diff options
1279 files changed, 0 insertions, 190978 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6266dddaa..46df0a301 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -256,22 +256,9 @@ add_subdirectory(grc) add_subdirectory(gr-fft) add_subdirectory(gr-filter) -add_subdirectory(gr-atsc) -add_subdirectory(gr-audio) add_subdirectory(gr-comedi) -add_subdirectory(gr-analog) -add_subdirectory(gr-digital) -add_subdirectory(gr-noaa) -add_subdirectory(gr-pager) add_subdirectory(gr-qtgui) -add_subdirectory(gr-trellis) -add_subdirectory(gr-uhd) -add_subdirectory(gr-shd) add_subdirectory(gr-utils) -add_subdirectory(gr-video-sdl) -add_subdirectory(gr-vocoder) -add_subdirectory(gr-fcd) -add_subdirectory(gr-wavelet) add_subdirectory(gr-wxgui) add_subdirectory(gr-blocks) diff --git a/gr-analog/CMakeLists.txt b/gr-analog/CMakeLists.txt deleted file mode 100644 index 4769ce7ac..000000000 --- a/gr-analog/CMakeLists.txt +++ /dev/null @@ -1,114 +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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) -GR_REGISTER_COMPONENT("gr-analog" ENABLE_GR_ANALOG - Boost_FOUND - ENABLE_VOLK - ENABLE_GR_CORE - ENABLE_GR_FFT - ENABLE_GR_FILTER -) - -GR_SET_GLOBAL(GR_ANALOG_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${CMAKE_CURRENT_BINARY_DIR}/include -) - -GR_SET_GLOBAL(GR_ANALOG_SWIG_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/swig -) - -SET(GR_PKG_ANALOG_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/analog) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_ANALOG) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_ANALOG_DESCRIPTION "GNU Radio Analog Blocks") - -CPACK_COMPONENT("analog_runtime" - GROUP "Analog" - DISPLAY_NAME "Runtime" - DESCRIPTION "Dynamic link libraries" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("analog_devel" - GROUP "Analog" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("analog_python" - GROUP "Analog" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime" - DEPENDS "core_python;analog_runtime" -) - -CPACK_COMPONENT("analog_swig" - GROUP "Analog" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;analog_python;analog_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(include/analog) -add_subdirectory(lib) -add_subdirectory(doc) -if(ENABLE_PYTHON) - add_subdirectory(swig) - add_subdirectory(python) - add_subdirectory(grc) - add_subdirectory(examples) -endif(ENABLE_PYTHON) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-analog.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-analog.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-analog.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "analog_devel" -) - -endif(ENABLE_GR_ANALOG) diff --git a/gr-analog/README b/gr-analog/README deleted file mode 100644 index 8c29ffde5..000000000 --- a/gr-analog/README +++ /dev/null @@ -1,4 +0,0 @@ -This GNU Radio component for implementing analog modulators, demodulators, and other related blocks. - - -FIXME: just fixme.
\ No newline at end of file diff --git a/gr-analog/doc/CMakeLists.txt b/gr-analog/doc/CMakeLists.txt deleted file mode 100644 index 5a02547db..000000000 --- a/gr-analog/doc/CMakeLists.txt +++ /dev/null @@ -1,23 +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. - -install( - FILES README.analog - DESTINATION ${GR_PKG_DOC_DIR} -) diff --git a/gr-analog/doc/README.analog b/gr-analog/doc/README.analog deleted file mode 100644 index b2b763cc3..000000000 --- a/gr-analog/doc/README.analog +++ /dev/null @@ -1,13 +0,0 @@ -This is the gr-analog package. It contains all of the analog -modulation blocks, utilities, and examples. To use the analog blocks, -the Python namespaces is in gnuradio.analog, which would be normally -imported as: - - from gnuradio import analog - -See the Doxygen documentation for details about the blocks available -in this package. A quick listing of the details can be found in Python -after importing by using: - - help(analog) - diff --git a/gr-analog/doc/analog.dox b/gr-analog/doc/analog.dox deleted file mode 100644 index d3af364f7..000000000 --- a/gr-analog/doc/analog.dox +++ /dev/null @@ -1,23 +0,0 @@ -/*! \page page_analog Analog Modulation - -\section Introduction -This is the gr-analog package. It contains all of the analog -modulation blocks, utilities, and examples. To use the analog blocks, -the Python namespaces is in gnuradio.analog, which would be normally -imported as: - -\code - from gnuradio import analog -\endcode - -See the Doxygen documentation for details about the blocks available -in this package. The relevant blocks are listed in the \ref analog group. - -A quick listing of the details can be found in Python after importing -by using: - -\code - help(analog) -\endcode - -*/ diff --git a/gr-analog/examples/CMakeLists.txt b/gr-analog/examples/CMakeLists.txt deleted file mode 100644 index 947600986..000000000 --- a/gr-analog/examples/CMakeLists.txt +++ /dev/null @@ -1,26 +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. - -include(GrPython) - -# Base stuff -GR_PYTHON_INSTALL(PROGRAMS - DESTINATION ${GR_PKG_ANALOG_EXAMPLES_DIR} - COMPONENT "analog_python" -) diff --git a/gr-analog/gnuradio-analog.pc.in b/gr-analog/gnuradio-analog.pc.in deleted file mode 100644 index 675c7ee20..000000000 --- a/gr-analog/gnuradio-analog.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-analog -Description: GNU Radio blocks for analog communications -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-analog -Cflags: -I${includedir} diff --git a/gr-analog/grc/CMakeLists.txt b/gr-analog/grc/CMakeLists.txt deleted file mode 100644 index 908ef0ed3..000000000 --- a/gr-analog/grc/CMakeLists.txt +++ /dev/null @@ -1,21 +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. - -file(GLOB xml_files "*.xml") -install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "analog_python") diff --git a/gr-analog/grc/analog_agc2_xx.xml b/gr-analog/grc/analog_agc2_xx.xml deleted file mode 100644 index e57666873..000000000 --- a/gr-analog/grc/analog_agc2_xx.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##AGC2 -################################################### - --> -<block> - <name>AGC2</name> - <key>analog_agc2_xx</key> - <import>from gnuradio import analog</import> - <make>analog.agc2_$(type.fcn)($attack_rate, $decay_rate, $reference, $gain, $max_gain)</make> - <callback>set_attack_rate($attack_rate)</callback> - <callback>set_decay_rate($decay_rate)</callback> - <callback>set_reference($reference)</callback> - <callback>set_gain($gain)</callback> - <callback>set_max_gain($max_gain)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:cc</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:ff</opt> - </option> - </param> - <param> - <name>Attack Rate</name> - <key>attack_rate</key> - <value>1e-1</value> - <type>real</type> - </param> - <param> - <name>Decay Rate</name> - <key>decay_rate</key> - <value>1e-2</value> - <type>real</type> - </param> - <param> - <name>Reference</name> - <key>reference</key> - <value>1.0</value> - <type>real</type> - </param> - <param> - <name>Gain</name> - <key>gain</key> - <value>1.0</value> - <type>real</type> - </param> - <param> - <name>Max Gain</name> - <key>max_gain</key> - <value>0.0</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>$type</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - </source> -</block> diff --git a/gr-analog/grc/analog_agc_xx.xml b/gr-analog/grc/analog_agc_xx.xml deleted file mode 100644 index 46797bff9..000000000 --- a/gr-analog/grc/analog_agc_xx.xml +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##AGC -################################################### - --> -<block> - <name>AGC</name> - <key>analog_agc_xx</key> - <import>from gnuradio import analog</import> - <make>analog.agc_$(type.fcn)($rate, $reference, $gain, $max_gain)</make> - <callback>set_rate($rate)</callback> - <callback>set_reference($reference)</callback> - <callback>set_gain($gain)</callback> - <callback>set_max_gain($max_gain)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:cc</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:ff</opt> - </option> - </param> - <param> - <name>Rate</name> - <key>rate</key> - <value>1e-4</value> - <type>real</type> - </param> - <param> - <name>Reference</name> - <key>reference</key> - <value>1.0</value> - <type>real</type> - </param> - <param> - <name>Gain</name> - <key>gain</key> - <value>1.0</value> - <type>real</type> - </param> - <param> - <name>Max Gain</name> - <key>max_gain</key> - <value>0.0</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>$type</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - </source> -</block> diff --git a/gr-analog/grc/analog_block_tree.xml b/gr-analog/grc/analog_block_tree.xml deleted file mode 100644 index b5b2ecd56..000000000 --- a/gr-analog/grc/analog_block_tree.xml +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.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. ---> - -<!-- -################################################### -##Block Tree for GR Analog blocks. -################################################### - --> -<cat> - <name></name> <!-- Blank for Root Name --> - <cat> - <name>Level Controls</name> - <block>analog_agc_xx</block> - <block>analog_agc2_xx</block> - <block>analog_dpll_bb</block> - <block>analog_feedforward_agc_cc</block> - <block>analog_ctcss_squelch_ff</block> - <block>analog_pwr_squelch_xx</block> - <block>analog_simple_squelch_cc</block> - <block>analog_rail_ff</block> - </cat> - <cat> - <name>Modulators</name> - <block>analog_cpfsk_bc</block> - <block>analog_frequency_modulator_fc</block> - <block>analog_phase_modulator_fc</block> - <block>analog_quadrature_demod_cf</block> - </cat> - <cat> - <name>Sources</name> - <block>analog_sig_source_x</block> - <block>analog_noise_source_x</block> - </cat> - <cat> - <name>Synchronizers</name> - <block>analog_pll_carriertracking_cc</block> - <block>analog_pll_freqdet_cf</block> - <block>analog_pll_refout_cc</block> - </cat> - <cat> - <name>Probes</name> - <block>analog_probe_avg_mag_sqrd_x</block> - </cat> -</cat> diff --git a/gr-analog/grc/analog_cpfsk_bc.xml b/gr-analog/grc/analog_cpfsk_bc.xml deleted file mode 100644 index 7eb85a2ec..000000000 --- a/gr-analog/grc/analog_cpfsk_bc.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##CPFSK -################################################### - --> -<block> - <name>CPFSK</name> - <key>analog_cpfsk_bc</key> - <import>from gnuradio import analog</import> - <make>analog.cpfsk_bc($k, $amplitude, $samples_per_symbol)</make> - <callback>set_amplitude($amplitude)</callback> - <param> - <name>K</name> - <key>k</key> - <type>real</type> - </param> - <param> - <name>Amplitude</name> - <key>amplitude</key> - <type>real</type> - </param> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-analog/grc/analog_ctcss_squelch_ff.xml b/gr-analog/grc/analog_ctcss_squelch_ff.xml deleted file mode 100644 index 9585835e2..000000000 --- a/gr-analog/grc/analog_ctcss_squelch_ff.xml +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0"?> -<!-- -# -# Copyright 2011 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. ---> - -<!-- -################################################### -##CTCSS Squelch -################################################### - --> -<block> - <name>CTCSS Squelch</name> - <key>analog_ctcss_squelch_ff</key> - <import>from gnuradio import analog</import> - <make>analog.ctcss_squelch_ff($rate, $freq, $level, $len, $ramp, $gate)</make> - <callback>set_level($level)</callback> - <param> - <name>Sampling Rate (Hz)</name> - <key>rate</key> - <value>samp_rate</value> - <type>real</type> - </param> - <param> - <name>Tone Frequency</name> - <key>freq</key> - <value>100.0</value> - <type>real</type> - </param> - <param> - <name>Level</name> - <key>level</key> - <value>0.01</value> - <type>real</type> - </param> - <param> - <name>Length</name> - <key>len</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Ramp</name> - <key>ramp</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Gate</name> - <key>gate</key> - <value>False</value> - <type>bool</type> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> -</block> diff --git a/gr-analog/grc/analog_dpll_bb.xml b/gr-analog/grc/analog_dpll_bb.xml deleted file mode 100644 index 65a489414..000000000 --- a/gr-analog/grc/analog_dpll_bb.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Detect Peak -################################################### - --> -<block> - <name>Detect Peak</name> - <key>analog_dpll_bb</key> - <import>from gnuradio import analog</import> - <make>analog.dpll_bb($period, $gain)</make> - <callback>set_gain($gain)</callback> - <param> - <name>Period</name> - <key>period</key> - <type>real</type> - </param> - <param> - <name>Gain</name> - <key>gain</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-analog/grc/analog_feedforward_agc_cc.xml b/gr-analog/grc/analog_feedforward_agc_cc.xml deleted file mode 100644 index 66d200a84..000000000 --- a/gr-analog/grc/analog_feedforward_agc_cc.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Feed Forward AGC -################################################### - --> -<block> - <name>Feed Forward AGC</name> - <key>analog_feedforward_agc_cc</key> - <import>from gnuradio import analog</import> - <make>analog.feedforward_agc_cc($num_samples, $reference)</make> - <param> - <name>Num Samples</name> - <key>num_samples</key> - <value>1024</value> - <type>int</type> - </param> - <param> - <name>Reference</name> - <key>reference</key> - <value>1.0</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-analog/grc/analog_frequency_modulator_fc.xml b/gr-analog/grc/analog_frequency_modulator_fc.xml deleted file mode 100644 index 3b6cd159a..000000000 --- a/gr-analog/grc/analog_frequency_modulator_fc.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Frequency Modulator -################################################### - --> -<block> - <name>Frequency Mod</name> - <key>analog_frequency_modulator_fc</key> - <import>from gnuradio import analog</import> - <make>analog.frequency_modulator_fc($sensitivity)</make> - <callback>set_sensitivity($sensitivity)</callback> - <param> - <name>Sensitivity</name> - <key>sensitivity</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-analog/grc/analog_noise_source_x.xml b/gr-analog/grc/analog_noise_source_x.xml deleted file mode 100644 index 5404e7896..000000000 --- a/gr-analog/grc/analog_noise_source_x.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Noise Source -################################################### - --> -<block> - <name>Noise Source</name> - <key>analog_noise_source_x</key> - <import>from gnuradio import analog</import> - <make>analog.noise_source_$(type.fcn)($noise_type, $amp, $seed)</make> - <callback>set_type($noise_type)</callback> - <callback>set_amplitude($amp)</callback> - <param> - <name>Output Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:c</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:f</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>fcn:i</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:s</opt> - </option> - </param> - <param> - <name>Noise Type</name> - <key>noise_type</key> - <value>analog.GR_GAUSSIAN</value> - <type>int</type> - <option> - <name>Uniform</name> - <key>analog.GR_UNIFORM</key> - </option> - <option> - <name>Gaussian</name> - <key>analog.GR_GAUSSIAN</key> - </option> - <option> - <name>Laplacian</name> - <key>analog.GR_LAPLACIAN</key> - </option> - <option> - <name>Impulse</name> - <key>analog.GR_IMPULSE</key> - </option> - </param> - <param> - <name>Amplitude</name> - <key>amp</key> - <value>1</value> - <type>real</type> - </param> - <param> - <name>Seed</name> - <key>seed</key> - <value>0</value> - <type>int</type> - </param> - <source> - <name>out</name> - <type>$type</type> - </source> -</block> diff --git a/gr-analog/grc/analog_phase_modulator_fc.xml b/gr-analog/grc/analog_phase_modulator_fc.xml deleted file mode 100644 index c13af769c..000000000 --- a/gr-analog/grc/analog_phase_modulator_fc.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Phase Modulator -################################################### - --> -<block> - <name>Phase Mod</name> - <key>analog_phase_modulator_fc</key> - <import>from gnuradio import analog</import> - <make>analog.phase_modulator_fc($sensitivity)</make> - <callback>set_sensitivity($sensitivity)</callback> - <param> - <name>Sensitivity</name> - <key>sensitivity</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-analog/grc/analog_pll_carriertracking_cc.xml b/gr-analog/grc/analog_pll_carriertracking_cc.xml deleted file mode 100644 index 95ec4b415..000000000 --- a/gr-analog/grc/analog_pll_carriertracking_cc.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##PLL Carrier Tracking -################################################### - --> -<block> - <name>PLL Carrier Tracking</name> - <key>analog_pll_carriertracking_cc</key> - <import>from gnuradio import analog</import> - <make>analog.pll_carriertracking_cc($w, $max_freq, $min_freq)</make> - <callback>set_loop_bandwidth($w)</callback> - <callback>set_max_freq($max_freq)</callback> - <callback>set_min_freq($min_freq)</callback> - <param> - <name>Loop Bandwidth</name> - <key>w</key> - <type>real</type> - </param> - <param> - <name>Max Freq</name> - <key>max_freq</key> - <type>real</type> - </param> - <param> - <name>Min Freq</name> - <key>min_freq</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-analog/grc/analog_pll_freqdet_cf.xml b/gr-analog/grc/analog_pll_freqdet_cf.xml deleted file mode 100644 index 0d44c160b..000000000 --- a/gr-analog/grc/analog_pll_freqdet_cf.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##PLL Frequency Det -################################################### - --> -<block> - <name>PLL Freq Det</name> - <key>analog_pll_freqdet_cf</key> - <import>from gnuradio import analog</import> - <make>analog.pll_freqdet_cf($w, $max_freq, $min_freq)</make> - <callback>set_loop_bandwidth($w)</callback> - <callback>set_max_freq($max_freq)</callback> - <callback>set_min_freq($min_freq)</callback> - <param> - <name>Loop Bandwidth</name> - <key>w</key> - <type>real</type> - </param> - <param> - <name>Max Freq</name> - <key>max_freq</key> - <type>real</type> - </param> - <param> - <name>Min Freq</name> - <key>min_freq</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> -</block> diff --git a/gr-analog/grc/analog_pll_refout_cc.xml b/gr-analog/grc/analog_pll_refout_cc.xml deleted file mode 100644 index eb2d752b2..000000000 --- a/gr-analog/grc/analog_pll_refout_cc.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##PLL Reference Out -################################################### - --> -<block> - <name>PLL Ref Out</name> - <key>analog_pll_refout_cc</key> - <import>from gnuradio import analog</import> - <make>analog.pll_refout_cc($w, $max_freq, $min_freq)</make> - <callback>set_loop_bandwidth($w)</callback> - <callback>set_max_freq($max_freq)</callback> - <callback>set_min_freq($min_freq)</callback> - <param> - <name>Loop Bandwidth</name> - <key>w</key> - <type>real</type> - </param> - <param> - <name>Max Freq</name> - <key>max_freq</key> - <type>real</type> - </param> - <param> - <name>Min Freq</name> - <key>min_freq</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml b/gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml deleted file mode 100644 index b05ac6d0d..000000000 --- a/gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Probe Average Magnitude Squared -################################################### - --> -<block> - <name>Probe Avg Mag^2</name> - <key>analog_probe_avg_mag_sqrd_x</key> - <import>from gnuradio import analog</import> - <make>analog.probe_avg_mag_sqrd_$(type)($threshold, $alpha)</make> - <callback>set_alpha($alpha)</callback> - <callback>set_threshold($threshold)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>c</key> - <opt>input:complex</opt> - </option> - <option> - <name>Float</name> - <key>f</key> - <opt>input:float</opt> - </option> - </param> - <param> - <name>Threshold (dB)</name> - <key>threshold</key> - <value>0</value> - <type>real</type> - </param> - <param> - <name>Alpha</name> - <key>alpha</key> - <value>1</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>$type.input</type> - </sink> - <doc> -Available functions to probe: level() - -Use with the function probe block. - </doc> -</block> diff --git a/gr-analog/grc/analog_pwr_squelch_xx.xml b/gr-analog/grc/analog_pwr_squelch_xx.xml deleted file mode 100644 index 32d9c0e94..000000000 --- a/gr-analog/grc/analog_pwr_squelch_xx.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Power Squelch -################################################### - --> -<block> - <name>Power Squelch</name> - <key>analog_pwr_squelch_xx</key> - <import>from gnuradio import analog</import> - <make>analog.pwr_squelch_$(type.fcn)($threshold, $alpha, $ramp, $gate)</make> - <callback>set_threshold($threshold)</callback> - <callback>set_alpha($alpha)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:cc</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:ff</opt> - </option> - </param> - <param> - <name>Threshold (dB)</name> - <key>threshold</key> - <type>real</type> - </param> - <param> - <name>Alpha</name> - <key>alpha</key> - <type>real</type> - </param> - <param> - <name>Ramp</name> - <key>ramp</key> - <type>int</type> - </param> - <param> - <name>Gate</name> - <key>gate</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <sink> - <name>in</name> - <type>$type</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - </source> -</block> diff --git a/gr-analog/grc/analog_quadrature_demod_cf.xml b/gr-analog/grc/analog_quadrature_demod_cf.xml deleted file mode 100644 index a60653135..000000000 --- a/gr-analog/grc/analog_quadrature_demod_cf.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Quadrature Demodulator -################################################### - --> -<block> - <name>Quadrature Demod</name> - <key>analog_quadrature_demod_cf</key> - <import>from gnuradio import analog</import> - <make>analog.quadrature_demod_cf($gain)</make> - <callback>set_gain($gain)</callback> - <param> - <name>Gain</name> - <key>gain</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> -</block> diff --git a/gr-analog/grc/analog_rail_ff.xml b/gr-analog/grc/analog_rail_ff.xml deleted file mode 100644 index 87dff0977..000000000 --- a/gr-analog/grc/analog_rail_ff.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.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. ---> - -<!-- -################################################### -##Rail -################################################### - --> -<block> - <name>Rail</name> - <key>analog_rail_ff</key> - <import>from gnuradio import analog</import> - <make>analog.rail_ff($lo, $hi)</make> - <callback>set_lo($lo)</callback> - <callback>set_hi($hi)</callback> - <param> - <name>Low clipping</name> - <key>lo</key> - <type>real</type> - </param> - <param> - <name>Hi clipping</name> - <key>hi</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> -</block> diff --git a/gr-analog/grc/analog_sig_source_x.xml b/gr-analog/grc/analog_sig_source_x.xml deleted file mode 100644 index b2cd8ad43..000000000 --- a/gr-analog/grc/analog_sig_source_x.xml +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Signal Source -################################################### - --> -<block> - <name>Signal Source</name> - <key>analog_sig_source_x</key> - <import>from gnuradio import analog</import> - <make>analog.sig_source_$(type.fcn)($samp_rate, $waveform, $freq, $amp, $offset)</make> - <callback>set_sampling_freq($samp_rate)</callback> - <callback>set_waveform($waveform)</callback> - <callback>set_frequency($freq)</callback> - <callback>set_amplitude($amp)</callback> - <callback>set_offset($offset)</callback> - <param> - <name>Output Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:c</opt> - <opt>offset_type:complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:f</opt> - <opt>offset_type:real</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>fcn:i</opt> - <opt>offset_type:int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:s</opt> - <opt>offset_type:int</opt> - </option> - </param> - <param> - <name>Sample Rate</name> - <key>samp_rate</key> - <value>samp_rate</value> - <type>real</type> - </param> - <param> - <name>Waveform</name> - <key>waveform</key> - <value>analog.GR_COS_WAVE</value> - <type>int</type> - <option> - <name>Constant</name> - <key>analog.GR_CONST_WAVE</key> - </option> - <option> - <name>Sine</name> - <key>analog.GR_SIN_WAVE</key> - </option> - <option> - <name>Cosine</name> - <key>analog.GR_COS_WAVE</key> - </option> - <option> - <name>Square</name> - <key>analog.GR_SQR_WAVE</key> - </option> - <option> - <name>Triangle</name> - <key>analog.GR_TRI_WAVE</key> - </option> - <option> - <name>Saw Tooth</name> - <key>analog.GR_SAW_WAVE</key> - </option> - </param> - <param> - <name>Frequency</name> - <key>freq</key> - <value>1000</value> - <type>real</type> - </param> - <param> - <name>Amplitude</name> - <key>amp</key> - <value>1</value> - <type>real</type> - </param> - <param> - <name>Offset</name> - <key>offset</key> - <value>0</value> - <type>$type.offset_type</type> - </param> - <source> - <name>out</name> - <type>$type</type> - </source> -</block> diff --git a/gr-analog/grc/analog_simple_squelch_cc.xml b/gr-analog/grc/analog_simple_squelch_cc.xml deleted file mode 100644 index 648921a14..000000000 --- a/gr-analog/grc/analog_simple_squelch_cc.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Simple Squelch -################################################### - --> -<block> - <name>Simple Squelch</name> - <key>analog_simple_squelch_cc</key> - <import>from gnuradio import analog</import> - <make>analog.simple_squelch_cc($threshold, $alpha)</make> - <callback>set_threshold($threshold)</callback> - <callback>set_alpha($alpha)</callback> - <param> - <name>Threshold (dB)</name> - <key>threshold</key> - <type>real</type> - </param> - <param> - <name>Alpha</name> - <key>alpha</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-analog/include/analog/CMakeLists.txt b/gr-analog/include/analog/CMakeLists.txt deleted file mode 100644 index b113dacc4..000000000 --- a/gr-analog/include/analog/CMakeLists.txt +++ /dev/null @@ -1,112 +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. - -######################################################################## -# generate helper scripts to expand templated files -######################################################################## -include(GrPython) - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " -#!${PYTHON_EXECUTABLE} - -import sys, os, re -sys.path.append('${GR_CORE_PYTHONPATH}') -os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.chdir('${CMAKE_CURRENT_BINARY_DIR}') - -if __name__ == '__main__': - import build_utils - root, inp = sys.argv[1:3] - for sig in sys.argv[3:]: - name = re.sub ('X+', sig, root) - d = build_utils.standard_dict2(name, sig, 'analog') - build_utils.expand_template(d, inp) - -") - -macro(expand_h root) - #make a list of all the generated files - unset(expanded_files_h) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) - endforeach(sig) - - #create a command to generate the files - add_custom_command( - OUTPUT ${expanded_files_h} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.h.t ${ARGN} - ) - - #install rules for the generated h files - list(APPEND generated_includes ${expanded_files_h}) -endmacro(expand_h) - -######################################################################## -# Invoke macro to generate various sources -####################################################################### -expand_h(noise_source_X s i f c) -expand_h(sig_source_X s i f c) - -add_custom_target(analog_generated_includes DEPENDS - ${generated_includes} -) - -######################################################################## -# Install header files -######################################################################## -install(FILES - ${generated_includes} - api.h - cpm.h - agc.h - agc2.h - noise_type.h - squelch_base_ff.h - agc_cc.h - agc_ff.h - agc2_cc.h - agc2_ff.h - cpfsk_bc.h - ctcss_squelch_ff.h - dpll_bb.h - feedforward_agc_cc.h - fmdet_cf.h - frequency_modulator_fc.h - phase_modulator_fc.h - pll_carriertracking_cc.h - pll_freqdet_cf.h - pll_refout_cc.h - probe_avg_mag_sqrd_c.h - probe_avg_mag_sqrd_cf.h - probe_avg_mag_sqrd_f.h - pwr_squelch_cc.h - pwr_squelch_ff.h - quadrature_demod_cf.h - rail_ff.h - rotator.h - sig_source_waveform.h - simple_squelch_cc.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/analog - COMPONENT "analog_devel" -) - diff --git a/gr-analog/include/analog/agc.h b/gr-analog/include/analog/agc.h deleted file mode 100644 index 92d777fa1..000000000 --- a/gr-analog/include/analog/agc.h +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_AGC_H -#define INCLUDED_ANALOG_AGC_H - -#include <analog/api.h> -#include <gr_complex.h> -#include <math.h> - -namespace gr { - namespace analog { - namespace kernel { - - /*! - * \brief high performance Automatic Gain Control class for complex signals. - * - * For Power the absolute value of the complex number is used. - */ - class ANALOG_API agc_cc - { - public: - agc_cc(float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _rate(rate), _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - virtual ~agc_cc() {}; - - float rate() const { return _rate; } - float reference() const { return _reference; } - float gain() const { return _gain; } - float max_gain() const { return _max_gain; } - - void set_rate(float rate) { _rate = rate; } - void set_reference(float reference) { _reference = reference; } - void set_gain(float gain) { _gain = gain; } - void set_max_gain(float max_gain) { _max_gain = max_gain; } - - gr_complex scale(gr_complex input) - { - gr_complex output = input * _gain; - - _gain += _rate * (_reference - sqrt(output.real()*output.real() + - output.imag()*output.imag())); - if(_max_gain > 0.0 && _gain > _max_gain) { - _gain = _max_gain; - } - return output; - } - - void scaleN(gr_complex output[], const gr_complex input[], unsigned n) - { - for(unsigned i = 0; i < n; i++) { - output[i] = scale (input[i]); - } - } - - protected: - float _rate; // adjustment rate - float _reference; // reference value - float _gain; // current gain - float _max_gain; // max allowable gain - }; - - /*! - * \brief high performance Automatic Gain Control class for float signals. - * - * Power is approximated by absolute value - */ - class ANALOG_API agc_ff - { - public: - agc_ff(float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _rate(rate), _reference(reference), _gain(gain), - _max_gain(max_gain) {}; - - ~agc_ff() {}; - - float rate () const { return _rate; } - float reference () const { return _reference; } - float gain () const { return _gain; } - float max_gain () const { return _max_gain; } - - void set_rate (float rate) { _rate = rate; } - void set_reference (float reference) { _reference = reference; } - void set_gain (float gain) { _gain = gain; } - void set_max_gain (float max_gain) { _max_gain = max_gain; } - - float scale (float input) - { - float output = input * _gain; - _gain += (_reference - fabsf (output)) * _rate; - if(_max_gain > 0.0 && _gain > _max_gain) - _gain = _max_gain; - return output; - } - - void scaleN(float output[], const float input[], unsigned n) - { - for(unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _rate; // adjustment rate - float _reference; // reference value - float _gain; // current gain - float _max_gain; // maximum gain - }; - - } /* namespace kernel */ - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_AGC_H */ diff --git a/gr-analog/include/analog/agc2.h b/gr-analog/include/analog/agc2.h deleted file mode 100644 index 75a203e9f..000000000 --- a/gr-analog/include/analog/agc2.h +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_AGC2_H -#define INCLUDED_ANALOG_AGC2_H - -#include <analog/api.h> -#include <gr_complex.h> -#include <math.h> - -namespace gr { - namespace analog { - namespace kernel { - - /*! - * \brief high performance Automatic Gain Control class - * - * For Power the absolute value of the complex number is used. - */ - class ANALOG_API agc2_cc - { - public: - agc2_cc(float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _attack_rate(attack_rate), _decay_rate(decay_rate), - _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - float decay_rate() const { return _decay_rate; } - float attack_rate() const { return _attack_rate; } - float reference() const { return _reference; } - float gain() const { return _gain; } - float max_gain() const { return _max_gain; } - - void set_decay_rate(float rate) { _decay_rate = rate; } - void set_attack_rate(float rate) { _attack_rate = rate; } - void set_reference(float reference) { _reference = reference; } - void set_gain(float gain) { _gain = gain; } - void set_max_gain(float max_gain) { _max_gain = max_gain; } - - gr_complex scale(gr_complex input) - { - gr_complex output = input * _gain; - - float tmp = -_reference + sqrt(output.real()*output.real() + - output.imag()*output.imag()); - float rate = _decay_rate; - if((tmp) > _gain) { - rate = _attack_rate; - } - _gain -= tmp*rate; - - // Not sure about this; will blow up if _gain < 0 (happens - // when rates are too high), but is this the solution? - if(_gain < 0.0) - _gain = 10e-5; - - if(_max_gain > 0.0 && _gain > _max_gain) { - _gain = _max_gain; - } - return output; - } - - void scaleN(gr_complex output[], const gr_complex input[], unsigned n) - { - for(unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _attack_rate; // attack rate for fast changing signals - float _decay_rate; // decay rate for slow changing signals - float _reference; // reference value - float _gain; // current gain - float _max_gain; // max allowable gain - }; - - - class ANALOG_API agc2_ff - { - public: - agc2_ff(float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _attack_rate(attack_rate), _decay_rate(decay_rate), - _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - float attack_rate() const { return _attack_rate; } - float decay_rate() const { return _decay_rate; } - float reference() const { return _reference; } - float gain() const { return _gain; } - float max_gain() const { return _max_gain; } - - void set_attack_rate(float rate) { _attack_rate = rate; } - void set_decay_rate(float rate) { _decay_rate = rate; } - void set_reference(float reference) { _reference = reference; } - void set_gain(float gain) { _gain = gain; } - void set_max_gain(float max_gain) { _max_gain = max_gain; } - - float scale(float input) - { - float output = input * _gain; - - float tmp = (fabsf(output)) - _reference; - float rate = _decay_rate; - if(fabsf(tmp) > _gain) { - rate = _attack_rate; - } - _gain -= tmp*rate; - - // Not sure about this - if(_gain < 0.0) - _gain = 10e-5; - - if(_max_gain > 0.0 && _gain > _max_gain) { - _gain = _max_gain; - } - return output; - } - - void scaleN(float output[], const float input[], unsigned n) - { - for(unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _attack_rate; // attack_rate for fast changing signals - float _decay_rate; // decay rate for slow changing signals - float _reference; // reference value - float _gain; // current gain - float _max_gain; // maximum gain - }; - - } /* namespace kernel */ - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_AGC2_H */ diff --git a/gr-analog/include/analog/agc2_cc.h b/gr-analog/include/analog/agc2_cc.h deleted file mode 100644 index c922ccd4d..000000000 --- a/gr-analog/include/analog/agc2_cc.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_AGC2_CC_H -#define INCLUDED_ANALOG_AGC2_CC_H - -#include <analog/api.h> -#include <analog/agc2.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * For Power the absolute value of the complex number is used. - */ - class ANALOG_API agc2_cc : virtual public gr_sync_block - { - public: - // gr::analog::agc2_cc::sptr - typedef boost::shared_ptr<agc2_cc> sptr; - - static sptr make(float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - - virtual float attack_rate() const = 0; - virtual float decay_rate() const = 0; - virtual float reference() const = 0; - virtual float gain() const = 0; - virtual float max_gain() const = 0; - - virtual void set_attack_rate(float rate) = 0; - virtual void set_decay_rate(float rate) = 0; - virtual void set_reference(float reference) = 0; - virtual void set_gain(float gain) = 0; - virtual void set_max_gain(float max_gain) = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_AGC2_CC_H */ diff --git a/gr-analog/include/analog/agc2_ff.h b/gr-analog/include/analog/agc2_ff.h deleted file mode 100644 index 27dd6d92e..000000000 --- a/gr-analog/include/analog/agc2_ff.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_ANALOG_AGC2_FF_H -#define INCLUDED_ANALOG_AGC2_FF_H - -#include <analog/api.h> -#include <analog/agc2.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief high performance Automatic Gain Control class - * - * \ingroup level_blk - * Power is approximated by absolute value - */ - class ANALOG_API agc2_ff : virtual public gr_sync_block - { - public: - // gr::analog::agc2_ff::sptr - typedef boost::shared_ptr<agc2_ff> sptr; - - static sptr make(float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - - virtual float attack_rate() const = 0; - virtual float decay_rate() const = 0; - virtual float reference() const = 0; - virtual float gain() const = 0; - virtual float max_gain() const = 0; - - virtual void set_attack_rate(float rate) = 0; - virtual void set_decay_rate(float rate) = 0; - virtual void set_reference(float reference) = 0; - virtual void set_gain(float gain) = 0; - virtual void set_max_gain(float max_gain) = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_AGC2_FF_H */ diff --git a/gr-analog/include/analog/agc_cc.h b/gr-analog/include/analog/agc_cc.h deleted file mode 100644 index b2b1a9b43..000000000 --- a/gr-analog/include/analog/agc_cc.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_AGC_CC_H -#define INCLUDED_ANALOG_AGC_CC_H - -#include <analog/api.h> -#include <analog/agc.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * For Power the absolute value of the complex number is used. - */ - class ANALOG_API agc_cc : virtual public gr_sync_block - { - public: - // gr::analog::agc_cc::sptr - typedef boost::shared_ptr<agc_cc> sptr; - - static sptr make(float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - - virtual float rate() const = 0; - virtual float reference() const = 0; - virtual float gain() const = 0; - virtual float max_gain() const = 0; - - virtual void set_rate(float rate) = 0; - virtual void set_reference(float reference) = 0; - virtual void set_gain(float gain) = 0; - virtual void set_max_gain(float max_gain) = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_AGC_CC_H */ diff --git a/gr-analog/include/analog/agc_ff.h b/gr-analog/include/analog/agc_ff.h deleted file mode 100644 index 30d1ae1fd..000000000 --- a/gr-analog/include/analog/agc_ff.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_ANALOG_AGC_FF_H -#define INCLUDED_ANALOG_AGC_FF_H - -#include <analog/api.h> -#include <analog/agc.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * Power is approximated by absolute value - */ - class ANALOG_API agc_ff : virtual public gr_sync_block - { - public: - // gr::analog::agc_ff::sptr - typedef boost::shared_ptr<agc_ff> sptr; - - static sptr make(float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - - virtual float rate() const = 0; - virtual float reference() const = 0; - virtual float gain() const = 0; - virtual float max_gain() const = 0; - - virtual void set_rate(float rate) = 0; - virtual void set_reference(float reference) = 0; - virtual void set_gain(float gain) = 0; - virtual void set_max_gain(float max_gain) = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_AGC_FF_H */ diff --git a/gr-analog/include/analog/api.h b/gr-analog/include/analog/api.h deleted file mode 100644 index b7dee4693..000000000 --- a/gr-analog/include/analog/api.h +++ /dev/null @@ -1,33 +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. - */ - -#ifndef INCLUDED_ANALOG_API_H -#define INCLUDED_ANALOG_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_analog_EXPORTS -# define ANALOG_API __GR_ATTR_EXPORT -#else -# define ANALOG_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_ANALOG_API_H */ diff --git a/gr-analog/include/analog/cpfsk_bc.h b/gr-analog/include/analog/cpfsk_bc.h deleted file mode 100644 index 904730e2b..000000000 --- a/gr-analog/include/analog/cpfsk_bc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2012 Free Software Foundation, Inc. - * - * 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 INCLUDED_ANALOG_CPFSK_BC_H -#define INCLUDED_ANALOG_CPFSK_BC_H - -#include <analog/api.h> -#include <gr_sync_interpolator.h> - -namespace gr { - namespace analog { - - /*! - * \brief Perform continuous phase 2-level frequency shift keying modulation - * on an input stream of unpacked bits. - * \ingroup modulation_blk - */ - class ANALOG_API cpfsk_bc : virtual public gr_sync_interpolator - { - public: - // gr::analog::cpfsk_bc::sptr - typedef boost::shared_ptr<cpfsk_bc> sptr; - - /*! - * \brief Make a CPFSK block. - * - * \param k modulation index - * \param ampl output amplitude - * \param samples_per_sym number of output samples per input bit - */ - static sptr make(float k, float ampl, int samples_per_sym); - - virtual void set_amplitude(float amplitude) = 0; - virtual float amplitude() = 0; - virtual float freq() = 0; - virtual float phase() = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_CPFSK_BC_H */ diff --git a/gr-analog/include/analog/cpm.h b/gr-analog/include/analog/cpm.h deleted file mode 100644 index d22e02321..000000000 --- a/gr-analog/include/analog/cpm.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010,2012 Free Software Foundation, Inc. - * - * 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 INCLUDED_ANALOG_CPM_H -#define INCLUDED_ANALOG_CPM_H - -#include <analog/api.h> -#include <vector> - -namespace gr { - namespace analog { - - class ANALOG_API cpm - { - public: - enum cpm_type { - LRC, - LSRC, - LREC, - TFM, - GAUSSIAN, - GENERIC = 999 - }; - - /*! \brief Return the taps for an interpolating FIR filter (gr_interp_fir_filter_fff). - * - * These taps represent the phase response \f$g(k)\f$ for use in a CPM modulator, - * see also gr_cpmmod_bc. - * - * \param type The CPM type (Rectangular, Raised Cosine, Spectral Raised Cosine, - * Tamed FM or Gaussian). - * \param samples_per_sym Samples per symbol. - * \param L The length of the phase response in symbols. - * \param beta For Spectral Raised Cosine, this is the rolloff factor. For Gaussian - * phase responses, this the 3dB-time-bandwidth product. For all other - * cases, it is ignored. - * - * Output: returns a vector of length \a K = \p samples_per_sym x \p L. - * This can be used directly in an interpolating FIR filter such as - * gr_interp_fir_filter_fff with interpolation factor \p samples_per_sym. - * - * All phase responses are normalised s.t. \f$ \sum_{k=0}^{K-1} g(k) = 1\f$; this will cause - * a maximum phase change of \f$ h \cdot \pi\f$ between two symbols, where \a h is the - * modulation index. - * - * The following phase responses can be generated: - * - LREC: Rectangular phase response. - * - LRC: Raised cosine phase response, looks like 1 - cos(x). - * - LSRC: Spectral raised cosine. This requires a rolloff factor beta. - * The phase response is the Fourier transform of raised cosine - * function. - * - TFM: Tamed frequency modulation. This scheme minimizes phase change for - * rapidly varying input symbols. - * - GAUSSIAN: A Gaussian phase response. For a modulation index h = 1/2, this - * results in GMSK. - * - * A short description of all these phase responses can be found in [1]. - * - * [1]: Anderson, Aulin and Sundberg; Digital Phase Modulation - */ - static std::vector<float> - phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta=0.3); - }; - } // namespace analog -} // namespace gr - -#endif /* INCLUDED_ANALOG_CPM_H */ - diff --git a/gr-analog/include/analog/ctcss_squelch_ff.h b/gr-analog/include/analog/ctcss_squelch_ff.h deleted file mode 100644 index f88029917..000000000 --- a/gr-analog/include/analog/ctcss_squelch_ff.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_CTCSS_SQUELCH_FF_H -#define INCLUDED_ANALOG_CTCSS_SQUELCH_FF_H - -#include <analog/api.h> -#include <analog/squelch_base_ff.h> -#include <gr_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief gate or zero output if ctcss tone not present - * \ingroup level_blk - */ - class ANALOG_API ctcss_squelch_ff : - public squelch_base_ff, virtual public gr_block - { - protected: - virtual void update_state(const float &in) = 0; - virtual bool mute() const = 0; - - public: - // gr::analog::ctcss_squelch_ff::sptr - typedef boost::shared_ptr<ctcss_squelch_ff> sptr; - - /*! - * \brief Make CTCSS tone squelch block. - */ - static sptr make(int rate, float freq, float level, - int len, int ramp, bool gate); - - virtual std::vector<float> squelch_range() const = 0; - virtual float level() const = 0; - virtual void set_level(float level) = 0; - virtual int len() const = 0; - - virtual int ramp() const = 0; - virtual void set_ramp(int ramp) = 0; - virtual bool gate() const = 0; - virtual void set_gate(bool gate) = 0; - virtual bool unmuted() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_CTCSS_SQUELCH_FF_H */ diff --git a/gr-analog/include/analog/dpll_bb.h b/gr-analog/include/analog/dpll_bb.h deleted file mode 100644 index 78efb8fde..000000000 --- a/gr-analog/include/analog/dpll_bb.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,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 INCLUDED_ANALOG_DPLL_BB_H -#define INCLUDED_ANALOG_DPLL_BB_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief Detect the peak of a signal - * \ingroup level_blk - * - * If a peak is detected, this block outputs a 1, - * or it outputs 0's. - */ - class ANALOG_API dpll_bb : virtual public gr_sync_block - { - public: - // gr::analog::dpll_bb::sptr - typedef boost::shared_ptr<dpll_bb> sptr; - - static sptr make(float period, float gain); - - virtual void set_gain(float gain) = 0; - virtual void set_decision_threshold(float thresh) = 0; - - virtual float gain() const = 0; - virtual float freq() const = 0; - virtual float phase() const = 0; - virtual float decision_threshold() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_DPLL_BB_H */ diff --git a/gr-analog/include/analog/feedforward_agc_cc.h b/gr-analog/include/analog/feedforward_agc_cc.h deleted file mode 100644 index 9e259a4eb..000000000 --- a/gr-analog/include/analog/feedforward_agc_cc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_H -#define INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief Non-causal AGC which computes required gain based on max absolute value over nsamples - * \ingroup level_blk - */ - class ANALOG_API feedforward_agc_cc : virtual public gr_sync_block - { - public: - // gr::analog::feedforward_agc_cc::sptr - typedef boost::shared_ptr<feedforward_agc_cc> sptr; - - static sptr make(int nsamples, float reference); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_GR_FEEDFORWARD_AGC_CC_H */ diff --git a/gr-analog/include/analog/fmdet_cf.h b/gr-analog/include/analog/fmdet_cf.h deleted file mode 100644 index 6878775e6..000000000 --- a/gr-analog/include/analog/fmdet_cf.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 INCLUDED_ANALOG_FMDET_CF_H -#define INCLUDED_ANALOG_FMDET_CF_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief Implements an IQ slope detector - * - * input: stream of complex; output: stream of floats - * - * This implements a limiting slope detector. The limiter is in - * the normalization by the magnitude of the sample - */ - class ANALOG_API fmdet_cf : virtual public gr_sync_block - { - public: - // gr::analog::fmdet_cf::sptr - typedef boost::shared_ptr<fmdet_cf> sptr; - - /*! - * \brief Make FM detector block. - * - * \param samplerate sample rate of signal (is not used; to be removed) - * \param freq_low lowest frequency of signal (Hz) - * \param freq_high highest frequency of signal (Hz) - * \param scl scale factor - */ - static sptr make(float samplerate, float freq_low, - float freq_high, float scl); - - virtual void set_scale(float scl) = 0; - virtual void set_freq_range(float freq_low, float freq_high) = 0; - - virtual float freq() const = 0; - virtual float freq_high() const = 0; - virtual float freq_low() const = 0; - virtual float scale() const = 0; - virtual float bias() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_FMDET_CF_H */ diff --git a/gr-analog/include/analog/frequency_modulator_fc.h b/gr-analog/include/analog/frequency_modulator_fc.h deleted file mode 100644 index 8706d513a..000000000 --- a/gr-analog/include/analog/frequency_modulator_fc.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_H -#define INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief Frequency modulator block - * \ingroup modulation_blk - * - * float input; complex baseband output - */ - class ANALOG_API frequency_modulator_fc : virtual public gr_sync_block - { - public: - // gr::analog::frequency_modulator_fc::sptr - typedef boost::shared_ptr<frequency_modulator_fc> sptr; - - static sptr make(double sensitivity); - - virtual void set_sensitivity(float sens) = 0; - virtual float sensitivity() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_H */ diff --git a/gr-analog/include/analog/lfsr.h b/gr-analog/include/analog/lfsr.h deleted file mode 100644 index 5cf2ec70d..000000000 --- a/gr-analog/include/analog/lfsr.h +++ /dev/null @@ -1,162 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,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 INCLUDED_ANALOG_LFSR_H -#define INCLUDED_ANALOG_LFSR_H - -#include <analog/api.h> -#include <stdexcept> -#include <stdint.h> - -namespace gr { - namespace analog { - - /*! - * \brief Fibonacci Linear Feedback Shift Register using specified - * polynomial mask - * \ingroup misc - * - * Generates a maximal length pseudo-random sequence of length - * 2^degree-1 - * - * Constructor: analog::lfsr(int mask, int seed, int reg_len); - * - * \param mask - polynomial coefficients representing the - * locations of feedback taps from a shift register - * which are xor'ed together to form the new high - * order bit. - * - * Some common masks might be: - * x^4 + x^3 + x^0 = 0x19 - * x^5 + x^3 + x^0 = 0x29 - * x^6 + x^5 + x^0 = 0x61 - * - * \param seed - the initialization vector placed into the - * register durring initialization. Low order bit - * corresponds to x^0 coefficient -- the first to be - * shifted as output. - * - * \param reg_len - specifies the length of the feedback shift - * register to be used. Durring each iteration, the - * register is rightshifted one and the new bit is - * placed in bit reg_len. reg_len should generally be - * at least order(mask) + 1 - * - * - * see http://en.wikipedia.org/wiki/Linear_feedback_shift_register - * for more explanation. - * - * next_bit() - Standard LFSR operation - * - * Perform one cycle of the LFSR. The output bit is taken from - * the shift register LSB. The shift register MSB is assigned from - * the modulo 2 sum of the masked shift register. - * - * next_bit_scramble(unsigned char input) - Scramble an input stream - * - * Perform one cycle of the LFSR. The output bit is taken from - * the shift register LSB. The shift register MSB is assigned from - * the modulo 2 sum of the masked shift register and the input LSB. - * - * next_bit_descramble(unsigned char input) - Descramble an input stream - * - * Perform one cycle of the LFSR. The output bit is taken from - * the modulo 2 sum of the masked shift register and the input LSB. - * The shift register MSB is assigned from the LSB of the input. - * - * See http://en.wikipedia.org/wiki/Scrambler for operation of these - * last two functions (see multiplicative scrambler.) - */ - class lfsr - { - private: - uint32_t d_shift_register; - uint32_t d_mask; - uint32_t d_seed; - uint32_t d_shift_register_length; // less than 32 - - static uint32_t - popCount(uint32_t x) - { - uint32_t r = x - ((x >> 1) & 033333333333) - - ((x >> 2) & 011111111111); - return ((r + (r >> 3)) & 030707070707) % 63; - } - - public: - lfsr(uint32_t mask, uint32_t seed, uint32_t reg_len) - : d_shift_register(seed), - d_mask(mask), - d_seed(seed), - d_shift_register_length(reg_len) - { - if(reg_len > 31) - throw std::invalid_argument("reg_len must be <= 31"); - } - - unsigned char next_bit() - { - unsigned char output = d_shift_register & 1; - unsigned char newbit = popCount( d_shift_register & d_mask )%2; - d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); - return output; - } - - unsigned char next_bit_scramble(unsigned char input) - { - unsigned char output = d_shift_register & 1; - unsigned char newbit = (popCount( d_shift_register & d_mask )%2)^(input & 1); - d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); - return output; - } - - unsigned char next_bit_descramble(unsigned char input) - { - unsigned char output = (popCount( d_shift_register & d_mask )%2)^(input & 1); - unsigned char newbit = input & 1; - d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); - return output; - } - - /*! - * Reset shift register to initial seed value - */ - void reset() { d_shift_register = d_seed; } - - /*! - * Rotate the register through x number of bits - * where we are just throwing away the results to get queued up correctly - */ - void pre_shift(int num) - { - for(int i=0; i<num; i++) { - next_bit(); - } - } - - int mask() const { return d_mask; } - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_LFSR_H */ diff --git a/gr-analog/include/analog/noise_source_X.h.t b/gr-analog/include/analog/noise_source_X.h.t deleted file mode 100644 index 9d1be6fed..000000000 --- a/gr-analog/include/analog/noise_source_X.h.t +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <analog/api.h> -#include <analog/noise_type.h> -#include <gr_sync_block.h> -#include <gr_random.h> - -namespace gr { - namespace analog { - - /*! - * \brief Random number source - * \ingroup source_blk - * - * \details - * Generate random values from different distributions. - * Currently, only Gaussian and uniform are enabled. - */ - class ANALOG_API @BASE_NAME@ : virtual public gr_sync_block - { - public: - // gr::analog::@BASE_NAME@::sptr - typedef boost::shared_ptr<@BASE_NAME@> sptr; - - /*! \brief Make a noise source - * \param type the random distribution to use (see analog/noise_type.h) - * \param ampl a scaling factor for the output - * \param seed seed for random generators. Note that for uniform and - * Gaussian distributions, this should be a negative number. - */ - static sptr make(noise_type_t type, float ampl, long seed); - - virtual void set_type(noise_type_t type) = 0; - virtual void set_amplitude(float ampl) = 0; - - virtual noise_type_t type() const = 0; - virtual float amplitude() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* @GUARD_NAME@ */ diff --git a/gr-analog/include/analog/noise_type.h b/gr-analog/include/analog/noise_type.h deleted file mode 100644 index c3a2146b7..000000000 --- a/gr-analog/include/analog/noise_type.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_ANALOG_NOISE_TYPE_H -#define INCLUDED_ANALOG_NOISE_TYPE_H - -namespace gr { - namespace analog { - - typedef enum { - GR_UNIFORM = 200, GR_GAUSSIAN, GR_LAPLACIAN, GR_IMPULSE - } noise_type_t; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_NOISE_TYPE_H */ diff --git a/gr-analog/include/analog/phase_modulator_fc.h b/gr-analog/include/analog/phase_modulator_fc.h deleted file mode 100644 index 409de7804..000000000 --- a/gr-analog/include/analog/phase_modulator_fc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_ANALOG_PHASE_MODULATOR_FC_H -#define INCLUDED_ANALOG_PHASE_MODULATOR_FC_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief Phase modulator block - * \ingroup modulation_blk - * - * output = complex(cos(in*sensitivity), sin(in*sensitivity)) - * - * Input stream 0: floats - * Ouput stream 0: complex - */ - class ANALOG_API phase_modulator_fc : virtual public gr_sync_block - { - public: - // gr::analog::phase_modulator_fc::sptr - typedef boost::shared_ptr<phase_modulator_fc> sptr; - - /* \brief Make a phase modulator block. - * - * \param sensitivity Phase change sensitivity of input amplitude. - */ - static sptr make(double sensitivity); - - virtual double sensitivity() const = 0; - virtual double phase() const = 0; - - virtual void set_sensitivity(double s) = 0; - virtual void set_phase(double p) = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PHASE_MODULATOR_FC_H */ diff --git a/gr-analog/include/analog/pll_carriertracking_cc.h b/gr-analog/include/analog/pll_carriertracking_cc.h deleted file mode 100644 index 3596429d4..000000000 --- a/gr-analog/include/analog/pll_carriertracking_cc.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2011,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 INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_H -#define INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief Implements a PLL which locks to the input frequency and outputs the - * input signal mixed with that carrier. - * \ingroup sync_blk - * - * Input stream 0: complex - * Output stream 0: complex - * - * This PLL locks onto a [possibly noisy] reference carrier on the - * input and outputs that signal, downconverted to DC - * - * All settings max_freq and min_freq are in terms of radians per - * sample, NOT HERTZ. The loop bandwidth determins the lock range - * and should be set around pi/200 -- 2pi/100. \sa - * pll_freqdet_cf, pll_carriertracking_cc - */ - class ANALOG_API pll_carriertracking_cc : virtual public gr_sync_block - { - public: - // gr::analog::pll_carriertracking_cc::sptr - typedef boost::shared_ptr<pll_carriertracking_cc> sptr; - - /* \brief Make a carrier tracking PLL block. - * - * \param loop_bw: control loop's bandwidth parameter. - * \param max_freq: maximum (normalized) frequency PLL will lock to. - * \param min_freq: minimum (normalized) frequency PLL will lock to. - */ - static sptr make(float loop_bw, float max_freq, float min_freq); - - virtual bool lock_detector(void) = 0; - virtual bool squelch_enable(bool) = 0; - virtual float set_lock_threshold(float) = 0; - - virtual void set_loop_bandwidth(float bw) = 0; - virtual void set_damping_factor(float df) = 0; - virtual void set_alpha(float alpha) = 0; - virtual void set_beta(float beta) = 0; - virtual void set_frequency(float freq) = 0; - virtual void set_phase(float phase) = 0; - virtual void set_min_freq(float freq) = 0; - virtual void set_max_freq(float freq) = 0; - - virtual float get_loop_bandwidth() const = 0; - virtual float get_damping_factor() const = 0; - virtual float get_alpha() const = 0; - virtual float get_beta() const = 0; - virtual float get_frequency() const = 0; - virtual float get_phase() const = 0; - virtual float get_min_freq() const = 0; - virtual float get_max_freq() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_H */ diff --git a/gr-analog/include/analog/pll_freqdet_cf.h b/gr-analog/include/analog/pll_freqdet_cf.h deleted file mode 100644 index 613e85263..000000000 --- a/gr-analog/include/analog/pll_freqdet_cf.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011 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 INCLUDED_ANALOG_PLL_FREQDET_CF_H -#define INCLUDED_ANALOG_PLL_FREQDET_CF_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief Implements a PLL which locks to the input frequency and outputs - * an estimate of that frequency. Useful for FM Demod. - * \ingroup sync_blk - * - * Input stream 0: complex - * Output stream 0: float - * - * This PLL locks onto a [possibly noisy] reference carrier on - * the input and outputs an estimate of that frequency in radians per sample. - * All settings max_freq and min_freq are in terms of radians per sample, - * NOT HERTZ. The loop bandwidth determins the lock range and should be set - * around pi/200 -- 2pi/100. - * \sa pll_refout_cc, pll_carriertracking_cc - */ - class ANALOG_API pll_freqdet_cf : virtual public gr_sync_block - { - public: - // gr::analog::pll_freqdet_cf::sptr - typedef boost::shared_ptr<pll_freqdet_cf> sptr; - - /* \brief Make PLL block that outputs the tracked signal's frequency. - * - * \param loop_bw: control loop's bandwidth parameter. - * \param max_freq: maximum (normalized) frequency PLL will lock to. - * \param min_freq: minimum (normalized) frequency PLL will lock to. - */ - static sptr make(float loop_bw, float max_freq, float min_freq); - - virtual void set_loop_bandwidth(float bw) = 0; - virtual void set_damping_factor(float df) = 0; - virtual void set_alpha(float alpha) = 0; - virtual void set_beta(float beta) = 0; - virtual void set_frequency(float freq) = 0; - virtual void set_phase(float phase) = 0; - virtual void set_min_freq(float freq) = 0; - virtual void set_max_freq(float freq) = 0; - - virtual float get_loop_bandwidth() const = 0; - virtual float get_damping_factor() const = 0; - virtual float get_alpha() const = 0; - virtual float get_beta() const = 0; - virtual float get_frequency() const = 0; - virtual float get_phase() const = 0; - virtual float get_min_freq() const = 0; - virtual float get_max_freq() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PLL_FREQDET_CF_H */ diff --git a/gr-analog/include/analog/pll_refout_cc.h b/gr-analog/include/analog/pll_refout_cc.h deleted file mode 100644 index a18d177e6..000000000 --- a/gr-analog/include/analog/pll_refout_cc.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011,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 INCLUDED_ANALOG_PLL_REFOUT_CC_H -#define INCLUDED_ANALOG_PLL_REFOUT_CC_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief Implements a PLL which locks to the input frequency and outputs a carrier - * \ingroup sync_blk - * - * Input stream 0: complex - * Output stream 0: complex - * - * This PLL locks onto a [possibly noisy] reference carrier on the - * input and outputs a clean version which is phase and frequency - * aligned to it. - * - * All settings max_freq and min_freq are in terms of radians per - * sample, NOT HERTZ. The loop bandwidth determins the lock range - * and should be set around pi/200 -- 2pi/100. \sa - * pll_freqdet_cf, pll_carriertracking_cc - */ - class ANALOG_API pll_refout_cc : virtual public gr_sync_block - { - public: - // gr::analog::pll_refout_cc::sptr - typedef boost::shared_ptr<pll_refout_cc> sptr; - - /* \brief Make PLL block that outputs the tracked carrier signal. - * - * \param loop_bw: control loop's bandwidth parameter. - * \param max_freq: maximum (normalized) frequency PLL will lock to. - * \param min_freq: minimum (normalized) frequency PLL will lock to. - */ - static sptr make(float loop_bw, float max_freq, float min_freq); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PLL_REFOUT_CC_H */ diff --git a/gr-analog/include/analog/probe_avg_mag_sqrd_c.h b/gr-analog/include/analog/probe_avg_mag_sqrd_c.h deleted file mode 100644 index 9e62732a3..000000000 --- a/gr-analog/include/analog/probe_avg_mag_sqrd_c.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_H -#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief compute avg magnitude squared. - * \ingroup sink_blk - * - * Input stream 0: complex - * - * Compute a running average of the magnitude squared of the the - * input. The level and indication as to whether the level exceeds - * threshold can be retrieved with the level and unmuted - * accessors. - */ - class ANALOG_API probe_avg_mag_sqrd_c : virtual public gr_sync_block - { - public: - // gr::analog::probe_avg_mag_sqrd_c::sptr - typedef boost::shared_ptr<probe_avg_mag_sqrd_c> sptr; - - /*! - * \brief Make a complex sink that computes avg magnitude squared. - * - * \param threshold_db Threshold for muting. - * \param alpha Gain parameter for the running average filter. - */ - static sptr make(double threshold_db, double alpha = 0.0001); - - virtual bool unmuted() const = 0; - virtual double level() const = 0; - virtual double threshold() const = 0; - - virtual void set_alpha(double alpha) = 0; - virtual void set_threshold(double decibels) = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_H */ diff --git a/gr-analog/include/analog/probe_avg_mag_sqrd_cf.h b/gr-analog/include/analog/probe_avg_mag_sqrd_cf.h deleted file mode 100644 index b18916ae9..000000000 --- a/gr-analog/include/analog/probe_avg_mag_sqrd_cf.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_H -#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief compute avg magnitude squared. - * \ingroup sink_blk - * - * Input stream 0: complex - * Output stream 0: float - * - * Compute a running average of the magnitude squared of the the - * input. The level and indication as to whether the level exceeds - * threshold can be retrieved with the level and unmuted - * accessors. - */ - class ANALOG_API probe_avg_mag_sqrd_cf : virtual public gr_sync_block - { - public: - // gr::analog::probe_avg_mag_sqrd_cf::sptr - typedef boost::shared_ptr<probe_avg_mag_sqrd_cf> sptr; - - /*! - * \brief Make a block that computes avg magnitude squared. - * - * \param threshold_db Threshold for muting. - * \param alpha Gain parameter for the running average filter. - */ - static sptr make(double threshold_db, double alpha = 0.0001); - - virtual bool unmuted() const = 0; - virtual double level() const = 0; - virtual double threshold() const = 0; - - virtual void set_alpha(double alpha) = 0; - virtual void set_threshold(double decibels) = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_H */ diff --git a/gr-analog/include/analog/probe_avg_mag_sqrd_f.h b/gr-analog/include/analog/probe_avg_mag_sqrd_f.h deleted file mode 100644 index fe9d27793..000000000 --- a/gr-analog/include/analog/probe_avg_mag_sqrd_f.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_H -#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief compute avg magnitude squared. - * \ingroup sink_blk - * - * input stream 0: float - * - * Compute a running average of the magnitude squared of the the - * input. The level and indication as to whether the level exceeds - * threshold can be retrieved with the level and unmuted - * accessors. - */ - class ANALOG_API probe_avg_mag_sqrd_f : virtual public gr_sync_block - { - public: - // gr::analog::probe_avg_mag_sqrd_f::sptr - typedef boost::shared_ptr<probe_avg_mag_sqrd_f> sptr; - - /*! - * \brief Make a float sink that computes avg magnitude squared. - * - * \param threshold_db Threshold for muting. - * \param alpha Gain parameter for the running average filter. - */ - static sptr make(double threshold_db, double alpha = 0.0001); - - virtual bool unmuted() const = 0; - virtual double level() const = 0; - - virtual double threshold() const = 0; - - virtual void set_alpha (double alpha) = 0; - virtual void set_threshold (double decibels) = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_H */ diff --git a/gr-analog/include/analog/pwr_squelch_cc.h b/gr-analog/include/analog/pwr_squelch_cc.h deleted file mode 100644 index 79364a86b..000000000 --- a/gr-analog/include/analog/pwr_squelch_cc.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_PWR_SQUELCH_CC_H -#define INCLUDED_ANALOG_PWR_SQUELCH_CC_H - -#include <analog/api.h> -#include <analog/squelch_base_cc.h> -#include <cmath> - -namespace gr { - namespace analog { - - /*! - * \brief gate or zero output when input power below threshold - * \ingroup level_blk - */ - class ANALOG_API pwr_squelch_cc : - public squelch_base_cc, virtual public gr_block - { - protected: - virtual void update_state(const gr_complex &in) = 0; - virtual bool mute() const = 0; - - public: - // gr::analog::pwr_squelch_cc::sptr - typedef boost::shared_ptr<pwr_squelch_cc> sptr; - - /*! - * \brief Make power-based squelch block. - * - * \param db threshold (in dB) for power squelch - * \param alpha Gain of averaging filter - * \param ramp - * \param gate - */ - static sptr make(double db, double alpha=0.0001, - int ramp=0, bool gate=false); - - virtual std::vector<float> squelch_range() const = 0; - - virtual double threshold() const = 0; - virtual void set_threshold(double db) = 0; - virtual void set_alpha(double alpha) = 0; - - virtual int ramp() const = 0; - virtual void set_ramp(int ramp) = 0; - virtual bool gate() const = 0; - virtual void set_gate(bool gate) = 0; - virtual bool unmuted() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PWR_SQUELCH_CC_H */ diff --git a/gr-analog/include/analog/pwr_squelch_ff.h b/gr-analog/include/analog/pwr_squelch_ff.h deleted file mode 100644 index 6fdebec74..000000000 --- a/gr-analog/include/analog/pwr_squelch_ff.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_PWR_SQUELCH_FF_H -#define INCLUDED_ANALOG_PWR_SQUELCH_FF_H - -#include <analog/api.h> -#include <analog/squelch_base_ff.h> -#include <cmath> - -namespace gr { - namespace analog { - - /*! - * \brief gate or zero output when input power below threshold - * \ingroup level_blk - */ - class ANALOG_API pwr_squelch_ff : - public squelch_base_ff, virtual public gr_block - { - protected: - virtual void update_state(const float &in) = 0; - virtual bool mute() const = 0; - - public: - // gr::analog::pwr_squelch_ff::sptr - typedef boost::shared_ptr<pwr_squelch_ff> sptr; - - /*! - * \brief Make power-based squelch block. - * - * \param db threshold (in dB) for power squelch - * \param alpha Gain of averaging filter - * \param ramp - * \param gate - */ - static sptr make(double db, double alpha=0.0001, - int ramp=0, bool gate=false); - - virtual std::vector<float> squelch_range() const = 0; - - virtual double threshold() const = 0; - virtual void set_threshold(double db) = 0; - virtual void set_alpha(double alpha) = 0; - - virtual int ramp() const = 0; - virtual void set_ramp(int ramp) = 0; - virtual bool gate() const = 0; - virtual void set_gate(bool gate) = 0; - virtual bool unmuted() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PWR_SQUELCH_FF_H */ diff --git a/gr-analog/include/analog/quadrature_demod_cf.h b/gr-analog/include/analog/quadrature_demod_cf.h deleted file mode 100644 index 916d8b2ec..000000000 --- a/gr-analog/include/analog/quadrature_demod_cf.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H -#define INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief quadrature demodulator: complex in, float out - * \ingroup demodulation_blk - * - * This can be used to demod FM, FSK, GMSK, etc. - * The input is complex baseband. - */ - class ANALOG_API quadrature_demod_cf : virtual public gr_sync_block - { - public: - // gr::analog::quadrature_demod_cf::sptr - typedef boost::shared_ptr<quadrature_demod_cf> sptr; - - static sptr make(float gain); - - virtual void set_gain(float gain) = 0; - virtual float gain() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H */ diff --git a/gr-analog/include/analog/rail_ff.h b/gr-analog/include/analog/rail_ff.h deleted file mode 100644 index e51b2fc93..000000000 --- a/gr-analog/include/analog/rail_ff.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_ANALOG_RAIL_FF_H -#define INCLUDED_ANALOG_RAIL_FF_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief clips input values to min, max - * \ingroup misc - */ - class ANALOG_API rail_ff : virtual public gr_sync_block - { - public: - // gr::analog::rail_ff::sptr - typedef boost::shared_ptr<rail_ff> sptr; - - static sptr make(float lo, float hi); - - virtual float lo() const = 0; - virtual float hi() const = 0; - - virtual void set_lo(float lo) = 0; - virtual void set_hi(float hi) = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_RAIL_FF_H */ diff --git a/gr-analog/include/analog/rotator.h b/gr-analog/include/analog/rotator.h deleted file mode 100644 index ee3849eae..000000000 --- a/gr-analog/include/analog/rotator.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2008,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 _ANALOG_ROTATOR_H_ -#define _ANALOG_ROTATOR_H_ - -#include <analog/api.h> -#include <gr_complex.h> - -namespace gr { - namespace analog { - - class rotator - { - private: - gr_complex d_phase; - gr_complex d_phase_incr; - unsigned int d_counter; - - public: - rotator() : d_phase (1), d_phase_incr (1), d_counter(0) - { } - - void set_phase(gr_complex phase) { d_phase = phase / abs(phase); } - void set_phase_incr(gr_complex incr) { d_phase_incr = incr / abs(incr); } - - gr_complex rotate (gr_complex in) - { - d_counter++; - - gr_complex z = in * d_phase; // rotate in by phase - d_phase *= d_phase_incr; // incr our phase (complex mult == add phases) - - if((d_counter % 512) == 0) - d_phase /= abs(d_phase); // Normalize to ensure multiplication is rotation - - return z; - } - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* _ANALOG_ROTATOR_H_ */ diff --git a/gr-analog/include/analog/sig_source_X.h.t b/gr-analog/include/analog/sig_source_X.h.t deleted file mode 100644 index 2915c2abe..000000000 --- a/gr-analog/include/analog/sig_source_X.h.t +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -/* @WARNING@ */ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <analog/api.h> -#include <analog/sig_source_waveform.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief signal generator with @TYPE@ output. - * \ingroup source_blk - */ - class ANALOG_API @BASE_NAME@ : virtual public gr_sync_block - { - public: - // gr::analog::@BASE_NAME@::sptr - typedef boost::shared_ptr<@BASE_NAME@> sptr; - - /*! - * \brief Make a signal source block. - * - * \param sampling_freq Sampling rate of signal. - * \param waveform wavetform type. - * \param wave_freq Frequency of waveform (relative to sampling_freq). - * \param ampl Signal amplitude. - * \param offset offset of signal. - */ - static sptr make(double sampling_freq, - gr::analog::gr_waveform_t waveform, - double wave_freq, - double ampl, @TYPE@ offset = 0); - - virtual double sampling_freq() const = 0; - virtual gr::analog::gr_waveform_t waveform() const = 0; - virtual double frequency() const = 0; - virtual double amplitude() const = 0; - virtual @TYPE@ offset() const = 0; - - virtual void set_sampling_freq(double sampling_freq) = 0; - virtual void set_waveform(gr::analog::gr_waveform_t waveform) = 0; - virtual void set_frequency(double frequency) = 0; - virtual void set_amplitude(double ampl) = 0; - virtual void set_offset(@TYPE@ offset) = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* @GUARD_NAME@ */ diff --git a/gr-analog/include/analog/sig_source_waveform.h b/gr-analog/include/analog/sig_source_waveform.h deleted file mode 100644 index 3a9edb8f3..000000000 --- a/gr-analog/include/analog/sig_source_waveform.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_ANALOG_SIG_SOURCE_WAVEFORM_H -#define INCLUDED_ANALOG_SIG_SOURCE_WAVEFORM_H - -namespace gr { - namespace analog { - - typedef enum { - GR_CONST_WAVE = 100, - GR_SIN_WAVE, - GR_COS_WAVE, - GR_SQR_WAVE, - GR_TRI_WAVE, - GR_SAW_WAVE - } gr_waveform_t; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_SIG_SOURCE_WAVEFORM_H */ diff --git a/gr-analog/include/analog/simple_squelch_cc.h b/gr-analog/include/analog/simple_squelch_cc.h deleted file mode 100644 index 1e12646e4..000000000 --- a/gr-analog/include/analog/simple_squelch_cc.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_H -#define INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief simple squelch block based on average signal power and threshold in dB. - * \ingroup level_blk - */ - class ANALOG_API simple_squelch_cc : virtual public gr_sync_block - { - public: - // gr::analog::simple_squelch_cc::sptr - typedef boost::shared_ptr<simple_squelch_cc> sptr; - - /*! - * \brief Make a simple squelch block. - * - * \param threshold_db Threshold for muting. - * \param alpha Gain parameter for the running average filter. - */ - static sptr make(double threshold_db, double alpha); - - virtual bool unmuted() const = 0; - - virtual void set_alpha(double alpha) = 0; - virtual void set_threshold(double decibels) = 0; - - virtual double threshold() const = 0; - virtual std::vector<float> squelch_range() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_H */ diff --git a/gr-analog/include/analog/sincos.h b/gr-analog/include/analog/sincos.h deleted file mode 100644 index 38b9d96da..000000000 --- a/gr-analog/include/analog/sincos.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2004,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 INCLUDED_ANALOG_SINCOS_H -#define INCLUDED_ANALOG_SINCOS_H - -#include <analog/api.h> - -namespace gr { - namespace analog { - - // compute sine and cosine at the same time - ANALOG_API void sincos(double x, double *sin, double *cos); - ANALOG_API void sincosf(float x, float *sin, float *cos); - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_SINCOS_H */ diff --git a/gr-analog/include/analog/squelch_base_cc.h b/gr-analog/include/analog/squelch_base_cc.h deleted file mode 100644 index 11476e7e8..000000000 --- a/gr-analog/include/analog/squelch_base_cc.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_SQUELCH_BASE_CC_H -#define INCLUDED_ANALOG_SQUELCH_BASE_CC_H - -#include <analog/api.h> -#include <gr_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief basic squelch block; to be subclassed for other squelches. - * \ingroup level_blk - */ - class ANALOG_API squelch_base_cc : virtual public gr_block - { - protected: - virtual void update_state(const gr_complex &sample) = 0; - virtual bool mute() const = 0; - - public: - squelch_base_cc() {}; - virtual int ramp() const = 0; - virtual void set_ramp(int ramp) = 0; - virtual bool gate() const = 0; - virtual void set_gate(bool gate) = 0; - virtual bool unmuted() const = 0; - - virtual std::vector<float> squelch_range() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_SQUELCH_BASE_CC_H */ diff --git a/gr-analog/include/analog/squelch_base_ff.h b/gr-analog/include/analog/squelch_base_ff.h deleted file mode 100644 index 2ce1f1a65..000000000 --- a/gr-analog/include/analog/squelch_base_ff.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_SQUELCH_BASE_FF_H -#define INCLUDED_ANALOG_SQUELCH_BASE_FF_H - -#include <analog/api.h> -#include <gr_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief basic squelch block; to be subclassed for other squelches. - * \ingroup level_blk - */ - class ANALOG_API squelch_base_ff : virtual public gr_block - { - protected: - virtual void update_state(const float &sample) = 0; - virtual bool mute() const = 0; - - public: - squelch_base_ff() {}; - virtual int ramp() const = 0; - virtual void set_ramp(int ramp) = 0; - virtual bool gate() const = 0; - virtual void set_gate(bool gate) = 0; - virtual bool unmuted() const = 0; - - virtual std::vector<float> squelch_range() const = 0; - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_SQUELCH_BASE_FF_H */ diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt deleted file mode 100644 index f7d6723b4..000000000 --- a/gr-analog/lib/CMakeLists.txt +++ /dev/null @@ -1,188 +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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../include - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${GR_ANALOG_INCLUDE_DIRS} - ${GR_FILTER_INCLUDE_DIRS} - ${GR_FFT_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${VOLK_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# generate helper scripts to expand templated files -######################################################################## -include(GrPython) - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " -#!${PYTHON_EXECUTABLE} - -import sys, os, re -sys.path.append('${GR_CORE_PYTHONPATH}') -os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.chdir('${CMAKE_CURRENT_BINARY_DIR}') - -if __name__ == '__main__': - import build_utils - root, inp = sys.argv[1:3] - for sig in sys.argv[3:]: - name = re.sub ('X+', sig, root) - d = build_utils.standard_impl_dict2(name, sig, 'analog') - build_utils.expand_template(d, inp) -") - -macro(expand_cc root) - #make a list of all the generated files - unset(expanded_files_cc) - unset(expanded_files_h) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc) - list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) - endforeach(sig) - - #create a command to generate the source files - add_custom_command( - OUTPUT ${expanded_files_cc} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.cc.t ${ARGN} - ) - - #create a command to generate the header file - add_custom_command( - OUTPUT ${expanded_files_h} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.h.t ${ARGN} - ) - - #make source files depends on headers to force generation - set_source_files_properties(${expanded_files_cc} - PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" - ) - - #install rules for the generated cc files - list(APPEND generated_sources ${expanded_files_cc}) - list(APPEND generated_headers ${expanded_files_h}) -endmacro(expand_cc) - - -######################################################################## -# Invoke macro to generate various sources -######################################################################## -expand_cc(noise_source_X_impl s i f c) -expand_cc(sig_source_X_impl s i f c) - -######################################################################## -# Setup library -######################################################################## -list(APPEND analog_sources - ${generated_sources} - cpm.cc - squelch_base_cc_impl.cc - squelch_base_ff_impl.cc - agc_cc_impl.cc - agc_ff_impl.cc - agc2_cc_impl.cc - agc2_ff_impl.cc - cpfsk_bc_impl.cc - ctcss_squelch_ff_impl.cc - dpll_bb_impl.cc - feedforward_agc_cc_impl.cc - fmdet_cf_impl.cc - frequency_modulator_fc_impl.cc - phase_modulator_fc_impl.cc - pll_carriertracking_cc_impl.cc - pll_freqdet_cf_impl.cc - pll_refout_cc_impl.cc - probe_avg_mag_sqrd_c_impl.cc - probe_avg_mag_sqrd_cf_impl.cc - probe_avg_mag_sqrd_f_impl.cc - pwr_squelch_cc_impl.cc - pwr_squelch_ff_impl.cc - quadrature_demod_cf_impl.cc - rail_ff_impl.cc - simple_squelch_cc_impl.cc - sincos.cc -) - -list(APPEND analog_libs - volk - gnuradio-core - gnuradio-filter - ${Boost_LIBRARIES} -) - -add_library(gnuradio-analog SHARED ${analog_sources}) -target_link_libraries(gnuradio-analog ${analog_libs}) -GR_LIBRARY_FOO(gnuradio-analog RUNTIME_COMPONENT "analog_runtime" DEVEL_COMPONENT "analog_devel") -add_dependencies(gnuradio-analog analog_generated_includes analog_generated_swigs gnuradio-filter) - - -######################################################################## -# QA C++ Code for gr-filter -######################################################################## -if(ENABLE_TESTING) - include(GrTest) - - include_directories(${CPPUNIT_INCLUDE_DIRS}) - link_directories(${CPPUNIT_LIBRARY_DIRS}) - - list(APPEND test_gr_analog_sources - ${CMAKE_CURRENT_SOURCE_DIR}/test_gr_analog.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_analog.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_sincos.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_rotator.cc - ) - - add_executable(test-gr-analog ${test_gr_analog_sources}) - - target_link_libraries( - test-gr-analog - gnuradio-core - gnuradio-analog - ${Boost_LIBRARIES} - ${CPPUNIT_LIBRARIES} - ) - - list(APPEND GR_TEST_TARGET_DEPS gnuradio-analog gnuradio-filter gnuradio-fft) - - GR_ADD_TEST(test_gr_analog test-gr-analog) -endif(ENABLE_TESTING) - -CHECK_CXX_SOURCE_COMPILES(" - #define _GNU_SOURCE - #include <math.h> - int main(){double x, sin, cos; sincos(x, &sin, &cos); return 0;} - " HAVE_SINCOS -) -GR_ADD_COND_DEF(HAVE_SINCOS) diff --git a/gr-analog/lib/agc2_cc_impl.cc b/gr-analog/lib/agc2_cc_impl.cc deleted file mode 100644 index 2ef18e5ab..000000000 --- a/gr-analog/lib/agc2_cc_impl.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,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 "agc2_cc_impl.h" -#include <gr_io_signature.h> - -namespace gr { - namespace analog { - - agc2_cc::sptr - agc2_cc::make(float attack_rate, float decay_rate, - float reference, - float gain, float max_gain) - { - return gnuradio::get_initial_sptr - (new agc2_cc_impl(attack_rate, decay_rate, - reference, gain, max_gain)); - } - - agc2_cc_impl::agc2_cc_impl(float attack_rate, float decay_rate, - float reference, - float gain, float max_gain) - : gr_sync_block("agc2_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - kernel::agc2_cc(attack_rate, decay_rate, - reference, gain, max_gain) - { - } - - agc2_cc_impl::~agc2_cc_impl() - { - } - - int - agc2_cc_impl::work(int noutput_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]; - scaleN(out, in, noutput_items); - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/agc2_cc_impl.h b/gr-analog/lib/agc2_cc_impl.h deleted file mode 100644 index 98afc668a..000000000 --- a/gr-analog/lib/agc2_cc_impl.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_AGC2_IMPL_CC_H -#define INCLUDED_ANALOG_AGC2_IMPL_CC_H - -#include <analog/agc2_cc.h> - -namespace gr { - namespace analog { - - class agc2_cc_impl : public agc2_cc, kernel::agc2_cc - { - public: - agc2_cc_impl(float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - ~agc2_cc_impl(); - - float attack_rate() const { return kernel::agc2_cc::attack_rate(); } - float decay_rate() const { return kernel::agc2_cc::decay_rate(); } - float reference() const { return kernel::agc2_cc::reference(); } - float gain() const { return kernel::agc2_cc::gain(); } - float max_gain() const { return kernel::agc2_cc::max_gain(); } - - void set_attack_rate(float rate) { kernel::agc2_cc::set_attack_rate(rate); } - void set_decay_rate(float rate) { kernel::agc2_cc::set_decay_rate(rate); } - void set_reference(float reference) { kernel::agc2_cc::set_reference(reference); } - void set_gain(float gain) { kernel::agc2_cc::set_gain(gain); } - void set_max_gain(float max_gain) { kernel::agc2_cc::set_max_gain(max_gain); } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_AGC2_CC_IMPL_H */ diff --git a/gr-analog/lib/agc2_ff_impl.cc b/gr-analog/lib/agc2_ff_impl.cc deleted file mode 100644 index e0cdd6c44..000000000 --- a/gr-analog/lib/agc2_ff_impl.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2010,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 "agc2_ff_impl.h" -#include <gr_io_signature.h> - -namespace gr { - namespace analog { - - agc2_ff::sptr - agc2_ff::make(float attack_rate, float decay_rate, - float reference, - float gain, float max_gain) - { - return gnuradio::get_initial_sptr - (new agc2_ff_impl(attack_rate, decay_rate, - reference, - gain, max_gain)); - } - - agc2_ff_impl::~agc2_ff_impl() - { - } - - agc2_ff_impl::agc2_ff_impl(float attack_rate, float decay_rate, - float reference, - float gain, float max_gain) - : gr_sync_block("agc2_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))) - , kernel::agc2_ff(attack_rate, decay_rate, - reference, gain, max_gain) - { - } - - int - agc2_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]; - scaleN(out, in, noutput_items); - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/agc2_ff_impl.h b/gr-analog/lib/agc2_ff_impl.h deleted file mode 100644 index df33c8e44..000000000 --- a/gr-analog/lib/agc2_ff_impl.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_ANALOG_AGC2_FF_IMPL_H -#define INCLUDED_ANALOG_AGC2_FF_IMPL_H - -#include <analog/agc2_ff.h> - -namespace gr { - namespace analog { - - class agc2_ff_impl : public agc2_ff, kernel::agc2_ff - { - public: - agc2_ff_impl(float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - ~agc2_ff_impl(); - - float attack_rate() const { return kernel::agc2_ff::attack_rate(); } - float decay_rate() const { return kernel::agc2_ff::decay_rate(); } - float reference() const { return kernel::agc2_ff::reference(); } - float gain() const { return kernel::agc2_ff::gain(); } - float max_gain() const { return kernel::agc2_ff::max_gain(); } - - void set_attack_rate(float rate) { kernel::agc2_ff::set_attack_rate(rate); } - void set_decay_rate(float rate) { kernel::agc2_ff::set_decay_rate(rate); } - void set_reference(float reference) { kernel::agc2_ff::set_reference(reference); } - void set_gain(float gain) { kernel::agc2_ff::set_gain(gain); } - void set_max_gain(float max_gain) { kernel::agc2_ff::set_max_gain(max_gain); } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_AGC2_IMPL_FF_H */ diff --git a/gr-analog/lib/agc_cc_impl.cc b/gr-analog/lib/agc_cc_impl.cc deleted file mode 100644 index 81e1f67f8..000000000 --- a/gr-analog/lib/agc_cc_impl.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,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 "agc_cc_impl.h" -#include <gr_io_signature.h> - -namespace gr { - namespace analog { - - agc_cc::sptr - agc_cc::make(float rate, float reference, - float gain, float max_gain) - { - return gnuradio::get_initial_sptr - (new agc_cc_impl(rate, reference, gain, max_gain)); - } - - agc_cc_impl::agc_cc_impl(float rate, float reference, - float gain, float max_gain) - : gr_sync_block("agc_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - kernel::agc_cc(rate, reference, gain, max_gain) - { - } - - agc_cc_impl::~agc_cc_impl() - { - } - - int - agc_cc_impl::work(int noutput_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]; - scaleN(out, in, noutput_items); - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/agc_cc_impl.h b/gr-analog/lib/agc_cc_impl.h deleted file mode 100644 index 822f46ef2..000000000 --- a/gr-analog/lib/agc_cc_impl.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_AGC_CC_IMPL_H -#define INCLUDED_ANALOG_AGC_CC_IMPL_H - -#include <analog/agc_cc.h> - -namespace gr { - namespace analog { - - class agc_cc_impl : public agc_cc, kernel::agc_cc - { - public: - agc_cc_impl(float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - ~agc_cc_impl(); - - float rate() const { return kernel::agc_cc::rate(); } - float reference() const { return kernel::agc_cc::reference(); } - float gain() const { return kernel::agc_cc::gain(); } - float max_gain() const { return kernel::agc_cc::max_gain(); } - - void set_rate(float rate) { kernel::agc_cc::set_rate(rate); } - void set_reference(float reference) { kernel::agc_cc::set_reference(reference); } - void set_gain(float gain) { kernel::agc_cc::set_gain(gain); } - void set_max_gain(float max_gain) { kernel::agc_cc::set_max_gain(max_gain); } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_AGC_CC_IMPL_H */ diff --git a/gr-analog/lib/agc_ff_impl.cc b/gr-analog/lib/agc_ff_impl.cc deleted file mode 100644 index a80b90c12..000000000 --- a/gr-analog/lib/agc_ff_impl.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2010,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 "agc_ff_impl.h" -#include <gr_io_signature.h> - -namespace gr { - namespace analog { - - agc_ff::sptr - agc_ff::make(float rate, float reference, float gain, float max_gain) - { - return gnuradio::get_initial_sptr - (new agc_ff_impl(rate, reference, gain, max_gain)); - } - - agc_ff_impl::agc_ff_impl(float rate, float reference, float gain, float max_gain) - : gr_sync_block("agc_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), - kernel::agc_ff(rate, reference, gain, max_gain) - { - } - - agc_ff_impl::~agc_ff_impl() - { - } - - int - agc_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]; - scaleN(out, in, noutput_items); - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/agc_ff_impl.h b/gr-analog/lib/agc_ff_impl.h deleted file mode 100644 index e309cca1b..000000000 --- a/gr-analog/lib/agc_ff_impl.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_ANALOG_AGC_FF_IMPL_H -#define INCLUDED_ANALOG_AGC_FF_IMPL_H - -#include <analog/agc_ff.h> - -namespace gr { - namespace analog { - - class agc_ff_impl : public agc_ff, kernel::agc_ff - { - public: - agc_ff_impl(float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - ~agc_ff_impl(); - - float rate() const { return kernel::agc_ff::rate(); } - float reference() const { return kernel::agc_ff::reference(); } - float gain() const { return kernel::agc_ff::gain(); } - float max_gain() const { return kernel::agc_ff::max_gain(); } - - void set_rate(float rate) { kernel::agc_ff::set_rate(rate); } - void set_reference(float reference) { kernel::agc_ff::set_reference(reference); } - void set_gain(float gain) { kernel::agc_ff::set_gain(gain); } - void set_max_gain(float max_gain) { kernel::agc_ff::set_max_gain(max_gain); } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_AGC_FF_IMPL_H */ diff --git a/gr-analog/lib/cpfsk_bc_impl.cc b/gr-analog/lib/cpfsk_bc_impl.cc deleted file mode 100644 index 1b7f25f6c..000000000 --- a/gr-analog/lib/cpfsk_bc_impl.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,2012 Free Software Foundation, Inc. - * - * 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 "cpfsk_bc_impl.h" -#include <gr_io_signature.h> -#include <gr_expj.h> - -namespace gr { - namespace analog { - -#define M_TWOPI (2*M_PI) - - cpfsk_bc::sptr - cpfsk_bc::make(float k, float ampl, int samples_per_sym) - { - return gnuradio::get_initial_sptr - (new cpfsk_bc_impl(k, ampl, samples_per_sym)); - } - - cpfsk_bc_impl::cpfsk_bc_impl(float k, float ampl, int samples_per_sym) - : gr_sync_interpolator("cpfsk_bc", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(gr_complex)), - samples_per_sym) - { - d_samples_per_sym = samples_per_sym; - d_freq = k*M_PI/samples_per_sym; - d_ampl = ampl; - d_phase = 0.0; - } - - cpfsk_bc_impl::~cpfsk_bc_impl() - { - } - - int - cpfsk_bc_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - const char *in = (const char*)input_items[0]; - gr_complex *out = (gr_complex*)output_items[0]; - - for(int i = 0; i < noutput_items/d_samples_per_sym; i++) { - for(int j = 0; j < d_samples_per_sym; j++) { - if(in[i] == 1) - d_phase += d_freq; - else - d_phase -= d_freq; - - while(d_phase > M_TWOPI) - d_phase -= M_TWOPI; - while(d_phase < -M_TWOPI) - d_phase += M_TWOPI; - - *out++ = gr_expj(d_phase)*d_ampl; - } - } - - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ - diff --git a/gr-analog/lib/cpfsk_bc_impl.h b/gr-analog/lib/cpfsk_bc_impl.h deleted file mode 100644 index 9f6ec2c7f..000000000 --- a/gr-analog/lib/cpfsk_bc_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2012 Free Software Foundation, Inc. - * - * 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 INCLUDED_ANALOG_CPFSK_BC_IMPL_H -#define INCLUDED_ANALOG_CPFSK_BC_IMPL_H - -#include <analog/cpfsk_bc.h> - -namespace gr { - namespace analog { - - class cpfsk_bc_impl : public cpfsk_bc - { - private: - int d_samples_per_sym; // Samples per symbol, square pulse - float d_freq; // Modulation index*pi/samples_per_sym - float d_ampl; // Output amplitude - float d_phase; // Current phase - - public: - cpfsk_bc_impl(float k, float ampl, int samples_per_sym); - ~cpfsk_bc_impl(); - - void set_amplitude(float amplitude) { d_ampl = amplitude; } - float amplitude() { return d_ampl; } - float freq() { return d_freq; } - float phase() { return d_phase; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_CPFSK_BC_IMPL_H */ diff --git a/gr-analog/lib/cpm.cc b/gr-analog/lib/cpm.cc deleted file mode 100644 index 618475cec..000000000 --- a/gr-analog/lib/cpm.cc +++ /dev/null @@ -1,221 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010,2012 Free Software Foundation, Inc. - * - * 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. - */ - -// Calculate the taps for the CPM phase responses - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <cmath> -#include <cfloat> -#include <analog/cpm.h> - -//gives us erf on compilers without it -#include <boost/math/special_functions/erf.hpp> -namespace bm = boost::math; - -namespace gr { - namespace analog { - -#ifndef M_TWOPI -# define M_TWOPI (2*M_PI) -#endif - - //! Normalised sinc function, sinc(x)=sin(pi*x)/pi*x - inline double - sinc(double x) - { - if(x == 0) { - return 1.0; - } - return sin(M_PI * x) / (M_PI * x); - } - - - //! Taps for L-RC CPM (Raised cosine of length L symbols) - std::vector<float> - generate_cpm_lrc_taps(unsigned samples_per_sym, unsigned L) - { - std::vector<float> taps(samples_per_sym * L, 1.0/L/samples_per_sym); - for(unsigned i = 0; i < samples_per_sym * L; i++) { - taps[i] *= 1 - cos(M_TWOPI * i / L / samples_per_sym); - } - - return taps; - } - - - /*! Taps for L-SRC CPM (Spectral raised cosine of length L symbols). - * - * L-SRC has a time-continuous phase response function of - * - * g(t) = 1/LT * sinc(2t/LT) * cos(beta * 2pi t / LT) / (1 - (4beta / LT * t)^2) - * - * which is the Fourier transform of a cos-rolloff function with rolloff - * beta, and looks like a sinc-function, multiplied with a rolloff term. - * We return the main lobe of the sinc, i.e., everything between the - * zero crossings. - * The time-discrete IR is thus - * - * g(k) = 1/Ls * sinc(2k/Ls) * cos(beta * pi k / Ls) / (1 - (4beta / Ls * k)^2) - * where k = 0...Ls-1 - * and s = samples per symbol. - */ - std::vector<float> - generate_cpm_lsrc_taps(unsigned samples_per_sym, unsigned L, double beta) - { - double Ls = (double) L * samples_per_sym; - std::vector<double> taps_d(L * samples_per_sym, 0.0); - std::vector<float> taps(L * samples_per_sym, 0.0); - - double sum = 0; - for(unsigned i = 0; i < samples_per_sym * L; i++) { - double k = i - Ls/2; // Causal to acausal - - taps_d[i] = 1.0 / Ls * sinc(2.0 * k / Ls); - - // For k = +/-Ls/4*beta, the rolloff term's cos-function becomes zero - // and the whole thing converges to PI/4 (to prove this, use de - // l'hopital's rule). - if(fabs(fabs(k) - Ls/4/beta) < 2*DBL_EPSILON) { - taps_d[i] *= M_PI_4; - } - else { - double tmp = 4.0 * beta * k / Ls; - taps_d[i] *= cos(beta * M_TWOPI * k / Ls) / (1 - tmp * tmp); - } - sum += taps_d[i]; - } - - for(unsigned i = 0; i < samples_per_sym * L; i++) { - taps[i] = (float) taps_d[i] / sum; - } - - return taps; - } - - //! Taps for L-REC CPM (Rectangular pulse shape of length L symbols) - std::vector<float> - generate_cpm_lrec_taps(unsigned samples_per_sym, unsigned L) - { - return std::vector<float>(samples_per_sym * L, 1.0/L/samples_per_sym); - } - - //! Helper function for TFM - double tfm_g0(double k, double sps) - { - if(fabs(k) < 2 * DBL_EPSILON) { - return 1.145393004159143; // 1 + pi^2/48 / sqrt(2) - } - - const double pi2_24 = 0.411233516712057; // pi^2/24 - double f = M_PI * k / sps; - return sinc(k/sps) - pi2_24 * (2 * sin(f) - 2*f*cos(f) - f*f*sin(f)) / (f*f*f); - } - - //! Taps for TFM CPM (Tamed frequency modulation) - // - // See [2, Chapter 2.7.2]. - // - // [2]: Anderson, Aulin and Sundberg; Digital Phase Modulation - std::vector<float> - generate_cpm_tfm_taps(unsigned sps, unsigned L) - { - unsigned causal_shift = sps * L / 2; - std::vector<double> taps_d(sps * L, 0.0); - std::vector<float> taps(sps * L, 0.0); - - double sum = 0; - for(unsigned i = 0; i < sps * L; i++) { - double k = (double)(((int)i) - ((int)causal_shift)); // Causal to acausal - - taps_d[i] = tfm_g0(k - sps, sps) + - 2 * tfm_g0(k, sps) + - tfm_g0(k + sps, sps); - sum += taps_d[i]; - } - - for(unsigned i = 0; i < sps * L; i++) { - taps[i] = (float) taps_d[i] / sum; - } - - return taps; - } - - //! Taps for Gaussian CPM. Phase response is truncated after \p L symbols. - // \p bt sets the 3dB-time-bandwidth product. - // - // Note: for h = 0.5, this is the phase response for GMSK. - // - // This C99-compatible formula for the taps is taken straight - // from [1, Chapter 9.2.3]. - // A version in Q-notation can be found in [2, Chapter 2.7.2]. - // - // [1]: Karl-Dirk Kammeyer; Nachrichtenübertragung, 4th Edition. - // [2]: Anderson, Aulin and Sundberg; Digital Phase Modulation - // - std::vector<float> - generate_cpm_gaussian_taps(unsigned samples_per_sym, unsigned L, double bt) - { - double Ls = (double) L * samples_per_sym; - std::vector<double> taps_d(L * samples_per_sym, 0.0); - std::vector<float> taps(L * samples_per_sym, 0.0); - - // alpha = sqrt(2/ln(2)) * pi * BT - double alpha = 5.336446256636997 * bt; - for(unsigned i = 0; i < samples_per_sym * L; i++) { - double k = i - Ls/2; // Causal to acausal - taps_d[i] = (bm::erf(alpha * (k / samples_per_sym + 0.5)) - - bm::erf(alpha * (k / samples_per_sym - 0.5))) - * 0.5 / samples_per_sym; - taps[i] = (float) taps_d[i]; - } - - return taps; - } - - std::vector<float> - cpm::phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta) - { - switch(type) { - case LRC: - return generate_cpm_lrc_taps(samples_per_sym, L); - - case LSRC: - return generate_cpm_lsrc_taps(samples_per_sym, L, beta); - - case LREC: - return generate_cpm_lrec_taps(samples_per_sym, L); - - case TFM: - return generate_cpm_tfm_taps(samples_per_sym, L); - - case GAUSSIAN: - return generate_cpm_gaussian_taps(samples_per_sym, L, beta); - - default: - return generate_cpm_lrec_taps(samples_per_sym, 1); - } - } - - } // namespace analog -} // namespace gr - diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.cc b/gr-analog/lib/ctcss_squelch_ff_impl.cc deleted file mode 100644 index 60cd94fdb..000000000 --- a/gr-analog/lib/ctcss_squelch_ff_impl.cc +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010,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 "ctcss_squelch_ff_impl.h" - -namespace gr { - namespace analog { - - static float ctcss_tones[] = { - 67.0, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5, 91.5, 94.8, - 97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, 131.8, - 136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2, - 192.8, 203.5, 210.7, 218.1, 225.7, 233.6, 241.8, 250.3 - }; - - static int max_tone_index = 37; - - ctcss_squelch_ff::sptr - ctcss_squelch_ff::make(int rate, float freq, float level, - int len, int ramp, bool gate) - { - return gnuradio::get_initial_sptr(new ctcss_squelch_ff_impl - (rate, freq, level, len, ramp, gate)); - } - - int - ctcss_squelch_ff_impl::find_tone(float freq) - { - for(int i = 0; i <= max_tone_index; i++) - if(ctcss_tones[i] == freq) // FIXME: make almost equal - return i; - return -1; - } - - ctcss_squelch_ff_impl::ctcss_squelch_ff_impl(int rate, float freq, float level, - int len, int ramp, bool gate) - : gr_block("ctcss_squelch_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), - squelch_base_ff_impl("ctcss_squelch_ff", ramp, gate) - { - d_freq = freq; - d_level = level; - - // Default is 100 ms detection time - if(len == 0) - d_len = (int)(rate/10.0); - else - d_len = len; - - int i = find_tone(freq); - - // Non-standard tones or edge tones get 2% guard band, otherwise - // guards are set at adjacent ctcss tone frequencies - float f_l, f_r; - if(i == -1 || i == 0) - f_l = freq*0.98; - else - f_l = ctcss_tones[i-1]; - - if(i == -1 || i == max_tone_index) - f_r = freq*1.02; - else - f_r = ctcss_tones[i+1]; - - d_goertzel_l = fft::goertzel(rate, d_len, f_l); - d_goertzel_c = fft::goertzel(rate, d_len, freq); - d_goertzel_r = fft::goertzel(rate, d_len, f_r); - - d_mute = true; - } - - ctcss_squelch_ff_impl::~ctcss_squelch_ff_impl() - { - } - - std::vector<float> - ctcss_squelch_ff_impl::squelch_range() const - { - std::vector<float> r(3); - r[0] = 0.0; - r[1] = 1.0; - r[2] = (r[1]-r[0])/100; // step size - - return r; - } - - void - ctcss_squelch_ff_impl::update_state(const float &in) - { - d_goertzel_l.input(in); - d_goertzel_c.input(in); - d_goertzel_r.input(in); - - float rounder = 100000; - float d_out_l, d_out_c, d_out_r; - if(d_goertzel_c.ready()) { - d_out_l = floor(rounder*abs(d_goertzel_l.output()))/rounder; - d_out_c = floor(rounder*abs(d_goertzel_c.output()))/rounder; - d_out_r = floor(rounder*abs(d_goertzel_r.output()))/rounder; - - //printf("d_out_l=%f d_out_c=%f d_out_r=%f\n", d_out_l, d_out_c, d_out_r); - d_mute = (d_out_c < d_level || d_out_c < d_out_l || d_out_c < d_out_r); - } - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.h b/gr-analog/lib/ctcss_squelch_ff_impl.h deleted file mode 100644 index 0827fbafe..000000000 --- a/gr-analog/lib/ctcss_squelch_ff_impl.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_CTCSS_SQUELCH_FF_IMPL_H -#define INCLUDED_ANALOG_CTCSS_SQUELCH_FF_IMPL_H - -#include <analog/ctcss_squelch_ff.h> -#include "squelch_base_ff_impl.h" -#include <fft/goertzel.h> - -namespace gr { - namespace analog { - - class ctcss_squelch_ff_impl : public ctcss_squelch_ff, squelch_base_ff_impl - { - private: - float d_freq; - float d_level; - int d_len; - bool d_mute; - - fft::goertzel d_goertzel_l; - fft::goertzel d_goertzel_c; - fft::goertzel d_goertzel_r; - - int find_tone(float freq); - - protected: - virtual void update_state(const float &in); - virtual bool mute() const { return d_mute; } - - public: - ctcss_squelch_ff_impl(int rate, float freq, float level, - int len, int ramp, bool gate); - ~ctcss_squelch_ff_impl(); - - std::vector<float> squelch_range() const; - float level() const { return d_level; } - void set_level(float level) { d_level = level; } - int len() const { return d_len; } - - int ramp() const { return squelch_base_ff_impl::ramp(); } - void set_ramp(int ramp) { squelch_base_ff_impl::set_ramp(ramp); } - bool gate() const { return squelch_base_ff_impl::gate(); } - void set_gate(bool gate) { squelch_base_ff_impl::set_gate(gate); } - bool unmuted() const { return squelch_base_ff_impl::unmuted(); } - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - return squelch_base_ff_impl::general_work(noutput_items, - ninput_items, - input_items, - output_items); - } - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_CTCSS_SQUELCH_FF_IMPL_H */ diff --git a/gr-analog/lib/dpll_bb_impl.cc b/gr-analog/lib/dpll_bb_impl.cc deleted file mode 100644 index a199b66b4..000000000 --- a/gr-analog/lib/dpll_bb_impl.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2009,2010 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 "dpll_bb_impl.h" -#include <gr_io_signature.h> -#include <cstdio> - -namespace gr { - namespace analog { - - dpll_bb::sptr - dpll_bb::make(float period, float gain) - { - return gnuradio::get_initial_sptr - (new dpll_bb_impl(period, gain)); - } - - dpll_bb_impl::dpll_bb_impl(float period, float gain) - : gr_sync_block("dpll_bb", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(char))), - d_restart(0), d_pulse_phase(0) - { - d_pulse_frequency = 1.0/period; - d_gain = gain; - d_decision_threshold = 1.0 - 0.5*d_pulse_frequency; -#if 0 - fprintf(stderr,"frequency = %f period = %f gain = %f threshold = %f\n", - d_pulse_frequency, - period, - d_gain, - d_decision_threshold); -#endif - } - - dpll_bb_impl::~dpll_bb_impl() - { - } - - int - dpll_bb_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - const char *iptr = (const char*)input_items[0]; - char *optr = (char*)output_items[0]; - - for(int i = 0; i < noutput_items; i++) { - optr[i]= 0; - if(iptr[i] == 1) { - if(d_restart == 0) { - d_pulse_phase = 1; - } - else { - if(d_pulse_phase > 0.5) - d_pulse_phase += d_gain*(1.0-d_pulse_phase); - else - d_pulse_phase -= d_gain*d_pulse_phase; - } - d_restart = 3; - } - if(d_pulse_phase > d_decision_threshold) { - d_pulse_phase -= 1.0; - if(d_restart > 0) { - d_restart -= 1; - optr[i] = 1; - } - } - d_pulse_phase += d_pulse_frequency; - } - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/dpll_bb_impl.h b/gr-analog/lib/dpll_bb_impl.h deleted file mode 100644 index a1d8b7709..000000000 --- a/gr-analog/lib/dpll_bb_impl.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,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 INCLUDED_ANALOG_DPLL_BB_IMPL_H -#define INCLUDED_ANALOG_DPLL_BB_IMPL_H - -#include <analog/dpll_bb.h> - -namespace gr { - namespace analog { - - class dpll_bb_impl : public dpll_bb - { - private: - unsigned char d_restart; - float d_pulse_phase, d_pulse_frequency; - float d_gain, d_decision_threshold; - - public: - dpll_bb_impl(float period, float gain); - ~dpll_bb_impl(); - - void set_gain(float gain) { d_gain = gain; } - void set_decision_threshold(float thresh) { d_decision_threshold = thresh; } - - float gain() const { return d_gain; } - float freq() const { return d_pulse_frequency; } - float phase() const { return d_pulse_phase; } - float decision_threshold() const { return d_decision_threshold; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_DPLL_BB_IMPL_H */ diff --git a/gr-analog/lib/feedforward_agc_cc_impl.cc b/gr-analog/lib/feedforward_agc_cc_impl.cc deleted file mode 100644 index 4796fdfc5..000000000 --- a/gr-analog/lib/feedforward_agc_cc_impl.cc +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,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 "feedforward_agc_cc_impl.h" -#include <gr_io_signature.h> -#include <stdexcept> - -namespace gr { - namespace analog { - - feedforward_agc_cc::sptr - feedforward_agc_cc::make(int nsamples, float reference) - { - return gnuradio::get_initial_sptr - (new feedforward_agc_cc_impl(nsamples, reference)); - } - - feedforward_agc_cc_impl::feedforward_agc_cc_impl(int nsamples, float reference) - : gr_sync_block("feedforward_agc_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - d_nsamples(nsamples), d_reference(reference) - { - if(nsamples < 1) - throw std::invalid_argument("feedforward_agc_cc_impl: nsamples must be >= 1"); - - set_history(nsamples); - } - - feedforward_agc_cc_impl::~feedforward_agc_cc_impl() - { - } - - inline static float - mag_squared(gr_complex x) - { - return x.real() * x.real() + x.imag() * x.imag(); - } - - // approximate sqrt(x^2 + y^2) - inline static float - envelope(gr_complex x) - { - float r_abs = std::fabs(x.real()); - float i_abs = std::fabs(x.imag()); - - if(r_abs > i_abs) - return r_abs + 0.4 * i_abs; - else - return i_abs + 0.4 * r_abs; - } - - int - feedforward_agc_cc_impl::work(int noutput_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]; - int nsamples = d_nsamples; - float gain; - - for(int i = 0; i < noutput_items; i++) { - //float max_env = 1e-12; // avoid divide by zero - float max_env = 1e-4; // avoid divide by zero, indirectly set max gain - for(int j = 0; j < nsamples; j++) { - max_env = std::max(max_env, envelope(in[i+j])); - } - gain = d_reference / max_env; - out[i] = gain * in[i]; - } - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/feedforward_agc_cc_impl.h b/gr-analog/lib/feedforward_agc_cc_impl.h deleted file mode 100644 index 60c7acada..000000000 --- a/gr-analog/lib/feedforward_agc_cc_impl.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_IMPL_H -#define INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_IMPL_H - -#include <analog/feedforward_agc_cc.h> - -namespace gr { - namespace analog { - - class feedforward_agc_cc_impl : public feedforward_agc_cc - { - private: - int d_nsamples; - float d_reference; - - public: - feedforward_agc_cc_impl(int nsamples, float reference); - ~feedforward_agc_cc_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_IMPL_H */ diff --git a/gr-analog/lib/fmdet_cf_impl.cc b/gr-analog/lib/fmdet_cf_impl.cc deleted file mode 100644 index c92ea2889..000000000 --- a/gr-analog/lib/fmdet_cf_impl.cc +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,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 "fmdet_cf_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> - -namespace gr { - namespace analog { - -#define M_TWOPI (2*M_PI) - - fmdet_cf::sptr - fmdet_cf::make(float samplerate, float freq_low, - float freq_high, float scl) - { - return gnuradio::get_initial_sptr - (new fmdet_cf_impl(samplerate, freq_low, freq_high, scl)); - } - - fmdet_cf_impl::fmdet_cf_impl(float samplerate, float freq_low, - float freq_high, float scl) - : gr_sync_block("fmdet_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))), - d_S1(0.1), d_S2(0.1), - d_S3(0.1), d_S4(0.1) - { - //const float h[] = { 0.003118678733, -0.012139843428, 0.027270898036, - // -0.051318579352, 0.090406910552, -0.162926865366, - // 0.361885392563, 0.000000000000, -0.361885392563, - // 0.162926865366, -0.090406910552, 0.051318579352, - // -0.027270898036, 0.012139843428, -0.003118678733}; - - //std::vector<float> taps(15); - - d_freq = 0; - d_freqhi = freq_high; - d_freqlo = freq_low; - set_scale(scl); - - //for(int i = 0; i < 15; i++) { - //taps[i] = h[i]; - //} - // d_filter = gr_fir_util::create_gr_fir_ccf(taps); - } - - fmdet_cf_impl::~fmdet_cf_impl() - { - } - - void - fmdet_cf_impl::set_scale(float scl) - { - float delta = d_freqhi - d_freqlo; - d_scl = scl; - d_bias = 0.5*scl*(d_freqhi + d_freqlo) / delta; - } - - void - fmdet_cf_impl::set_freq_range(float freq_low, float freq_high) - { - d_freqhi = freq_high; - d_freqlo = freq_low; - set_scale(d_scl); - } - - int - fmdet_cf_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - const gr_complex *iptr = (gr_complex*)input_items[0]; - float *optr = (float*)output_items[0]; - //const gr_complex *scaleiptr = (gr_complex*)input_items[0]; - - int size = noutput_items; - - gr_complex Sdot, S0; - gr_complex S1=d_S1, S2=d_S2, S3=d_S3, S4=d_S4; - float d_8 = 8.0; - - while(size-- > 0) { - S0 = *iptr++; - - Sdot = d_scl * (-S0+d_8*S1-d_8*S1+S4); - - d_freq = (S2.real()*Sdot.imag()-S2.imag()*Sdot.real()) / - (S2.real()*S2.real()+S2.imag()*S2.imag()); - - S4 = S3; - S3 = S2; - S2 = S1; - S1 = S0; - - *optr++ = d_freq-d_bias; - } - d_S1 = S1; - d_S2 = S2; - d_S3 = S3; - d_S4 = S4; - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/fmdet_cf_impl.h b/gr-analog/lib/fmdet_cf_impl.h deleted file mode 100644 index 01fce09dd..000000000 --- a/gr-analog/lib/fmdet_cf_impl.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008, 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 INCLUDED_ANALOG_FMDET_CF_IMPL_H -#define INCLUDED_ANALOG_FMDET_CF_IMPL_H - -#include <analog/fmdet_cf.h> -//#include <filter/fir_filter.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - class fmdet_cf_impl : public fmdet_cf - { - private: - gr_complex d_S1, d_S2, d_S3, d_S4; - float d_freq, d_freqlo, d_freqhi, d_scl, d_bias; - //kernel::fir_filter_ccf* d_filter; - - public: - fmdet_cf_impl(float samplerate, float freq_low, - float freq_high, float scl); - ~fmdet_cf_impl(); - - void set_scale(float scl); - void set_freq_range(float freq_low, float freq_high); - - float freq() const { return d_freq; } - float freq_high() const { return d_freqhi; } - float freq_low() const { return d_freqlo; } - float scale() const { return d_scl; } - float bias() const { return d_bias; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_FMDET_CF_IMPL_H */ diff --git a/gr-analog/lib/frequency_modulator_fc_impl.cc b/gr-analog/lib/frequency_modulator_fc_impl.cc deleted file mode 100644 index 2da7ee15f..000000000 --- a/gr-analog/lib/frequency_modulator_fc_impl.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010-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 "frequency_modulator_fc_impl.h" -#include <gr_io_signature.h> -#include <gr_fxpt.h> -#include <math.h> -#include <boost/math/special_functions/trunc.hpp> - -namespace gr { - namespace analog { - - frequency_modulator_fc::sptr - frequency_modulator_fc::make(double sensitivity) - { - return gnuradio::get_initial_sptr - (new frequency_modulator_fc_impl(sensitivity)); - } - - frequency_modulator_fc_impl::frequency_modulator_fc_impl(double sensitivity) - : gr_sync_block("frequency_modulator_fc", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - d_sensitivity(sensitivity), d_phase(0) - { - } - - frequency_modulator_fc_impl::~frequency_modulator_fc_impl() - { - } - - int - frequency_modulator_fc_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]; - gr_complex *out = (gr_complex*)output_items[0]; - - for(int i = 0; i < noutput_items; i++) { - d_phase = d_phase + d_sensitivity * in[i]; - - while(d_phase > (float)(M_PI)) - d_phase -= (float)(2.0 * M_PI); - while(d_phase < (float)(-M_PI)) - d_phase += (float)(2.0 * M_PI); - - float oi, oq; - - gr_int32 angle = gr_fxpt::float_to_fixed (d_phase); - gr_fxpt::sincos(angle, &oq, &oi); - out[i] = gr_complex(oi, oq); - } - - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/frequency_modulator_fc_impl.h b/gr-analog/lib/frequency_modulator_fc_impl.h deleted file mode 100644 index 36512f516..000000000 --- a/gr-analog/lib/frequency_modulator_fc_impl.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_IMPL_H -#define INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_IMPL_H - -#include <analog/frequency_modulator_fc.h> - -namespace gr { - namespace analog { - - class frequency_modulator_fc_impl : public frequency_modulator_fc - { - private: - float d_sensitivity; - float d_phase; - - public: - frequency_modulator_fc_impl(double sensitivity); - ~frequency_modulator_fc_impl(); - - void set_sensitivity(float sens) { d_sensitivity = sens; } - float sensitivity() const { return d_sensitivity; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_IMPL_H */ diff --git a/gr-analog/lib/noise_source_X_impl.cc.t b/gr-analog/lib/noise_source_X_impl.cc.t deleted file mode 100644 index 40e2517d2..000000000 --- a/gr-analog/lib/noise_source_X_impl.cc.t +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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. - */ - -/* @WARNING@ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "@IMPL_NAME@.h" -#include <gr_io_signature.h> -#include <stdexcept> - -namespace gr { - namespace analog { - - @BASE_NAME@::sptr - @BASE_NAME@::make(noise_type_t type, float ampl, long seed) - { - return gnuradio::get_initial_sptr - (new @IMPL_NAME@(type, ampl, seed)); - } - - @IMPL_NAME@::@IMPL_NAME@(noise_type_t type, float ampl, long seed) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(@TYPE@))), - d_type(type), - d_ampl(ampl), - d_rng(seed) - { - } - - @IMPL_NAME@::~@IMPL_NAME@() - { - } - - void - @IMPL_NAME@::set_type(noise_type_t type) - { - gruel::scoped_lock l(d_setlock); - d_type = type; - } - - void - @IMPL_NAME@::set_amplitude(float ampl) - { - gruel::scoped_lock l(d_setlock); - d_ampl = ampl; - } - - int - @IMPL_NAME@::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - gruel::scoped_lock l(d_setlock); - - @TYPE@ *out = (@TYPE@*)output_items[0]; - - switch(d_type) { -#if @IS_COMPLEX@ // complex? - - case GR_UNIFORM: - for(int i = 0; i < noutput_items; i++) { - out[i] = gr_complex(d_ampl * ((d_rng.ran1() * 2.0) - 1.0), - d_ampl * ((d_rng.ran1() * 2.0) - 1.0)); - } - break; - - case GR_GAUSSIAN: - for(int i = 0; i < noutput_items; i++) { - out[i] = d_ampl * d_rng.rayleigh_complex(); - } - break; - -#else // nope... - - case GR_UNIFORM: - for(int i = 0; i < noutput_items; i++) { - out[i] = (@TYPE@)(d_ampl * ((d_rng.ran1() * 2.0) - 1.0)); - } - break; - - case GR_GAUSSIAN: - for(int i = 0; i < noutput_items; i++) { - out[i] = (@TYPE@)(d_ampl * d_rng.gasdev()); - } - break; - - case GR_LAPLACIAN: - for(int i = 0; i < noutput_items; i++) { - out[i] = (@TYPE@)(d_ampl * d_rng.laplacian()); - } - break; - - case GR_IMPULSE: // FIXME changeable impulse settings - for(int i = 0; i < noutput_items; i++) { - out[i] = (@TYPE@)(d_ampl * d_rng.impulse(9)); - } - break; -#endif - - default: - throw std::runtime_error("invalid type"); - } - - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ - diff --git a/gr-analog/lib/noise_source_X_impl.h.t b/gr-analog/lib/noise_source_X_impl.h.t deleted file mode 100644 index 3a0e8d6d7..000000000 --- a/gr-analog/lib/noise_source_X_impl.h.t +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -/* @WARNING@ */ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <analog/@BASE_NAME@.h> -#include <gr_random.h> - -namespace gr { - namespace analog { - - class @IMPL_NAME@ : public @BASE_NAME@ - { - noise_type_t d_type; - float d_ampl; - gr_random d_rng; - - public: - @IMPL_NAME@(noise_type_t type, float ampl, long seed = 0); - ~@IMPL_NAME@(); - - void set_type(noise_type_t type); - void set_amplitude(float ampl); - - noise_type_t type() const { return d_type; } - float amplitude() const { return d_ampl; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace filter */ -} /* namespace gr */ - -#endif /* @GUARD_NAME@ */ diff --git a/gr-analog/lib/phase_modulator_fc_impl.cc b/gr-analog/lib/phase_modulator_fc_impl.cc deleted file mode 100644 index 9e9e73f8c..000000000 --- a/gr-analog/lib/phase_modulator_fc_impl.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2010,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 "phase_modulator_fc_impl.h" -#include <gr_io_signature.h> -#include <gr_sincos.h> -#include <math.h> - -namespace gr { - namespace analog { - - phase_modulator_fc::sptr - phase_modulator_fc::make(double sensitivity) - { - return gnuradio::get_initial_sptr - (new phase_modulator_fc_impl(sensitivity)); - } - - phase_modulator_fc_impl::phase_modulator_fc_impl(double sensitivity) - : gr_sync_block("phase_modulator_fc", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - d_sensitivity(sensitivity), d_phase(0) - { - } - - phase_modulator_fc_impl::~phase_modulator_fc_impl() - { - } - - int - phase_modulator_fc_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]; - gr_complex *out = (gr_complex*)output_items[0]; - - for(int i = 0; i < noutput_items; i++) { - d_phase = d_sensitivity * in[i]; - float oi, oq; - gr_sincosf(d_phase, &oq, &oi); - out[i] = gr_complex(oi, oq); - } - - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/phase_modulator_fc_impl.h b/gr-analog/lib/phase_modulator_fc_impl.h deleted file mode 100644 index ac10bc891..000000000 --- a/gr-analog/lib/phase_modulator_fc_impl.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_ANALOG_PHASE_MODULATOR_FC_IMPL_H -#define INCLUDED_ANALOG_PHASE_MODULATOR_FC_IMPL_H - -#include <analog/phase_modulator_fc.h> - -namespace gr { - namespace analog { - - class phase_modulator_fc_impl : public phase_modulator_fc - { - private: - double d_sensitivity; - double d_phase; - - public: - phase_modulator_fc_impl(double sensitivity); - ~phase_modulator_fc_impl(); - - double sensitivity() const { return d_sensitivity; } - double phase() const { return d_phase; } - - void set_sensitivity(double s) { d_sensitivity = s; } - void set_phase(double p) { d_phase = p; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PHASE_MODULATOR_FC_IMPL_H */ diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.cc b/gr-analog/lib/pll_carriertracking_cc_impl.cc deleted file mode 100644 index c53e0f433..000000000 --- a/gr-analog/lib/pll_carriertracking_cc_impl.cc +++ /dev/null @@ -1,228 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010-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 "pll_carriertracking_cc_impl.h" -#include <gr_io_signature.h> -#include <gr_sincos.h> -#include <math.h> -#include <gr_math.h> - -namespace gr { - namespace analog { - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - - pll_carriertracking_cc::sptr - pll_carriertracking_cc::make(float loop_bw, float max_freq, float min_freq) - { - return gnuradio::get_initial_sptr - (new pll_carriertracking_cc_impl(loop_bw, max_freq, min_freq)); - } - - pll_carriertracking_cc_impl::pll_carriertracking_cc_impl(float loop_bw, - float max_freq, - float min_freq) - : gr_sync_block("pll_carriertracking_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - gri_control_loop(loop_bw, max_freq, min_freq), - d_locksig(0), d_lock_threshold(0), d_squelch_enable(false) - { - } - - pll_carriertracking_cc_impl::~pll_carriertracking_cc_impl() - { - } - - float - pll_carriertracking_cc_impl::mod_2pi(float in) - { - if(in>M_PI) - return in-M_TWOPI; - else if(in<-M_PI) - return in+M_TWOPI; - else - return in; - } - - float - pll_carriertracking_cc_impl::phase_detector(gr_complex sample, float ref_phase) - { - float sample_phase; - // sample_phase = atan2(sample.imag(),sample.real()); - sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); - return mod_2pi(sample_phase-ref_phase); - } - - bool - pll_carriertracking_cc_impl::lock_detector(void) - { - return (fabsf(d_locksig) > d_lock_threshold); - } - - bool - pll_carriertracking_cc_impl::squelch_enable(bool set_squelch) - { - return d_squelch_enable = set_squelch; - } - - float - pll_carriertracking_cc_impl::set_lock_threshold(float threshold) - { - return d_lock_threshold = threshold; - } - - int - pll_carriertracking_cc_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - const gr_complex *iptr = (gr_complex*)input_items[0]; - gr_complex *optr = (gr_complex*)output_items[0]; - - float error; - float t_imag, t_real; - - for(int i = 0; i < noutput_items; i++) { - gr_sincosf(d_phase, &t_imag, &t_real); - optr[i] = iptr[i] * gr_complex(t_real, -t_imag); - - error = phase_detector(iptr[i], d_phase); - - advance_loop(error); - phase_wrap(); - frequency_limit(); - - d_locksig = d_locksig * (1.0 - d_alpha) + \ - d_alpha*(iptr[i].real() * t_real + iptr[i].imag() * t_imag); - - if((d_squelch_enable) && !lock_detector()) - optr[i] = 0; - } - return noutput_items; - } - - void - pll_carriertracking_cc_impl::set_loop_bandwidth(float bw) - { - gri_control_loop::set_loop_bandwidth(bw); - } - - void - pll_carriertracking_cc_impl::set_damping_factor(float df) - { - gri_control_loop::set_damping_factor(df); - } - - void - pll_carriertracking_cc_impl::set_alpha(float alpha) - { - gri_control_loop::set_alpha(alpha); - } - - void - pll_carriertracking_cc_impl::set_beta(float beta) - { - gri_control_loop::set_beta(beta); - } - - void - pll_carriertracking_cc_impl::set_frequency(float freq) - { - gri_control_loop::set_frequency(freq); - } - - void - pll_carriertracking_cc_impl::set_phase(float phase) - { - gri_control_loop::set_phase(phase); - } - - void - pll_carriertracking_cc_impl::set_min_freq(float freq) - { - gri_control_loop::set_min_freq(freq); - } - - void - pll_carriertracking_cc_impl::set_max_freq(float freq) - { - gri_control_loop::set_max_freq(freq); - } - - - float - pll_carriertracking_cc_impl::get_loop_bandwidth() const - { - return gri_control_loop::get_loop_bandwidth(); - } - - float - pll_carriertracking_cc_impl::get_damping_factor() const - { - return gri_control_loop::get_damping_factor(); - } - - float - pll_carriertracking_cc_impl::get_alpha() const - { - return gri_control_loop::get_alpha(); - } - - float - pll_carriertracking_cc_impl::get_beta() const - { - return gri_control_loop::get_beta(); - } - - float - pll_carriertracking_cc_impl::get_frequency() const - { - return gri_control_loop::get_frequency(); - } - - float - pll_carriertracking_cc_impl::get_phase() const - { - return gri_control_loop::get_phase(); - } - - float - pll_carriertracking_cc_impl::get_min_freq() const - { - return gri_control_loop::get_min_freq(); - } - - float - pll_carriertracking_cc_impl::get_max_freq() const - { - return gri_control_loop::get_max_freq(); - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.h b/gr-analog/lib/pll_carriertracking_cc_impl.h deleted file mode 100644 index d67223db8..000000000 --- a/gr-analog/lib/pll_carriertracking_cc_impl.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2011,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 INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H -#define INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H - -#include <analog/pll_carriertracking_cc.h> -#include <gri_control_loop.h> - -namespace gr { - namespace analog { - - class pll_carriertracking_cc_impl - : public pll_carriertracking_cc, public gri_control_loop - { - private: - float d_locksig,d_lock_threshold; - bool d_squelch_enable; - - float mod_2pi(float in); - float phase_detector(gr_complex sample,float ref_phase); - - public: - pll_carriertracking_cc_impl(float loop_bw, float max_freq, float min_freq); - ~pll_carriertracking_cc_impl(); - - bool lock_detector(void); - bool squelch_enable(bool); - float set_lock_threshold(float); - - void set_loop_bandwidth(float bw); - void set_damping_factor(float df); - void set_alpha(float alpha); - void set_beta(float beta); - void set_frequency(float freq); - void set_phase(float phase); - void set_min_freq(float freq); - void set_max_freq(float freq); - - float get_loop_bandwidth() const; - float get_damping_factor() const; - float get_alpha() const; - float get_beta() const; - float get_frequency() const; - float get_phase() const; - float get_min_freq() const; - float get_max_freq() const; - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H */ diff --git a/gr-analog/lib/pll_freqdet_cf_impl.cc b/gr-analog/lib/pll_freqdet_cf_impl.cc deleted file mode 100644 index 27e8d02aa..000000000 --- a/gr-analog/lib/pll_freqdet_cf_impl.cc +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2011 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 "pll_freqdet_cf_impl.h" -#include <gr_io_signature.h> -#include <math.h> -#include <gr_math.h> - -namespace gr { - namespace analog { - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - - pll_freqdet_cf::sptr - pll_freqdet_cf::make(float loop_bw, float max_freq, float min_freq) - { - return gnuradio::get_initial_sptr - (new pll_freqdet_cf_impl(loop_bw, max_freq, min_freq)); - } - - pll_freqdet_cf_impl::pll_freqdet_cf_impl(float loop_bw, float max_freq, float min_freq) - : gr_sync_block("pll_freqdet_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))), - gri_control_loop(loop_bw, max_freq, min_freq) - { - } - - pll_freqdet_cf_impl::~pll_freqdet_cf_impl() - { - } - - float - pll_freqdet_cf_impl::mod_2pi(float in) - { - if(in > M_PI) - return in - M_TWOPI; - else if(in < -M_PI) - return in + M_TWOPI; - else - return in; - } - - float - pll_freqdet_cf_impl::phase_detector(gr_complex sample, float ref_phase) - { - float sample_phase; - sample_phase = gr_fast_atan2f(sample.imag(), sample.real()); - return mod_2pi(sample_phase - ref_phase); - } - - int - pll_freqdet_cf_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - const gr_complex *iptr = (gr_complex*)input_items[0]; - float *optr = (float*)output_items[0]; - - float error; - int size = noutput_items; - - while(size-- > 0) { - *optr++ = d_freq; - - error = phase_detector(*iptr++, d_phase); - - advance_loop(error); - phase_wrap(); - frequency_limit(); - } - return noutput_items; - } - - void - pll_freqdet_cf_impl::set_loop_bandwidth(float bw) - { - gri_control_loop::set_loop_bandwidth(bw); - } - - void - pll_freqdet_cf_impl::set_damping_factor(float df) - { - gri_control_loop::set_damping_factor(df); - } - - void - pll_freqdet_cf_impl::set_alpha(float alpha) - { - gri_control_loop::set_alpha(alpha); - } - - void - pll_freqdet_cf_impl::set_beta(float beta) - { - gri_control_loop::set_beta(beta); - } - - void - pll_freqdet_cf_impl::set_frequency(float freq) - { - gri_control_loop::set_frequency(freq); - } - - void - pll_freqdet_cf_impl::set_phase(float phase) - { - gri_control_loop::set_phase(phase); - } - - void - pll_freqdet_cf_impl::set_min_freq(float freq) - { - gri_control_loop::set_min_freq(freq); - } - - void - pll_freqdet_cf_impl::set_max_freq(float freq) - { - gri_control_loop::set_max_freq(freq); - } - - - float - pll_freqdet_cf_impl::get_loop_bandwidth() const - { - return gri_control_loop::get_loop_bandwidth(); - } - - float - pll_freqdet_cf_impl::get_damping_factor() const - { - return gri_control_loop::get_damping_factor(); - } - - float - pll_freqdet_cf_impl::get_alpha() const - { - return gri_control_loop::get_alpha(); - } - - float - pll_freqdet_cf_impl::get_beta() const - { - return gri_control_loop::get_beta(); - } - - float - pll_freqdet_cf_impl::get_frequency() const - { - return gri_control_loop::get_frequency(); - } - - float - pll_freqdet_cf_impl::get_phase() const - { - return gri_control_loop::get_phase(); - } - - float - pll_freqdet_cf_impl::get_min_freq() const - { - return gri_control_loop::get_min_freq(); - } - - float - pll_freqdet_cf_impl::get_max_freq() const - { - return gri_control_loop::get_max_freq(); - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/pll_freqdet_cf_impl.h b/gr-analog/lib/pll_freqdet_cf_impl.h deleted file mode 100644 index 7acf53ebb..000000000 --- a/gr-analog/lib/pll_freqdet_cf_impl.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011,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 INCLUDED_ANALOG_PLL_FREQDET_CF_IMPL_H -#define INCLUDED_ANALOG_PLL_FREQDET_CF_IMPL_H - -#include <analog/pll_freqdet_cf.h> -#include <gri_control_loop.h> - -namespace gr { - namespace analog { - - class pll_freqdet_cf_impl : - public pll_freqdet_cf, public gri_control_loop - { - private: - float phase_detector(gr_complex sample,float ref_phase); - - public: - pll_freqdet_cf_impl(float loop_bw, float max_freq, float min_freq); - ~pll_freqdet_cf_impl(); - - float mod_2pi(float in); - - void set_loop_bandwidth(float bw); - void set_damping_factor(float df); - void set_alpha(float alpha); - void set_beta(float beta); - void set_frequency(float freq); - void set_phase(float phase); - void set_min_freq(float freq); - void set_max_freq(float freq); - - float get_loop_bandwidth() const; - float get_damping_factor() const; - float get_alpha() const; - float get_beta() const; - float get_frequency() const; - float get_phase() const; - float get_min_freq() const; - float get_max_freq() const; - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PLL_FREQDET_CF_IMPL_H */ diff --git a/gr-analog/lib/pll_refout_cc_impl.cc b/gr-analog/lib/pll_refout_cc_impl.cc deleted file mode 100644 index b94e3660a..000000000 --- a/gr-analog/lib/pll_refout_cc_impl.cc +++ /dev/null @@ -1,201 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010-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 "pll_refout_cc_impl.h" -#include <gr_io_signature.h> -#include <gr_sincos.h> -#include <math.h> -#include <gr_math.h> - -namespace gr { - namespace analog { - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - - pll_refout_cc::sptr - pll_refout_cc::make(float loop_bw, float max_freq, float min_freq) - { - return gnuradio::get_initial_sptr - (new pll_refout_cc_impl(loop_bw, max_freq, min_freq)); - } - - pll_refout_cc_impl::pll_refout_cc_impl(float loop_bw, float max_freq, float min_freq) - : gr_sync_block("pll_refout_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - gri_control_loop(loop_bw, max_freq, min_freq) - { - } - - pll_refout_cc_impl::~pll_refout_cc_impl() - { - } - - float - pll_refout_cc_impl::mod_2pi(float in) - { - if(in > M_PI) - return in - M_TWOPI; - else if(in < -M_PI) - return in+ M_TWOPI; - else - return in; - } - - float - pll_refout_cc_impl::phase_detector(gr_complex sample,float ref_phase) - { - float sample_phase; - sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); - return mod_2pi(sample_phase-ref_phase); - } - - int - pll_refout_cc_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - const gr_complex *iptr = (gr_complex*)input_items[0]; - gr_complex *optr = (gr_complex*)output_items[0]; - - float error; - float t_imag, t_real; - int size = noutput_items; - - while(size-- > 0) { - gr_sincosf(d_phase,&t_imag,&t_real); - *optr++ = gr_complex(t_real,t_imag); - - error = phase_detector(*iptr++,d_phase); - - advance_loop(error); - phase_wrap(); - frequency_limit(); - } - return noutput_items; - } - - void - pll_refout_cc_impl::set_loop_bandwidth(float bw) - { - gri_control_loop::set_loop_bandwidth(bw); - } - - void - pll_refout_cc_impl::set_damping_factor(float df) - { - gri_control_loop::set_damping_factor(df); - } - - void - pll_refout_cc_impl::set_alpha(float alpha) - { - gri_control_loop::set_alpha(alpha); - } - - void - pll_refout_cc_impl::set_beta(float beta) - { - gri_control_loop::set_beta(beta); - } - - void - pll_refout_cc_impl::set_frequency(float freq) - { - gri_control_loop::set_frequency(freq); - } - - void - pll_refout_cc_impl::set_phase(float phase) - { - gri_control_loop::set_phase(phase); - } - - void - pll_refout_cc_impl::set_min_freq(float freq) - { - gri_control_loop::set_min_freq(freq); - } - - void - pll_refout_cc_impl::set_max_freq(float freq) - { - gri_control_loop::set_max_freq(freq); - } - - - float - pll_refout_cc_impl::get_loop_bandwidth() const - { - return gri_control_loop::get_loop_bandwidth(); - } - - float - pll_refout_cc_impl::get_damping_factor() const - { - return gri_control_loop::get_damping_factor(); - } - - float - pll_refout_cc_impl::get_alpha() const - { - return gri_control_loop::get_alpha(); - } - - float - pll_refout_cc_impl::get_beta() const - { - return gri_control_loop::get_beta(); - } - - float - pll_refout_cc_impl::get_frequency() const - { - return gri_control_loop::get_frequency(); - } - - float - pll_refout_cc_impl::get_phase() const - { - return gri_control_loop::get_phase(); - } - - float - pll_refout_cc_impl::get_min_freq() const - { - return gri_control_loop::get_min_freq(); - } - - float - pll_refout_cc_impl::get_max_freq() const - { - return gri_control_loop::get_max_freq(); - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/pll_refout_cc_impl.h b/gr-analog/lib/pll_refout_cc_impl.h deleted file mode 100644 index 9e8ae286b..000000000 --- a/gr-analog/lib/pll_refout_cc_impl.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011,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 INCLUDED_ANALOG_PLL_REFOUT_CC_IMPL_H -#define INCLUDED_ANALOG_PLL_REFOUT_CC_IMPL_H - -#include <analog/pll_refout_cc.h> -#include <gri_control_loop.h> - -namespace gr { - namespace analog { - - class pll_refout_cc_impl - : public pll_refout_cc, public gri_control_loop - { - private: - float mod_2pi (float in); - float phase_detector(gr_complex sample, float ref_phase); - - public: - pll_refout_cc_impl(float loop_bw, float max_freq, float min_freq); - ~pll_refout_cc_impl(); - - void set_loop_bandwidth(float bw); - void set_damping_factor(float df); - void set_alpha(float alpha); - void set_beta(float beta); - void set_frequency(float freq); - void set_phase(float phase); - void set_min_freq(float freq); - void set_max_freq(float freq); - - float get_loop_bandwidth() const; - float get_damping_factor() const; - float get_alpha() const; - float get_beta() const; - float get_frequency() const; - float get_phase() const; - float get_min_freq() const; - float get_max_freq() const; - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PLL_REFOUT_CC_IMPL_H */ diff --git a/gr-analog/lib/probe_avg_mag_sqrd_c_impl.cc b/gr-analog/lib/probe_avg_mag_sqrd_c_impl.cc deleted file mode 100644 index 291809bb2..000000000 --- a/gr-analog/lib/probe_avg_mag_sqrd_c_impl.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010,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 "probe_avg_mag_sqrd_c_impl.h" -#include <gr_io_signature.h> -#include <cmath> - -namespace gr { - namespace analog { - - probe_avg_mag_sqrd_c::sptr - probe_avg_mag_sqrd_c::make(double threshold_db, double alpha) - { - return gnuradio::get_initial_sptr - (new probe_avg_mag_sqrd_c_impl(threshold_db, alpha)); - } - - probe_avg_mag_sqrd_c_impl::probe_avg_mag_sqrd_c_impl(double threshold_db, double alpha) - : gr_sync_block("probe_avg_mag_sqrd_c", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), - d_unmuted(false), d_level(0), d_iir(alpha) - { - set_threshold(threshold_db); - } - - probe_avg_mag_sqrd_c_impl::~probe_avg_mag_sqrd_c_impl() - { - } - - int - probe_avg_mag_sqrd_c_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - const gr_complex *in = (const gr_complex*)input_items[0]; - - for(int i = 0; i < noutput_items; i++) { - double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag(); - d_iir.filter(mag_sqrd); // computed for side effect: prev_output() - } - - d_unmuted = d_iir.prev_output() >= d_threshold; - d_level = d_iir.prev_output(); - return noutput_items; - } - - double - probe_avg_mag_sqrd_c_impl::threshold() const - { - return 10 * std::log10(d_threshold); - } - - void - probe_avg_mag_sqrd_c_impl::set_threshold(double decibels) - { - // convert to absolute threshold (mag squared) - d_threshold = std::pow(10.0, decibels/10); - } - - void - probe_avg_mag_sqrd_c_impl::set_alpha(double alpha) - { - d_iir.set_taps(alpha); - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/probe_avg_mag_sqrd_c_impl.h b/gr-analog/lib/probe_avg_mag_sqrd_c_impl.h deleted file mode 100644 index 0a2685357..000000000 --- a/gr-analog/lib/probe_avg_mag_sqrd_c_impl.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_IMPL_H -#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_IMPL_H - -#include <analog/probe_avg_mag_sqrd_c.h> -#include <filter/single_pole_iir.h> - -namespace gr { - namespace analog { - - class probe_avg_mag_sqrd_c_impl : public probe_avg_mag_sqrd_c - { - private: - double d_threshold; - bool d_unmuted; - double d_level; - filter::single_pole_iir<double,double,double> d_iir; - - public: - probe_avg_mag_sqrd_c_impl(double threshold_db, double alpha = 0.0001); - ~probe_avg_mag_sqrd_c_impl(); - - bool unmuted() const { return d_unmuted; } - double level() const { return d_level; } - - double threshold() const; - - void set_alpha(double alpha); - void set_threshold(double decibels); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_IMPL_H */ diff --git a/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.cc b/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.cc deleted file mode 100644 index ceaf5dbf0..000000000 --- a/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2007,2010,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 "probe_avg_mag_sqrd_cf_impl.h" -#include <gr_io_signature.h> -#include <cmath> - -namespace gr { - namespace analog { - - probe_avg_mag_sqrd_cf::sptr - probe_avg_mag_sqrd_cf::make(double threshold_db, double alpha) - { - return gnuradio::get_initial_sptr - (new probe_avg_mag_sqrd_cf_impl(threshold_db, alpha)); - } - - probe_avg_mag_sqrd_cf_impl::probe_avg_mag_sqrd_cf_impl(double threshold_db, double alpha) - : gr_sync_block("probe_avg_mag_sqrd_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))), - d_unmuted(false), d_level(0), d_iir(alpha) - { - set_threshold(threshold_db); - } - - probe_avg_mag_sqrd_cf_impl::~probe_avg_mag_sqrd_cf_impl() - { - } - - int - probe_avg_mag_sqrd_cf_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - const gr_complex *in = (const gr_complex*)input_items[0]; - float *out = (float*)output_items[0]; - - for(int i = 0; i < noutput_items; i++) { - out[i] = d_iir.prev_output(); - double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag(); - d_iir.filter(mag_sqrd); // computed for side effect: prev_output() - } - - d_unmuted = d_iir.prev_output() >= d_threshold; - d_level = d_iir.prev_output(); - return noutput_items; - } - - double - probe_avg_mag_sqrd_cf_impl::threshold() const - { - return 10 * std::log10(d_threshold); - } - - void - probe_avg_mag_sqrd_cf_impl::set_threshold(double decibels) - { - // convert to absolute threshold (mag squared) - d_threshold = std::pow(10.0, decibels/10); - } - - void - probe_avg_mag_sqrd_cf_impl::set_alpha(double alpha) - { - d_iir.set_taps(alpha); - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.h b/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.h deleted file mode 100644 index 9cd8f8d4c..000000000 --- a/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_IMPL_H -#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_IMPL_H - -#include <analog/probe_avg_mag_sqrd_cf.h> -#include <filter/single_pole_iir.h> - -namespace gr { - namespace analog { - - class probe_avg_mag_sqrd_cf_impl : public probe_avg_mag_sqrd_cf - { - private: - double d_threshold; - bool d_unmuted; - double d_level; - filter::single_pole_iir<double,double,double> d_iir; - - public: - probe_avg_mag_sqrd_cf_impl(double threshold_db, double alpha); - ~probe_avg_mag_sqrd_cf_impl(); - - bool unmuted() const { return d_unmuted; } - double level() const { return d_level; } - - double threshold() const; - - void set_alpha(double alpha); - void set_threshold(double decibels); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_IMPL_H */ diff --git a/gr-analog/lib/probe_avg_mag_sqrd_f_impl.cc b/gr-analog/lib/probe_avg_mag_sqrd_f_impl.cc deleted file mode 100644 index 4ac7ef06b..000000000 --- a/gr-analog/lib/probe_avg_mag_sqrd_f_impl.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010,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 "probe_avg_mag_sqrd_f_impl.h" -#include <gr_io_signature.h> -#include <cmath> - -namespace gr { - namespace analog { - - probe_avg_mag_sqrd_f::sptr - probe_avg_mag_sqrd_f::make(double threshold_db, double alpha) - { - return gnuradio::get_initial_sptr - (new probe_avg_mag_sqrd_f_impl(threshold_db, alpha)); - } - - probe_avg_mag_sqrd_f_impl::probe_avg_mag_sqrd_f_impl(double threshold_db, double alpha) - : gr_sync_block("probe_avg_mag_sqrd_f", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(0, 0, 0)), - d_unmuted(false), d_level(0), d_iir(alpha) - { - set_threshold(threshold_db); - } - - probe_avg_mag_sqrd_f_impl::~probe_avg_mag_sqrd_f_impl() - { - } - - int - probe_avg_mag_sqrd_f_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]; - - for(int i = 0; i < noutput_items; i++) { - double mag_sqrd = in[i]*in[i]; - d_iir.filter(mag_sqrd); // computed for side effect: prev_output() - } - - d_unmuted = d_iir.prev_output() >= d_threshold; - d_level = d_iir.prev_output(); - return noutput_items; - } - - double - probe_avg_mag_sqrd_f_impl::threshold() const - { - return 10 * std::log10(d_threshold); - } - - void - probe_avg_mag_sqrd_f_impl::set_threshold(double decibels) - { - // convert to absolute threshold (mag sqrd) - d_threshold = std::pow(10.0, decibels/10); - } - - void - probe_avg_mag_sqrd_f_impl::set_alpha(double alpha) - { - d_iir.set_taps(alpha); - } - - } /* namespace analog */ -} /* namespace gr */ - diff --git a/gr-analog/lib/probe_avg_mag_sqrd_f_impl.h b/gr-analog/lib/probe_avg_mag_sqrd_f_impl.h deleted file mode 100644 index ba879763c..000000000 --- a/gr-analog/lib/probe_avg_mag_sqrd_f_impl.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_IMPL_H -#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_IMPL_H - -#include <analog/probe_avg_mag_sqrd_f.h> -#include <filter/single_pole_iir.h> - -namespace gr { - namespace analog { - - class probe_avg_mag_sqrd_f_impl : public probe_avg_mag_sqrd_f - { - private: - double d_threshold; - bool d_unmuted; - double d_level; - filter::single_pole_iir<double,double,double> d_iir; - - public: - probe_avg_mag_sqrd_f_impl(double threshold_db, double alpha); - ~probe_avg_mag_sqrd_f_impl(); - - bool unmuted() const { return d_unmuted; } - double level() const { return d_level; } - - double threshold() const; - - void set_alpha(double alpha); - void set_threshold(double decibels); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_IMPL_H */ diff --git a/gr-analog/lib/pwr_squelch_cc_impl.cc b/gr-analog/lib/pwr_squelch_cc_impl.cc deleted file mode 100644 index 1bfba6846..000000000 --- a/gr-analog/lib/pwr_squelch_cc_impl.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010,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 "pwr_squelch_cc_impl.h" - -namespace gr { - namespace analog { - - pwr_squelch_cc::sptr - pwr_squelch_cc::make(double threshold, double alpha, - int ramp, bool gate) - { - return gnuradio::get_initial_sptr - (new pwr_squelch_cc_impl(threshold, alpha, ramp, gate)); - } - - pwr_squelch_cc_impl::pwr_squelch_cc_impl(double threshold, double alpha, - int ramp, bool gate) - : gr_block("pwr_squelch_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - squelch_base_cc_impl("pwr_squelch_cc", ramp, gate), - d_iir(alpha) - { - set_threshold(threshold); - } - - pwr_squelch_cc_impl::~pwr_squelch_cc_impl() - { - } - - std::vector<float> - pwr_squelch_cc_impl::squelch_range() const - { - std::vector<float> r(3); - r[0] = -50.0; // min FIXME - r[1] = +50.0; // max FIXME - r[2] = (r[1] - r[0]) / 100; // step size - - return r; - } - - void - pwr_squelch_cc_impl::update_state(const gr_complex &in) - { - d_pwr = d_iir.filter(in.real()*in.real()+in.imag()*in.imag()); - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/pwr_squelch_cc_impl.h b/gr-analog/lib/pwr_squelch_cc_impl.h deleted file mode 100644 index 72df0f3d2..000000000 --- a/gr-analog/lib/pwr_squelch_cc_impl.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_PWR_SQUELCH_CC_IMPL_H -#define INCLUDED_ANALOG_PWR_SQUELCH_CC_IMPL_H - -#include <analog/pwr_squelch_cc.h> -#include "squelch_base_cc_impl.h" -#include <filter/single_pole_iir.h> -#include <cmath> - -namespace gr { - namespace analog { - - class ANALOG_API pwr_squelch_cc_impl : - public pwr_squelch_cc, squelch_base_cc_impl - { - private: - double d_threshold; - double d_pwr; - filter::single_pole_iir<double,double,double> d_iir; - - protected: - virtual void update_state(const gr_complex &in); - virtual bool mute() const { return d_pwr < d_threshold; } - - public: - pwr_squelch_cc_impl(double db, double alpha=0.0001, - int ramp=0, bool gate=false); - ~pwr_squelch_cc_impl(); - - std::vector<float> squelch_range() const; - - double threshold() const { return 10*log10(d_threshold); } - void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } - void set_alpha(double alpha) { d_iir.set_taps(alpha); } - - int ramp() const { return squelch_base_cc_impl::ramp(); } - void set_ramp(int ramp) { squelch_base_cc_impl::set_ramp(ramp); } - bool gate() const { return squelch_base_cc_impl::gate(); } - void set_gate(bool gate) { squelch_base_cc_impl::set_gate(gate); } - bool unmuted() const { return squelch_base_cc_impl::unmuted(); } - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - return squelch_base_cc_impl::general_work(noutput_items, - ninput_items, - input_items, - output_items); - } - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PWR_SQUELCH_CC_IMPL_H */ diff --git a/gr-analog/lib/pwr_squelch_ff_impl.cc b/gr-analog/lib/pwr_squelch_ff_impl.cc deleted file mode 100644 index c6bb6af90..000000000 --- a/gr-analog/lib/pwr_squelch_ff_impl.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010,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 "pwr_squelch_ff_impl.h" - -namespace gr { - namespace analog { - - pwr_squelch_ff::sptr - pwr_squelch_ff::make(double threshold, double alpha, - int ramp, bool gate) - { - return gnuradio::get_initial_sptr - (new pwr_squelch_ff_impl(threshold, alpha, ramp, gate)); - } - - pwr_squelch_ff_impl::pwr_squelch_ff_impl(double threshold, double alpha, - int ramp, bool gate) - : gr_block("pwr_squelch_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), - squelch_base_ff_impl("pwr_squelch_ff", ramp, gate), - d_iir(alpha) - { - set_threshold(threshold); - } - - pwr_squelch_ff_impl::~pwr_squelch_ff_impl() - { - } - - std::vector<float> - pwr_squelch_ff_impl::squelch_range() const - { - std::vector<float> r(3); - r[0] = -50.0; // min FIXME - r[1] = +50.0; // max FIXME - r[2] = (r[1] - r[0]) / 100; // step size - - return r; - } - - void - pwr_squelch_ff_impl::update_state(const float &in) - { - d_pwr = d_iir.filter(in*in); - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/pwr_squelch_ff_impl.h b/gr-analog/lib/pwr_squelch_ff_impl.h deleted file mode 100644 index 96d959b4d..000000000 --- a/gr-analog/lib/pwr_squelch_ff_impl.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_ANALOG_PWR_SQUELCH_FF_IMPL_H -#define INCLUDED_ANALOG_PWR_SQUELCH_FF_IMPL_H - -#include <analog/pwr_squelch_ff.h> -#include "squelch_base_ff_impl.h" -#include <filter/single_pole_iir.h> -#include <cmath> - -namespace gr { - namespace analog { - - class ANALOG_API pwr_squelch_ff_impl : - public pwr_squelch_ff, squelch_base_ff_impl - { - private: - double d_threshold; - double d_pwr; - filter::single_pole_iir<double,double,double> d_iir; - - protected: - virtual void update_state(const float &in); - virtual bool mute() const { return d_pwr < d_threshold; } - - public: - pwr_squelch_ff_impl(double db, double alpha=0.0001, - int ramp=0, bool gate=false); - ~pwr_squelch_ff_impl(); - - std::vector<float> squelch_range() const; - - double threshold() const { return 10*log10(d_threshold); } - void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } - void set_alpha(double alpha) { d_iir.set_taps(alpha); } - - int ramp() const { return squelch_base_ff_impl::ramp(); } - void set_ramp(int ramp) { squelch_base_ff_impl::set_ramp(ramp); } - bool gate() const { return squelch_base_ff_impl::gate(); } - void set_gate(bool gate) { squelch_base_ff_impl::set_gate(gate); } - bool unmuted() const { return squelch_base_ff_impl::unmuted(); } - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - return squelch_base_ff_impl::general_work(noutput_items, - ninput_items, - input_items, - output_items); - } - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_PWR_SQUELCH_FF_IMPL_H */ diff --git a/gr-analog/lib/qa_analog.cc b/gr-analog/lib/qa_analog.cc deleted file mode 100644 index c3d51863b..000000000 --- a/gr-analog/lib/qa_analog.cc +++ /dev/null @@ -1,41 +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-analog - * directory into a single test suite. As you create new test cases, - * add them here. - */ - -#include <qa_analog.h> -#include <qa_sincos.h> -#include <qa_rotator.h> - -CppUnit::TestSuite * -qa_gr_analog::suite() -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite("gr-analog"); - - s->addTest(gr::analog::qa_sincos::suite()); - s->addTest(gr::analog::qa_rotator::suite()); - - return s; -} diff --git a/gr-analog/lib/qa_analog.h b/gr-analog/lib/qa_analog.h deleted file mode 100644 index 458861cc9..000000000 --- a/gr-analog/lib/qa_analog.h +++ /dev/null @@ -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_GR_ANALOG_H_ -#define _QA_GR_ANALOG_H_ - -#include <gruel/attributes.h> -#include <cppunit/TestSuite.h> - -//! collect all the tests for the gr-analog directory - -class __GR_ATTR_EXPORT qa_gr_analog { - public: - //! return suite of tests for all of gr-analog directory - static CppUnit::TestSuite *suite(); -}; - - -#endif /* _QA_GR_ANALOG_H_ */ diff --git a/gr-analog/lib/qa_rotator.cc b/gr-analog/lib/qa_rotator.cc deleted file mode 100644 index b722f32c4..000000000 --- a/gr-analog/lib/qa_rotator.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 <gruel/attributes.h> -#include <cppunit/TestAssert.h> -#include <qa_rotator.h> -#include <analog/rotator.h> -#include <stdio.h> -#include <cmath> -#include <gr_expj.h> - -namespace gr { - namespace analog { - - // error vector magnitude - __GR_ATTR_UNUSED static float - error_vector_mag(gr_complex a, gr_complex b) - { - return abs(a-b); - } - - void - qa_rotator::t1() - { - static const unsigned int N = 100000; - - rotator r; - - double phase_incr = 2*M_PI / 1003; - double phase = 0; - - // Old code: We increment then return the rotated value, thus we - // need to start one tick back - // r.set_phase(gr_complex(1,0) * conj(gr_expj(phase_incr))); - - r.set_phase(gr_complex(1,0)); - r.set_phase_incr(gr_expj(phase_incr)); - - for(unsigned i = 0; i < N; i++) { - gr_complex expected = gr_expj(phase); - gr_complex actual = r.rotate(gr_complex(1, 0)); - -#if 0 - float evm = error_vector_mag(expected, actual); - printf("[%6d] expected: (%8.6f, %8.6f) actual: (%8.6f, %8.6f) evm: %8.6f\n", - i, expected.real(), expected.imag(), actual.real(), actual.imag(), evm); -#endif - - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.0001); - - phase += phase_incr; - if(phase >= 2*M_PI) - phase -= 2*M_PI; - } - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/qa_rotator.h b/gr-analog/lib/qa_rotator.h deleted file mode 100644 index a22e41ec2..000000000 --- a/gr-analog/lib/qa_rotator.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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_ANALOG_ROTATOR_H_ -#define _QA_ANALOG_ROTATOR_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -namespace gr { - namespace analog { - - class qa_rotator : public CppUnit::TestCase - { - CPPUNIT_TEST_SUITE(qa_rotator); - CPPUNIT_TEST(t1); - CPPUNIT_TEST_SUITE_END(); - - private: - void t1(); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* _QA_ANALOG_ROTATOR_H_ */ diff --git a/gr-analog/lib/qa_sincos.cc b/gr-analog/lib/qa_sincos.cc deleted file mode 100644 index 62642c117..000000000 --- a/gr-analog/lib/qa_sincos.cc +++ /dev/null @@ -1,75 +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 <qa_sincos.h> -#include <analog/sincos.h> -#include <gruel/attributes.h> -#include <cppunit/TestAssert.h> -#include <cmath> - -namespace gr { - namespace analog { - - void - qa_sincos::t1() - { - static const unsigned int N = 1000; - double c_sin, c_cos; - double gr_sin, gr_cos; - - for(unsigned i = 0; i < N; i++) { - double x = i/100.0; - c_sin = sin(x); - c_cos = cos(x); - - analog::sincos(x, &gr_sin, &gr_cos); - - CPPUNIT_ASSERT_DOUBLES_EQUAL(c_sin, gr_sin, 0.0001); - CPPUNIT_ASSERT_DOUBLES_EQUAL(c_cos, gr_cos, 0.0001); - } - } - - void - qa_sincos::t2() - { - static const unsigned int N = 1000; - float c_sin, c_cos; - float gr_sin, gr_cos; - - for(unsigned i = 0; i < N; i++) { - float x = i/100.0; - c_sin = sinf(x); - c_cos = cosf(x); - - analog::sincosf(x, &gr_sin, &gr_cos); - - CPPUNIT_ASSERT_DOUBLES_EQUAL(c_sin, gr_sin, 0.0001); - CPPUNIT_ASSERT_DOUBLES_EQUAL(c_cos, gr_cos, 0.0001); - } - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/qa_sincos.h b/gr-analog/lib/qa_sincos.h deleted file mode 100644 index f18e879dd..000000000 --- a/gr-analog/lib/qa_sincos.h +++ /dev/null @@ -1,47 +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_ANALOG_SINCOS_H_ -#define _QA_ANALOG_SINCOS_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -namespace gr { - namespace analog { - - class qa_sincos : public CppUnit::TestCase - { - CPPUNIT_TEST_SUITE(qa_sincos); - CPPUNIT_TEST(t1); - CPPUNIT_TEST(t2); - CPPUNIT_TEST_SUITE_END(); - - private: - void t1(); - void t2(); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* _QA_ANALOG_SINCOS_H_ */ diff --git a/gr-analog/lib/quadrature_demod_cf_impl.cc b/gr-analog/lib/quadrature_demod_cf_impl.cc deleted file mode 100644 index 9490ba6be..000000000 --- a/gr-analog/lib/quadrature_demod_cf_impl.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005,2010,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 "quadrature_demod_cf_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> - -namespace gr { - namespace analog { - - quadrature_demod_cf::sptr - quadrature_demod_cf::make(float gain) - { - return gnuradio::get_initial_sptr - (new quadrature_demod_cf_impl(gain)); - } - - quadrature_demod_cf_impl::quadrature_demod_cf_impl(float gain) - : gr_sync_block("quadrature_demod_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))), - d_gain(gain) - { - set_history(2); // we need to look at the previous value - } - - quadrature_demod_cf_impl::~quadrature_demod_cf_impl() - { - } - - int - quadrature_demod_cf_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - gr_complex *in = (gr_complex*)input_items[0]; - float *out = (float*)output_items[0]; - in++; // ensure that in[-1] is valid - - for(int i = 0; i < noutput_items; i++) { - gr_complex product = in[i] * conj(in[i-1]); - out[i] = d_gain * gr_fast_atan2f(imag(product), real(product)); - } - - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/quadrature_demod_cf_impl.h b/gr-analog/lib/quadrature_demod_cf_impl.h deleted file mode 100644 index 72beb2331..000000000 --- a/gr-analog/lib/quadrature_demod_cf_impl.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_IMPL_H -#define INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_IMPL_H - -#include <analog/quadrature_demod_cf.h> - -namespace gr { - namespace analog { - - class quadrature_demod_cf_impl : public quadrature_demod_cf - { - private: - float d_gain; - - public: - quadrature_demod_cf_impl(float gain); - ~quadrature_demod_cf_impl(); - - void set_gain(float gain) { d_gain = gain; } - float gain() const { return d_gain; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_IMPL_H */ diff --git a/gr-analog/lib/rail_ff_impl.cc b/gr-analog/lib/rail_ff_impl.cc deleted file mode 100644 index 106c6353a..000000000 --- a/gr-analog/lib/rail_ff_impl.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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 "rail_ff_impl.h" -#include <gr_io_signature.h> -#include <gr_math.h> - -namespace gr { - namespace analog { - - rail_ff::sptr - rail_ff::make(float lo, float hi) - { - return gnuradio::get_initial_sptr - (new rail_ff_impl(lo, hi)); - } - - rail_ff_impl::rail_ff_impl(float lo, float hi) - : gr_sync_block("rail_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), - d_lo(lo), d_hi(hi) - { - set_clipping(); - } - - rail_ff_impl::~rail_ff_impl() - { - } - - void - rail_ff_impl::set_lo(float lo) - { - d_lo = lo; - set_clipping(); - } - - void - rail_ff_impl::set_hi(float hi) - { - d_hi = hi; - set_clipping(); - } - - void - rail_ff_impl::set_clipping() - { - d_mid = (d_lo + d_hi)/2; - d_clip = d_hi - d_mid; - } - - int - rail_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++) { - out[i] = d_mid + gr_branchless_clip(in[i] - d_mid, d_clip); - } - - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/rail_ff_impl.h b/gr-analog/lib/rail_ff_impl.h deleted file mode 100644 index 436b10b41..000000000 --- a/gr-analog/lib/rail_ff_impl.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_ANALOG_RAIL_FF_IMPL_H -#define INCLUDED_ANALOG_RAIL_FF_IMPL_H - -#include <analog/rail_ff.h> - -namespace gr { - namespace analog { - - class rail_ff_impl : public rail_ff - { - private: - float d_lo, d_hi; - float d_mid, d_clip; - - void set_clipping(); - - public: - rail_ff_impl(float lo, float hi); - ~rail_ff_impl(); - - float lo() const { return d_lo; } - float hi() const { return d_hi; } - - void set_lo(float lo); - void set_hi(float hi); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_RAIL_FF_IMPL_H */ diff --git a/gr-analog/lib/sig_source_X_impl.cc.t b/gr-analog/lib/sig_source_X_impl.cc.t deleted file mode 100644 index 60653dc1b..000000000 --- a/gr-analog/lib/sig_source_X_impl.cc.t +++ /dev/null @@ -1,253 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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. - */ - -/* @WARNING@ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "@IMPL_NAME@.h" -#include <algorithm> -#include <gr_io_signature.h> -#include <stdexcept> -#include <algorithm> -#include <gr_complex.h> - -namespace gr { - namespace analog { - - @BASE_NAME@::sptr - @BASE_NAME@::make(double sampling_freq, gr_waveform_t waveform, - double frequency, double ampl, @TYPE@ offset) - { - return gnuradio::get_initial_sptr - (new @IMPL_NAME@(sampling_freq, waveform, frequency, ampl, offset)); - } - - @IMPL_NAME@::@IMPL_NAME@(double sampling_freq, gr_waveform_t waveform, - double frequency, double ampl, @TYPE@ offset) - : gr_sync_block("@BASE_NAME@", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(@TYPE@))), - d_sampling_freq(sampling_freq), d_waveform(waveform), - d_frequency(frequency), d_ampl(ampl), d_offset(offset) - { - d_nco.set_freq(2 * M_PI * d_frequency / d_sampling_freq); - } - - @IMPL_NAME@::~@IMPL_NAME@() - { - } - - int - @IMPL_NAME@::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - @TYPE@ *optr = (@TYPE@*)output_items[0]; - @TYPE@ t; - - switch(d_waveform) { - -#if @IS_COMPLEX@ // complex? - - case GR_CONST_WAVE: - t = (gr_complex) d_ampl + d_offset; - std::fill_n(optr, noutput_items, t); - break; - - case GR_SIN_WAVE: - case GR_COS_WAVE: - d_nco.sincos(optr, noutput_items, d_ampl); - if(d_offset == gr_complex(0,0)) - break; - - for(int i = 0; i < noutput_items; i++) { - optr[i] += d_offset; - } - break; - - /* Implements a real square wave high from -PI to 0. - * The imaginary square wave leads by 90 deg. - */ - case GR_SQR_WAVE: - for(int i = 0; i < noutput_items; i++) { - if(d_nco.get_phase() < -1*M_PI/2) - optr[i] = gr_complex(d_ampl, 0) + d_offset; - else if(d_nco.get_phase() < 0) - optr[i] = gr_complex(d_ampl, d_ampl) + d_offset; - else if(d_nco.get_phase() < M_PI/2) - optr[i] = gr_complex(0, d_ampl) + d_offset; - else - optr[i] = d_offset; - d_nco.step(); - } - break; - - /* Implements a real triangle wave rising from -PI to 0 and - * falling from 0 to PI. The imaginary triangle wave leads by - * 90 deg. - */ - case GR_TRI_WAVE: - for(int i = 0; i < noutput_items; i++) { - if(d_nco.get_phase() < -1*M_PI/2){ - optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl, - -1*d_ampl*d_nco.get_phase()/M_PI - d_ampl/2) + d_offset; - } - else if(d_nco.get_phase() < 0) { - optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl, - d_ampl*d_nco.get_phase()/M_PI + d_ampl/2) + d_offset; - } - else if(d_nco.get_phase() < M_PI/2) { - optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl, - d_ampl*d_nco.get_phase()/M_PI + d_ampl/2) + d_offset; - } - else { - optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl, - -1*d_ampl*d_nco.get_phase()/M_PI + 3*d_ampl/2) + d_offset; - } - d_nco.step(); - } - break; - - /* Implements a real saw tooth wave rising from -PI to PI. - * The imaginary saw tooth wave leads by 90 deg. - */ - case GR_SAW_WAVE: - for(int i = 0; i < noutput_items; i++) { - if(d_nco.get_phase() < -1*M_PI/2) { - optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2, - d_ampl*d_nco.get_phase()/(2*M_PI) + 5*d_ampl/4) + d_offset; - } - else { - optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2, - d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/4) + d_offset; - } - d_nco.step(); - } - break; - -#else // nope... - - case GR_CONST_WAVE: - t = (@TYPE@)d_ampl + d_offset; - std::fill_n(optr, noutput_items, t); - break; - - case GR_SIN_WAVE: - d_nco.sin(optr, noutput_items, d_ampl); - if(d_offset == 0) - break; - - for(int i = 0; i < noutput_items; i++) { - optr[i] += d_offset; - } - break; - - case GR_COS_WAVE: - d_nco.cos(optr, noutput_items, d_ampl); - if(d_offset == 0) - break; - - for(int i = 0; i < noutput_items; i++) { - optr[i] += d_offset; - } - break; - - /* The square wave is high from -PI to 0. */ - case GR_SQR_WAVE: - t = (@TYPE@)d_ampl + d_offset; - for(int i = 0; i < noutput_items; i++) { - if(d_nco.get_phase() < 0) - optr[i] = t; - else - optr[i] = d_offset; - d_nco.step(); - } - break; - - /* The triangle wave rises from -PI to 0 and falls from 0 to PI. */ - case GR_TRI_WAVE: - for(int i = 0; i < noutput_items; i++) { - double t = d_ampl*d_nco.get_phase()/M_PI; - if (d_nco.get_phase() < 0) - optr[i] = static_cast<@TYPE@>(t + d_ampl + d_offset); - else - optr[i] = static_cast<@TYPE@>(-1*t + d_ampl + d_offset); - d_nco.step(); - } - break; - - /* The saw tooth wave rises from -PI to PI. */ - case GR_SAW_WAVE: - for(int i = 0; i < noutput_items; i++) { - t = static_cast<@TYPE@>(d_ampl*d_nco.get_phase()/(2*M_PI) - + d_ampl/2 + d_offset); - optr[i] = t; - d_nco.step(); - } - break; - -#endif - - default: - throw std::runtime_error("gr_sig_source: invalid waveform"); - } - - return noutput_items; - } - - void - @NAME@::set_sampling_freq(double sampling_freq) - { - d_sampling_freq = sampling_freq; - d_nco.set_freq (2 * M_PI * d_frequency / d_sampling_freq); - } - - void - @NAME@::set_waveform(gr_waveform_t waveform) - { - d_waveform = waveform; - } - - void - @NAME@::set_frequency(double frequency) - { - d_frequency = frequency; - d_nco.set_freq(2 * M_PI * d_frequency / d_sampling_freq); - } - - void - @NAME@::set_amplitude(double ampl) - { - d_ampl = ampl; - } - - void - @NAME@::set_offset(@TYPE@ offset) - { - d_offset = offset; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/sig_source_X_impl.h.t b/gr-analog/lib/sig_source_X_impl.h.t deleted file mode 100644 index 50f179127..000000000 --- a/gr-analog/lib/sig_source_X_impl.h.t +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -/* @WARNING@ */ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <analog/@BASE_NAME@.h> -#include <gr_sync_block.h> -#include <gr_fxpt_nco.h> - -namespace gr { - namespace analog { - - class @IMPL_NAME@ : public @BASE_NAME@ - { - private: - double d_sampling_freq; - gr_waveform_t d_waveform; - double d_frequency; - double d_ampl; - @TYPE@ d_offset; - gr_fxpt_nco d_nco; - - public: - @IMPL_NAME@(double sampling_freq, gr_waveform_t waveform, - double wave_freq, double ampl, @TYPE@ offset = 0); - ~@IMPL_NAME@(); - - virtual int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - double sampling_freq() const { return d_sampling_freq; } - gr_waveform_t waveform() const { return d_waveform; } - double frequency() const { return d_frequency; } - double amplitude() const { return d_ampl; } - @TYPE@ offset() const { return d_offset; } - - void set_sampling_freq(double sampling_freq); - void set_waveform(gr_waveform_t waveform); - void set_frequency(double frequency); - void set_amplitude(double ampl); - void set_offset(@TYPE@ offset); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* @GUARD_NAME@ */ diff --git a/gr-analog/lib/simple_squelch_cc_impl.cc b/gr-analog/lib/simple_squelch_cc_impl.cc deleted file mode 100644 index 02ccc535d..000000000 --- a/gr-analog/lib/simple_squelch_cc_impl.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010,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 "simple_squelch_cc_impl.h" -#include <gr_io_signature.h> -#include <cmath> - -namespace gr { - namespace analog { - - simple_squelch_cc::sptr - simple_squelch_cc::make(double threshold_db, double alpha) - { - return gnuradio::get_initial_sptr - (new simple_squelch_cc_impl(threshold_db, alpha)); - } - - simple_squelch_cc_impl::simple_squelch_cc_impl(double threshold_db, double alpha) - : gr_sync_block("simple_squelch_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - d_unmuted(false), d_iir(alpha) - { - set_threshold(threshold_db); - } - - simple_squelch_cc_impl::~simple_squelch_cc_impl() - { - } - - void - simple_squelch_cc_impl::set_threshold(double decibels) - { - // convert to absolute threshold (mag squared) - d_threshold = std::pow(10.0, decibels/10); - } - - double - simple_squelch_cc_impl::threshold() const - { - return 10 * log10(d_threshold); - } - - void - simple_squelch_cc_impl::set_alpha(double alpha) - { - d_iir.set_taps(alpha); - } - - std::vector<float> - simple_squelch_cc_impl::squelch_range() const - { - std::vector<float> r(3); - r[0] = -50.0; // min FIXME - r[1] = +50.0; // max FIXME - r[2] = (r[1] - r[0]) / 100; // step size - - return r; - } - - int - simple_squelch_cc_impl::work(int noutput_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]; - - for(int i = 0; i < noutput_items; i++) { - double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag(); - double f = d_iir.filter(mag_sqrd); - if(f >= d_threshold) - out[i] = in[i]; - else - out[i] = 0; - } - - d_unmuted = d_iir.prev_output() >= d_threshold; - return noutput_items; - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/simple_squelch_cc_impl.h b/gr-analog/lib/simple_squelch_cc_impl.h deleted file mode 100644 index ba11de91e..000000000 --- a/gr-analog/lib/simple_squelch_cc_impl.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_IMPL_H -#define INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_IMPL_H - -#include <analog/simple_squelch_cc.h> -#include <filter/single_pole_iir.h> - -namespace gr { - namespace analog { - - class simple_squelch_cc_impl : public simple_squelch_cc - { - private: - double d_threshold; - bool d_unmuted; - filter::single_pole_iir<double,double,double> d_iir; - - public: - simple_squelch_cc_impl(double threshold_db, double alpha); - ~simple_squelch_cc_impl(); - - bool unmuted() const { return d_unmuted; } - - void set_alpha(double alpha); - void set_threshold(double decibels); - - double threshold() const; - std::vector<float> squelch_range() const; - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_IMPL_H */ diff --git a/gr-analog/lib/sincos.cc b/gr-analog/lib/sincos.cc deleted file mode 100644 index 14ceeb3a2..000000000 --- a/gr-analog/lib/sincos.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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 - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE // ask for GNU extensions if available -#endif - -#include <analog/sincos.h> -#include <math.h> - -namespace gr { - namespace analog { - -// ---------------------------------------------------------------- - -#if defined (HAVE_SINCOS) - - void - sincos(double x, double *sinx, double *cosx) - { - ::sincos(x, sinx, cosx); - } - -#else - - void - sincos(double x, double *sinx, double *cosx) - { - *sinx = sin(x); - *cosx = cos(x); - } - -#endif - -// ---------------------------------------------------------------- - -#if defined (HAVE_SINCOSF) - - void - sincosf(float x, float *sinx, float *cosx) - { - sincosf(x, sinx, cosx); - } - -#elif defined (HAVE_SINF) && defined (HAVE_COSF) - - void - sincosf(float x, float *sinx, float *cosx) - { - *sinx = sinf(x); - *cosx = cosf(x); - } - -#else - - void - sincosf(float x, float *sinx, float *cosx) - { - *sinx = sin(x); - *cosx = cos(x); - } - -#endif - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/squelch_base_cc_impl.cc b/gr-analog/lib/squelch_base_cc_impl.cc deleted file mode 100644 index cba7b30db..000000000 --- a/gr-analog/lib/squelch_base_cc_impl.cc +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,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 "squelch_base_cc_impl.h" -#include <gr_io_signature.h> - -namespace gr { - namespace analog { - - squelch_base_cc_impl::squelch_base_cc_impl(const char *name, int ramp, bool gate) - : gr_block(name, - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))) - { - set_ramp(ramp); - set_gate(gate); - d_state = ST_MUTED; - d_envelope = d_ramp ? 0.0 : 1.0; - d_ramped = 0; - } - - squelch_base_cc_impl::~squelch_base_cc_impl() - { - } - - int - squelch_base_cc_impl::ramp() const - { - return d_ramp; - } - - void - squelch_base_cc_impl::set_ramp(int ramp) - { - d_ramp = ramp; - } - - bool - squelch_base_cc_impl::gate() const - { - return d_gate; - } - - void - squelch_base_cc_impl::set_gate(bool gate) - { - d_gate = gate; - } - - bool - squelch_base_cc_impl::unmuted() const - { - return (d_state == ST_UNMUTED || d_state == ST_ATTACK); - } - - int - squelch_base_cc_impl::general_work(int noutput_items, - gr_vector_int &ninput_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]; - - int j = 0; - - for(int i = 0; i < noutput_items; i++) { - update_state(in[i]); - - // Adjust envelope based on current state - switch(d_state) { - case ST_MUTED: - if(!mute()) { - d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; // If not ramping, go straight to unmuted - } - break; - - case ST_UNMUTED: - if(mute()) { - d_state = d_ramp ? ST_DECAY : ST_MUTED; // If not ramping, go straight to muted - } - break; - - case ST_ATTACK: - d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed - if(d_ramped >= d_ramp) { // use >= in case d_ramp is set to lower value elsewhere - d_state = ST_UNMUTED; - d_envelope = 1.0; - } - break; - - case ST_DECAY: - d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed - if(d_ramped == 0.0) { - d_state = ST_MUTED; - } - break; - }; - - // If unmuted, copy input times envelope to output - // Otherwise, if not gating, copy zero to output - if(d_state != ST_MUTED) { - out[j++] = in[i]*gr_complex(d_envelope, 0.0); - } - else { - if(!d_gate) { - out[j++] = 0.0; - } - } - } - - consume_each(noutput_items); // Use all the inputs - return j; // But only report outputs copied - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/squelch_base_cc_impl.h b/gr-analog/lib/squelch_base_cc_impl.h deleted file mode 100644 index 19dccaa10..000000000 --- a/gr-analog/lib/squelch_base_cc_impl.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_GR_SQUELCH_BASE_CC_IMPL_H -#define INCLUDED_GR_SQUELCH_BASE_CC_IMPL_H - -#include <analog/squelch_base_cc.h> - -namespace gr { - namespace analog { - - class squelch_base_cc_impl : public squelch_base_cc - { - private: - int d_ramp; - int d_ramped; - bool d_gate; - double d_envelope; - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; - - protected: - virtual void update_state(const gr_complex &sample) {}; - virtual bool mute() const { return false; }; - - public: - squelch_base_cc_impl(const char *name, int ramp, bool gate); - ~squelch_base_cc_impl(); - - int ramp() const; - void set_ramp(int ramp); - bool gate() const; - void set_gate(bool gate); - bool unmuted() const; - - virtual std::vector<float> squelch_range() const = 0; - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_SQUELCH_BASE_IMPL_FF_H */ diff --git a/gr-analog/lib/squelch_base_ff_impl.cc b/gr-analog/lib/squelch_base_ff_impl.cc deleted file mode 100644 index f9f07d36d..000000000 --- a/gr-analog/lib/squelch_base_ff_impl.cc +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,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 "squelch_base_ff_impl.h" -#include <gr_io_signature.h> - -namespace gr { - namespace analog { - - squelch_base_ff_impl::squelch_base_ff_impl(const char *name, int ramp, bool gate) - : gr_block(name, - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))) - { - set_ramp(ramp); - set_gate(gate); - d_state = ST_MUTED; - d_envelope = d_ramp ? 0.0 : 1.0; - d_ramped = 0; - } - - squelch_base_ff_impl::~squelch_base_ff_impl() - { - } - - int - squelch_base_ff_impl::ramp() const - { - return d_ramp; - } - - void - squelch_base_ff_impl::set_ramp(int ramp) - { - d_ramp = ramp; - } - - bool - squelch_base_ff_impl::gate() const - { - return d_gate; - } - - void - squelch_base_ff_impl::set_gate(bool gate) - { - d_gate = gate; - } - - bool - squelch_base_ff_impl::unmuted() const - { - return (d_state == ST_UNMUTED || d_state == ST_ATTACK); - } - - int - squelch_base_ff_impl::general_work(int noutput_items, - gr_vector_int &ninput_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]; - - int j = 0; - - for(int i = 0; i < noutput_items; i++) { - update_state(in[i]); - - // Adjust envelope based on current state - switch(d_state) { - case ST_MUTED: - if(!mute()) - // If not ramping, go straight to unmuted - d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; - break; - - case ST_UNMUTED: - if(mute()) - // If not ramping, go straight to muted - d_state = d_ramp ? ST_DECAY : ST_MUTED; - break; - - case ST_ATTACK: - // FIXME: precalculate window for speed - d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; - - // use >= in case d_ramp is set to lower value elsewhere - if(d_ramped >= d_ramp) { - d_state = ST_UNMUTED; - d_envelope = 1.0; - } - break; - - case ST_DECAY: - // FIXME: precalculate window for speed - d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; - if(d_ramped == 0.0) - d_state = ST_MUTED; - break; - }; - - // If unmuted, copy input times envelope to output - // Otherwise, if not gating, copy zero to output - if(d_state != ST_MUTED) - out[j++] = in[i]*d_envelope; - else - if(!d_gate) - out[j++] = 0.0; - } - - consume_each(noutput_items); // Use all the inputs - return j; // But only report outputs copied - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/squelch_base_ff_impl.h b/gr-analog/lib/squelch_base_ff_impl.h deleted file mode 100644 index 22659be74..000000000 --- a/gr-analog/lib/squelch_base_ff_impl.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_GR_SQUELCH_BASE_FF_IMPL_H -#define INCLUDED_GR_SQUELCH_BASE_FF_IMPL_H - -#include <analog/squelch_base_ff.h> - -namespace gr { - namespace analog { - - class squelch_base_ff_impl : public squelch_base_ff - { - private: - int d_ramp; - int d_ramped; - bool d_gate; - double d_envelope; - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; - - protected: - virtual void update_state(const float &sample) {}; - virtual bool mute() const { return false; }; - - public: - squelch_base_ff_impl(const char *name, int ramp, bool gate); - ~squelch_base_ff_impl(); - - int ramp() const; - void set_ramp(int ramp); - bool gate() const; - void set_gate(bool gate); - bool unmuted() const; - - virtual std::vector<float> squelch_range() const = 0; - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* INCLUDED_ANALOG_SQUELCH_BASE_IMPL_FF_H */ diff --git a/gr-analog/lib/test_gr_analog.cc b/gr-analog/lib/test_gr_analog.cc deleted file mode 100644 index 00d624269..000000000 --- a/gr-analog/lib/test_gr_analog.cc +++ /dev/null @@ -1,43 +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. - */ - -#include <cppunit/TextTestRunner.h> -#include <cppunit/XmlOutputter.h> - -#include <gr_unittests.h> -#include "qa_analog.h" -#include <iostream> - -int -main (int argc, char **argv) -{ - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(get_unittest_path("gr_analog.xml").c_str()); - CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); - - runner.addTest(qa_gr_analog::suite()); - runner.setOutputter(xmlout); - - bool was_successful = runner.run("", false); - - return was_successful ? 0 : 1; -} diff --git a/gr-analog/python/CMakeLists.txt b/gr-analog/python/CMakeLists.txt deleted file mode 100644 index 1657e5bf3..000000000 --- a/gr-analog/python/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 212 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. - -######################################################################## -# Setup python install -######################################################################## -include(GrPython) - -GR_PYTHON_INSTALL( - FILES - __init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/analog - COMPONENT "analog_python" -) - -######################################################################## -# Handle the unit tests -######################################################################## -if(ENABLE_TESTING) - -list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-analog/python - ${CMAKE_BINARY_DIR}/gr-analog/swig - ${CMAKE_BINARY_DIR}/gr-filter/python - ${CMAKE_BINARY_DIR}/gr-filter/swig -) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-analog gnuradio-filter gnuradio-fft) - -include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) -endif(ENABLE_TESTING) diff --git a/gr-analog/python/__init__.py b/gr-analog/python/__init__.py deleted file mode 100644 index fc345028b..000000000 --- a/gr-analog/python/__init__.py +++ /dev/null @@ -1,27 +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. -# - -''' -Blocks and utilities for analog modulation and demodulation. -''' - -# The presence of this file turns this directory into a Python package - -from analog_swig import * diff --git a/gr-analog/python/qa_agc.py b/gr-analog/python/qa_agc.py deleted file mode 100755 index dc4922cf8..000000000 --- a/gr-analog/python/qa_agc.py +++ /dev/null @@ -1,495 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010,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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - -test_output = False - -class test_agc (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - - def test_001_sets(self): - agc = analog.agc_cc(1e-3, 1, 1, 1000) - - agc.set_rate(1) - agc.set_reference(1.1) - agc.set_gain(1.1) - agc.set_max_gain(100) - - self.assertAlmostEqual(agc.rate(), 1) - self.assertAlmostEqual(agc.reference(), 1.1) - self.assertAlmostEqual(agc.gain(), 1.1) - self.assertAlmostEqual(agc.max_gain(), 100) - - def test_001(self): - ''' Test the complex AGC loop (single rate input) ''' - tb = self.tb - - expected_result = ( - (100.000244140625+7.2191943445432116e-07j), - (72.892257690429688+52.959323883056641j), - (25.089065551757812+77.216217041015625j), - (-22.611061096191406+69.589706420898438j), - (-53.357715606689453+38.766635894775391j), - (-59.458671569824219+3.4792964243024471e-07j), - (-43.373462677001953-31.512666702270508j), - (-14.94139289855957-45.984889984130859j), - (13.478158950805664-41.48150634765625j), - (31.838506698608398-23.132022857666016j), - (35.519271850585938-3.1176801940091536e-07j), - (25.942903518676758+18.848621368408203j), - (8.9492912292480469+27.5430908203125j), - (-8.0852642059326172+24.883890151977539j), - (-19.131628036499023+13.899936676025391j), - (-21.383295059204102+3.1281737733479531e-07j), - (-15.650330543518066-11.370632171630859j), - (-5.4110145568847656-16.65339469909668j), - (4.9008159637451172-15.083160400390625j), - (11.628337860107422-8.4484796524047852j), - (13.036135673522949-2.288476110834381e-07j), - (9.5726661682128906+6.954948902130127j), - (3.3216962814331055+10.223132133483887j), - (-3.0204284191131592+9.2959251403808594j), - (-7.1977195739746094+5.2294478416442871j), - (-8.1072216033935547+1.8976157889483147e-07j), - (-5.9838657379150391-4.3475332260131836j), - (-2.0879747867584229-6.4261269569396973j), - (1.9100792407989502-5.8786196708679199j), - (4.5814824104309082-3.3286411762237549j), - (5.1967458724975586-1.3684227440080576e-07j), - (3.8647139072418213+2.8078789710998535j), - (1.3594740629196167+4.1840314865112305j), - (-1.2544282674789429+3.8607344627380371j), - (-3.0366206169128418+2.2062335014343262j), - (-3.4781389236450195+1.1194014604143376e-07j), - (-2.6133756637573242-1.8987287282943726j), - (-0.9293016791343689-2.8600969314575195j), - (0.86727333068847656-2.6691930294036865j), - (2.1243946552276611-1.5434627532958984j), - (2.4633183479309082-8.6486437567145913e-08j), - (1.8744727373123169+1.3618841171264648j), - (0.67528903484344482+2.0783262252807617j), - (-0.63866174221038818+1.965599536895752j), - (-1.5857341289520264+1.152103066444397j), - (-1.8640764951705933+7.6355092915036948e-08j), - (-1.4381576776504517-1.0448826551437378j), - (-0.52529704570770264-1.6166983842849731j), - (0.50366902351379395-1.5501341819763184j), - (1.26766037940979-0.92100900411605835j)) - - sampling_freq = 100 - src1 = gr.sig_source_c(sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100.0) - dst1 = gr.vector_sink_c() - head = gr.head(gr.sizeof_gr_complex, int (5*sampling_freq * 0.10)) - - agc = analog.agc_cc(1e-3, 1, 1, 1000) - - tb.connect(src1, head) - tb.connect(head, agc) - tb.connect(agc, dst1) - - if test_output == True: - tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc_cc.dat")) - - tb.run() - dst_data = dst1.data() - self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) - - def test_002_sets(self): - agc = analog.agc_ff(1e-3, 1, 1, 1000) - - agc.set_rate(1) - agc.set_reference(1.1) - agc.set_gain(1.1) - agc.set_max_gain(100) - - self.assertAlmostEqual(agc.rate(), 1) - self.assertAlmostEqual(agc.reference(), 1.1) - self.assertAlmostEqual(agc.gain(), 1.1) - self.assertAlmostEqual(agc.max_gain(), 100) - - def test_002(self): - ''' Test the floating point AGC loop (single rate input) ''' - tb = self.tb - - expected_result = ( - 7.2191943445432116e-07, - 58.837181091308594, - 89.700050354003906, - 81.264183044433594, - 45.506141662597656, - 4.269894304798072e-07, - -42.948936462402344, - -65.50335693359375, - -59.368724822998047, - -33.261005401611328, - -4.683740257860336e-07, - 31.423542022705078, - 47.950984954833984, - 43.485683441162109, - 24.378345489501953, - 5.7254135299444897e-07, - -23.062990188598633, - -35.218441009521484, - -31.964075088500977, - -17.934831619262695, - -5.0591745548445033e-07, - 16.998210906982422, - 25.982204437255859, - 23.606258392333984, - 13.260685920715332, - 4.9936483037527069e-07, - -12.59880542755127, - -19.28221321105957, - -17.54347038269043, - -9.8700437545776367, - -4.188150626305287e-07, - 9.4074573516845703, - 14.422011375427246, - 13.145503044128418, - 7.41046142578125, - 3.8512698097292741e-07, - -7.0924453735351562, - -10.896408081054688, - -9.9552040100097656, - -5.6262712478637695, - -3.1982864356905338e-07, - 5.4131259918212891, - 8.3389215469360352, - 7.6409502029418945, - 4.3320145606994629, - 2.882407841298118e-07, - -4.194943904876709, - -6.4837145805358887, - -5.9621825218200684, - -3.3931560516357422) - - sampling_freq = 100 - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100.0) - dst1 = gr.vector_sink_f () - head = gr.head (gr.sizeof_float, int (5*sampling_freq * 0.10)) - - agc = analog.agc_ff(1e-3, 1, 1, 1000) - - tb.connect (src1, head) - tb.connect (head, agc) - tb.connect (agc, dst1) - - if test_output == True: - tb.connect (agc, gr.file_sink(gr.sizeof_float, "test_agc_ff.dat")) - - tb.run () - dst_data = dst1.data () - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4) - - def test_003_sets(self): - agc = analog.agc2_cc(1e-3, 1e-1, 1, 1, 1000) - - agc.set_attack_rate(1) - agc.set_decay_rate(2) - agc.set_reference(1.1) - agc.set_gain(1.1) - agc.set_max_gain(100) - - self.assertAlmostEqual(agc.attack_rate(), 1) - self.assertAlmostEqual(agc.decay_rate(), 2) - self.assertAlmostEqual(agc.reference(), 1.1) - self.assertAlmostEqual(agc.gain(), 1.1) - self.assertAlmostEqual(agc.max_gain(), 100) - - def test_003(self): - ''' Test the complex AGC loop (attack and decay rate inputs) ''' - tb = self.tb - - expected_result = \ - ((100.000244140625+7.2191943445432116e-07j), - (0.80881959199905396+0.58764183521270752j), - (0.30894950032234192+0.95084899663925171j), - (-0.30895623564720154+0.95086973905563354j), - (-0.80887287855148315+0.58768033981323242j), - (-0.99984413385391235+5.850709250410091e-09j), - (-0.80889981985092163-0.58770018815994263j), - (-0.30897706747055054-0.95093393325805664j), - (0.30898112058639526-0.95094609260559082j), - (0.80893135070800781-0.58772283792495728j), - (0.99990922212600708-8.7766354184282136e-09j), - (0.80894720554351807+0.58773452043533325j), - (0.30899339914321899+0.95098406076431274j), - (-0.30899572372436523+0.95099133253097534j), - (-0.80896598100662231+0.58774799108505249j), - (-0.99994778633117676+1.4628290578855285e-08j), - (-0.80897533893585205-0.58775502443313599j), - (-0.30900305509567261-0.95101380348205566j), - (0.30900448560714722-0.95101797580718994j), - (0.80898630619049072-0.58776277303695679j), - (0.99997037649154663-1.7554345532744264e-08j), - (0.80899184942245483+0.58776694536209106j), - (0.30900871753692627+0.95103120803833008j), - (-0.30900952219963074+0.95103377103805542j), - (-0.8089984655380249+0.58777159452438354j), - (-0.99998390674591064+2.3406109050938539e-08j), - (-0.809001624584198-0.58777409791946411j), - (-0.30901208519935608-0.95104163885116577j), - (0.30901262164115906-0.95104306936264038j), - (0.80900543928146362-0.587776780128479j), - (0.99999171495437622-2.6332081404234486e-08j), - (0.80900734663009644+0.58777821063995361j), - (0.30901408195495605+0.95104765892028809j), - (-0.30901429057121277+0.95104855298995972j), - (-0.80900967121124268+0.58777981996536255j), - (-0.99999648332595825+3.2183805842578295e-08j), - (-0.80901080369949341-0.58778077363967896j), - (-0.30901527404785156-0.95105135440826416j), - (0.30901545286178589-0.95105189085006714j), - (0.80901217460632324-0.58778166770935059j), - (0.99999916553497314-3.5109700036173308e-08j), - (0.809012770652771+0.58778214454650879j), - (0.30901595950126648+0.9510534405708313j), - (-0.30901598930358887+0.95105385780334473j), - (-0.80901366472244263+0.58778274059295654j), - (-1.0000008344650269+4.0961388947380328e-08j), - (-0.8090139627456665-0.58778303861618042j), - (-0.30901634693145752-0.95105475187301636j), - (0.30901640653610229-0.95105493068695068j), - (0.80901449918746948-0.5877833366394043j)) - - sampling_freq = 100 - src1 = gr.sig_source_c(sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_c() - head = gr.head(gr.sizeof_gr_complex, int(5*sampling_freq * 0.10)) - - agc = analog.agc2_cc(1e-2, 1e-3, 1, 1, 1000) - - tb.connect(src1, head) - tb.connect(head, agc) - tb.connect(agc, dst1) - - if test_output == True: - tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat")) - - tb.run() - dst_data = dst1.data() - self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) - - def test_004_sets(self): - agc = analog.agc2_ff(1e-3, 1e-1, 1, 1, 1000) - - agc.set_attack_rate(1) - agc.set_decay_rate(2) - agc.set_reference(1.1) - agc.set_gain(1.1) - agc.set_max_gain(100) - - self.assertAlmostEqual(agc.attack_rate(), 1) - self.assertAlmostEqual(agc.decay_rate(), 2) - self.assertAlmostEqual(agc.reference(), 1.1) - self.assertAlmostEqual(agc.gain(), 1.1) - self.assertAlmostEqual(agc.max_gain(), 100) - - def test_004(self): - ''' Test the floating point AGC loop (attack and decay rate inputs) ''' - tb = self.tb - - expected_result = \ - (7.2191943445432116e-07, - 58.837181091308594, - 40.194305419921875, - 2.9183335304260254, - 0.67606079578399658, - 8.6260438791896377e-09, - -1.4542514085769653, - -1.9210131168365479, - -1.0450780391693115, - -0.61939650774002075, - -1.2590258613442984e-08, - 1.4308931827545166, - 1.9054338932037354, - 1.0443156957626343, - 0.61937344074249268, - 2.0983527804219193e-08, - -1.4308838844299316, - -1.9054274559020996, - -1.0443152189254761, - -0.61937344074249268, - -2.5180233009791664e-08, - 1.4308837652206421, - 1.9054274559020996, - 1.0443154573440552, - 0.61937344074249268, - 3.3573645197293445e-08, - -1.4308838844299316, - -1.9054274559020996, - -1.0443152189254761, - -0.61937350034713745, - -3.7770352179222755e-08, - 1.4308837652206421, - 1.9054274559020996, - 1.0443154573440552, - 0.61937350034713745, - 4.6163762590367696e-08, - -1.4308838844299316, - -1.9054274559020996, - -1.0443153381347656, - -0.61937344074249268, - -5.0360466019583328e-08, - 1.4308837652206421, - 1.9054274559020996, - 1.0443155765533447, - 0.61937344074249268, - 5.8753879983441948e-08, - -1.4308837652206421, - -1.9054274559020996, - -1.0443153381347656, - -0.61937344074249268) - - sampling_freq = 100 - src1 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_f() - head = gr.head(gr.sizeof_float, int(5*sampling_freq * 0.10)) - - agc = analog.agc2_ff(1e-2, 1e-3, 1, 1, 1000) - - tb.connect(src1, head) - tb.connect(head, agc) - tb.connect(agc, dst1) - - if test_output == True: - tb.connect(agc, gr.file_sink(gr.sizeof_float, "test_agc2_ff.dat")) - - tb.run() - dst_data = dst1.data() - self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 4) - - - def test_005(self): - ''' Test the complex AGC loop (attack and decay rate inputs) ''' - tb = self.tb - - expected_result = \ - ((100.000244140625+7.2191943445432116e-07j), - (0.80881959199905396+0.58764183521270752j), - (0.30894950032234192+0.95084899663925171j), - (-0.30895623564720154+0.95086973905563354j), - (-0.80887287855148315+0.58768033981323242j), - (-0.99984413385391235+5.850709250410091e-09j), - (-0.80889981985092163-0.58770018815994263j), - (-0.30897706747055054-0.95093393325805664j), - (0.30898112058639526-0.95094609260559082j), - (0.80893135070800781-0.58772283792495728j), - (0.99990922212600708-8.7766354184282136e-09j), - (0.80894720554351807+0.58773452043533325j), - (0.30899339914321899+0.95098406076431274j), - (-0.30899572372436523+0.95099133253097534j), - (-0.80896598100662231+0.58774799108505249j), - (-0.99994778633117676+1.4628290578855285e-08j), - (-0.80897533893585205-0.58775502443313599j), - (-0.30900305509567261-0.95101380348205566j), - (0.30900448560714722-0.95101797580718994j), - (0.80898630619049072-0.58776277303695679j), - (0.99997037649154663-1.7554345532744264e-08j), - (0.80899184942245483+0.58776694536209106j), - (0.30900871753692627+0.95103120803833008j), - (-0.30900952219963074+0.95103377103805542j), - (-0.8089984655380249+0.58777159452438354j), - (-0.99998390674591064+2.3406109050938539e-08j), - (-0.809001624584198-0.58777409791946411j), - (-0.30901208519935608-0.95104163885116577j), - (0.30901262164115906-0.95104306936264038j), - (0.80900543928146362-0.587776780128479j), - (0.99999171495437622-2.6332081404234486e-08j), - (0.80900734663009644+0.58777821063995361j), - (0.30901408195495605+0.95104765892028809j), - (-0.30901429057121277+0.95104855298995972j), - (-0.80900967121124268+0.58777981996536255j), - (-0.99999648332595825+3.2183805842578295e-08j), - (-0.80901080369949341-0.58778077363967896j), - (-0.30901527404785156-0.95105135440826416j), - (0.30901545286178589-0.95105189085006714j), - (0.80901217460632324-0.58778166770935059j), - (0.99999916553497314-3.5109700036173308e-08j), - (0.809012770652771+0.58778214454650879j), - (0.30901595950126648+0.9510534405708313j), - (-0.30901598930358887+0.95105385780334473j), - (-0.80901366472244263+0.58778274059295654j), - (-1.0000008344650269+4.0961388947380328e-08j), - (-0.8090139627456665-0.58778303861618042j), - (-0.30901634693145752-0.95105475187301636j), - (0.30901640653610229-0.95105493068695068j), - (0.80901449918746948-0.5877833366394043j)) - - sampling_freq = 100 - src1 = gr.sig_source_c(sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_c() - head = gr.head(gr.sizeof_gr_complex, int(5*sampling_freq * 0.10)) - - agc = analog.agc2_cc(1e-2, 1e-3, 1, 1, 1000) - - tb.connect(src1, head) - tb.connect(head, agc) - tb.connect(agc, dst1) - - if test_output == True: - tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat")) - - tb.run() - dst_data = dst1.data() - self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) - - def test_100(self): - ''' Test complex feedforward agc with constant input ''' - - length = 8 - gain = 2 - - input_data = 8*(0.0,) + 24*(1.0,) + 24*(0.0,) - expected_result = (8+length-1)*(0.0,) + 24*(gain*1.0,) + (0,) - - src = gr.vector_source_c(input_data) - agc = analog.feedforward_agc_cc(8, 2.0) - dst = gr.vector_sink_c() - self.tb.connect(src, agc, dst) - - if test_output == True: - self.tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, - "test_feedforward_cc.dat")) - - self.tb.run() - dst_data = dst.data()[0:len(expected_result)] - - self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) - - -if __name__ == '__main__': - gr_unittest.run(test_agc, "test_agc.xml") diff --git a/gr-analog/python/qa_cpfsk.py b/gr-analog/python/qa_cpfsk.py deleted file mode 100755 index decf94ea3..000000000 --- a/gr-analog/python/qa_cpfsk.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - -class test_cpfsk_bc(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_cpfsk_bc_001(self): - # Test set/gets - - op = analog.cpfsk_bc(2, 1, 2) - - op.set_amplitude(2) - a = op.amplitude() - self.assertEqual(2, a) - - freq = 2*math.pi/2.0 - f = op.freq() - self.assertAlmostEqual(freq, f, 5) - - p = op.phase() - self.assertEqual(0, p) - - def test_cpfsk_bc_002(self): - src_data = 10*[0, 1] - expected_result = map(lambda x: complex(2*x-1,0), src_data) - - src = gr.vector_source_b(src_data) - op = analog.cpfsk_bc(2, 1, 2) - dst = gr.vector_sink_c() - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - result_data = dst.data()[0:len(expected_result)] - self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4) - -if __name__ == '__main__': - gr_unittest.run(test_cpfsk_bc, "test_cpfsk_bc.xml") - diff --git a/gr-analog/python/qa_ctcss_squelch.py b/gr-analog/python/qa_ctcss_squelch.py deleted file mode 100755 index 08d3dbfef..000000000 --- a/gr-analog/python/qa_ctcss_squelch.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog - -class test_ctcss_squelch(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_ctcss_squelch_001(self): - # Test set/gets - - rate = 1 - rate2 = 2 - freq = 100 - level = 0.5 - length = 1 - ramp = 1 - ramp2 = 2 - gate = True - gate2 = False - - op = analog.ctcss_squelch_ff(rate, freq, level, - length, ramp, gate) - - op.set_ramp(ramp2) - r = op.ramp() - self.assertEqual(ramp2, r) - - op.set_gate(gate2) - g = op.gate() - self.assertEqual(gate2, g) - - def test_ctcss_squelch_002(self): - # Test runtime, gate=True - rate = 1 - freq = 100 - level = 0.0 - length = 1 - ramp = 1 - gate = True - - src_data = map(lambda x: float(x)/10.0, range(1, 40)) - expected_result = src_data - expected_result[0] = 0 - - src = gr.vector_source_f(src_data) - op = analog.ctcss_squelch_ff(rate, freq, level, - length, ramp, gate) - dst = gr.vector_sink_f() - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - result_data = dst.data() - self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4) - - def test_ctcss_squelch_003(self): - # Test runtime, gate=False - rate = 1 - freq = 100 - level = 0.5 - length = 1 - ramp = 1 - gate = False - - src_data = map(lambda x: float(x)/10.0, range(1, 40)) - src = gr.vector_source_f(src_data) - op = analog.ctcss_squelch_ff(rate, freq, level, - length, ramp, gate) - dst = gr.vector_sink_f() - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - expected_result = src_data - expected_result[0:5] = [0, 0, 0, 0, 0] - - result_data = dst.data() - self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4) - -if __name__ == '__main__': - gr_unittest.run(test_ctcss_squelch, "test_ctcss_squelch.xml") - diff --git a/gr-analog/python/qa_dpll.py b/gr-analog/python/qa_dpll.py deleted file mode 100755 index 3ef8a6e28..000000000 --- a/gr-analog/python/qa_dpll.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - -class test_dpll_bb(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_dpll_bb_001(self): - # Test set/gets - - period = 1.0 - gain = 0.1 - op = analog.dpll_bb(period, gain) - - op.set_gain(0.2) - g = op.gain() - self.assertAlmostEqual(g, 0.2) - - f = op.freq() - self.assertEqual(1/period, f) - - d0 = 1.0 - 0.5*f; - d1 = op.decision_threshold() - self.assertAlmostEqual(d0, d1) - - p = op.phase() - self.assertEqual(0, p) - - def test_dpll_bb_002(self): - period = 4 - gain = 0.1 - - src_data = 10*((period-1)*[0,] + [1,]) - expected_result = src_data - - src = gr.vector_source_b(src_data) - op = analog.dpll_bb(period, gain) - dst = gr.vector_sink_b() - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - result_data = dst.data() - self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4) - -if __name__ == '__main__': - gr_unittest.run(test_dpll_bb, "test_dpll_bb.xml") - diff --git a/gr-analog/python/qa_fmdet.py b/gr-analog/python/qa_fmdet.py deleted file mode 100755 index b90ef2ffa..000000000 --- a/gr-analog/python/qa_fmdet.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - -class test_fmdet_cf(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_fmdet_cf_001(self): - # Test set/gets - - fh1 = 10 - fh2 = 20 - fl1 = 1 - fl2 = 2 - scale1 = 3 - scale2 = 4 - op = analog.fmdet_cf(1, fl1, fh1, scale1) - - op.set_freq_range(fl2, fh2) - lo = op.freq_low() - hi = op.freq_high() - f = op.freq() - self.assertEqual(fl2, lo) - self.assertEqual(fh2, hi) - self.assertEqual(0, f) - - op.set_scale(scale2) - s = op.scale() - b = op.bias() - eb = 0.5*scale2*(hi + lo) / (hi - lo); - self.assertEqual(scale2, s) - self.assertAlmostEqual(eb, b) - - # FIXME: This passes QA, but the it's only based off what the - # block is saying, not what the values should actually be. - def est_fmdet_cf_002(self): - N = 100 - src = gr.sig_source_c(1, gr.GR_SIN_WAVE, 0.2, 1) - head = gr.head(gr.sizeof_gr_complex, N) - op = analog.fmdet_cf(1, 0.1, 0.3, 0.1) - dst = gr.vector_sink_f() - - self.tb.connect(src, head, op) - self.tb.connect(op, dst) - self.tb.run() - - result_data = dst.data()[4:N] - expected_result = (100-4)*[-0.21755,] - self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4) - -if __name__ == '__main__': - gr_unittest.run(test_fmdet_cf, "test_fmdet_cf.xml") - diff --git a/gr-analog/python/qa_frequency_modulator.py b/gr-analog/python/qa_frequency_modulator.py deleted file mode 100755 index b673b3275..000000000 --- a/gr-analog/python/qa_frequency_modulator.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010,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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - -def sincos(x): - return math.cos(x) + math.sin(x) * 1j - - -class test_frequency_modulator(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_fm_001(self): - pi = math.pi - sensitivity = pi/4 - src_data = (1.0/4, 1.0/2, 1.0/4, -1.0/4, -1.0/2, -1/4.0) - running_sum = (pi/16, 3*pi/16, pi/4, 3*pi/16, pi/16, 0) - expected_result = tuple([sincos(x) for x in running_sum]) - src = gr.vector_source_f(src_data) - op = analog.frequency_modulator_fc(sensitivity) - dst = gr.vector_sink_c() - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - result_data = dst.data() - self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_frequency_modulator, "test_frequency_modulator.xml") - diff --git a/gr-analog/python/qa_lfsr.py b/gr-analog/python/qa_lfsr.py deleted file mode 100755 index 2a8167a57..000000000 --- a/gr-analog/python/qa_lfsr.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - - -class test_lfsr(gr_unittest.TestCase): - - def setUp(self): - pass - - def tearDown(self): - pass - - def test_lfsr_001(self): - reglen = 8 - l = analog.lfsr(1, 1, reglen) - - result_data = [] - for i in xrange(4*(reglen+1)): - result_data.append(l.next_bit()) - - expected_result = 4*([1,] + reglen*[0,]) - self.assertFloatTuplesAlmostEqual(expected_result, result_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_lfsr, "test_lfsr.xml") - diff --git a/gr-analog/python/qa_noise.py b/gr-analog/python/qa_noise.py deleted file mode 100755 index dd94fc231..000000000 --- a/gr-analog/python/qa_noise.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2010,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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog - -class test_noise_source(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - # Just confirm that we can instantiate a noise source - op = analog.noise_source_f(analog.GR_GAUSSIAN, 10, 10) - - def test_002(self): - # Test get methods - set_type = analog.GR_GAUSSIAN - set_ampl = 10 - op = analog.noise_source_f(set_type, set_ampl, 10) - get_type = op.type() - get_ampl = op.amplitude() - - self.assertEqual(get_type, set_type) - self.assertEqual(get_ampl, set_ampl) - - -if __name__ == '__main__': - gr_unittest.run(test_noise_source, "test_noise_source.xml") - diff --git a/gr-analog/python/qa_phase_modulator.py b/gr-analog/python/qa_phase_modulator.py deleted file mode 100755 index a9c8c8459..000000000 --- a/gr-analog/python/qa_phase_modulator.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - -def sincos(x): - return math.cos(x) + math.sin(x) * 1j - - -class test_phase_modulator(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_fm_001(self): - pi = math.pi - sensitivity = pi/4 - src_data = (1.0/4, 1.0/2, 1.0/4, -1.0/4, -1.0/2, -1/4.0) - expected_result = tuple([sincos(sensitivity*x) for x in src_data]) - - src = gr.vector_source_f(src_data) - op = analog.phase_modulator_fc(sensitivity) - dst = gr.vector_sink_c() - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - result_data = dst.data() - self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_phase_modulator, "test_phase_modulator.xml") - diff --git a/gr-analog/python/qa_pll_carriertracking.py b/gr-analog/python/qa_pll_carriertracking.py deleted file mode 100755 index a292059d1..000000000 --- a/gr-analog/python/qa_pll_carriertracking.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010-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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - -class test_pll_carriertracking(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test_pll_carriertracking(self): - expected_result = ((1.00000238419+7.21919457547e-09j), - (0.998025715351+0.062790453434j), - (0.992777824402+0.119947694242j), - (0.985192835331+0.171441286802j), - (0.976061582565+0.217501848936j), - (0.966034710407+0.258409559727j), - (0.95565611124+0.294477283955j), - (0.945357382298+0.326030552387j), - (0.935475051403+0.353395611048j), - (0.926258146763+0.376889169216j), - (0.917895197868+0.39681750536j), - (0.910515546799+0.413470208645j), - (0.904196679592+0.427117019892j), - (0.898972511292+0.438006043434j), - (0.894769787788+0.446523308754j), - (0.891652584076+0.452715367079j), - (0.8895829916+0.456773489714j), - (0.888502895832+0.458873122931j), - (0.888343691826+0.459175437689j), - (0.889035582542+0.457833081484j), - (0.890497922897+0.454985737801j), - (0.892645597458+0.450762689114j), - (0.895388305187+0.445282936096j), - (0.898648142815+0.438664674759j), - (0.902342617512+0.431016951799j), - (0.906392872334+0.422441422939j), - (0.910642921925+0.413191765547j), - (0.915039420128+0.403358519077j), - (0.919594764709+0.392864197493j), - (0.92425006628+0.381792247295j), - (0.928944349289+0.370217680931j), - (0.933634519577+0.358220815659j), - (0.938279032707+0.345874190331j), - (0.942840516567+0.333247303963j), - (0.947280526161+0.32040438056j), - (0.951574921608+0.307409763336j), - (0.955703914165+0.294323593378j), - (0.959648966789+0.281201630831j), - (0.963392794132+0.268095195293j), - (0.966880619526+0.255221515894j), - (0.970162451267+0.242447137833j), - (0.973235487938+0.229809194803j), - (0.97609680891+0.217341512442j), - (0.978744983673+0.20507311821j), - (0.981189727783+0.193033605814j), - (0.983436584473+0.181248426437j), - (0.985490739346+0.169738590717j), - (0.987353682518+0.158523857594j), - (0.989041447639+0.147622272372j), - (0.990563035011+0.137049794197j), - (0.991928339005+0.126818582416j), - (0.993117690086+0.117111675441j), - (0.994156062603+0.107930034399j), - (0.995076179504+0.0990980416536j), - (0.995887458324+0.0906178802252j), - (0.996591091156+0.0824909061193j), - (0.997202515602+0.0747182965279j), - (0.997730851173+0.0672992765903j), - (0.998185396194+0.0602316558361j), - (0.99856698513+0.0535135567188j), - (0.998885989189+0.0471420884132j), - (0.99915266037+0.0411129891872j), - (0.999372899532+0.0354214012623j), - (0.999548316002+0.0300626158714j), - (0.999680638313+0.0252036750317j), - (0.999784469604+0.020652115345j), - (0.999865531921+0.0163950324059j), - (0.999923825264+0.0124222636223j), - (0.999960243702+0.00872156023979j), - (0.999983668327+0.00528120994568j), - (0.999997138977+0.00209015607834j), - (1.00000119209-0.00086285173893j), - (0.999992132187-0.00358882546425j), - (0.999979138374-0.00609711557627j), - (0.999963641167-0.00839691981673j), - (0.999947249889-0.0104993218556j), - (0.999924004078-0.0122378543019j), - (0.999904811382-0.0136305987835j), - (0.999888062477-0.0148707330227j), - (0.9998742342-0.0159679055214j), - (0.999856114388-0.0169314742088j), - (0.999839782715-0.0177700817585j), - (0.999826967716-0.0184917747974j), - (0.999818325043-0.0191045701504j), - (0.999807476997-0.0196143388748j), - (0.999797284603-0.0200265944004j), - (0.999791204929-0.0203481912613j), - (0.99978852272-0.0205836892128j), - (0.99978530407-0.0207380950451j), - (0.999785065651-0.0206423997879j), - (0.999787807465-0.0204866230488j), - (0.999794304371-0.0202808082104j), - (0.999800384045-0.0200312435627j), - (0.999803245068-0.0197458267212j), - (0.9998087883-0.0194311738014j), - (0.999816894531-0.0190933048725j), - (0.999825954437-0.0187371373177j), - (0.999829888344-0.0183679759502j), - (0.999835848808-0.017987690866j), - (0.999844014645-0.0176006518304j)) - - sampling_freq = 10e3 - freq = sampling_freq / 100 - - loop_bw = math.pi/100.0 - maxf = 1 - minf = -1 - - src = gr.sig_source_c(sampling_freq, gr.GR_COS_WAVE, freq, 1.0) - pll = analog.pll_carriertracking_cc(loop_bw, maxf, minf) - head = gr.head(gr.sizeof_gr_complex, int (freq)) - dst = gr.vector_sink_c() - - self.tb.connect(src, pll, head) - self.tb.connect(head, dst) - - self.tb.run() - dst_data = dst.data() - self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_pll_carriertracking, "test_pll_carriertracking.xml") diff --git a/gr-analog/python/qa_pll_freqdet.py b/gr-analog/python/qa_pll_freqdet.py deleted file mode 100755 index 1f808afa6..000000000 --- a/gr-analog/python/qa_pll_freqdet.py +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010-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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - -class test_pll_freqdet(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test_pll_freqdet(self): - expected_result = (0.0, - 4.33888922882e-08, - 0.367369994515, - 1.08135249597, - 2.10983253908, - 3.42221529438, - 4.98940390402, - 6.78379190842, - 8.77923286024, - 10.9510106794, - 13.2758363182, - 15.7317829127, - 18.2982902299, - 20.9561068599, - 23.6755271122, - 26.452952094, - 29.2731265301, - 32.1219053479, - 34.9862418188, - 37.8540971414, - 40.7144315483, - 43.5571390869, - 46.3730179743, - 49.1537231663, - 51.8917218889, - 54.58026103, - 57.2015358514, - 59.7513664199, - 62.2380533124, - 64.657612252, - 67.006640002, - 69.2822432184, - 71.4820384499, - 73.6041047056, - 75.6469478817, - 77.6094829742, - 79.4909866472, - 81.2911031615, - 83.0097850853, - 84.6355598352, - 86.1820937186, - 87.6504420946, - 89.0418441206, - 90.3577286819, - 91.5996432431, - 92.7692775646, - 93.8684162704, - 94.8989269904, - 95.8627662892, - 96.7619381633, - 97.598505899, - 98.362769679, - 99.0579904444, - 99.6992633875, - 100.288805948, - 100.828805921, - 101.321421457, - 101.76878699, - 102.17300138, - 102.536116055, - 102.860158727, - 103.147085962, - 103.398830608, - 103.617254366, - 103.792467691, - 103.939387906, - 104.060030865, - 104.15631756, - 104.230085975, - 104.283067372, - 104.316933727, - 104.333238432, - 104.333440018, - 104.318914008, - 104.290941063, - 104.250742554, - 104.187634452, - 104.103822339, - 104.013227468, - 103.916810336, - 103.815448432, - 103.709936239, - 103.600997093, - 103.489283183, - 103.375351833, - 103.259712936, - 103.142828952, - 103.025091195, - 102.90686726, - 102.776726069, - 102.648078982, - 102.521459607, - 102.397294831, - 102.275999684, - 102.157882471, - 102.043215927, - 101.93218978, - 101.824958181, - 101.72159228, - 101.622151366) - - sampling_freq = 10e3 - freq = sampling_freq / 100 - - loop_bw = math.pi/100.0 - maxf = 1 - minf = -1 - - src = gr.sig_source_c(sampling_freq, gr.GR_COS_WAVE, freq, 1.0) - pll = analog.pll_freqdet_cf(loop_bw, maxf, minf) - head = gr.head(gr.sizeof_float, int (freq)) - dst = gr.vector_sink_f() - - self.tb.connect(src, pll, head) - self.tb.connect(head, dst) - - self.tb.run() - dst_data = dst.data() - - # convert it from normalized frequency to absolute frequency (Hz) - dst_data = [i*(sampling_freq/(2*math.pi)) for i in dst_data] - - self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 3) - -if __name__ == '__main__': - gr_unittest.run(test_pll_freqdet, "test_pll_freqdet.xml") diff --git a/gr-analog/python/qa_pll_refout.py b/gr-analog/python/qa_pll_refout.py deleted file mode 100755 index 2831b2909..000000000 --- a/gr-analog/python/qa_pll_refout.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2010,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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - -class test_pll_refout(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_pll_refout(self): - expected_result = ((1+0j), - (1+6.4087357643e-10j), - (0.999985277653+0.00542619498447j), - (0.999868750572+0.0162021834403j), - (0.99948567152+0.0320679470897j), - (0.99860727787+0.0527590736747j), - (0.996953129768+0.0780025869608j), - (0.994203746319+0.107512556016j), - (0.990011692047+0.140985429287j), - (0.984013140202+0.178095817566j), - (0.975838363171+0.218493551016j), - (0.965121984482+0.261800557375j), - (0.95151245594+0.307610183954j), - (0.934681296349+0.355486690998j), - (0.914401650429+0.404808044434j), - (0.890356600285+0.455263823271j), - (0.862329125404+0.506348133087j), - (0.830152392387+0.557536482811j), - (0.793714106083+0.608290970325j), - (0.752960026264+0.658066213131j), - (0.707896590233+0.706316053867j), - (0.658591926098+0.752500295639j), - (0.605175673962+0.796091973782j), - (0.547837555408+0.836584687233j), - (0.48682525754+0.873499393463j), - (0.42244040966+0.906390726566j), - (0.355197101831+0.934791445732j), - (0.285494059324+0.958380460739j), - (0.213591173291+0.976923108101j), - (0.139945343137+0.990159213543j), - (0.065038472414+0.997882783413j), - (-0.0106285437942+0.999943494797j), - (-0.0865436866879+0.996248066425j), - (-0.162189796567+0.986759603024j), - (-0.23705175519+0.971496999264j), - (-0.310622543097+0.950533330441j), - (-0.38240903616+0.923993110657j), - (-0.451937526464+0.89204955101j), - (-0.518758952618+0.854920566082j), - (-0.582311093807+0.812966048717j), - (-0.642372369766+0.76639264822j), - (-0.698591887951+0.715520322323j), - (-0.750654160976+0.660695314407j), - (-0.798280358315+0.602286040783j), - (-0.841228663921+0.540679454803j), - (-0.87929558754+0.476276367903j), - (-0.912315964699+0.409486919641j), - (-0.940161883831+0.340728074312j), - (-0.962742805481+0.270418733358j), - (-0.980004072189+0.198977485299j), - (-0.991925954819+0.126818284392j), - (-0.99851256609+0.0545223206282j), - (-0.999846458435-0.0175215266645j), - (-0.996021270752-0.0891158208251j), - (-0.987133920193-0.159895718098j), - (-0.973306238651-0.2295101583j), - (-0.954683184624-0.297624111176j), - (-0.931430280209-0.363919824362j), - (-0.903732538223-0.428097635508j), - (-0.871792256832-0.489875763655j), - (-0.835827112198-0.548992812634j), - (-0.796068251133-0.605206847191j), - (-0.752758979797-0.658296227455j), - (-0.706152498722-0.70805978775j), - (-0.656641483307-0.754202902317j), - (-0.604367733002-0.79670548439j), - (-0.549597978592-0.835429251194j), - (-0.492602348328-0.870254516602j), - (-0.433654457331-0.901079237461j), - (-0.373029649258-0.927819430828j), - (-0.31100410223-0.950408577919j), - (-0.247853919864-0.968797445297j), - (-0.183855071664-0.982953369617j), - (-0.119282215834-0.992860376835j), - (-0.0544078871608-0.998518764973j), - (0.0104992967099-0.999944865704j), - (0.0749994292855-0.997183561325j), - (0.138844624162-0.990314185619j), - (0.201967850327-0.979392170906j), - (0.264124274254-0.964488625526j), - (0.325075358152-0.945688128471j), - (0.3845885396-0.92308807373j), - (0.442438393831-0.89679890871j), - (0.498407125473-0.866943061352j), - (0.552284479141-0.833655714989j), - (0.603869199753-0.797083437443j), - (0.652970373631-0.757383465767j), - (0.69940674305-0.714723825455j), - (0.743007957935-0.66928255558j), - (0.78350687027-0.62138313055j), - (0.820889055729-0.571087777615j), - (0.855021059513-0.51859331131j), - (0.885780930519-0.46410369873j), - (0.913058102131-0.407829582691j), - (0.936754107475-0.349988251925j), - (0.956783294678-0.290801793337j), - (0.973072886467-0.230497643352j), - (0.985563337803-0.169307261705j), - (0.9942086339-0.1074674353j), - (0.9989772439-0.0452152714133j)) - - sampling_freq = 10e3 - freq = sampling_freq / 100 - - loop_bw = math.pi/100.0 - maxf = 1 - minf = -1 - - src = gr.sig_source_c(sampling_freq, gr.GR_COS_WAVE, freq, 1.0) - pll = analog.pll_refout_cc(loop_bw, maxf, minf) - head = gr.head(gr.sizeof_gr_complex, int (freq)) - dst = gr.vector_sink_c() - - self.tb.connect(src, pll, head) - self.tb.connect(head, dst) - - self.tb.run() - dst_data = dst.data() - self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) - -if __name__ == '__main__': - gr_unittest.run(test_pll_refout, "test_pll_refout.xml") diff --git a/gr-analog/python/qa_probe_avg_mag_sqrd.py b/gr-analog/python/qa_probe_avg_mag_sqrd.py deleted file mode 100755 index 5c6c97e45..000000000 --- a/gr-analog/python/qa_probe_avg_mag_sqrd.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - -def avg_mag_sqrd_c(x, alpha): - y = [0,] - for xi in x: - tmp = alpha*(xi.real*xi.real + xi.imag*xi.imag) + (1-alpha)*y[-1] - y.append(tmp) - return y - -def avg_mag_sqrd_f(x, alpha): - y = [0,] - for xi in x: - tmp = alpha*(xi*xi) + (1-alpha)*y[-1] - y.append(tmp) - return y - -class test_probe_avg_mag_sqrd(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_c_001(self): - alpha = 0.0001 - src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, - 6.0+6.0j, 7.0+7.0j, 8.0+8.0j, 9.0+9.0j, 10.0+10.0j] - expected_result = avg_mag_sqrd_c(src_data, alpha)[-1] - - src = gr.vector_source_c(src_data) - op = analog.probe_avg_mag_sqrd_c(0, alpha) - - self.tb.connect(src, op) - self.tb.run() - - result_data = op.level() - self.assertAlmostEqual(expected_result, result_data, 5) - - def test_cf_002(self): - alpha = 0.0001 - src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, - 6.0+6.0j, 7.0+7.0j, 8.0+8.0j, 9.0+9.0j, 10.0+10.0j] - expected_result = avg_mag_sqrd_c(src_data, alpha)[0:-1] - - src = gr.vector_source_c(src_data) - op = analog.probe_avg_mag_sqrd_cf(0, alpha) - dst = gr.vector_sink_f() - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - result_data = dst.data() - self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5) - - def test_f_003(self): - alpha = 0.0001 - src_data = [1.0, 2.0, 3.0, 4.0, 5.0, - 6.0, 7.0, 8.0, 9.0, 10.0] - expected_result = avg_mag_sqrd_f(src_data, alpha)[-1] - - src = gr.vector_source_f(src_data) - op = analog.probe_avg_mag_sqrd_f(0, alpha) - - self.tb.connect(src, op) - self.tb.run() - - result_data = op.level() - self.assertAlmostEqual(expected_result, result_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_probe_avg_mag_sqrd, "test_probe_avg_mag_sqrd.xml") - diff --git a/gr-analog/python/qa_pwr_squelch.py b/gr-analog/python/qa_pwr_squelch.py deleted file mode 100755 index dd42c7fb9..000000000 --- a/gr-analog/python/qa_pwr_squelch.py +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog - -class test_pwr_squelch(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_pwr_squelch_001(self): - # Test set/gets - - alpha = 0.0001 - - thr1 = 10 - thr2 = 20 - ramp = 1 - ramp2 = 2 - gate = True - gate2 = False - - op = analog.pwr_squelch_cc(thr1, alpha, ramp, gate) - - op.set_threshold(thr2) - t = op.threshold() - self.assertEqual(thr2, t) - - op.set_ramp(ramp2) - r = op.ramp() - self.assertEqual(ramp2, r) - - op.set_gate(gate2) - g = op.gate() - self.assertEqual(gate2, g) - - def test_pwr_squelch_002(self): - # Test runtime, gate=True - alpha = 0.0001 - thr = -25 - - src_data = map(lambda x: float(x)/10.0, range(1, 40)) - src = gr.vector_source_c(src_data) - op = analog.pwr_squelch_cc(thr, alpha) - dst = gr.vector_sink_c() - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - expected_result = src_data - expected_result[0:20] = 20*[0,] - - result_data = dst.data() - self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4) - - def test_pwr_squelch_003(self): - # Test set/gets - - alpha = 0.0001 - - thr1 = 10 - thr2 = 20 - ramp = 1 - ramp2 = 2 - gate = True - gate2 = False - - op = analog.pwr_squelch_ff(thr1, alpha, ramp, gate) - - op.set_threshold(thr2) - t = op.threshold() - self.assertEqual(thr2, t) - - op.set_ramp(ramp2) - r = op.ramp() - self.assertEqual(ramp2, r) - - op.set_gate(gate2) - g = op.gate() - self.assertEqual(gate2, g) - - - def test_pwr_squelch_004(self): - alpha = 0.0001 - thr = -25 - - src_data = map(lambda x: float(x)/10.0, range(1, 40)) - src = gr.vector_source_f(src_data) - op = analog.pwr_squelch_ff(thr, alpha) - dst = gr.vector_sink_f() - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - expected_result = src_data - expected_result[0:20] = 20*[0,] - - result_data = dst.data() - self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4) - -if __name__ == '__main__': - gr_unittest.run(test_pwr_squelch, "test_pwr_squelch.xml") - diff --git a/gr-analog/python/qa_quadrature_demod.py b/gr-analog/python/qa_quadrature_demod.py deleted file mode 100755 index e38ea72a7..000000000 --- a/gr-analog/python/qa_quadrature_demod.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import cmath - -class test_quadrature_demod(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_quad_demod_001(self): - f = 1000.0 - fs = 8000.0 - - src_data = [] - for i in xrange(200): - ti = i/fs - src_data.append(cmath.exp(2j*cmath.pi*f*ti)) - - # f/fs is a quarter turn per sample. - # Set the gain based on this to get 1 out. - gain = 1.0/(cmath.pi/4) - - expected_result = [0,] + 199*[1.0] - - src = gr.vector_source_c(src_data) - op = analog.quadrature_demod_cf(gain) - dst = gr.vector_sink_f() - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - result_data = dst.data() - self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_quadrature_demod, "test_quadrature_demod.xml") - diff --git a/gr-analog/python/qa_rail_ff.py b/gr-analog/python/qa_rail_ff.py deleted file mode 100755 index 5bcf01c6b..000000000 --- a/gr-analog/python/qa_rail_ff.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog - -def clip(x, lo, hi): - if(x < lo): - return lo - elif(x > hi): - return hi - else: - return x - -class test_rail(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_rail_001(self): - # Test set/gets - - hi1 = 1 - hi2 = 2 - lo1 = -1 - lo2 = -2 - - op = analog.rail_ff(lo1, hi1) - - op.set_hi(hi2) - h = op.hi() - self.assertEqual(hi2, h) - - op.set_lo(lo2) - l = op.lo() - self.assertEqual(lo2, l) - - def test_rail_002(self): - lo = -0.75 - hi = 0.90 - src_data = [-2, -1, -0.5, -0.25, 0, 0.25, 0.5, 1, 2] - expected_result = map(lambda x: clip(x, lo, hi), src_data) - - src = gr.vector_source_f(src_data) - op = analog.rail_ff(lo, hi) - dst = gr.vector_sink_f() - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - result_data = dst.data() - self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4) - -if __name__ == '__main__': - gr_unittest.run(test_rail, "test_rail.xml") - diff --git a/gr-analog/python/qa_sig_source.py b/gr-analog/python/qa_sig_source.py deleted file mode 100755 index bc48333ed..000000000 --- a/gr-analog/python/qa_sig_source.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010,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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import math - -class test_sig_source(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_const_f(self): - tb = self.tb - expected_result = (1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5) - src1 = analog.sig_source_f(1e6, analog.GR_CONST_WAVE, 0, 1.5) - op = gr.head(gr.sizeof_float, 10) - dst1 = gr.vector_sink_f() - tb.connect(src1, op) - tb.connect(op, dst1) - tb.run() - dst_data = dst1.data() - self.assertEqual(expected_result, dst_data) - - def test_const_i(self): - tb = self.tb - expected_result = (1, 1, 1, 1) - src1 = analog.sig_source_i(1e6, analog.GR_CONST_WAVE, 0, 1) - op = gr.head(gr.sizeof_int, 4) - dst1 = gr.vector_sink_i() - tb.connect(src1, op) - tb.connect(op, dst1) - tb.run() - dst_data = dst1.data() - self.assertEqual(expected_result, dst_data) - - def test_sine_f(self): - tb = self.tb - sqrt2 = math.sqrt(2) / 2 - expected_result = (0, sqrt2, 1, sqrt2, 0, -sqrt2, -1, -sqrt2, 0) - src1 = analog.sig_source_f(8, analog.GR_SIN_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_float, 9) - dst1 = gr.vector_sink_f() - tb.connect(src1, op) - tb.connect(op, dst1) - tb.run() - dst_data = dst1.data() - self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5) - - def test_cosine_f(self): - tb = self.tb - sqrt2 = math.sqrt(2) / 2 - expected_result = (1, sqrt2, 0, -sqrt2, -1, -sqrt2, 0, sqrt2, 1) - src1 = analog.sig_source_f(8, analog.GR_COS_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_float, 9) - dst1 = gr.vector_sink_f() - tb.connect(src1, op) - tb.connect(op, dst1) - tb.run() - dst_data = dst1.data() - self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5) - - def test_sqr_c(self): - tb = self.tb #arg6 is a bit before -PI/2 - expected_result = (1j, 1j, 0, 0, 1, 1, 1+0j, 1+1j, 1j) - src1 = analog.sig_source_c(8, analog.GR_SQR_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_gr_complex, 9) - dst1 = gr.vector_sink_c() - tb.connect(src1, op) - tb.connect(op, dst1) - tb.run() - dst_data = dst1.data() - self.assertEqual(expected_result, dst_data) - - def test_tri_c(self): - tb = self.tb - expected_result = (1+.5j, .75+.75j, .5+1j, .25+.75j, 0+.5j, - .25+.25j, .5+0j, .75+.25j, 1+.5j) - src1 = analog.sig_source_c(8, analog.GR_TRI_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_gr_complex, 9) - dst1 = gr.vector_sink_c() - tb.connect(src1, op) - tb.connect(op, dst1) - tb.run() - dst_data = dst1.data() - self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5) - - def test_saw_c(self): - tb = self.tb - expected_result = (.5+.25j, .625+.375j, .75+.5j, .875+.625j, - 0+.75j, .125+.875j, .25+1j, .375+.125j, .5+.25j) - src1 = analog.sig_source_c(8, analog.GR_SAW_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_gr_complex, 9) - dst1 = gr.vector_sink_c() - tb.connect(src1, op) - tb.connect(op, dst1) - tb.run() - dst_data = dst1.data() - self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5) - - def test_sqr_f(self): - tb = self.tb - expected_result = (0, 0, 0, 0, 1, 1, 1, 1, 0) - src1 = analog.sig_source_f(8, analog.GR_SQR_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_float, 9) - dst1 = gr.vector_sink_f() - tb.connect(src1, op) - tb.connect(op, dst1) - tb.run() - dst_data = dst1.data() - self.assertEqual(expected_result, dst_data) - - def test_tri_f(self): - tb = self.tb - expected_result = (1, .75, .5, .25, 0, .25, .5, .75, 1) - src1 = analog.sig_source_f(8, analog.GR_TRI_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_float, 9) - dst1 = gr.vector_sink_f() - tb.connect(src1, op) - tb.connect(op, dst1) - tb.run() - dst_data = dst1.data() - self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5) - - def test_saw_f(self): - tb = self.tb - expected_result = (.5, .625, .75, .875, 0, .125, .25, .375, .5) - src1 = analog.sig_source_f(8, analog.GR_SAW_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_float, 9) - dst1 = gr.vector_sink_f() - tb.connect(src1, op) - tb.connect(op, dst1) - tb.run() - dst_data = dst1.data() - self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_sig_source, "test_sig_source.xml") diff --git a/gr-analog/python/qa_simple_squelch.py b/gr-analog/python/qa_simple_squelch.py deleted file mode 100755 index 9fa112864..000000000 --- a/gr-analog/python/qa_simple_squelch.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog - -class test_simple_squelch(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_simple_squelch_001(self): - # Test set/gets - - alpha = 0.0001 - - thr1 = 10 - thr2 = 20 - - op = analog.simple_squelch_cc(thr1, alpha) - - op.set_threshold(thr2) - t = op.threshold() - self.assertEqual(thr2, t) - - def test_simple_squelch_002(self): - alpha = 0.0001 - thr = -25 - - src_data = map(lambda x: float(x)/10.0, range(1, 40)) - src = gr.vector_source_c(src_data) - op = analog.simple_squelch_cc(thr, alpha) - dst = gr.vector_sink_c() - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - expected_result = src_data - expected_result[0:20] = 20*[0,] - - result_data = dst.data() - self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4) - -if __name__ == '__main__': - gr_unittest.run(test_simple_squelch, "test_simple_squelch.xml") - diff --git a/gr-analog/swig/CMakeLists.txt b/gr-analog/swig/CMakeLists.txt deleted file mode 100644 index 4391e5e09..000000000 --- a/gr-analog/swig/CMakeLists.txt +++ /dev/null @@ -1,53 +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. - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_INCLUDE_DIRS - ${GR_ANALOG_INCLUDE_DIRS} - ${GR_FILTER_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/analog_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib) -set(GR_SWIG_TARGET_DEPS analog_generated_includes) -set(GR_SWIG_LIBRARIES gnuradio-analog gnuradio-filter) - -GR_SWIG_MAKE(analog_swig analog_swig.i) - -GR_SWIG_INSTALL( - TARGETS analog_swig - DESTINATION ${GR_PYTHON_DIR}/gnuradio/analog - COMPONENT "analog_python" -) - -install( - FILES - analog_swig.i - ${CMAKE_CURRENT_BINARY_DIR}/analog_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "analog_swig" -) diff --git a/gr-analog/swig/analog_swig.i b/gr-analog/swig/analog_swig.i deleted file mode 100644 index 016537c94..000000000 --- a/gr-analog/swig/analog_swig.i +++ /dev/null @@ -1,137 +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. - */ - -#define ANALOG_API - -%include "gnuradio.i" -%include "stdint.i" - -//load generated python docstrings -%include "analog_swig_doc.i" - -%{ -#include "analog/cpm.h" -#include "analog/noise_type.h" -#include "analog/agc_cc.h" -#include "analog/agc_ff.h" -#include "analog/agc2_cc.h" -#include "analog/agc2_ff.h" -#include "analog/cpfsk_bc.h" -#include "analog/ctcss_squelch_ff.h" -#include "analog/dpll_bb.h" -#include "analog/feedforward_agc_cc.h" -#include "analog/fmdet_cf.h" -#include "analog/frequency_modulator_fc.h" -#include "analog/lfsr.h" -#include "analog/noise_source_s.h" -#include "analog/noise_source_i.h" -#include "analog/noise_source_f.h" -#include "analog/noise_source_c.h" -#include "analog/phase_modulator_fc.h" -#include "analog/pll_carriertracking_cc.h" -#include "analog/pll_freqdet_cf.h" -#include "analog/pll_refout_cc.h" -#include "analog/probe_avg_mag_sqrd_c.h" -#include "analog/probe_avg_mag_sqrd_cf.h" -#include "analog/probe_avg_mag_sqrd_f.h" -#include "analog/pwr_squelch_cc.h" -#include "analog/pwr_squelch_ff.h" -#include "analog/quadrature_demod_cf.h" -#include "analog/rail_ff.h" -#include "analog/sincos.h" -#include "analog/sig_source_s.h" -#include "analog/sig_source_i.h" -#include "analog/sig_source_f.h" -#include "analog/sig_source_c.h" -#include "analog/sig_source_waveform.h" -#include "analog/simple_squelch_cc.h" -#include "analog/squelch_base_cc.h" -#include "analog/squelch_base_ff.h" -%} - -%include "analog/cpm.h" -%include "analog/noise_type.h" -%include "analog/agc_cc.h" -%include "analog/agc_ff.h" -%include "analog/agc2_cc.h" -%include "analog/agc2_ff.h" -%include "analog/cpfsk_bc.h" -%include "analog/ctcss_squelch_ff.h" -%include "analog/dpll_bb.h" -%include "analog/feedforward_agc_cc.h" -%include "analog/fmdet_cf.h" -%include "analog/frequency_modulator_fc.h" -%include "analog/lfsr.h" -%include "analog/noise_source_s.h" -%include "analog/noise_source_i.h" -%include "analog/noise_source_f.h" -%include "analog/noise_source_c.h" -%include "analog/phase_modulator_fc.h" -%include "analog/pll_carriertracking_cc.h" -%include "analog/pll_freqdet_cf.h" -%include "analog/pll_refout_cc.h" -%include "analog/probe_avg_mag_sqrd_c.h" -%include "analog/probe_avg_mag_sqrd_cf.h" -%include "analog/probe_avg_mag_sqrd_f.h" -%include "analog/pwr_squelch_cc.h" -%include "analog/pwr_squelch_ff.h" -%include "analog/quadrature_demod_cf.h" -%include "analog/rail_ff.h" -%include "analog/sincos.h" -%include "analog/sig_source_s.h" -%include "analog/sig_source_i.h" -%include "analog/sig_source_f.h" -%include "analog/sig_source_c.h" -%include "analog/sig_source_waveform.h" -%include "analog/simple_squelch_cc.h" -%include "analog/squelch_base_cc.h" -%include "analog/squelch_base_ff.h" - -GR_SWIG_BLOCK_MAGIC2(analog, agc_cc); -GR_SWIG_BLOCK_MAGIC2(analog, agc_ff); -GR_SWIG_BLOCK_MAGIC2(analog, agc2_cc); -GR_SWIG_BLOCK_MAGIC2(analog, agc2_ff); -GR_SWIG_BLOCK_MAGIC2(analog, cpfsk_bc); -GR_SWIG_BLOCK_MAGIC2(analog, ctcss_squelch_ff); -GR_SWIG_BLOCK_MAGIC2(analog, dpll_bb); -GR_SWIG_BLOCK_MAGIC2(analog, feedforward_agc_cc); -GR_SWIG_BLOCK_MAGIC2(analog, fmdet_cf); -GR_SWIG_BLOCK_MAGIC2(analog, frequency_modulator_fc); -GR_SWIG_BLOCK_MAGIC2(analog, noise_source_s); -GR_SWIG_BLOCK_MAGIC2(analog, noise_source_i); -GR_SWIG_BLOCK_MAGIC2(analog, noise_source_f); -GR_SWIG_BLOCK_MAGIC2(analog, noise_source_c); -GR_SWIG_BLOCK_MAGIC2(analog, phase_modulator_fc); -GR_SWIG_BLOCK_MAGIC2(analog, pll_carriertracking_cc); -GR_SWIG_BLOCK_MAGIC2(analog, pll_freqdet_cf); -GR_SWIG_BLOCK_MAGIC2(analog, pll_refout_cc); -GR_SWIG_BLOCK_MAGIC2(analog, probe_avg_mag_sqrd_c); -GR_SWIG_BLOCK_MAGIC2(analog, probe_avg_mag_sqrd_cf); -GR_SWIG_BLOCK_MAGIC2(analog, probe_avg_mag_sqrd_f); -GR_SWIG_BLOCK_MAGIC2(analog, pwr_squelch_cc); -GR_SWIG_BLOCK_MAGIC2(analog, pwr_squelch_ff); -GR_SWIG_BLOCK_MAGIC2(analog, quadrature_demod_cf); -GR_SWIG_BLOCK_MAGIC2(analog, rail_ff); -GR_SWIG_BLOCK_MAGIC2(analog, sig_source_s); -GR_SWIG_BLOCK_MAGIC2(analog, sig_source_i); -GR_SWIG_BLOCK_MAGIC2(analog, sig_source_f); -GR_SWIG_BLOCK_MAGIC2(analog, sig_source_c); -GR_SWIG_BLOCK_MAGIC2(analog, simple_squelch_cc); diff --git a/gr-atsc/CMakeLists.txt b/gr-atsc/CMakeLists.txt deleted file mode 100644 index 26f99a157..000000000 --- a/gr-atsc/CMakeLists.txt +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) -GR_REGISTER_COMPONENT("gr-atsc" ENABLE_GR_ATSC - Boost_FOUND - ENABLE_GR_CORE -) - -GR_SET_GLOBAL(GR_ATSC_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/src/lib -) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_ATSC) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_ATSC_DESCRIPTION "GNU Radio ATSC Blocks") - -CPACK_COMPONENT("atsc_runtime" - GROUP "ATSC" - DISPLAY_NAME "Runtime" - DESCRIPTION "Runtime" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("atsc_devel" - GROUP "ATSC" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("atsc_python" - GROUP "ATSC" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime; GRC xml files" - DEPENDS "core_python;atsc_runtime" -) - -CPACK_COMPONENT("atsc_examples" - GROUP "ATSC" - DISPLAY_NAME "Examples" - DESCRIPTION "Python examples for ATSC" - DEPENDS "atsc_python" -) - -CPACK_COMPONENT("atsc_swig" - GROUP "ATSC" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;atsc_python;atsc_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(src/lib) -if(ENABLE_PYTHON) - add_subdirectory(src/python) -endif(ENABLE_PYTHON) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-atsc.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-atsc.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-atsc.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "atsc_devel" -) - -endif(ENABLE_GR_ATSC) diff --git a/gr-atsc/README b/gr-atsc/README deleted file mode 100644 index aa73910bd..000000000 --- a/gr-atsc/README +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright 2006 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 module contains the GNU Radio 2.x code for the -ATSC (HDTV) transmitter and receiver. - -See http://www.atsc.org for specifications. The most relevant ones -are XXX and YYY. - diff --git a/gr-atsc/README.signal_flow b/gr-atsc/README.signal_flow deleted file mode 100644 index eee83a484..000000000 --- a/gr-atsc/README.signal_flow +++ /dev/null @@ -1,41 +0,0 @@ -This describes the signal flow through the gnuradio-0.9 ATSC Transmitter -and Receiver programs. - -ATSC Transmitter -================ - -module input output notes --------------------- ---------------- ------------------- -------- -VrFileSource "MPEG transport stream" atsc_mpeg_packet -GrAtscRandomizer atsc_mpeg_packet atsc_mpeg_packet_no_sync whiten data with LFSR -GrAtscRSEncoder atsc_mpeg_packet_no_sync atsc_mpeg_packet_rs_encoded Reed-Soloman encoder -GrAtscInterleaver atsc_mpeg_packet_rs_encoded atsc_mpeg_packet_rs_encoded convolutional interleaver -GrAtscTrellisEncoder atsc_mpeg_packet_rs_encoded atsc_data_segment trellis encoder -GrAtscFieldSyncMux atsc_data_segment atsc_data_segment add in field syncs -GrAtscSymbolMapper atsc_data_segment float map [0,7] to +/- {1,3,5,7} and add pilot -GrWeaverModHead float float,float front half of Weaver VSB modulator -GrFIRfilterFFF (2x) float float low pass root raised cosine (matched filter) -GrWeaverModTail float,float short back half of Weaver VSB modulator -VrFileSink short "16-bit passband data" - - -ATSC Receiver -============= - -module input output notes --------------------- ---------------- ------------------- ------- -VrFileSource "16-bit passband data" short -GrConvertSF short float convert short to float -GrFIRfilterFFF float float band pass root raised cosine centered at IF freq (matched filter) -GrAtscFPLL float float carrier tracking freq and phase lock loop with down converting mixer -GrFIRfilterFFF float float low pass to kill unwanted mixer image -GrRemoveDcFFF float float remove DC offset prior to symbol timing module -GrAtscBitTimingLoop3 float float,syminfo track symbol & segment timing and do fractional interpolation -GrAtscFieldSyncChecker float,syminfo float,syminfo look for field sync patterns -GrAtscEqualizer float,syminfo float,syminfo LMS equalizer -GrAtscFieldSyncDemux float,syminfo atsc_soft_data_segment remove field syncs and pack into data segments -GrAtscViterbiDecoder atsc_soft_data_segment atsc_mpeg_packet_rs_encoded Viterbi decoder (12 seg delay) -GrAtscDeinterleaver atsc_mpeg_packet_rs_encoded atsc_mpeg_packet_rs_encoded convolutional de-interleaver (52 seg delay) -GrAtscRSDecoder atsc_mpeg_packet_rs_encoded atsc_mpeg_packet_no_sync Reed-Solomon decoder -GrAtscDerandomizer atsc_mpeg_packet_no_sync atsc_mpeg_packet de-whiten with LFSR -VrFileSink atsc_mpeg_packet "MPEG transport stream" diff --git a/gr-atsc/gnuradio-atsc.pc.in b/gr-atsc/gnuradio-atsc.pc.in deleted file mode 100644 index 4413bfc82..000000000 --- a/gr-atsc/gnuradio-atsc.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-atsc -Description: The GNU Radio blocks for ATSC decoding -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-atsc -Cflags: -I${includedir} diff --git a/gr-atsc/src/lib/CMakeLists.txt b/gr-atsc/src/lib/CMakeLists.txt deleted file mode 100644 index 3d2b84a03..000000000 --- a/gr-atsc/src/lib/CMakeLists.txt +++ /dev/null @@ -1,236 +0,0 @@ -# Copyright 2011-212 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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${GR_ATSC_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# Generate viterbi mux source -# http://www.vtk.org/Wiki/CMake_Cross_Compiling#Using_executables_in_the_build_created_during_the_build -######################################################################## -if(NOT CMAKE_CROSSCOMPILING) - add_executable(atsci_viterbi_gen atsci_viterbi_gen.cc) - export(TARGETS atsci_viterbi_gen APPEND FILE ${EXPORT_FILE}) -endif() - - -set(atsci_viterbi_mux_cc ${CMAKE_CURRENT_BINARY_DIR}/atsci_viterbi_mux.cc) - -add_custom_command( - OUTPUT ${atsci_viterbi_mux_cc} - DEPENDS atsci_viterbi_gen - COMMAND atsci_viterbi_gen -o ${atsci_viterbi_mux_cc} -) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_atsc_sources - ${atsci_viterbi_mux_cc} - atsc_derandomizer.cc - atsc_randomizer.cc - atsc_rs_decoder.cc - atsc_rs_encoder.cc - atsc_interleaver.cc - atsc_deinterleaver.cc - atsc_trellis_encoder.cc - atsc_viterbi_decoder.cc - atsc_ds_to_softds.cc - atsc_field_sync_mux.cc - atsc_field_sync_demux.cc - atsc_equalizer.cc - atsc_fs_checker.cc - atsc_bit_timing_loop.cc - atsc_fpll.cc - atsc_depad.cc - atsc_pad.cc - atsci_basic_trellis_encoder.cc - atsci_data_interleaver.cc - atsci_equalizer.cc - atsci_equalizer_lms.cc - atsci_equalizer_lms2.cc - atsci_equalizer_nop.cc - atsci_fake_single_viterbi.cc - atsci_fs_checker.cc - atsci_fs_checker_naive.cc - atsci_fs_correlator.cc - atsci_fs_correlator_naive.cc - atsci_single_viterbi.cc - atsci_sssr.cc - atsci_pnXXX.cc - atsci_randomizer.cc - atsci_reed_solomon.cc - atsci_sliding_correlator.cc - atsci_trellis_encoder.cc - atsci_viterbi_decoder.cc - create_atsci_equalizer.cc - create_atsci_fs_checker.cc - create_atsci_fs_correlator.cc - plinfo.cc -) - -list(APPEND atsc_libs - gnuradio-core - ${Boost_LIBRARIES} -) - -add_library(gnuradio-atsc SHARED ${gr_atsc_sources}) -target_link_libraries(gnuradio-atsc ${atsc_libs}) -GR_LIBRARY_FOO(gnuradio-atsc RUNTIME_COMPONENT "atsc_runtime" DEVEL_COMPONENT "atsc_devel") - -######################################################################## -# Build and register unit test -######################################################################## -if(ENABLE_TESTING) - -include_directories(${CPPUNIT_INCLUDE_DIRS}) -link_directories(${CPPUNIT_LIBRARY_DIRS}) - -list(APPEND test_atsci_sources - qa_atsci_basic_trellis_encoder.cc - qa_atsci_data_interleaver.cc - qa_atsci_equalizer_nop.cc - qa_atsci_fake_single_viterbi.cc - qa_atsci_fs_correlator.cc - qa_atsci_single_viterbi.cc - qa_atsci_randomizer.cc - qa_atsci_reed_solomon.cc - qa_atsci_sliding_correlator.cc - qa_atsci_trellis_encoder.cc - qa_atsci_viterbi_decoder.cc - qa_convolutional_interleaver.cc - qa_atsci.cc - qa_interleaver_fifo.cc -) - -include(GrTest) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-atsc) -add_executable(test_atsci ${test_atsci_sources} test_atsci.cc) -target_link_libraries(test_atsci gnuradio-atsc gnuradio-core ${CPPUNIT_LIBRARIES}) -GR_ADD_TEST(atsci-test test_atsci) - -endif(ENABLE_TESTING) - -######################################################################## -# Install public header files -######################################################################## -install(FILES - atsc_api.h - atsc_consts.h - atsc_derandomizer.h - atsc_randomizer.h - atsc_rs_decoder.h - atsc_rs_encoder.h - atsc_interleaver.h - atsc_deinterleaver.h - atsc_trellis_encoder.h - atsc_viterbi_decoder.h - atsc_ds_to_softds.h - atsc_field_sync_mux.h - atsc_field_sync_demux.h - atsc_equalizer.h - atsc_fs_checker.h - atsc_bit_timing_loop.h - atsc_fpll.h - atsc_depad.h - atsc_pad.h - atsc_types.h - atsci_basic_trellis_encoder.h - atsci_data_interleaver.h - atsci_diag_output.h - atsci_equalizer.h - atsci_equalizer_lms.h - atsci_equalizer_lms2.h - atsci_equalizer_nop.h - atsci_exp2_lp.h - atsci_fake_single_viterbi.h - atsci_fs_checker.h - atsci_fs_checker_naive.h - atsci_fs_correlator.h - atsci_fs_correlator_naive.h - atsci_pnXXX.h - atsci_randomizer.h - atsci_reed_solomon.h - atsci_root_raised_cosine.h - atsci_root_raised_cosine_bandpass.h - atsci_single_viterbi.h - atsci_slicer_agc.h - atsci_sliding_correlator.h - atsci_sssr.h - atsci_syminfo.h - atsci_sync_tag.h - atsci_trellis_encoder.h - atsci_viterbi_decoder.h - atsci_vsbtx_lp.h - convolutional_interleaver.h - create_atsci_equalizer.h - create_atsci_fs_checker.h - create_atsci_fs_correlator.h - fpll_btloop_coupling.h - interleaver_fifo.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "atsc_devel" -) - -######################################################################## -# Setup swig generation -######################################################################## -if(ENABLE_PYTHON) -include(GrPython) -include(GrSwig) - -set(GR_SWIG_INCLUDE_DIRS - ${GR_ATSC_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -# add Doxygen docs to python -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/atsc_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) - -set(GR_SWIG_LIBRARIES gnuradio-atsc) - -GR_SWIG_MAKE(atsc atsc.i) - -GR_SWIG_INSTALL( - TARGETS atsc - DESTINATION ${GR_PYTHON_DIR}/gnuradio - COMPONENT "atsc_python" -) - -install( - FILES atsc.i - ${CMAKE_CURRENT_BINARY_DIR}/atsc_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "atsc_swig" -) - -endif(ENABLE_PYTHON) diff --git a/gr-atsc/src/lib/GrAtscBitTimingLoop.cc b/gr-atsc/src/lib/GrAtscBitTimingLoop.cc deleted file mode 100644 index 8053736ee..000000000 --- a/gr-atsc/src/lib/GrAtscBitTimingLoop.cc +++ /dev/null @@ -1,223 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cmath> -#include <GrAtscBitTimingLoop.h> -#include "fpll_btloop_coupling.h" -#include <algorithm> -#include <atsc_consts.h> -#include <stdio.h> -#include <assert.h> - -using std::abs; - -static const int DEC = 2; // nominal decimation factor - -/* - * I strongly suggest that you not mess with these... - */ -static const double DEFAULT_TIMING_RATE = 2.19e-4 / FPLL_BTLOOP_COUPLING_CONST; -static const double DEFAULT_LOOP_TAP = 0.05; - - -GrAtscBitTimingLoop::GrAtscBitTimingLoop () - : VrDecimatingSigProc<float,float> (1, DEC), - next_input(0), w (1.0), mu (0.5), last_right(0), - debug_no_update (false) -{ - d_timing_rate = DEFAULT_TIMING_RATE; - loop.set_taps (DEFAULT_LOOP_TAP); - - history = 1500; // spare input samples in case we need them. - -#ifdef _BT_DIAG_OUTPUT_ - fp_loop = fopen ("loop.out", "w"); - if (fp_loop == 0){ - perror ("loop.out"); - exit (1); - } - - fp_ps = fopen ("ps.out", "w"); - if (fp_ps == 0){ - perror ("ps.out"); - exit (1); - } -#endif -} - -// -// We are nominally a 2x decimator, but our actual rate varies slightly -// depending on the difference between the transmitter and receiver -// sampling clocks. Hence, we need to compute our input ranges -// explictly. - -int -GrAtscBitTimingLoop::forecast(VrSampleRange output, - VrSampleRange inputs[]) { - /* dec:1 ratio with history */ - for(unsigned int i=0;i<numberInputs;i++) { - inputs[i].index=next_input; - inputs[i].size=output.size*decimation + history-1; - } - return 0; -} - -inline double -GrAtscBitTimingLoop::filter_error (double e) -{ - static const double limit = 50 * FPLL_BTLOOP_COUPLING_CONST; - - // first limit - - if (e > limit) - e = limit; - else if (e < -limit) - e = -limit; - - return loop.filter (e); -} - -int -GrAtscBitTimingLoop::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - iType *in = ((iType **)ai)[0]; - oType *out = ((oType **)ao)[0]; - - // Force in-order computation of output stream. - // This is required because of our slightly variable decimation factor - sync (output.index); - - - // We are tasked with producing output.size output samples. - // We will consume approximately 2 * output.size input samples. - - - unsigned int ii = 0; // input index - unsigned int k; // output index - - // We look at a window of 3 samples that we call left (oldest), - // middle, right (newest). Each time through the loop, the previous - // right becomes the new left, and the new samples are middle and - // right. - // - // The basic game plan is to drive the average difference between - // right and left to zero. Given that all transitions are - // equiprobable (the data is white) and that the composite matched - // filter is symmetric (raised cosine) it turns out that in the - // average, if we drive that difference to zero, (implying that the - // average slope at the middle point is zero), we'll be sampling - // middle at the maximum or minimum point in the pulse. - - iType left; - iType middle; - iType right = last_right; - - for (k = 0; k < output.size; k++){ - - left = right; - middle = produce_sample (in, ii); - right = produce_sample (in, ii); - - // assert (ii < inputs[0].size); - if (!(ii < inputs[0].size)){ - fprintf (stderr, "ii < inputs[0].size\n"); - fprintf (stderr, "ii = %d, inputs[0].size = %lu, k = %d, output.size = %lu\n", - ii, inputs[0].size, k, output.size); - assert (0); - } - - - out[k] = middle; // produce our output - - double timing_error = -middle * ((double) right - left); - - // update_timing_control_word - - double filtered_timing_error = filter_error (timing_error); - - if (!debug_no_update){ - mu += filtered_timing_error * d_timing_rate; - } - -#ifdef _BT_DIAG_OUTPUT_ - float iodata[8]; - iodata[0] = left; - iodata[1] = middle; - iodata[2] = right; - iodata[3] = timing_error; - iodata[4] = filtered_timing_error; - iodata[5] = mu; - iodata[6] = w; - iodata[7] = 0; - if (fwrite (iodata, sizeof (iodata), 1, fp_loop) != 1){ - perror ("fwrite: loop"); - exit (1); - } -#endif - - } - - last_right = right; - next_input += ii; // update next_input so forecast can get us what we need - return output.size; -} - -/*! - * Produce samples equally spaced in time that are referenced - * to the transmitter's sample clock, not ours. - * - * See pp 523-527 of "Digital Communication Receivers", Meyr, - * Moeneclaey and Fechtel, Wiley, 1998. - */ - -GrAtscBitTimingLoop::iType -GrAtscBitTimingLoop::produce_sample (const iType *in, unsigned int &index) -{ - // update mu and index as function of control word, w - - double sum = mu + w; - double f = floor (sum); - int incr = (int) f; // mostly 1, rarely 0 or 2 - mu = sum - f; - - assert (0 <= incr && incr <= 2); - assert (0.0 <= mu && mu <= 1.0); - - index += incr; - - iType n = intr.interpolate (&in[index], mu); - -#if defined(_BT_DIAG_OUTPUT_) && 0 - float iodata[4]; - iodata[0] = incr; - iodata[1] = mu; - iodata[2] = w; - iodata[3] = 0; - if (fwrite (iodata, sizeof (iodata), 1, fp_ps) != 1){ - perror ("fwrite: ps"); - exit (1); - } -#endif - - return n; -} diff --git a/gr-atsc/src/lib/GrAtscBitTimingLoop.h b/gr-atsc/src/lib/GrAtscBitTimingLoop.h deleted file mode 100644 index fa64f4d37..000000000 --- a/gr-atsc/src/lib/GrAtscBitTimingLoop.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCBITTIMINGLOOP_H_ -#define _GRATSCBITTIMINGLOOP_H_ - -#include <gr_nco.h> -#include <VrSigProc.h> -#include <VrHistoryProc.h> -#include <VrDecimatingSigProc.h> -#include <interleaver_fifo.h> -#include <gr_single_pole_iir.h> -#include <gr_mmse_fir_interpolator.h> -#include <atsci_slicer_agc.h> -#include <stdio.h> -#include <atsci_diag_output.h> - - -/*! - * \brief ATSC BitTimingLoop - * - * This class accepts a single real input and produces a single real output - */ - -class GrAtscBitTimingLoop : public VrDecimatingSigProc<float,float> { - - public: - - GrAtscBitTimingLoop (); - virtual ~GrAtscBitTimingLoop () { }; - - virtual const char *name () { return "GrAtscBitTimingLoop"; } - - virtual int forecast (VrSampleRange output, - VrSampleRange inputs[]); - - virtual int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - - // debug - void set_mu (double a_mu) { mu = a_mu; } - void set_no_update (bool a_no_update) { debug_no_update = a_no_update; } - void set_loop_filter_tap (double tap) { loop.set_taps (tap); } - void set_timing_rate (double rate) { d_timing_rate = rate; } - - protected: - - typedef float iType; - typedef float oType; - - iType produce_sample (const iType *in, unsigned int &index); - double filter_error (double e); - - VrSampleIndex next_input; - gr_mmse_fir_interpolator intr; - double w; // timing control word - double mu; // fractional delay - iType last_right; // last right hand sample - gr_single_pole_iir<double,double,double> loop; - bool debug_no_update;// debug - - double d_loop_filter_tap; - double d_timing_rate; - -#ifdef _BT_DIAG_OUTPUT_ - FILE *fp_loop; - FILE *fp_ps; -#endif -}; - -#endif // _GRATSCBITTIMINGLOOP_H_ diff --git a/gr-atsc/src/lib/GrAtscBitTimingLoop2.cc b/gr-atsc/src/lib/GrAtscBitTimingLoop2.cc deleted file mode 100644 index c741a5bb2..000000000 --- a/gr-atsc/src/lib/GrAtscBitTimingLoop2.cc +++ /dev/null @@ -1,173 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscBitTimingLoop2.h> -#include <algorithm> -#include <atsc_consts.h> -#include <stdio.h> -#include <assert.h> - - -static const int DEC = 2; // nominal decimation factor - -static const unsigned AVG_WINDOW_LEN = 256; -static const float TIMING_RATE_CONST = 1e-5; // FIXME document interaction with AGC - - -GrAtscBitTimingLoop2::GrAtscBitTimingLoop2 () - : VrDecimatingSigProc<float,float> (1, DEC), - next_input(0), dc (0.0002), mu (0.0), last_right(0), use_right_p (true) -{ - history = 100; // spare input samples in case we need them. - -#ifdef _BT_DIAG_OUTPUT_ - fp_loop = fopen ("loop.out", "w"); - if (fp_loop == 0){ - perror ("loop.out"); - exit (1); - } - - fp_ps = fopen ("ps.out", "w"); - if (fp_ps == 0){ - perror ("ps.out"); - exit (1); - } -#endif - -} - -// -// We are nominally a 2x decimator, but our actual rate varies slightly -// depending on the difference between the transmitter and receiver -// sampling clocks. Hence, we need to compute our input ranges -// explictly. - -int -GrAtscBitTimingLoop2::forecast(VrSampleRange output, - VrSampleRange inputs[]) { - /* dec:1 ratio with history */ - for(unsigned int i=0;i<numberInputs;i++) { - inputs[i].index=next_input; - inputs[i].size=output.size*decimation + history-1; - } - return 0; -} - -inline float -GrAtscBitTimingLoop2::filter_error (float e) -{ - return e; // identity function -} - -int -GrAtscBitTimingLoop2::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - iType *in = ((iType **)ai)[0]; - oType *out = ((oType **)ao)[0]; - - // Force in-order computation of output stream. - // This is required because of our slightly variable decimation factor - sync (output.index); - - - // We are tasked with producing output.size output samples. - // We will consume approximately 2 * output.size input samples. - - - unsigned int ii = 0; // input index - unsigned int k; // output index - - // We look at a window of 3 samples that we call left (oldest), - // middle, right (newest). Each time through the loop, the previous - // right becomes the new left, and the new samples are middle and - // right. - // - // The basic game plan is to drive the average difference between - // right and left to zero. Given that all transitions are - // equiprobable (the data is white) and that the composite matched - // filter is symmetric (raised cosine) it turns out that in the - // average, if we drive that difference to zero, (implying that the - // average slope at the middle point is zero), we'll be sampling - // middle at the maximum or minimum point in the pulse. - - iType left; - iType middle; - iType right = last_right; - - for (k = 0; k < output.size; k++){ - - left = right; - - iType middle_raw = produce_sample (in, ii); - iType middle_dc = dc.filter (middle_raw); - middle = middle_raw - middle_dc; - - iType right_raw = produce_sample (in, ii); - iType right_dc = dc.filter (right_raw); - right = right_raw - right_dc; - - if (use_right_p) // produce our output - out[k] = right; - else - out[k] = middle; - } - -#ifdef _BT_DIAG_OUTPUT_ - float iodata[8]; - iodata[0] = 0; - iodata[1] = out[k]; - iodata[2] = 0; - iodata[3] = 0; - iodata[4] = 0; - iodata[5] = mu; - iodata[6] = 0; - iodata[7] = 0; // spare - if (fwrite (iodata, sizeof (iodata), 1, fp_loop) != 1){ - perror ("fwrite: loop"); - exit (1); - } -#endif - - - last_right = right; - next_input += ii; // update next_input so forecast can get us what we need - return output.size; -} - -/*! - * Produce samples equally spaced in time that are referenced - * to the transmitter's sample clock, not ours. - * - * See pp 523-527 of "Digital Communication Receivers", Meyr, - * Moeneclaey and Fechtel, Wiley, 1998. - */ - -GrAtscBitTimingLoop2::iType -GrAtscBitTimingLoop2::produce_sample (const iType *in, unsigned int &index) -{ - iType n = intr.interpolate (&in[index], mu); - - index++; - return n; -} - diff --git a/gr-atsc/src/lib/GrAtscBitTimingLoop2.h b/gr-atsc/src/lib/GrAtscBitTimingLoop2.h deleted file mode 100644 index 4f36c902e..000000000 --- a/gr-atsc/src/lib/GrAtscBitTimingLoop2.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCBITTIMINGLOOP2_H_ -#define _GRATSCBITTIMINGLOOP2_H_ - -#include <gr_nco.h> -#include <VrSigProc.h> -#include <VrHistoryProc.h> -#include <VrDecimatingSigProc.h> -#include <interleaver_fifo.h> -#include <gr_single_pole_iir.h> -#include <gr_mmse_fir_interpolator.h> - -/*! - * \brief ATSC BitTimingLoop - * - * This class accepts a single real input and produces a single real output - */ - -class GrAtscBitTimingLoop2 : public VrDecimatingSigProc<float,float> { - - public: - - GrAtscBitTimingLoop2 (); - virtual ~GrAtscBitTimingLoop2 () { }; - - virtual const char *name () { return "GrAtscBitTimingLoop2"; } - - virtual int forecast (VrSampleRange output, - VrSampleRange inputs[]); - - virtual int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - - // debug - void set_mu (float a_mu) { - assert (0 <= a_mu && a_mu <= 1.9); - use_right_p = a_mu < 1.0; - mu = a_mu - floor (a_mu); - cerr << "BTL2: mu: " << mu << " use_right_p: " << use_right_p << endl; - } - - protected: - - typedef float iType; - typedef float oType; - - iType produce_sample (const iType *in, unsigned int &index); - float filter_error (float e); - - VrSampleIndex next_input; - gr_single_pole_iir<float,float,float> dc; // used to estimate DC component - gr_mmse_fir_interpolator intr; - float mu; // fractional delay - iType last_right; // last right hand sample - - bool use_right_p; // ...else middle -}; - -#endif // _GRATSCBITTIMINGLOOP2_H_ diff --git a/gr-atsc/src/lib/GrAtscBitTimingLoop3.cc b/gr-atsc/src/lib/GrAtscBitTimingLoop3.cc deleted file mode 100644 index f9c1eb02e..000000000 --- a/gr-atsc/src/lib/GrAtscBitTimingLoop3.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscBitTimingLoop3.h> -#include <cmath> -#include <cstdio> -#include <assert.h> - -using std::abs; - - -static const int NOUTPUTS = 2; - -GrAtscBitTimingLoop3::GrAtscBitTimingLoop3 (double ratio_of_rx_clock_to_symbol_freq) - : VrDecimatingSigProc<float,float> (NOUTPUTS, (int) rint (ratio_of_rx_clock_to_symbol_freq)), - d_interp (ratio_of_rx_clock_to_symbol_freq), d_next_input(0), - d_rx_clock_to_symbol_freq (ratio_of_rx_clock_to_symbol_freq) - -{ - assert (ratio_of_rx_clock_to_symbol_freq >= 1.8); // sanity check - - history = 1500; // spare input samples in case we need them. -} - -// -// We are nominally a 2x decimator, but our actual rate varies slightly -// depending on the difference between the transmitter and receiver -// sampling clocks. Hence, we need to compute our input ranges -// explictly. - -int -GrAtscBitTimingLoop3::forecast(VrSampleRange output, - VrSampleRange inputs[]) { - assert (numberInputs == 1); - - /* dec:1 ratio with history */ - inputs[0].index = d_next_input; - inputs[0].size = - ((unsigned long) (output.size * d_rx_clock_to_symbol_freq) + history - 1); - - return 0; -} - - -int -GrAtscBitTimingLoop3::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - iType *in = ((iType **)ai)[0]; - oDataType *out_sample = ((oDataType **)ao)[0]; - oTagType *out_tag = ((oTagType **) ao)[1]; - - // Force in-order computation of output stream. - // This is required because of our slightly variable decimation factor - sync (output.index); - - // We are tasked with producing output.size output samples. - // We will consume approximately 2 * output.size input samples. - - int si = 0; // source index - unsigned int k; // output index - - float interp_sample; - int symbol_index; - double timing_adjustment = 0; - bool seg_locked; - oTagType tag; - - memset (&tag, 0, sizeof (tag)); - - for (k = 0; k < output.size; k++){ - - if (!d_interp.update (in, inputs[0].size, &si, timing_adjustment, &interp_sample)){ - fprintf (stderr, "GrAtscBitTimingLoop3: ran short on data...\n"); - break; - } - - d_sssr.update (interp_sample, &seg_locked, &symbol_index, &timing_adjustment); - out_sample[k] = interp_sample; - tag.valid = seg_locked; - tag.symbol_num = symbol_index; - out_tag[k] = tag; - } - - d_next_input += si; // update next_input so forecast can get us what we need - return k; -} diff --git a/gr-atsc/src/lib/GrAtscBitTimingLoop3.h b/gr-atsc/src/lib/GrAtscBitTimingLoop3.h deleted file mode 100644 index 7e019e49c..000000000 --- a/gr-atsc/src/lib/GrAtscBitTimingLoop3.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCBITTIMINGLOOP3_H_ -#define _GRATSCBITTIMINGLOOP3_H_ - -#include <cstdio> -#include <VrDecimatingSigProc.h> -#include <atsci_diag_output.h> -#include <atsci_sssr.h> -#include <atsci_syminfo.h> - -/*! - * \brief ATSC BitTimingLoop3 - * - * This class accepts a single real input and produces two outputs, - * the raw symbol (float) and the tag (atsc_syminfo) - */ - -class GrAtscBitTimingLoop3 : public VrDecimatingSigProc<float,float> { - - public: - - GrAtscBitTimingLoop3 (double ratio_of_rx_clock_to_symbol_freq); - virtual ~GrAtscBitTimingLoop3 () { }; - - virtual const char *name () { return "GrAtscBitTimingLoop3"; } - - virtual int forecast (VrSampleRange output, - VrSampleRange inputs[]); - - virtual int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - - // debug (NOPs) - void set_mu (double a_mu) { } - void set_no_update (bool a_no_update) { } - void set_loop_filter_tap (double tap) { } - void set_timing_rate (double rate) { } - - protected: - - typedef float iType; - typedef float oDataType; - typedef atsc::syminfo oTagType; - - atsci_sssr d_sssr; - atsci_interpolator d_interp; - VrSampleIndex d_next_input; - double d_rx_clock_to_symbol_freq; -}; - -#endif // _GRATSCBITTIMINGLOOP3_H_ diff --git a/gr-atsc/src/lib/GrAtscConvert2xTo20.cc b/gr-atsc/src/lib/GrAtscConvert2xTo20.cc deleted file mode 100644 index 1f540464d..000000000 --- a/gr-atsc/src/lib/GrAtscConvert2xTo20.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscConvert2xTo20.h> -#include <atsc_consts.h> -#include <cmath> -#include <cstdio> - -static const int N_OUTPUTS = 1; -static const double DEC_RATIO = (2.0 * ATSC_SYMBOL_RATE) / 20e6; // ~ 1.076 - -GrAtscConvert2xTo20::GrAtscConvert2xTo20 () - : VrDecimatingSigProc<float,float> (N_OUTPUTS, (int) rint (DEC_RATIO)) -{ - d_next_input = 0; - d_frac_part = 0; - history = 2 * d_interp.ntaps (); // some slack -} - -GrAtscConvert2xTo20::~GrAtscConvert2xTo20 () -{ - // Nop -} - -void -GrAtscConvert2xTo20::pre_initialize () -{ - fprintf (stderr, - "GrAtscConvert2xTo20: input freq = %g\n", getInputSamplingFrequencyN(0)); - fprintf (stderr, - "GrAtscConvert2xTo20: DEC_RATIO = %g\n", DEC_RATIO); - fprintf (stderr, - "GrAtscConvert2xTo20: argument to setSamplingFrequency = %g\n", - getInputSamplingFrequencyN(0) / DEC_RATIO); - - int r; - r = setSamplingFrequency (getInputSamplingFrequencyN (0) / DEC_RATIO); - - fprintf (stderr, "GrAtscConvert2xTo20: result = %d\n", r); - - fprintf (stderr, "GrAtscConvert2xTo20: getSamplingFrequency = %g\n", - getSamplingFrequency ()); -} - - -int -GrAtscConvert2xTo20::forecast (VrSampleRange output, - VrSampleRange inputs[]) -{ - assert (numberInputs == 1); // I hate these free references to - // superclass's instance variables... - - inputs[0].index = d_next_input; - inputs[0].size = - ((long unsigned int) (output.size * DEC_RATIO) + history - 1); - - return 0; -} - -int -GrAtscConvert2xTo20::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - float *in = ((float **) ai)[0]; - float *out = ((float **) ao)[0]; - - sync (output.index); - - unsigned long si = 0; // source index - unsigned long oi = 0; // output index - double frac_part = d_frac_part; - - for (oi = 0; oi < output.size; oi++){ - assert (si + d_interp.ntaps () < inputs[0].size); - out[oi] = d_interp.interpolate (&in[si], (1. - frac_part)); - - double s = frac_part + DEC_RATIO; - double float_incr = floor (s); - frac_part = s - float_incr; - int incr = (int) float_incr; - si += incr; - } - - d_next_input += si; - d_frac_part = frac_part; - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscConvert2xTo20.h b/gr-atsc/src/lib/GrAtscConvert2xTo20.h deleted file mode 100644 index 05b1023e5..000000000 --- a/gr-atsc/src/lib/GrAtscConvert2xTo20.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCCONVERT2XTO20_H_ -#define _GRATSCCONVERT2XTO20_H_ - -#include <VrDecimatingSigProc.h> -#include <gr_mmse_fir_interpolator.h> - -class GrAtscConvert2xTo20 : public VrDecimatingSigProc<float,float> { - gr_mmse_fir_interpolator d_interp; - double d_frac_part; - VrSampleIndex d_next_input; - -public: - GrAtscConvert2xTo20 (); - ~GrAtscConvert2xTo20 (); - - virtual const char *name () { return "GrAtscConvert2xTo20"; } - - virtual int forecast (VrSampleRange output, - VrSampleRange inputs[]); - - virtual int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - - void pre_initialize (); - int checkOutputSamplingFrequency(float) { return 0; } // bogus, but required - -}; - -#endif /* _GRATSCCONVERT2XTO20_H_ */ diff --git a/gr-atsc/src/lib/GrAtscDataSegToSoftDataSeg.cc b/gr-atsc/src/lib/GrAtscDataSegToSoftDataSeg.cc deleted file mode 100644 index 09c3db4e0..000000000 --- a/gr-atsc/src/lib/GrAtscDataSegToSoftDataSeg.cc +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscDataSegToSoftDataSeg.h> - -// typedefs for fundamental i/o types - -typedef atsc_data_segment iType; -typedef atsc_soft_data_segment oType; - -static const int NUMBER_OF_OUTPUTS = 1; // # of output streams (almost always one) - - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static void -map_to_soft_symbols (atsc_soft_data_segment &out, - const atsc_data_segment &in) -{ - for (unsigned int i = 0; i < NELEM (in.data); i++){ - out.data[i] = in.data[i] * 2 - 7; - } -} - - -GrAtscDataSegToSoftDataSeg::GrAtscDataSegToSoftDataSeg () - : VrHistoryProc<iType,oType> (NUMBER_OF_OUTPUTS) -{ - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // We're one-to-one input-to-output so set it to 1. - history = 1; - - // any other init here. -} - -GrAtscDataSegToSoftDataSeg::~GrAtscDataSegToSoftDataSeg () -{ - // Anything that isn't automatically cleaned up... -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ - -int -GrAtscDataSegToSoftDataSeg::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // If we have state that persists across invocations (e.g., we have - // instance variables that we modify), we must use the sync method - // to indicate to the scheduler that our output must be computed in - // order. This doesn't keep other things from being run in - // parallel, it just means that at any given time, there is only a - // single thread working this code, and that the scheduler will - // ensure that we are asked to produce output that is contiguous and - // that will be presented to us in order of increasing time. - - // sync (output.index); - - // construct some nicer i/o pointers to work with. - - iType *in = ((iType **) ai)[0]; - oType *out = ((oType **) ao)[0]; - - - // We must produce output.size units of output. - - for (unsigned int i = 0; i < output.size; i++){ - map_to_soft_symbols (out[i], in[i]); - out[i].pli = in[i].pli; - } - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscDataSegToSoftDataSeg.h b/gr-atsc/src/lib/GrAtscDataSegToSoftDataSeg.h deleted file mode 100644 index 207324d55..000000000 --- a/gr-atsc/src/lib/GrAtscDataSegToSoftDataSeg.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCDATASEGTOSOFTDATASEG_H_ -#define _GRATSCDATASEGTOSOFTDATASEG_H_ - -#include <VrHistoryProc.h> -#include <atsc_types.h> - -/*! - * \brief Debug glue routine (atsc_data_segment --> atsc_soft_data_segment) - */ - -class GrAtscDataSegToSoftDataSeg : public VrHistoryProc<atsc_data_segment, - atsc_soft_data_segment> -{ - -public: - - GrAtscDataSegToSoftDataSeg (); - ~GrAtscDataSegToSoftDataSeg (); - - const char *name () { return "GrAtscDataSegToSoftDataSeg"; } - - int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - -protected: -}; - -#endif /* _GRATSCDATASEGTOSOFTDATASEG_H_ */ diff --git a/gr-atsc/src/lib/GrAtscDeinterleaver.cc b/gr-atsc/src/lib/GrAtscDeinterleaver.cc deleted file mode 100644 index fd67d7a20..000000000 --- a/gr-atsc/src/lib/GrAtscDeinterleaver.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscDeinterleaver.h> - -// typedefs for fundamental i/o types - -typedef atsc_mpeg_packet_rs_encoded iType; -typedef atsc_mpeg_packet_rs_encoded oType; - -static const int NUMBER_OF_OUTPUTS = 1; // # of output streams (almost always one) - - -GrAtscDeinterleaver::GrAtscDeinterleaver () - : VrHistoryProc<iType,oType> (NUMBER_OF_OUTPUTS) -{ - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // We're one-to-one input-to-output so set it to 1. - history = 1; - - // any other init here. -} - -GrAtscDeinterleaver::~GrAtscDeinterleaver () -{ - // Anything that isn't automatically cleaned up... -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ - -int -GrAtscDeinterleaver::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // If we have state that persists across invocations (e.g., we have - // instance variables that we modify), we must use the sync method - // to indicate to the scheduler that our output must be computed in - // order. This doesn't keep other things from being run in - // parallel, it just means that at any given time, there is only a - // single thread working this code, and that the scheduler will - // ensure that we are asked to produce output that is contiguous and - // that will be presented to us in order of increasing time. - - // We have state, the current contents of the LFSR in the randomizer, hence - // we must use sync. - - sync (output.index); - - // construct some nicer i/o pointers to work with. - - iType *in = ((iType **) ai)[0]; - oType *out = ((oType **) ao)[0]; - - - // We must produce output.size units of output. - - for (unsigned int i = 0; i < output.size; i++){ - // pipeline info is handled in the primitive - deinterleaver.deinterleave (out[i], in[i]); - } - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscDeinterleaver.h b/gr-atsc/src/lib/GrAtscDeinterleaver.h deleted file mode 100644 index f0f9830b6..000000000 --- a/gr-atsc/src/lib/GrAtscDeinterleaver.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCDEINTERLEAVER_H_ -#define _GRATSCDEINTERLEAVER_H_ - -#include <VrHistoryProc.h> -#include <atsc_types.h> -#include <atsci_data_interleaver.h> - -/*! - * \brief Deinterleave RS encoded ATSC data ( atsc_mpeg_packet_rs_encoded --> atsc_mpeg_packet_rs_encoded) - */ - -class GrAtscDeinterleaver : public VrHistoryProc<atsc_mpeg_packet_rs_encoded, atsc_mpeg_packet_rs_encoded> -{ - -public: - - GrAtscDeinterleaver (); - ~GrAtscDeinterleaver (); - - const char *name () { return "GrAtscDeinterleaver"; } - - int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - -protected: - atsci_data_deinterleaver deinterleaver; -}; - -#endif /* _GRATSCDEINTERLEAVER_H_ */ diff --git a/gr-atsc/src/lib/GrAtscDerandomizer.cc b/gr-atsc/src/lib/GrAtscDerandomizer.cc deleted file mode 100644 index db3583a62..000000000 --- a/gr-atsc/src/lib/GrAtscDerandomizer.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscDerandomizer.h> - -// typedefs for fundamental i/o types - -typedef atsc_mpeg_packet_no_sync iType; -typedef atsc_mpeg_packet oType; - -static const int NUMBER_OF_OUTPUTS = 1; // # of output streams (almost always one) - - -GrAtscDerandomizer::GrAtscDerandomizer () - : VrHistoryProc<iType,oType> (NUMBER_OF_OUTPUTS) -{ - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // We're one-to-one input-to-output so set it to 1. - history = 1; - - // any other init here. -} - -GrAtscDerandomizer::~GrAtscDerandomizer () -{ - // Anything that isn't automatically cleaned up... -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ - -int -GrAtscDerandomizer::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // If we have state that persists across invocations (e.g., we have - // instance variables that we modify), we must use the sync method - // to indicate to the scheduler that our output must be computed in - // order. This doesn't keep other things from being run in - // parallel, it just means that at any given time, there is only a - // single thread working this code, and that the scheduler will - // ensure that we are asked to produce output that is contiguous and - // that will be presented to us in order of increasing time. - - // We have state, the current contents of the LFSR in the randomizer, hence - // we must use sync. - - sync (output.index); - - // construct some nicer i/o pointers to work with. - - iType *in = ((iType **) ai)[0]; - oType *out = ((oType **) ao)[0]; - - - // We must produce output.size units of output. - - for (unsigned int i = 0; i < output.size; i++){ - - assert (in[i].pli.regular_seg_p ()); - - if (in[i].pli.first_regular_seg_p ()) - rand.reset (); - - rand.derandomize (out[i], in[i]); - - // take a look at the transport error bit in the pipeline info - // and set bit as required - - if (in[i].pli.transport_error_p ()) - out[i].data[1] |= MPEG_TRANSPORT_ERROR_BIT; - else - out[i].data[1] &= ~MPEG_TRANSPORT_ERROR_BIT; - - } - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscDerandomizer.h b/gr-atsc/src/lib/GrAtscDerandomizer.h deleted file mode 100644 index bd0d70d94..000000000 --- a/gr-atsc/src/lib/GrAtscDerandomizer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCDERANDOMIZER_H_ -#define _GRATSCDERANDOMIZER_H_ - -#include <VrHistoryProc.h> -#include <atsc_types.h> -#include <atsci_randomizer.h> - -/*! - * \brief Derandomize ATSC data (atsc_mpeg_packet_no_sync --> atsc_mpeg_packet) - */ - -class GrAtscDerandomizer : public VrHistoryProc<atsc_mpeg_packet_no_sync, atsc_mpeg_packet> -{ - -public: - - GrAtscDerandomizer (); - ~GrAtscDerandomizer (); - - const char *name () { return "GrAtscDerandomizer"; } - - virtual int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - -protected: - atsci_randomizer rand; -}; - -#endif /* _GRATSCDERANDOMIZER_H_ */ diff --git a/gr-atsc/src/lib/GrAtscEqualizer.cc b/gr-atsc/src/lib/GrAtscEqualizer.cc deleted file mode 100644 index 27f64c2b7..000000000 --- a/gr-atsc/src/lib/GrAtscEqualizer.cc +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscEqualizer.h> -#include <atsci_equalizer.h> - -// typedefs for fundamental i/o types - -typedef float dataType; -typedef atsc::syminfo tagType; - -static const int NUMBER_OF_OUTPUTS = 2; // # of output streams - - -GrAtscEqualizer::GrAtscEqualizer (atsci_equalizer *equalizer) - : VrHistoryProc<dataType,dataType> (NUMBER_OF_OUTPUTS) -{ - // due to limitation of runtime, all inputs must be the same size - assert (sizeof (dataType) == sizeof (tagType)); - - d_equalizer = equalizer; - - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // - // Set this to the answer returned by the equalizer primitive we were passed. - history = d_equalizer->ntaps (); -} - -GrAtscEqualizer::~GrAtscEqualizer () -{ - // Anything that isn't automatically cleaned up... - - delete d_equalizer; -} - - -/* - * non-standard forecast routine that handles getting the correct amount of - * history for the data input as well as ensuring correct alignment of - * the data and tags. - */ - -int -GrAtscEqualizer::forecast (VrSampleRange output, - VrSampleRange inputs[]) -{ - assert (numberInputs == 2); - - int ntaps = d_equalizer->ntaps (); - int npretaps = d_equalizer->npretaps (); - - assert (ntaps >= 1); - assert (npretaps >= 0 && npretaps < ntaps); - - inputs[0].index = output.index; // the equalizer data - inputs[0].size = output.size + ntaps - 1; // history on data - - // FIXME if there's a problem, it's probably on the next line... - int offset = ntaps - npretaps - 1; - - assert (offset >= 0 && offset < ntaps); - - inputs[1].index = output.index + offset; // align equalizer tags - inputs[1].size = output.size; // N.B., no extra history on tags - - return 0; -} - -/* - * This is the real work horse. We consume 2 input streams - * and produce 2 output streams. - */ - -int -GrAtscEqualizer::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // assert (numberInputs == 2); - - // If we have state that persists across invocations (e.g., we have - // instance variables that we modify), we must use the sync method - // to indicate to the scheduler that our output must be computed in - // order. This doesn't keep other things from being run in - // parallel, it just means that at any given time, there is only a - // single thread working this code, and that the scheduler will - // ensure that we are asked to produce output that is contiguous and - // that will be presented to us in order of increasing time. - - // We have state, hence we must use sync. - - sync (output.index); - - // construct some nicer i/o pointers to work with. - - dataType *input_samples = ((dataType **) ai)[0]; - tagType *input_tags = ((tagType **) ai)[1]; - dataType *output_samples = ((dataType **) ao)[0]; - tagType *output_tags = ((tagType **) ao)[1]; - - - // peform the actual equalization - - d_equalizer->filter (input_samples, input_tags, - output_samples, output.size); - - // write the output tags - - for (unsigned int i = 0; i < output.size; i++) - output_tags[i] = input_tags[i]; - - // Return the number of units we produced. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscEqualizer.h b/gr-atsc/src/lib/GrAtscEqualizer.h deleted file mode 100644 index ff944deb7..000000000 --- a/gr-atsc/src/lib/GrAtscEqualizer.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCEQUALIZER_H_ -#define _GRATSCEQUALIZER_H_ - -#include <VrHistoryProc.h> - -class atsci_equalizer; - -/*! - * \brief ATSC equalizer (float,syminfo --> float,syminfo) - * - * first inputs are data samples, second inputs are tags. - * first outputs are equalized data samples, second outputs are tags. - * - * tag values are defined in atsci_syminfo.h - */ - -class GrAtscEqualizer : public VrHistoryProc<float,float> -{ - -public: - - GrAtscEqualizer (atsci_equalizer *equalizer); - ~GrAtscEqualizer (); - - const char *name () { return "GrAtscEqualizer"; } - - int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - - // we've got a non-standard forecast routine - int forecast (VrSampleRange output, VrSampleRange inputs[]); - -protected: - atsci_equalizer *d_equalizer; -}; - -#endif /* _GRATSCEQUALIZER_H_ */ diff --git a/gr-atsc/src/lib/GrAtscFPLL.cc b/gr-atsc/src/lib/GrAtscFPLL.cc deleted file mode 100644 index df7d6b8c0..000000000 --- a/gr-atsc/src/lib/GrAtscFPLL.cc +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscFPLL.h> -#include <algorithm> -#include "fpll_btloop_coupling.h" - -/* - * I strongly suggest that you not mess with these... - * - * They are strongly coupled into the symbol timing code and - * their value also sets the level of the symbols going - * into the equalizer and viterbi decoder. - */ -static const float FPLL_AGC_REFERENCE = 2.5 * FPLL_BTLOOP_COUPLING_CONST; -static const float FPLL_AGC_RATE = 0.25e-6; - - -GrAtscFPLL::GrAtscFPLL (double a_initial_freq) - : VrSigProc (1, sizeof (iType), sizeof (oType)), - initial_phase(0), debug_no_update(false) -{ - initial_freq = a_initial_freq; - agc.set_rate (FPLL_AGC_RATE); - agc.set_reference (FPLL_AGC_REFERENCE); - - if (_FPLL_DIAG_OUTPUT_){ - fp = fopen ("fpll.out", "w"); - if (fp == 0){ - perror ("fpll.out"); - exit (1); - } - } - -} - -void -GrAtscFPLL::initialize () -{ - float Fs = getInputSamplingFrequencyN (0); - - float alpha = 1 - exp(-1.0 / Fs / 5e-6); - - afci.set_taps (alpha); - afcq.set_taps (alpha); - - nco.set_freq (initial_freq / Fs * 2 * M_PI); - nco.set_phase (initial_phase); -} - -int -GrAtscFPLL::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - iType *in = ((iType **)ai)[0]; - oType *out = ((oType **)ao)[0]; - - unsigned int k; - - for (k = 0; k < output.size; k++){ - - float a_cos, a_sin; - - float input = agc.scale (in[k]); - - nco.step (); // increment phase - nco.sincos (a_sin, a_cos); // compute cos and sin - - float I = input * a_sin; - float Q = input * a_cos; - - out[k] = I; - - float filtered_I = afci.filter (I); - float filtered_Q = afcq.filter (Q); - - // phase detector - - float x = atan2 (filtered_Q, filtered_I); - - // avoid slamming filter with big transitions - - static const float limit = M_PI / 2; - - if (x > limit) - x = limit; - else if (x < -limit) - x = -limit; - - // static const float alpha = 0.037; // Max value - // static const float alpha = 0.005; // takes about 5k samples to pull in, stddev = 323 - // static const float alpha = 0.002; // takes about 15k samples to pull in, stddev = 69 - // or about 120k samples on noisy data, - static const float alpha = 0.001; - static const float beta = alpha * alpha / 4; - - - if (!debug_no_update){ - nco.adjust_phase (alpha * x); - nco.adjust_freq (beta * x); - } - - if (_FPLL_DIAG_OUTPUT_){ -#if 0 // lots of data... - float iodata[8]; - iodata[0] = nco.get_freq () * getSamplingFrequency () * (1.0 / (2 * M_PI)); - iodata[1] = in[k]; - iodata[2] = input; - iodata[3] = I; - iodata[4] = Q; - iodata[5] = filtered_I; - iodata[6] = filtered_Q; - iodata[7] = x; - if (fwrite (iodata, sizeof (iodata), 1, fp) != 1){ - perror ("fwrite: fpll"); - exit (1); - } -#else // just the frequency - float iodata[1]; - iodata[0] = nco.get_freq () * getSamplingFrequency () * (1.0 / (2 * M_PI)); - if (fwrite (iodata, sizeof (iodata), 1, fp) != 1){ - perror ("fwrite: fpll"); - exit (1); - } -#endif - } - } - - return output.size; -} - diff --git a/gr-atsc/src/lib/GrAtscFPLL.h b/gr-atsc/src/lib/GrAtscFPLL.h deleted file mode 100644 index 597a4a891..000000000 --- a/gr-atsc/src/lib/GrAtscFPLL.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCFPLL_H_ -#define _GRATSCFPLL_H_ - -#include <gr_nco.h> -#include <gr_iir.h> -#include <gr_single_pole_iir.h> -#include <gr_agc.h> -#include <VrSigProc.h> -#include <stdio.h> -#include <atsci_diag_output.h> - -/*! - * \brief ATSC FPLL (2nd Version) - * - * Used as follows: - * float float - * A/D --> GrFIRfilterFFF ----> GrAtscFPLL ----> - * - * We use GrFIRfilterFFF to bandpass filter the signal of interest. - * - * This class accepts a single real input and produces a single real output - */ - -class GrAtscFPLL : public VrSigProc { - protected: - - typedef float iType; - typedef float oType; - - public: - - GrAtscFPLL (double a_initial_freq); - virtual ~GrAtscFPLL () {} - - virtual const char *name () { return "GrAtscFPLL"; } - - virtual void initialize (); - - virtual int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - - - // diagnostic routines - void set_initial_phase (double phase) { initial_phase = phase; } // radians - void set_no_update (bool a_no_update) { debug_no_update = a_no_update; } - - - protected: - - double initial_freq; - double initial_phase; - bool debug_no_update; - gr_nco<float,float> nco; - gr_agc agc; // automatic gain control - gr_single_pole_iir<float,float,float> afci; - gr_single_pole_iir<float,float,float> afcq; - -#ifdef _FPLL_DIAG_OUTPUT_ - FILE *fp; -#endif - -}; - - -#endif // _GRATSCFPLL_H_ diff --git a/gr-atsc/src/lib/GrAtscFieldSyncChecker.cc b/gr-atsc/src/lib/GrAtscFieldSyncChecker.cc deleted file mode 100644 index d2c82d6d4..000000000 --- a/gr-atsc/src/lib/GrAtscFieldSyncChecker.cc +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscFieldSyncChecker.h> -#include <create_atsci_fs_checker.h> -#include <atsci_fs_checker.h> - -// typedefs for fundamental i/o types - -typedef float iDataType; -typedef atsc::syminfo iTagType; -typedef float oDataType; -typedef atsc::syminfo oTagType; - -static const int NUMBER_OF_OUTPUTS = 2; // # of output streams - - -GrAtscFieldSyncChecker::GrAtscFieldSyncChecker () - : VrHistoryProc<iDataType,oDataType> (NUMBER_OF_OUTPUTS) -{ - // tags and data must be same size due to limitation of runtime - assert (sizeof (iDataType) == sizeof (iTagType)); - assert (sizeof (oDataType) == sizeof (oTagType)); - - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // We're one-to-one input-to-output so set it to 1. - history = 1; - - d_fsc = create_atsci_fs_checker (); -} - -GrAtscFieldSyncChecker::~GrAtscFieldSyncChecker () -{ - // Anything that isn't automatically cleaned up... - - delete d_fsc; -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ - -int -GrAtscFieldSyncChecker::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // If we have state that persists across invocations (e.g., we have - // instance variables that we modify), we must use the sync method - // to indicate to the scheduler that our output must be computed in - // order. This doesn't keep other things from being run in - // parallel, it just means that at any given time, there is only a - // single thread working this code, and that the scheduler will - // ensure that we are asked to produce output that is contiguous and - // that will be presented to us in order of increasing time. - - // We have state, hence we must use sync. - - sync (output.index); - - // construct some nicer i/o pointers to work with. - - iDataType *sample_in = ((iDataType **) ai)[0]; - iTagType *tag_in = ((iTagType **) ai)[1]; - oDataType *sample_out = ((oDataType **) ao)[0]; - oTagType *tag_out = ((oTagType **) ao)[1]; - - // We must produce output.size units of output. - - for (unsigned int i = 0; i < output.size; i++){ - d_fsc->filter (sample_in[i], tag_in[i], &sample_out[i], &tag_out[i]); - } - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscFieldSyncChecker.h b/gr-atsc/src/lib/GrAtscFieldSyncChecker.h deleted file mode 100644 index 28458a19b..000000000 --- a/gr-atsc/src/lib/GrAtscFieldSyncChecker.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCFIELDSYNCCHECKER_H_ -#define _GRATSCFIELDSYNCCHECKER_H_ - -#include <VrHistoryProc.h> - -class atsci_fs_checker; - -/*! - * \brief ATSC field sync checker (float,syminfo --> float,syminfo) - * - * first output is delayed version of input. - * second output is set of tags, one-for-one with first output. - */ - -class GrAtscFieldSyncChecker : public VrHistoryProc<float,float> -{ - -public: - - GrAtscFieldSyncChecker (); - ~GrAtscFieldSyncChecker (); - - const char *name () { return "GrAtscFieldSyncChecker"; } - - int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - -protected: - atsci_fs_checker *d_fsc; -}; - -#endif /* _GRATSCFIELDSYNCCHECKER_H_ */ diff --git a/gr-atsc/src/lib/GrAtscFieldSyncCorrelator.cc b/gr-atsc/src/lib/GrAtscFieldSyncCorrelator.cc deleted file mode 100644 index 42f93aa8c..000000000 --- a/gr-atsc/src/lib/GrAtscFieldSyncCorrelator.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscFieldSyncCorrelator.h> -#include <create_atsci_fs_correlator.h> -#include <atsci_fs_correlator.h> - -// typedefs for fundamental i/o types - -typedef float iType; -typedef float oType; - -static const int NUMBER_OF_OUTPUTS = 2; // # of output streams - - -GrAtscFieldSyncCorrelator::GrAtscFieldSyncCorrelator () - : VrHistoryProc<iType,oType> (NUMBER_OF_OUTPUTS) -{ - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // We're one-to-one input-to-output so set it to 1. - history = 1; - - d_fsc = create_atsci_fs_correlator (); -} - -GrAtscFieldSyncCorrelator::~GrAtscFieldSyncCorrelator () -{ - // Anything that isn't automatically cleaned up... - - delete d_fsc; -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ - -int -GrAtscFieldSyncCorrelator::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // If we have state that persists across invocations (e.g., we have - // instance variables that we modify), we must use the sync method - // to indicate to the scheduler that our output must be computed in - // order. This doesn't keep other things from being run in - // parallel, it just means that at any given time, there is only a - // single thread working this code, and that the scheduler will - // ensure that we are asked to produce output that is contiguous and - // that will be presented to us in order of increasing time. - - // We have state, hence we must use sync. - - sync (output.index); - - // construct some nicer i/o pointers to work with. - - iType *in = ((iType **) ai)[0]; - oType *sample_out = ((oType **) ao)[0]; - oType *tag_out = ((oType **) ao)[1]; - - - // We must produce output.size units of output. - - for (unsigned int i = 0; i < output.size; i++){ - d_fsc->filter (in[i], &sample_out[i], &tag_out[i]); - } - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscFieldSyncCorrelator.h b/gr-atsc/src/lib/GrAtscFieldSyncCorrelator.h deleted file mode 100644 index 1a16048b2..000000000 --- a/gr-atsc/src/lib/GrAtscFieldSyncCorrelator.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCFIELDSYNCCORRELATOR_H_ -#define _GRATSCFIELDSYNCCORRELATOR_H_ - -#include <VrHistoryProc.h> - -class atsci_fs_correlator; - -/*! - * \brief ATSC field sync correlator (float --> float,float) - * - * first output is delayed version of input. - * second output is set of tags, one-for-one with first output. - * - * tag values are defined in atsci_sync_tag.h - */ - -class GrAtscFieldSyncCorrelator : public VrHistoryProc<float,float> -{ - -public: - - GrAtscFieldSyncCorrelator (); - ~GrAtscFieldSyncCorrelator (); - - const char *name () { return "GrAtscFieldSyncCorrelator"; } - - int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - -protected: - atsci_fs_correlator *d_fsc; -}; - -#endif /* _GRATSCFIELDSYNCCORRELATOR_H_ */ diff --git a/gr-atsc/src/lib/GrAtscFieldSyncDemux.cc b/gr-atsc/src/lib/GrAtscFieldSyncDemux.cc deleted file mode 100644 index e311acc8a..000000000 --- a/gr-atsc/src/lib/GrAtscFieldSyncDemux.cc +++ /dev/null @@ -1,173 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cmath> -#include <GrAtscFieldSyncDemux.h> -#include <atsc_consts.h> -#include <atsc_types.h> -#include <atsci_syminfo.h> -#include <stdio.h> -#include <assert.h> - -using std::abs; - -static const int DEC = ATSC_DATA_SEGMENT_LENGTH; // nominal decimation factor - -GrAtscFieldSyncDemux::GrAtscFieldSyncDemux () - : VrDecimatingSigProc<float,atsc_soft_data_segment> (1, DEC), - d_locked (false), d_in_field2(true), d_segment_number(0), d_next_input(0), - d_lost_index (0) -{ - history = 2 * ATSC_DATA_SEGMENT_LENGTH; // spare input samples in case we need them. -} - -GrAtscFieldSyncDemux::~GrAtscFieldSyncDemux () -{ -} - -int -GrAtscFieldSyncDemux::forecast (VrSampleRange output, - VrSampleRange inputs[]) { - /* dec:1 ratio with history */ - - assert (numberInputs == 2); - - for (unsigned int i = 0; i < numberInputs; i++) { - inputs[i].index = d_next_input; - inputs[i].size = output.size * decimation + history - 1; - } - return 0; -} - -inline static bool -tag_is_seg_sync_or_field_sync (atsc::syminfo tag) -{ - return tag.symbol_num == 0 && tag.valid; -} - -int -GrAtscFieldSyncDemux::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - float *input_samples = (float *) ai[0]; - atsc::syminfo *input_tags = (atsc::syminfo *) ai[1]; - atsc_soft_data_segment *out = ((atsc_soft_data_segment **)ao)[0]; - - sync (output.index); - - unsigned int ii = 0; // input index - - // Are we in sync? - if (!tag_is_seg_sync_or_field_sync (input_tags[0])){ // No ... - - if (d_locked){ - d_locked = false; - d_lost_index = inputs[0].index + ii; - cerr << "GrAtscFieldSyncDemux: lost sync at " - << d_lost_index << endl; - } - - // ... search for beginning of a field sync - - // cerr << "GrAtscFieldSyncDemux: searching for sync at " - // << inputs[0].index + ii << endl; - - for (ii = 1; ii < inputs[0].size; ii++){ - if (atsc::tag_is_start_field_sync (input_tags[ii])){ - // found one - d_locked = true; - - const char *str; - if (atsc::tag_is_start_field_sync_1 (input_tags[ii])) - str = "FIELD-1"; - else if (atsc::tag_is_start_field_sync_2 (input_tags[ii])) - str = "FIELD-2"; - else - str = "SEGMENT"; - - cerr << "GrAtscFieldSyncDemux: synced (" << str << ") at " - << inputs[0].index + ii - << " [delta = " << inputs[0].index + ii - d_lost_index - << "]\n"; - - d_next_input += ii; // update for forecast - return 0; // no work completed so far - } - } - // no non-NORMAL tag found - d_next_input += ii; // update for forecast - return 0; // no work completed so far - } - - // We are in sync. Produce output... - - unsigned int k = 0; // output index - - while (k < output.size){ - - if (inputs[0].size - ii < (unsigned) ATSC_DATA_SEGMENT_LENGTH){ - // We're out of input data. - cerr << "GrAtscFieldSyncDemux: ran out of input data\n"; - d_next_input += ii; // update for forecast - return k; // return amount of work completed so far - } - - if (!tag_is_seg_sync_or_field_sync (input_tags[ii])){ - // lost sync... - // cerr << "GrAtscFieldSyncDemux: lost sync at " - // << inputs[0].index + ii << endl; - - d_next_input += ii; // update for forecast - return k; // return amount of work completed so far - } - - if (atsc::tag_is_start_field_sync_1 (input_tags[ii])){ - d_in_field2 = false; - d_segment_number = 0; - ii += ATSC_DATA_SEGMENT_LENGTH; // skip over field sync - continue; - } - - if (atsc::tag_is_start_field_sync_2 (input_tags[ii])){ - d_in_field2 = true; - d_segment_number = 0; - ii += ATSC_DATA_SEGMENT_LENGTH; // skip over field sync - continue; - } - - if (d_segment_number >= ATSC_DSEGS_PER_FIELD){ - // something's wrong... - cerr << "GrAtscFieldSyncDemux: segment number overflow\n"; - d_segment_number = 0; - } - - out[k].pli.set_regular_seg (d_in_field2, d_segment_number++); - for (int jj = 0; jj < ATSC_DATA_SEGMENT_LENGTH; jj++) - out[k].data[jj] = input_samples[ii + jj]; - ii += ATSC_DATA_SEGMENT_LENGTH; - k++; - } - - d_next_input += ii; // update for forecast - return k; // return amount of work completed -} - diff --git a/gr-atsc/src/lib/GrAtscFieldSyncDemux.h b/gr-atsc/src/lib/GrAtscFieldSyncDemux.h deleted file mode 100644 index f5bab9b87..000000000 --- a/gr-atsc/src/lib/GrAtscFieldSyncDemux.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCFIELDSYNCDEMUX_H_ -#define _GRATSCFIELDSYNCDEMUX_H_ - -#include <VrDecimatingSigProc.h> -#include <atsc_types.h> - -/*! - * \brief ATSC Field Sync Demux - * - * This class accepts 1 stream of floats (data), and 1 stream of tags (syminfo). - * It outputs one stream of atsc_soft_data_segment packets - */ - -class GrAtscFieldSyncDemux : public VrDecimatingSigProc<float,atsc_soft_data_segment> { - - public: - - GrAtscFieldSyncDemux (); - virtual ~GrAtscFieldSyncDemux (); - - virtual const char *name () { return "GrAtscFieldSyncDemux"; } - - virtual int forecast (VrSampleRange output, - VrSampleRange inputs[]); - - virtual int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - - protected: - - bool d_locked; - bool d_in_field2; - int d_segment_number; - VrSampleIndex d_next_input; - VrSampleIndex d_lost_index; // diagnostic fluff -}; - -#endif // _GRATSCFIELDSYNCDEMUX_H_ diff --git a/gr-atsc/src/lib/GrAtscFieldSyncMux.cc b/gr-atsc/src/lib/GrAtscFieldSyncMux.cc deleted file mode 100644 index 7ebab72ad..000000000 --- a/gr-atsc/src/lib/GrAtscFieldSyncMux.cc +++ /dev/null @@ -1,246 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscFieldSyncMux.h> -#include <atsci_pnXXX.h> - - -// typedefs for fundamental i/o types - -typedef atsc_data_segment iType; -typedef atsc_data_segment oType; - -static const int NUMBER_OF_OUTPUTS = 1; // # of output streams (almost always one) - -static const int N_SAVED_SYMBOLS = GrAtscFieldSyncMux::N_SAVED_SYMBOLS; - -static void -init_field_sync_common (unsigned char *p, int mask, - const unsigned char saved_symbols[N_SAVED_SYMBOLS]) -{ - static const unsigned char bin_map[2] = { 1, 6 }; // map binary values to 1 of 8 levels - - int i = 0; - - p[i++] = bin_map[1]; // data segment sync pulse - p[i++] = bin_map[0]; - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - - for (int j = 0; j < 511; j++) // PN511 - p[i++] = bin_map[atsc_pn511[j]]; - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map[atsc_pn63[j]]; - - for (int j = 0; j < 63; j++) // PN63, toggled on field 2 - p[i++] = bin_map[atsc_pn63[j] ^ mask]; - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map[atsc_pn63[j]]; - - p[i++] = bin_map[0]; // 24 bits of VSB8 mode identifiera - p[i++] = bin_map[0]; - p[i++] = bin_map[0]; - p[i++] = bin_map[0]; - - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - - p[i++] = bin_map[1]; - p[i++] = bin_map[1]; - p[i++] = bin_map[1]; - p[i++] = bin_map[1]; - - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - - - for (int j = 0; j < 92; j++) // 92 more bits - p[i++] = bin_map[atsc_pn63[j % 63]]; - - // now copy the last 12 symbols of the previous segment - - for (int j = 0; j < N_SAVED_SYMBOLS; j++) - p[i++] = saved_symbols[j]; - - assert (i == ATSC_DATA_SEGMENT_LENGTH); -} - -inline static void -init_field_sync_1 (atsc_data_segment *s, - const unsigned char saved_symbols[N_SAVED_SYMBOLS]) -{ - init_field_sync_common (&s->data[0], 0, saved_symbols); -} - -inline static void -init_field_sync_2 (atsc_data_segment *s, - const unsigned char saved_symbols[N_SAVED_SYMBOLS]) - -{ - init_field_sync_common (&s->data[0], 1, saved_symbols); -} - -static void -save_last_symbols (unsigned char saved_symbols[N_SAVED_SYMBOLS], - const atsc_data_segment &seg) -{ - for (int i = 0; i < N_SAVED_SYMBOLS; i++) - saved_symbols[i] = seg.data[i + ATSC_DATA_SEGMENT_LENGTH - N_SAVED_SYMBOLS]; -} - - -inline static bool -last_regular_seg_p (const plinfo &pli) -{ - return pli.regular_seg_p () && (pli.segno () == ATSC_DSEGS_PER_FIELD - 1); -} - - -GrAtscFieldSyncMux::GrAtscFieldSyncMux () - : VrHistoryProc<iType,oType> (NUMBER_OF_OUTPUTS), - d_current_index (0), d_already_output_field_sync (false) -{ - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - history = 1; - - // any other init here. -} - -GrAtscFieldSyncMux::~GrAtscFieldSyncMux () -{ - // Anything that isn't automatically cleaned up... -} - -void -GrAtscFieldSyncMux::pre_initialize () -{ - // we jack our output sampling frequency up to account for inserted field syncs - setSamplingFrequency (getInputSamplingFrequencyN (0) * 313./312.); -} - -/* - * we need a non-standard version of forecast because our output isn't - * exactly 1:1 with our input. - */ - -int -GrAtscFieldSyncMux::forecast (VrSampleRange output, VrSampleRange inputs[]) -{ - for(unsigned int i = 0; i < numberInputs; i++) { - inputs[i].index = d_current_index; - inputs[i].size = output.size; - } - return 0; -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ -int -GrAtscFieldSyncMux::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // If we have state that persists across invocations (e.g., we have - // instance variables that we modify), we must use the sync method - // to indicate to the scheduler that our output must be computed in - // order. This doesn't keep other things from being run in - // parallel, it just means that at any given time, there is only a - // single thread working this code, and that the scheduler will - // ensure that we are asked to produce output that is contiguous and - // that will be presented to us in order of increasing time. - - // We have state, hence we must use sync. - - sync (output.index); - - // construct some nicer i/o pointers to work with. - - iType *in = ((iType **) ai)[0]; - oType *out = ((oType **) ao)[0]; - - - // We must produce output.size units of output. - - unsigned int index = 0; - for (unsigned int outdex = 0; outdex < output.size; outdex++){ - - assert (in[index].pli.regular_seg_p ()); - - if (!in[index].pli.first_regular_seg_p ()){ - out[outdex] = in[index]; // just copy in to out - - if (last_regular_seg_p (in[index].pli)) - save_last_symbols (d_saved_symbols, in[index]); - - index++; - } - else { // first_regular_seg_p - if (!d_already_output_field_sync){ - // write out field sync... - atsc_data_segment field_sync; - - if (in[index].pli.in_field1_p ()) - init_field_sync_1 (&field_sync, d_saved_symbols); - else - init_field_sync_2 (&field_sync, d_saved_symbols); - - // note that index doesn't advance in this branch - out[outdex] = field_sync; - d_already_output_field_sync = true; - } - else { - // already output field sync, now output first regular segment - out[outdex] = in[index]; - index++; - d_already_output_field_sync = false; - } - } - } - - d_current_index += index; - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscFieldSyncMux.h b/gr-atsc/src/lib/GrAtscFieldSyncMux.h deleted file mode 100644 index ae52b8e5c..000000000 --- a/gr-atsc/src/lib/GrAtscFieldSyncMux.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCFIELDSYNCMUX_H_ -#define _GRATSCFIELDSYNCMUX_H_ - -#include <VrHistoryProc.h> -#include <atsc_types.h> - -/*! - * \brief Insert ATSC Field Syncs as required (atsc_data_segment --> atsc_data_segment) - */ - -class GrAtscFieldSyncMux : public VrHistoryProc<atsc_data_segment, atsc_data_segment> -{ - -public: - - GrAtscFieldSyncMux (); - ~GrAtscFieldSyncMux (); - - const char *name () { return "GrAtscFieldSyncMux"; } - - int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - - int forecast (VrSampleRange output, VrSampleRange inputs[]); - - void pre_initialize (); - - static const int N_SAVED_SYMBOLS = 12; - -protected: - VrSampleIndex d_current_index; - bool d_already_output_field_sync; - unsigned char d_saved_symbols[N_SAVED_SYMBOLS]; -}; - -#endif /* _GRATSCFIELDSYNCMUX_H_ */ diff --git a/gr-atsc/src/lib/GrAtscInterleaver.cc b/gr-atsc/src/lib/GrAtscInterleaver.cc deleted file mode 100644 index 2c8f0c7e8..000000000 --- a/gr-atsc/src/lib/GrAtscInterleaver.cc +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscInterleaver.h> - -// typedefs for fundamental i/o types - -typedef atsc_mpeg_packet_rs_encoded iType; -typedef atsc_mpeg_packet_rs_encoded oType; - -static const int NUMBER_OF_OUTPUTS = 1; // # of output streams (almost always one) - - -GrAtscInterleaver::GrAtscInterleaver () - : VrHistoryProc<iType,oType> (NUMBER_OF_OUTPUTS) -{ - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // We're one-to-one input-to-output so set it to 1. - history = 1; - - // any other init here. -} - -GrAtscInterleaver::~GrAtscInterleaver () -{ - // Anything that isn't automatically cleaned up... -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ - -int -GrAtscInterleaver::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // If we have state that persists across invocations (e.g., we have - // instance variables that we modify), we must use the sync method - // to indicate to the scheduler that our output must be computed in - // order. This doesn't keep other things from being run in - // parallel, it just means that at any given time, there is only a - // single thread working this code, and that the scheduler will - // ensure that we are asked to produce output that is contiguous and - // that will be presented to us in order of increasing time. - - // We have state, the current contents of the FIFOs, hence - // we must use sync. - - sync (output.index); - - // construct some nicer i/o pointers to work with. - - iType *in = ((iType **) ai)[0]; - oType *out = ((oType **) ao)[0]; - - -#if 0 - cerr << "@@@ GrAtscInterleaver: output.index = " << output.index - << " output.size = " << output.size - << " sum = " << output.index + output.size - << " \t[out = " << out << "]" - << endl; -#endif - - // We must produce output.size units of output. - - for (unsigned int i = 0; i < output.size; i++){ - // pipeline info is handled in the primitive - interleaver.interleave (out[i], in[i]); - } - - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscInterleaver.h b/gr-atsc/src/lib/GrAtscInterleaver.h deleted file mode 100644 index 76be38a21..000000000 --- a/gr-atsc/src/lib/GrAtscInterleaver.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCINTERLEAVER_H_ -#define _GRATSCINTERLEAVER_H_ - -#include <VrHistoryProc.h> -#include <atsc_types.h> -#include <atsci_data_interleaver.h> - -/*! - * \brief Interleave RS encoded ATSC data ( atsc_mpeg_packet_rs_encoded --> atsc_mpeg_packet_rs_encoded) - */ - -class GrAtscInterleaver : public VrHistoryProc<atsc_mpeg_packet_rs_encoded, atsc_mpeg_packet_rs_encoded> -{ - -public: - - GrAtscInterleaver (); - ~GrAtscInterleaver (); - - const char *name () { return "GrAtscInterleaver"; } - - int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - -protected: - atsci_data_interleaver interleaver; -}; - -#endif /* _GRATSCINTERLEAVER_H_ */ diff --git a/gr-atsc/src/lib/GrAtscRSDecoder.cc b/gr-atsc/src/lib/GrAtscRSDecoder.cc deleted file mode 100644 index fd0122ad2..000000000 --- a/gr-atsc/src/lib/GrAtscRSDecoder.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscRSDecoder.h> - -// typedefs for fundamental i/o types - -typedef atsc_mpeg_packet_rs_encoded iType; -typedef atsc_mpeg_packet_no_sync oType; - -static const int NUMBER_OF_OUTPUTS = 1; // # of output streams (almost always one) - - -GrAtscRSDecoder::GrAtscRSDecoder () - : VrHistoryProc<iType,oType> (NUMBER_OF_OUTPUTS) -{ - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // We're one-to-one input-to-output so set it to 1. - history = 1; - - // any other init here. -} - -GrAtscRSDecoder::~GrAtscRSDecoder () -{ - // Anything that isn't automatically cleaned up... -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ - -int -GrAtscRSDecoder::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // construct some nicer i/o pointers to work with. - - iType *in = ((iType **) ai)[0]; - oType *out = ((oType **) ao)[0]; - - - // We must produce output.size units of output. - - for (unsigned int i = 0; i < output.size; i++){ - assert (in[i].pli.regular_seg_p ()); - out[i].pli = in[i].pli; // copy pipeline info - - int nerrors_not_corrected = rs_decoder.decode (out[i], in[i]); - out[i].pli.set_transport_error (nerrors_not_corrected == -1); - } - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscRSDecoder.h b/gr-atsc/src/lib/GrAtscRSDecoder.h deleted file mode 100644 index d64102d10..000000000 --- a/gr-atsc/src/lib/GrAtscRSDecoder.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCRSDECODER_H_ -#define _GRATSCRSDECODER_H_ - -#include <VrHistoryProc.h> -#include <atsc_types.h> -#include <atsci_reed_solomon.h> - -/*! - * \brief Pass ATSC data Reed-Solomon decoder( atsc_mpeg_packet_rs_encoded --> atsc_mpeg_rs_no_sync) - */ - -class GrAtscRSDecoder : public VrHistoryProc<atsc_mpeg_packet_rs_encoded, atsc_mpeg_packet_no_sync> -{ - -public: - - GrAtscRSDecoder (); - ~GrAtscRSDecoder (); - - const char *name () { return "GrAtscRSDecoder"; } - - virtual int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - -protected: - atsci_reed_solomon rs_decoder; -}; - -#endif /* _GRATSCRSDECODER_H_ */ diff --git a/gr-atsc/src/lib/GrAtscRSEncoder.cc b/gr-atsc/src/lib/GrAtscRSEncoder.cc deleted file mode 100644 index 249678427..000000000 --- a/gr-atsc/src/lib/GrAtscRSEncoder.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscRSEncoder.h> - -// typedefs for fundamental i/o types - -typedef atsc_mpeg_packet_no_sync iType; -typedef atsc_mpeg_packet_rs_encoded oType; - -static const int NUMBER_OF_OUTPUTS = 1; // # of output streams (almost always one) - - -GrAtscRSEncoder::GrAtscRSEncoder () - : VrHistoryProc<iType,oType> (NUMBER_OF_OUTPUTS) -{ - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // We're one-to-one input-to-output so set it to 1. - history = 1; - - // any other init here. -} - -GrAtscRSEncoder::~GrAtscRSEncoder () -{ - // Anything that isn't automatically cleaned up... -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ - -int -GrAtscRSEncoder::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // construct some nicer i/o pointers to work with. - - iType *in = ((iType **) ai)[0]; - oType *out = ((oType **) ao)[0]; - - - // We must produce output.size units of output. - - for (unsigned int i = 0; i < output.size; i++){ - - // ensure that on the way in, the error bit is clear - // [assertion is not valid, because the randomizer has already scrambled the bits] - // assert ((in[i].data[0] & MPEG_TRANSPORT_ERROR_BIT) == 0); - - assert (in[i].pli.regular_seg_p ()); - out[i].pli = in[i].pli; // copy pipeline info... - rs_encoder.encode (out[i], in[i]); - } - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscRSEncoder.h b/gr-atsc/src/lib/GrAtscRSEncoder.h deleted file mode 100644 index 29921d8b3..000000000 --- a/gr-atsc/src/lib/GrAtscRSEncoder.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCRSENCODER_H_ -#define _GRATSCRSENCODER_H_ - -#include <VrHistoryProc.h> -#include <atsc_types.h> -#include <atsci_reed_solomon.h> - -/*! - * \brief Encode using Reed Solomon ATSC data (atsc_mpeg_packet_no_sync --> atsc_mpeg_packet_rs_encoded) - */ - -class GrAtscRSEncoder : public VrHistoryProc<atsc_mpeg_packet_no_sync, atsc_mpeg_packet_rs_encoded> -{ - -public: - - GrAtscRSEncoder (); - ~GrAtscRSEncoder (); - - const char *name () { return "GrAtscRSEncoder"; } - - int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - -protected: - atsci_reed_solomon rs_encoder; -}; - -#endif /* _GRATSCRSENCODER_H_ */ diff --git a/gr-atsc/src/lib/GrAtscRandomizer.cc b/gr-atsc/src/lib/GrAtscRandomizer.cc deleted file mode 100644 index c5172699c..000000000 --- a/gr-atsc/src/lib/GrAtscRandomizer.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscRandomizer.h> - -// typedefs for fundamental i/o types - -typedef atsc_mpeg_packet iType; -typedef atsc_mpeg_packet_no_sync oType; - -static const int NUMBER_OF_OUTPUTS = 1; // # of output streams (almost always one) - - -GrAtscRandomizer::GrAtscRandomizer () - : VrHistoryProc<iType,oType> (NUMBER_OF_OUTPUTS), - field2 (false), segno (0) -{ - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // We're one-to-one input-to-output so set it to 1. - history = 1; - - // any other init here. -} - -GrAtscRandomizer::~GrAtscRandomizer () -{ - // Anything that isn't automatically cleaned up... -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ - -int -GrAtscRandomizer::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // If we have state that persists across invocations (e.g., we have - // instance variables that we modify), we must use the sync method - // to indicate to the scheduler that our output must be computed in - // order. This doesn't keep other things from being run in - // parallel, it just means that at any given time, there is only a - // single thread working this code, and that the scheduler will - // ensure that we are asked to produce output that is contiguous and - // that will be presented to us in order of increasing time. - - // We have state, the current contents of the LFSR in the randomizer, hence - // we must use sync. - - sync (output.index); - - // construct some nicer i/o pointers to work with. - - iType *in = ((iType **) ai)[0]; - oType *out = ((oType **) ao)[0]; - - - // We must produce output.size units of output. - - for (unsigned int i = 0; i < output.size; i++){ - - // initialize plinfo for downstream - // - // We do this here because the randomizer is effectively - // the head of the tx processing chain - // - out[i].pli.set_regular_seg (field2, segno); - segno++; - if (segno == 312){ - segno = 0; - field2 = !field2; - } - - assert ((in[i].data[1] & MPEG_TRANSPORT_ERROR_BIT) == 0); - - if (out[i].pli.first_regular_seg_p ()) - rand.reset (); - - rand.randomize (out[i], in[i]); - } - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscRandomizer.h b/gr-atsc/src/lib/GrAtscRandomizer.h deleted file mode 100644 index f56f7178e..000000000 --- a/gr-atsc/src/lib/GrAtscRandomizer.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCRANDOMIZER_H_ -#define _GRATSCRANDOMIZER_H_ - -#include <VrHistoryProc.h> -#include <atsc_types.h> -#include <atsci_randomizer.h> - -/*! - * \brief Randomize ATSC data (atsc_mpeg_packet --> atsc_mpeg_packet_no_sync) - */ - -class GrAtscRandomizer : public VrHistoryProc<atsc_mpeg_packet, atsc_mpeg_packet_no_sync> -{ - -public: - - GrAtscRandomizer (); - ~GrAtscRandomizer (); - - const char *name () { return "GrAtscRandomizer"; } - - int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - -protected: - atsci_randomizer rand; - - // used to initialize plinfo in output - bool field2; - int segno; -}; - -#endif /* _GRATSCRANDOMIZER_H_ */ diff --git a/gr-atsc/src/lib/GrAtscSegSymSync.cc b/gr-atsc/src/lib/GrAtscSegSymSync.cc deleted file mode 100644 index 2d9419c25..000000000 --- a/gr-atsc/src/lib/GrAtscSegSymSync.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscSegSymSync.h> -#include <GrAtscSegSymSyncImpl_export.h> -#include <iostream> -#include <assert.h> - -static const int DECIMATION = 2; // close enough for super class's use -static const int N_OUTPUTS = 2; - -GrAtscSegSymSync::GrAtscSegSymSync () - : VrDecimatingSigProc<float,float> (N_OUTPUTS, DECIMATION) -{ - if (sizeof (float) != sizeof (atsc::syminfo)){ - cerr << "GrAtscSegSymSync: sizeof (float) != sizeof (atsc::syminfo)\n"; - assert (0); - } -} - -GrAtscSegSymSync::~GrAtscSegSymSync () -{ - // Nop -} - - -GrAtscSegSymSync * -GrAtscSegSymSync::create (double nominal_ratio_of_rx_clock_to_symbol_freq) -{ - return create_GrAtscSegSymSyncImpl (nominal_ratio_of_rx_clock_to_symbol_freq); -} diff --git a/gr-atsc/src/lib/GrAtscSegSymSync.h b/gr-atsc/src/lib/GrAtscSegSymSync.h deleted file mode 100644 index 750483f54..000000000 --- a/gr-atsc/src/lib/GrAtscSegSymSync.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCSEGSYMSYNC_H_ -#define _GRATSCSEGSYMSYNC_H_ - -#include <VrDecimatingSigProc.h> - -/*! - * \brief ATSC SegSymSync - * - * Abstract class that establishes symbol timing and synchronizes - * with data segment boundaries. - * - * Takes a single stream of floats as the input and - * produces two streams as output. The first stream is the data samples - * and is of type float. The second stream is the tags, and is of type syminfo. - * - * The current GNU Radio interface doesn't currently support different - * types on the input ports (or output ports for that matter), but - * since they are the same size, it works. - */ - -#include <atsci_syminfo.h> - -class GrAtscSegSymSync : public VrDecimatingSigProc<float,float> { - -public: - - GrAtscSegSymSync (); - ~GrAtscSegSymSync (); - - /*! - * \brief reset bit timing loop on channel change - */ - virtual void reset () = 0; - - /*! - * \brief create an instance of GrAtscSegSymSync - */ - static GrAtscSegSymSync *create (double nominal_ratio_of_rx_clock_to_symbol_freq); - -}; - -#endif // _GRATSCSEGSYMSYNC_H_ diff --git a/gr-atsc/src/lib/GrAtscSegSymSyncImpl.cc b/gr-atsc/src/lib/GrAtscSegSymSyncImpl.cc deleted file mode 100644 index 8e2cfc208..000000000 --- a/gr-atsc/src/lib/GrAtscSegSymSyncImpl.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscSegSymSyncImpl.h> -#include <GrAtscSegSymSyncImpl_export.h> -#include <cmath> -#include <assert.h> - -GrAtscSegSymSyncImpl::GrAtscSegSymSyncImpl ( - double nominal_ratio_of_rx_clock_to_symbol_freq) - : d_interp (nominal_ratio_of_rx_clock_to_symbol_freq) -{ - // set approximate decimation rate for superclass's benefit - decimation = (int) rint (nominal_ratio_of_rx_clock_to_symbol_freq); - - history = 1500; // spare input samples in case we need them. - - d_sssr.reset (); - d_interp.reset (); - d_next_input = 0; - d_rx_clock_to_symbol_freq = nominal_ratio_of_rx_clock_to_symbol_freq; -} - -GrAtscSegSymSyncImpl::~GrAtscSegSymSyncImpl () -{ - // Nop -} - -void -GrAtscSegSymSyncImpl::pre_initialize () -{ - setSamplingFrequency ( - getInputSamplingFrequencyN (0) / d_rx_clock_to_symbol_freq); -} - -int -GrAtscSegSymSyncImpl::forecast (VrSampleRange output, - VrSampleRange inputs[]) -{ - assert (numberInputs == 1); // I hate these free references to - // superclass's instance variables... - - inputs[0].index = d_next_input; - inputs[0].size = - ((long unsigned int) (output.size * d_rx_clock_to_symbol_freq) - + history - 1); - - return 0; -} - -int -GrAtscSegSymSyncImpl::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ -#if 0 - float *input_samples = ((float **) ai)[0]; - float *output_samples = ((float **) ao)[0]; - atsc::syminfo *output_info = ((atsc::syminfo **) ao)[1]; - - // FIXME finish... -#endif - assert (0); - - return output.size; -} - -void -GrAtscSegSymSyncImpl::reset () -{ - d_sssr.reset (); - d_interp.reset (); -} - - -/* - * Exported constructor. - * Doesn't expose any of the internals or our compile time dependencies. - */ - -GrAtscSegSymSync * -create_GrAtscSegSymSyncImpl (double nominal_ratio_of_rx_clock_to_symbol_freq) -{ - return new GrAtscSegSymSyncImpl (nominal_ratio_of_rx_clock_to_symbol_freq); -} diff --git a/gr-atsc/src/lib/GrAtscSegSymSyncImpl.h b/gr-atsc/src/lib/GrAtscSegSymSyncImpl.h deleted file mode 100644 index 650dab569..000000000 --- a/gr-atsc/src/lib/GrAtscSegSymSyncImpl.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCSEGSYMSYNCIMPL_H_ -#define _GRATSCSEGSYMSYNCIMPL_H_ - -#include <GrAtscSegSymSync.h> -#include <atsci_sssr.h> - - -/*! - * \brief concrete implementation of GrAtscSegSymSync - * - * This class implements data segment sync tracking and symbol timing - * using a variation of the method described in - * "ATSC/VSB Tutorial - Receiver Technology" by Wayne E. Bretl of - * Zenith, pgs 41-45. - */ - -class GrAtscSegSymSyncImpl : public GrAtscSegSymSync { - - atsci_sssr d_sssr; - atsci_interpolator d_interp; - VrSampleIndex d_next_input; - double d_rx_clock_to_symbol_freq; // nominal ratio - -public: - - // the standard methods... - - GrAtscSegSymSyncImpl (double nominal_ratio_of_rx_clock_to_symbol_freq); - virtual ~GrAtscSegSymSyncImpl (); - - virtual const char *name () { return "GrAtscSegSymSyncImpl"; } - - virtual int forecast (VrSampleRange output, - VrSampleRange inputs[]); - - virtual int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - - void pre_initialize (); - - - // reset on channel change - - virtual void reset (); - -}; - -#endif /* _GRATSCSEGSYMSYNCIMPL_H_ */ diff --git a/gr-atsc/src/lib/GrAtscSegSymSyncImpl_export.h b/gr-atsc/src/lib/GrAtscSegSymSyncImpl_export.h deleted file mode 100644 index 187f1a039..000000000 --- a/gr-atsc/src/lib/GrAtscSegSymSyncImpl_export.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -class GrAtscSegSymSync; - -GrAtscSegSymSync *create_GrAtscSegSymSyncImpl ( - double nominal_ratio_of_rx_clock_to_symbol_freq); diff --git a/gr-atsc/src/lib/GrAtscSymbolMapper.h b/gr-atsc/src/lib/GrAtscSymbolMapper.h deleted file mode 100644 index a37703f1f..000000000 --- a/gr-atsc/src/lib/GrAtscSymbolMapper.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCSYMBOLMAPPER_H_ -#define _GRATSCSYMBOLMAPPER_H_ - - -#include <VrInterpolatingSigProcNoWork.h> -#include <atsc_types.h> -#include <gr_nco.h> - -/*! - * \brief take atsc_data_segments and map them to symbols. - * - * Input is a stream of atsc_data_segments. - * Output is a stream of symbols at 1x the symbol rate - * - * This module performs the signal mapping & pilot addition. - */ - -template<class oType> -class GrAtscSymbolMapper - : public VrInterpolatingSigProcNoWork<atsc_data_segment, oType> { - -public: - GrAtscSymbolMapper () - : VrInterpolatingSigProcNoWork<atsc_data_segment, oType>(1, INTERP_FACTOR) {}; - - ~GrAtscSymbolMapper () {}; - - const char *name () { return "GrAtscSymbolMapper"; } - - int work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]); - -protected: - static const int INTERP_FACTOR = ATSC_DATA_SEGMENT_LENGTH; -}; - - -template<class oType> -int -GrAtscSymbolMapper<oType>::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - atsc_data_segment *in = ((atsc_data_segment **) ai)[0]; - oType *out = ((oType **) ao)[0]; - - assert ((output.size % INTERP_FACTOR) == 0); - - static const float pilot_add = 1.25; - static const float map[8] = { - -7 + pilot_add, - -5 + pilot_add, - -3 + pilot_add, - -1 + pilot_add, - 1 + pilot_add, - 3 + pilot_add, - 5 + pilot_add, - 7 + pilot_add - }; - - unsigned int oo = 0; - unsigned int nsegs = output.size / INTERP_FACTOR; - - for (unsigned int n = 0; n < nsegs; n++){ - unsigned char *symbol = in[n].data; - - for (int i = 0; i < ATSC_DATA_SEGMENT_LENGTH; i++){ - out[oo++] = (oType) map[symbol[i] & 0x7]; - } - } - - assert (oo == output.size); - return output.size; -} - -#endif /* _GRATSCSYMBOLMAPPER_H_ */ diff --git a/gr-atsc/src/lib/GrAtscTrellisEncoder.cc b/gr-atsc/src/lib/GrAtscTrellisEncoder.cc deleted file mode 100644 index a0df3e9a7..000000000 --- a/gr-atsc/src/lib/GrAtscTrellisEncoder.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscTrellisEncoder.h> - -// typedefs for fundamental i/o types - -typedef atsc_mpeg_packet_rs_encoded iType; -typedef atsc_data_segment oType; - -static const int NUMBER_OF_OUTPUTS = 1; // # of output streams (almost always one) - - -GrAtscTrellisEncoder::GrAtscTrellisEncoder () - : VrHistoryProc<iType,oType> (NUMBER_OF_OUTPUTS), last_start(-1) -{ - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // - // We need our input to be aligned on a 12-segment boundary, - // to ensure satisfaction, ask for 11 more - history = 1 + (atsci_trellis_encoder::NCODERS - 1); - - // any other init here. - - // Let the bottom end know we must produce output in multiples of 12 segments. - setOutputSize (atsci_trellis_encoder::NCODERS); -} - -GrAtscTrellisEncoder::~GrAtscTrellisEncoder () -{ - // Anything that isn't automatically cleaned up... -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ - -int -GrAtscTrellisEncoder::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // If we have state that persists across invocations (e.g., we have - // instance variables that we modify), we must use the sync method - // to indicate to the scheduler that our output must be computed in - // order. This doesn't keep other things from being run in - // parallel, it just means that at any given time, there is only a - // single thread working this code, and that the scheduler will - // ensure that we are asked to produce output that is contiguous and - // that will be presented to us in order of increasing time. - - // We have state, the current state of the encoders, hence - // we must use sync. - - sync (output.index); - - // construct some nicer i/o pointers to work with. - - iType *in = ((iType **) ai)[0]; - oType *out = ((oType **) ao)[0]; - - -#if 0 - cerr << "@@@ GrAtscTrellisEncoder: output.index = " << output.index - << " output.size = " << output.size - << " sum = " << output.index + output.size - << " \t[in = " << in << "]" - << endl; -#endif - - assert (output.size % atsci_trellis_encoder::NCODERS == 0); - - - // find the first mod 12 boundary to begin decoding - int start; - for (start = 0; start < atsci_trellis_encoder::NCODERS; start++){ - plinfo::sanity_check (in[start].pli); - assert (in[start].pli.regular_seg_p ()); - if ((in[start].pli.segno () % atsci_trellis_encoder::NCODERS) == 0) - break; - } - - if (start == atsci_trellis_encoder::NCODERS){ - // we didn't find a mod 12 boundary. There's some kind of problem - // upstream of us (not yet sync'd??) - cerr << "!!!GrAtscTrellisEncoder: no mod-12 boundary found\7\n"; - start = 0; - } - else if (start != last_start){ - cerr << "GrAtscTrellisEncoder: new starting offset = " << start - << " output.index = " << output.index << endl; - last_start = start; - } - - - // FIXME paranoid check for problem - for (unsigned int i = 0; i < output.size; i++){ - plinfo::sanity_check (in[i + start].pli); - } - - // We must produce output.size units of output. - - for (unsigned int i = 0; i < output.size; i += atsci_trellis_encoder::NCODERS){ - // primitive does 12 segments at a time. - // pipeline info is handled in the primitive. - encoder.encode (&out[i], &in[i + start]); - } - -#if 0 - // FIXME paranoid check for problem - for (unsigned int i = 0; i < output.size; i++){ - plinfo::sanity_check (out[i].pli); - assert (out[i].pli.regular_seg_p ()); - } -#endif - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscTrellisEncoder.h b/gr-atsc/src/lib/GrAtscTrellisEncoder.h deleted file mode 100644 index e4de388ae..000000000 --- a/gr-atsc/src/lib/GrAtscTrellisEncoder.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCTRELLISENCODER_H_ - -#include <VrHistoryProc.h> -#include <atsci_trellis_encoder.h> - -/*! - * \brief ATSC 12-way interleaved trellis encoder (atsc_mpeg_packet_rs_encoded --> atsc_data_segment) - */ - -class GrAtscTrellisEncoder : public VrHistoryProc<atsc_mpeg_packet_rs_encoded,atsc_data_segment> -{ - -public: - - GrAtscTrellisEncoder (); - ~GrAtscTrellisEncoder (); - - const char *name () { return "GrAtscTrellisEncoder"; } - - int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - -protected: - atsci_trellis_encoder encoder; - int last_start; -}; - -#endif diff --git a/gr-atsc/src/lib/GrAtscViterbiDecoder.cc b/gr-atsc/src/lib/GrAtscViterbiDecoder.cc deleted file mode 100644 index c89b3556b..000000000 --- a/gr-atsc/src/lib/GrAtscViterbiDecoder.cc +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <GrAtscViterbiDecoder.h> -#include <iostream> - -// typedefs for fundamental i/o types - -typedef atsc_soft_data_segment iType; -typedef atsc_mpeg_packet_rs_encoded oType; - -static const int NUMBER_OF_OUTPUTS = 1; // # of output streams (almost always one) - - -GrAtscViterbiDecoder::GrAtscViterbiDecoder () - : VrHistoryProc<iType,oType> (NUMBER_OF_OUTPUTS), last_start(-1) -{ - // 1 + number of extra input elements at which we look. This is - // used by the superclass's forecast routine to get us the correct - // range on our inputs. - // - // We need our input to be aligned on a 12-segment boundary, - // to ensure satisfaction, ask for 11 more - history = 1 + (atsci_viterbi_decoder::NCODERS - 1); - - // any other init here. - - // Let the bottom end know we must produce output in multiples of 12 segments. - setOutputSize (atsci_viterbi_decoder::NCODERS); -} - -GrAtscViterbiDecoder::~GrAtscViterbiDecoder () -{ - // Anything that isn't automatically cleaned up... -} - -/* - * This is the real work horse. In general this interface can handle - * multiple streams of input and output, but we almost always - * use a single input and output stream. - */ - -int -GrAtscViterbiDecoder::work (VrSampleRange output, void *ao[], - VrSampleRange inputs[], void *ai[]) -{ - // If we have state that persists across invocations (e.g., we have - // instance variables that we modify), we must use the sync method - // to indicate to the scheduler that our output must be computed in - // order. This doesn't keep other things from being run in - // parallel, it just means that at any given time, there is only a - // single thread working this code, and that the scheduler will - // ensure that we are asked to produce output that is contiguous and - // that will be presented to us in order of increasing time. - - // We have state, the current state of the decoder, hence - // we must use sync. - - sync (output.index); - - // construct some nicer i/o pointers to work with. - - iType *in = ((iType **) ai)[0]; - oType *out = ((oType **) ao)[0]; - - - assert (output.size % atsci_viterbi_decoder::NCODERS == 0); - - // find the first mod 12 boundary to begin decoding - int start; - for (start = 0; start < atsci_viterbi_decoder::NCODERS; start++){ - assert (in[start].pli.regular_seg_p ()); - if ((in[start].pli.segno () % atsci_viterbi_decoder::NCODERS) == 0) - break; - } - - if (start == atsci_viterbi_decoder::NCODERS){ - // we didn't find a mod 12 boundary. There's some kind of problem - // upstream of us (not yet sync'd??) - cerr << "!!!GrAtscViterbiDecoder: no mod-12 boundary found\7\n"; - start = 0; - } - else if (start != last_start){ - cerr << "GrAtscViterbiDecoder: new starting offset = " << start - << " output.index = " << output.index << endl; - last_start = start; - } - - // We must produce output.size units of output. - - for (unsigned int i = 0; i < output.size; i += atsci_viterbi_decoder::NCODERS){ - // primitive does 12 segments at a time. - // pipeline info is handled in the primitive. - decoder.decode (&out[i], &in[i + start]); - } - -#if 0 - // FIXME paranoid check... - for (unsigned int i = 0; i < output.size; i++){ - plinfo::sanity_check (out[i].pli); - assert (out[i].pli.regular_seg_p ()); - } -#endif - -#if 0 - cerr << "@@@ GrAtscViterbiDecoder: output.index = " << output.index - << " output.size = " << output.size - << " sum = " << output.index + output.size << endl; -#endif - - // Return the number of units we produced. - // Note that for all intents and purposes, it is an error to - // produce less than you are asked for. - - return output.size; -} diff --git a/gr-atsc/src/lib/GrAtscViterbiDecoder.h b/gr-atsc/src/lib/GrAtscViterbiDecoder.h deleted file mode 100644 index 1b3bdd84a..000000000 --- a/gr-atsc/src/lib/GrAtscViterbiDecoder.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _GRATSCVITERBIDECODER_H_ - -#include <VrHistoryProc.h> -#include <atsci_viterbi_decoder.h> - -/*! - * \brief ATSC 12-way interleaved viterbi decoder (atsc_soft_data_segment --> atsc_mpeg_packet_rs_encoded) - */ - -class GrAtscViterbiDecoder : public VrHistoryProc<atsc_soft_data_segment, - atsc_mpeg_packet_rs_encoded> -{ - -public: - - GrAtscViterbiDecoder (); - ~GrAtscViterbiDecoder (); - - const char *name () { return "GrAtscViterbiDecoder"; } - - int work (VrSampleRange output, void *o[], - VrSampleRange inputs[], void *i[]); - -protected: - atsci_viterbi_decoder decoder; - int last_start; -}; - -#endif diff --git a/gr-atsc/src/lib/atsc.i b/gr-atsc/src/lib/atsc.i deleted file mode 100644 index 6b83a2315..000000000 --- a/gr-atsc/src/lib/atsc.i +++ /dev/null @@ -1,305 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -%include "gnuradio.i" // the common stuff - -//load generated python docstrings -%include "atsc_swig_doc.i" - -%{ -#include <atsc_randomizer.h> -#include <atsc_derandomizer.h> -#include <atsc_rs_encoder.h> -#include <atsc_rs_decoder.h> -#include <atsc_interleaver.h> -#include <atsc_deinterleaver.h> -#include <atsc_trellis_encoder.h> -#include <atsc_viterbi_decoder.h> -#include <atsc_ds_to_softds.h> -#include <atsc_field_sync_mux.h> -#include <atsc_field_sync_demux.h> -#include <atsc_equalizer.h> -#include <atsc_fs_checker.h> -#include <atsc_bit_timing_loop.h> -#include <atsc_fpll.h> -#include <atsc_depad.h> -#include <atsc_pad.h> -%} - -%include "atsc_consts.h" - -%constant int sizeof_atsc_mpeg_packet = sizeof(atsc_mpeg_packet); -%constant int sizeof_atsc_mpeg_packet_no_sync = sizeof(atsc_mpeg_packet_no_sync); -%constant int sizeof_atsc_mpeg_packet_rs_encoded = sizeof(atsc_mpeg_packet_rs_encoded); -%constant int sizeof_atsc_data_segment = sizeof(atsc_data_segment); -%constant int sizeof_atsc_soft_data_segment = sizeof(atsc_soft_data_segment); - -%constant int sizeof_atsc_mpeg_packet_pad = atsc_mpeg_packet::NPAD; -%constant int sizeof_atsc_mpeg_packet_no_sync_pad = atsc_mpeg_packet_no_sync::NPAD; -%constant int sizeof_atsc_mpeg_packet_rs_encoded_pad = atsc_mpeg_packet_rs_encoded::NPAD; -%constant int sizeof_atsc_data_segment_pad = atsc_data_segment::NPAD; -%constant int sizeof_atsc_soft_data_segment_pad = atsc_soft_data_segment::NPAD; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,randomizer); - -atsc_randomizer_sptr atsc_make_randomizer(); - -class atsc_randomizer : public gr_sync_block -{ - atsc_randomizer(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,derandomizer); - -atsc_derandomizer_sptr atsc_make_derandomizer(); - -class atsc_derandomizer : public gr_sync_block -{ - atsc_derandomizer(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,rs_encoder); - -atsc_rs_encoder_sptr atsc_make_rs_encoder(); - -class atsc_rs_encoder : public gr_sync_block -{ - atsc_rs_encoder(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,rs_decoder); - -atsc_rs_decoder_sptr atsc_make_rs_decoder(); - -class atsc_rs_decoder : public gr_sync_block -{ - atsc_rs_decoder(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,interleaver); - -atsc_interleaver_sptr atsc_make_interleaver(); - -class atsc_interleaver : public gr_sync_block -{ - atsc_interleaver(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,deinterleaver); - -atsc_deinterleaver_sptr atsc_make_deinterleaver(); - -class atsc_deinterleaver : public gr_sync_block -{ - atsc_deinterleaver(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,trellis_encoder); - -atsc_trellis_encoder_sptr atsc_make_trellis_encoder(); - -class atsc_trellis_encoder : public gr_sync_block -{ - atsc_trellis_encoder(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,viterbi_decoder); - -atsc_viterbi_decoder_sptr atsc_make_viterbi_decoder(); - -class atsc_viterbi_decoder : public gr_sync_block -{ - atsc_viterbi_decoder(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,ds_to_softds); - -atsc_ds_to_softds_sptr atsc_make_ds_to_softds(); - -class atsc_ds_to_softds : public gr_sync_block -{ - atsc_ds_to_softds(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,field_sync_mux); - -atsc_field_sync_mux_sptr atsc_make_field_sync_mux(); - -class atsc_field_sync_mux : public gr_sync_block -{ - atsc_field_sync_mux(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,field_sync_demux); - -atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); - -class atsc_field_sync_demux : public gr_block -{ - atsc_field_sync_demux(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,equalizer); - -atsc_equalizer_sptr atsc_make_equalizer(); - -class atsc_equalizer : public gr_sync_block -{ - atsc_equalizer(); - -public: - void reset(); - std::vector<double> taps(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,fs_checker); - -atsc_fs_checker_sptr atsc_make_fs_checker(); - -class atsc_fs_checker : public gr_sync_block -{ - atsc_fs_checker(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,bit_timing_loop); - -atsc_bit_timing_loop_sptr atsc_make_bit_timing_loop(); - -class atsc_bit_timing_loop : public gr_block -{ - atsc_bit_timing_loop(); - -public: - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,fpll); - -atsc_fpll_sptr atsc_make_fpll(); - -class atsc_fpll : public gr_sync_block -{ - atsc_fpll(); - -public: - void reset(); - -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,depad); - -atsc_depad_sptr atsc_make_depad(); - -class atsc_depad : public gr_sync_interpolator -{ - atsc_depad(); - -public: - void reset(); - -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(atsc,pad); - -atsc_pad_sptr atsc_make_pad(); - -class atsc_pad : public gr_sync_decimator -{ - atsc_pad(); - -public: - void reset(); - -}; - -// ---------------------------------------------------------------- - diff --git a/gr-atsc/src/lib/atsc_api.h b/gr-atsc/src/lib/atsc_api.h deleted file mode 100644 index 5add37762..000000000 --- a/gr-atsc/src/lib/atsc_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_ATSC_API_H -#define INCLUDED_ATSC_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_atsc_EXPORTS -# define ATSC_API __GR_ATTR_EXPORT -#else -# define ATSC_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_ATSC_API_H */ diff --git a/gr-atsc/src/lib/atsc_bit_timing_loop.cc b/gr-atsc/src/lib/atsc_bit_timing_loop.cc deleted file mode 100644 index dc43d28bc..000000000 --- a/gr-atsc/src/lib/atsc_bit_timing_loop.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_bit_timing_loop.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> -#include <string.h> - -// Input rate changed from 20MHz to 19.2 to support usrp at 3 * 6.4MHz -float input_rate = 19.2e6; -double ratio_of_rx_clock_to_symbol_freq = input_rate / ATSC_SYMBOL_RATE; - - -atsc_bit_timing_loop_sptr -atsc_make_bit_timing_loop() -{ - return gnuradio::get_initial_sptr(new atsc_bit_timing_loop()); -} - - -atsc_bit_timing_loop::atsc_bit_timing_loop() - : gr_block("atsc_bit_timing_loop", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature3(2, 3, sizeof(float), sizeof(float), sizeof(float))), - d_interp(ratio_of_rx_clock_to_symbol_freq), d_next_input(0), - d_rx_clock_to_symbol_freq (ratio_of_rx_clock_to_symbol_freq), - d_si(0) -{ - reset(); -} - -void -atsc_bit_timing_loop::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = static_cast<int>(noutput_items * d_rx_clock_to_symbol_freq) + 1500 - 1; - -} - -int -atsc_bit_timing_loop::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int r = work (noutput_items, input_items, output_items); - if (r > 0) - consume_each (d_si); - return r; -} - - -int -atsc_bit_timing_loop::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_sample = (float *) output_items[0]; - atsc::syminfo *out_tag = (atsc::syminfo *) output_items[1]; - float *out_timing_error = (float *) output_items[2]; - - assert(sizeof(float) == sizeof(atsc::syminfo)); - - // We are tasked with producing output.size output samples. - // We will consume approximately 2 * output.size input samples. - - int k; // output index - - float interp_sample; - int symbol_index; - double timing_adjustment = 0; - bool seg_locked; - atsc::syminfo tag; - // ammount requested in forecast - unsigned long input_size = noutput_items * d_rx_clock_to_symbol_freq + 1500 -1; - - memset (&tag, 0, sizeof (tag)); - - // ammount actually consumed - d_si = 0; - - for (k = 0; k < noutput_items; k++){ - if (!d_interp.update (in, input_size, &d_si, timing_adjustment, &interp_sample)){ - fprintf (stderr, "GrAtscBitTimingLoop3: ran short on data...\n"); - break; - } - - d_sssr.update (interp_sample, &seg_locked, &symbol_index, &timing_adjustment); - if (output_items.size() == 3) { - out_timing_error[k] = timing_adjustment; - } - out_sample[k] = interp_sample; - tag.valid = seg_locked; - tag.symbol_num = symbol_index; - out_tag[k] = tag; - - } - - return k; -} diff --git a/gr-atsc/src/lib/atsc_bit_timing_loop.h b/gr-atsc/src/lib/atsc_bit_timing_loop.h deleted file mode 100644 index 8b352f7eb..000000000 --- a/gr-atsc/src/lib/atsc_bit_timing_loop.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_BIT_TIMING_LOOP_H -#define INCLUDED_ATSC_BIT_TIMING_LOOP_H - -#include <atsc_api.h> -#include <cstdio> -#include <gr_block.h> -#include <atsci_diag_output.h> -#include <atsci_sssr.h> -#include <atsci_syminfo.h> - -class atsc_bit_timing_loop; -typedef boost::shared_ptr<atsc_bit_timing_loop> atsc_bit_timing_loop_sptr; - -ATSC_API atsc_bit_timing_loop_sptr atsc_make_bit_timing_loop(); - -/*! - * \brief ATSC BitTimingLoop3 - * \ingroup atsc - * - * This class accepts a single real input and produces two outputs, - * the raw symbol (float) and the tag (atsc_syminfo) - */ -class ATSC_API atsc_bit_timing_loop : public gr_block -{ - friend ATSC_API atsc_bit_timing_loop_sptr atsc_make_bit_timing_loop(); - - atsc_bit_timing_loop(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } - - ~atsc_bit_timing_loop () { }; - - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - - // debug (NOPs) - void set_mu (double a_mu) { } - void set_no_update (bool a_no_update) { } - void set_loop_filter_tap (double tap) { } - void set_timing_rate (double rate) { } - - - protected: - - atsci_sssr d_sssr; - atsci_interpolator d_interp; - unsigned long long d_next_input; - double d_rx_clock_to_symbol_freq; - int d_si; - - -}; - -#endif /* INCLUDED_ATSC_BIT_TIMING_LOOP_H */ - - - diff --git a/gr-atsc/src/lib/atsc_consts.h b/gr-atsc/src/lib/atsc_consts.h deleted file mode 100644 index bbe2ec69a..000000000 --- a/gr-atsc/src/lib/atsc_consts.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_CONSTS_H_ -#define _ATSC_CONSTS_H_ - -static const double ATSC_SYMBOL_RATE = 4.5e6 / 286 * 684; // ~10.76 MHz -static const double ATSC_DATA_SEGMENT_RATE = ATSC_SYMBOL_RATE / 832; // ~12.935 kHz - - -static const int ATSC_MPEG_DATA_LENGTH = 187; -static const int ATSC_MPEG_PKT_LENGTH = 188; // sync + data -static const int ATSC_MPEG_RS_ENCODED_LENGTH = 207; -static const int ATSC_DATA_SEGMENT_LENGTH = 832; // includes 4 sync symbols at beginning -static const int ATSC_DSEGS_PER_FIELD = 312; // regular data segs / field - - -static const int MPEG_SYNC_BYTE = 0x47; - -static const int MPEG_TRANSPORT_ERROR_BIT = 0x80; // top bit of byte after SYNC - - -#endif // _ATSC_CONSTS_H_ diff --git a/gr-atsc/src/lib/atsc_deinterleaver.cc b/gr-atsc/src/lib/atsc_deinterleaver.cc deleted file mode 100644 index f251c7f4e..000000000 --- a/gr-atsc/src/lib/atsc_deinterleaver.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_deinterleaver.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> - - -atsc_deinterleaver_sptr -atsc_make_deinterleaver() -{ - return gnuradio::get_initial_sptr(new atsc_deinterleaver()); -} - -atsc_deinterleaver::atsc_deinterleaver() - : gr_sync_block("atsc_deinterleaver", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))) -{ - reset(); -} - -int -atsc_deinterleaver::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const atsc_mpeg_packet_rs_encoded *in = (const atsc_mpeg_packet_rs_encoded *) input_items[0]; - atsc_mpeg_packet_rs_encoded *out = (atsc_mpeg_packet_rs_encoded *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - d_deinterleaver.deinterleave (out[i], in[i]); - } - - return noutput_items; -} diff --git a/gr-atsc/src/lib/atsc_deinterleaver.h b/gr-atsc/src/lib/atsc_deinterleaver.h deleted file mode 100644 index e398dfcc7..000000000 --- a/gr-atsc/src/lib/atsc_deinterleaver.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_DEINTERLEAVER_H -#define INCLUDED_ATSC_DEINTERLEAVER_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <atsci_data_interleaver.h> - -class atsc_deinterleaver; -typedef boost::shared_ptr<atsc_deinterleaver> atsc_deinterleaver_sptr; - -ATSC_API atsc_deinterleaver_sptr atsc_make_deinterleaver(); - -/*! - * \brief Deinterleave RS encoded ATSC data ( atsc_mpeg_packet_rs_encoded --> atsc_mpeg_packet_rs_encoded) - * \ingroup atsc - * - * input: atsc_mpeg_packet_rs_encoded; output: atsc_mpeg_packet_rs_encoded - */ -class ATSC_API atsc_deinterleaver : public gr_sync_block -{ - friend ATSC_API atsc_deinterleaver_sptr atsc_make_deinterleaver(); - - atsci_data_deinterleaver d_deinterleaver; - - atsc_deinterleaver(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } -}; - - -#endif /* INCLUDED_ATSC_DEINTERLEAVER_H */ diff --git a/gr-atsc/src/lib/atsc_depad.cc b/gr-atsc/src/lib/atsc_depad.cc deleted file mode 100644 index 9792a4e6a..000000000 --- a/gr-atsc/src/lib/atsc_depad.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2008,2010 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 <atsc_depad.h> -#include <gr_io_signature.h> -#include <atsc_types.h> - -atsc_depad_sptr -atsc_make_depad() -{ - return gnuradio::get_initial_sptr(new atsc_depad()); -} - -atsc_depad::atsc_depad() - : gr_sync_interpolator("atsc_depad", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet)), - gr_make_io_signature(1, 1, sizeof(unsigned char)), - ATSC_MPEG_PKT_LENGTH) -{ - reset(); -} - -int -atsc_depad::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const atsc_mpeg_packet *in = (const atsc_mpeg_packet *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - int i; - - for (i = 0; i < noutput_items/ATSC_MPEG_PKT_LENGTH; i++){ - memcpy(&out[i * ATSC_MPEG_PKT_LENGTH], in[i].data, ATSC_MPEG_PKT_LENGTH); - } - - return i * ATSC_MPEG_PKT_LENGTH; -} diff --git a/gr-atsc/src/lib/atsc_depad.h b/gr-atsc/src/lib/atsc_depad.h deleted file mode 100644 index 9d1a381bf..000000000 --- a/gr-atsc/src/lib/atsc_depad.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_DEPAD_H -#define INCLUDED_ATSC_DEPAD_H - -#include <atsc_api.h> -#include <gr_sync_interpolator.h> - -class atsc_depad; -typedef boost::shared_ptr<atsc_depad> atsc_depad_sptr; - -ATSC_API atsc_depad_sptr atsc_make_depad(); - -/*! - * \brief depad mpeg ts packets from 256 byte atsc_mpeg_packet to 188 byte char - * \ingroup atsc - * - * input: atsc_mpeg_packet; output: unsigned char - */ -class ATSC_API atsc_depad : public gr_sync_interpolator -{ - friend ATSC_API atsc_depad_sptr atsc_make_depad(); - - atsc_depad(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } -}; - - -#endif /* INCLUDED_ATSC_DEPAD_H */ diff --git a/gr-atsc/src/lib/atsc_derandomizer.cc b/gr-atsc/src/lib/atsc_derandomizer.cc deleted file mode 100644 index 6642adb25..000000000 --- a/gr-atsc/src/lib/atsc_derandomizer.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_derandomizer.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> - - -atsc_derandomizer_sptr -atsc_make_derandomizer() -{ - return gnuradio::get_initial_sptr(new atsc_derandomizer()); -} - -atsc_derandomizer::atsc_derandomizer() - : gr_sync_block("atsc_derandomizer", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_no_sync)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet))) -{ - reset(); -} - -void -atsc_derandomizer::reset() -{ - d_rand.reset(); -} - -int -atsc_derandomizer::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const atsc_mpeg_packet_no_sync *in = (const atsc_mpeg_packet_no_sync *) input_items[0]; - atsc_mpeg_packet *out = (atsc_mpeg_packet *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - - assert(in[i].pli.regular_seg_p()); - - if (in[i].pli.first_regular_seg_p()) - d_rand.reset(); - - d_rand.derandomize(out[i], in[i]); - - // Check the pipeline info for error status and and set the - // corresponding bit in transport packet header. - - if (in[i].pli.transport_error_p()) - out[i].data[1] |= MPEG_TRANSPORT_ERROR_BIT; - else - out[i].data[1] &= ~MPEG_TRANSPORT_ERROR_BIT; - } - - return noutput_items; -} diff --git a/gr-atsc/src/lib/atsc_derandomizer.h b/gr-atsc/src/lib/atsc_derandomizer.h deleted file mode 100644 index 1881a69a3..000000000 --- a/gr-atsc/src/lib/atsc_derandomizer.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_DERANDOMIZER_H -#define INCLUDED_ATSC_DERANDOMIZER_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <atsci_randomizer.h> - -class atsc_derandomizer; -typedef boost::shared_ptr<atsc_derandomizer> atsc_derandomizer_sptr; - -ATSC_API atsc_derandomizer_sptr atsc_make_derandomizer(); - -/*! - * \brief "dewhiten" incoming mpeg transport stream packets - * \ingroup atsc - * - * input: atsc_mpeg_packet_no_sync; output: atsc_mpeg_packet; - */ -class ATSC_API atsc_derandomizer : public gr_sync_block -{ - friend ATSC_API atsc_derandomizer_sptr atsc_make_derandomizer(); - - atsci_randomizer d_rand; - - atsc_derandomizer(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset(); -}; - - -#endif /* INCLUDED_ATSC_DERANDOMIZER_H */ diff --git a/gr-atsc/src/lib/atsc_ds_to_softds.cc b/gr-atsc/src/lib/atsc_ds_to_softds.cc deleted file mode 100644 index a8f93bde4..000000000 --- a/gr-atsc/src/lib/atsc_ds_to_softds.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_ds_to_softds.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> - - -atsc_ds_to_softds_sptr -atsc_make_ds_to_softds() -{ - return gnuradio::get_initial_sptr(new atsc_ds_to_softds()); -} - -atsc_ds_to_softds::atsc_ds_to_softds() - : gr_sync_block("atsc_ds_to_softds", - gr_make_io_signature(1, 1, sizeof(atsc_data_segment)), - gr_make_io_signature(1, 1, sizeof(atsc_soft_data_segment))) -{ - reset(); -} - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -void -atsc_ds_to_softds::map_to_soft_symbols (atsc_soft_data_segment &out, - const atsc_data_segment &in) -{ - for (unsigned int i = 0; i < NELEM (in.data); i++){ - out.data[i] = in.data[i] * 2 - 7; - } -} - - -int -atsc_ds_to_softds::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const atsc_data_segment *in = (const atsc_data_segment *) input_items[0]; - atsc_soft_data_segment *out = (atsc_soft_data_segment *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - - out[i].pli = in[i].pli; // copy pipeline info... - map_to_soft_symbols(out[i], in[i]); - } - - return noutput_items; -} diff --git a/gr-atsc/src/lib/atsc_ds_to_softds.h b/gr-atsc/src/lib/atsc_ds_to_softds.h deleted file mode 100644 index 0ba61c7d6..000000000 --- a/gr-atsc/src/lib/atsc_ds_to_softds.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_DS_TO_SOFTDS_H -#define INCLUDED_ATSC_DS_TO_SOFTDS_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <atsc_types.h> - -class atsc_ds_to_softds; -typedef boost::shared_ptr<atsc_ds_to_softds> atsc_ds_to_softds_sptr; - -ATSC_API atsc_ds_to_softds_sptr atsc_make_ds_to_softds(); - -/*! - * \brief Debug glue routine (atsc_data_segment --> atsc_soft_data_segment) - * \ingroup atsc - * - * input: atsc_data_segment; output: atsc_soft_data_segment - */ -class ATSC_API atsc_ds_to_softds : public gr_sync_block -{ - friend ATSC_API atsc_ds_to_softds_sptr atsc_make_ds_to_softds(); - - atsc_ds_to_softds(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void map_to_soft_symbols (atsc_soft_data_segment &out, - const atsc_data_segment &in); - - - void reset() { /* nop */ } -}; - - -#endif /* INCLUDED_ATSC_DS_TO_SOFTDS_H */ diff --git a/gr-atsc/src/lib/atsc_equalizer.cc b/gr-atsc/src/lib/atsc_equalizer.cc deleted file mode 100644 index b8f31aeb4..000000000 --- a/gr-atsc/src/lib/atsc_equalizer.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_equalizer.h> -#include <create_atsci_equalizer.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> -#include <atsci_syminfo.h> - - -atsc_equalizer_sptr -atsc_make_equalizer() -{ - return gnuradio::get_initial_sptr(new atsc_equalizer()); -} - -// had atsc_equalizer(atsci_equalizer *equalizer) -atsc_equalizer::atsc_equalizer() - : gr_sync_block("atsc_equalizer", - gr_make_io_signature(2, 2, sizeof(float)), - gr_make_io_signature(2, 2, sizeof(float))) -{ - d_equalizer = create_atsci_equalizer_lms(); -} - -atsc_equalizer::~atsc_equalizer () -{ - // Anything that isn't automatically cleaned up... - - delete d_equalizer; -} - - -void -atsc_equalizer::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - - int ntaps = d_equalizer->ntaps (); - - unsigned ninputs = ninput_items_required.size(); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = fixed_rate_noutput_to_ninput (noutput_items + ntaps); - - -} - - - -int -atsc_equalizer::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]; - const atsc::syminfo *in_tags = (const atsc::syminfo *) input_items[1]; - float *out = (float *) output_items[0]; - atsc::syminfo *out_tags = (atsc::syminfo *) output_items[1]; - - assert(sizeof(float) == sizeof(atsc::syminfo)); - - int ntaps = d_equalizer->ntaps (); - int npretaps = d_equalizer->npretaps (); - - assert (ntaps >= 1); - assert (npretaps >= 0 && npretaps < ntaps); - - int offset = ntaps - npretaps - 1; - assert (offset >= 0 && offset < ntaps); - - - // peform the actual equalization - - d_equalizer->filter (in, in_tags + offset, - out, noutput_items); - - // write the output tags - - for (int i = 0; i < noutput_items; i++) - out_tags[i] = in_tags[i + offset]; - - return noutput_items; -} diff --git a/gr-atsc/src/lib/atsc_equalizer.h b/gr-atsc/src/lib/atsc_equalizer.h deleted file mode 100644 index aca5e63b4..000000000 --- a/gr-atsc/src/lib/atsc_equalizer.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_EQUALIZER_H -#define INCLUDED_ATSC_EQUALIZER_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <atsci_equalizer.h> -#include <vector> - -class atsc_equalizer; -typedef boost::shared_ptr<atsc_equalizer> atsc_equalizer_sptr; - -atsc_equalizer_sptr ATSC_API atsc_make_equalizer(); - -/*! - * \brief ATSC equalizer (float,syminfo --> float,syminfo) - * \ingroup atsc - * - * first inputs are data samples, second inputs are tags. - * first outputs are equalized data samples, second outputs are tags. - */ -class ATSC_API atsc_equalizer : public gr_sync_block -{ - friend ATSC_API atsc_equalizer_sptr atsc_make_equalizer(); - - atsc_equalizer(); - -public: - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - - std::vector<double> taps() { - return d_equalizer->taps(); - } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } - - ~atsc_equalizer (); - - -protected: - atsci_equalizer *d_equalizer; - -}; - - -#endif /* INCLUDED_ATSC_EQUALIZER_H */ diff --git a/gr-atsc/src/lib/atsc_field_sync_demux.cc b/gr-atsc/src/lib/atsc_field_sync_demux.cc deleted file mode 100644 index 2783e4a90..000000000 --- a/gr-atsc/src/lib/atsc_field_sync_demux.cc +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <cmath> -#include <atsc_field_sync_demux.h> -#include <gr_io_signature.h> -#include <atsc_types.h> -#include <atsc_consts.h> -#include <atsci_syminfo.h> -#include <stdio.h> -#include <assert.h> -#include <iostream> - -using std::cerr; -using std::endl; - - -static const int DEC = ATSC_DATA_SEGMENT_LENGTH; // nominal decimation factor - - -atsc_field_sync_demux_sptr -atsc_make_field_sync_demux() -{ - return gnuradio::get_initial_sptr(new atsc_field_sync_demux()); -} - -atsc_field_sync_demux::atsc_field_sync_demux() - : gr_block("atsc_field_sync_demux", - gr_make_io_signature(2, 2, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(atsc_soft_data_segment))), - d_locked(false), d_in_field2(true), d_segment_number(0), - d_next_input(0), d_lost_index(0), d_inputs0_index(0), - d_inputs0_size(0), d_consume(0) -{ - reset(); -} - -inline static bool -tag_is_seg_sync_or_field_sync (atsc::syminfo tag) -{ - return tag.symbol_num == 0 && tag.valid; -} - -void -atsc_field_sync_demux::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i = 0; i < ninputs; i++) { - ninput_items_required[i] = noutput_items * DEC + 2 * DEC ; - - d_inputs0_index = d_next_input; - d_inputs0_size = noutput_items * DEC + 2 * DEC ; - } -} - -int -atsc_field_sync_demux::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int r = work (noutput_items, input_items, output_items); - consume_each (d_consume); - // printf("Consumed: %d, produced: %d\n",d_consume,r); - // we consume input even if no output is produced - // while looking for sync - return r; -} - - -int -atsc_field_sync_demux::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *in = (float *) input_items[0]; - atsc::syminfo *input_tags = (atsc::syminfo *) input_items[1]; - atsc_soft_data_segment *out = (atsc_soft_data_segment *) output_items[0]; - - assert(sizeof(float) == sizeof(atsc::syminfo)); - - unsigned int ii = 0; // input index - - // Are we in sync? - if (!tag_is_seg_sync_or_field_sync (input_tags[0])){ // No ... - - if (d_locked){ - d_locked = false; - d_lost_index = d_inputs0_index + ii; - cerr << "atsc_field_sync_demux: lost sync at " - << d_lost_index << endl; - } - - // ... search for beginning of a field sync - - // cerr << "atsc_field_sync_demux: searching for sync at " - // << d_inputs0_index + ii << endl; - - for (ii = 1; ii < d_inputs0_size; ii++){ - if (atsc::tag_is_start_field_sync (input_tags[ii])){ - // found one - d_locked = true; - - const char *str; - if (atsc::tag_is_start_field_sync_1 (input_tags[ii])) - str = "FIELD-1"; - else if (atsc::tag_is_start_field_sync_2 (input_tags[ii])) - str = "FIELD-2"; - else - str = "SEGMENT"; - - cerr << "atsc_field_sync_demux: synced (" << str << ") at " - << d_inputs0_index + ii - << " [delta = " << d_inputs0_index + ii - d_lost_index - << "]\n"; - - d_next_input += ii; // update for forecast - d_consume = ii; - return 0; // no work completed so far - } - } - // no non-NORMAL tag found - d_next_input += ii; // update for forecast - d_consume = ii; - // printf("ii: %d, d_next_input: %d\n",ii,d_next_input); - return 0; // no work completed so far - } - - // We are in sync. Produce output... - - int k = 0; // output index - - while (k < noutput_items){ - - if (d_inputs0_size - ii < static_cast<unsigned int>(ATSC_DATA_SEGMENT_LENGTH)){ - // We're out of input data. - cerr << "atsc_field_sync_demux: ran out of input data\n"; - d_next_input += ii; // update for forecast - return k; // return amount of work completed so far - } - - if (!tag_is_seg_sync_or_field_sync (input_tags[ii])){ - // lost sync... - cerr << "atsc_field_sync_demux: lost sync at " - << d_inputs0_index + ii << endl; - - d_next_input += ii; // update for forecast - return k; // return amount of work completed so far - } - - if (atsc::tag_is_start_field_sync_1 (input_tags[ii])){ - d_in_field2 = false; - d_segment_number = 0; - ii += ATSC_DATA_SEGMENT_LENGTH; // skip over field sync - continue; - } - - if (atsc::tag_is_start_field_sync_2 (input_tags[ii])){ - d_in_field2 = true; - d_segment_number = 0; - ii += ATSC_DATA_SEGMENT_LENGTH; // skip over field sync - continue; - } - - if (d_segment_number >= ATSC_DSEGS_PER_FIELD){ - // something's wrong... - cerr << "atsc_field_sync_demux: segment number overflow\n"; - d_segment_number = 0; - } - - out[k].pli.set_regular_seg (d_in_field2, d_segment_number++); - for (int jj = 0; jj < ATSC_DATA_SEGMENT_LENGTH; jj++) - out[k].data[jj] = in[ii + jj]; - ii += ATSC_DATA_SEGMENT_LENGTH; - k++; - } - - d_next_input += ii; // update for forecast - d_consume = ii; - return k; // return amount of work completed - -} - - - - diff --git a/gr-atsc/src/lib/atsc_field_sync_demux.h b/gr-atsc/src/lib/atsc_field_sync_demux.h deleted file mode 100644 index ea9a5d1ac..000000000 --- a/gr-atsc/src/lib/atsc_field_sync_demux.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_FIELD_SYNC_DEMUX_H -#define INCLUDED_ATSC_FIELD_SYNC_DEMUX_H - -#include <atsc_api.h> -#include <gr_block.h> -#include <atsc_types.h> - -class atsc_field_sync_demux; -typedef boost::shared_ptr<atsc_field_sync_demux> atsc_field_sync_demux_sptr; - -ATSC_API atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); - -/*! - * \brief ATSC Field Sync Demux - * - * This class accepts 1 stream of floats (data), and 1 stream of tags (syminfo). * It outputs one stream of atsc_soft_data_segment packets - * \ingroup atsc - * - */ -class ATSC_API atsc_field_sync_demux : public gr_block -{ - friend ATSC_API atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); - - atsc_field_sync_demux(); - -public: - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } - -protected: - bool d_locked; - bool d_in_field2; - int d_segment_number; - gr_uint64 d_next_input; - gr_uint64 d_lost_index; // diagnostic fluff - - unsigned long long d_inputs0_index; // for inputs[0].index - unsigned long d_inputs0_size; // for inputs[0].size - int d_consume; - -}; - - -#endif /* INCLUDED_ATSC_FIELD_SYNC_DEMUX_H */ diff --git a/gr-atsc/src/lib/atsc_field_sync_mux.cc b/gr-atsc/src/lib/atsc_field_sync_mux.cc deleted file mode 100644 index 99fa5bff3..000000000 --- a/gr-atsc/src/lib/atsc_field_sync_mux.cc +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_field_sync_mux.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> -#include <atsci_pnXXX.h> - - -atsc_field_sync_mux_sptr -atsc_make_field_sync_mux() -{ - return gnuradio::get_initial_sptr(new atsc_field_sync_mux()); -} - -atsc_field_sync_mux::atsc_field_sync_mux() - : gr_sync_block("atsc_field_sync_mux", - gr_make_io_signature(1, 1, sizeof(atsc_data_segment)), - gr_make_io_signature(1, 1, sizeof(atsc_data_segment))) -{ - reset(); -} - -static const int NUMBER_OF_OUTPUTS = 1; // # of output streams (almost always one) - -static const int N_SAVED_SYMBOLS = atsc_field_sync_mux::N_SAVED_SYMBOLS; - -static void -init_field_sync_common (unsigned char *p, int mask, - const unsigned char saved_symbols[N_SAVED_SYMBOLS]) -{ - static const unsigned char bin_map[2] = { 1, 6 }; // map binary values to 1 of 8 levels - - int i = 0; - - p[i++] = bin_map[1]; // data segment sync pulse - p[i++] = bin_map[0]; - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - - for (int j = 0; j < 511; j++) // PN511 - p[i++] = bin_map[atsc_pn511[j]]; - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map[atsc_pn63[j]]; - - for (int j = 0; j < 63; j++) // PN63, toggled on field 2 - p[i++] = bin_map[atsc_pn63[j] ^ mask]; - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map[atsc_pn63[j]]; - - p[i++] = bin_map[0]; // 24 bits of VSB8 mode identifiera - p[i++] = bin_map[0]; - p[i++] = bin_map[0]; - p[i++] = bin_map[0]; - - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - - p[i++] = bin_map[1]; - p[i++] = bin_map[1]; - p[i++] = bin_map[1]; - p[i++] = bin_map[1]; - - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - p[i++] = bin_map[1]; - p[i++] = bin_map[0]; - - - for (int j = 0; j < 92; j++) // 92 more bits - p[i++] = bin_map[atsc_pn63[j % 63]]; - - // now copy the last 12 symbols of the previous segment - - for (int j = 0; j < N_SAVED_SYMBOLS; j++) - p[i++] = saved_symbols[j]; - - assert (i == ATSC_DATA_SEGMENT_LENGTH); -} -inline static void -init_field_sync_1 (atsc_data_segment *s, - const unsigned char saved_symbols[N_SAVED_SYMBOLS]) -{ - init_field_sync_common (&s->data[0], 0, saved_symbols); -} - -inline static void -init_field_sync_2 (atsc_data_segment *s, - const unsigned char saved_symbols[N_SAVED_SYMBOLS]) - -{ - init_field_sync_common (&s->data[0], 1, saved_symbols); -} - -static void -save_last_symbols (unsigned char saved_symbols[N_SAVED_SYMBOLS], - const atsc_data_segment &seg) -{ - for (int i = 0; i < N_SAVED_SYMBOLS; i++) - saved_symbols[i] = seg.data[i + ATSC_DATA_SEGMENT_LENGTH - N_SAVED_SYMBOLS];} - - -inline static bool -last_regular_seg_p (const plinfo &pli) -{ - return pli.regular_seg_p () && (pli.segno () == ATSC_DSEGS_PER_FIELD - 1); -} - -void -atsc_field_sync_mux::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = fixed_rate_noutput_to_ninput (noutput_items); - -} - - -int -atsc_field_sync_mux::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const atsc_data_segment *in = (const atsc_data_segment *) input_items[0]; - atsc_data_segment *out = (atsc_data_segment *) output_items[0]; - - unsigned int index = 0; - for (int outdex = 0; outdex < noutput_items; outdex++){ - - assert (in[index].pli.regular_seg_p ()); - - if (!in[index].pli.first_regular_seg_p ()){ - out[outdex] = in[index]; // just copy in to out - - if (last_regular_seg_p (in[index].pli)) - save_last_symbols (d_saved_symbols, in[index]); - - index++; - } - else { // first_regular_seg_p - if (!d_already_output_field_sync){ - // write out field sync... - atsc_data_segment field_sync; - - if (in[index].pli.in_field1_p ()) - init_field_sync_1 (&field_sync, d_saved_symbols); - else - init_field_sync_2 (&field_sync, d_saved_symbols); - - // note that index doesn't advance in this branch - out[outdex] = field_sync; - d_already_output_field_sync = true; - } - else { - // already output field sync, now output first regular segment - out[outdex] = in[index]; - index++; - d_already_output_field_sync = false; - } - } - } - - d_current_index += index; - - return noutput_items; -} diff --git a/gr-atsc/src/lib/atsc_field_sync_mux.h b/gr-atsc/src/lib/atsc_field_sync_mux.h deleted file mode 100644 index ce4514e9c..000000000 --- a/gr-atsc/src/lib/atsc_field_sync_mux.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_FIELD_SYNC_MUX_H -#define INCLUDED_ATSC_FIELD_SYNC_MUX_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <atsc_types.h> - -class atsc_field_sync_mux; -typedef boost::shared_ptr<atsc_field_sync_mux> atsc_field_sync_mux_sptr; - -ATSC_API atsc_field_sync_mux_sptr atsc_make_field_sync_mux(); - -/*! - * \brief Insert ATSC Field Syncs as required (atsc_data_segment --> atsc_data_segment) - * \ingroup atsc - * - * input: atsc_data_segment; output: atsc_data_segment - */ -class ATSC_API atsc_field_sync_mux : public gr_sync_block -{ - friend ATSC_API atsc_field_sync_mux_sptr atsc_make_field_sync_mux(); - - atsc_field_sync_mux(); - -public: - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - - static const int N_SAVED_SYMBOLS = 12; - - void reset() { /* nop */ } - -protected: - gr_uint64 d_current_index; - bool d_already_output_field_sync; - unsigned char d_saved_symbols[N_SAVED_SYMBOLS]; -}; - - -#endif /* INCLUDED_ATSC_FIELD_SYNC_MUX_H */ diff --git a/gr-atsc/src/lib/atsc_fpll.cc b/gr-atsc/src/lib/atsc_fpll.cc deleted file mode 100644 index c8d62c415..000000000 --- a/gr-atsc/src/lib/atsc_fpll.cc +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_fpll.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> -#include <algorithm> -#include "fpll_btloop_coupling.h" -#include <gr_math.h> - -atsc_fpll_sptr -atsc_make_fpll() -{ - return gnuradio::get_initial_sptr(new atsc_fpll()); -} - - -/* - * I strongly suggest that you not mess with these... - * - * They are strongly coupled into the symbol timing code and - * their value also sets the level of the symbols going - * into the equalizer and viterbi decoder. - */ -static const float FPLL_AGC_REFERENCE = 2.5 * FPLL_BTLOOP_COUPLING_CONST; -static const float FPLL_AGC_RATE = 0.25e-6; - - - -atsc_fpll::atsc_fpll() - : gr_sync_block("atsc_fpll", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), - initial_phase(0) -{ - initial_freq = 5.75e6 - 3e6 + 0.31e6 + 5e3; // a_initial_freq; - agc.set_rate (FPLL_AGC_RATE); - agc.set_reference (FPLL_AGC_REFERENCE); - initialize(); -} - - -void -atsc_fpll::initialize () -{ - float Fs = 19.2e6; - - float alpha = 1 - exp(-1.0 / Fs / 5e-6); - - afci.set_taps (alpha); - afcq.set_taps (alpha); - - printf("Setting initial_freq: %f\n",initial_freq); - nco.set_freq (initial_freq / Fs * 2 * M_PI); - nco.set_phase (initial_phase); -} - - -int -atsc_fpll::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 k = 0; k < noutput_items; k++){ - - float a_cos, a_sin; - - float input = agc.scale (in[k]); - - nco.step (); // increment phase - nco.sincos (&a_sin, &a_cos); // compute cos and sin - - float I = input * a_sin; - float Q = input * a_cos; - - out[k] = I; - - float filtered_I = afci.filter (I); - float filtered_Q = afcq.filter (Q); - - // phase detector - - // float x = atan2 (filtered_Q, filtered_I); - float x = gr_fast_atan2f(filtered_Q, filtered_I); - - // avoid slamming filter with big transitions - - static const float limit = M_PI / 2; - - if (x > limit) - x = limit; - else if (x < -limit) - x = -limit; - - // static const float alpha = 0.037; // Max value - // static const float alpha = 0.005; // takes about 5k samples to pull in, stddev = 323 - // static const float alpha = 0.002; // takes about 15k samples to pull in, stddev = 69 - // or about 120k samples on noisy data, - static const float alpha = 0.001; - static const float beta = alpha * alpha / 4; - - nco.adjust_phase (alpha * x); - nco.adjust_freq (beta * x); - - } - - return noutput_items; -} - - - diff --git a/gr-atsc/src/lib/atsc_fpll.h b/gr-atsc/src/lib/atsc_fpll.h deleted file mode 100644 index 0474b8f76..000000000 --- a/gr-atsc/src/lib/atsc_fpll.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_FPLL_H -#define INCLUDED_ATSC_FPLL_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <gr_nco.h> -#include <gr_single_pole_iir.h> -#include <gri_agc_ff.h> -#include <stdio.h> -#include <atsci_diag_output.h> - -class atsc_fpll; -typedef boost::shared_ptr<atsc_fpll> atsc_fpll_sptr; - -ATSC_API atsc_fpll_sptr atsc_make_fpll(); - -/*! - * \brief ATSC FPLL (2nd Version) - * \ingroup atsc - * - * A/D --> GrFIRfilterFFF ----> GrAtscFPLL ----> - * - * We use GrFIRfilterFFF to bandpass filter the signal of interest. - * - * This class accepts a single real input and produces a single real output - */ - -class ATSC_API atsc_fpll : public gr_sync_block -{ - friend ATSC_API atsc_fpll_sptr atsc_make_fpll(); - - atsc_fpll(); - -public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } - - void initialize () ; - - protected: - - double initial_freq; - double initial_phase; - bool debug_no_update; - gr_nco<float,float> nco; - gri_agc_ff agc; // automatic gain control - gr_single_pole_iir<float,float,float> afci; - gr_single_pole_iir<float,float,float> afcq; - - -}; - - -#endif /* INCLUDED_ATSC_FPLL_H */ diff --git a/gr-atsc/src/lib/atsc_fs_checker.cc b/gr-atsc/src/lib/atsc_fs_checker.cc deleted file mode 100644 index f8c4e43d5..000000000 --- a/gr-atsc/src/lib/atsc_fs_checker.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_fs_checker.h> -#include <create_atsci_fs_checker.h> -#include <atsci_fs_checker.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> -#include <atsci_syminfo.h> - - -atsc_fs_checker_sptr -atsc_make_fs_checker() -{ - return gnuradio::get_initial_sptr(new atsc_fs_checker()); -} - -atsc_fs_checker::atsc_fs_checker() - : gr_sync_block("atsc_fs_checker", - gr_make_io_signature(2, 2, sizeof(float)), - gr_make_io_signature(2, 2, sizeof(float))) -{ - d_fsc = create_atsci_fs_checker(); -} - - -atsc_fs_checker::~atsc_fs_checker () -{ - // Anything that isn't automatically cleaned up... - - delete d_fsc; -} - - -int -atsc_fs_checker::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]; - const atsc::syminfo *tag_in = (const atsc::syminfo *) input_items[1]; - float *out = (float *) output_items[0]; - atsc::syminfo *tag_out = (atsc::syminfo *) output_items[1]; - - assert(sizeof(float) == sizeof(atsc::syminfo)); - - - for (int i = 0; i < noutput_items; i++) - d_fsc->filter (in[i], tag_in[i], &out[i], &tag_out[i]); - - return noutput_items; -} diff --git a/gr-atsc/src/lib/atsc_fs_checker.h b/gr-atsc/src/lib/atsc_fs_checker.h deleted file mode 100644 index d034fdd28..000000000 --- a/gr-atsc/src/lib/atsc_fs_checker.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_FS_CHECKER_H -#define INCLUDED_ATSC_FS_CHECKER_H - -#include <atsc_api.h> -#include <atsci_fs_checker.h> -#include <gr_sync_block.h> - -class atsc_fs_checker; -typedef boost::shared_ptr<atsc_fs_checker> atsc_fs_checker_sptr; - -ATSC_API atsc_fs_checker_sptr atsc_make_fs_checker(); - -/*! - * \brief ATSC field sync checker (float,syminfo --> float,syminfo) - * \ingroup atsc - * - * first output is delayed version of input. - * second output is set of tags, one-for-one with first output. - */ - -class ATSC_API atsc_fs_checker : public gr_sync_block -{ - friend ATSC_API atsc_fs_checker_sptr atsc_make_fs_checker(); - - atsc_fs_checker(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } - - ~atsc_fs_checker (); - -protected: - atsci_fs_checker *d_fsc; - -}; - - -#endif /* INCLUDED_ATSC_FS_CHECKER_H */ diff --git a/gr-atsc/src/lib/atsc_interleaver.cc b/gr-atsc/src/lib/atsc_interleaver.cc deleted file mode 100644 index fff5b2fa6..000000000 --- a/gr-atsc/src/lib/atsc_interleaver.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_interleaver.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> - - -atsc_interleaver_sptr -atsc_make_interleaver() -{ - return gnuradio::get_initial_sptr(new atsc_interleaver()); -} - -atsc_interleaver::atsc_interleaver() - : gr_sync_block("atsc_interleaver", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))) -{ - reset(); -} - -int -atsc_interleaver::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const atsc_mpeg_packet_rs_encoded *in = (const atsc_mpeg_packet_rs_encoded *) input_items[0]; - atsc_mpeg_packet_rs_encoded *out = (atsc_mpeg_packet_rs_encoded *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - d_interleaver.interleave (out[i], in[i]); - } - - return noutput_items; -} diff --git a/gr-atsc/src/lib/atsc_interleaver.h b/gr-atsc/src/lib/atsc_interleaver.h deleted file mode 100644 index 3090d49de..000000000 --- a/gr-atsc/src/lib/atsc_interleaver.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_INTERLEAVER_H -#define INCLUDED_ATSC_INTERLEAVER_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <atsci_data_interleaver.h> - -class atsc_interleaver; -typedef boost::shared_ptr<atsc_interleaver> atsc_interleaver_sptr; - -ATSC_API atsc_interleaver_sptr atsc_make_interleaver(); - -/*! \brief Interleave RS encoded ATSC data ( atsc_mpeg_packet_rs_encoded --> atsc_mpeg_packet_rs_encoded)* - * \ingroup atsc - * - * input: atsc_mpeg_packet_rs_encoded; output: atsc_mpeg_packet_rs_encoded - */ -class ATSC_API atsc_interleaver : public gr_sync_block -{ - friend ATSC_API atsc_interleaver_sptr atsc_make_interleaver(); - - atsci_data_interleaver d_interleaver; - - atsc_interleaver(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } -}; - - -#endif /* INCLUDED_ATSC_INTERLEAVER_H */ diff --git a/gr-atsc/src/lib/atsc_pad.cc b/gr-atsc/src/lib/atsc_pad.cc deleted file mode 100644 index 317b16aca..000000000 --- a/gr-atsc/src/lib/atsc_pad.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_pad.h> -#include <gr_io_signature.h> -#include <atsc_types.h> - -static const int INTR = ATSC_MPEG_PKT_LENGTH; - -atsc_pad_sptr -atsc_make_pad() -{ - return gnuradio::get_initial_sptr(new atsc_pad()); -} - -atsc_pad::atsc_pad() - : gr_sync_decimator("atsc_pad", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet)), - INTR) -{ - reset(); -} - -void -atsc_pad::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = noutput_items * ATSC_MPEG_PKT_LENGTH; -} - - -int -atsc_pad::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - atsc_mpeg_packet *out = (atsc_mpeg_packet *) output_items[0]; - - int i; - - for (i = 0; i < noutput_items; i++){ - for (int j = 0; j < ATSC_MPEG_PKT_LENGTH; j++) - out[i].data[j] = in[i * ATSC_MPEG_PKT_LENGTH + j]; - - } - - return noutput_items; -} - - - - diff --git a/gr-atsc/src/lib/atsc_pad.h b/gr-atsc/src/lib/atsc_pad.h deleted file mode 100644 index 139d951a6..000000000 --- a/gr-atsc/src/lib/atsc_pad.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_PAD_H -#define INCLUDED_ATSC_PAD_H - -#include <atsc_api.h> -#include <gr_sync_decimator.h> - -class atsc_pad; -typedef boost::shared_ptr<atsc_pad> atsc_pad_sptr; - -ATSC_API atsc_pad_sptr atsc_make_pad(); - -/*! - * \brief pad mpeg ts packets from 188 byte char to - * to 256 byte atsc_mpeg_packet - * \ingroup atsc - * - * input: unsigned char; output: atsc_mpeg_packet - */ -class ATSC_API atsc_pad : public gr_sync_decimator -{ - friend ATSC_API atsc_pad_sptr atsc_make_pad(); - - atsc_pad(); - -public: - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } -}; - - -#endif /* INCLUDED_ATSC_PAD_H */ diff --git a/gr-atsc/src/lib/atsc_randomizer.cc b/gr-atsc/src/lib/atsc_randomizer.cc deleted file mode 100644 index 73375e84c..000000000 --- a/gr-atsc/src/lib/atsc_randomizer.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_randomizer.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> - - -atsc_randomizer_sptr -atsc_make_randomizer() -{ - return gnuradio::get_initial_sptr(new atsc_randomizer()); -} - -atsc_randomizer::atsc_randomizer() - : gr_sync_block("atsc_randomizer", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_no_sync))) -{ - reset(); -} - -void -atsc_randomizer::reset() -{ - d_rand.reset(); - d_field2 = false; - d_segno = 0; -} - -int -atsc_randomizer::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const atsc_mpeg_packet *in = (const atsc_mpeg_packet *) input_items[0]; - atsc_mpeg_packet_no_sync *out = (atsc_mpeg_packet_no_sync *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - - // sanity check incoming data. - assert((in[i].data[0] == MPEG_SYNC_BYTE)); - assert((in[i].data[1] & MPEG_TRANSPORT_ERROR_BIT) == 0); - - // initialize plinfo for downstream - // - // We do this here because the randomizer is effectively - // the head of the tx processing chain - // - out[i].pli.set_regular_seg(d_field2, d_segno); - d_segno++; - if (d_segno == 312){ - d_segno = 0; - d_field2 = !d_field2; - } - - if (out[i].pli.first_regular_seg_p()) - d_rand.reset(); - - d_rand.randomize(out[i], in[i]); - } - - return noutput_items; -} diff --git a/gr-atsc/src/lib/atsc_randomizer.h b/gr-atsc/src/lib/atsc_randomizer.h deleted file mode 100644 index 7d00efcf9..000000000 --- a/gr-atsc/src/lib/atsc_randomizer.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_RANDOMIZER_H -#define INCLUDED_ATSC_RANDOMIZER_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <atsci_randomizer.h> - -class atsc_randomizer; -typedef boost::shared_ptr<atsc_randomizer> atsc_randomizer_sptr; - -ATSC_API atsc_randomizer_sptr atsc_make_randomizer(); - -/*! - * \brief "Whiten" incoming mpeg transport stream packets - * \ingroup atsc - * - * input: atsc_mpeg_packet; output: atsc_mpeg_packet_no_sync - */ -class ATSC_API atsc_randomizer : public gr_sync_block -{ - friend ATSC_API atsc_randomizer_sptr atsc_make_randomizer(); - - atsci_randomizer d_rand; - bool d_field2; // user to init plinfo in output - int d_segno; // likewise - - atsc_randomizer(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset(); -}; - - -#endif /* INCLUDED_ATSC_RANDOMIZER_H */ diff --git a/gr-atsc/src/lib/atsc_rs_decoder.cc b/gr-atsc/src/lib/atsc_rs_decoder.cc deleted file mode 100644 index e4bb6e57a..000000000 --- a/gr-atsc/src/lib/atsc_rs_decoder.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_rs_decoder.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> - - -atsc_rs_decoder_sptr -atsc_make_rs_decoder() -{ - return gnuradio::get_initial_sptr(new atsc_rs_decoder()); -} - -atsc_rs_decoder::atsc_rs_decoder() - : gr_sync_block("atsc_rs_decoder", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_no_sync))) -{ - reset(); -} - -int -atsc_rs_decoder::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const atsc_mpeg_packet_rs_encoded *in = (const atsc_mpeg_packet_rs_encoded *) input_items[0]; - atsc_mpeg_packet_no_sync *out = (atsc_mpeg_packet_no_sync *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - assert(in[i].pli.regular_seg_p()); - out[i].pli = in[i].pli; // copy pipeline info... - - int nerrors_corrrected = d_rs_decoder.decode(out[i], in[i]); - out[i].pli.set_transport_error(nerrors_corrrected == -1); - } - - return noutput_items; -} diff --git a/gr-atsc/src/lib/atsc_rs_decoder.h b/gr-atsc/src/lib/atsc_rs_decoder.h deleted file mode 100644 index 9e4bf8d44..000000000 --- a/gr-atsc/src/lib/atsc_rs_decoder.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_RS_DECODER_H -#define INCLUDED_ATSC_RS_DECODER_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <atsci_reed_solomon.h> - -class atsc_rs_decoder; -typedef boost::shared_ptr<atsc_rs_decoder> atsc_rs_decoder_sptr; - -ATSC_API atsc_rs_decoder_sptr atsc_make_rs_decoder(); - -/*! - * \brief Reed-Solomon decoder for ATSC - * \ingroup atsc - * - * input: atsc_mpeg_packet_rs_encoded; output: atsc_mpeg_packet_no_sync - */ -class ATSC_API atsc_rs_decoder : public gr_sync_block -{ - friend ATSC_API atsc_rs_decoder_sptr atsc_make_rs_decoder(); - - atsci_reed_solomon d_rs_decoder; - - atsc_rs_decoder(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } -}; - - -#endif /* INCLUDED_ATSC_RS_DECODER_H */ diff --git a/gr-atsc/src/lib/atsc_rs_encoder.cc b/gr-atsc/src/lib/atsc_rs_encoder.cc deleted file mode 100644 index 7c4ec293b..000000000 --- a/gr-atsc/src/lib/atsc_rs_encoder.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_rs_encoder.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> - - -atsc_rs_encoder_sptr -atsc_make_rs_encoder() -{ - return gnuradio::get_initial_sptr(new atsc_rs_encoder()); -} - -atsc_rs_encoder::atsc_rs_encoder() - : gr_sync_block("atsc_rs_encoder", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_no_sync)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))) -{ - reset(); -} - -int -atsc_rs_encoder::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const atsc_mpeg_packet_no_sync *in = (const atsc_mpeg_packet_no_sync *) input_items[0]; - atsc_mpeg_packet_rs_encoded *out = (atsc_mpeg_packet_rs_encoded *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - - assert(in[i].pli.regular_seg_p()); - out[i].pli = in[i].pli; // copy pipeline info... - d_rs_encoder.encode(out[i], in[i]); - } - - return noutput_items; -} diff --git a/gr-atsc/src/lib/atsc_rs_encoder.h b/gr-atsc/src/lib/atsc_rs_encoder.h deleted file mode 100644 index b0d69d95d..000000000 --- a/gr-atsc/src/lib/atsc_rs_encoder.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_RS_ENCODER_H -#define INCLUDED_ATSC_RS_ENCODER_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <atsci_reed_solomon.h> - -class atsc_rs_encoder; -typedef boost::shared_ptr<atsc_rs_encoder> atsc_rs_encoder_sptr; - -ATSC_API atsc_rs_encoder_sptr atsc_make_rs_encoder(); - -/*! - * \brief Reed-Solomon encoder for ATSC - * \ingroup atsc - * - * input: atsc_mpeg_packet_no_sync; output: atsc_mpeg_packet_rs_encoded - */ -class ATSC_API atsc_rs_encoder : public gr_sync_block -{ - friend ATSC_API atsc_rs_encoder_sptr atsc_make_rs_encoder(); - - atsci_reed_solomon d_rs_encoder; - - atsc_rs_encoder(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } -}; - - -#endif /* INCLUDED_ATSC_RS_ENCODER_H */ diff --git a/gr-atsc/src/lib/atsc_trellis_encoder.cc b/gr-atsc/src/lib/atsc_trellis_encoder.cc deleted file mode 100644 index fa0a889aa..000000000 --- a/gr-atsc/src/lib/atsc_trellis_encoder.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_trellis_encoder.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> - - -atsc_trellis_encoder_sptr -atsc_make_trellis_encoder() -{ - return gnuradio::get_initial_sptr(new atsc_trellis_encoder()); -} - -atsc_trellis_encoder::atsc_trellis_encoder() - : gr_sync_block("atsc_trellis_encoder", - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)), - gr_make_io_signature(1, 1, sizeof(atsc_data_segment))) -{ - set_output_multiple(atsci_trellis_encoder::NCODERS); - reset(); -} - -int -atsc_trellis_encoder::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const atsc_mpeg_packet_rs_encoded *in = (const atsc_mpeg_packet_rs_encoded *) input_items[0]; - atsc_data_segment *out = (atsc_data_segment *) output_items[0]; - - for (int i = 0; i < atsci_trellis_encoder::NCODERS; i += atsci_trellis_encoder::NCODERS){ - d_trellis_encoder.encode(&out[i], &in[i]); - } - return atsci_trellis_encoder::NCODERS; -} - diff --git a/gr-atsc/src/lib/atsc_trellis_encoder.h b/gr-atsc/src/lib/atsc_trellis_encoder.h deleted file mode 100644 index da51f633d..000000000 --- a/gr-atsc/src/lib/atsc_trellis_encoder.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_TRELLIS_ENCODER_H -#define INCLUDED_ATSC_TRELLIS_ENCODER_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <atsci_trellis_encoder.h> - -class atsc_trellis_encoder; -typedef boost::shared_ptr<atsc_trellis_encoder> atsc_trellis_encoder_sptr; - -ATSC_API atsc_trellis_encoder_sptr atsc_make_trellis_encoder(); - -/*! - * \brief ATSC 12-way interleaved trellis encoder (atsc_mpeg_packet_rs_encoded --> atsc_data_segment) - * \ingroup atsc - * - * input: atsc_mpeg_packet_rs_encoded; output: atsc_data_segment - */ -class ATSC_API atsc_trellis_encoder : public gr_sync_block -{ - friend ATSC_API atsc_trellis_encoder_sptr atsc_make_trellis_encoder(); - - atsci_trellis_encoder d_trellis_encoder; - - atsc_trellis_encoder(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } -}; - - -#endif /* INCLUDED_ATSC_TRELLIS_ENCODER_H */ diff --git a/gr-atsc/src/lib/atsc_types.h b/gr-atsc/src/lib/atsc_types.h deleted file mode 100644 index ed4dedace..000000000 --- a/gr-atsc/src/lib/atsc_types.h +++ /dev/null @@ -1,238 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2006 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 _ATSC_TYPES_H_ -#define _ATSC_TYPES_H_ - -#include <atsc_consts.h> -#include <cstring> -#include <cassert> - - -/*! - * \brief pipeline info that flows with data - * - * Not all modules need all the info - */ -class plinfo { -public: - plinfo () : _flags (0), _segno (0) { } - - // accessors - - bool field_sync1_p () const { return (_flags & fl_field_sync1) != 0; } - bool field_sync2_p () const { return (_flags & fl_field_sync2) != 0; } - bool field_sync_p () const { return field_sync1_p () || field_sync2_p (); } - - bool regular_seg_p () const { return (_flags & fl_regular_seg) != 0; } - - bool in_field1_p () const { return (_flags & fl_field2) == 0; } - bool in_field2_p () const { return (_flags & fl_field2) != 0; } - - bool first_regular_seg_p () const { return (_flags & fl_first_regular_seg) != 0; } - - bool transport_error_p () const { return (_flags & fl_transport_error) != 0; } - - unsigned int segno () const { return _segno; } - unsigned int flags () const { return _flags; } - - // setters - - void set_field_sync1 () - { - _segno = 0; - _flags = fl_field_sync1; - } - - void set_field_sync2 () - { - _segno = 0; - _flags = fl_field_sync2 | fl_field2; - } - - void set_regular_seg (bool field2, int segno) - { - assert (0 <= segno && segno < ATSC_DSEGS_PER_FIELD); - _segno = segno; - _flags = fl_regular_seg; - if (segno == 0) - _flags |= fl_first_regular_seg; - if (segno >= ATSC_DSEGS_PER_FIELD) - _flags |= fl_transport_error; - if (field2) - _flags |= fl_field2; - } - - void set_transport_error (bool error){ - if (error) - _flags |= fl_transport_error; - else - _flags &= ~fl_transport_error; - } - - // overload equality operator - bool operator== (const plinfo &other) const { - return (_flags == other._flags && _segno == other._segno); - } - - bool operator!= (const plinfo &other) const { - return !(_flags == other._flags && _segno == other._segno); - } - - /*! - * Set \p OUT such that it reflects a \p NSEGS_OF_DELAY - * pipeline delay from \p IN. - */ - static void delay (plinfo &out, const plinfo &in, int nsegs_of_delay); - - /*! - * confirm that \p X is plausible - */ - static void sanity_check (const plinfo &in); - - -protected: - unsigned short _flags; // bitmask - unsigned short _segno; // segment number [0,311] - - // these three are mutually exclusive - // This is a regular data segment. - static const int fl_regular_seg = 0x0001; - // This is a field sync segment, for 1st half of a field. - static const int fl_field_sync1 = 0x0002; - // This is a field sync segment, for 2nd half of a field. - static const int fl_field_sync2 = 0x0004; - - // This bit is on ONLY when fl_regular_seg is set AND when this is - // the first regular data segment AFTER a field sync segment. This - // segment causes various processing modules to reset. - static const int fl_first_regular_seg = 0x0008; - - // which field are we in? - static const int fl_field2 = 0x0010; // else field 1 - - // This bit is set when Reed-Solomon decoding detects an error that it - // can't correct. Note that other error detection (e.g. Viterbi) do not - // set it, since Reed-Solomon will correct many of those. This bit is - // then copied into the final Transport Stream packet so that MPEG - // software can see that the 188-byte data segment has been corrupted. - static const int fl_transport_error = 0x0020; -}; - - - - -class atsc_mpeg_packet { - public: - static const int NPAD = 68; - unsigned char data[ATSC_MPEG_DATA_LENGTH + 1]; // first byte is sync - unsigned char _pad_[NPAD]; // pad to power of 2 (256) - - // overload equality operator - bool operator== (const atsc_mpeg_packet &other) const { - return std::memcmp (data, other.data, sizeof (data)) == 0; - }; - - bool operator!= (const atsc_mpeg_packet &other) const { - return !(std::memcmp (data, other.data, sizeof (data)) == 0); - }; -}; - -class atsc_mpeg_packet_no_sync { - public: - static const int NPAD = 65; - plinfo pli; - unsigned char data[ATSC_MPEG_DATA_LENGTH]; - unsigned char _pad_[NPAD]; // pad to power of 2 (256) - - // overload equality operator - bool operator== (const atsc_mpeg_packet_no_sync &other) const { - return std::memcmp (data, other.data, sizeof (data)) == 0; - } - - bool operator!= (const atsc_mpeg_packet_no_sync &other) const { - return !(std::memcmp (data, other.data, sizeof (data)) == 0); - } -}; - -class atsc_mpeg_packet_rs_encoded { - public: - static const int NPAD = 45; - plinfo pli; - unsigned char data[ATSC_MPEG_RS_ENCODED_LENGTH]; - unsigned char _pad_[NPAD]; // pad to power of 2 (256) - - // overload equality operator - bool operator== (const atsc_mpeg_packet_rs_encoded &other) const { - return std::memcmp (data, other.data, sizeof (data)) == 0; - } - - bool operator!= (const atsc_mpeg_packet_rs_encoded &other) const { - return !(std::memcmp (data, other.data, sizeof (data)) == 0); - } -}; - - -//! contains 832 3 bit symbols. The low 3 bits in the byte hold the symbol. - -class atsc_data_segment { - public: - static const int NPAD = 188; - plinfo pli; - unsigned char data[ATSC_DATA_SEGMENT_LENGTH]; - unsigned char _pad_[NPAD]; // pad to power of 2 (1024) - - // overload equality operator - bool operator== (const atsc_data_segment &other) const { - return std::memcmp (data, other.data, sizeof (data)) == 0; - } - - bool operator!= (const atsc_data_segment &other) const { - return !(std::memcmp (data, other.data, sizeof (data)) == 0); - } -}; - -/*! - * Contains 832 bipolar floating point symbols. - * Nominal values are +/- {1, 3, 5, 7}. - * This data type represents the input to the viterbi decoder. - */ - -class atsc_soft_data_segment { - public: - static const int NPAD = 764; - plinfo pli; - float data[ATSC_DATA_SEGMENT_LENGTH]; - unsigned char _pad_[NPAD]; // pad to power of 2 (4096) - - // overload equality operator - bool operator== (const atsc_data_segment &other) const { - return std::memcmp (data, other.data, sizeof (data)) == 0; - } - - bool operator!= (const atsc_data_segment &other) const { - return !(std::memcmp (data, other.data, sizeof (data)) == 0); - } -}; - - -#endif /* _ATSC_TYPES_H_ */ diff --git a/gr-atsc/src/lib/atsc_viterbi_decoder.cc b/gr-atsc/src/lib/atsc_viterbi_decoder.cc deleted file mode 100644 index 72b9a965b..000000000 --- a/gr-atsc/src/lib/atsc_viterbi_decoder.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <atsc_viterbi_decoder.h> -#include <gr_io_signature.h> -#include <atsc_consts.h> -#include <iostream> - -using std::cerr; -using std::endl; - -atsc_viterbi_decoder_sptr -atsc_make_viterbi_decoder() -{ - return gnuradio::get_initial_sptr(new atsc_viterbi_decoder()); -} - -atsc_viterbi_decoder::atsc_viterbi_decoder() - : gr_sync_block("atsc_viterbi_decoder", - gr_make_io_signature(1, 1, sizeof(atsc_soft_data_segment)), - gr_make_io_signature(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))), - last_start(-1) -{ - set_output_multiple(atsci_viterbi_decoder::NCODERS); - reset(); -} - -int -atsc_viterbi_decoder::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const atsc_soft_data_segment *in = (const atsc_soft_data_segment *) input_items[0]; - atsc_mpeg_packet_rs_encoded *out = (atsc_mpeg_packet_rs_encoded *) output_items[0]; - - assert (noutput_items % atsci_viterbi_decoder::NCODERS == 0); - - // find the first mod 12 boundary to begin decoding - int start; - for (start = 0; start < atsci_viterbi_decoder::NCODERS; start++){ - assert (in[start].pli.regular_seg_p ()); - if ((in[start].pli.segno () % atsci_viterbi_decoder::NCODERS) == 0) - break; - } - - if (start == atsci_viterbi_decoder::NCODERS){ - // we didn't find a mod 12 boundary. There's some kind of problem - // upstream of us (not yet sync'd??) - cerr << "!!!atsc_viterbi_decoder: no mod-12 boundary found\7\n"; - start = 0; - } - else if (start != last_start){ - cerr << "atsc_viterbi_decoder: new starting offset = " << start - << endl; - last_start = start; - } - - for (int i = 0; i < atsci_viterbi_decoder::NCODERS; i += atsci_viterbi_decoder::NCODERS){ - d_viterbi_decoder.decode(&out[i], &in[i + start]); - } - return atsci_viterbi_decoder::NCODERS; -} - diff --git a/gr-atsc/src/lib/atsc_viterbi_decoder.h b/gr-atsc/src/lib/atsc_viterbi_decoder.h deleted file mode 100644 index de571db33..000000000 --- a/gr-atsc/src/lib/atsc_viterbi_decoder.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_ATSC_VITERBI_DECODER_H -#define INCLUDED_ATSC_VITERBI_DECODER_H - -#include <atsc_api.h> -#include <gr_sync_block.h> -#include <atsci_viterbi_decoder.h> - -class atsc_viterbi_decoder; -typedef boost::shared_ptr<atsc_viterbi_decoder> atsc_viterbi_decoder_sptr; - -ATSC_API atsc_viterbi_decoder_sptr atsc_make_viterbi_decoder(); - -/*! - * \brief ATSC 12-way interleaved viterbi decoder (atsc_soft_data_segment --> atsc_mpeg_packet_rs_encoded) - * \ingroup atsc - * - * input: atsc_soft_data_segment; output: atsc_mpeg_packet_rs_encoded - */ -class ATSC_API atsc_viterbi_decoder : public gr_sync_block -{ - friend ATSC_API atsc_viterbi_decoder_sptr atsc_make_viterbi_decoder(); - - atsci_viterbi_decoder d_viterbi_decoder; - - atsc_viterbi_decoder(); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { /* nop */ } - -protected: - int last_start; - -}; - - -#endif /* INCLUDED_ATSC_VITERBI_DECODER_H */ diff --git a/gr-atsc/src/lib/atsci_basic_trellis_encoder.cc b/gr-atsc/src/lib/atsci_basic_trellis_encoder.cc deleted file mode 100644 index 2ae481cbc..000000000 --- a/gr-atsc/src/lib/atsci_basic_trellis_encoder.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_basic_trellis_encoder.h> -#include <assert.h> - -const unsigned char atsci_basic_trellis_encoder::next_state[32] = { - 0,1,4,5, - 2,3,6,7, - 1,0,5,4, - 3,2,7,6, - 4,5,0,1, - 6,7,2,3, - 5,4,1,0, - 7,6,3,2 -}; - -const unsigned char atsci_basic_trellis_encoder::out_symbol[32] = { - 0,2,4,6, - 1,3,5,7, - 0,2,4,6, - 1,3,5,7, - 4,6,0,2, - 5,7,1,3, - 4,6,0,2, - 5,7,1,3 -}; - - -/*! - * Encode two bit INPUT into 3 bit return value. Domain is [0,3], - * Range is [0,7]. The mapping to bipolar levels is not done. - */ - -int -atsci_basic_trellis_encoder::encode (unsigned int input) -{ - assert (input < 4); - int index = (state << 2) + input; - state = next_state[index]; - return out_symbol[index]; -} - diff --git a/gr-atsc/src/lib/atsci_basic_trellis_encoder.h b/gr-atsc/src/lib/atsci_basic_trellis_encoder.h deleted file mode 100644 index a1bbbf5a0..000000000 --- a/gr-atsc/src/lib/atsci_basic_trellis_encoder.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_BASIC_TRELLIS_ENCODER_H_ -#define _ATSC_BASIC_TRELLIS_ENCODER_H_ - -#include <atsc_api.h> -#include <assert.h> - -/*! - * \brief ATSC trellis encoder building block. - * - * Note this is NOT the 12x interleaved interface. - * - * This implements a single instance of the ATSC trellis encoder. - * This is a rate 2/3 encoder (really a constraint length 3, rate 1/2 - * encoder with the top bit passed through unencoded. This does not - * implement the "precoding" of the top bit, because the NTSC rejection - * filter is not supported. - */ - -class ATSC_API atsci_basic_trellis_encoder { - -private: - int state; // two bit state; - -public: - atsci_basic_trellis_encoder () : state (0) {} - - /*! - * Encode two bit INPUT into 3 bit return value. Domain is [0,3], - * Range is [0,7]. The mapping to bipolar levels is not done. - */ - int encode (unsigned int input); - - //! reset encoder state - void reset () { state = 0; } - - static const unsigned char next_state[32]; - static const unsigned char out_symbol[32]; -}; - -#endif /* _ATSC_BASIC_TRELLIS_ENCODER_H_ */ diff --git a/gr-atsc/src/lib/atsci_data_interleaver.cc b/gr-atsc/src/lib/atsci_data_interleaver.cc deleted file mode 100644 index a2eef0fea..000000000 --- a/gr-atsc/src/lib/atsci_data_interleaver.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_data_interleaver.h> - -void -atsci_data_interleaver::interleave (atsc_mpeg_packet_rs_encoded &out, - const atsc_mpeg_packet_rs_encoded &in) -{ - assert (in.pli.regular_seg_p ()); - plinfo::sanity_check (in.pli); - - out.pli = in.pli; // copy pipeline info - if (in.pli.first_regular_seg_p ()) // reset commutator if required - sync (); - - transform (out.data, in.data, sizeof (in.data)); -} - - -void -atsci_data_deinterleaver::deinterleave (atsc_mpeg_packet_rs_encoded &out, - const atsc_mpeg_packet_rs_encoded &in) -{ - assert (in.pli.regular_seg_p ()); - plinfo::sanity_check (in.pli); - - // reset commutator if required using INPUT pipeline info - if (in.pli.first_regular_seg_p ()) - sync (); - - // remap OUTPUT pipeline info to reflect 52 data segment end-to-end delay - - plinfo::delay (out.pli, in.pli, 52); - - // now do the actual deinterleaving - - for (unsigned int i = 0; i < sizeof (in.data); i++){ - out.data[i] = alignment_fifo.stuff (transform (in.data[i])); - } -} - diff --git a/gr-atsc/src/lib/atsci_data_interleaver.h b/gr-atsc/src/lib/atsci_data_interleaver.h deleted file mode 100644 index 290607ea3..000000000 --- a/gr-atsc/src/lib/atsci_data_interleaver.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_DATA_INTERLEAVER_H_ -#define _ATSC_DATA_INTERLEAVER_H_ - -#include <atsc_api.h> -#include <atsc_types.h> -#include <convolutional_interleaver.h> - -/*! - * \brief atsc convolutional data interleaver - */ -class ATSC_API atsci_data_interleaver : public convolutional_interleaver<unsigned char> { - public: - atsci_data_interleaver () : convolutional_interleaver<unsigned char>(true, 52, 4) {} - - void interleave (atsc_mpeg_packet_rs_encoded &out, - const atsc_mpeg_packet_rs_encoded &in); -}; - -/*! - * \brief atsc convolutional data deinterleaver - */ -class ATSC_API atsci_data_deinterleaver : public convolutional_interleaver<unsigned char> { - public: - atsci_data_deinterleaver () : - convolutional_interleaver<unsigned char>(false, 52, 4), alignment_fifo (156) {} - - void deinterleave (atsc_mpeg_packet_rs_encoded &out, - const atsc_mpeg_packet_rs_encoded &in); - -private: - /*! - * Note: The use of the alignment_fifo keeps the encoder and decoder - * aligned if both are synced to a field boundary. There may be other - * ways to implement this function. This is a best guess as to how - * this should behave, as we have no test vectors for either the - * interleaver or deinterleaver. - */ - interleaver_fifo<unsigned char> alignment_fifo; - - static void remap_pli (plinfo &out, const plinfo &in); -}; - -#endif /* _ATSC_DATA_INTERLEAVER_H_ */ diff --git a/gr-atsc/src/lib/atsci_diag_output.h b/gr-atsc/src/lib/atsci_diag_output.h deleted file mode 100644 index 09fd763d6..000000000 --- a/gr-atsc/src/lib/atsci_diag_output.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -/* - * single place to control all compile time diagnostic output options - */ - -#define _BT_DIAG_OUTPUT_ 0 -#define _FPLL_DIAG_OUTPUT_ 0 -#define _SSSR_DIAG_OUTPUT_ 0 diff --git a/gr-atsc/src/lib/atsci_equalizer.cc b/gr-atsc/src/lib/atsci_equalizer.cc deleted file mode 100644 index 4aec47495..000000000 --- a/gr-atsc/src/lib/atsci_equalizer.cc +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_equalizer.h> -#include <algorithm> -#include <iostream> -#include <atsc_types.h> - -using std::cerr; -using std::endl; -using std::min; - - -// total number of symbols (including field sync) / field -static const int SYMBOLS_PER_FIELD = - (ATSC_DSEGS_PER_FIELD + 1) * ATSC_DATA_SEGMENT_LENGTH; - - -atsci_equalizer::atsci_equalizer () -{ - d_locked_p = false; - d_offset_from_last_field_sync = 0; - d_current_field = 0; -} - -atsci_equalizer::~atsci_equalizer () -{ -} - -void -atsci_equalizer::reset () -{ - d_locked_p = false; - d_offset_from_last_field_sync = 0; - d_current_field = 0; -} - -/* - * Errrr.... Define to 1 if compiler handles tail recursion without pushing - * unnecessary stack frames, else define to 0 for lame compilers. - */ -#define WINNING_COMPILER 0 - - -/* - * divide and conquer... - * - * Note that this could be refactored to take advantage of the - * symbol_num that is contained in the input_tags. Then we wouldn't - * have to be counting here. - * - * Today's strategy: get it working. - */ - -void -atsci_equalizer::filter (const float *input_samples, - const atsc::syminfo *input_tags, - float *output_samples, - int nsamples) -{ - lame_compiler_kludge: - - if (!d_locked_p){ - - // look for a field sync - - int i; - for (i = 0; i < nsamples; i++){ - if (atsc::tag_is_start_field_sync (input_tags[i])) - break; - } - - // whether we found one or not, everything up to it should - // be run through the normal path - - if (i != 0) - filter_normal (input_samples, output_samples, i); - - if (i == nsamples) // no field sync found, still not locked. - return; - - // OK, we've just transitioned to the locked state. - - d_locked_p = true; - d_offset_from_last_field_sync = 0; - - // handle locked case recursively - - if (WINNING_COMPILER) - filter (&input_samples[i], &input_tags[i], - &output_samples[i], nsamples - i); - else { - input_samples += i; - input_tags += i; - output_samples += i; - nsamples -= i; - goto lame_compiler_kludge; - } - - return; - } - - // We're in the locked state. - // - // Figure out where we are with respect to a data segment boundary - // and do the right thing. Note that in the interested of performance, - // we don't scan all the tags looking for trouble. We only check - // them where we expect them to be non-NORMAL. Worst case, it'll take - // us a field to notice that something went wrong... - - if (d_offset_from_last_field_sync % SYMBOLS_PER_FIELD == 0){ // we should be looking - // at a field sync - if (atsc::tag_is_start_field_sync_1 (input_tags[0])) - d_current_field = 0; - - else if (atsc::tag_is_start_field_sync_2 (input_tags[0])) - d_current_field = 1; - - else { // we're lost... no field sync where we expected it - - cerr << "!!! atsci_equalizer: expected field sync, didn't find one\n"; - - d_locked_p = false; - d_offset_from_last_field_sync = 0; - - if (WINNING_COMPILER) - filter (input_samples, input_tags, output_samples, nsamples); - else - goto lame_compiler_kludge; - - return; - } - - // OK, everything's cool. We're looking at a field sync. - - int n = min (ATSC_DATA_SEGMENT_LENGTH, nsamples); - - filter_field_sync (input_samples, output_samples, n, 0, d_current_field); - - d_offset_from_last_field_sync = n; - nsamples -= n; - - if (nsamples > 0){ - if (WINNING_COMPILER) - filter (&input_samples[n], &input_tags[n], - &output_samples[n], nsamples); - else { - input_samples += n; - input_tags += n; - output_samples += n; - goto lame_compiler_kludge; - } - } - return; - } - - if (d_offset_from_last_field_sync < ATSC_DATA_SEGMENT_LENGTH){ // we're in the middle of a field sync - int n = min (ATSC_DATA_SEGMENT_LENGTH - d_offset_from_last_field_sync, nsamples); - - filter_field_sync (input_samples, output_samples, n, - d_offset_from_last_field_sync, d_current_field); - - d_offset_from_last_field_sync += n; - nsamples -= n; - - if (nsamples > 0){ - if (WINNING_COMPILER) - filter (&input_samples[n], &input_tags[n], - &output_samples[n], nsamples); - else { - input_samples += n; - input_tags += n; - output_samples += n; - goto lame_compiler_kludge; - } - } - return; - } - - // OK, we're not in a field sync. We're either in a data segment sync or in the clear... - - int seg_offset = d_offset_from_last_field_sync % ATSC_DATA_SEGMENT_LENGTH; - - assert (seg_offset >= 0); - - if (seg_offset < 4){ // somewhere in a data seg sync. - int n = min (4 - seg_offset, nsamples); - - filter_data_seg_sync (input_samples, output_samples, n, seg_offset); - - d_offset_from_last_field_sync += n; - nsamples -= n; - - if (nsamples > 0){ - if (WINNING_COMPILER) - filter (&input_samples[n], &input_tags[n], - &output_samples[n], nsamples); - else { - input_samples += n; - input_tags += n; - output_samples += n; - goto lame_compiler_kludge; - } - } - return; - } - - // otherwise... we're in the normal zone - - int n = min (ATSC_DATA_SEGMENT_LENGTH - seg_offset, nsamples); - - filter_normal (input_samples, output_samples, n); - - d_offset_from_last_field_sync += n; - nsamples -= n; - - if (nsamples <= 0) - return; - - if (WINNING_COMPILER) - filter (&input_samples[n], &input_tags[n], - &output_samples[n], nsamples); - else { - input_samples += n; - input_tags += n; - output_samples += n; - goto lame_compiler_kludge; - } -} diff --git a/gr-atsc/src/lib/atsci_equalizer.h b/gr-atsc/src/lib/atsci_equalizer.h deleted file mode 100644 index b0c243b51..000000000 --- a/gr-atsc/src/lib/atsci_equalizer.h +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_EQUALIZER_H_ -#define _ATSC_EQUALIZER_H_ - -#include <atsc_api.h> -#include <atsci_syminfo.h> -#include <vector> - -/*! - * \brief abstract base class for ATSC equalizer - */ -class ATSC_API atsci_equalizer { - -private: - - /* - * have we seen a field sync since the last reset or problem? - */ - bool d_locked_p; - - /* - * sample offset from the beginning of the last field sync we saw - * to the beginning of our current input stream. When we're locked - * this will be in [0, 313*832] i.e., [0, 260416] - */ - int d_offset_from_last_field_sync; - - int d_current_field; // [0,1] - - -public: - - // CREATORS - atsci_equalizer (); - virtual ~atsci_equalizer (); - - virtual std::vector<double> taps () { - return std::vector<double>(); - } - - // MANIPULATORS - - /*! - * \brief reset state (e.g., on channel change) - * - * Note, subclasses must invoke the superclass's method too! - */ - virtual void reset (); - - /*! - * \brief produce \p nsamples of output from given inputs and tags - * - * This is the main entry point. It examines the input_tags - * and local state and invokes the appropriate virtual function - * to handle each sub-segment of the input data. - * - * \p input_samples must have (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] are - * referenced to compute the output values. - * - * \p input_tags must have nsamples valid entries. - * input_tags[0] .. input_tags[nsamples - 1] are referenced to - * compute the output values. - */ - virtual void filter (const float *input_samples, - const atsc::syminfo *input_tags, - float *output_samples, - int nsamples); - - // ACCESSORS - - /*! - * \brief how much history the input data stream requires. - * - * This must return a value >= 1. Think of this as the number - * of samples you need to look at to compute a single output sample. - */ - virtual int ntaps () const = 0; - - /*! - * \brief how many taps are "in the future". - * - * This allows us to handle what the ATSC folks call "pre-ghosts". - * What it really does is allow the caller to jack with the offset - * between the tags and the data so that everything magically works out. - * - * npretaps () must return a value between 0 and ntaps() - 1. - * - * If npretaps () returns 0, this means that the equalizer will only handle - * multipath "in the past." I suspect that a good value would be something - * like 15% - 20% of ntaps (). - */ - virtual int npretaps () const = 0; - - -protected: - - /*! - * Input range is known NOT TO CONTAIN data segment syncs - * or field syncs. This should be the fast path. In the - * non decicion directed case, this just runs the input - * through the filter without adapting it. - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ - virtual void filter_normal (const float *input_samples, - float *output_samples, - int nsamples) = 0; - - /*! - * Input range is known to consist of only a data segment sync or a - * portion of a data segment sync. \p nsamples will be in [1,4]. - * \p offset will be in [0,3]. \p offset is the offset of the input - * from the beginning of the data segment sync pattern. - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ - virtual void filter_data_seg_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset) = 0; - - /*! - * Input range is known to consist of only a field sync segment or a - * portion of a field sync segment. \p nsamples will be in [1,832]. - * \p offset will be in [0,831]. \p offset is the offset of the input - * from the beginning of the data segment sync pattern. We consider the - * 4 symbols of the immediately preceding data segment sync to be the - * first symbols of the field sync segment. \p which_field is in [0,1] - * and specifies which field (duh). - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ - virtual void filter_field_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset, - int which_field) = 0; -}; - - -#endif /* _ATSC_EQUALIZER_H_ */ diff --git a/gr-atsc/src/lib/atsci_equalizer_lms.cc b/gr-atsc/src/lib/atsci_equalizer_lms.cc deleted file mode 100644 index bab962e32..000000000 --- a/gr-atsc/src/lib/atsci_equalizer_lms.cc +++ /dev/null @@ -1,307 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_equalizer_lms.h> -#include <assert.h> -#include <algorithm> -#include <atsci_pnXXX.h> - -#include <stdio.h> - -using std::min; -using std::max; - -static const int NTAPS = 256; -static const int NPRETAPS = (int) (NTAPS * 0.8); // probably should be either .2 or .8 - - -// the length of the field sync pattern that we know unequivocally -static const int KNOWN_FIELD_SYNC_LENGTH = 4 + 511 + 3 * 63; - -// static const float *get_data_seg_sync_training_sequence (int offset); -static int get_field_sync_training_sequence_length (int offset); -static const float *get_field_sync_training_sequence (int which_field, int offset); - - -atsci_equalizer_lms::atsci_equalizer_lms () : d_taps (NTAPS) -{ - for (int i = 0; i < NTAPS; i++) { - d_taps[i] = 0.0; - } - trainingfile=fopen("taps.txt","w"); -} - -atsci_equalizer_lms::~atsci_equalizer_lms () -{ -} - -void -atsci_equalizer_lms::reset () -{ - atsci_equalizer::reset (); // invoke superclass - - for (int i = 0; i < NTAPS; i++) { - d_taps[i] = 0.0; - } -} - -int -atsci_equalizer_lms::ntaps () const -{ - return NTAPS; -} - -int -atsci_equalizer_lms::npretaps () const -{ - return NPRETAPS; -} - -/*! - * Input range is known NOT TO CONTAIN data segment syncs - * or field syncs. This should be the fast path. In the - * non decicion directed case, this just runs the input - * through the filter without adapting it. - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ -void -atsci_equalizer_lms::filter_normal (const float *input_samples, - float *output_samples, - int nsamples) -{ - // handle data - filterN (input_samples, output_samples, nsamples); -} - - -/*! - * Input range is known to consist of only a data segment sync or a - * portion of a data segment sync. \p nsamples will be in [1,4]. - * \p offset will be in [0,3]. \p offset is the offset of the input - * from the beginning of the data segment sync pattern. - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ -void -atsci_equalizer_lms::filter_data_seg_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset) -{ - // handle data - // adaptN (input_samples, get_data_seg_sync_training_sequence (offset), - // output_samples, nsamples); - filterN (input_samples, output_samples, nsamples); - - // cerr << "Seg Sync: offset " << offset << "\tnsamples\t" << nsamples << "\t pre, 5 -5 -5 5\t" << - // output_samples[0] << "\t" << output_samples[1] << "\t" << output_samples[2] << "\t" << output_samples[3] << endl; - -} - - -/*! - * Input range is known to consist of only a field sync segment or a - * portion of a field sync segment. \p nsamples will be in [1,832]. - * \p offset will be in [0,831]. \p offset is the offset of the input - * from the beginning of the data segment sync pattern. We consider the - * 4 symbols of the immediately preceding data segment sync to be the - * first symbols of the field sync segment. \p which_field is in [0,1] - * and specifies which field (duh). - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ -void -atsci_equalizer_lms::filter_field_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset, - int which_field) -{ - // Only the first 4 + 511 + 3 * 63 symbols are completely defined. - // Those after that the symbols are bilevel, so we could use decision feedback and use - // that to train, but for now, don't train on them. - - int n = min (nsamples, get_field_sync_training_sequence_length (offset)); - - // handle known training sequence - adaptN (input_samples, get_field_sync_training_sequence (which_field, offset), - output_samples, n); - - // just filter any unknown portion - if (nsamples > n) - filterN (&input_samples[n], &output_samples[n], nsamples - n); - - if (offset == 0 && nsamples > 0){ - for (int i = 0; i < NTAPS; i++) - fprintf(trainingfile,"%f ",d_taps[i]); - - fprintf (trainingfile,"\n"); - } - -} - -// ---------------------------------------------------------------- - -// -// filter a single output -// -float -atsci_equalizer_lms::filter1 (const float input[]) -{ - static const int N_UNROLL = 4; - - float acc0 = 0; - float acc1 = 0; - float acc2 = 0; - float acc3 = 0; - - - unsigned i = 0; - unsigned n = (NTAPS / N_UNROLL) * N_UNROLL; - - for (i = 0; i < n; i += N_UNROLL){ - acc0 += d_taps[i + 0] * input[i + 0]; - acc1 += d_taps[i + 1] * input[i + 1]; - acc2 += d_taps[i + 2] * input[i + 2]; - acc3 += d_taps[i + 3] * input[i + 3]; - } - - for (; i < (unsigned) NTAPS; i++) - acc0 += d_taps[i] * input[i]; - - return (acc0 + acc1 + acc2 + acc3); -} - -// -// filter and adapt a single output -// -float -atsci_equalizer_lms::adapt1 (const float input[], float ideal_output) -{ - static const double BETA = 0.00005; // FIXME figure out what this ought to be - // FIXME add gear-shifting - - double y = filter1 (input); - double e = y - ideal_output; - - // update taps... - for (int i = 0; i < NTAPS; i++){ - d_taps[i] = d_taps[i] - BETA * e * (double)(input[i]); - } - - return y; -} - -void -atsci_equalizer_lms::filterN (const float *input_samples, - float *output_samples, - int nsamples) -{ - for (int i = 0; i < nsamples; i++) - output_samples[i] = filter1 (&input_samples[i]); -} - - -void -atsci_equalizer_lms::adaptN (const float *input_samples, - const float *training_pattern, - float *output_samples, - int nsamples) -{ - for (int i = 0; i < nsamples; i++) - output_samples[i] = adapt1 (&input_samples[i], training_pattern[i]); -} - -// ---------------------------------------------------------------- - -static float -bin_map (int bit) -{ - return bit ? +5 : -5; -} - -static void -init_field_sync_common (float *p, int mask) - -{ - int i = 0; - - p[i++] = bin_map (1); // data segment sync pulse - p[i++] = bin_map (0); - p[i++] = bin_map (0); - p[i++] = bin_map (1); - - for (int j = 0; j < 511; j++) // PN511 - p[i++] = bin_map (atsc_pn511[j]); - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map (atsc_pn63[j]); - - for (int j = 0; j < 63; j++) // PN63, toggled on field 2 - p[i++] = bin_map (atsc_pn63[j] ^ mask); - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map (atsc_pn63[j]); - - assert (i == KNOWN_FIELD_SYNC_LENGTH); -} - -#if 0 -static const float * -get_data_seg_sync_training_sequence (int offset) -{ - static const float training_data[4] = { +5, -5, -5, +5 }; - return &training_data[offset]; -} -#endif - -static int -get_field_sync_training_sequence_length (int offset) -{ - return max (0, KNOWN_FIELD_SYNC_LENGTH - offset); -} - -static const float * -get_field_sync_training_sequence (int which_field, int offset) -{ - static float *field_1 = 0; - static float *field_2 = 0; - - if (field_1 == 0){ - field_1 = new float[KNOWN_FIELD_SYNC_LENGTH]; - field_2 = new float[KNOWN_FIELD_SYNC_LENGTH]; - init_field_sync_common (field_1, 0); - init_field_sync_common (field_2, 1); - } - - if (which_field == 0) - return &field_1[offset]; - else - return &field_2[offset]; -} diff --git a/gr-atsc/src/lib/atsci_equalizer_lms.h b/gr-atsc/src/lib/atsci_equalizer_lms.h deleted file mode 100644 index eac72f75b..000000000 --- a/gr-atsc/src/lib/atsci_equalizer_lms.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_EQUALIZER_LMS_H_ -#define _ATSC_EQUALIZER_LMS_H_ - -#include <atsc_api.h> -#include <atsci_equalizer.h> -#include <vector> -#include <stdio.h> - -class ATSC_API atsci_equalizer_lms : public atsci_equalizer -{ -public: - atsci_equalizer_lms (); - virtual ~atsci_equalizer_lms (); - - virtual void reset (); - virtual int ntaps () const; - virtual int npretaps () const; - std::vector<double> taps () { - return d_taps; - } - -protected: - FILE *trainingfile; - virtual void filter_normal (const float *input_samples, - float *output_samples, - int nsamples); - - virtual void filter_data_seg_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset); - - virtual void filter_field_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset, - int which_field); - -private: - std::vector<double> d_taps; - - void filterN (const float *input_samples, - float *output_samples, - int nsamples); - - void adaptN (const float *input_samples, - const float *training_pattern, - float *output_samples, - int nsamples); - - float filter1 (const float input[]); - float adapt1 (const float input[], float ideal_output); - -}; - - -#endif /* _ATSC_EQUALIZER_LMS_H_ */ diff --git a/gr-atsc/src/lib/atsci_equalizer_lms2.cc b/gr-atsc/src/lib/atsci_equalizer_lms2.cc deleted file mode 100644 index 2825aad50..000000000 --- a/gr-atsc/src/lib/atsci_equalizer_lms2.cc +++ /dev/null @@ -1,375 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_equalizer_lms2.h> -#include <assert.h> -#include <algorithm> -#include <atsci_pnXXX.h> -#include <cmath> -#include <stdlib.h> -#include <gr_math.h> -#include <stdio.h> -#include <boost/math/special_functions/fpclassify.hpp> - -using std::min; -using std::max; - -static const int NFFTAPS = 64; -static const int NFBTAPS = 192; - -// the length of the field sync pattern that we know unequivocally -static const int KNOWN_FIELD_SYNC_LENGTH = 4 + 511 + 3 * 63; - -// static const float *get_data_seg_sync_training_sequence (int offset); -static int get_field_sync_training_sequence_length (int offset); -static const float *get_field_sync_training_sequence (int which_field, int offset); - -static inline int -wrap (int d) -{ - assert (d >= 0 && d <= (2 * NFBTAPS)); - - if(d >= NFBTAPS) - return d - NFBTAPS; - return d; -} - -static inline float -slice (float d) -{ - if (boost::math::isnan (d)) - return 0.0; - - if (d >= 0.0){ - if (d >= 4.0){ - if (d >= 6.0) - return 7.0; - else - return 5.0; - } - if (d >= 2.0) - return 3.0; - return 1.0; - } - else - return -slice (-d); -} - -atsci_equalizer_lms2::atsci_equalizer_lms2 () - : d_taps_ff (NFFTAPS), d_taps_fb (NFBTAPS), d_old_output (NFBTAPS) -{ - for (int i = 0; i < NFFTAPS; i++) { - d_taps_ff[i] = 0.0; - } - for (int i = 0; i < NFBTAPS; i++) { - d_taps_fb[i] = 0.0; - d_old_output[i] = 0.0; - } - d_output_ptr = 0; - trainingfile=fopen("taps.txt","w"); -} - -atsci_equalizer_lms2::~atsci_equalizer_lms2 () -{ -} - -void -atsci_equalizer_lms2::reset () -{ - atsci_equalizer::reset (); // invoke superclass - for (int i = 0; i < NFFTAPS; i++) { - d_taps_ff[i] = 0.0; - } - for (int i = 0; i < NFBTAPS; i++) { - d_taps_fb[i] = 0.0; - d_old_output[i] = 0.0; - } - d_output_ptr = 0; -} - - -int -atsci_equalizer_lms2::ntaps () const -{ - return NFFTAPS + NFBTAPS; -} - -int -atsci_equalizer_lms2::npretaps () const -{ - return NFFTAPS; -} - -/*! - * Input range is known NOT TO CONTAIN data segment syncs - * or field syncs. This should be the fast path. In the - * non decicion directed case, this just runs the input - * through the filter without adapting it. - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ -void -atsci_equalizer_lms2::filter_normal (const float *input_samples, - float *output_samples, - int nsamples) -{ - // handle data - filterN (input_samples, output_samples, nsamples); -} - - -/*! - * Input range is known to consist of only a data segment sync or a - * portion of a data segment sync. \p nsamples will be in [1,4]. - * \p offset will be in [0,3]. \p offset is the offset of the input - * from the beginning of the data segment sync pattern. - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ -void -atsci_equalizer_lms2::filter_data_seg_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset) -{ - // handle data - // adaptN (input_samples, get_data_seg_sync_training_sequence (offset), - // output_samples, nsamples); - filterN (input_samples, output_samples, nsamples); - - // cerr << "Seg Sync: offset " << offset << "\tnsamples\t" << nsamples << "\t pre, 5 -5 -5 5\t" << - // output_samples[0] << "\t" << output_samples[1] << "\t" << output_samples[2] << "\t" << output_samples[3] << endl; - -} - - -/*! - * Input range is known to consist of only a field sync segment or a - * portion of a field sync segment. \p nsamples will be in [1,832]. - * \p offset will be in [0,831]. \p offset is the offset of the input - * from the beginning of the data segment sync pattern. We consider the - * 4 symbols of the immediately preceding data segment sync to be the - * first symbols of the field sync segment. \p which_field is in [0,1] - * and specifies which field (duh). - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ -void -atsci_equalizer_lms2::filter_field_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset, - int which_field) -{ - // Only the first 4 + 511 + 3 * 63 symbols are completely defined. - // Those after that the symbols are bilevel, so we could use decision feedback and use - // that to train, but for now, don't train on them. - - int n = min (nsamples, get_field_sync_training_sequence_length (offset)); - - // handle known training sequence - adaptN (input_samples, get_field_sync_training_sequence (which_field, offset), - output_samples, n); - - // just filter any unknown portion - if (nsamples > n) - filterN (&input_samples[n], &output_samples[n], nsamples - n); - - if (offset == 0 && nsamples > 0){ - for (int i = 0; i < NFFTAPS; i++) - fprintf(trainingfile,"%f ",d_taps_ff[i]); - for (int i = 0; i < NFBTAPS; i++) - fprintf(trainingfile,"%f ",d_taps_fb[i]); - fprintf (trainingfile,"\n"); - } - -} - -// ---------------------------------------------------------------- - -// -// filter a single output -// -float -atsci_equalizer_lms2::filter1 (const float input[]) -{ - static const int N_UNROLL = 4; - - float acc0 = 0; - float acc1 = 0; - float acc2 = 0; - float acc3 = 0; - float acc = 0; - - - unsigned i = 0; - unsigned n = (NFFTAPS / N_UNROLL) * N_UNROLL; - - for (i = 0; i < n; i += N_UNROLL){ - acc0 += d_taps_ff[i + 0] * input[i + 0]; - acc1 += d_taps_ff[i + 1] * input[i + 1]; - acc2 += d_taps_ff[i + 2] * input[i + 2]; - acc3 += d_taps_ff[i + 3] * input[i + 3]; - } - - for (; i < (unsigned) NFFTAPS; i++) - acc0 += d_taps_ff[i] * input[i]; - - acc = (acc0 + acc1 + acc2 + acc3); - - d_output_ptr = wrap (d_output_ptr + 1); - - for (int i = 0; i < NFBTAPS; i++) { - acc -= d_taps_fb[i] * d_old_output[wrap(i + d_output_ptr)]; - } - - if (boost::math::isnan (acc)){ - abort (); - } - - d_old_output[d_output_ptr] = slice (acc); - return acc; -} - -// -// filter and adapt a single output -// -float kludge () -{ - return 0.0; -} - -float -atsci_equalizer_lms2::adapt1 (const float input[], float ideal_output) -{ - static const double BETA = 0.00005; // FIXME figure out what this ought to be - // FIXME add gear-shifting - - double y = filter1 (input); - double e = y - ideal_output; - - // update taps... - for (int i = 0; i < NFFTAPS; i++){ - d_taps_ff[i] = d_taps_ff[i] - BETA * e * (double)(input[i]); - } - - for (int i = 0; i < NFBTAPS; i++){ - // d_taps_fb[i] = d_taps_fb[i] - BETA * e * (double)d_old_output[wrap(i+d_output_ptr)]; - d_taps_fb[i] = d_taps_fb[i] - kludge() * e * (double)d_old_output[wrap(i+d_output_ptr)]; - } - - return y; -} - -void -atsci_equalizer_lms2::filterN (const float *input_samples, - float *output_samples, - int nsamples) -{ - for (int i = 0; i < nsamples; i++) - output_samples[i] = filter1 (&input_samples[i]); -} - - -void -atsci_equalizer_lms2::adaptN (const float *input_samples, - const float *training_pattern, - float *output_samples, - int nsamples) -{ - for (int i = 0; i < nsamples; i++) - output_samples[i] = adapt1 (&input_samples[i], training_pattern[i]); -} - -// ---------------------------------------------------------------- - -static float -bin_map (int bit) -{ - return bit ? +5 : -5; -} - -static void -init_field_sync_common (float *p, int mask) - -{ - int i = 0; - - p[i++] = bin_map (1); // data segment sync pulse - p[i++] = bin_map (0); - p[i++] = bin_map (0); - p[i++] = bin_map (1); - - for (int j = 0; j < 511; j++) // PN511 - p[i++] = bin_map (atsc_pn511[j]); - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map (atsc_pn63[j]); - - for (int j = 0; j < 63; j++) // PN63, toggled on field 2 - p[i++] = bin_map (atsc_pn63[j] ^ mask); - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map (atsc_pn63[j]); - - assert (i == KNOWN_FIELD_SYNC_LENGTH); -} - -#if 0 -static const float * -get_data_seg_sync_training_sequence (int offset) -{ - static const float training_data[4] = { +5, -5, -5, +5 }; - return &training_data[offset]; -} -#endif - -static int -get_field_sync_training_sequence_length (int offset) -{ - return max (0, KNOWN_FIELD_SYNC_LENGTH - offset); -} - -static const float * -get_field_sync_training_sequence (int which_field, int offset) -{ - static float *field_1 = 0; - static float *field_2 = 0; - - if (field_1 == 0){ - field_1 = new float[KNOWN_FIELD_SYNC_LENGTH]; - field_2 = new float[KNOWN_FIELD_SYNC_LENGTH]; - init_field_sync_common (field_1, 0); - init_field_sync_common (field_2, 1); - } - - if (which_field == 0) - return &field_1[offset]; - else - return &field_2[offset]; -} diff --git a/gr-atsc/src/lib/atsci_equalizer_lms2.h b/gr-atsc/src/lib/atsci_equalizer_lms2.h deleted file mode 100644 index d0f2660d5..000000000 --- a/gr-atsc/src/lib/atsci_equalizer_lms2.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_EQUALIZER_LMS2_H_ -#define _ATSC_EQUALIZER_LMS2_H_ - -#include <atsc_api.h> -#include <atsci_equalizer.h> -#include <vector> -#include <stdio.h> - -class ATSC_API atsci_equalizer_lms2 : public atsci_equalizer -{ -public: - atsci_equalizer_lms2 (); - virtual ~atsci_equalizer_lms2 (); - - virtual void reset (); - virtual int ntaps () const; - virtual int npretaps () const; - -protected: - FILE *trainingfile; - virtual void filter_normal (const float *input_samples, - float *output_samples, - int nsamples); - - virtual void filter_data_seg_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset); - - virtual void filter_field_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset, - int which_field); - -private: - std::vector<double> d_taps_ff; - std::vector<double> d_taps_fb; - std::vector<float> d_old_output; - - int d_output_ptr; - - void filterN (const float *input_samples, - float *output_samples, - int nsamples); - - void adaptN (const float *input_samples, - const float *training_pattern, - float *output_samples, - int nsamples); - - float filter1 (const float input[]); - float adapt1 (const float input[], float ideal_output); - -}; - - -#endif /* _ATSC_EQUALIZER_LMS2_H_ */ diff --git a/gr-atsc/src/lib/atsci_equalizer_nop.cc b/gr-atsc/src/lib/atsci_equalizer_nop.cc deleted file mode 100644 index 5af2cc4e7..000000000 --- a/gr-atsc/src/lib/atsci_equalizer_nop.cc +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_equalizer_nop.h> -#include <atsci_sync_tag.h> -#include <assert.h> - -atsci_equalizer_nop::atsci_equalizer_nop () -{ -} - -atsci_equalizer_nop::~atsci_equalizer_nop () -{ -} - -void -atsci_equalizer_nop::reset () -{ - atsci_equalizer::reset (); // invoke superclass -} - -int -atsci_equalizer_nop::ntaps () const -{ - return 1; -} - -int -atsci_equalizer_nop::npretaps () const -{ - return 0; -} - -/*! - * Input range is known NOT TO CONTAIN data segment syncs - * or field syncs. This should be the fast path. In the - * non decicion directed case, this just runs the input - * through the filter without adapting it. - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ -void -atsci_equalizer_nop::filter_normal (const float *input_samples, - float *output_samples, - int nsamples) -{ - for (int i = 0; i < nsamples; i++){ - output_samples[i] = scale (input_samples[i]); - } -} - - -/*! - * Input range is known to consist of only a data segment sync or a - * portion of a data segment sync. \p nsamples will be in [1,4]. - * \p offset will be in [0,3]. \p offset is the offset of the input - * from the beginning of the data segment sync pattern. - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ -void -atsci_equalizer_nop::filter_data_seg_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset) -{ - for (int i = 0; i < nsamples; i++){ - output_samples[i] = scale_and_train (input_samples[i]); - } -} - - -/*! - * Input range is known to consist of only a field sync segment or a - * portion of a field sync segment. \p nsamples will be in [1,832]. - * \p offset will be in [0,831]. \p offset is the offset of the input - * from the beginning of the data segment sync pattern. We consider the - * 4 symbols of the immediately preceding data segment sync to be the - * first symbols of the field sync segment. \p which_field is in [0,1] - * and specifies which field (duh). - * - * \p input_samples has (nsamples + ntaps() - 1) valid entries. - * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be - * referenced to compute the output values. - */ -void -atsci_equalizer_nop::filter_field_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset, - int which_field) -{ - int i = 0; - - if (offset == 0 && nsamples > 0){ - output_samples[0] = scale_and_train (input_samples[0]); - i++; - } - - for (; i < nsamples; i++){ - output_samples[i] = scale_and_train (input_samples[i]); - } -} - - -float -atsci_equalizer_nop::scale_and_train (float input) -{ - return input; -} diff --git a/gr-atsc/src/lib/atsci_equalizer_nop.h b/gr-atsc/src/lib/atsci_equalizer_nop.h deleted file mode 100644 index d29fded64..000000000 --- a/gr-atsc/src/lib/atsci_equalizer_nop.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_EQUALIZER_NOP_H_ -#define _ATSC_EQUALIZER_NOP_H_ - -#include <atsc_api.h> -#include <atsci_equalizer.h> - -class ATSC_API atsci_equalizer_nop : public atsci_equalizer -{ -private: - float scale (float input) { return input; } - - float scale_and_train (float input); - - -public: - atsci_equalizer_nop (); - virtual ~atsci_equalizer_nop (); - - virtual void reset (); - virtual int ntaps () const; - virtual int npretaps () const; - -protected: - virtual void filter_normal (const float *input_samples, - float *output_samples, - int nsamples); - - virtual void filter_data_seg_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset); - - virtual void filter_field_sync (const float *input_samples, - float *output_samples, - int nsamples, - int offset, - int which_field); -}; - - -#endif /* _ATSC_EQUALIZER_NOP_H_ */ diff --git a/gr-atsc/src/lib/atsci_exp2_lp.cc b/gr-atsc/src/lib/atsci_exp2_lp.cc deleted file mode 100644 index 8f411977e..000000000 --- a/gr-atsc/src/lib/atsci_exp2_lp.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsc_consts.h> -#include <atsci_exp2_lp.h> -#include <stdexcept> -#include <cmath> -#include <iostream> - -using std::vector; -using std::cerr; -using std::endl; - -/* - * FILTER SPECIFICATION FILE - * FILTER TYPE:LOW PASS 1H - * PASSBAND RIPPLE IN -dB -.0100 - * STOPBAND RIPPLE IN -dB -66.0000 - * PASSBAND CUTOFF FREQUENCY 5.69000 HERTZ - * STOPBAND CUTOFF FREQUENCY 6.12000 HERTZ - * SAMPLING FREQUENCY 21.5200 HERTZ - */ -static const float atsci_exp2_lp2x[] = { -#include "atsci_exp2_lp2x.dat" -}; - -/* - * FILTER SPECIFICATION FILE - * FILTER TYPE:LOW PASS 1H - * PASSBAND RIPPLE IN -dB -.0100 - * STOPBAND RIPPLE IN -dB -66.0000 - * PASSBAND CUTOFF FREQUENCY 5.69000 HERTZ - * STOPBAND CUTOFF FREQUENCY 6.12000 HERTZ - * SAMPLING FREQUENCY 20.0000 HERTZ - */ -static const float atsci_exp2_lp20[] = { -#include "atsci_exp2_lp20.dat" -}; - - -#define NELEM(x) (sizeof (x) / sizeof ((x)[0])) - -// is A within 5% of TARGET? - -static bool -close_enough_p (double a, double target) -{ - double delta = fabs (target * 0.05); // 5 percent - - return fabs (target - a) <= delta; -} - -vector<float> -atsci_exp2_lp::taps (double sampling_freq) -{ - if (close_enough_p (sampling_freq, 20e6)){ - return vector<float>(&atsci_exp2_lp20[0], &atsci_exp2_lp20[NELEM(atsci_exp2_lp20)]); - } - if (close_enough_p (sampling_freq, 2 * ATSC_SYMBOL_RATE)){ - return vector<float>(&atsci_exp2_lp2x[0], &atsci_exp2_lp2x[NELEM(atsci_exp2_lp2x)]); - } - else - throw std::out_of_range ( - "atsci_exp2_lp: no pre-designed filter close enough"); -} diff --git a/gr-atsc/src/lib/atsci_exp2_lp.h b/gr-atsc/src/lib/atsci_exp2_lp.h deleted file mode 100644 index e04c42528..000000000 --- a/gr-atsc/src/lib/atsci_exp2_lp.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_EXP2_LP_H_ -#define _ATSC_EXP2_LP_H_ - -#include <atsc_api.h> -#include <gr_fir_builder.h> - -class ATSC_API atsci_exp2_lp : public gr_fir_builder -{ -public: - virtual std::vector<float> taps (double sampling_freq); -}; - -#endif /* _ATSC_EXP2_LP_H_ */ diff --git a/gr-atsc/src/lib/atsci_exp2_lp20.dat b/gr-atsc/src/lib/atsci_exp2_lp20.dat deleted file mode 100644 index d09c5aca2..000000000 --- a/gr-atsc/src/lib/atsci_exp2_lp20.dat +++ /dev/null @@ -1,178 +0,0 @@ -/* - * FILTER SPECIFICATION FILE - * FILTER TYPE:LOW PASS 1H - * PASSBAND RIPPLE IN -dB -.0100 - * STOPBAND RIPPLE IN -dB -66.0000 - * PASSBAND CUTOFF FREQUENCY 5.69000 HERTZ - * STOPBAND CUTOFF FREQUENCY 6.12000 HERTZ - * SAMPLING FREQUENCY 20.0000 HERTZ - */ - -.3137849271297455e-03, - -.6755953654646874e-04, - .2326252870261669e-03, - -.1614624634385109e-03, - -.1158984377980232e-03, - .2114051021635532e-03, - .6828224286437035e-04, - -.3522797487676144e-03, - .1759170554578304e-03, - .2849949523806572e-03, - -.3568925894796848e-03, - -.1521380618214607e-03, - .5445396527647972e-03, - -.1707794144749641e-03, - -.5257474258542061e-03, - .5062967538833618e-03, - .3262492828071117e-03, - -.8037807419896126e-03, - .1136297360062599e-03, - .8607362397015095e-03, - -.6433278322219849e-03, - -.6174184381961823e-03, - .1120670232921839e-02, - .3442214801907539e-04, - -.1305819023400545e-02, - .7387576624751091e-03, - .1056550536304712e-02, - -.1477979123592377e-02, - -.3192713484168053e-03, - .1870564185082912e-02, - -.7502869702875614e-03, - -.1675266306847334e-02, - .1847642473876476e-02, - .7931739091873169e-03, - -.2555002458393574e-02, - .6227688863873482e-03, - .2505954820662737e-02, - -.2186967991292477e-02, - -.1515555195510387e-02, - .3349546808749437e-02, - -.2860687673091888e-03, - -.3578922711312771e-02, - .2438103780150414e-02, - .2555412705987692e-02, - -.4232846200466156e-02, - -.3483905456960201e-03, - .4926202818751335e-02, - -.2523601986467838e-02, - -.3997647203505039e-02, - .5173782818019390e-02, - .1395780127495527e-02, - -.6588382180780172e-02, - .2339247148483992e-02, - .5959283560514450e-02, - -.6131949834525585e-02, - -.3020572476089001e-02, - .8632841985672712e-02, - -.1736589241772890e-02, - -.8627892937511206e-02, - .7060498464852572e-02, - .5489445291459560e-02, - -.1119629153981805e-01, - .4754690453410149e-03, - .1235919492319226e-01, - -.7909852080047131e-02, - -.9316097479313612e-02, - .1459939032793045e-01, - .1910720951855183e-02, - -.1796151325106621e-01, - .8631225209683180e-02, - .1572139468044043e-01, - -.1972115319222212e-01, - -.6601144559681416e-02, - .2775513892993331e-01, - -.9181375615298748e-02, - -.2863558568060398e-01, - .2976502152159810e-01, - .1806837785989046e-01, - -.5192282795906067e-01, - .9526194538921118e-02, - .7172224065288901e-01, - -.6965141417458654e-01, - -.8541030902415514e-01, - .3052920936606824e+00, - .5900069065392017e+00, - .3052920936606824e+00, - -.8541030902415514e-01, - -.6965141417458654e-01, - .7172224065288901e-01, - .9526194538921118e-02, - -.5192282795906067e-01, - .1806837785989046e-01, - .2976502152159810e-01, - -.2863558568060398e-01, - -.9181375615298748e-02, - .2775513892993331e-01, - -.6601144559681416e-02, - -.1972115319222212e-01, - .1572139468044043e-01, - .8631225209683180e-02, - -.1796151325106621e-01, - .1910720951855183e-02, - .1459939032793045e-01, - -.9316097479313612e-02, - -.7909852080047131e-02, - .1235919492319226e-01, - .4754690453410149e-03, - -.1119629153981805e-01, - .5489445291459560e-02, - .7060498464852572e-02, - -.8627892937511206e-02, - -.1736589241772890e-02, - .8632841985672712e-02, - -.3020572476089001e-02, - -.6131949834525585e-02, - .5959283560514450e-02, - .2339247148483992e-02, - -.6588382180780172e-02, - .1395780127495527e-02, - .5173782818019390e-02, - -.3997647203505039e-02, - -.2523601986467838e-02, - .4926202818751335e-02, - -.3483905456960201e-03, - -.4232846200466156e-02, - .2555412705987692e-02, - .2438103780150414e-02, - -.3578922711312771e-02, - -.2860687673091888e-03, - .3349546808749437e-02, - -.1515555195510387e-02, - -.2186967991292477e-02, - .2505954820662737e-02, - .6227688863873482e-03, - -.2555002458393574e-02, - .7931739091873169e-03, - .1847642473876476e-02, - -.1675266306847334e-02, - -.7502869702875614e-03, - .1870564185082912e-02, - -.3192713484168053e-03, - -.1477979123592377e-02, - .1056550536304712e-02, - .7387576624751091e-03, - -.1305819023400545e-02, - .3442214801907539e-04, - .1120670232921839e-02, - -.6174184381961823e-03, - -.6433278322219849e-03, - .8607362397015095e-03, - .1136297360062599e-03, - -.8037807419896126e-03, - .3262492828071117e-03, - .5062967538833618e-03, - -.5257474258542061e-03, - -.1707794144749641e-03, - .5445396527647972e-03, - -.1521380618214607e-03, - -.3568925894796848e-03, - .2849949523806572e-03, - .1759170554578304e-03, - -.3522797487676144e-03, - .6828224286437035e-04, - .2114051021635532e-03, - -.1158984377980232e-03, - -.1614624634385109e-03, - .2326252870261669e-03, - -.6755953654646874e-04, - -.3137849271297455e-03 diff --git a/gr-atsc/src/lib/atsci_exp2_lp2x.dat b/gr-atsc/src/lib/atsci_exp2_lp2x.dat deleted file mode 100644 index 67dd204cb..000000000 --- a/gr-atsc/src/lib/atsci_exp2_lp2x.dat +++ /dev/null @@ -1,196 +0,0 @@ -/* - * FILTER SPECIFICATION FILE - * FILTER TYPE:LOW PASS 1H - * PASSBAND RIPPLE IN -dB -.0100 - * STOPBAND RIPPLE IN -dB -66.0000 - * PASSBAND CUTOFF FREQUENCY 5.69000 HERTZ - * STOPBAND CUTOFF FREQUENCY 6.12000 HERTZ - * SAMPLING FREQUENCY 21.5200 HERTZ - */ - -/* - * probably total overkill... -*/ - -.8815620094537735E-04, - -.3356961533427239E-03, - .1227599568665028E-03, - .1281457953155041E-03, - -.1479196362197399E-03, - -.1201131381094456E-03, - .2271742559969425E-03, - .6969040259718895E-04, - -.3000237047672272E-03, - .1565506681799889E-04, - .3562141209840775E-03, - -.1368308439850807E-03, - -.3795824013650417E-03, - .2876669168472290E-03, - .3540110774338245E-03, - -.4550744779407978E-03, - -.2659554593265057E-03, - .6190738640725613E-03, - .1072990708053112E-03, - -.7539116777479649E-03, - .1217066310346127E-03, - .8306214585900307E-03, - -.4104166291654110E-03, - -.8203103207051754E-03, - .7365280762314796E-03, - .6983750499784946E-03, - -.1066216267645359E-02, - -.4491899162530899E-03, - .1356074586510658E-02, - .7050111889839172E-04, - -.1556793693453074E-02, - .4230584017932415E-03, - .1618413720279932E-02, - -.9978362359106541E-03, - -.1497142482548952E-02, - .1601643394678831E-02, - .1162088476121426E-02, - -.2165937330573797E-02, - -.6025419570505619E-03, - .2611500211060047E-02, - -.1667905598878861E-03, - -.2855417784303427E-02, - .1101639121770859E-02, - .2821092493832111E-02, - -.2127973828464747E-02, - -.2448682673275471E-02, - .3145063761621714E-02, - .1706911250948906E-02, - -.4030079115182161E-02, - -.5993186496198177E-03, - .4651836119592190E-02, - -.8259965106844902E-03, - -.4880243912339211E-02, - .2475241199135780E-02, - .4603198729455471E-02, - -.4209769889712334E-02, - -.3741886932402849E-02, - .5853117443621159E-02, - .2264967188239098E-02, - -.7202429696917534E-02, - -.2001645043492317E-03, - .8043776731938124E-02, - -.2357403747737408E-02, - -.8171265944838524E-02, - .5242727231234312E-02, - .7407441269606352E-02, - -.8224328979849815E-02, - -.5622585304081440E-02, - .1101253507658839E-01, - .2751644235104322E-02, - -.1327139046043158E-01, - .1191724557429552E-02, - .1463502133265138E-01, - -.6110311951488257E-02, - -.1471871789544821E-01, - .1182264182716608E-01, - .1312375022098422E-01, - -.1807126961648464E-01, - -.9420783724635840E-02, - .2453883877024055E-01, - .3084233496338129E-02, - -.3086851537227631E-01, - .6689148955047131E-02, - .3669126378372312E-01, - -.2150753932073712E-01, - -.4165294021368027E-01, - .4559329804033041E-01, - .4544338863343000E-01, - -.9483475470915437E-01, - -.4782041534781456E-01, - .3143207929097116E+00, - .5483355415053666E+00, - .3143207929097116E+00, - -.4782041534781456E-01, - -.9483475470915437E-01, - .4544338863343000E-01, - .4559329804033041E-01, - -.4165294021368027E-01, - -.2150753932073712E-01, - .3669126378372312E-01, - .6689148955047131E-02, - -.3086851537227631E-01, - .3084233496338129E-02, - .2453883877024055E-01, - -.9420783724635840E-02, - -.1807126961648464E-01, - .1312375022098422E-01, - .1182264182716608E-01, - -.1471871789544821E-01, - -.6110311951488257E-02, - .1463502133265138E-01, - .1191724557429552E-02, - -.1327139046043158E-01, - .2751644235104322E-02, - .1101253507658839E-01, - -.5622585304081440E-02, - -.8224328979849815E-02, - .7407441269606352E-02, - .5242727231234312E-02, - -.8171265944838524E-02, - -.2357403747737408E-02, - .8043776731938124E-02, - -.2001645043492317E-03, - -.7202429696917534E-02, - .2264967188239098E-02, - .5853117443621159E-02, - -.3741886932402849E-02, - -.4209769889712334E-02, - .4603198729455471E-02, - .2475241199135780E-02, - -.4880243912339211E-02, - -.8259965106844902E-03, - .4651836119592190E-02, - -.5993186496198177E-03, - -.4030079115182161E-02, - .1706911250948906E-02, - .3145063761621714E-02, - -.2448682673275471E-02, - -.2127973828464747E-02, - .2821092493832111E-02, - .1101639121770859E-02, - -.2855417784303427E-02, - -.1667905598878861E-03, - .2611500211060047E-02, - -.6025419570505619E-03, - -.2165937330573797E-02, - .1162088476121426E-02, - .1601643394678831E-02, - -.1497142482548952E-02, - -.9978362359106541E-03, - .1618413720279932E-02, - .4230584017932415E-03, - -.1556793693453074E-02, - .7050111889839172E-04, - .1356074586510658E-02, - -.4491899162530899E-03, - -.1066216267645359E-02, - .6983750499784946E-03, - .7365280762314796E-03, - -.8203103207051754E-03, - -.4104166291654110E-03, - .8306214585900307E-03, - .1217066310346127E-03, - -.7539116777479649E-03, - .1072990708053112E-03, - .6190738640725613E-03, - -.2659554593265057E-03, - -.4550744779407978E-03, - .3540110774338245E-03, - .2876669168472290E-03, - -.3795824013650417E-03, - -.1368308439850807E-03, - .3562141209840775E-03, - .1565506681799889E-04, - -.3000237047672272E-03, - .6969040259718895E-04, - .2271742559969425E-03, - -.1201131381094456E-03, - -.1479196362197399E-03, - .1281457953155041E-03, - .1227599568665028E-03, - -.3356961533427239E-03, - -.8815620094537735E-04 diff --git a/gr-atsc/src/lib/atsci_fake_single_viterbi.cc b/gr-atsc/src/lib/atsci_fake_single_viterbi.cc deleted file mode 100644 index 6246a9050..000000000 --- a/gr-atsc/src/lib/atsci_fake_single_viterbi.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <math.h> -#include <atsci_fake_single_viterbi.h> -#include <iostream> -#include <algorithm> - -using std::cerr; -using std::cout; - -void -atsci_fake_single_viterbi::reset() -{ - post_coder_state = 0; -} - -atsci_fake_single_viterbi::atsci_fake_single_viterbi() -{ - reset(); -} - -/* - * implement simple slicer and post coder - */ -char -atsci_fake_single_viterbi::decode (float input) -{ - int y2, y1; - - if (input < -4){ - y2 = 0; - y1 = 0; - } - else if (input < 0){ - y2 = 0; - y1 = 1; - } - else if (input < 4){ - y2 = 1; - y1 = 0; - } - else { - y2 = 1; - y1 = 1; - } - - int x1 = y1; - int x2 = y2 ^ post_coder_state; - post_coder_state = y2; - - return (x2 << 1) | x1; -} diff --git a/gr-atsc/src/lib/atsci_fake_single_viterbi.h b/gr-atsc/src/lib/atsci_fake_single_viterbi.h deleted file mode 100644 index 561afb3d3..000000000 --- a/gr-atsc/src/lib/atsci_fake_single_viterbi.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSCFAKESINGLEVITERBI_H_ -#define _ATSCFAKESINGLEVITERBI_H_ - -#include <atsc_api.h> - -/*! - * \brief single channel viterbi decoder - */ -class ATSC_API atsci_fake_single_viterbi -{ - -public: - atsci_fake_single_viterbi (); - - /*! - * \p INPUT ideally takes on the values +/- 1,3,5,7 - * return is decoded dibit in the range [0, 3] - */ - char decode (float input); - - void reset (); - - //! internal delay of decoder - int delay () { return 0; } - -protected: - int post_coder_state; -}; - -#endif diff --git a/gr-atsc/src/lib/atsci_fs_checker.cc b/gr-atsc/src/lib/atsci_fs_checker.cc deleted file mode 100644 index 7d321307c..000000000 --- a/gr-atsc/src/lib/atsci_fs_checker.cc +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_fs_checker.h> - -// empty constructor -atsci_fs_checker::atsci_fs_checker () -{ -} - -// empty virtual destructor -atsci_fs_checker::~atsci_fs_checker () -{ -} diff --git a/gr-atsc/src/lib/atsci_fs_checker.h b/gr-atsc/src/lib/atsci_fs_checker.h deleted file mode 100644 index 7a426b742..000000000 --- a/gr-atsc/src/lib/atsci_fs_checker.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_FS_CHECKER_H_ -#define _ATSC_FS_CHECKER_H_ - -#include <atsc_api.h> -#include <atsci_syminfo.h> - -/*! - * \brief abstract base class for ATSC field sync checker - * - * Processes input samples one at a time looking for - * an occurence of either the field sync 1 or field sync 2 pattern. - * - * Note that unlike atsci_fs_correlator, this class uses the symbol_num in - * input_tag to avoid having to test each symbol position. - * - * For each sample processed, an output sample and an output tag are produced. - * The output samples are identical to the input samples but are delayed by - * a number of samples given by \p delay(). The output tag associated with - * the the given output sample indicates whether this sample is the beginning - * of one of the field syncs or is an ordinary sample. The tags are defined in - * atsci_sync_tag.h. - * - * For ease of use, the field sync patterns are defined to begin with the - * first symbol of the 4 symbol data segment sync pattern that immediately - * proceeds the actual PN 511 code. This makes it easier for downstream code - * to determine the location of data segment syncs merely by counting. They'll - * occur every 832 samples assuming everything is working. - */ - -class ATSC_API atsci_fs_checker { - -public: - - // CREATORS - atsci_fs_checker (); - virtual ~atsci_fs_checker () = 0; - - // MANIPULATORS - virtual void reset () = 0; - virtual void filter (float input_sample, atsc::syminfo input_tag, - float *output_sample, atsc::syminfo *output_tag) = 0; - - // ACCESSORS - - //! return delay in samples from input to output - virtual int delay () const = 0; -}; - -#endif /* _ATSC_FS_CHECKER_H_ */ diff --git a/gr-atsc/src/lib/atsci_fs_checker_naive.cc b/gr-atsc/src/lib/atsci_fs_checker_naive.cc deleted file mode 100644 index f14472aa2..000000000 --- a/gr-atsc/src/lib/atsci_fs_checker_naive.cc +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_fs_checker_naive.h> -#include <atsci_syminfo.h> -#include <atsci_pnXXX.h> -#include <iostream> -#include <cstring> - -using std::cerr; -using std::endl; - -static const int PN511_ERROR_LIMIT = 20; // max number of bits wrong -static const int PN63_ERROR_LIMIT = 5; - -unsigned char atsci_fs_checker_naive::s_511[LENGTH_511]; -unsigned char atsci_fs_checker_naive::s_63[LENGTH_2ND_63]; - -static void -init_s_511 (unsigned char *p) -{ - *p++ = 1; // data segment sync pattern - *p++ = 0; - *p++ = 0; - *p++ = 1; - - for (int i = 0; i < 511; i++){ - p[i] = atsc_pn511[i]; - } -} - -static void -init_s_63 (unsigned char *p) -{ - for (int i = 0; i < 63; i++){ - p[i] = atsc_pn63[i]; - } -} - -atsci_fs_checker_naive::atsci_fs_checker_naive () -{ - init_s_511 (s_511); - init_s_63 (s_63); - reset (); -} - -atsci_fs_checker_naive::~atsci_fs_checker_naive () -{ -} - -void -atsci_fs_checker_naive::reset () -{ - d_index = 0; - memset (d_sample_sr, 0, sizeof (d_sample_sr)); - memset (d_tag_sr, 0, sizeof (d_tag_sr)); - memset (d_bit_sr, 0, sizeof (d_bit_sr)); - d_field_num = 0; - d_segment_num = 0; -} - -void -atsci_fs_checker_naive::filter (float input_sample, atsc::syminfo input_tag, - float *output_sample, atsc::syminfo *output_tag) -{ - atsc::syminfo proto_tag = d_tag_sr[d_index]; // oldest tag in the queue - - if (proto_tag.symbol_num == 0){ // check for field sync pattern - - d_segment_num = (d_segment_num + 1) & atsc::SI_SEGMENT_NUM_MASK; // increment - - // check for a hit on the PN 511 pattern - int errors = 0; - int start = wrap (d_index + OFFSET_511); - - for (int i = 0; i < LENGTH_511 && errors < PN511_ERROR_LIMIT; i++) - errors += d_bit_sr[wrap (start + i)] ^ s_511[i]; - - if (errors < PN511_ERROR_LIMIT){ // 511 pattern is good. - // determine if this is field 1 or field 2 - errors = 0; - start = wrap (d_index + OFFSET_2ND_63); - for (int i = 0; i < LENGTH_2ND_63; i++) - errors += d_bit_sr[wrap (start + i)] ^ s_63[i]; - - // we should have either field 1 (== PN63) or field 2 (== ~PN63) - - if (errors <= PN63_ERROR_LIMIT){ - d_segment_num = atsc::SI_FIELD_SYNC_SEGMENT_NUM; // this is FIELD_SYNC_1 - d_field_num = 0; - } - else if (errors >= (LENGTH_2ND_63 - PN63_ERROR_LIMIT)){ - d_segment_num = atsc::SI_FIELD_SYNC_SEGMENT_NUM; // this is FIELD_SYNC_2 - d_field_num = 1; - } - else { - // should be extremely rare. - cerr << "!!! atsci_fs_checker_naive: PN63 error count = " << errors << endl; - } - } - } - - proto_tag.segment_num = d_segment_num; // fill in segment number and field number - proto_tag.field_num = d_field_num; - - // return oldest sample - *output_sample = d_sample_sr[d_index]; - *output_tag = proto_tag; - - // overwrite with newest sample; - d_sample_sr[d_index] = input_sample; - d_bit_sr[d_index] = input_sample < 0 ? 0 : 1; - d_tag_sr[d_index] = input_tag; - d_index = incr (d_index); -} - -int -atsci_fs_checker_naive::delay () const -{ - return SRSIZE; -} diff --git a/gr-atsc/src/lib/atsci_fs_checker_naive.h b/gr-atsc/src/lib/atsci_fs_checker_naive.h deleted file mode 100644 index 21c628a1d..000000000 --- a/gr-atsc/src/lib/atsci_fs_checker_naive.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_FS_CHECKER_NAIVE_H_ -#define _ATSC_FS_CHECKER_NAIVE_H_ - -#include <atsc_api.h> -#include <atsci_fs_checker.h> - -/*! - * \brief Naive concrete implementation of field sync checker - */ -class ATSC_API atsci_fs_checker_naive : public atsci_fs_checker { - - private: - static const int SRSIZE = 1024; // must be power of two - int d_index; // points at oldest sample - float d_sample_sr[SRSIZE]; // sample shift register - atsc::syminfo d_tag_sr[SRSIZE]; // tag shift register - unsigned char d_bit_sr[SRSIZE]; // binary decision shift register - int d_field_num; - int d_segment_num; - - static const int OFFSET_511 = 0; // offset to PN 511 pattern - static const int LENGTH_511 = 511 + 4; // length of PN 511 pattern (+ 4 seg sync) - static const int OFFSET_2ND_63 = 578; // offset to second PN 63 pattern - static const int LENGTH_2ND_63 = 63; // length of PN 63 pattern - - static unsigned char s_511[LENGTH_511]; // PN 511 pattern - static unsigned char s_63[LENGTH_2ND_63]; // PN 63 pattern - - inline static int wrap (int index){ return index & (SRSIZE - 1); } - inline static int incr (int index){ return wrap (index + 1); } - inline static int decr (int index){ return wrap (index - 1); } - - public: - - // CREATORS - atsci_fs_checker_naive (); - ~atsci_fs_checker_naive (); - - // MANIPULATORS - virtual void reset (); - void filter (float input_sample, atsc::syminfo input_tag, - float *output_sample, atsc::syminfo *output_tag); - - // ACCESSORS - - //! return delay in samples from input to output - int delay () const; - -}; - - -#endif /* _ATSC_FS_CHECKER_NAIVE_H_ */ diff --git a/gr-atsc/src/lib/atsci_fs_correlator.cc b/gr-atsc/src/lib/atsci_fs_correlator.cc deleted file mode 100644 index efeb35176..000000000 --- a/gr-atsc/src/lib/atsci_fs_correlator.cc +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_fs_correlator.h> - -// empty constructor -atsci_fs_correlator::atsci_fs_correlator () -{ -} - -// empty virtual destructor -atsci_fs_correlator::~atsci_fs_correlator () -{ -} diff --git a/gr-atsc/src/lib/atsci_fs_correlator.h b/gr-atsc/src/lib/atsci_fs_correlator.h deleted file mode 100644 index ff70245c9..000000000 --- a/gr-atsc/src/lib/atsci_fs_correlator.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_FS_CORRELATOR_H_ -#define _ATSC_FS_CORRELATOR_H_ - -#include <atsc_api.h> - -/*! - * \brief abstract base class for ATSC field sync correlator - * - * Processes input samples one at a time looking for - * an occurence of either the field sync 1 or field sync 2 pattern. - * - * For each sample processed, an output sample and an output tag are produced. - * The output samples are identical to the input samples but are delayed by - * a number of samples given by \p delay(). The output tag associated with - * the the given output sample indicates whether this sample is the beginning - * of one of the field syncs or is an ordinary sample. The tags are defined in - * atsci_sync_tag.h. - * - * For ease of use, the field sync patterns are defined to begin with the - * first symbol of the 4 symbol data segment sync pattern that immediately - * proceeds the actual PN 511 code. This makes it easier for downstream code - * to determine the location of data segment syncs merely by counting. They'll - * occur every 832 samples assuming everything is working. - */ - -class ATSC_API atsci_fs_correlator { - -public: - - // CREATORS - atsci_fs_correlator (); - virtual ~atsci_fs_correlator () = 0; - - // MANIPULATORS - virtual void reset () = 0; - virtual void filter (float input_sample, float *output_sample, float *output_tag) = 0; - - // ACCESSORS - - //! return delay in samples from input to output - virtual int delay () const = 0; -}; - -#endif /* _ATSC_FS_CORRELATOR_H_ */ diff --git a/gr-atsc/src/lib/atsci_fs_correlator_naive.cc b/gr-atsc/src/lib/atsci_fs_correlator_naive.cc deleted file mode 100644 index ccf903531..000000000 --- a/gr-atsc/src/lib/atsci_fs_correlator_naive.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_fs_correlator_naive.h> -#include <atsci_sync_tag.h> -#include <atsci_pnXXX.h> -#include <iostream> -#include <cstring> - -using std::cerr; -using std::endl; - -static const int PN511_ERROR_LIMIT = 20; // max number of bits wrong -static const int PN63_ERROR_LIMIT = 5; - -unsigned char atsci_fs_correlator_naive::s_511[LENGTH_511]; -unsigned char atsci_fs_correlator_naive::s_63[LENGTH_2ND_63]; - -static void -init_s_511 (unsigned char *p) -{ - *p++ = 1; // data segment sync pattern - *p++ = 0; - *p++ = 0; - *p++ = 1; - - for (int i = 0; i < 511; i++){ - p[i] = atsc_pn511[i]; - } -} - -static void -init_s_63 (unsigned char *p) -{ - for (int i = 0; i < 63; i++){ - p[i] = atsc_pn63[i]; - } -} - -atsci_fs_correlator_naive::atsci_fs_correlator_naive () -{ - init_s_511 (s_511); - init_s_63 (s_63); - reset (); -} - -atsci_fs_correlator_naive::~atsci_fs_correlator_naive () -{ -} - -void -atsci_fs_correlator_naive::reset () -{ - d_index = 0; - memset (d_sample_sr, 0, sizeof (d_sample_sr)); - memset (d_bit_sr, 0, sizeof (d_bit_sr)); -} - -void -atsci_fs_correlator_naive::filter (float input_sample, - float *output_sample, float *output_tag) -{ - // check for a hit on the PN 511 pattern - int errors = 0; - int start = wrap (d_index + OFFSET_511); - - for (int i = 0; i < LENGTH_511 && errors < PN511_ERROR_LIMIT; i++) - errors += d_bit_sr[wrap (start + i)] ^ s_511[i]; - - if (errors >= PN511_ERROR_LIMIT) - *output_tag = atsc_sync_tag::NORMAL; - - else { // 511 pattern is good. determine if this is field 1 or field 2 - errors = 0; - start = wrap (d_index + OFFSET_2ND_63); - for (int i = 0; i < LENGTH_2ND_63; i++) - errors += d_bit_sr[wrap (start + i)] ^ s_63[i]; - - // we should have either field 1 (== PN63) or field 2 (== ~PN63) - if (errors <= PN63_ERROR_LIMIT) - *output_tag = atsc_sync_tag::START_FIELD_SYNC_1; - - else if (errors >= (LENGTH_2ND_63 - PN63_ERROR_LIMIT)) - *output_tag = atsc_sync_tag::START_FIELD_SYNC_2; - - else { - // should be extremely rare. - cerr << "!!! atsci_fs_correlator_naive: PN63 error count = " << errors << endl; - *output_tag = atsc_sync_tag::NORMAL; - } - } - - // return oldest sample - *output_sample = d_sample_sr[d_index]; - - // overwrite with newest sample; - d_sample_sr[d_index] = input_sample; - d_bit_sr[d_index] = input_sample < 0 ? 0 : 1; - d_index = incr (d_index); -} - -int -atsci_fs_correlator_naive::delay () const -{ - return SRSIZE; -} diff --git a/gr-atsc/src/lib/atsci_fs_correlator_naive.h b/gr-atsc/src/lib/atsci_fs_correlator_naive.h deleted file mode 100644 index d8afc2ca6..000000000 --- a/gr-atsc/src/lib/atsci_fs_correlator_naive.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_FS_CORRELATOR_NAIVE_H_ -#define _ATSC_FS_CORRELATOR_NAIVE_H_ - -#include <atsc_api.h> -#include <atsci_fs_correlator.h> - -/*! - * \brief Naive concrete implementation of field sync correlator - */ -class ATSC_API atsci_fs_correlator_naive : public atsci_fs_correlator { - - private: - static const int SRSIZE = 1024; // must be power of two - int d_index; // points at oldest sample - float d_sample_sr[SRSIZE]; // sample shift register - unsigned char d_bit_sr[SRSIZE]; // binary decision shift register - - static const int OFFSET_511 = 0; // offset to PN 511 pattern - static const int LENGTH_511 = 511 + 4; // length of PN 511 pattern (+ 4 seg sync) - static const int OFFSET_2ND_63 = 578; // offset to second PN 63 pattern - static const int LENGTH_2ND_63 = 63; // length of PN 63 pattern - - static unsigned char s_511[LENGTH_511]; // PN 511 pattern - static unsigned char s_63[LENGTH_2ND_63]; // PN 63 pattern - - inline static int wrap (int index){ return index & (SRSIZE - 1); } - inline static int incr (int index){ return wrap (index + 1); } - inline static int decr (int index){ return wrap (index - 1); } - - public: - - // CREATORS - atsci_fs_correlator_naive (); - ~atsci_fs_correlator_naive (); - - // MANIPULATORS - virtual void reset (); - void filter (float input_sample, float *output_sample, float *output_tag); - - // ACCESSORS - - //! return delay in samples from input to output - int delay () const; - -}; - - -#endif /* _ATSC_FS_CORRELATOR_NAIVE_H_ */ diff --git a/gr-atsc/src/lib/atsci_pnXXX.cc b/gr-atsc/src/lib/atsci_pnXXX.cc deleted file mode 100644 index 128582d2d..000000000 --- a/gr-atsc/src/lib/atsci_pnXXX.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_pnXXX.h> - -const unsigned char atsc_pn511[511] = { - 0,0,0,0, 0,0,0,1, 0,1,1,1, 1,1,1,1, 1,1,0,0, 1,0,1,0, 1,0,1,0, 1,1,1,0, - 0,1,1,0, 0,1,1,0, 1,0,0,0, 1,0,0,0, 1,0,0,1, 1,1,1,0, 0,0,0,1, 1,1,0,1, - - 0,1,1,1, 1,1,0,1, 0,0,1,1, 0,1,0,1, 0,0,1,1, 1,0,1,1, 0,0,1,1, 1,0,1,0, - 0,1,0,0, 0,1,0,1, 1,0,0,0, 1,1,1,1, 0,0,1,0, 0,0,0,1, 0,1,0,0, 0,1,1,1, - - 1,1,0,0, 1,1,1,1, 0,1,0,1, 0,0,0,1, 0,1,0,0, 1,1,0,0, 0,0,1,1, 0,0,0,1, - 0,0,0,0, 0,1,0,0, 0,0,1,1, 1,1,1,1, 0,0,0,0, 0,1,0,1, 0,1,0,0, 0,0,0,0, - - 1,1,0,0, 1,1,1,1, 1,1,1,0, 1,1,1,0, 1,0,1,0, 1,0,0,1, 0,1,1,0, 0,1,1,0, - 0,0,1,1, 0,1,1,1, 0,1,1,1, 1,0,1,1, 0,1,0,0, 1,0,1,0, 0,1,0,0, 1,1,1,0, - - 0,1,1,1, 0,0,0,1, 0,1,1,1, 0,1,0,0, 0,0,1,1, 0,1,0,0, 1,1,1,1, 1,0,1,1, - 0,0,0,1, 0,1,0,1, 1,0,1,1, 1,1,0,0, 1,1,0,1, 1,0,1,0, 1,1,1,0, 1,1,0,1, - - 1,0,0,1, 0,1,1,0, 1,1,0,1, 1,1,0,0, 1,0,0,1, 0,0,1,0, 1,1,1,0, 0,0,1,1, - 1,0,0,1, 0,1,1,1, 1,0,1,0, 0,0,1,1, 0,1,0,1, 1,0,0,0, 0,1,0,0, 1,1,0,1, - - 1,1,1,1, 0,0,0,1, 0,0,1,0, 1,0,1,1, 1,1,0,0, 0,1,1,0, 0,1,0,1, 0,0,0,0, - 1,0,0,0, 1,1,0,0, 0,0,0,1, 1,1,1,0, 1,1,1,1, 1,1,0,1, 0,1,1,0, 1,0,1,0, - - 1,1,0,0, 1,0,0,1, 1,0,0,1, 0,0,0,1, 1,1,0,1, 1,1,0,0, 0,0,1,0, 1,1,0,1, - 0,0,0,0, 0,1,1,0, 1,1,0,0, 0,0,0,0, 1,0,0,1, 0,0,0,0, 0,0,0,1, 1,1,0 -}; - -const unsigned char atsc_pn63[63] = { - 1,1,1,0, 0,1,0,0, 1,0,1,1, 0,1,1,1, 0,1,1,0, 0,1,1,0, 1,0,1,0, 1,1,1,1, - 1,1,0,0, 0,0,0,1, 0,0,0,0, 1,1,0,0, 0,1,0,1, 0,0,1,1, 1,1,0,1, 0,0,0 -}; - diff --git a/gr-atsc/src/lib/atsci_pnXXX.h b/gr-atsc/src/lib/atsci_pnXXX.h deleted file mode 100644 index 612ed2034..000000000 --- a/gr-atsc/src/lib/atsci_pnXXX.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsc_api.h> - -ATSC_API extern const unsigned char atsc_pn511[]; -ATSC_API extern const unsigned char atsc_pn63[]; diff --git a/gr-atsc/src/lib/atsci_randomizer.cc b/gr-atsc/src/lib/atsci_randomizer.cc deleted file mode 100644 index 8766bbef0..000000000 --- a/gr-atsc/src/lib/atsci_randomizer.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_randomizer.h> -#include <assert.h> - -unsigned char atsci_randomizer::s_output_map[1 << 14]; -bool atsci_randomizer::s_output_map_initialized_p = false; - -atsci_randomizer::atsci_randomizer () -{ - d_state = PRELOAD_VALUE; - - if (!s_output_map_initialized_p) - initialize_output_map (); -} - -/*! - * \brief Generate the table used in the fast_output_map function. - * - * The table has 16K byte entries, but because of how is is used, only - * 256 entries end up being resident in the cache. This seems - * like a good use of memory. We can get away with a 16K table - * because the low two bits of the state do not affect the output - * function. By shifting right those two bits we shrink the table, - * and also get better cache line utilization. - */ -void -atsci_randomizer::initialize_output_map () -{ - s_output_map_initialized_p = true; - - for (int i = 0; i < (1 << 14); i++) - s_output_map[i] = slow_output_map (i << 2); -} - - -void -atsci_randomizer::reset () -{ - d_state = PRELOAD_VALUE; -} - -void -atsci_randomizer::randomize (atsc_mpeg_packet_no_sync &out, const atsc_mpeg_packet &in) -{ - assert (in.data[0] == MPEG_SYNC_BYTE); // confirm it's there, then drop - - for (int i = 0; i < ATSC_MPEG_DATA_LENGTH; i++) - out.data[i] = in.data[i + 1] ^ output_and_clk (); -} - -void -atsci_randomizer::derandomize (atsc_mpeg_packet &out, const atsc_mpeg_packet_no_sync &in) -{ - out.data[0] = MPEG_SYNC_BYTE; // add sync byte to beginning of packet - - for (int i = 0; i < ATSC_MPEG_DATA_LENGTH; i++) - out.data[i + 1] = in.data[i] ^ output_and_clk (); -} - - -unsigned char -atsci_randomizer::slow_output_map (int st) -{ - int output = 0; - - if (st & 0x8000) - output |= 0x01; - - if (st & 0x2000) - output |= 0x02; - - if (st & 0x1000) - output |= 0x04; - - if (st & 0x0200) - output |= 0x08; - - if (st & 0x0020) - output |= 0x10; - - if (st & 0x0010) - output |= 0x20; - - if (st & 0x0008) - output |= 0x40; - - if (st & 0x0004) - output |= 0x80; - - return output; -} diff --git a/gr-atsc/src/lib/atsci_randomizer.h b/gr-atsc/src/lib/atsci_randomizer.h deleted file mode 100644 index aedd0d808..000000000 --- a/gr-atsc/src/lib/atsci_randomizer.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001 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 _ATSC_RANDOMIZER_H_ -#define _ATSC_RANDOMIZER_H_ - -#include <atsc_api.h> -#include <atsc_types.h> - -/*! - * \brief ATSC data "whitener" - * - * The data randomizer described in ATSC standard A/53B. - * See figure D4 on page 54. - */ - -class ATSC_API atsci_randomizer { - friend class qa_atsci_randomizer; - - public: - atsci_randomizer(); - - /*! \brief reset randomizer LFSR - * - * must be called during the Data Segment Sync interval prior to the - * first data segment. I.e., the LFSR is reset prior to the first - * field of each VSB data frame. - */ - void reset (); - - //! randomize (whiten) mpeg packet and remove leading MPEG-2 sync byte - void randomize (atsc_mpeg_packet_no_sync &out, const atsc_mpeg_packet &in); - - //! derandomize (de-whiten) mpeg packet and add leading MPEG-2 sync byte - void derandomize (atsc_mpeg_packet &out, const atsc_mpeg_packet_no_sync &in); - - unsigned int state() const { return d_state; } - - private: - static void initialize_output_map (); - static unsigned char slow_output_map (int st); - - static unsigned char fast_output_map (int st){ - return s_output_map[(st & 0xb23c) >> 2]; // Magic const with 8 bits set improves cache - // utilization. The bits correspond to the taps - // used in output calculation. Others may be - // safely ignored. - } - - //! return current output value - unsigned char output (){ - return fast_output_map (d_state); - } - - //! clock LFSR; advance to next state. - void clk (){ - if (d_state & 0x1) - d_state = ((d_state ^ MASK) >> 1) | 0x8000; - else - d_state = d_state >> 1; - } - - //! return current output value and advance to next state - unsigned char output_and_clk (){ - unsigned char r = output (); - clk (); - return r; - } - - unsigned int d_state; - - static const unsigned int PRELOAD_VALUE = 0x018f; /* 0xf180 bit reversed */ - static const unsigned int MASK = 0xa638; - static unsigned char s_output_map[1 << 14]; - static bool s_output_map_initialized_p; -}; - -#endif /* _ATSC_RANDOMIZER_H_ */ diff --git a/gr-atsc/src/lib/atsci_reed_solomon.cc b/gr-atsc/src/lib/atsci_reed_solomon.cc deleted file mode 100644 index a4a40e3f1..000000000 --- a/gr-atsc/src/lib/atsci_reed_solomon.cc +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_reed_solomon.h> -#include <assert.h> -#include <string.h> - -extern "C" { -#include "rs.h" -} - -static const int rs_init_symsize = 8; -static const int rs_init_gfpoly = 0x11d; -static const int rs_init_fcr = 0; // first consecutive root -static const int rs_init_prim = 1; // primitive is 1 (alpha) -static const int rs_init_nroots = 20; - -static const int N = (1 << rs_init_symsize) - 1; // 255 -static const int K = N - rs_init_nroots; // 235 - -static const int amount_of_pad = N - ATSC_MPEG_RS_ENCODED_LENGTH; // 48 - -atsci_reed_solomon::atsci_reed_solomon () -{ - d_rs = init_rs_char (rs_init_symsize, rs_init_gfpoly, - rs_init_fcr, rs_init_prim, rs_init_nroots); - - assert (d_rs != 0); -} - -atsci_reed_solomon::~atsci_reed_solomon () -{ - if (d_rs) - free_rs_char (d_rs); - d_rs = 0; -} - -void -atsci_reed_solomon::encode (atsc_mpeg_packet_rs_encoded &out, const atsc_mpeg_packet_no_sync &in) -{ - unsigned char tmp[K]; - - assert ((int)(amount_of_pad + sizeof (in.data)) == K); - - // add missing prefix zero padding to message - memset (tmp, 0, amount_of_pad); - memcpy (&tmp[amount_of_pad], in.data, sizeof (in.data)); - - // copy message portion to output packet - memcpy (out.data, in.data, sizeof (in.data)); - - // now compute parity bytes and add them to tail end of output packet - encode_rs_char (d_rs, tmp, &out.data[sizeof (in.data)]); -} - -int -atsci_reed_solomon::decode (atsc_mpeg_packet_no_sync &out, const atsc_mpeg_packet_rs_encoded &in) -{ - unsigned char tmp[N]; - int ncorrections; - - assert ((int)(amount_of_pad + sizeof (in.data)) == N); - - // add missing prefix zero padding to message - memset (tmp, 0, amount_of_pad); - memcpy (&tmp[amount_of_pad], in.data, sizeof (in.data)); - - // correct message... - ncorrections = decode_rs_char (d_rs, tmp, 0, 0); - - // copy corrected message to output, skipping prefix zero padding - memcpy (out.data, &tmp[amount_of_pad], sizeof (out.data)); - - return ncorrections; -} diff --git a/gr-atsc/src/lib/atsci_reed_solomon.h b/gr-atsc/src/lib/atsci_reed_solomon.h deleted file mode 100644 index 8f6e26426..000000000 --- a/gr-atsc/src/lib/atsci_reed_solomon.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_REED_SOLOMON_H_ -#define _ATSC_REED_SOLOMON_H_ - -#include <atsc_api.h> -#include <atsc_types.h> - -/*! - * \brief ATSC Reed-Solomon encoder / decoder - * - * The t=10 (207,187) code described in ATSC standard A/53B. - * See figure D5 on page 55. - */ - -class ATSC_API atsci_reed_solomon { - - public: - atsci_reed_solomon(); - ~atsci_reed_solomon(); - - /*! - * \brief Add RS error correction encoding - */ - void encode (atsc_mpeg_packet_rs_encoded &out, const atsc_mpeg_packet_no_sync &in); - - /*! - * Decode RS encoded packet. - * \returns a count of corrected symbols, or -1 if the block was uncorrectible. - */ - int decode (atsc_mpeg_packet_no_sync &out, const atsc_mpeg_packet_rs_encoded &in); - - private: - void *d_rs; -}; - -#endif /* _ATSC_REED_SOLOMON_H_ */ diff --git a/gr-atsc/src/lib/atsci_root_raised_cosine.cc b/gr-atsc/src/lib/atsci_root_raised_cosine.cc deleted file mode 100644 index f555d90ac..000000000 --- a/gr-atsc/src/lib/atsci_root_raised_cosine.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsc_consts.h> -#include <atsci_root_raised_cosine.h> -#include <gr_firdes.h> - -vector<float> -atsc_root_raised_cosine::taps (double sampling_rate) -{ - static const double symbol_rate = ATSC_SYMBOL_RATE/2; // 1/2 as wide because we're designing lp filter - // static const int NTAPS = 93; // good number - // static const int NTAPS = 745; // better number - static const int NTAPS = 279; // better number - - return gr_firdes::root_raised_cosine (1.0, sampling_rate, symbol_rate, .115, NTAPS); -} diff --git a/gr-atsc/src/lib/atsci_root_raised_cosine.h b/gr-atsc/src/lib/atsci_root_raised_cosine.h deleted file mode 100644 index f24606992..000000000 --- a/gr-atsc/src/lib/atsci_root_raised_cosine.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_RRC_H_ -#define _ATSC_RRC_H_ - -#include <atsc_api.h> -#include <gr_fir_builder.h> - -class ATSC_API atsc_root_raised_cosine : public gr_fir_builder -{ -public: - virtual std::vector<float> taps (double sampling_freq); -}; - - -#endif /* _ATSC_RRC_H_ */ diff --git a/gr-atsc/src/lib/atsci_root_raised_cosine_bandpass.cc b/gr-atsc/src/lib/atsci_root_raised_cosine_bandpass.cc deleted file mode 100644 index f795a4166..000000000 --- a/gr-atsc/src/lib/atsci_root_raised_cosine_bandpass.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_root_raised_cosine_bandpass.h> -#include <iostream> -#include <cmath> - -using std::vector; -using std::cerr; -using std::endl; - - -vector<float> -atsc_root_raised_cosine_bandpass::taps (double sampling_freq) -{ - - vector<float> t = atsc_root_raised_cosine::taps (sampling_freq); - - cerr << "atsc_root_raised_cosine_bandpass::taps -- " << t.size () << endl; - - // heterodyne the low pass coefficients up to the specified bandpass - // center frequency. Note that when we do this, the filter bandwidth - // is effectively twice the low pass (2.69 * 2 = 5.38) and hence - // matches the diagram in the ATSC spec. - - double arg = 2 * M_PI * _center_freq / sampling_freq; - for (unsigned int i = 0; i < t.size (); i++) - // the factor of 2 keeps the gain of the passband normalized to 1 - t[i] *= 2 * cos (arg * (double) i); - - return t; -} diff --git a/gr-atsc/src/lib/atsci_root_raised_cosine_bandpass.h b/gr-atsc/src/lib/atsci_root_raised_cosine_bandpass.h deleted file mode 100644 index bdb33c28d..000000000 --- a/gr-atsc/src/lib/atsci_root_raised_cosine_bandpass.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_RRC_BANDPASS_H_ -#define _ATSC_RRC_BANDPASS_H_ - -#include <atsc_api.h> -#include <atsci_root_raised_cosine.h> - -class ATSC_API atsc_root_raised_cosine_bandpass : public atsc_root_raised_cosine -{ -public: - atsc_root_raised_cosine_bandpass (double center_freq) : _center_freq (center_freq) {} - virtual std::vector<float> taps (double sampling_freq); - -protected: - double _center_freq; -}; - - -#endif /* _ATSC_RRC_BANDPASS_H_ */ diff --git a/gr-atsc/src/lib/atsci_single_viterbi.cc b/gr-atsc/src/lib/atsci_single_viterbi.cc deleted file mode 100644 index a1bf2ea49..000000000 --- a/gr-atsc/src/lib/atsci_single_viterbi.cc +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <math.h> -#include <atsci_single_viterbi.h> -#include <iostream> - -using std::cerr; -using std::cout; - -const float atsci_single_viterbi::was_sent[32] = { - -7,-3,-7,-3,-7,-3,-7,-3, - -5,-1,-5,-1,-5,-1,-5,-1, - 1,5,1,5,1,5,1,5, - 3,7,3,7,3,7,3,7 -}; - -const int atsci_single_viterbi::transition_table[32] = { - 0,2,4,6, - 2,0,6,4, - 1,3,5,7, - 3,1,7,5, - 4,6,0,2, - 6,4,2,0, - 5,7,1,3, - 7,5,3,1 -}; - -void -atsci_single_viterbi::reset() -{ - for (unsigned int i = 0; i<2; i++) - for (unsigned int j = 0; j<8; j++) { - path_metrics[i][j] = 0; - traceback[i][j] = 0; - } - phase = 0; -} - -atsci_single_viterbi::atsci_single_viterbi() -{ - reset(); -} - -char -atsci_single_viterbi::decode(float input) -{ - for (unsigned int next_state = 0; next_state < 8; next_state++) { - unsigned int index = next_state << 2; - int min_metric_symb = 0; - float min_metric = fabs(input - was_sent[index + 0]) + - path_metrics[phase][transition_table[index + 0]]; - - for (unsigned int symbol_sent = 1; symbol_sent < 4; symbol_sent++) - if( (fabs(input-was_sent[index+symbol_sent]) + - path_metrics[phase][transition_table[index+symbol_sent]]) - < min_metric) { - min_metric = fabs(input-was_sent[index+symbol_sent]) + - path_metrics[phase][transition_table[index+symbol_sent]]; - min_metric_symb = symbol_sent; - } - - path_metrics[phase^1][next_state] = min_metric; - traceback[phase^1][next_state] = (((unsigned long long)min_metric_symb) << 62) | - (traceback[phase][transition_table[index+min_metric_symb]] >> 2); - } - unsigned int best_state = 0; - float best_state_metric = path_metrics[phase^1][0]; - for (unsigned int state = 1; state < 8; state++) - if(path_metrics[phase^1][state] < best_state_metric) { - best_state = state; - best_state_metric = path_metrics[phase^1][state]; - } - if(best_state_metric > 10000) { - for(unsigned int state = 0; state < 8; state++) - path_metrics[phase^1][state] -= best_state_metric; - // cerr << "Resetting Path Metrics from " << best_state_metric << " to 0\n"; - } - phase ^= 1; - return (0x3 & traceback[phase][best_state]); -} diff --git a/gr-atsc/src/lib/atsci_single_viterbi.h b/gr-atsc/src/lib/atsci_single_viterbi.h deleted file mode 100644 index 01b13fb25..000000000 --- a/gr-atsc/src/lib/atsci_single_viterbi.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSCSINGLEVITERBI_H_ -#define _ATSCSINGLEVITERBI_H_ - -#include <atsc_api.h> - -/*! - * \brief single channel viterbi decoder - */ -class ATSC_API atsci_single_viterbi -{ - -public: - atsci_single_viterbi (); - - static const unsigned int TB_LEN = 32; - - /*! - * \p INPUT ideally takes on the values +/- 1,3,5,7 - * return is decoded dibit in the range [0, 3] - */ - char decode (float input); - - void reset (); - - //! internal delay of decoder - int delay () { return TB_LEN - 1; } - -protected: - static const int transition_table[32]; - static const float was_sent[32]; - float path_metrics [2][8]; - unsigned long long traceback [2][8]; - unsigned char phase; -}; - -#endif diff --git a/gr-atsc/src/lib/atsci_slicer_agc.h b/gr-atsc/src/lib/atsci_slicer_agc.h deleted file mode 100644 index 8a3927b70..000000000 --- a/gr-atsc/src/lib/atsci_slicer_agc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_SLICER_AGC_H_ -#define _ATSC_SLICER_AGC_H_ - -#include <atsc_api.h> -#include <math.h> -#include <gr_single_pole_iir.h> - -/*! - * \brief Automatic Gain Control class for atsc slicer - * - * Given perfect data, output values will be +/- {7, 5, 3, 1} - */ - -class ATSC_API atsci_slicer_agc { - - public: - atsci_slicer_agc () : _gain(1), dc(0.0025) {}; - - - float gain () { return _gain; } - -#if 1 - float scale (float input){ - float t = input * _gain; - float output = t - REFERENCE; - float error = REFERENCE - dc.filter (t); - _gain += error * RATE; - return output; - } -#else - float scale(float input){ - float avg = dc.filter(input); - if(fabs(avg)<.1)avg=.1; - _gain += _gain*.99 + .01* REFERENCE/avg; - return input*_gain - REFERENCE; - } -#endif - - protected: - - static const float REFERENCE = 1.25; // pilot reference value - static const float RATE = 1.0e-5; // adjustment rate - float _gain; // current gain - gr_single_pole_iir<float,float,float> dc; -}; - -#endif /* _ATSC_SLICER_AGC_H_ */ diff --git a/gr-atsc/src/lib/atsci_sliding_correlator.cc b/gr-atsc/src/lib/atsci_sliding_correlator.cc deleted file mode 100644 index 877037db7..000000000 --- a/gr-atsc/src/lib/atsci_sliding_correlator.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2006 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. - */ - -#include <atsci_sliding_correlator.h> -#include <atsci_pnXXX.h> - -// #define TRY_BACKWARDS - -/* - * Return the number of 1's in v. - * This magic code is explained wonderfully in the AMD Athlon - * optimization guide, pg 136. - */ -static inline int popcount32 (unsigned long v) -{ - unsigned long w = v - ((v >> 1) & 0x55555555); - unsigned long x = (w & 0x33333333) + ((w >> 2) & 0x33333333); - unsigned long y = (x + (x >> 4)) & 0x0f0f0f0f; - unsigned long z = (y * 0x01010101) >> 24; - - return z; -} - -atsci_sliding_correlator::atsci_sliding_correlator () -{ -#if defined(TRY_BACKWARDS) - for (int i = 511 - 1; i >= 0; i--) - mask.shift_in (atsc_pn511[i]); -#else - for (unsigned i = 0; i < 511; i++) - mask.shift_in (atsc_pn511[i]); -#endif - - and_mask.shift_in (0); - for (int i = 0; i < 511; i++) - and_mask.shift_in (1); -} - -/* - * we shift in from the top of the register towards the bottom - * - * +-- bits enter here... - * | - * v - * block 0 | block 1 | block 2 ... | block N-1 - * | - * +--> ... and drop out here - * - */ -inline void -atsci_sliding_correlator::shift_reg::shift_in (int bit) -{ - for (int i = NSRBLOCKS - 1; i > 0; i--) - d[i] = ((d[i-1] & 0x1) << (srblock_bitsize - 1)) | (d[i] >> 1); - - d[0] = (((srblock) bit) << (srblock_bitsize - 1)) | (d[0] >> 1); -} - -int -atsci_sliding_correlator::input_bit (int bit) -{ - input.shift_in (bit); - - // can probably get a win by unrolling the loop, if we need to. - int count = 0; - for (int i = 0; i < NSRBLOCKS; i++) - count += popcount32 ((input.d[i] ^ mask.d[i]) & and_mask.d[i]); - - return count; -} - diff --git a/gr-atsc/src/lib/atsci_sliding_correlator.h b/gr-atsc/src/lib/atsci_sliding_correlator.h deleted file mode 100644 index ffa2124ed..000000000 --- a/gr-atsc/src/lib/atsci_sliding_correlator.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_SLIDING_CORRELATOR_H_ -#define _ATSC_SLIDING_CORRELATOR_H_ - -#include <atsc_api.h> -#include <string.h> - -#include <atsci_pnXXX.h> -//extern const unsigned char atsc_pn511[511]; -//extern const unsigned char atsc_pn63[63]; - -/*! - * \brief look for the PN 511 field sync pattern - */ -class ATSC_API atsci_sliding_correlator { - public: - - atsci_sliding_correlator (); - ~atsci_sliding_correlator (){}; - - //! input hard decision bit, return correlation (0,511) - // Result is the number of wrong bits. - // E.g., 0 -> perfect match; 511 -> all bits are wrong - - int input_bit (int bit); - - //! input sample, return correlation (0,511) - // Result is the number of wrong bits. - // E.g., 0 -> perfect match; 511 -> all bits are wrong - - int input_int (int sample){ - return input_bit (sample < 0 ? 0 : 1); - } - - //! input sample, return correlation (0,511) - // Result is the number of wrong bits. - // E.g., 0 -> perfect match; 511 -> all bits are wrong - - int input_float (float sample){ - return input_bit (sample < 0 ? 0 : 1); - } - - void reset () { input.reset (); } - - private: - - typedef unsigned long srblock; - static const int bits_per_char = 8; - static const int srblock_bitsize = sizeof (srblock) * bits_per_char; - static const int NSRBLOCKS = (511 + srblock_bitsize - 1) / srblock_bitsize; - - class shift_reg { - public: - shift_reg () { reset (); } - void reset () { memset (d, 0, sizeof (d)); } - void shift_in (int bit); - srblock d[NSRBLOCKS]; - }; - - shift_reg mask; // pattern we're looking for - shift_reg input; // current input window - shift_reg and_mask; // bits to consider -}; - -#endif /* _ATSC_SLIDING_CORRELATOR_H_ */ diff --git a/gr-atsc/src/lib/atsci_sssr.cc b/gr-atsc/src/lib/atsci_sssr.cc deleted file mode 100644 index 56a0c6a00..000000000 --- a/gr-atsc/src/lib/atsci_sssr.cc +++ /dev/null @@ -1,297 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2008 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. - */ - -#include <atsci_sssr.h> -#include <algorithm> -#include <cmath> -#include <cstdio> -#include <assert.h> -#include <atsci_diag_output.h> -#include <gr_math.h> -#include <stdio.h> -#include <boost/math/special_functions/sign.hpp> -#include <iostream> - -/* - * ---------------------------------------------------------------- - * Segment Integrator Pre-Processor - * - * Compute weight passed to integrator based on - * correlation result and ncorr_gain2 - */ - -inline static int -sipp (bool digcorr_output) -{ - if (digcorr_output) - return +2; // positive correlation - else - return -1; // no correlation -} - -/* - * ---------------------------------------------------------------- - * Segment Sync Integrator... - */ - -static const int SSI_MIN = -16; -static const int SSI_MAX = 15; - -void -sssr::seg_sync_integrator::reset () -{ - for (int i = 0; i < ATSC_DATA_SEGMENT_LENGTH; i++) - d_integrator[i] = SSI_MIN; -} - -int -sssr::seg_sync_integrator::update (int weight, int index) -{ - int t = d_integrator[index] + weight; - t = std::max (t, SSI_MIN); - t = std::min (t, SSI_MAX); - d_integrator[index] = t; - - return t; -} - -int -sssr::seg_sync_integrator::find_max (int *v) -{ - int best_value = d_integrator[0]; - int best_index = 0; - - for (int i = 1; i < ATSC_DATA_SEGMENT_LENGTH; i++) - if (d_integrator[i] > best_value){ - best_value = d_integrator[i]; - best_index = i; - } - - *v = best_value; - return best_index; -} - -/* - * ---------------------------------------------------------------- - * Segment Sync and Symbol recovery - */ - -static const int SYMBOL_INDEX_OFFSET = 3; -static const int MIN_SEG_LOCK_CORRELATION_VALUE = 5; - -atsci_sssr::atsci_sssr () - : d_debug_fp(0) -{ - reset (); - - if (_SSSR_DIAG_OUTPUT_){ - const char *file = "sssr.ssout"; - if ((d_debug_fp = fopen (file, "wb")) == 0){ - perror (file); - exit (1); - } - } -} - -atsci_sssr::~atsci_sssr () -{ - if (d_debug_fp) - fclose (d_debug_fp); -} - -void -atsci_sssr::reset () -{ - d_correlator.reset (); - d_integrator.reset (); - d_quad_filter.reset (); - - for (int i = 0; i < ATSC_DATA_SEGMENT_LENGTH; i++) - d_quad_output[i] = 0; - - d_timing_adjust = 0; - d_counter = 0; - d_symbol_index = 0; - d_seg_locked = false; -} - -void -atsci_sssr::update (sssr::sample_t sample_in, // input - bool *seg_locked, // are we seeing segment syncs? - int *symbol_index, // 0..831 - double *timing_adjust) // how much to adjust timing -{ - double qo = d_quad_filter.update (sample_in); - d_quad_output[d_counter] = qo; - - int bit = boost::math::signbit (sample_in); - if (bit != 0) - bit = 0; - else - bit = 1; - int corr_out = d_correlator.update (bit); - int weight = sipp (corr_out); - int corr_value = d_integrator.update (weight, d_counter); - int best_correlation_index = -1; - - incr_symbol_index (); - if (incr_counter ()){ // counter just wrapped... - int best_correlation_value; - best_correlation_index = d_integrator.find_max (&best_correlation_value); - d_seg_locked = best_correlation_value >= MIN_SEG_LOCK_CORRELATION_VALUE; - //std::cout << "best = " << best_correlation_value << " min is " << MIN_SEG_LOCK_CORRELATION_VALUE << std::endl; - d_timing_adjust = d_quad_output[best_correlation_index]; - - d_symbol_index = SYMBOL_INDEX_OFFSET - 1 - best_correlation_index; - if (d_symbol_index < 0) - d_symbol_index += ATSC_DATA_SEGMENT_LENGTH; - } - - *seg_locked = d_seg_locked; - *symbol_index = d_symbol_index; - *timing_adjust = d_timing_adjust; - - if (_SSSR_DIAG_OUTPUT_){ - float iodata[7]; - iodata[0] = bit; - iodata[1] = corr_value; - iodata[2] = qo; - iodata[3] = d_counter; - iodata[4] = d_symbol_index; - iodata[5] = best_correlation_index; - iodata[6] = d_timing_adjust; - - if (fwrite (iodata, sizeof (iodata), 1, d_debug_fp) != 1){ - perror ("fwrite: sssr"); - exit (1); - } - } - -} - -/* - * ---------------------------------------------------------------- - * Interpolator control for Seg & Symbol Sync Recovery - */ - -static const double LOOP_FILTER_TAP = 0.00025; // 0.0005 works -static const double ADJUSTMENT_GAIN = 1.0e-5 / (10 * ATSC_DATA_SEGMENT_LENGTH); - -atsci_interpolator::atsci_interpolator (double nominal_ratio_of_rx_clock_to_symbol_freq) - : d_debug_fp(0) -{ -// Tweaked ratio from 1.8 to 1.78 to support input rate of 19.2MHz - assert (nominal_ratio_of_rx_clock_to_symbol_freq >= 1.78); - d_nominal_ratio_of_rx_clock_to_symbol_freq = - nominal_ratio_of_rx_clock_to_symbol_freq; - - d_loop.set_taps (LOOP_FILTER_TAP); - - reset (); - - if (_SSSR_DIAG_OUTPUT_){ - const char *file = "interp.ssout"; - if ((d_debug_fp = fopen (file, "wb")) == 0){ - perror (file); - exit (1); - } - } - -} - -atsci_interpolator::~atsci_interpolator () -{ - if (d_debug_fp) - fclose (d_debug_fp); -} - -void -atsci_interpolator::reset () -{ - d_w = d_nominal_ratio_of_rx_clock_to_symbol_freq; - d_mu = 0.5; - d_incr = 0; - d_loop.reset (); -} - -bool -atsci_interpolator::update ( - const sssr::sample_t input_samples[], // I: vector of samples - int nsamples, // I: total number of samples - int *index, // I/O: current input index - double timing_adjustment, // I: how much to bump timing - sssr::sample_t *output_sample) -{ - if (*index + (int) ntaps () > nsamples) - return false; - - // FIXME Confirm that this is right. I think it is. It was (1-d_mu) - *output_sample = d_interp.interpolate (&input_samples[*index], d_mu); - - double filter_out = 0; - -#if 0 - - filter_out = d_loop.filter (timing_adjustment); - d_w = d_w + ADJUSTMENT_GAIN * filter_out * 1e-3; - -#elif 1 - - filter_out = d_loop.filter (timing_adjustment); - d_mu = d_mu + ADJUSTMENT_GAIN * 10e3 * filter_out; - -#else - - static const double alpha = 0.01; - static const double beta = alpha * alpha / 16; - - double x = ADJUSTMENT_GAIN * 10e3 * timing_adjustment; - - d_mu = d_mu + alpha * x; // conceptually "phase" - d_w = d_w + beta * x; // conceptually "frequency" - -#endif - - double s = d_mu + d_w; - double float_incr = floor (s); - d_mu = s - float_incr; - d_incr = (int) float_incr; - - assert (d_incr >= 1 && d_incr <= 3); - *index += d_incr; - - if (_SSSR_DIAG_OUTPUT_){ - float iodata[6]; - iodata[0] = timing_adjustment; - iodata[1] = filter_out; - iodata[2] = d_w; - iodata[3] = d_mu; - iodata[4] = d_incr; - iodata[5] = *output_sample; - if (fwrite (iodata, sizeof (iodata), 1, d_debug_fp) != 1){ - perror ("fwrite: interpolate"); - exit (1); - } - } - - return true; -} diff --git a/gr-atsc/src/lib/atsci_sssr.h b/gr-atsc/src/lib/atsci_sssr.h deleted file mode 100644 index f3b825b3c..000000000 --- a/gr-atsc/src/lib/atsci_sssr.h +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -/* - * --- ATSC Segment and Symbol Sync Recovery --- - */ - -#ifndef _ATSC_SSSR_H_ -#define _ATSC_SSSR_H_ - -#include <atsc_api.h> -#include <atsc_consts.h> -#include <gri_mmse_fir_interpolator.h> -#include <gr_single_pole_iir.h> -#include <cstdio> - -/* - * --- support classes for atsci_sssr --- - */ - -namespace sssr { - - typedef float sample_t; - - // ---------------------------------------------------------------- - //! digital correlator for 1001 and 0110 patterns - - class ATSC_API digital_correlator { - int d_sr; // 4 bit shift register - - public: - - // Constructor - digital_correlator () { reset (); } - - // Manipulators - - //! called on channel change - void reset () { d_sr = 0; } - - //! clock bit in and return true if we've seen 1001 - - bool update (int bit) { - d_sr = ((bit & 1) << 3) | (d_sr >> 1); - - return (d_sr == 0x9); // 1001 - } - - }; - - - // ---------------------------------------------------------------- - //! segment sync integrator - - class ATSC_API seg_sync_integrator { - signed char d_integrator[ATSC_DATA_SEGMENT_LENGTH]; - - public: - - // Constructor - seg_sync_integrator () { reset (); } - - // Manipulators - - //! called on channel change - void reset (); - - //! update current tap with weight and return integrated correlation value - int update (int weight, int index); - - //! return index of maximum correlation value - int find_max (int *value); - - }; - - // ---------------------------------------------------------------- - //! quad filter (used to compute timing error) - - class ATSC_API quad_filter { - sample_t d_delay[4]; - - public: - // Constructor - quad_filter () { reset (); } - - // Manipulators - - //! called on channel change - void reset () { d_delay[0] = d_delay[1] = d_delay[2] = d_delay[3] = 0; } - - double update (sample_t sample){ - d_delay[3] = d_delay[2]; - d_delay[2] = d_delay[1]; - d_delay[1] = d_delay[0]; - d_delay[0] = sample; - - // the coefficients are -1,-1,+1,+1 - return d_delay[3] + d_delay[2] - d_delay[1] - d_delay[0]; - } - }; -} - -// ---------------------------------------------------------------- - -/*! - * \brief ATSC Segment and Symbol Sync Recovery - * - * This class implements data segment sync tracking and symbol timing - * using the method described in "ATSC/VSB Tutorial - Receiver Technology" - * by Wayne E. Bretl of Zenith, pgs 41-45. - */ - -class ATSC_API atsci_sssr { - sssr::digital_correlator d_correlator; - sssr::seg_sync_integrator d_integrator; - sssr::quad_filter d_quad_filter; - double d_quad_output[ATSC_DATA_SEGMENT_LENGTH]; - double d_timing_adjust; - int d_counter; // free running mod 832 counter - int d_symbol_index; - bool d_seg_locked; - FILE *d_debug_fp; - - - bool incr_counter () { - d_counter++; - if (d_counter >= ATSC_DATA_SEGMENT_LENGTH){ - d_counter = 0; - return true; - } - return false; - } - - void incr_symbol_index () { - d_symbol_index++; - if (d_symbol_index >= ATSC_DATA_SEGMENT_LENGTH) - d_symbol_index = 0; - } - -public: - - // Constructor - atsci_sssr (); - ~atsci_sssr (); - - // Manipulators - - //! call on channel change - void reset (); - - - /*! - * \brief process a single sample at the ATSC symbol rate (~10.76 MSPS) - * - * This block computes an indication of our timing error and keeps - * track of where the segment sync's occur. \p timing_adjust is - * returned to indicate how the interpolator timing needs to be - * adjusted to track the transmitter's symbol timing. If \p seg_locked - * is true, then \p symbol_index is the index of this sample in - * the current segment. The symbols are numbered from 0 to 831, where - * symbols 0, 1, 2 and 3 correspond to the data segment sync pattern, - * nominally +5, -5, -5, +5. - */ - - void update (sssr::sample_t sample_in, // input - bool *seg_locked, // are we seeing segment syncs? - int *symbol_index, // 0..831 - double *timing_adjust); // how much to adjust timing - -}; - -// ---------------------------------------------------------------- - -/*! - * \brief interpolator control for segment and symbol sync recovery - */ - -class ATSC_API atsci_interpolator { - gri_mmse_fir_interpolator d_interp; - gr_single_pole_iir<float,float,float> d_loop; // ``VCO'' loop filter - double d_nominal_ratio_of_rx_clock_to_symbol_freq; // FREQ - double d_w; // ratio of PERIOD of Tx to Rx clocks - double d_mu; // fractional delay [0,1] - int d_incr; // diagnostic only - FILE *d_debug_fp; // diagnostic only - -public: - //! \p nominal_ratio_of_rx_clock_to_symbol_freq must be >= 1.8 - atsci_interpolator (double nominal_ratio_of_rx_clock_to_symbol_freq); - ~atsci_interpolator (); - - // Manipulators - - //! call on channel change - void reset (); - - /*! - * \brief produce next sample referenced to Tx clock - * - * If there aren't enough input_samples left to produce - * an output, return false, else true. - */ - - bool update (const sssr::sample_t input_samples[], // I: vector of samples - int nsamples, // I: total number of samples - int *index, // I/O: current input index - double timing_adjustment, // I: how much to bump timing - sssr::sample_t *output_sample); // O: the output sample - - // Accessors - - // how much history we require on our input - unsigned ntaps () const { return d_interp.ntaps (); } - - // diagnostic accessors - double mu () const { return d_mu; } - double w () const { return d_w; } - int incr () const { return d_incr; } - -}; - -#endif /* _ATSC_SSSR_H_ */ diff --git a/gr-atsc/src/lib/atsci_syminfo.h b/gr-atsc/src/lib/atsci_syminfo.h deleted file mode 100644 index 9f25e4902..000000000 --- a/gr-atsc/src/lib/atsci_syminfo.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_SYMINFO_H_ -#define _ATSC_SYMINFO_H_ - -namespace atsc { - - static const unsigned int SI_SEGMENT_NUM_MASK = 0x1ff; - static const unsigned int SI_FIELD_SYNC_SEGMENT_NUM = SI_SEGMENT_NUM_MASK; // conceptually -1 - - struct syminfo { - unsigned int symbol_num : 10; // 0..831 - unsigned int segment_num : 9; // 0..311 and SI_FIELD_SYNC_SEGMENT_NUM - unsigned int field_num : 1; // 0..1 - unsigned int valid : 1; // contents are valid - }; - - - static inline bool - tag_is_start_field_sync (syminfo tag) - { - return tag.symbol_num == 0 && tag.segment_num == SI_FIELD_SYNC_SEGMENT_NUM && tag.valid; - } - - static inline bool - tag_is_start_field_sync_1 (syminfo tag) - { - return tag_is_start_field_sync (tag) && tag.field_num == 0; - } - - static inline bool - tag_is_start_field_sync_2 (syminfo tag) - { - return tag_is_start_field_sync (tag) && tag.field_num == 1; - } - -} - -#endif /* _ATSC_SYMINFO_H_ */ diff --git a/gr-atsc/src/lib/atsci_sync_tag.h b/gr-atsc/src/lib/atsci_sync_tag.h deleted file mode 100644 index bdb64c5d3..000000000 --- a/gr-atsc/src/lib/atsci_sync_tag.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_SYNC_TAG_H_ -#define _ATSC_SYNC_TAG_H_ - -/* - * Constants used to communicate in the second stream passed between - * GrAtscFSCorrelator, GrAtscEqualizer and GrAtscFieldSyncMux. The - * second stream is sample-for-sample parallel with the streaming - * floating point in the first stream. The second stream provides - * information about alignment boundaries. - * - * These are in floating point because the current implementation - * requires that for a given module, all input streams share the same - * type and all output streams share the same type. We'd use unsigned - * char otherwise. - */ - -namespace atsc_sync_tag { - - // Nothing special - static const float NORMAL = 0.0; - - // The corresponding symbol is the first symbol of the - // data segment sync sequence { +5, -5, -5, +5 } - static const float START_SEG_SYNC = 1.0; - - // The corresponding symbol is the first symbol of the - // field sync 1 PN511 pattern. - static const float START_FIELD_SYNC_1 = 2.0; - - // The corresponding symbol is the first symbol of the - // field sync 2 PN511 pattern. - static const float START_FIELD_SYNC_2 = 3.0; -}; - -#endif /* _ATSC_SYNC_TAG_H_ */ diff --git a/gr-atsc/src/lib/atsci_trellis_encoder.cc b/gr-atsc/src/lib/atsci_trellis_encoder.cc deleted file mode 100644 index 2b3e851bc..000000000 --- a/gr-atsc/src/lib/atsci_trellis_encoder.cc +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2006 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. - */ - -#include <atsci_trellis_encoder.h> -#include <assert.h> -#include <stdio.h> -#include <string.h> - -static const int DIBITS_PER_BYTE = 4; - -#define SEGOF(x) ( (x) / ((SEGMENT_SIZE+1) * DIBITS_PER_BYTE)) -#define SYMOF(x) (((x) % ((SEGMENT_SIZE+1) * DIBITS_PER_BYTE))-4) - -/* How many separate Trellis encoders / Viterbi decoders run in parallel */ -static const int NCODERS = 12; - -#define ENCODER_SEG_BUMP 4 - -/* A Segment sync symbol is an 8VSB +5,-5,-5,+5 sequence that occurs at - the start of each 207-byte segment (including field sync segments). */ -#define DSEG_SYNC_SYM1 0x06 /* +5 */ -#define DSEG_SYNC_SYM2 0x01 /* -5 */ -#define DSEG_SYNC_SYM3 0x01 /* -5 */ -#define DSEG_SYNC_SYM4 0x06 /* +5 */ - - -/* Shift counts to bit numbers (high order, low order); 9x entries unused */ -static const int bit1[8] = {1, 99, 3, 98, 5, 97, 7, 96}; -static const int bit2[8] = {0, 99, 2, 98, 4, 97, 6, 96}; - - -atsci_trellis_encoder::atsci_trellis_encoder () -{ - debug = false; - reset (); -} - -atsci_trellis_encoder::~atsci_trellis_encoder () -{ -} - -void -atsci_trellis_encoder::reset () -{ - for (int i = 0; i < NCODERS; i++) - enc[i].reset (); -} - -void -atsci_trellis_encoder::encode (atsc_data_segment out[NCODERS], - const atsc_mpeg_packet_rs_encoded in[NCODERS]) -{ - unsigned char out_copy[OUTPUT_SIZE]; - unsigned char in_copy[INPUT_SIZE]; - - assert (sizeof (in_copy) == sizeof (in[0].data) * NCODERS); - assert (sizeof (out_copy) == sizeof (out[0].data) * NCODERS); - - // copy input into continguous temporary buffer - for (int i = 0; i < NCODERS; i++){ - assert (in[i].pli.regular_seg_p ()); - plinfo::sanity_check (in[i].pli); - memcpy (&in_copy[i * INPUT_SIZE/NCODERS], - &in[i].data[0], - ATSC_MPEG_RS_ENCODED_LENGTH * sizeof (in_copy[0])); - } - - memset (out_copy, 0, sizeof (out_copy)); // FIXME, sanity check - - // do the deed... - encode_helper (out_copy, in_copy); - - // copy output from contiguous temp buffer into final output - for (int i = 0; i < NCODERS; i++){ - memcpy (&out[i].data[0], - &out_copy[i * OUTPUT_SIZE/NCODERS], - ATSC_DATA_SEGMENT_LENGTH * sizeof (out_copy[0])); - - // copy pipeline info - out[i].pli = in[i].pli; - - plinfo::sanity_check (out[i].pli); - assert (out[i].pli.regular_seg_p ()); - } -} - -/* - * This code expects contiguous arrrays. Use it as is, it computes - * the correct answer. Maybe someday, when we've run out of better - * things to do, rework to avoid the copying in encode. - */ -void -atsci_trellis_encoder::encode_helper (unsigned char output[OUTPUT_SIZE], - const unsigned char input[INPUT_SIZE]) -{ - int i; - int encoder; - unsigned char trellis_buffer[NCODERS]; - int trellis_wherefrom[NCODERS]; - unsigned char *out, *next_out_seg; - int chunk; - int shift; - unsigned char dibit; - unsigned char symbol; - int skip_encoder_bump; - - /* FIXME, we may want special processing here - for a flag byte to keep track of which part of the field we're in? */ - - encoder = NCODERS - ENCODER_SEG_BUMP; - skip_encoder_bump = 0; - out = output; - next_out_seg = out; - - for (chunk = 0; - chunk < INPUT_SIZE; - chunk += NCODERS) { - /* Load a new chunk of bytes into the Trellis encoder buffers. - They get loaded in an order that depends on where we are in the - segment sync progress (sigh). - GRR! When the chunk reload happens at the same time as the - segment boundary, we should bump the encoder NOW for the reload, - rather than LATER during the bitshift transition!!! */ - if (out >= next_out_seg) { - encoder = (encoder + ENCODER_SEG_BUMP) % NCODERS; - skip_encoder_bump = 1; - } - - for (i = 0; i < NCODERS; i++) { - /* for debug */ trellis_wherefrom[encoder] = chunk+i; - trellis_buffer[encoder] = input [chunk+i]; - encoder++; - if (encoder >= NCODERS) encoder = 0; - } - - for (shift = 6; shift >= 0; shift -= 2) { - - /* Segment boundaries happen to occur on some bitshift transitions. */ - if (out >= next_out_seg) { - /* Segment transition. Output a data segment sync symbol, and - mess with the trellis encoder mux. */ - *out++ = DSEG_SYNC_SYM1; - *out++ = DSEG_SYNC_SYM2; - *out++ = DSEG_SYNC_SYM3; - *out++ = DSEG_SYNC_SYM4; - if (debug) printf ("SYNC SYNC SYNC SYNC\n"); - next_out_seg = out + (SEGMENT_SIZE * DIBITS_PER_BYTE); - - if (!skip_encoder_bump) - encoder = (encoder + ENCODER_SEG_BUMP) % NCODERS; - skip_encoder_bump = 0; - } - - /* Now run each of the 12 Trellis encoders to spit out 12 symbols. - Each encoder takes input from the same byte of the chunk, but the - outputs of the encoders come out in various orders. - NOPE -- this is false. The encoders take input from various - bytes of the chunk (which changes at segment sync time), AND - they also come out in various orders. You really do have to - keep separate track of: the input bytes, the encoders, and - the output bytes -- because they're all moving with respect to - each other!!! */ - for (i = 0; i < NCODERS; i++) { - dibit = 0x03 & (trellis_buffer[encoder] >> shift); - if (debug) - printf ("Seg %ld Symb %3ld Trell %2d Byte %6d Bits %d-%d = dibit %d ", - (long) SEGOF(out-output), (long) SYMOF(out-output), - encoder, trellis_wherefrom[encoder], - bit1[shift], bit2[shift], dibit); - symbol = enc[encoder].encode (dibit); - *out++ = symbol; - encoder++; if (encoder >= NCODERS) encoder = 0; - if (debug) printf ("sym %d\n", symbol); - } /* Encoders */ - } /* Bit shifts */ - } /* Chunks */ - - /* Check up on ourselves */ -#if 0 - assertIntsEqual (0, (INPUT_SIZE * DIBITS_PER_BYTE) % NCODERS, "not %"); - assertIntsEqual (OUTPUT_SIZE, out - output, "outptr"); - assertIntsEqual (NCODERS - ENCODER_SEG_BUMP, encoder, "mux sync"); -#else - assert (0 == (INPUT_SIZE * DIBITS_PER_BYTE) % NCODERS); - assert (OUTPUT_SIZE == out - output); - assert (NCODERS - ENCODER_SEG_BUMP == encoder); -#endif -} - diff --git a/gr-atsc/src/lib/atsci_trellis_encoder.h b/gr-atsc/src/lib/atsci_trellis_encoder.h deleted file mode 100644 index 294ad860f..000000000 --- a/gr-atsc/src/lib/atsci_trellis_encoder.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_TRELLIS_ENCODER_H_ -#define _ATSC_TRELLIS_ENCODER_H_ - -#include <atsc_api.h> -#include <atsci_basic_trellis_encoder.h> -#include <atsc_types.h> - -/*! - * \brief fancy, schmancy 12-way interleaved trellis encoder for ATSC - */ - -class ATSC_API atsci_trellis_encoder { - public: - static const int NCODERS = 12; - - atsci_trellis_encoder (); - ~atsci_trellis_encoder (); - - //! reset all encoder states - void reset (); - - /*! - * Take 12 RS encoded, convolutionally interleaved segments and - * produce 12 trellis coded data segments. We work in groups of 12 - * because that's the smallest number of segments that composes a - * single full cycle of the encoder mux. - */ - void encode (atsc_data_segment out[NCODERS], - const atsc_mpeg_packet_rs_encoded in[NCODERS]); - - - protected: - static const int SEGMENT_SIZE = ATSC_MPEG_RS_ENCODED_LENGTH; // 207 - static const int INPUT_SIZE = (SEGMENT_SIZE * 12); - static const int OUTPUT_SIZE = (ATSC_DATA_SEGMENT_LENGTH * 12); - - void encode_helper (unsigned char out[OUTPUT_SIZE], - const unsigned char in[INPUT_SIZE]); - - atsci_basic_trellis_encoder enc[NCODERS]; - bool debug; -}; - - -#endif /* _ATSC_TRELLIS_ENCODER_H_ */ diff --git a/gr-atsc/src/lib/atsci_viterbi_decoder.cc b/gr-atsc/src/lib/atsci_viterbi_decoder.cc deleted file mode 100644 index 8804f6007..000000000 --- a/gr-atsc/src/lib/atsci_viterbi_decoder.cc +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsci_viterbi_decoder.h> -#include <assert.h> -#include <stdio.h> -#include <cmath> -#include "atsci_viterbi_mux.cc" -#include <string.h> - - -/* How many separate Trellis encoders / Viterbi decoders run in parallel */ -static const int NCODERS = 12; - -static const float DSEG_SYNC_SYM1 = 5; -static const float DSEG_SYNC_SYM2 = -5; -static const float DSEG_SYNC_SYM3 = -5; -static const float DSEG_SYNC_SYM4 = 5; - -atsci_viterbi_decoder::atsci_viterbi_decoder () -{ - debug = true; - - /* - * These fifo's handle the alignment problem caused by the - * inherent decoding delay of the individual viterbi decoders. - * The net result is that this entire block has a pipeline latency - * of 12 complete segments. - * - * If anybody cares, it is possible to do it with less delay, but - * this approach is at least somewhat understandable... - */ - - // the -4 is for the 4 sync symbols - int fifo_size = ATSC_DATA_SEGMENT_LENGTH - 4 - viterbi[0].delay (); - for (int i = 0; i < NCODERS; i++) - fifo[i] = new fifo_t(fifo_size); - - reset (); -} - -atsci_viterbi_decoder::~atsci_viterbi_decoder () -{ - for (int i = 0; i < NCODERS; i++) - delete fifo[i]; -} - -void -atsci_viterbi_decoder::reset () -{ - for (int i = 0; i < NCODERS; i++){ - viterbi[i].reset (); - fifo[i]->reset (); - } -} - - -void -atsci_viterbi_decoder::decode (atsc_mpeg_packet_rs_encoded out[NCODERS], - const atsc_soft_data_segment in[NCODERS]) -{ - unsigned char out_copy[OUTPUT_SIZE]; - float in_copy[INPUT_SIZE]; - - // copy input into continguous temporary buffer - for (int i = 0; i < NCODERS; i++){ - assert (in[i].pli.regular_seg_p ()); - memcpy (&in_copy[i * INPUT_SIZE/NCODERS], - &in[i].data[0], - ATSC_DATA_SEGMENT_LENGTH * sizeof (in_copy[0])); - } - - memset (out_copy, 0, sizeof (out_copy)); // sanity check - - // do the deed... - decode_helper (out_copy, in_copy); - - // copy output from contiguous temp buffer into final output - for (int i = 0; i < NCODERS; i++){ - memcpy (&out[i].data[0], - &out_copy[i * OUTPUT_SIZE/NCODERS], - ATSC_MPEG_RS_ENCODED_LENGTH * sizeof (out_copy[0])); - - - // adjust pipeline info to reflect 12 segment delay - plinfo::delay (out[i].pli, in[i].pli, NCODERS); - } -} - -void -atsci_viterbi_decoder::decode_helper (unsigned char out[OUTPUT_SIZE], - const float symbols_in[INPUT_SIZE]) -{ - int encoder; - unsigned int i; - int dbi; - int dbwhere; - int dbindex; - int shift; - unsigned char dibit; - float symbol; - - /* Memset is not necessary if it's all working... */ - memset (out, 0, OUTPUT_SIZE); - -#define VERBOSE 0 - -#if 1 - /* Check for sync symbols in the incoming data stream */ - /* For now, all we do is complain to stdout. FIXME, pass it back to - caller as an error/quality signal. */ - for (i = 0; i < sync_symbol_indices_max; i++) { - int j = sync_symbol_indices[i]; - if (fabsf (symbols_in[j] - DSEG_SYNC_SYM1) > 1.0) - if (VERBOSE) fprintf (stderr, "** Missing dataseg sync 1 at %d, expect %g, got %g.\n", - j, DSEG_SYNC_SYM1, symbols_in[j]); - j++; - if (fabsf (symbols_in[j] - DSEG_SYNC_SYM2) > 1.0) - if (VERBOSE) fprintf (stderr, "** Missing dataseg sync 2 at %d, expect %g, got %g.\n", - j, DSEG_SYNC_SYM2, symbols_in[j]); - j++; - if (fabsf (symbols_in[j] - DSEG_SYNC_SYM3) > 1.0) - if (VERBOSE) fprintf (stderr, "** Missing dataseg sync 3 at %d, expect %g, got %g.\n", - j, DSEG_SYNC_SYM3, symbols_in[j]); - j++; - if (fabsf (symbols_in[j] - DSEG_SYNC_SYM4) > 1.0) - if (VERBOSE) fprintf (stderr, "** Missing dataseg sync 4 at %d, expect %g, got %g.\n", - j, DSEG_SYNC_SYM4, symbols_in[j]); - } -#endif -#undef VERBOSE - - // printf ("@@@ DIBITS @@@\n"); - - /* Now run each of the 12 Trellis encoders over their subset of - the input symbols */ - for (encoder = 0; encoder < NCODERS; encoder++) { - dbi = 0; /* Reinitialize dibit index for new encoder */ - fifo_t *dibit_fifo = fifo[encoder]; - - /* Feed all the incoming symbols into one encoder; - pump them into the relevant dibits. */ - for (i = 0; i < enco_which_max; i++) { - symbol = symbols_in[enco_which_syms[encoder][i]]; - dibit = dibit_fifo->stuff (viterbi[encoder].decode (symbol)); - // printf ("%d\n", dibit); - /* Store the dibit into the output data segment */ - dbwhere = enco_which_dibits[encoder][dbi++]; - dbindex = dbwhere >> 3; - shift = dbwhere & 0x7; - out[dbindex] = - (out[dbindex] & ~(0x03 << shift)) | (dibit << shift); - } /* Symbols fed into one encoder */ - } /* Encoders */ - - // fflush (stdout); -} diff --git a/gr-atsc/src/lib/atsci_viterbi_decoder.h b/gr-atsc/src/lib/atsci_viterbi_decoder.h deleted file mode 100644 index f339ce79a..000000000 --- a/gr-atsc/src/lib/atsci_viterbi_decoder.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_VITERBI_DECODER_H_ -#define _ATSC_VITERBI_DECODER_H_ - -#define USE_SIMPLE_SLICER 0 - -#include <atsc_api.h> -#include <atsc_types.h> -#include <interleaver_fifo.h> - -#if (USE_SIMPLE_SLICER) -#include <atsci_fake_single_viterbi.h> -typedef atsci_fake_single_viterbi single_viterbi_t; -#else -#include <atsci_single_viterbi.h> -typedef atsci_single_viterbi single_viterbi_t; -#endif - -/*! - * \brief fancy, schmancy 12-way interleaved viterbi decoder for ATSC - */ - -class ATSC_API atsci_viterbi_decoder { -public: - static const int NCODERS = 12; - - atsci_viterbi_decoder (); - ~atsci_viterbi_decoder (); - - //! reset all decoder states - void reset (); - - /*! - * Take 12 data segments of soft decisions (floats) and - * produce 12 RS encoded data segments. We work in groups of 12 - * because that's the smallest number of segments that composes a - * single full cycle of the decoder mux. - */ - void decode (atsc_mpeg_packet_rs_encoded out[NCODERS], - const atsc_soft_data_segment in[NCODERS]); - - - - protected: - typedef interleaver_fifo<unsigned char> fifo_t; - - static const int SEGMENT_SIZE = ATSC_MPEG_RS_ENCODED_LENGTH; // 207 - static const int OUTPUT_SIZE = (SEGMENT_SIZE * 12); - static const int INPUT_SIZE = (ATSC_DATA_SEGMENT_LENGTH * 12); - - void decode_helper (unsigned char out[OUTPUT_SIZE], - const float in[INPUT_SIZE]); - - - single_viterbi_t viterbi[NCODERS]; - fifo_t *fifo[NCODERS]; - bool debug; - -}; - - - -#endif /* _ATSC_VITERBI_DECODER_H_ */ diff --git a/gr-atsc/src/lib/atsci_viterbi_gen.cc b/gr-atsc/src/lib/atsci_viterbi_gen.cc deleted file mode 100644 index bff3c4773..000000000 --- a/gr-atsc/src/lib/atsci_viterbi_gen.cc +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2006 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. - */ - -#include <iostream> -#include <stdio.h> - -using std::cerr; - -/* - * Trellis-encode a whole pile of 12 data segments for ATSC. - * This also includes scrambling the data among twelve Trellis encoders. - * - * Input is twelve 207-byte blocks of raw data (Reed-Solomon output that's - * been scrambled up by interleaving with other blocks). - * - * Output is 12 x 208 x 4 bytes, each byte containing a 3-bit symbol. - * The first 4 bytes are the segment sync symbol. - * - Got the first version of Trellis encoder coded. Compiles, but I - didn't realize that each data segment contains an odd number of BITS! - The second data segment in a field starts by pulling bits out of the - middles of the bytes it's encoding. You actually have to read all the - entries in that table on page 59 AND 60 to get it. - - There's a 4-segment asymmetric pattern of bit accesses. - There's a 3-segment asymmetric pattern of muxing encoders. - - The result is there's a 12-segment pattern that repeats throughout - the encoding of a field. So this routine now encodes 12 segments at once. - - This encoding system was either designed by a complete idiot or by - a complete genius. It's highly complex when it could have been very - simple. Now the question is whether - this incredible complexity buys us anything subtle and important. - */ - -#define SEGMENT_SIZE 207 -#define INPUT_SIZE (SEGMENT_SIZE * 12) -#define DIBITS_PER_BYTE 4 -#define EXTRAS (4 * 12) /* FIXME, sync symbols and such */ -#define SYMBOLS_OUT ((INPUT_SIZE * DIBITS_PER_BYTE) + EXTRAS) -#define SEGOF(x) ( (x) / ((SEGMENT_SIZE+1) * DIBITS_PER_BYTE)) -#define SYMOF(x) (((x) % ((SEGMENT_SIZE+1) * DIBITS_PER_BYTE))-4) -#define ENCODERS 12 -#define ENCODER_SEG_BUMP 4 - - -/* Shift counts to bit numbers (high order, low order); 9x entries unused */ -static const int bit1[8] = {1, 99, 3, 98, 5, 97, 7, 96}; -static const int bit2[8] = {0, 99, 2, 98, 4, 97, 6, 96}; - -/* Detailed Debugging */ -int debug_dec = 0; - -/* - * Build indirect data structures to say which symbols go into which - * encoder, and then where the resulting dibits from the encoders go. - */ -int -build_decode_structures (char *fileout) -{ - int retval = 0; - int i; - int encoder; - int trellis_wheredata[ENCODERS]; - unsigned char *symp, *next_sym_seg; - unsigned char symbols[SYMBOLS_OUT]; - int chunk; - int shift; - int skip_encoder_bump; - int *enco_syms[ENCODERS]; - int *enco_dibits[ENCODERS]; - int j; - /* The data structures we'll build and then spit out... */ - int sync_symbol_indices[1000]; - int sync_symbol_indices_max; - int enco_which_syms[ENCODERS][INPUT_SIZE]; - int enco_which_dibits[ENCODERS][INPUT_SIZE]; - int enco_which_max; - #define BIT_PTR(int,shif) (((int) << 3) | ((shif) & 0x7)) - /* Running indices into them as we build 'em... */ - int *syncsyms = sync_symbol_indices; - - /* Start our running pointers at the start of our per-encoder subarrays */ - for (i = 0; i < ENCODERS; i++) { - enco_dibits[i] = enco_which_dibits[i]; - enco_syms[i] = enco_which_syms[i]; - } - - encoder = ENCODERS - ENCODER_SEG_BUMP; - skip_encoder_bump = 0; - symp = symbols; - next_sym_seg = symp; - - for (chunk = 0; - chunk < INPUT_SIZE; - chunk += ENCODERS) { - /* Associate data bytes with the Trellis encoders. - They get loaded or stored in an order that depends on where we are in the - segment sync progress (sigh). - GRR! When the chunk reload happens at the same time as the - segment boundary, we should bump the encoder NOW for the reload, - rather than LATER during the bitshift transition!!! */ - if (symp >= next_sym_seg) { - encoder = (encoder + ENCODER_SEG_BUMP) % ENCODERS; - skip_encoder_bump = 1; - } - - /* Remember where the data bytes are going to go, once we've - accumulated them from the 12 interleaved decoders */ - for (i = 0; i < ENCODERS; i++) { - trellis_wheredata[encoder] = chunk+i; - encoder++; - if (encoder >= ENCODERS) encoder = 0; - } - - for (shift = 6; shift >= 0; shift -= 2) { - - /* Segment boundaries happen to occur on some bitshift transitions. */ - if (symp >= next_sym_seg) { - /* Segment transition. Output a data segment sync symbol, and - mess with the trellis encoder mux. */ - *syncsyms++ = symp - symbols; - symp += 4; - next_sym_seg = symp + (SEGMENT_SIZE * DIBITS_PER_BYTE); - - if (!skip_encoder_bump) - encoder = (encoder + ENCODER_SEG_BUMP) % ENCODERS; - skip_encoder_bump = 0; - } - - /* Now run each of the 12 Trellis encoders to spit out 12 symbols. - Each encoder takes input from the same byte of the chunk, but the - outputs of the encoders come out in various orders. - NOPE -- this is false. The encoders take input from various - bytes of the chunk (which changes at segment sync time), AND - they also come out in various orders. You really do have to - keep separate track of: the datasegs bytes, the encoders, and - the symbol bytes -- because they're all moving with respect to - each other!!! */ - for (i = 0; i < ENCODERS; i++) { - if (debug_dec) - printf ("Seg %ld Symb %3ld Trell %2d Byte %6d Bits %d-%d = ", - (long) SEGOF(symp-symbols), (long) SYMOF(symp-symbols), - encoder, trellis_wheredata[encoder], - bit1[shift], bit2[shift]); - - /* Decoding: Grab symbol, run through decoder, slice dibit into - buffer. */ - /* This symbol goes into this encoder next */ - *(enco_syms[encoder]++) = symp - symbols; - symp++; - /* The next output from this encoder goes into these dibits */ - *(enco_dibits[encoder]++) = BIT_PTR(trellis_wheredata[encoder], shift); - - encoder++; if (encoder >= ENCODERS) encoder = 0; - } /* Encoders */ - } /* Bit shifts */ - -#if 0 - /* Now dump out the chunk of 12 data bytes that the twelve decoders have - accumulated. */ - unsigned char trellis_buffer[ENCODERS]; - unsigned char dibit; - unsigned char symbol; - int save_state; - for (i = 0; i < ENCODERS; i++) { - datasegs [trellis_wheredata[encoder]] = trellis_buffer[encoder]; - encoder++; - if (encoder >= ENCODERS) encoder = 0; - } /* Dumping encoder bytes */ -#endif - } /* Chunks */ - - /* Now print the resulting data structures in C++ */ - - if (!freopen(fileout, "w", stdout)) - return 2; - - printf ("/*\n\ - * atsc_viterbi_mux.cc\n\ - *\n\ - * Data structures for knowing which symbols are fed to which\n\ - * Viterbi decoders, and then where to put the resulting output dibits.\n\ - *\n\ - * Generated by 'atsc_viterbi_gen.cc'.\n\ - */\n\n"); - sync_symbol_indices_max = syncsyms - sync_symbol_indices; - printf ("const unsigned int sync_symbol_indices_max = %d;\n", - sync_symbol_indices_max); - printf ("const unsigned int sync_symbol_indices[%d] = {\n ", - sync_symbol_indices_max); - for (i = 0; i < sync_symbol_indices_max; i++) { - printf ("%d,%s", sync_symbol_indices[i], (7 == i%8)? "\n ": " "); - } - printf ("};\n\n"); - - enco_which_max = enco_dibits[0] - enco_which_dibits[0]; - for (i = 0; i < ENCODERS; i++) - if (enco_which_max != enco_dibits[i] - enco_which_dibits[i]) { - cerr << "Encoder " << i << " has different max_dibits " << - enco_dibits[i] - enco_which_dibits[i] << " than " << enco_which_max; - retval = 3; - } - - printf ("const unsigned int enco_which_max = %d;\n" , enco_which_max); - - printf ("const unsigned int enco_which_syms[%d][%d] = {\n", - ENCODERS, enco_which_max); - for (i = 0; i < ENCODERS; i++) { - printf (" /* %d */\n {", i); - for (j = 0; j < enco_which_max; j++) - printf ("%d,%s", enco_which_syms[i][j], (7 == j%8)? "\n ": " "); - printf ("},\n"); - } - printf ("};\n\n"); - - printf ("const unsigned int enco_which_dibits[%d][%d] = {\n", - ENCODERS, enco_which_max); - for (i = 0; i < ENCODERS; i++) { - printf (" /* %d */\n {", i); - for (j = 0; j < enco_which_max; j++) - printf ("%d,%s", enco_which_dibits[i][j], (7 == j%8)? "\n ": " "); - printf ("},\n"); - } - printf ("};\n\n"); - return retval; -} - -int -usage() -{ - cerr << "atsc_viterbi_gen: Usage:\n"; - cerr << " ./atsc_viterbi_gen -o atsc_viterbi_mux.cc\n"; - cerr << "That's all, folks!\n"; - return 1; -} - - -int -main(int argc, char **argv) -{ - if (argc != 3) return usage(); - if (argv[1][0] != '-' - || argv[1][1] != 'o' - || argv[1][2] != 0 ) return usage(); - return build_decode_structures(argv[2]); -} diff --git a/gr-atsc/src/lib/atsci_vsbtx_lp.cc b/gr-atsc/src/lib/atsci_vsbtx_lp.cc deleted file mode 100644 index 704cd00ca..000000000 --- a/gr-atsc/src/lib/atsci_vsbtx_lp.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <atsc_consts.h> -#include <atsci_vsbtx_lp.h> -#include <stdexcept> -#include <cmath> -#include <iostream> - -using std::vector; -using std::cerr; -using std::endl; - -// atsc root raised cosine filter, sampling rate = 21.52 MHz -static const float atsc_vsbtx_lp2x[] = { -#include "atsc_vsbtx_lp.dat" -}; - -#define NELEM(x) (sizeof (x) / sizeof ((x)[0])) - -// is a within 5% of target? - -static bool -close_enough_p (double a, double target) -{ - double delta = fabs (target * 0.05); // 5 percent - - return fabs (target - a) <= delta; -} - -vector<float> -atsc_vsbtx_lp::taps (double sampling_freq) -{ - if (close_enough_p (sampling_freq, 2 * ATSC_SYMBOL_RATE)){ - return vector<float>(&atsc_vsbtx_lp2x[0], &atsc_vsbtx_lp2x[NELEM(atsc_vsbtx_lp2x)]); - } - else - throw std::out_of_range ( - "atsc_vsbtx_lp: no pre-designed filter close enough"); -} diff --git a/gr-atsc/src/lib/atsci_vsbtx_lp.dat b/gr-atsc/src/lib/atsci_vsbtx_lp.dat deleted file mode 100644 index 0fa54d42b..000000000 --- a/gr-atsc/src/lib/atsci_vsbtx_lp.dat +++ /dev/null @@ -1,49 +0,0 @@ -/* - * FILTER SPECIFICATION FILE - * FILTER TYPE:LOW PASS 1H - * PASSBAND RIPPLE IN -dB -.0100 - * STOPBAND RIPPLE IN -dB -76.0000 - * PASSBAND CUTOFF FREQUENCY .250000 HERTZ - * STOPBAND CUTOFF FREQUENCY .360000 HERTZ - * SAMPLING FREQUENCY 1.00000 HERTZ - */ -/* - * gain of 2 - */ - 9.23312269151211e-04, - 8.75200144946575e-04, - -2.89211887866259e-03, - 1.31580047309399e-04, - 6.72745611518621e-03, - -5.82943391054869e-03, - -8.86140950024128e-03, - 1.84674616903067e-02, - 1.27039104700089e-03, - -3.39064113795757e-02, - 2.52537783235312e-02, - 3.74889532104135e-02, - -7.35438484698534e-02, - -3.70154529809952e-03, - 1.33745657280087e-01, - -1.12098718993366e-01, - -1.84760546311736e-01, - 5.98605459555984e-01, - 1.20420956425369e+00, - 5.98605459555984e-01, - -1.84760546311736e-01, - -1.12098718993366e-01, - 1.33745657280087e-01, - -3.70154529809952e-03, - -7.35438484698534e-02, - 3.74889532104135e-02, - 2.52537783235312e-02, - -3.39064113795757e-02, - 1.27039104700089e-03, - 1.84674616903067e-02, - -8.86140950024128e-03, - -5.82943391054869e-03, - 6.72745611518621e-03, - 1.31580047309399e-04, - -2.89211887866259e-03, - 8.75200144946575e-04, - 9.23312269151211e-04 diff --git a/gr-atsc/src/lib/atsci_vsbtx_lp.h b/gr-atsc/src/lib/atsci_vsbtx_lp.h deleted file mode 100644 index b892641c9..000000000 --- a/gr-atsc/src/lib/atsci_vsbtx_lp.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _ATSC_VSBTX_LP_H_ -#define _ATSC_VSBTX_LP_H_ - -#include <atsc_api.h> -#include <gr_fir_builder.h> - -class ATSC_API atsc_vsbtx_lp : public gr_fir_builder -{ -public: - virtual std::vector<float> taps (double sampling_freq); -}; - - - -#endif /* _ATSC_VSBTX_LP_H_ */ diff --git a/gr-atsc/src/lib/convolutional_interleaver.h b/gr-atsc/src/lib/convolutional_interleaver.h deleted file mode 100644 index 35a31d487..000000000 --- a/gr-atsc/src/lib/convolutional_interleaver.h +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _CONVOLUTIONAL_INTERLEAVER_H_ -#define _CONVOLUTIONAL_INTERLEAVER_H_ - -#include <vector> -#include <interleaver_fifo.h> -#include <assert.h> - -/*! - * \brief template class for generic convolutional interleaver - */ - -template<class symbol_type> -class convolutional_interleaver { - public: - - convolutional_interleaver (bool interleave_p, int nbanks, int fifo_size_incr); - virtual ~convolutional_interleaver (); - - //! reset interleaver (flushes contents and resets commutator) - void reset (); - - //! sync interleaver (resets commutator, but doesn't flush fifos) - void sync () { m_commutator = 0; } - - //! return end to end delay in symbols (delay through concatenated interleaver / deinterleaver) - int end_to_end_delay (); - - //! transform a single symbol - symbol_type transform (symbol_type input){ - symbol_type retval = m_fifo[m_commutator]->stuff (input); - m_commutator++; - if (m_commutator >= m_nbanks) - m_commutator = 0; - return retval; - } - - //! transform a bunch of symbols - void transform (symbol_type *out, const symbol_type *in, int nsymbols); - -protected: - int m_commutator; - int m_nbanks; - int m_fifo_size_incr; - std::vector<interleaver_fifo<symbol_type> *> m_fifo; -}; - -template<class symbol_type> -convolutional_interleaver<symbol_type>::convolutional_interleaver ( - bool interleave_p, - int nbanks, - int fifo_size_incr) -{ - assert (nbanks >= 1); - assert (fifo_size_incr >= 1); - - m_nbanks = nbanks; - m_fifo_size_incr = fifo_size_incr; - - m_fifo.resize (nbanks); - - if (interleave_p){ // configure as interleaver - for (int i = 0; i < nbanks; i++) - m_fifo[i] = new interleaver_fifo<symbol_type>(i * fifo_size_incr); - } - else { // configure as de-interleaver - for (int i = 0; i < nbanks; i++) - m_fifo[nbanks - 1 - i] = new interleaver_fifo<symbol_type>(i * fifo_size_incr); - } - sync (); -} - -template<class symbol_type> -convolutional_interleaver<symbol_type>::~convolutional_interleaver () -{ - for (int i = 0; i < m_nbanks; i++) - delete m_fifo[i]; -} - -template<class symbol_type> void -convolutional_interleaver<symbol_type>::reset () -{ - sync (); - for (int i = 0; i < m_nbanks; i++) - m_fifo[i]->reset (); -} - -template<class symbol_type> int -convolutional_interleaver<symbol_type>::end_to_end_delay () -{ - int m = m_nbanks * m_fifo_size_incr; - return m * (m_nbanks - 1); -} - -template<class symbol_type> void -convolutional_interleaver<symbol_type>::transform (symbol_type *out, - const symbol_type *in, - int nsymbols) -{ - // we may want to unroll this a couple of times... - for (int i = 0; i < nsymbols; i++) - out[i] = transform (in[i]); -} - -#endif /* _CONVOLUTIONAL_INTERLEAVER_H_ */ diff --git a/gr-atsc/src/lib/create_atsci_equalizer.cc b/gr-atsc/src/lib/create_atsci_equalizer.cc deleted file mode 100644 index f784116d2..000000000 --- a/gr-atsc/src/lib/create_atsci_equalizer.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <create_atsci_equalizer.h> -#include <atsci_equalizer_nop.h> -#include <atsci_equalizer_lms.h> -#include <atsci_equalizer_lms2.h> - -atsci_equalizer * -create_atsci_equalizer_nop () -{ - return new atsci_equalizer_nop (); -} - -atsci_equalizer * -create_atsci_equalizer_lms () -{ - return new atsci_equalizer_lms (); -} - -atsci_equalizer * -create_atsci_equalizer_lms2 () -{ - return new atsci_equalizer_lms2 (); -} diff --git a/gr-atsc/src/lib/create_atsci_equalizer.h b/gr-atsc/src/lib/create_atsci_equalizer.h deleted file mode 100644 index b291e0bbd..000000000 --- a/gr-atsc/src/lib/create_atsci_equalizer.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _CREATE_ATSC_EQUALIZER_H_ -#define _CREATE_ATSC_EQUALIZER_H_ - -#include <atsc_api.h> - -class atsci_equalizer; - -ATSC_API atsci_equalizer *create_atsci_equalizer_nop (); -ATSC_API atsci_equalizer *create_atsci_equalizer_lms (); -ATSC_API atsci_equalizer *create_atsci_equalizer_lms2 (); - -#endif /* _CREATE_ATSC_EQUALIZER_H_ */ diff --git a/gr-atsc/src/lib/create_atsci_fs_checker.cc b/gr-atsc/src/lib/create_atsci_fs_checker.cc deleted file mode 100644 index 5b9a4092c..000000000 --- a/gr-atsc/src/lib/create_atsci_fs_checker.cc +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <create_atsci_fs_checker.h> -#include <atsci_fs_checker_naive.h> - -atsci_fs_checker * -create_atsci_fs_checker () -{ - return new atsci_fs_checker_naive (); -} diff --git a/gr-atsc/src/lib/create_atsci_fs_checker.h b/gr-atsc/src/lib/create_atsci_fs_checker.h deleted file mode 100644 index 42119a6d4..000000000 --- a/gr-atsc/src/lib/create_atsci_fs_checker.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _CREATE_ATSC_FS_CHECKER_H_ -#define _CREATE_ATSC_FS_CHECKER_H_ - -#include <atsc_api.h> - -class atsci_fs_checker; - -/*! - * Factory that creates appropriate atsci_fs_checker - */ -ATSC_API atsci_fs_checker *create_atsci_fs_checker (); - - -#endif /* _CREATE_ATSC_FS_CHECKER_H_ */ diff --git a/gr-atsc/src/lib/create_atsci_fs_correlator.cc b/gr-atsc/src/lib/create_atsci_fs_correlator.cc deleted file mode 100644 index 414b2d7f4..000000000 --- a/gr-atsc/src/lib/create_atsci_fs_correlator.cc +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <create_atsci_fs_correlator.h> -#include <atsci_fs_correlator_naive.h> - -atsci_fs_correlator * -create_atsci_fs_correlator () -{ - return new atsci_fs_correlator_naive (); -} diff --git a/gr-atsc/src/lib/create_atsci_fs_correlator.h b/gr-atsc/src/lib/create_atsci_fs_correlator.h deleted file mode 100644 index b9b037403..000000000 --- a/gr-atsc/src/lib/create_atsci_fs_correlator.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _CREATE_ATSC_FS_CORRELATOR_H_ -#define _CREATE_ATSC_FS_CORRELATOR_H_ - -#include <atsc_api.h> - -class atsci_fs_correlator; - -/*! - * Factory that creates appropriate atsci_fs_correlator - */ -ATSC_API atsci_fs_correlator *create_atsci_fs_correlator (); - - -#endif /* _CREATE_ATSC_FS_CORRELATOR_H_ */ diff --git a/gr-atsc/src/lib/fpll_btloop_coupling.h b/gr-atsc/src/lib/fpll_btloop_coupling.h deleted file mode 100644 index 9a1a99d86..000000000 --- a/gr-atsc/src/lib/fpll_btloop_coupling.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _FPLL_BTLOOP_COUPLING_H_ -#define _FPLL_BTLOOP_COUPLING_H_ - -/*! - * Magic coupling constant between GrAtscFPLL and GrAtscBitTimingLoop. - * Trust me, you don't want to mess with this. - * - * The agc block buried in the FPLL indirectly sets the level of the input - * to the bit timing loop. The bit timing loop's convergence properties - * depend on the the mean amplitude of it's input. This constant ties - * them together such that you can tweak the input level of the bit timing loop - * (somewhat) without screwing everything. - */ - -static const float FPLL_BTLOOP_COUPLING_CONST = 3.125; - -#endif /* _FPLL_BTLOOP_COUPLING_H_ */ diff --git a/gr-atsc/src/lib/gen_encoder.py b/gr-atsc/src/lib/gen_encoder.py deleted file mode 100755 index 6c8fabf7a..000000000 --- a/gr-atsc/src/lib/gen_encoder.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/python -# -# Copyright 2002 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. -# - -def output(input, state): - x2 = (input >> 1) & 0x1 - x1 = (input >> 0) & 0x1 - s = (state >> 2) & 0x1 - t = (state >> 1) & 0x1 - u = (state >> 0) & 0x1 - - z0 = u - z1 = x1 - z2 = x2 ^ s - return (z2 << 2) | (z1 << 1) | z0 - - -def next_state(input, state): - x2 = (input >> 1) & 0x1 - x1 = (input >> 0) & 0x1 - s0 = (state >> 2) & 0x1 - t0 = (state >> 1) & 0x1 - u0 = (state >> 0) & 0x1 - - s1 = x2 ^ s0 - t1 = u0 - u1 = t0 ^ x1 - - return (s1 << 2) | (t1 << 1) | u1 - -print "@@@ NEXT @@@" - -for i in range (32): - state = (i >> 2) & 0x7 - input = i & 0x3 - print next_state (input, state) - - -print "@@@ OUTPUT @@@" - -for i in range (32): - state = (i >> 2) & 0x7 - input = i & 0x3 - print output (input, state) - diff --git a/gr-atsc/src/lib/interleaver_fifo.h b/gr-atsc/src/lib/interleaver_fifo.h deleted file mode 100644 index cacac85a3..000000000 --- a/gr-atsc/src/lib/interleaver_fifo.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 _INTERLEAVER_FIFO_H_ -#define _INTERLEAVER_FIFO_H_ - - -#include <interleaver_fifo.h> -#include <string.h> - -/*! - * \brief template class for interleaver fifo - */ - -template<class symbol_type> -class interleaver_fifo { - public: - - interleaver_fifo (unsigned int size); - ~interleaver_fifo (); - - //! reset interleaver (flushes contents and resets commutator) - void reset (); - - //! stuff a symbol into the fifo and return the oldest - symbol_type stuff (symbol_type input){ - if (m_size == 0) - return input; - - symbol_type retval = m_fifo[m_position]; - m_fifo[m_position] = input; - m_position++; - if (m_position >= m_size) - m_position = 0; - - return retval; - } - -protected: - unsigned int m_size; - unsigned int m_position; - symbol_type *m_fifo; -}; - -template<class symbol_type> -interleaver_fifo<symbol_type>::interleaver_fifo (unsigned int size) -{ - m_size = size; - m_position = 0; - m_fifo = new symbol_type[size]; - memset (m_fifo, 0, m_size * sizeof (symbol_type)); -} - -template<class symbol_type> -interleaver_fifo<symbol_type>::~interleaver_fifo () -{ - delete [] m_fifo; -} - -template<class symbol_type> void -interleaver_fifo<symbol_type>::reset () -{ - m_position = 0; - memset (m_fifo, 0, m_size * sizeof (symbol_type)); -} - -#endif /* _INTERLEAVER_FIFO_H_ */ diff --git a/gr-atsc/src/lib/plinfo.cc b/gr-atsc/src/lib/plinfo.cc deleted file mode 100644 index 30e192907..000000000 --- a/gr-atsc/src/lib/plinfo.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2006 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. - */ - -#include <atsc_types.h> -#include <assert.h> - -void -plinfo::delay (plinfo &out, const plinfo &in, int nsegs_of_delay) -{ - assert (in.regular_seg_p ()); - assert (nsegs_of_delay >= 0); - - int s = in.segno (); - if (in.in_field2_p ()) - s += ATSC_DSEGS_PER_FIELD; - - s -= nsegs_of_delay; - if (s < 0) - s += 2 * ATSC_DSEGS_PER_FIELD; - - assert (0 <= s && s < 2 * ATSC_DSEGS_PER_FIELD); - - if (s < ATSC_DSEGS_PER_FIELD) - out.set_regular_seg (false, s); // field 1 - else - out.set_regular_seg (true, s - ATSC_DSEGS_PER_FIELD); // field 2 -} - -void -plinfo::sanity_check (const plinfo &x) -{ - // basic sanity checks... - assert (x.segno () >= 0); - assert (x.segno () < (unsigned) ATSC_DSEGS_PER_FIELD); - assert ((x.flags () & ~0x3f) == 0); - - assert (x.regular_seg_p () ^ x.field_sync_p ()); - assert ((x.segno () != 0) ^ x.first_regular_seg_p ()); -} - diff --git a/gr-atsc/src/lib/qa_atsci.cc b/gr-atsc/src/lib/qa_atsci.cc deleted file mode 100644 index 8dc940bcb..000000000 --- a/gr-atsc/src/lib/qa_atsci.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2002 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 atsc - * directory into a single test suite. As you create new test cases, - * add them here. - */ - -#include <qa_atsci.h> -#include <qa_atsci_randomizer.h> -#include <qa_atsci_reed_solomon.h> -#include <qa_interleaver_fifo.h> -#include <qa_convolutional_interleaver.h> -#include <qa_atsci_data_interleaver.h> -#include <qa_atsci_basic_trellis_encoder.h> -#include <qa_atsci_sliding_correlator.h> -#include <qa_atsci_fake_single_viterbi.h> -#include <qa_atsci_single_viterbi.h> -#include <qa_atsci_trellis_encoder.h> -#include <qa_atsci_viterbi_decoder.h> -#include <qa_atsci_fs_correlator.h> -#include <qa_atsci_equalizer_nop.h> - -CppUnit::TestSuite * -qa_atsc::suite () -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite ("atsc"); - - s->addTest (qa_atsci_randomizer::suite ()); - s->addTest (qa_atsci_reed_solomon::suite ()); - s->addTest (qa_interleaver_fifo::suite ()); - s->addTest (qa_convolutional_interleaver::suite ()); - s->addTest (qa_atsci_data_interleaver::suite ()); - s->addTest (qa_atsci_basic_trellis_encoder::suite ()); - s->addTest (qa_atsci_sliding_correlator::suite ()); - s->addTest (qa_atsci_fake_single_viterbi::suite ()); - s->addTest (qa_atsci_single_viterbi::suite ()); - s->addTest (qa_atsci_trellis_encoder::suite ()); - s->addTest (qa_atsci_viterbi_decoder::suite ()); - s->addTest (qa_atsci_fs_correlator::suite ()); - s->addTest (qa_atsci_equalizer_nop::suite ()); - - return s; -} diff --git a/gr-atsc/src/lib/qa_atsci.h b/gr-atsc/src/lib/qa_atsci.h deleted file mode 100644 index 86aca2d32..000000000 --- a/gr-atsc/src/lib/qa_atsci.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_H_ -#define _QA_ATSC_H_ - -#include <cppunit/TestSuite.h> - -//! collect all the tests for the dtv directory - -class qa_atsc { - public: - //! return suite of tests for all of dtv directory - static CppUnit::TestSuite *suite (); -}; - - -#endif /* _QA_ATSC_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_basic_trellis_encoder.cc b/gr-atsc/src/lib/qa_atsci_basic_trellis_encoder.cc deleted file mode 100644 index 4a8137424..000000000 --- a/gr-atsc/src/lib/qa_atsci_basic_trellis_encoder.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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/TestAssert.h> -#include <qa_atsci_basic_trellis_encoder.h> -#include <stdlib.h> -#include <stdio.h> - -void -qa_atsci_basic_trellis_encoder::t0 () -{ - const static unsigned char in[14] = { - 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 2, 3 - }; - - const static unsigned char expected_out[14] = { - 0, 2, 3, 1, 1, 3, 0, 1, 2, 0, 0, 2, 5, 2 - }; - - for (unsigned i = 0; i < sizeof (in); i++) - CPPUNIT_ASSERT_EQUAL ((int) expected_out[i], enc.encode (in[i])); - - // reset encoder and test again. - - enc.reset (); - for (unsigned i = 0; i < sizeof (in); i++) - CPPUNIT_ASSERT_EQUAL ((int) expected_out[i], enc.encode (in[i])); -} - - -void -qa_atsci_basic_trellis_encoder::t1 () -{ - // Print data to externally check distribution. - // looks OK. -#if 0 - srandom (27); - - for (int i = 0; i < 8192; i++){ - int t = (random () >> 10) & 0x3; // 2 random bits - printf ("%d %d\n", t, enc.encode (t)); - } -#endif -} diff --git a/gr-atsc/src/lib/qa_atsci_basic_trellis_encoder.h b/gr-atsc/src/lib/qa_atsci_basic_trellis_encoder.h deleted file mode 100644 index e413d0d3d..000000000 --- a/gr-atsc/src/lib/qa_atsci_basic_trellis_encoder.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_BASIC_TRELLIS_ENCODER_H_ -#define _QA_ATSC_BASIC_TRELLIS_ENCODER_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -#include <atsci_basic_trellis_encoder.h> - -class qa_atsci_basic_trellis_encoder : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_atsci_basic_trellis_encoder); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - atsci_basic_trellis_encoder enc; - - void t0 (); - void t1 (); -}; - -#endif /* _QA_ATSC_BASIC_TRELLIS_ENCODER_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_data_interleaver.cc b/gr-atsc/src/lib/qa_atsci_data_interleaver.cc deleted file mode 100644 index 6069e8680..000000000 --- a/gr-atsc/src/lib/qa_atsci_data_interleaver.cc +++ /dev/null @@ -1,197 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cppunit/TestAssert.h> -#include <qa_atsci_data_interleaver.h> -#include <string.h> - - -/*! - * write an easy to identify pattern into the packet - */ -void -qa_atsci_data_interleaver::init_test_packet (int counter, - atsc_mpeg_packet_rs_encoded &out) -{ - out.data[0] = 0xf0; - out.data[1] = 0xff; - out.data[2] = (counter >> 8) & 0xff; - out.data[3] = counter & 0xff; - - for (int i = 4; i < 205; i++) - out.data[i] = i; - - out.data[205] = 0xa0; - out.data[206] = 0xaf; -} - -void -qa_atsci_data_interleaver::print_packet (FILE *fp, - int frame_number, - int field_number, - int segment_number, - const atsc_mpeg_packet_rs_encoded &in) -{ - fprintf (fp, "%04d:%d:%03d ", frame_number, field_number, segment_number); - - const unsigned char *p = &in.data[0]; - for (int i = 0; i < 8; i++) - fprintf (fp, "%02X", p[i]); - - fprintf (fp, " "); - p = &in.data[8]; - for (int i = 0; i < 8; i++) - fprintf (fp, "%02X", p[i]); - - - fprintf (fp, " ... "); - p = &in.data[191]; - for (int i = 0; i < 8; i++) - fprintf (fp, "%02X", p[i]); - - fprintf (fp, " "); - p = &in.data[199]; - for (int i = 0; i < 8; i++) - fprintf (fp, "%02X", p[i]); - - fprintf (fp, "\n"); -} - -void -qa_atsci_data_interleaver::chk_assert (const atsc_mpeg_packet_rs_encoded &expected, - const atsc_mpeg_packet_rs_encoded &actual) -{ - if (expected == actual) - return; - - FILE *fp = stderr; - - fprintf (fp, "Expected: "); - print_packet (fp, 0, 0, 0, expected); - - fprintf (fp, "Actual: "); - print_packet (fp, 0, 0, 0, actual); - - CPPUNIT_ASSERT (expected == actual); -} - -void -qa_atsci_data_interleaver::t0 () -{ - int counter = 0; - atsc_mpeg_packet_rs_encoded in, enc, out; - atsc_mpeg_packet_rs_encoded zero; - - memset (&zero, 0, sizeof (zero)); - - for (int frame = 0; frame < 4; frame++){ - for (int field = 0; field < 2; field++){ - for (int segment = 0; segment < 312; segment++, counter++){ - - // build test packet - init_test_packet (counter, in); - in.pli.set_regular_seg (field == 1, segment); - - // interleave it - outbound.interleave (enc, in); - - // deinterleave it - inbound.deinterleave (out, enc); - - if (counter < 52) - // CPPUNIT_ASSERT (zero == out); - chk_assert (zero, out); - - else if (counter >= 52){ - atsc_mpeg_packet_rs_encoded expected; - init_test_packet (counter - 52, expected); - // CPPUNIT_ASSERT (expected == out); - chk_assert (expected, out); - } - } - } - } -} - -// -// Note, this assumes that the interleaver and deinterleaver -// have the state left by t0. -// -// This test pushes crap into the interleaver, and then confirms that -// the deinterleaver recovers. This would be part of what you'd see -// on a channel change. -// - -void -qa_atsci_data_interleaver::t1 () -{ - int counter = 0; - atsc_mpeg_packet_rs_encoded in, enc, out; - atsc_mpeg_packet_rs_encoded zero; - - memset (&zero, 0, sizeof (zero)); - - static const int NCRAP = 13; - - // push NCRAP segments of crap into the interleaver, - // but don't change the deinterleaver state - - for (int i = 0; i < NCRAP; i++){ - init_test_packet (i + 2758, in); - in.pli.set_regular_seg (false, i + 5); - - outbound.interleave (enc, in); - } - - // now run the normal test. - // we should get good segments after NCRAP + 52 - - int starting_counter = 3141; - counter = starting_counter; - - for (int frame = 0; frame < 4; frame++){ - for (int field = 0; field < 2; field++){ - for (int segment = 0; segment < 312; segment++, counter++){ - - // build test packet - init_test_packet (counter, in); - in.pli.set_regular_seg (field == 1, segment); - - // interleave it - outbound.interleave (enc, in); - - // deinterleave it - inbound.deinterleave (out, enc); - - if (counter < starting_counter + 52 + NCRAP){ - // don't care... - } - else if (counter >= starting_counter + 52 + NCRAP){ - atsc_mpeg_packet_rs_encoded expected; - init_test_packet (counter - 52, expected); - // CPPUNIT_ASSERT (expected == out); - chk_assert (expected, out); - } - } - } - } -} diff --git a/gr-atsc/src/lib/qa_atsci_data_interleaver.h b/gr-atsc/src/lib/qa_atsci_data_interleaver.h deleted file mode 100644 index 6b9408c9a..000000000 --- a/gr-atsc/src/lib/qa_atsci_data_interleaver.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_DATA_INTERLEAVER_H_ -#define _QA_ATSC_DATA_INTERLEAVER_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdio.h> - -#include <atsci_data_interleaver.h> - -class qa_atsci_data_interleaver : public CppUnit::TestCase { - public: - - void setUp (){ - outbound.reset (); - inbound.reset (); - } - - CPPUNIT_TEST_SUITE (qa_atsci_data_interleaver); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - atsci_data_interleaver outbound; - atsci_data_deinterleaver inbound; - - void t0 (); - void t1 (); - - void init_test_packet (int counter, atsc_mpeg_packet_rs_encoded &out); - void print_packet (FILE *fp, int frame_number, int field_number, int segment_number, - const atsc_mpeg_packet_rs_encoded &in); - void chk_assert (const atsc_mpeg_packet_rs_encoded &expected, - const atsc_mpeg_packet_rs_encoded &actual); -}; - - -#endif /* _QA_ATSC_DATA_INTERLEAVER_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_equalizer_nop.cc b/gr-atsc/src/lib/qa_atsci_equalizer_nop.cc deleted file mode 100644 index 7039eeb8e..000000000 --- a/gr-atsc/src/lib/qa_atsci_equalizer_nop.cc +++ /dev/null @@ -1,247 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <qa_atsci_equalizer_nop.h> -#include <atsci_equalizer.h> -#include <atsci_equalizer_nop.h> -#include <atsci_pnXXX.h> -#include <atsc_types.h> -#include <cppunit/TestAssert.h> -#include <assert.h> -#include <iostream> -#include <string.h> - -using std::cerr; -using std::endl; - - -static const int SYMBOLS_PER_FIELD = (ATSC_DSEGS_PER_FIELD + 1) * ATSC_DATA_SEGMENT_LENGTH; -static const int PAD = 500; -static const int NFIELDS = 2; - -static const int INPUT_SIZE = PAD + (NFIELDS * SYMBOLS_PER_FIELD); - -static float -bin_map (int bit) -{ - return bit ? +5 : -5; -} - -static void -init_tags (atsc::syminfo *tags, int segnum, int fieldnum) -{ - int i; - - for (i = 0; i < ATSC_DATA_SEGMENT_LENGTH; i++){ - tags[i].symbol_num = i; - tags[i].segment_num = segnum; - tags[i].field_num = fieldnum; - tags[i].valid = 1; - } -} - -static void -init_data_seg (float *p, atsc::syminfo *tags, int v, int segnum, int fieldnum) -{ - init_tags (tags, segnum, fieldnum); - - int i = 0; - - p[i++] = bin_map (1); // data segment sync pulse - p[i++] = bin_map (0); - p[i++] = bin_map (0); - p[i++] = bin_map (1); - - for (; i < ATSC_DATA_SEGMENT_LENGTH; i++) - p[i] = (float) (i + v); -} - -static void -init_field_sync_tags (atsc::syminfo *tags, int fieldnum) -{ - init_tags (tags, atsc::SI_FIELD_SYNC_SEGMENT_NUM, fieldnum); -} - -static void -init_field_sync_common (float *p, int mask) - -{ - int i = 0; - - p[i++] = bin_map (1); // data segment sync pulse - p[i++] = bin_map (0); - p[i++] = bin_map (0); - p[i++] = bin_map (1); - - for (int j = 0; j < 511; j++) // PN511 - p[i++] = bin_map (atsc_pn511[j]); - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map (atsc_pn63[j]); - - for (int j = 0; j < 63; j++) // PN63, toggled on field 2 - p[i++] = bin_map (atsc_pn63[j] ^ mask); - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map (atsc_pn63[j]); - - p[i++] = bin_map (0); // 24 bits of VSB8 mode identifiera - p[i++] = bin_map (0); - p[i++] = bin_map (0); - p[i++] = bin_map (0); - - p[i++] = bin_map (1); - p[i++] = bin_map (0); - p[i++] = bin_map (1); - p[i++] = bin_map (0); - - p[i++] = bin_map (0); - p[i++] = bin_map (1); - p[i++] = bin_map (0); - p[i++] = bin_map (1); - - p[i++] = bin_map (1); - p[i++] = bin_map (1); - p[i++] = bin_map (1); - p[i++] = bin_map (1); - - p[i++] = bin_map (0); - p[i++] = bin_map (1); - p[i++] = bin_map (0); - p[i++] = bin_map (1); - - p[i++] = bin_map (1); - p[i++] = bin_map (0); - p[i++] = bin_map (1); - p[i++] = bin_map (0); - - - for (int j = 0; j < 92; j++) // 92 more bits - p[i++] = bin_map (atsc_pn63[j % 63]); - - // now copy the last 12 symbols of the previous segment - // bogus fill - - for (int j = 0; j < 12; j++) - p[i++] = bin_map (j & 1); - - assert (i == ATSC_DATA_SEGMENT_LENGTH); -} - -void -qa_atsci_equalizer_nop::setUp () -{ - eq = new atsci_equalizer_nop (); -} - -void -qa_atsci_equalizer_nop::tearDown () -{ - delete eq; - eq = 0; -} - -static void -setup_test_data (float *data, atsc::syminfo *tags) -{ - int mask = 0; - int i = 0; - - for (i = 0; i < PAD; i++){ - data[i] = (float) i; - tags[i].symbol_num = 13 + i; - tags[i].segment_num = 17; - tags[i].field_num = 0; - tags[i].valid = 1; - } - - for (int nfields = 0; nfields < NFIELDS; nfields++){ - init_field_sync_common (&data[i], mask); - init_field_sync_tags (&tags[i], mask); - i += ATSC_DATA_SEGMENT_LENGTH; - - for (int segnum = 0; segnum < 312; segnum++){ - init_data_seg (&data[i], &tags[i], i, segnum, mask); - i += ATSC_DATA_SEGMENT_LENGTH; - } - mask ^= 1; - } - assert (i == INPUT_SIZE); -} - -void -qa_atsci_equalizer_nop::t0 () -{ - // these are dynamically allocated because they are bigger - // than the default stack limit. - - float *input_data = new float[INPUT_SIZE]; - atsc::syminfo *input_tags = new atsc::syminfo[INPUT_SIZE]; - float *output_data = new float[INPUT_SIZE]; - - try { - - memset (input_data, 0, sizeof (input_data)); - memset (input_tags, 0, sizeof (input_tags)); - memset (output_data, 0, sizeof (output_data)); - - setup_test_data (input_data, input_tags); - - eq->filter (input_data, input_tags, - output_data, INPUT_SIZE); - - - // now check that data values got copied correctly - - for (int i = 0; i < INPUT_SIZE; i++){ - - if (input_tags[i].segment_num == atsc::SI_FIELD_SYNC_SEGMENT_NUM){ - // ignore entire field sync data segment - } - else if (input_tags[i].symbol_num <= 3){ - // ignore 4 symbols of data segment sync (+5, -5, -5, +5) - } - else { - if (output_data[i] != (float) i){ - cerr << "output_data[" << i << "] == " << output_data[i] << endl; - CPPUNIT_ASSERT_DOUBLES_EQUAL ((float) i, output_data[i], 1e-6); - } - } - } - - delete [] input_data; - delete [] input_tags; - delete [] output_data; - } - - catch ( ... ){ - delete [] input_data; - delete [] input_tags; - delete [] output_data; - } -} - -void -qa_atsci_equalizer_nop::t1 () -{ - // think of another test... -} diff --git a/gr-atsc/src/lib/qa_atsci_equalizer_nop.h b/gr-atsc/src/lib/qa_atsci_equalizer_nop.h deleted file mode 100644 index 244daf8b3..000000000 --- a/gr-atsc/src/lib/qa_atsci_equalizer_nop.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_EQUALIZER_NOP_H_ -#define _QA_ATSC_EQUALIZER_NOP_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class atsci_equalizer; - -class qa_atsci_equalizer_nop : public CppUnit::TestCase { -private: - atsci_equalizer *eq; - -public: - void setUp (); - void tearDown (); - - CPPUNIT_TEST_SUITE (qa_atsci_equalizer_nop); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - -private: - - void t0 (); - void t1 (); - -}; - -#endif /* _QA_ATSC_EQUALIZER_NOP_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_fake_single_viterbi.cc b/gr-atsc/src/lib/qa_atsci_fake_single_viterbi.cc deleted file mode 100644 index 2cc646daf..000000000 --- a/gr-atsc/src/lib/qa_atsci_fake_single_viterbi.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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/TestAssert.h> -#include <stdio.h> -#include <atsci_fake_single_viterbi.h> -#include <qa_atsci_fake_single_viterbi.h> -#include <random.h> -#include <string.h> - - -static const int NTRIALS = 50; -static const int MAXERRORS = 10; -static const int NN = 200; - -static const int MAXDIBIT = 3; - -void -qa_atsci_fake_single_viterbi::encode_block (unsigned char *out, unsigned char *in, - unsigned int n) -{ - for (unsigned int i = 0; i < n; i++) { - out[i] = encoder.encode(in[i]); - } -} - - -void -qa_atsci_fake_single_viterbi::decode_block (unsigned char *out, unsigned char *in, - unsigned int n) -{ - for (unsigned int i = 0; i < n; i++) { - out[i] = decoder.decode ((2*in[i]-7) + noise ()); - } -} - -float -qa_atsci_fake_single_viterbi::noise () -{ -#if 1 - return 2.0 * ((float) random () / RANDOM_MAX - 0.5);; -#else - return 0; -#endif -} - -void -qa_atsci_fake_single_viterbi::t0 () -{ - static const int blocklen = NN; - unsigned char in[blocklen]; - unsigned char enc[blocklen]; - unsigned char out[blocklen]; - int decoder_errors = 0; - int delay = decoder.delay (); - int i; - - // printf (" Delay is %d.\n", delay); - - srandom (27); // reproducable sequence of "random" values - - for (int nt = 0; nt < NTRIALS; nt++){ - - // load block with random data and encode - - for (i = 0; i < (blocklen-delay); i++) - in[i] = random () & MAXDIBIT; - for ( ; i < blocklen; i++) - in[i] = 0; /* To empty the delay buffers */ - - encoder.reset (); - encode_block (enc, in, blocklen); - - decoder.reset (); - - // decode the block - decode_block (out, enc, blocklen); - - // int offset = delay/4; - int offset = 2; - bool differs = (memcmp (in+offset, - out+delay+offset, blocklen-(delay+offset))); - - // initial values after reset are 0 - for (i = 0; i < delay; i++){ - if (out[i] != 0) - printf (" initial output at %i is %X, not 0\n", - i, out[i]); - } - - if (differs){ - printf (" incorrect data, trial #%d\n", nt); - - printf ("\n Erroneous result dibits:"); - for (int erri = 0; erri < (NN-delay); erri++) { - if (in[erri] != out[erri+delay]) - printf (" %d", erri); - } - printf ("\n In: "); - for (int erri = 0; erri < (NN-delay); erri++) { - printf (" %d", in[erri]); - } - printf ("\n Out: "); - for (int erri = 0; erri < (NN-delay); erri++) { - printf (" %d", out[erri+delay]); - } - printf ("\n Errs:"); - for (int erri = 0; erri < (NN-delay); erri++) { - printf (" %c", (in[erri] != out[erri+delay])? '*': ' '); - } - printf ("\n THIS IS A REAL PROBLEM.\n"); - decoder_errors++; - } - } - - printf (" Summary: %d decoder errors out of %d trials.\n", - decoder_errors, NTRIALS); - - CPPUNIT_ASSERT (decoder_errors == 0); -} - diff --git a/gr-atsc/src/lib/qa_atsci_fake_single_viterbi.h b/gr-atsc/src/lib/qa_atsci_fake_single_viterbi.h deleted file mode 100644 index 47805952c..000000000 --- a/gr-atsc/src/lib/qa_atsci_fake_single_viterbi.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_FAKE_SINGLE_VITERBI_H -#define _QA_ATSC_FAKE_SINGLE_VITERBI_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -#include <atsci_fake_single_viterbi.h> -#include <atsci_basic_trellis_encoder.h> - -class qa_atsci_fake_single_viterbi : public CppUnit::TestCase { - private: - atsci_fake_single_viterbi decoder; - atsci_basic_trellis_encoder encoder; - - CPPUNIT_TEST_SUITE (qa_atsci_fake_single_viterbi); - CPPUNIT_TEST (t0); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t0 (); - - void encode_block(unsigned char *out, unsigned char *in, unsigned n); - void decode_block(unsigned char *out, unsigned char *in, unsigned n); - float noise (); - -}; - -#endif /* _QA_ATSC_FAKE_SINGLE_VITERBI_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_fs_correlator.cc b/gr-atsc/src/lib/qa_atsci_fs_correlator.cc deleted file mode 100644 index 591c84050..000000000 --- a/gr-atsc/src/lib/qa_atsci_fs_correlator.cc +++ /dev/null @@ -1,255 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 <qa_atsci_fs_correlator.h> -#include <atsci_fs_correlator.h> -#include <create_atsci_fs_correlator.h> -#include <atsci_sync_tag.h> -#include <stdlib.h> -#include <algorithm> -#include <atsci_pnXXX.h> -#include <atsc_types.h> -#include <cppunit/TestAssert.h> -#include <assert.h> -#include <random.h> - - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - - -static float -bin_map (int bit) -{ - return bit ? +5 : -5; -} - -static void -init_field_sync_common (float *p, int mask) - -{ - int i = 0; - - p[i++] = bin_map(1); // data segment sync pulse - p[i++] = bin_map(0); - p[i++] = bin_map(0); - p[i++] = bin_map(1); - - for (int j = 0; j < 511; j++) // PN511 - p[i++] = bin_map(atsc_pn511[j]); - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map(atsc_pn63[j]); - - for (int j = 0; j < 63; j++) // PN63, toggled on field 2 - p[i++] = bin_map(atsc_pn63[j] ^ mask); - - for (int j = 0; j < 63; j++) // PN63 - p[i++] = bin_map(atsc_pn63[j]); - - p[i++] = bin_map(0); // 24 bits of VSB8 mode identifiera - p[i++] = bin_map(0); - p[i++] = bin_map(0); - p[i++] = bin_map(0); - - p[i++] = bin_map(1); - p[i++] = bin_map(0); - p[i++] = bin_map(1); - p[i++] = bin_map(0); - - p[i++] = bin_map(0); - p[i++] = bin_map(1); - p[i++] = bin_map(0); - p[i++] = bin_map(1); - - p[i++] = bin_map(1); - p[i++] = bin_map(1); - p[i++] = bin_map(1); - p[i++] = bin_map(1); - - p[i++] = bin_map(0); - p[i++] = bin_map(1); - p[i++] = bin_map(0); - p[i++] = bin_map(1); - - p[i++] = bin_map(1); - p[i++] = bin_map(0); - p[i++] = bin_map(1); - p[i++] = bin_map(0); - - - for (int j = 0; j < 92; j++) // 92 more bits - p[i++] = bin_map(atsc_pn63[j % 63]); - - // now copy the last 12 symbols of the previous segment - // bogus pad for this test... - - for (int j = 0; j < 12; j++) - p[i++] = bin_map(j & 1); - - assert (i == ATSC_DATA_SEGMENT_LENGTH); -} - -inline static void -init_field_sync_1 (float *s) -{ - init_field_sync_common (s, 0); -} - -inline static void -init_field_sync_2 (float *s) -{ - init_field_sync_common (s, 1); -} - -static void -cause_errors (float *p, int nerrs1, int nerrs2) -{ - static const int offset1 = 4; // offset to PN 511 - static const int offset2 = 578; // offset to 2nd PN 63 - - for (int i = 0; i < nerrs1; i++){ // flip nerrs1 bits in PN 511 - p[i + offset1] = -p[i + offset1]; - } - - for (int i = 0; i < nerrs2; i++){ // flip nerrs2 bits in PN 63 - p[i + offset2] = -p[i + offset2]; - } -} - - -void -qa_atsci_fs_correlator::setUp () -{ - fsc = create_atsci_fs_correlator (); -} - -void -qa_atsci_fs_correlator::tearDown () -{ - delete fsc; - fsc = 0; -} - - -// check sample fifo - -void -qa_atsci_fs_correlator::t0 () -{ - int delay = fsc->delay (); - int i; - float output_sample, output_tag; - - for (i = 0; i < delay; i++){ - fsc->filter ((float) i, &output_sample, &output_tag); - CPPUNIT_ASSERT_DOUBLES_EQUAL (0.0, output_sample, 1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL (atsc_sync_tag::NORMAL, output_tag, 1e-6); - } - - for (; i < delay + 5000; i++){ - fsc->filter ((float) i, &output_sample, &output_tag); - CPPUNIT_ASSERT_DOUBLES_EQUAL ((float) (i - delay), output_sample, 1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL (atsc_sync_tag::NORMAL, output_tag, 1e-6); - } -} - -void -qa_atsci_fs_correlator::util (int which_field, int nerrs1, int nerrs2) -{ - static const int PAD = 303; - static const int ISIZE = 4096; - int delay = fsc->delay (); - float output_sample, output_tag; - int i; - float input[ISIZE]; - - fsc->reset (); // known starting conditions - - // build input - - for (i = 0; i < PAD; i++) - input[i] = uniform () * 7; - - init_field_sync_common (&input[i], which_field); - cause_errors (&input[i], nerrs1, nerrs2); - i += ATSC_DATA_SEGMENT_LENGTH; - - for (; i < ISIZE; i++) - input[i] = uniform () * 7; - - // run the input and check - - for (i = 0; i < ISIZE; i++){ - fsc->filter (input[i], &output_sample, &output_tag); - if (i == delay + PAD){ // should be field sync - if (which_field == 0) - CPPUNIT_ASSERT_DOUBLES_EQUAL (atsc_sync_tag::START_FIELD_SYNC_1, output_tag, 1e-6); - else - CPPUNIT_ASSERT_DOUBLES_EQUAL (atsc_sync_tag::START_FIELD_SYNC_2, output_tag, 1e-6); - } - else { - CPPUNIT_ASSERT_DOUBLES_EQUAL (atsc_sync_tag::NORMAL, output_tag, 1e-6); - } - } -} - - -void -qa_atsci_fs_correlator::t1 () -{ - util (0, 0, 0); -} - -void -qa_atsci_fs_correlator::t2 () -{ - util (1, 0, 0); -} - -void -qa_atsci_fs_correlator::t3 () -{ - for (int nerrs1 = 0; nerrs1 < 20; nerrs1++){ - for (int nerrs2 = 0; nerrs2 < 5; nerrs2++){ - util (0, nerrs1, nerrs2); - } - } -} - -void -qa_atsci_fs_correlator::t4 () -{ - for (int nerrs1 = 0; nerrs1 < 5; nerrs1++){ - for (int nerrs2 = 0; nerrs2 < 5; nerrs2++){ - util (1, nerrs1, nerrs2); - } - } -} - diff --git a/gr-atsc/src/lib/qa_atsci_fs_correlator.h b/gr-atsc/src/lib/qa_atsci_fs_correlator.h deleted file mode 100644 index 4785f096e..000000000 --- a/gr-atsc/src/lib/qa_atsci_fs_correlator.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_FS_CORRELATOR_H_ -#define _QA_ATSC_FS_CORRELATOR_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class atsci_fs_correlator; - -class qa_atsci_fs_correlator : public CppUnit::TestCase { -private: - atsci_fs_correlator *fsc; - - public: - - void setUp (); - void tearDown (); - - CPPUNIT_TEST_SUITE (qa_atsci_fs_correlator); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST (t4); - CPPUNIT_TEST_SUITE_END (); - - private: - - void util (int which_field, int nerr1, int nerr2); - - void t0 (); - void t1 (); - void t2 (); - void t3 (); - void t4 (); -}; - -#endif /* _QA_ATSC_FS_CORRELATOR_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_randomizer.cc b/gr-atsc/src/lib/qa_atsci_randomizer.cc deleted file mode 100644 index c12582dfd..000000000 --- a/gr-atsc/src/lib/qa_atsci_randomizer.cc +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <qa_atsci_randomizer.h> - -#include <cppunit/TestAssert.h> -#include <string.h> - -static unsigned int expected_initial_states[] = { - 0x018f, - 0xd3db, - 0xbaf1, - 0x8e64, - 0x4732, - 0x2399, - 0xc2d0, - 0x6168 -}; - -static unsigned char expected_initial_values[] = { - 0xc0, - 0x6d, - 0x3f, - 0x99, - 0x38, - 0x6a, - 0x29, - 0x52 -}; - -#define NELEMENTS(ary) ((sizeof (ary)) / sizeof (ary[0])) - -void -qa_atsci_randomizer::t0_compare_output_maps () -{ - for (int i = 0; i < 0x10000; i++){ - unsigned char slow = atsci_randomizer::slow_output_map(i); - unsigned char fast = atsci_randomizer::fast_output_map(i); - CPPUNIT_ASSERT_EQUAL (slow, fast); - } -} - -void -qa_atsci_randomizer::t1_initial_states () -{ - // LFSR should start with expected states - - for (unsigned int i = 0; i < NELEMENTS (expected_initial_values); i++){ - unsigned int got = randomizer.state(); - randomizer.clk (); - CPPUNIT_ASSERT_EQUAL (expected_initial_states[i], got); - } -} - -void -qa_atsci_randomizer::t2_initial_values () -{ - // LFSR should start with expected values - - for (unsigned int i = 0; i < NELEMENTS (expected_initial_values); i++){ - unsigned char got = randomizer.output_and_clk (); - CPPUNIT_ASSERT_EQUAL (expected_initial_values[i], got); - } -} - -void -qa_atsci_randomizer::t3_reset () -{ - // LFSR should start with expected values - - for (unsigned int i = 0; i < NELEMENTS (expected_initial_values); i++){ - unsigned char got = randomizer.output_and_clk (); - CPPUNIT_ASSERT_EQUAL (expected_initial_values[i], got); - } - - randomizer.reset (); // reset LFSR - - // and now should repeat expected values - - for (unsigned int i = 0; i < NELEMENTS (expected_initial_values); i++){ - unsigned char got = randomizer.output_and_clk (); - CPPUNIT_ASSERT_EQUAL (expected_initial_values[i], got); - } -} - -void -qa_atsci_randomizer::t4_high_level () -{ - static const int N = 5; - - atsc_mpeg_packet in[N]; - atsc_mpeg_packet_no_sync middle[N]; - atsc_mpeg_packet out[N]; - - memset (in, 0, sizeof (in)); - memset (middle, 0, sizeof (middle)); - memset (out, 0, sizeof (out)); - - // setup input test data - - int counter = 0xff; - for (int n = 0; n < N; n++){ - in[n].data[0] = MPEG_SYNC_BYTE; - for (int i = 0; i < ATSC_MPEG_DATA_LENGTH; i++) - in[n].data[i + 1] = counter++; - } - - // randomize N packets - - for (int n = 0; n < N; n++) - randomizer.randomize (middle[n], in[n]); - - // reset LFSR and derandomize N packets - - randomizer.reset (); // reset LFSR - - for (int n = 0; n < N; n++) - randomizer.derandomize (out[n], middle[n]); - - // compare packets - - for (int n = 0; n < N; n++){ - CPPUNIT_ASSERT (in[n] == out[n]); - } -} - diff --git a/gr-atsc/src/lib/qa_atsci_randomizer.h b/gr-atsc/src/lib/qa_atsci_randomizer.h deleted file mode 100644 index 16d12754f..000000000 --- a/gr-atsc/src/lib/qa_atsci_randomizer.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_RANDOMIZER_H_ -#define _QA_ATSC_RANDOMIZER_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -#include <atsci_randomizer.h> - -class qa_atsci_randomizer : public CppUnit::TestCase { - private: - atsci_randomizer randomizer; - - public: - - void setUp (){ - // nop - } - - void tearDown (){ - // nop - } - - CPPUNIT_TEST_SUITE (qa_atsci_randomizer); - CPPUNIT_TEST (t0_compare_output_maps); - CPPUNIT_TEST (t1_initial_states); - CPPUNIT_TEST (t2_initial_values); - CPPUNIT_TEST (t3_reset); - CPPUNIT_TEST (t4_high_level); - CPPUNIT_TEST_SUITE_END (); - - - private: - void t0_compare_output_maps (); - void t1_initial_states (); - void t2_initial_values (); - void t3_reset (); - void t4_high_level (); - -}; - -#endif /* _QA_ATSC_RANDOMIZER_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_reed_solomon.cc b/gr-atsc/src/lib/qa_atsci_reed_solomon.cc deleted file mode 100644 index 81766f856..000000000 --- a/gr-atsc/src/lib/qa_atsci_reed_solomon.cc +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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/TestAssert.h> -#include <stdlib.h> -#include <stdio.h> -#include <atsci_reed_solomon.h> -#include <qa_atsci_reed_solomon.h> -#include <string.h> - - -static const int NROOTS = 20; -static const int NTRIALS = 100; -static const int NN = ATSC_MPEG_RS_ENCODED_LENGTH; - -void -qa_atsci_reed_solomon::t0_reed_solomon () -{ - atsc_mpeg_packet_no_sync in; - atsc_mpeg_packet_rs_encoded enc; - atsc_mpeg_packet_no_sync out; - int derrors; - int errlocs[NN]; - int errval; - int errloc; - int decoder_errors = 0; - - for (int nt = 0; nt < NTRIALS; nt++){ - - // test up to the error correction capacity of the code - for (int errors = 0; errors <= NROOTS*2; errors++){ - - // load block with random data and encode - - for (int i = 0; i < ATSC_MPEG_DATA_LENGTH; i++) - in.data[i] = random () & 0xff; - - rs.encode (enc, in); - - memset (errlocs, 0, sizeof (errlocs)); - - for (int i = 0; i < errors; i++){ - - do { - errval = random () & 0xff; - } while (errval == 0); // error value must be non-zero - - do { - errloc = random () % NN; - } while (errlocs[errloc] != 0); // must not choose the same location twice - - errlocs[errloc] = 1; - - enc.data[errloc] ^= errval; // cause the error - } - - // decode the errored block - derrors = rs.decode (out, enc); - - if (errors <= NROOTS/2) { - // We should have handled all these errors and corrected them. - if (derrors != errors){ - fprintf (stderr, " decoder says %d errors, true number is %d\n", derrors, errors); - decoder_errors++; - } - - if (in != out){ - fprintf (stderr, " uncorrected errors!\n"); - decoder_errors++; - } - } else { - // We have been given more errors than we could cope with. Make - // sure that we detect these errors. Complain if we get incorrect - // block but don't say it's incorrect. - bool differs = (in != out); - - if (differs && (derrors < 0)) { - // Reported uncorrectable error accurately - } else if (differs) { - fprintf (stderr, - " decoder found %d of %d errors, but incorrect block\n", - derrors, errors); - } else { - fprintf (stderr, " decoder corrected %d of %d errors unexpectedly\n", - derrors, errors); - } - } - } - } - - CPPUNIT_ASSERT (decoder_errors == 0); -} diff --git a/gr-atsc/src/lib/qa_atsci_reed_solomon.h b/gr-atsc/src/lib/qa_atsci_reed_solomon.h deleted file mode 100644 index 95d642e72..000000000 --- a/gr-atsc/src/lib/qa_atsci_reed_solomon.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_REED_SOLOMON_H_ -#define _QA_ATSC_REED_SOLOMON_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -#include <atsci_reed_solomon.h> - -class qa_atsci_reed_solomon : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_atsci_reed_solomon); - CPPUNIT_TEST (t0_reed_solomon); - CPPUNIT_TEST_SUITE_END (); - - private: - atsci_reed_solomon rs; - - void t0_reed_solomon (); -}; - -#endif /* _QA_ATSC_REED_SOLOMON_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_single_viterbi.cc b/gr-atsc/src/lib/qa_atsci_single_viterbi.cc deleted file mode 100644 index 699dce952..000000000 --- a/gr-atsc/src/lib/qa_atsci_single_viterbi.cc +++ /dev/null @@ -1,284 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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/TestAssert.h> -#include <stdlib.h> -#include <stdio.h> -#include <atsci_single_viterbi.h> -#include <qa_atsci_single_viterbi.h> -#include <random.h> -#include <string.h> - - -static const int NTRIALS = 50; -static const int MAXERRORS = 10; -static const int NN = 200; - -static const int MAXDIBIT = 3; - -void -qa_atsci_single_viterbi::encode_block (unsigned char *out, unsigned char *in, - unsigned int n) -{ - for (unsigned int i = 0; i < n; i++) { - out[i] = encoder.encode(in[i]); - } -} - - -void -qa_atsci_single_viterbi::decode_block (unsigned char *out, unsigned char *in, - unsigned int n, float noise_factor) -{ - for (unsigned int i = 0; i < n; i++) { - out[i] = decoder.decode((2*in[i]-7) + noise () * noise_factor); - } -} - -float -qa_atsci_single_viterbi::noise () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -void -qa_atsci_single_viterbi::t0 () -{ - static const int blocklen = NN; - unsigned char in[blocklen]; - unsigned char enc[blocklen]; - unsigned char out[blocklen]; - int decoder_errors = 0; - int delay = decoder.delay (); - int i; - - // printf (" Delay is %d.\n", delay); - - srandom (27); // reproducable sequence of "random" values - - for (int nt = 0; nt < NTRIALS; nt++){ - - // load block with random data and encode - - for (i = 0; i < (blocklen-delay); i++) - in[i] = random () & MAXDIBIT; - for ( ; i < blocklen; i++) - in[i] = 0; /* To empty the delay buffers */ - - encoder.reset (); - encode_block (enc, in, blocklen); - - decoder.reset (); - - // decode the block - decode_block (out, enc, blocklen, 1.0); - - // int offset = delay/4; - int offset = 2; - bool differs = (memcmp (in+offset, - out+delay+offset, blocklen-(delay+offset))); - - // initial values after reset are 0 - for (i = 0; i < delay; i++){ - if (out[i] != 0) - printf (" initial output at %i is %X, not 0\n", - i, out[i]); - } - - if (differs){ - printf (" incorrect data\n"); - - printf ("\n Erroneous result dibits:"); - for (int erri = 0; erri < (NN-delay); erri++) { - if (in[erri] != out[erri+delay]) - printf (" %d", erri); - } - printf ("\n In: "); - for (int erri = 0; erri < (NN-delay); erri++) { - printf (" %d", in[erri]); - } - printf ("\n Out: "); - for (int erri = 0; erri < (NN-delay); erri++) { - printf (" %d", out[erri+delay]); - } - printf ("\n Errs:"); - for (int erri = 0; erri < (NN-delay); erri++) { - printf (" %c", (in[erri] != out[erri+delay])? '*': ' '); - } - printf ("\n THIS IS A REAL PROBLEM.\n"); - decoder_errors++; - } - } - - printf (" Summary: %d decoder errors out of %d trials.\n", - decoder_errors, NTRIALS); - - CPPUNIT_ASSERT (decoder_errors == 0); -} - -void -qa_atsci_single_viterbi::t1 () -{ - static const int blocklen = NN; - unsigned char in[blocklen]; - unsigned char enc[blocklen]; - unsigned char out[blocklen]; - int errlocs[NN]; - int errval; - int errloc; - int decoder_errors = 0; - int delay = decoder.delay (); - int i; - - // printf (" Delay is %d.\n", delay); - - srandom (1); // reproducable sequence of "random" values - - for (int nt = 0; nt < NTRIALS; nt++){ - - // test up to the error correction capacity of the code - for (int errors = 0; errors <= MAXERRORS; errors++){ - - // load block with random data and encode - - for (i = 0; i < (blocklen-delay); i++) - in[i] = random () & MAXDIBIT; - for ( ; i < blocklen; i++) - in[i] = 0; /* To empty the delay buffers */ - - encoder.reset (); - encode_block (enc, in, blocklen); - - // Now generate 0 to N errors in the encoded symbols. - // - // If we restrict ourselves to damaging the low-order bit, - // our decoder finds and fixes the vast majority of errors. - // - // If we munge any or all of the three bits of the symbol, - // our decoder frequently gets the wrong data even with a single - // error. - // - // Let's see what it can do with just the two low-order bits. - // - // ALSO: Don't let any error be within 12 spots of another - // error. This simulates the muxed behavior. - - memset (errlocs, 0, sizeof (errlocs)); - - for (int j = 0; j < errors; j++){ - - do { - // errval = random () & 3; // FIXME: 1; // FIXME: MAXSYM; - errval = random () & 1; // FIXME: 1; // FIXME: MAXSYM; - } while (errval == 0); // error value must be non-zero - - // Don't insert errors in the first delay slot, since we - // don't have valid history to correct them. Also, don't - // insert burst errors (adjacent errors), or errors within 2, - // since we can't reliably correct them. Also we must not choose - // the same location twice when inserting an error. - - do { - errloc = random () % NN; - } while (errloc < delay || errlocs[errloc] != 0 - || (errloc > 0 && errlocs[errloc-1] != 0) - || (errloc > 1 && errlocs[errloc-2] != 0) - || (errloc < (NN-1) && errlocs[errloc+1] != 0) - || (errloc < (NN-2) && errlocs[errloc+2] != 0)); - - errlocs[errloc] = 1; - - enc[errloc] ^= errval; // cause the error - } - - // decode the errored block - decoder.reset (); - decode_block (out, enc, blocklen, 0.5); - - // int offset = delay/4; - int offset = 2; - bool differs = (memcmp (in+offset, - out+delay+offset, blocklen-(delay+offset))); - - // initial values after reset are 0 - for (i = 0; i < delay; i++){ - if (out[i] != 0) - printf (" initial output at %i is %X, not 0\n", - i, out[i]); - } - - if (differs){ - printf (" %2d errors introduced, %scorrect data\n", - errors, differs? "in": ""); - - // FIXME, should we be able to tell how many errs too? - if (differs) { - //const int ERRTOL = 12; /* Or relate to delay? */ - int shouldfix = 1; - //int lasti = -ERRTOL; - - printf ( " Inserted errors: "); - for (int erri = 0; erri < NN; erri++) { - if (errlocs[erri]) { - printf (" %d", erri); - // if (erri < lasti+ERRTOL) - // shouldfix = 0; - //lasti = erri; - } - } - printf ("\n Erroneous result dibits:"); - for (int erri = 0; erri < (NN-delay); erri++) { - if (in[erri] != out[erri+delay]) - printf (" %d", erri); - } - printf ("\n In: "); - for (int erri = 0; erri < (NN-delay); erri++) { - printf (" %d", in[erri]); - } - printf ("\n Out: "); - for (int erri = 0; erri < (NN-delay); erri++) { - printf (" %d", out[erri+delay]); - } - printf ("\n Errs:"); - for (int erri = 0; erri < (NN-delay); erri++) { - printf (" %c", (in[erri] != out[erri+delay])? '*': ' '); - } - if (shouldfix) - printf ("\n THIS IS A REAL PROBLEM.\n"); - else - printf ("\n BUT THAT'S OK since errors are too close.\n"); - if (shouldfix) - decoder_errors++; - } - } - } - } - - printf (" Summary: %d decoder errors out of %d trials.\n", - decoder_errors, (MAXERRORS*NTRIALS)); - - CPPUNIT_ASSERT (decoder_errors <= (MAXERRORS*NTRIALS) * .1); -} diff --git a/gr-atsc/src/lib/qa_atsci_single_viterbi.h b/gr-atsc/src/lib/qa_atsci_single_viterbi.h deleted file mode 100644 index 07585de22..000000000 --- a/gr-atsc/src/lib/qa_atsci_single_viterbi.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_SINGLE_VITERBI_H -#define _QA_ATSC_SINGLE_VITERBI_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -#include <atsci_single_viterbi.h> -#include <atsci_basic_trellis_encoder.h> - -class qa_atsci_single_viterbi : public CppUnit::TestCase { - private: - atsci_single_viterbi decoder; - atsci_basic_trellis_encoder encoder; - - CPPUNIT_TEST_SUITE (qa_atsci_single_viterbi); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t0 (); - void t1 (); - - void encode_block(unsigned char *out, unsigned char *in, unsigned n); - void decode_block(unsigned char *out, unsigned char *in, unsigned n, float noise_factor); - float noise (); - -}; - -#endif /* _QA_ATSC_SINGLE_VITERBI_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_sliding_correlator.cc b/gr-atsc/src/lib/qa_atsci_sliding_correlator.cc deleted file mode 100644 index 4b215ba85..000000000 --- a/gr-atsc/src/lib/qa_atsci_sliding_correlator.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cppunit/TestAssert.h> -#include <qa_atsci_sliding_correlator.h> -#include <cstdio> - -void -qa_atsci_sliding_correlator::t0 () -{ - -#if 0 - int count = 0; - int i; - for (i = 0; i < 100; i++) - printf ("%6d: %3d\n", count++, corr.input_bit (i & 1)); - - for (i = 0; i < 511; i++) - printf ("%6d: %3d\n", count++, corr.input_bit (atsc_pn511[i])); - - for (i = 0; i < 100; i++) - printf ("%6d: %3d\n", count++, corr.input_bit ((i & 2) != 0)); - - for (i = 0; i < 511; i++) - printf ("%6d: %3d\n", count++, corr.input_bit (atsc_pn511[i] ^ 1)); - - for (i = 0; i < 100; i++) - printf ("%6d: %3d\n", count++, - corr.input_bit (atsc_pn511[i] ^ atsc_pn511[i+31])); -#endif - -} diff --git a/gr-atsc/src/lib/qa_atsci_sliding_correlator.h b/gr-atsc/src/lib/qa_atsci_sliding_correlator.h deleted file mode 100644 index bdcd09319..000000000 --- a/gr-atsc/src/lib/qa_atsci_sliding_correlator.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_SLIDING_CORRELATOR_H_ -#define _QA_ATSC_SLIDING_CORRELATOR_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdio.h> - -#include <atsci_sliding_correlator.h> - -class qa_atsci_sliding_correlator : public CppUnit::TestCase { - - public: - - void setUp (void) - { - corr.reset (); - } - - CPPUNIT_TEST_SUITE (qa_atsci_sliding_correlator); - CPPUNIT_TEST (t0); - CPPUNIT_TEST_SUITE_END (); - - private: - atsci_sliding_correlator corr; - - void t0 (); -}; - - -#endif /* _QA_ATSC_SLIDING_CORRELATOR_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_trellis_encoder.cc b/gr-atsc/src/lib/qa_atsci_trellis_encoder.cc deleted file mode 100644 index d3a3482f0..000000000 --- a/gr-atsc/src/lib/qa_atsci_trellis_encoder.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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/TestAssert.h> -#include <qa_atsci_trellis_encoder.h> -#include <cstdio> -#include <string.h> -#include <stdlib.h> -#include <time.h> -#include <string.h> - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - - -static const int NCODERS = atsci_trellis_encoder::NCODERS; - -void -qa_atsci_trellis_encoder::t0 () -{ -#if 0 // generate i/o test data for t1 - - atsc_mpeg_packet_rs_encoded in[NCODERS]; - atsc_data_segment out[NCODERS]; - - - memset (in, 0, sizeof (in)); - memset (out, 0, sizeof (out)); - - srandom (1); - - printf ("@@@ INPUT @@@\n"); - for (int i = 0; i < NCODERS; i++){ - for (unsigned int j = 0; j < NELEM (in[i].data); j++){ - int t = (random () >> 8) & 0xff; // 8 random bits - in[i].data[j] = t; - printf ("%d\n", t); - } - } - - enc.reset (); - enc.encode (out, in); - - printf ("@@@ OUTPUT @@@\n"); - for (int i = 0; i < NCODERS; i++){ - for (unsigned int j = 0; j < NELEM (out[i].data); j++){ - printf ("%d\n", out[i].data[j]); - } - } -#endif -} - -void -qa_atsci_trellis_encoder::t1 () -{ - atsc_mpeg_packet_rs_encoded in[NCODERS]; - atsc_data_segment expected_out[NCODERS]; - atsc_data_segment actual_out[NCODERS]; - static const unsigned char raw_input[NCODERS * NELEM (in[0].data)] = { -#include "qa_atsci_trellis_encoder_t1_input.dat" - }; - static const unsigned char raw_output[NCODERS * NELEM (expected_out[0].data)] = { -#include "qa_atsci_trellis_encoder_t1_output.dat" - }; - - - // load up input - const unsigned char *r = &raw_input[0]; - for (int i = 0; i < NCODERS; i++){ - in[i].pli.set_regular_seg (false, i); - for (unsigned int j = 0; j < NELEM (in[i].data); j++){ - in[i].data[j] = *r++; - } - } - - // load up expected output - r = &raw_output[0]; - for (int i = 0; i < NCODERS; i++){ - expected_out[i].pli.set_regular_seg (false, i); - for (unsigned int j = 0; j < NELEM (expected_out[i].data); j++){ - expected_out[i].data[j] = *r++; - } - } - - memset (&actual_out, 0, sizeof (actual_out)); // ensure zero - - enc.reset (); - enc.encode (actual_out, in); // trellis code test data - - for (int i = 0; i < NCODERS; i++){ // check the result - CPPUNIT_ASSERT (expected_out[i] == actual_out[i]); - CPPUNIT_ASSERT (expected_out[i].pli == actual_out[i].pli); - } -} diff --git a/gr-atsc/src/lib/qa_atsci_trellis_encoder.h b/gr-atsc/src/lib/qa_atsci_trellis_encoder.h deleted file mode 100644 index fcd114330..000000000 --- a/gr-atsc/src/lib/qa_atsci_trellis_encoder.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_TRELLIS_ENCODER_H_ -#define _QA_ATSC_TRELLIS_ENCODER_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdio.h> - -#include <atsci_trellis_encoder.h> - -class qa_atsci_trellis_encoder : public CppUnit::TestCase { - - public: - - void setUp (void) - { - enc.reset (); - } - - CPPUNIT_TEST_SUITE (qa_atsci_trellis_encoder); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - atsci_trellis_encoder enc; - - void t0 (); - void t1 (); -}; - - -#endif /* _QA_ATSC_TRELLIS_ENCODER_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_trellis_encoder_t1_input.dat b/gr-atsc/src/lib/qa_atsci_trellis_encoder_t1_input.dat deleted file mode 100644 index e6109ddfc..000000000 --- a/gr-atsc/src/lib/qa_atsci_trellis_encoder_t1_input.dat +++ /dev/null @@ -1,2484 +0,0 @@ -69, -35, -152, -72, -220, -92, -148, -88, -31, -124, -88, -215, -65, -30, -169, -225, -0, -98, -8, -39, -35, -233, -205, -67, -15, -37, -249, -114, -194, -215, -196, -7, -251, -93, -80, -215, -186, -228, -48, -217, -97, -137, -177, -163, -168, -90, -132, -168, -189, -140, -208, -224, -118, -158, -36, -134, -196, -29, -248, -134, -245, -189, -141, -240, -26, -221, -200, -212, -194, -248, -173, -35, -130, -95, -198, -42, -185, -74, -211, -119, -215, -164, -88, -78, -66, -124, -212, -6, -154, -204, -141, -143, -137, -27, -127, -164, -249, -72, -120, -187, -64, -38, -222, -195, -133, -165, -237, -63, -240, -193, -183, -199, -101, -15, -21, -168, -140, -233, -175, -38, -182, -60, -182, -64, -87, -53, -228, -80, -126, -93, -11, -191, -132, -234, -130, -10, -143, -112, -74, -127, -49, -2, -71, -150, -18, -93, -63, -158, -71, -238, -197, -253, -43, -123, -62, -130, -177, -35, -211, -47, -129, -223, -238, -6, -202, -112, -17, -89, -224, -91, -217, -17, -94, -33, -168, -112, -126, -231, -14, -197, -214, -212, -195, -1, -79, -1, -132, -1, -36, -87, -48, -165, -55, -30, -172, -1, -143, -189, -90, -112, -24, -52, -130, -119, -85, -42, -231, -211, -18, -246, -153, -232, -202, -92, -234, -26, -93, -110, -27, -130, -197, -75, -40, -253, -106, -212, -254, -250, -145, -89, -106, -170, -141, -236, -33, -227, -23, -9, -183, -41, -255, -80, -18, -201, -172, -252, -227, -10, -107, -255, -141, -49, -74, -181, -46, -181, -138, -44, -175, -27, -133, -26, -198, -19, -6, -232, -246, -29, -241, -174, -71, -240, -254, -90, -185, -171, -87, -157, -182, -194, -157, -67, -243, -232, -248, -34, -157, -130, -78, -77, -158, -212, -103, -100, -231, -110, -76, -222, -140, -61, -140, -211, -46, -138, -46, -232, -54, -133, -133, -236, -72, -35, -47, -59, -11, -40, -94, -168, -171, -172, -246, -74, -128, -93, -174, -104, -204, -251, -70, -88, -57, -210, -44, -103, -93, -90, -79, -148, -223, -213, -129, -39, -248, -177, -99, -4, -217, -193, -172, -133, -110, -162, -207, -239, -0, -126, -87, -205, -121, -158, -37, -179, -113, -81, -27, -207, -171, -107, -99, -139, -65, -228, -178, -58, -149, -22, -62, -111, -216, -234, -244, -70, -141, -195, -54, -142, -66, -141, -91, -187, -44, -129, -111, -157, -210, -138, -108, -126, -245, -208, -9, -55, -180, -188, -113, -74, -211, -175, -185, -171, -154, -174, -242, -40, -114, -40, -183, -180, -182, -19, -112, -226, -148, -223, -128, -103, -106, -237, -229, -96, -189, -239, -151, -114, -172, -8, -189, -127, -184, -118, -43, -83, -37, -29, -123, -151, -70, -50, -76, -252, -69, -188, -223, -218, -156, -96, -65, -6, -77, -39, -102, -11, -23, -254, -125, -195, -7, -59, -67, -191, -178, -111, -18, -215, -141, -142, -111, -211, -192, -187, -208, -6, -119, -176, -225, -19, -16, -34, -26, -94, -74, -128, -105, -97, -127, -231, -37, -134, -35, -104, -69, -213, -215, -88, -172, -101, -230, -27, -56, -167, -214, -9, -174, -78, -185, -143, -98, -202, -178, -124, -40, -253, -253, -146, -94, -124, -122, -131, -2, -157, -236, -72, -114, -196, -161, -31, -41, -136, -58, -98, -47, -17, -107, -222, -96, -37, -110, -194, -239, -32, -63, -24, -29, -60, -170, -124, -185, -37, -0, -188, -195, -237, -4, -53, -178, -165, -84, -219, -45, -143, -62, -93, -161, -169, -60, -1, -206, -170, -196, -190, -203, -4, -214, -232, -65, -129, -101, -250, -166, -102, -182, -105, -83, -186, -159, -5, -96, -244, -225, -142, -132, -31, -236, -37, -201, -40, -39, -152, -210, -236, -86, -157, -240, -44, -134, -49, -173, -235, -44, -83, -81, -226, -189, -165, -157, -93, -170, -254, -81, -140, -141, -213, -171, -121, -251, -117, -161, -35, -13, -116, -16, -99, -17, -0, -144, -152, -50, -61, -132, -95, -145, -214, -66, -79, -123, -223, -172, -38, -222, -254, -178, -107, -211, -94, -229, -207, -212, -134, -242, -225, -251, -2, -69, -12, -3, -214, -164, -54, -20, -40, -149, -165, -254, -215, -245, -122, -183, -162, -160, -150, -160, -83, -1, -116, -177, -230, -67, -133, -109, -54, -103, -104, -56, -173, -117, -60, -131, -26, -115, -151, -67, -9, -61, -65, -224, -50, -188, -152, -212, -92, -46, -116, -175, -48, -232, -97, -23, -44, -231, -132, -98, -78, -237, -155, -251, -98, -215, -126, -124, -74, -22, -191, -83, -83, -1, -52, -133, -189, -205, -90, -26, -252, -207, -202, -45, -183, -43, -68, -228, -19, -201, -70, -98, -182, -225, -93, -25, -185, -220, -150, -4, -243, -86, -88, -70, -88, -141, -203, -21, -90, -38, -48, -87, -245, -250, -132, -173, -38, -200, -145, -57, -145, -215, -156, -72, -185, -250, -98, -114, -215, -248, -119, -202, -78, -207, -16, -166, -92, -220, -188, -183, -2, -237, -14, -247, -231, -146, -164, -14, -91, -53, -72, -237, -13, -228, -53, -199, -222, -151, -57, -181, -144, -177, -127, -222, -128, -143, -133, -220, -107, -66, -147, -109, -47, -162, -101, -23, -52, -9, -37, -143, -63, -110, -125, -77, -82, -179, -20, -49, -75, -78, -230, -219, -255, -102, -186, -127, -246, -64, -92, -98, -130, -240, -208, -177, -146, -53, -200, -198, -63, -238, -86, -127, -92, -212, -204, -175, -135, -224, -224, -210, -47, -199, -173, -46, -45, -104, -174, -36, -168, -10, -134, -42, -250, -86, -220, -141, -139, -165, -83, -203, -148, -170, -74, -241, -126, -22, -160, -6, -247, -128, -216, -38, -72, -134, -85, -117, -238, -3, -153, -151, -13, -32, -194, -8, -118, -158, -149, -2, -68, -233, -205, -217, -148, -23, -202, -19, -46, -106, -25, -38, -235, -241, -76, -51, -120, -162, -169, -103, -165, -66, -254, -179, -98, -192, -188, -217, -95, -82, -219, -164, -59, -169, -125, -208, -193, -71, -227, -239, -177, -252, -22, -157, -238, -98, -208, -102, -5, -121, -206, -170, -188, -204, -94, -31, -141, -26, -248, -237, -108, -212, -146, -168, -125, -15, -120, -62, -87, -91, -46, -9, -88, -68, -166, -70, -167, -118, -173, -172, -240, -124, -87, -172, -72, -181, -203, -214, -207, -196, -196, -59, -152, -86, -228, -21, -102, -92, -84, -190, -183, -131, -199, -16, -199, -110, -86, -110, -229, -4, -27, -213, -128, -114, -129, -201, -39, -77, -160, -247, -17, -100, -51, -169, -187, -23, -191, -33, -115, -20, -223, -43, -151, -167, -59, -94, -21, -146, -205, -251, -150, -233, -208, -23, -91, -82, -224, -131, -159, -129, -122, -177, -229, -173, -91, -160, -196, -27, -194, -56, -47, -162, -99, -198, -74, -159, -37, -95, -49, -243, -91, -200, -220, -43, -223, -55, -126, -192, -187, -29, -65, -53, -207, -39, -226, -42, -200, -167, -69, -138, -223, -116, -45, -67, -59, -119, -226, -97, -215, -20, -84, -50, -221, -48, -94, -188, -104, -220, -125, -35, -249, -191, -89, -200, -230, -60, -243, -175, -227, -56, -57, -195, -173, -103, -7, -233, -222, -234, -74, -181, -254, -158, -232, -219, -207, -70, -152, -56, -34, -22, -92, -28, -213, -181, -229, -188, -241, -216, -107, -213, -17, -165, -153, -190, -12, -160, -167, -235, -139, -242, -161, -138, -144, -137, -101, -96, -208, -254, -152, -242, -20, -244, -14, -234, -170, -243, -167, -155, -204, -19, -113, -221, -184, -11, -156, -197, -171, -68, -177, -55, -54, -82, -193, -199, -220, -39, -39, -172, -37, -192, -158, -58, -180, -173, -37, -94, -161, -204, -250, -109, -224, -108, -75, -153, -119, -232, -94, -35, -45, -15, -90, -99, -98, -27, -43, -62, -66, -83, -234, -104, -20, -137, -162, -201, -54, -200, -39, -215, -149, -34, -69, -117, -142, -144, -14, -6, -121, -109, -41, -166, -125, -131, -10, -223, -159, -53, -29, -225, -137, -8, -74, -157, -145, -237, -102, -200, -181, -142, -159, -74, -177, -229, -192, -64, -118, -207, -70, -239, -60, -111, -149, -185, -243, -160, -153, -146, -214, -182, -116, -95, -191, -190, -253, -80, -171, -99, -25, -97, -242, -185, -172, -163, -158, -108, -228, -20, -59, -42, -4, -120, -154, -154, -49, -141, -58, -202, -32, -16, -129, -149, -112, -65, -83, -109, -146, -255, -209, -171, -96, -196, -100, -13, -103, -2, -121, -76, -23, -181, -118, -28, -45, -17, -183, -95, -158, -241, -42, -191, -2, -172, -84, -115, -237, -168, -224, -127, -168, -178, -42, -8, -118, -142, -22, -222, -145, -143, -42, -169, -69, -160, -197, -114, -177, -124, -210, -80, -110, -252, -16, -113, -168, -101, -228, -149, -13, -197, -20, -181, -119, -63, -190, -237, -206, -212, -203, -95, -100, -245, -9, -169, -150, -207, -28, -72, -76, -238, -153, -186, -234, -169, -44, -146, -14, -17, -40, -28, -214, -61, -209, -77, -125, -144, -59, -75, -100, -6, -171, -200, -252, -180, -114, -147, -131, -142, -219, -207, -124, -117, -138, -102, -31, -183, -249, -45, -200, -34, -74, -158, -96, -27, -236, -221, -172, -39, -40, -16, -46, -212, -217, -43, -136, -75, -190, -11, -217, -154, -219, -85, -15, -102, -188, -46, -29, -182, -92, -229, -217, -166, -131, -57, -194, -112, -22, -110, -151, -63, -127, -197, -19, -88, -241, -156, -163, -175, -168, -125, -73, -131, -211, -88, -233, -143, -135, -7, -70, -227, -236, -31, -138, -112, -88, -77, -224, -111, -187, -120, -174, -59, -62, -194, -147, -47, -94, -55, -222, -6, -180, -40, -138, -135, -129, -116, -23, -8, -123, -93, -236, -103, -125, -118, -216, -213, -195, -184, -69, -127, -49, -244, -187, -111, -182, -78, -158, -21, -134, -125, -27, -59, -165, -165, -195, -38, -25, -218, -47, -149, -56, -27, -252, -181, -146, -213, -139, -86, -142, -208, -213, -191, -196, -145, -46, -123, -223, -205, -144, -102, -75, -171, -161, -240, -81, -101, -23, -107, -64, -70, -0, -120, -98, -253, -46, -244, -210, -185, -74, -96, -138, -32, -32, -78, -177, -79, -201, -145, -28, -89, -248, -103, -5, -154, -88, -87, -255, -112, -195, -63, -183, -196, -184, -25, -193, -230, -14, -148, -160, -89, -245, -42, -122, -21, -121, -43, -100, -67, -189, -129, -157, -182, -233, -162, -80, -65, -250, -80, -178, -190, -143, -105, -130, -72, -131, -67, -47, -145, -216, -208, -235, -205, -251, -101, -227, -116, -145, -71, -183, -78, -201, -84, -4, -178, -247, -85, -244, -242, -165, -166, -176, -53, -16, -50, -126, -147, -118, -173, -37, -78, -125, -16, -28, -120, -117, -0, -237, -6, -71, -164, -85, -17, -249, -90, -195, -240, -175, -184, -227, -85, -94, -147, -138, -110, -197, -8, -2, -60, -182, -39, -139, -51, -55, -167, -172, -173, -167, -153, -179, -239, -62, -9, -1, -55, -99, -196, -40, -19, -124, -12, -104, -219, -159, -243, -74, -101, -251, -76, -161, -178, -115, -44, -230, -171, -212, -146, -88, -124, -44, -12, -108, -107, -21, -109, -163, -121, -50, -204, -140, -175, -216, -244, -138, -119, -232, -213, -221, -228, -33, -127, -150, -149, -172, -124, -64, -129, -15, -153, -253, -59, -166, -105, -167, -187, -215, -74, -53, -9, -22, -193, -184, -238, -182, -67, -102, -158, -24, -68, -130, -58, -195, -24, -207, -111, -149, -16, -240, -164, -170, -238, -224, -80, -88, -135, -12, -47, -209, -65, -57, -232, -2, -242, -215, -185, -53, -62, -87, -78, -130, -218, -136, -69, -243, -87, -181, -136, -104, -166, -44, -18, -148, -13, -99, -237, -148, -111, -28, -102, -176, -86, -79, -179, -72, -38, -109, -125, -100, -197, -203, -231, -159, -83, -44, -146, -171, -226, -27, -20, -137, -72, -39, -29, -85, -138, -10, -234, -249, -39, -81, -170, -125, -160, -94, -197, -198, -203, -67, -43, -145, -15, -18, -48, -98, -63, -195, -14, -34, -222, -35, -171, -39, -74, -201, -125, -212, -212, -103, -206, -251, -185, -121, -121, -89, -215, -63, -32, -163, -130, -75, -52, -145, -94, -101, -244, -158, -40, -3, -192, -7, -38, -107, -47, -113, -52, -172, -69, -8, -20, -20, -4, -205, -141, -126, -38, -101, -189, -71, -9, -64, -147, -62, -210, -241, -163, -198, -143, -204, -202, -80, -212, -241, -187, -4, -98, -240, -176, -168, -249, -197, -188, -254, -146, -73, -124, -185, -175, -57, -1, -184, -122, -148, -246, -76, -134, -154, -19, -21, -102, -222, -102, -59, -207, -33, -63, -49, -18, -240, -218, -11, -181, -150, -9, -72, -224, -134, -2, -143, -192, -3, -71, -58, -151, -62, -135, -29, -216, -154, -51, -63, -120, -153, -123, -72, -187, -187, -122, -206, -171, -84, -218, -97, -234, -228, -169, -203, -106, -172, -90, -42, -175, -162, -101, -71, -224, -236, -101, -185, -135, -153, -248, -0, -51, -116, -72, -238, -47, -194, -189, -218, -22, -151, -60, -1, -123, -230, -204, -230, -146, -38, -17, -66, -200, -118, -137, -169, -99, -239, -98, -234, -136, -91, -234, -187, -208, -51, -170, -255, -245, -103, -218, -11, -255, -22, -12, -123, -252, -217, -97, -142, -255, -115, -208, -200, -234, -90, -114, -77, -73, -212, -56, -209, -48, -35, -141, -0, -86, -55, -0, -75, -159, -218, -87, -159, -240, -100, -26, -237, -61, -124, -124, -61, -239, -77, -6, -218, -167, -120, -39, -241, -77, -96, -195, -125, -132, -80, -126, -218, -136, -126, -38, -40, -88, -126, -199, -73, -226, -225, -55, -32, -94, -179, -94, -78, -1, -100, -40, -168, -220, -80, -154, -41, -177, -93, -167, -53, -173, -37, -16, -54, -164, -55, -94, -253, -181, -37, -70, -152, -7, -126, -184, -102, -50, -22, -180, -51, -123, -221, -220, -87, -46, -118, -129, -223, -211, -41, -20, -129, -78, -37, -183, -243, -92, -21, -240, -17, -59, -55, -169, -67, -181, -98, -170, -231, -121, -94, -27, -244, -60, -247, -76, -106, -109, -206, -73, -64, -247, -94, -193, -70, -131, -121, -57, -223, -143, -41, -241, -203, -97, -155, -14, -23, -253, -184, -255, -119, -23, -26, -108, -83, -17, -184, -190, -127, -135, -7, -191, -126, -102, -129, -196, -233, -251, -254, -200, -138, -40, -186, -85, -137, -85, -100, -160, -83, -29, -159, -202, -53, -185, -54, -137, -203, -239, -71, -74, -119, -79, -10, -245, -181, -140, -186, -158, -135, -184, -103, -18, -224, -33, -103, -106, -118, -204, -10, -201, -234, -170, -147, -31, -99, -202, -168, -47, -186, -239, -121, -50, -62, -131, -39, -243, -15, -225, -146, -151, -154, -249, -169, -123, -26, -17, -229, -145, -221, -239, -90, -199, -153, -238, -230, -253, -185, -142, -44, -116, -126, -166, -166, -189, -41, -206, -176, -57, -176, -67, -208, -74, -60, -121, -197, -87, -138, -170, -232, -104, -154, -67, -48, -52, -50, -22, -49, -236, -165, -94, -96, -36, -4, -7, -225, -46, -213, -146, -104, -133, -213, -57, -207, -18, -178, -149, -105, -61, -63, -82, -166, -218, -150, -214, -14, -200, -237, -64, -180, -147, -159, -21, -183, -164, -28, -152, -210, -241, -42, -59, -118, -0, -116, -70, -18, diff --git a/gr-atsc/src/lib/qa_atsci_trellis_encoder_t1_output.dat b/gr-atsc/src/lib/qa_atsci_trellis_encoder_t1_output.dat deleted file mode 100644 index 175d482b4..000000000 --- a/gr-atsc/src/lib/qa_atsci_trellis_encoder_t1_output.dat +++ /dev/null @@ -1,9984 +0,0 @@ -6, -1, -1, -6, -2, -0, -4, -2, -6, -2, -4, -2, -0, -2, -2, -6, -1, -4, -6, -1, -7, -3, -6, -3, -2, -7, -3, -7, -2, -4, -1, -4, -3, -7, -7, -5, -7, -3, -5, -7, -2, -2, -0, -5, -0, -4, -5, -5, -3, -0, -5, -2, -3, -1, -5, -2, -1, -7, -5, -5, -0, -7, -3, -2, -1, -2, -0, -4, -0, -1, -5, -1, -5, -1, -0, -1, -1, -6, -5, -4, -1, -1, -1, -3, -4, -5, -7, -0, -3, -1, -6, -6, -0, -5, -1, -6, -3, -7, -7, -7, -0, -0, -2, -7, -7, -3, -7, -4, -7, -6, -6, -3, -1, -5, -7, -3, -5, -2, -4, -4, -2, -6, -6, -2, -6, -6, -1, -0, -5, -2, -7, -6, -4, -3, -5, -2, -2, -6, -3, -5, -1, -7, -5, -3, -2, -3, -4, -7, -5, -3, -0, -2, -3, -1, -1, -5, -5, -2, -1, -1, -2, -5, -7, -2, -4, -1, -7, -1, -0, -2, -0, -5, -4, -7, -5, -5, -5, -5, -4, -1, -5, -5, -3, -1, -0, -4, -5, -6, -6, -7, -7, -7, -4, -0, -1, -1, -4, -1, -3, -2, -6, -0, -5, -0, -3, -1, -7, -5, -2, -0, -2, -5, -3, -3, -1, -1, -1, -2, -2, -5, -7, -7, -0, -4, -3, -7, -3, -2, -3, -6, -4, -7, -7, -5, -0, -5, -4, -0, -0, -4, -0, -7, -4, -0, -2, -1, -4, -2, -5, -7, -7, -2, -7, -3, -0, -1, -6, -7, -4, -6, -6, -7, -5, -3, -5, -6, -4, -4, -7, -2, -2, -5, -0, -2, -1, -3, -5, -0, -2, -5, -7, -2, -3, -4, -4, -2, -1, -0, -1, -0, -3, -2, -0, -3, -7, -5, -0, -3, -7, -3, -7, -4, -3, -2, -1, -3, -4, -0, -6, -1, -6, -7, -6, -0, -2, -1, -0, -6, -7, -5, -1, -5, -4, -6, -6, -2, -4, -6, -5, -2, -1, -0, -2, -1, -2, -2, -3, -1, -4, -0, -6, -3, -7, -1, -4, -7, -5, -5, -5, -0, -6, -4, -4, -7, -6, -0, -6, -4, -4, -4, -5, -3, -3, -0, -4, -2, -6, -3, -1, -3, -3, -3, -1, -5, -7, -2, -0, -0, -5, -5, -4, -1, -3, -7, -3, -3, -2, -1, -6, -2, -6, -1, -7, -1, -6, -2, -4, -4, -6, -0, -3, -1, -2, -7, -5, -5, -6, -0, -5, -1, -1, -7, -5, -4, -5, -0, -5, -7, -3, -0, -6, -2, -6, -3, -7, -5, -4, -7, -5, -0, -5, -6, -6, -2, -6, -6, -2, -2, -1, -3, -7, -1, -5, -1, -1, -7, -1, -4, -6, -0, -6, -0, -0, -0, -7, -4, -0, -1, -4, -0, -5, -0, -6, -3, -3, -7, -6, -1, -7, -5, -3, -2, -4, -2, -3, -7, -3, -3, -6, -0, -5, -7, -7, -5, -1, -1, -5, -6, -2, -0, -3, -3, -7, -6, -4, -0, -6, -6, -3, -4, -2, -7, -5, -3, -2, -6, -5, -7, -6, -2, -2, -4, -3, -7, -7, -0, -6, -3, -0, -3, -1, -1, -4, -4, -7, -6, -4, -1, -1, -3, -7, -6, -4, -6, -0, -4, -0, -6, -7, -2, -0, -0, -7, -0, -5, -0, -0, -4, -1, -3, -5, -6, -7, -1, -4, -2, -6, -4, -0, -0, -6, -1, -1, -3, -5, -0, -7, -3, -4, -0, -4, -4, -2, -1, -5, -7, -7, -5, -3, -5, -4, -2, -4, -0, -3, -7, -3, -2, -4, -6, -0, -1, -6, -3, -2, -2, -1, -0, -0, -6, -1, -2, -7, -1, -5, -7, -7, -7, -3, -7, -3, -3, -4, -5, -3, -1, -0, -6, -3, -1, -6, -1, -3, -3, -3, -2, -4, -5, -5, -4, -6, -1, -0, -7, -6, -0, -7, -2, -5, -7, -2, -0, -6, -5, -0, -6, -0, -1, -4, -7, -6, -6, -0, -0, -5, -3, -0, -2, -6, -2, -1, -5, -4, -0, -2, -6, -2, -6, -2, -7, -1, -4, -4, -5, -6, -2, -7, -7, -6, -4, -3, -5, -4, -6, -7, -3, -5, -7, -1, -7, -7, -6, -3, -1, -1, -3, -3, -4, -4, -5, -1, -0, -1, -5, -6, -1, -4, -1, -6, -7, -3, -7, -1, -7, -3, -6, -0, -3, -5, -1, -0, -3, -5, -6, -7, -3, -6, -4, -2, -0, -0, -1, -0, -2, -5, -0, -6, -2, -4, -4, -1, -1, -1, -1, -4, -2, -3, -4, -6, -2, -4, -4, -6, -0, -2, -1, -6, -3, -0, -6, -1, -1, -2, -6, -2, -3, -0, -3, -5, -7, -1, -7, -0, -0, -5, -5, -5, -5, -2, -2, -4, -4, -4, -7, -7, -3, -0, -4, -4, -3, -3, -6, -7, -3, -5, -2, -7, -7, -7, -5, -3, -6, -5, -5, -1, -3, -4, -2, -2, -0, -5, -6, -7, -6, -1, -4, -1, -0, -1, -7, -2, -1, -3, -2, -4, -3, -5, -3, -7, -3, -6, -5, -6, -1, -1, -6, -7, -7, -7, -5, -4, -3, -0, -7, -3, -4, -4, -3, -5, -6, -0, -1, -1, -6, -4, -0, -3, -1, -7, -1, -1, -0, -3, -1, -4, -4, -0, -5, -2, -4, -3, -7, -3, -2, -1, -5, -3, -6, -0, -2, -2, -3, -6, -2, -2, -5, -3, -5, -1, -5, -4, -6, -5, -3, -2, -6, -6, -2, -4, -5, -3, -0, -0, -3, -0, -2, -7, -1, -7, -4, -3, -1, -2, -7, -0, -3, -5, -0, -1, -4, -1, -6, -3, -5, -4, -3, -0, -6, -4, -0, -5, -5, -3, -7, -4, -1, -4, -4, -4, -0, -7, -0, -3, -0, -0, -1, -1, -5, -2, -3, -4, -0, -7, -4, -2, -5, -3, -3, -4, -1, -3, -1, -6, -6, -2, -6, -6, -6, -7, -2, -5, -7, -5, -7, -3, -5, -2, -3, -1, -4, -2, -2, -6, -4, -1, -2, -5, -4, -5, -7, -0, -2, -6, -1, -4, -1, -7, -6, -5, -1, -0, -2, -7, -1, -3, -0, -0, -2, -4, -5, -3, -4, -7, -6, -7, -2, -3, -5, -0, -4, -1, -4, -4, -5, -1, -5, -2, -0, -0, -2, -4, -2, -0, -1, -1, -6, -1, -6, -0, -2, -5, -2, -2, -3, -5, -6, -6, -0, -3, -0, -2, -1, -0, -3, -5, -3, -0, -4, -2, -6, -2, -4, -5, -6, -1, -7, -2, -0, -7, -0, -3, -3, -6, -6, -0, -0, -0, -0, -6, -3, -3, -4, -1, -7, -3, -7, -7, -4, -3, -5, -7, -7, -0, -2, -3, -4, -7, -1, -1, -0, -5, -4, -1, -6, -3, -5, -6, -5, -0, -5, -3, -6, -7, -1, -5, -2, -5, -6, -2, -2, -7, -5, -4, -1, -6, -2, -3, -1, -7, -4, -7, -4, -3, -1, -7, -0, -6, -6, -2, -0, -2, -4, -5, -0, -4, -1, -3, -1, -3, -7, -4, -5, -2, -2, -3, -0, -5, -5, -2, -4, -3, -7, -0, -2, -3, -3, -6, -2, -6, -3, -4, -5, -0, -4, -2, -2, -5, -5, -0, -5, -4, -2, -4, -2, -7, -3, -7, -3, -7, -7, -2, -2, -2, -6, -2, -6, -1, -3, -1, -1, -2, -4, -7, -4, -1, -1, -1, -7, -5, -6, -1, -5, -0, -3, -5, -0, -4, -6, -2, -5, -5, -6, -5, -5, -4, -5, -3, -0, -5, -0, -0, -1, -3, -5, -3, -1, -2, -1, -2, -2, -6, -6, -4, -1, -0, -2, -4, -5, -5, -1, -4, -3, -6, -5, -4, -7, -1, -0, -5, -5, -6, -5, -0, -5, -3, -6, -0, -6, -4, -6, -4, -1, -6, -1, -4, -1, -7, -4, -0, -6, -3, -1, -1, -5, -3, -5, -0, -7, -6, -0, -0, -3, -7, -6, -6, -5, -5, -5, -6, -4, -0, -4, -0, -3, -0, -6, -2, -3, -7, -7, -5, -3, -0, -6, -2, -2, -5, -1, -1, -6, -4, -6, -2, -3, -4, -1, -3, -2, -2, -4, -6, -0, -7, -0, -4, -0, -2, -2, -7, -5, -4, -5, -4, -6, -1, -0, -6, -5, -1, -6, -6, -0, -6, -0, -2, -3, -5, -0, -3, -0, -2, -5, -2, -7, -5, -3, -3, -3, -5, -4, -7, -7, -4, -4, -3, -5, -2, -3, -7, -2, -5, -6, -0, -5, -4, -7, -5, -5, -6, -0, -2, -2, -7, -3, -1, -7, -2, -5, -7, -7, -1, -5, -2, -5, -2, -7, -0, -6, -3, -3, -6, -0, -4, -4, -5, -0, -0, -0, -1, -2, -3, -0, -2, -3, -3, -7, -2, -1, -6, -7, -0, -7, -2, -7, -5, -7, -1, -7, -4, -4, -3, -3, -1, -1, -6, -7, -6, -0, -1, -0, -6, -7, -1, -6, -4, -3, -7, -0, -6, -7, -5, -7, -3, -7, -3, -4, -1, -4, -1, -1, -5, -1, -7, -5, -1, -4, -4, -2, -4, -1, -1, -4, -4, -3, -6, -3, -3, -7, -3, -7, -3, -6, -7, -3, -7, -0, -0, -0, -4, -5, -1, -7, -7, -2, -2, -3, -1, -7, -6, -7, -7, -7, -7, -0, -6, -5, -6, -0, -1, -5, -5, -1, -7, -6, -2, -7, -0, -0, -7, -3, -7, -5, -0, -5, -6, -0, -4, -3, -0, -5, -5, -5, -6, -3, -1, -1, -6, -4, -6, -4, -0, -0, -7, -1, -2, -4, -6, -1, -5, -4, -7, -3, -4, -1, -0, -3, -3, -5, -6, -7, -4, -2, -1, -5, -2, -0, -7, -6, -1, -0, -1, -0, -1, -3, -7, -3, -1, -3, -3, -6, -5, -5, -2, -3, -6, -7, -4, -0, -4, -5, -2, -7, -3, -0, -4, -7, -2, -6, -5, -7, -3, -3, -6, -5, -2, -5, -2, -2, -3, -4, -0, -7, -3, -6, -5, -1, -0, -2, -1, -4, -3, -4, -3, -2, -0, -4, -6, -5, -6, -6, -4, -0, -4, -0, -7, -0, -3, -4, -0, -1, -1, -5, -3, -4, -7, -4, -2, -4, -7, -0, -6, -7, -6, -6, -6, -1, -1, -6, -0, -0, -4, -4, -7, -6, -6, -4, -5, -0, -1, -2, -4, -0, -1, -4, -3, -4, -1, -2, -7, -6, -5, -5, -6, -6, -4, -2, -4, -6, -2, -7, -2, -7, -1, -2, -3, -1, -7, -3, -5, -1, -4, -1, -4, -1, -7, -4, -1, -0, -7, -7, -4, -2, -0, -7, -6, -1, -2, -2, -1, -5, -4, -2, -5, -6, -4, -6, -7, -1, -2, -7, -5, -6, -1, -0, -0, -7, -0, -6, -5, -3, -1, -5, -7, -2, -4, -0, -7, -3, -6, -3, -1, -2, -4, -7, -6, -1, -3, -4, -3, -6, -1, -3, -5, -0, -7, -2, -2, -4, -1, -4, -2, -2, -0, -4, -3, -6, -7, -2, -3, -1, -3, -4, -2, -7, -3, -1, -6, -3, -0, -3, -7, -2, -0, -2, -1, -3, -1, -6, -6, -3, -3, -5, -0, -2, -3, -1, -6, -6, -3, -2, -3, -4, -7, -5, -7, -7, -5, -4, -4, -4, -2, -1, -7, -1, -4, -5, -7, -5, -7, -5, -6, -4, -0, -6, -6, -6, -5, -5, -4, -5, -4, -0, -1, -4, -2, -2, -2, -4, -4, -3, -5, -7, -3, -3, -2, -0, -3, -7, -7, -4, -7, -4, -6, -0, -3, -7, -4, -6, -7, -1, -7, -2, -3, -3, -6, -5, -4, -6, -4, -3, -0, -5, -6, -7, -6, -5, -5, -2, -3, -0, -6, -3, -1, -5, -0, -7, -4, -3, -4, -6, -1, -6, -5, -2, -6, -3, -6, -4, -4, -4, -3, -3, -5, -3, -0, -6, -6, -4, -3, -3, -4, -3, -7, -1, -7, -5, -7, -5, -5, -5, -1, -3, -6, -5, -6, -1, -2, -3, -1, -6, -6, -0, -3, -2, -5, -5, -4, -3, -2, -0, -1, -4, -4, -1, -4, -6, -0, -5, -4, -4, -7, -1, -3, -2, -4, -4, -1, -1, -5, -5, -6, -7, -7, -6, -0, -5, -4, -7, -2, -6, -2, -7, -1, -1, -2, -0, -5, -4, -0, -1, -0, -6, -2, -6, -4, -1, -6, -2, -6, -7, -0, -5, -2, -7, -3, -0, -7, -3, -3, -7, -6, -1, -6, -5, -3, -7, -7, -0, -1, -2, -7, -5, -5, -5, -3, -5, -5, -6, -0, -4, -5, -4, -0, -7, -2, -1, -3, -5, -1, -4, -7, -4, -3, -6, -3, -0, -4, -3, -2, -1, -7, -2, -1, -2, -0, -7, -5, -7, -4, -6, -4, -3, -0, -5, -3, -7, -3, -3, -1, -7, -4, -2, -2, -4, -3, -6, -2, -1, -5, -0, -7, -2, -0, -7, -7, -7, -3, -2, -6, -1, -5, -5, -4, -6, -4, -3, -3, -5, -6, -7, -1, -1, -1, -0, -1, -5, -4, -2, -2, -1, -0, -5, -4, -7, -1, -5, -6, -6, -6, -6, -4, -1, -0, -1, -5, -6, -1, -6, -0, -4, -3, -5, -0, -3, -4, -1, -2, -0, -1, -2, -6, -0, -1, -6, -0, -6, -0, -5, -4, -0, -5, -3, -5, -0, -5, -4, -2, -2, -2, -5, -0, -4, -5, -1, -6, -6, -7, -4, -3, -7, -7, -5, -0, -4, -1, -3, -0, -7, -0, -0, -5, -5, -1, -1, -6, -6, -7, -0, -4, -3, -1, -2, -3, -5, -7, -1, -3, -1, -2, -3, -2, -4, -0, -3, -4, -1, -2, -1, -7, -0, -0, -1, -5, -7, -5, -1, -5, -5, -6, -7, -4, -1, -2, -7, -0, -3, -2, -5, -4, -3, -5, -0, -5, -6, -7, -2, -5, -6, -4, -7, -5, -6, -4, -7, -6, -6, -7, -0, -0, -4, -6, -6, -4, -4, -3, -7, -4, -7, -0, -4, -3, -2, -5, -0, -5, -6, -5, -0, -4, -5, -7, -0, -3, -3, -0, -0, -2, -7, -1, -5, -2, -5, -5, -2, -2, -5, -7, -6, -6, -3, -1, -0, -7, -5, -1, -3, -0, -3, -7, -3, -1, -2, -3, -3, -5, -7, -7, -5, -6, -4, -2, -1, -6, -6, -2, -5, -7, -2, -4, -1, -5, -3, -0, -1, -6, -1, -0, -5, -0, -6, -3, -5, -6, -7, -4, -3, -7, -4, -0, -5, -3, -1, -5, -1, -4, -0, -2, -0, -1, -5, -2, -7, -3, -4, -1, -3, -0, -3, -3, -5, -5, -4, -3, -2, -6, -1, -5, -4, -6, -5, -3, -2, -7, -5, -5, -6, -0, -0, -7, -7, -7, -1, -0, -4, -2, -6, -5, -7, -0, -7, -0, -1, -1, -3, -7, -0, -6, -6, -5, -5, -2, -1, -5, -1, -7, -0, -3, -0, -5, -1, -3, -3, -3, -5, -4, -3, -0, -5, -0, -4, -0, -2, -2, -4, -3, -7, -7, -6, -7, -6, -5, -0, -3, -4, -0, -3, -2, -2, -5, -2, -5, -6, -6, -0, -7, -4, -4, -1, -4, -2, -3, -1, -1, -5, -0, -6, -4, -6, -6, -7, -0, -5, -6, -4, -1, -2, -4, -1, -1, -7, -7, -0, -6, -0, -4, -3, -3, -0, -2, -4, -6, -5, -5, -1, -3, -3, -6, -1, -1, -6, -3, -3, -4, -3, -7, -4, -3, -3, -4, -1, -4, -2, -5, -3, -0, -6, -6, -1, -4, -6, -0, -3, -3, -3, -7, -2, -4, -2, -6, -0, -5, -6, -4, -6, -7, -7, -2, -6, -0, -7, -5, -7, -2, -7, -0, -0, -0, -6, -2, -7, -4, -1, -6, -5, -2, -7, -6, -2, -7, -6, -5, -5, -4, -3, -4, -7, -1, -4, -1, -5, -5, -5, -0, -1, -4, -6, -6, -0, -2, -5, -2, -6, -3, -2, -1, -1, -2, -6, -5, -1, -0, -4, -0, -0, -0, -6, -2, -7, -3, -5, -4, -6, -2, -5, -0, -0, -5, -7, -4, -6, -5, -2, -7, -6, -3, -2, -4, -0, -2, -3, -4, -6, -7, -2, -5, -5, -7, -2, -0, -4, -2, -6, -6, -3, -4, -3, -5, -2, -0, -7, -6, -6, -7, -2, -5, -7, -7, -5, -1, -6, -7, -3, -5, -1, -1, -5, -0, -6, -3, -7, -7, -3, -3, -4, -2, -6, -7, -4, -7, -0, -2, -6, -0, -1, -2, -5, -6, -0, -2, -5, -5, -4, -0, -2, -3, -7, -2, -6, -5, -0, -4, -4, -1, -2, -6, -5, -3, -2, -1, -0, -0, -2, -2, -1, -3, -1, -5, -2, -4, -0, -0, -0, -5, -5, -7, -6, -0, -0, -4, -2, -1, -6, -3, -4, -6, -0, -3, -6, -3, -7, -5, -3, -2, -7, -3, -0, -6, -3, -6, -7, -3, -5, -2, -5, -0, -1, -0, -0, -7, -3, -0, -3, -6, -7, -4, -1, -4, -5, -5, -2, -5, -2, -4, -6, -2, -2, -2, -5, -0, -7, -0, -3, -5, -6, -2, -0, -3, -4, -3, -5, -0, -6, -1, -1, -5, -7, -1, -2, -3, -0, -7, -1, -0, -0, -0, -7, -7, -5, -2, -5, -2, -4, -6, -1, -2, -2, -1, -0, -6, -5, -4, -4, -0, -4, -0, -7, -5, -5, -6, -5, -2, -3, -4, -7, -0, -6, -6, -6, -6, -0, -0, -2, -3, -6, -4, -1, -6, -7, -7, -0, -2, -1, -0, -2, -3, -4, -2, -5, -7, -1, -7, -0, -1, -2, -6, -1, -4, -0, -7, -7, -3, -3, -4, -0, -6, -0, -1, -6, -3, -2, -7, -6, -0, -2, -5, -4, -2, -0, -0, -4, -7, -5, -6, -2, -7, -6, -2, -6, -3, -2, -1, -0, -4, -4, -4, -1, -5, -7, -4, -5, -7, -3, -0, -0, -3, -1, -6, -2, -1, -3, -0, -2, -0, -5, -3, -4, -5, -0, -1, -0, -7, -2, -6, -0, -5, -5, -3, -2, -7, -3, -0, -6, -0, -0, -3, -0, -4, -7, -6, -1, -2, -1, -5, -1, -7, -4, -7, -2, -3, -6, -6, -2, -0, -5, -6, -2, -1, -6, -2, -5, -3, -2, -3, -0, -2, -3, -6, -2, -7, -1, -4, -4, -2, -7, -7, -4, -3, -6, -5, -1, -6, -6, -2, -1, -6, -1, -4, -0, -5, -2, -2, -6, -4, -4, -5, -4, -3, -3, -5, -6, -3, -7, -0, -0, -4, -2, -4, -3, -1, -2, -6, -3, -0, -5, -4, -6, -4, -3, -7, -7, -7, -4, -0, -7, -7, -1, -2, -7, -6, -1, -7, -6, -6, -0, -4, -4, -3, -5, -3, -3, -5, -3, -2, -4, -2, -2, -6, -1, -6, -7, -1, -4, -0, -0, -4, -6, -1, -1, -1, -6, -0, -6, -3, -3, -5, -3, -6, -5, -4, -2, -0, -6, -0, -2, -4, -5, -2, -1, -5, -2, -7, -4, -5, -1, -2, -3, -7, -7, -6, -5, -4, -6, -7, -6, -6, -2, -5, -7, -5, -6, -7, -7, -5, -3, -6, -7, -4, -2, -4, -4, -7, -6, -3, -6, -6, -1, -6, -1, -6, -5, -3, -1, -6, -1, -0, -0, -4, -7, -1, -1, -1, -4, -3, -6, -6, -4, -1, -0, -6, -2, -6, -5, -4, -5, -6, -0, -5, -1, -4, -6, -7, -6, -2, -5, -1, -0, -4, -2, -2, -2, -7, -5, -7, -7, -5, -7, -6, -3, -0, -1, -4, -0, -1, -4, -2, -7, -0, -4, -6, -5, -0, -2, -6, -2, -7, -1, -2, -0, -7, -7, -7, -3, -6, -2, -3, -3, -6, -2, -1, -7, -3, -1, -3, -2, -3, -7, -1, -1, -6, -6, -4, -1, -4, -1, -0, -2, -5, -7, -5, -7, -3, -5, -5, -3, -1, -5, -5, -7, -5, -2, -1, -0, -7, -4, -0, -2, -6, -1, -0, -5, -3, -0, -7, -7, -4, -7, -5, -2, -6, -7, -7, -5, -4, -0, -2, -1, -3, -5, -6, -7, -3, -2, -7, -5, -3, -6, -2, -3, -7, -5, -0, -5, -1, -0, -2, -1, -3, -1, -7, -6, -0, -1, -0, -7, -1, -2, -6, -1, -6, -0, -3, -2, -3, -5, -0, -6, -7, -1, -1, -1, -0, -7, -0, -3, -1, -7, -6, -0, -6, -4, -6, -7, -2, -7, -3, -7, -5, -4, -1, -6, -6, -5, -6, -6, -1, -6, -7, -0, -6, -1, -1, -6, -1, -4, -1, -0, -4, -6, -2, -5, -1, -1, -6, -7, -2, -3, -6, -2, -3, -3, -2, -4, -1, -0, -6, -1, -2, -5, -6, -1, -1, -7, -7, -5, -7, -3, -3, -5, -7, -7, -7, -0, -3, -2, -1, -4, -2, -3, -1, -3, -7, -0, -7, -1, -4, -2, -1, -5, -0, -0, -5, -0, -4, -3, -0, -4, -1, -5, -3, -2, -0, -5, -5, -7, -5, -1, -7, -3, -0, -6, -2, -2, -4, -6, -3, -3, -0, -7, -7, -7, -5, -6, -6, -1, -6, -6, -6, -6, -3, -6, -6, -6, -0, -5, -5, -2, -7, -3, -2, -2, -5, -2, -4, -6, -7, -6, -2, -0, -5, -5, -3, -7, -3, -7, -2, -5, -5, -6, -0, -4, -3, -7, -5, -3, -4, -7, -3, -0, -3, -5, -2, -2, -4, -0, -3, -6, -7, -0, -3, -7, -2, -6, -3, -5, -3, -7, -4, -0, -1, -7, -6, -3, -0, -6, -5, -4, -7, -7, -3, -2, -3, -1, -2, -2, -0, -3, -5, -5, -4, -4, -1, -1, -4, -5, -7, -4, -0, -1, -1, -0, -5, -5, -3, -4, -5, -3, -3, -4, -6, -3, -3, -3, -2, -2, -4, -1, -2, -0, -0, -2, -1, -2, -6, -3, -2, -0, -1, -0, -2, -5, -3, -7, -6, -2, -2, -6, -3, -6, -6, -3, -3, -4, -5, -3, -0, -5, -7, -4, -1, -5, -2, -7, -7, -3, -3, -0, -6, -0, -5, -4, -3, -0, -1, -0, -0, -5, -2, -5, -5, -5, -1, -0, -4, -5, -4, -5, -1, -5, -0, -2, -6, -2, -7, -6, -1, -2, -7, -0, -0, -5, -4, -6, -2, -2, -0, -7, -0, -4, -5, -1, -1, -1, -4, -3, -3, -7, -5, -1, -5, -6, -3, -4, -0, -1, -0, -7, -3, -7, -4, -1, -0, -7, -0, -7, -5, -3, -4, -0, -2, -2, -3, -5, -3, -5, -5, -7, -0, -4, -0, -5, -4, -0, -3, -3, -3, -3, -2, -4, -5, -7, -6, -6, -4, -4, -0, -6, -4, -6, -0, -7, -0, -5, -3, -2, -6, -0, -1, -2, -5, -6, -4, -5, -5, -1, -1, -7, -7, -0, -2, -3, -4, -1, -6, -1, -0, -5, -3, -1, -1, -0, -4, -7, -5, -0, -1, -1, -5, -7, -2, -7, -1, -4, -0, -4, -4, -7, -0, -3, -4, -6, -6, -0, -1, -6, -2, -5, -1, -5, -1, -6, -7, -6, -7, -7, -1, -1, -3, -2, -0, -5, -4, -6, -1, -7, -7, -1, -7, -2, -7, -2, -1, -1, -5, -1, -5, -1, -4, -3, -2, -6, -2, -5, -0, -7, -4, -0, -7, -3, -5, -0, -4, -5, -2, -6, -3, -4, -7, -5, -2, -2, -4, -3, -0, -2, -5, -6, -3, -1, -5, -2, -4, -2, -1, -1, -2, -2, -6, -5, -6, -4, -3, -4, -6, -1, -0, -7, -7, -3, -4, -6, -0, -1, -2, -0, -1, -2, -5, -0, -3, -1, -2, -2, -4, -4, -4, -4, -4, -4, -6, -5, -0, -7, -1, -5, -4, -1, -6, -6, -1, -6, -0, -2, -3, -4, -6, -4, -0, -2, -3, -7, -2, -3, -4, -2, -7, -1, -2, -7, -2, -6, -5, -5, -0, -7, -2, -5, -4, -6, -3, -7, -3, -7, -1, -3, -0, -2, -1, -4, -5, -2, -5, -2, -1, -1, -3, -4, -4, -4, -6, -1, -4, -1, -7, -6, -5, -7, -0, -3, -0, -6, -2, -6, -7, -6, -2, -1, -3, -4, -5, -7, -4, -3, -3, -4, -5, -0, -4, -6, -6, -7, -6, -0, -0, -7, -1, -4, -7, -0, -2, -4, -2, -7, -2, -7, -2, -6, -1, -6, -2, -6, -7, -6, -1, -0, -3, -1, -3, -2, -3, -5, -2, -3, -1, -1, -6, -3, -1, -5, -5, -3, -4, -4, -7, -1, -5, -6, -4, -3, -3, -5, -5, -1, -7, -7, -1, -7, -1, -2, -2, -6, -6, -3, -1, -1, -1, -7, -3, -0, -5, -1, -1, -0, -2, -2, -1, -7, -7, -6, -6, -5, -1, -2, -0, -2, -1, -2, -3, -2, -0, -0, -6, -6, -5, -6, -1, -7, -6, -3, -4, -4, -7, -6, -7, -4, -1, -3, -6, -1, -2, -3, -1, -4, -7, -5, -5, -0, -1, -3, -2, -1, -5, -6, -2, -4, -4, -6, -7, -4, -3, -4, -3, -5, -0, -2, -2, -0, -5, -6, -4, -0, -0, -1, -7, -1, -5, -7, -5, -6, -0, -1, -7, -2, -3, -2, -6, -7, -2, -5, -2, -1, -3, -0, -5, -5, -5, -6, -0, -6, -0, -5, -2, -2, -5, -3, -1, -2, -3, -3, -6, -2, -0, -1, -7, -2, -1, -1, -7, -0, -2, -1, -5, -1, -6, -3, -3, -3, -7, -5, -6, -4, -2, -7, -6, -2, -1, -4, -0, -7, -4, -5, -6, -2, -5, -2, -4, -0, -6, -5, -3, -2, -5, -7, -7, -3, -0, -4, -0, -6, -4, -2, -6, -1, -1, -6, -7, -3, -7, -2, -0, -5, -6, -0, -3, -4, -6, -0, -2, -2, -3, -3, -0, -6, -5, -2, -2, -6, -6, -3, -0, -0, -4, -7, -6, -2, -4, -7, -4, -5, -7, -5, -2, -2, -7, -2, -5, -1, -3, -1, -6, -0, -3, -5, -5, -3, -1, -4, -4, -2, -3, -1, -3, -1, -0, -1, -2, -3, -7, -6, -7, -4, -2, -1, -1, -0, -5, -3, -4, -4, -0, -7, -5, -2, -2, -1, -5, -3, -6, -6, -6, -1, -7, -5, -7, -1, -5, -5, -5, -5, -4, -6, -5, -4, -3, -7, -0, -6, -0, -3, -7, -3, -0, -3, -2, -5, -2, -4, -3, -4, -5, -4, -6, -6, -0, -1, -2, -4, -6, -7, -1, -2, -6, -3, -2, -2, -2, -7, -1, -3, -5, -1, -5, -1, -6, -1, -5, -7, -7, -0, -2, -3, -0, -3, -1, -6, -7, -3, -6, -5, -3, -3, -2, -6, -5, -2, -3, -0, -3, -2, -4, -3, -4, -3, -1, -2, -2, -6, -6, -6, -4, -2, -0, -2, -3, -4, -6, -7, -0, -7, -6, -3, -1, -5, -4, -2, -5, -3, -0, -7, -2, -7, -7, -5, -0, -6, -4, -7, -3, -5, -4, -4, -3, -0, -5, -5, -1, -2, -4, -1, -0, -7, -6, -5, -7, -7, -1, -5, -6, -7, -6, -5, -3, -6, -1, -6, -0, -3, -1, -3, -4, -5, -1, -7, -7, -6, -4, -6, -5, -0, -3, -0, -2, -1, -4, -0, -4, -5, -3, -1, -4, -3, -4, -1, -5, -7, -5, -1, -7, -0, -3, -6, -5, -1, -3, -4, -4, -2, -0, -6, -1, -5, -4, -4, -6, -1, -7, -7, -3, -6, -1, -2, -1, -6, -7, -0, -6, -7, -2, -7, -1, -7, -4, -3, -7, -2, -3, -2, -3, -4, -0, -0, -5, -3, -1, -7, -6, -7, -6, -3, -7, -7, -6, -7, -5, -0, -6, -2, -2, -1, -2, -5, -4, -7, -5, -3, -5, -7, -4, -6, -5, -3, -1, -3, -7, -4, -2, -0, -1, -1, -0, -5, -0, -0, -0, -4, -3, -5, -2, -7, -3, -1, -4, -0, -3, -3, -1, -3, -2, -6, -3, -3, -6, -5, -0, -1, -7, -3, -4, -7, -2, -4, -3, -0, -6, -3, -2, -6, -4, -2, -5, -6, -7, -0, -0, -7, -3, -4, -5, -6, -7, -2, -0, -2, -7, -6, -1, -1, -3, -5, -4, -7, -7, -3, -5, -7, -4, -7, -6, -7, -6, -0, -7, -3, -4, -1, -4, -3, -5, -7, -0, -6, -2, -3, -5, -6, -1, -3, -3, -2, -2, -6, -6, -0, -3, -7, -1, -2, -6, -2, -1, -6, -0, -2, -3, -4, -7, -2, -1, -5, -2, -4, -5, -7, -0, -5, -1, -4, -4, -2, -7, -6, -7, -6, -3, -3, -0, -2, -5, -2, -5, -1, -2, -0, -7, -5, -0, -4, -6, -6, -1, -5, -2, -6, -0, -4, -0, -4, -5, -7, -3, -5, -7, -4, -4, -0, -0, -2, -3, -7, -4, -1, -1, -2, -2, -3, -4, -2, -6, -3, -7, -3, -3, -7, -7, -2, -4, -7, -0, -7, -3, -7, -6, -4, -5, -6, -0, -1, -2, -2, -2, -1, -3, -4, -4, -7, -1, -2, -5, -4, -3, -6, -7, -5, -4, -3, -6, -1, -3, -5, -0, -1, -3, -1, -1, -5, -3, -7, -1, -1, -0, -4, -1, -2, -0, -6, -5, -3, -5, -2, -6, -3, -7, -1, -2, -2, -3, -6, -3, -4, -3, -6, -6, -4, -1, -0, -2, -7, -7, -7, -2, -7, -6, -5, -1, -1, -1, -5, -5, -5, -4, -7, -2, -7, -4, -6, -0, -6, -7, -4, -0, -1, -1, -4, -5, -0, -2, -0, -7, -0, -6, -7, -5, -3, -6, -5, -0, -5, -5, -0, -3, -4, -6, -5, -6, -4, -2, -2, -1, -6, -0, -4, -0, -4, -7, -7, -6, -7, -5, -0, -0, -2, -7, -2, -5, -6, -1, -0, -1, -7, -6, -6, -7, -5, -3, -1, -2, -5, -1, -3, -0, -0, -0, -7, -3, -6, -6, -2, -6, -4, -5, -1, -5, -3, -0, -5, -6, -0, -4, -2, -7, -3, -1, -1, -6, -3, -0, -5, -0, -0, -0, -1, -5, -5, -7, -5, -2, -4, -4, -3, -0, -2, -6, -4, -5, -1, -0, -1, -7, -1, -6, -0, -2, -7, -7, -3, -5, -3, -5, -5, -5, -2, -1, -7, -1, -5, -3, -5, -1, -6, -0, -1, -3, -6, -6, -5, -6, -7, -2, -5, -7, -4, -7, -5, -2, -1, -4, -5, -6, -2, -6, -3, -4, -4, -5, -1, -0, -6, -2, -3, -7, -0, -5, -2, -1, -0, -7, -5, -2, -4, -3, -2, -5, -0, -6, -6, -2, -2, -6, -3, -1, -6, -7, -4, -1, -2, -2, -5, -6, -7, -0, -0, -6, -1, -4, -0, -5, -1, -3, -0, -3, -3, -4, -5, -4, -2, -3, -6, -1, -4, -3, -5, -1, -6, -6, -1, -1, -6, -5, -7, -7, -7, -6, -4, -7, -0, -2, -6, -4, -6, -1, -5, -6, -7, -0, -7, -4, -4, -1, -6, -4, -1, -3, -3, -6, -6, -4, -7, -3, -6, -0, -5, -4, -2, -4, -4, -1, -4, -6, -2, -5, -7, -5, -0, -4, -2, -3, -5, -6, -0, -1, -2, -1, -3, -4, -7, -2, -5, -3, -4, -4, -6, -2, -7, -1, -4, -3, -7, -7, -0, -2, -7, -4, -5, -0, -7, -3, -3, -3, -4, -1, -5, -4, -1, -6, -0, -6, -4, -2, -5, -4, -7, -1, -0, -4, -1, -1, -5, -3, -5, -0, -1, -1, -7, -5, -1, -2, -5, -6, -2, -5, -0, -6, -5, -0, -4, -7, -4, -7, -5, -2, -0, -3, -5, -5, -7, -3, -1, -0, -5, -5, -3, -1, -4, -2, -6, -0, -4, -7, -0, -3, -4, -1, -2, -4, -6, -2, -6, -1, -7, -6, -7, -1, -3, -3, -4, -5, -3, -7, -7, -4, -7, -6, -1, -1, -5, -0, -6, -6, -1, -1, -7, -1, -4, -3, -5, -1, -5, -1, -3, -0, -5, -5, -2, -0, -5, -3, -7, -7, -7, -2, -5, -6, -1, -7, -6, -1, -0, -6, -2, -6, -2, -4, -7, -7, -3, -0, -7, -6, -5, -2, -6, -6, -2, -2, -0, -5, -2, -5, -1, -2, -6, -7, -1, -1, -5, -5, -1, -5, -0, -6, -3, -5, -0, -5, -6, -0, -6, -4, -4, -1, -4, -2, -0, -2, -2, -1, -6, -7, -2, -7, -7, -1, -0, -3, -3, -2, -5, -1, -7, -1, -7, -7, -1, -7, -6, -3, -3, -7, -6, -7, -5, -3, -1, -4, -7, -0, -5, -0, -6, -5, -4, -0, -3, -4, -3, -1, -4, -3, -4, -1, -6, -3, -6, -7, -6, -3, -2, -4, -7, -3, -5, -0, -1, -6, -1, -3, -4, -7, -2, -1, -3, -4, -0, -5, -6, -0, -2, -2, -0, -0, -7, -6, -6, -1, -3, -6, -6, -6, -6, -2, -6, -7, -3, -0, -4, -0, -5, -4, -7, -7, -7, -7, -3, -3, -6, -2, -2, -1, -7, -0, -1, -1, -5, -3, -7, -4, -6, -3, -5, -2, -4, -2, -7, -5, -1, -4, -0, -7, -3, -3, -0, -4, -7, -5, -2, -3, -5, -1, -3, -1, -5, -0, -5, -4, -1, -4, -0, -4, -3, -0, -7, -7, -7, -1, -2, -2, -3, -7, -4, -7, -0, -7, -0, -4, -4, -0, -0, -1, -0, -7, -0, -1, -1, -1, -1, -3, -5, -3, -6, -4, -1, -2, -2, -3, -6, -1, -6, -1, -0, -3, -1, -1, -2, -4, -5, -4, -4, -7, -0, -5, -1, -0, -6, -4, -0, -4, -0, -1, -6, -6, -4, -1, -0, -1, -0, -1, -2, -6, -3, -2, -1, -2, -2, -5, -3, -2, -0, -2, -7, -5, -3, -4, -2, -7, -3, -1, -5, -0, -0, -2, -5, -4, -0, -2, -0, -3, -1, -5, -5, -0, -2, -3, -5, -7, -7, -3, -4, -6, -3, -3, -5, -6, -3, -1, -7, -5, -7, -3, -4, -0, -2, -0, -5, -5, -5, -1, -0, -5, -2, -0, -6, -6, -6, -3, -1, -6, -7, -7, -3, -5, -4, -7, -7, -7, -7, -7, -7, -4, -4, -6, -7, -1, -6, -5, -3, -7, -1, -4, -6, -4, -1, -6, -0, -7, -5, -1, -0, -0, -3, -7, -2, -6, -6, -7, -3, -2, -0, -7, -1, -5, -2, -3, -5, -5, -6, -3, -7, -0, -5, -2, -0, -2, -2, -0, -2, -6, -3, -6, -0, -2, -0, -6, -5, -0, -1, -7, -2, -0, -7, -6, -5, -5, -1, -5, -6, -4, -0, -3, -5, -4, -0, -3, -0, -2, -4, -4, -2, -4, -3, -2, -6, -0, -1, -7, -5, -0, -1, -1, -3, -2, -3, -6, -4, -0, -0, -2, -4, -4, -4, -0, -5, -5, -4, -1, -6, -4, -1, -4, -7, -0, -3, -3, -1, -6, -3, -2, -7, -4, -4, -0, -5, -4, -1, -7, -7, -2, -3, -2, -1, -2, -1, -4, -7, -4, -3, -4, -4, -7, -0, -1, -7, -7, -4, -6, -6, -4, -2, -1, -7, -5, -5, -0, -0, -3, -5, -7, -0, -6, -6, -4, -5, -3, -4, -5, -3, -6, -6, -3, -4, -1, -1, -7, -5, -0, -7, -2, -7, -2, -4, -0, -0, -2, -2, -7, -3, -3, -7, -2, -6, -1, -4, -3, -0, -2, -0, -6, -2, -3, -4, -3, -2, -0, -0, -7, -6, -7, -6, -6, -2, -6, -5, -5, -5, -7, -6, -0, -5, -7, -5, -7, -5, -2, -4, -1, -6, -3, -3, -7, -2, -6, -0, -3, -6, -3, -1, -5, -6, -6, -5, -7, -4, -4, -7, -6, -4, -3, -2, -7, -1, -2, -5, -6, -6, -2, -1, -0, -2, -4, -0, -0, -0, -1, -7, -4, -5, -5, -3, -6, -5, -1, -4, -3, -1, -6, -2, -0, -2, -2, -4, -1, -0, -4, -2, -1, -6, -6, -1, -1, -6, -4, -7, -4, -5, -7, -1, -5, -0, -2, -0, -0, -0, -4, -5, -5, -2, -5, -6, -7, -2, -5, -0, -2, -2, -6, -1, -6, -2, -3, -6, -4, -7, -6, -6, -1, -5, -5, -5, -2, -3, -6, -5, -3, -3, -4, -1, -4, -6, -6, -5, -1, -5, -6, -6, -3, -2, -4, -6, -3, -4, -4, -1, -6, -3, -1, -6, -4, -4, -0, -2, -7, -6, -4, -5, -4, -6, -6, -3, -7, -4, -0, -3, -4, -3, -6, -1, -0, -2, -6, -1, -5, -4, -6, -5, -3, -7, -1, -7, -0, -1, -5, -5, -3, -2, -1, -3, -7, -4, -2, -0, -2, -0, -0, -3, -0, -7, -0, -2, -0, -7, -6, -1, -5, -3, -7, -6, -5, -5, -5, -0, -3, -1, -7, -4, -6, -7, -7, -0, -2, -1, -4, -4, -7, -1, -7, -1, -0, -2, -2, -2, -2, -1, -1, -0, -0, -1, -4, -6, -6, -4, -0, -1, -1, -1, -6, -6, -1, -5, -7, -0, -7, -0, -4, -4, -2, -5, -6, -7, -4, -5, -1, -6, -3, -6, -6, -1, -0, -3, -7, -1, -1, -1, -7, -5, -2, -5, -3, -0, -0, -4, -5, -3, -6, -1, -6, -0, -0, -2, -5, -7, -2, -5, -7, -4, -4, -1, -4, -7, -0, -2, -7, -7, -3, -4, -0, -3, -0, -3, -0, -3, -4, -5, -0, -0, -3, -3, -3, -7, -6, -6, -6, -4, -2, -6, -5, -7, -2, -7, -5, -4, -1, -6, -1, -7, -7, -2, -0, -1, -0, -2, -7, -5, -2, -1, -6, -7, -1, -3, -5, -1, -6, -0, -2, -6, -4, -2, -6, -2, -3, -5, -6, -1, -1, -0, -0, -6, -2, -2, -1, -0, -2, -7, -0, -7, -2, -4, -0, -1, -5, -7, -0, -2, -6, -4, -2, -2, -4, -0, -4, -4, -6, -7, -7, -7, -5, -7, -3, -6, -6, -4, -0, -1, -2, -4, -3, -3, -6, -5, -5, -5, -3, -4, -6, -4, -7, -1, -6, -6, -6, -3, -5, -6, -1, -2, -3, -5, -7, -2, -0, -2, -7, -6, -1, -0, -1, -3, -7, -2, -4, -4, -0, -3, -7, -0, -1, -0, -1, -1, -0, -4, -7, -4, -0, -1, -0, -4, -7, -2, -3, -3, -1, -2, -3, -0, -6, -7, -1, -6, -2, -7, -6, -4, -6, -1, -6, -4, -7, -6, -2, -3, -2, -1, -6, -1, -4, -0, -2, -0, -3, -6, -0, -5, -5, -7, -3, -4, -2, -7, -1, -2, -0, -1, -6, -5, -2, -0, -5, -3, -5, -3, -0, -1, -1, -0, -7, -5, -6, -7, -5, -5, -2, -4, -5, -6, -0, -3, -5, -3, -5, -1, -5, -1, -4, -1, -6, -4, -5, -3, -3, -2, -4, -7, -1, -1, -4, -0, -2, -6, -2, -6, -2, -6, -7, -6, -5, -5, -6, -1, -3, -7, -6, -0, -6, -1, -1, -4, -5, -1, -3, -2, -1, -3, -5, -2, -7, -6, -3, -6, -7, -7, -7, -6, -5, -2, -4, -7, -7, -0, -4, -3, -2, -6, -6, -5, -3, -0, -1, -1, -2, -6, -7, -7, -2, -0, -6, -4, -4, -2, -0, -7, -2, -5, -3, -6, -5, -0, -7, -3, -5, -3, -3, -4, -7, -0, -2, -0, -6, -4, -5, -5, -6, -1, -7, -3, -3, -7, -4, -6, -4, -6, -7, -5, -2, -3, -2, -1, -2, -1, -2, -7, -2, -3, -6, -7, -7, -4, -6, -3, -0, -7, -7, -1, -5, -5, -6, -0, -7, -3, -5, -4, -4, -2, -5, -1, -2, -5, -1, -1, -4, -7, -2, -1, -0, -0, -1, -3, -2, -1, -2, -6, -7, -2, -4, -2, -2, -0, -3, -4, -5, -7, -2, -0, -1, -6, -2, -2, -3, -6, -4, -7, -0, -2, -3, -0, -7, -5, -5, -5, -7, -1, -7, -1, -7, -6, -5, -6, -0, -4, -2, -6, -6, -0, -7, -1, -7, -7, -3, -5, -3, -1, -2, -4, -6, -5, -6, -7, -4, -7, -6, -6, -1, -6, -3, -0, -7, -2, -0, -0, -5, -6, -2, -4, -3, -0, -3, -6, -3, -4, -2, -3, -0, -0, -7, -6, -2, -0, -6, -7, -0, -6, -5, -1, -5, -4, -3, -7, -4, -2, -0, -3, -7, -5, -6, -5, -0, -4, -0, -5, -6, -3, -6, -6, -7, -4, -0, -3, -7, -6, -1, -7, -7, -7, -7, -6, -6, -5, -2, -2, -3, -5, -6, -2, -1, -6, -1, -5, -4, -4, -7, -4, -6, -0, -2, -2, -7, -4, -5, -4, -6, -5, -1, -4, -2, -7, -3, -1, -0, -0, -3, -5, -1, -4, -1, -0, -3, -1, -1, -4, -3, -4, -2, -0, -0, -5, -3, -4, -3, -7, -5, -5, -3, -2, -4, -1, -5, -0, -0, -2, -0, -4, -7, -6, -2, -7, -4, -4, -4, -1, -7, -1, -7, -1, -4, -2, -4, -1, -4, -1, -5, -0, -1, -2, -3, -2, -7, -1, -6, -1, -6, -1, -1, -6, -3, -0, -4, -2, -7, -6, -7, -7, -4, -4, -2, -5, -4, -0, -7, -3, -6, -2, -3, -4, -2, -3, -0, -2, -7, -2, -1, -5, -6, -7, -0, -5, -7, -3, -2, -4, -3, -3, -5, -5, -3, -3, -1, -2, -3, -6, -1, -4, -0, -7, -3, -5, -5, -4, -2, -6, -0, -6, -0, -6, -3, -4, -4, -5, -7, -1, -2, -3, -5, -3, -3, -3, -5, -5, -7, -3, -6, -0, -5, -3, -0, -5, -3, -5, -7, -6, -1, -4, -4, -1, -6, -2, -5, -1, -2, -7, -4, -6, -3, -1, -0, -4, -0, -6, -0, -3, -2, -2, -1, -1, -0, -6, -0, -7, -6, -1, -5, -2, -1, -6, -4, -2, -1, -2, -0, -3, -7, -4, -4, -0, -0, -1, -3, -0, -6, -3, -2, -2, -1, -7, -1, -0, -3, -4, -3, -4, -0, -5, -3, -4, -3, -1, -2, -0, -5, -3, -2, -2, -6, -5, -5, -4, -0, -1, -0, -4, -7, -3, -0, -1, -3, -3, -1, -4, -5, -1, -0, -2, -4, -4, -0, -4, -5, -6, -3, -0, -4, -7, -6, -7, -7, -5, -6, -3, -3, -2, -2, -6, -7, -0, -7, -1, -7, -2, -7, -5, -0, -7, -4, -1, -3, -3, -5, -7, -4, -0, -5, -1, -7, -1, -6, -0, -2, -1, -7, -6, -3, -4, -5, -7, -7, -7, -7, -7, -0, -3, -2, -2, -5, -6, -7, -4, -0, -2, -7, -3, -6, -4, -4, -5, -5, -5, -6, -5, -7, -6, -6, -6, -3, -1, -0, -2, -3, -6, -6, -6, -5, -7, -6, -6, -1, -2, -2, -0, -2, -4, -5, -4, -1, -3, -7, -5, -5, -2, -5, -0, -2, -4, -4, -6, -5, -2, -1, -4, -7, -3, -4, -0, -3, -6, -3, -3, -7, -6, -5, -1, -4, -7, -7, -2, -7, -3, -1, -7, -4, -7, -3, -2, -3, -2, -5, -7, -0, -3, -5, -0, -3, -1, -2, -2, -5, -2, -5, -5, -1, -2, -5, -7, -1, -3, -4, -3, -5, -7, -7, -3, -6, -4, -5, -1, -1, -0, -0, -3, -7, -3, -6, -0, -2, -0, -5, -7, -3, -3, -2, -2, -4, -4, -0, -1, -1, -6, -5, -6, -4, -7, -1, -2, -7, -7, -4, -6, -0, -3, -1, -2, -7, -6, -4, -5, -7, -3, -4, -4, -1, -5, -7, -5, -7, -6, -7, -4, -0, -0, -4, -4, -6, -3, -0, -4, -6, -3, -5, -1, -7, -3, -0, -4, -2, -2, -1, -3, -6, -5, -3, -4, -1, -3, -0, -0, -1, -4, -0, -5, -5, -5, -4, -1, -5, -4, -4, -4, -6, -4, -5, -5, -2, -3, -1, -4, -1, -1, -6, -2, -0, -2, -6, -1, -0, -2, -2, -3, -7, -2, -1, -1, -6, -7, -2, -7, -6, -6, -6, -1, -6, -6, -2, -6, -3, -1, -1, -4, -5, -7, -3, -1, -4, -7, -0, -6, -7, -5, -0, -5, -2, -1, -1, -5, -6, -3, -0, -1, -6, -7, -5, -4, -2, -1, -3, -1, -5, -6, -6, -4, -0, -2, -6, -7, -7, -7, -0, -1, -2, -4, -5, -5, -6, -6, -2, -7, -7, -2, -3, -5, -4, -6, -4, -2, -1, -3, -7, -4, -0, -6, -1, -1, -2, -3, -1, -4, -4, -3, -5, -1, -3, -1, -7, -1, -1, -1, -6, -6, -1, -2, -3, -4, -3, -6, -4, -3, -4, -7, -4, -1, -6, -0, -4, -7, -2, -4, -5, -2, -7, -4, -6, -4, -6, -0, -7, -7, -6, -0, -4, -4, -1, -7, -1, -1, -3, -6, -5, -0, -3, -6, -3, -2, -5, -7, -6, -0, -5, -5, -1, -1, -1, -5, -1, -1, -3, -6, -6, -7, -7, -0, -7, -4, -5, -2, -7, -4, -2, -2, -3, -3, -2, -1, -4, -5, -1, -2, -2, -5, -6, -5, -3, -2, -4, -4, -3, -2, -7, -5, -2, -0, -7, -0, -2, -6, -6, -5, -1, -0, -2, -4, -1, -5, -3, -1, -2, -7, -5, -6, -3, -4, -4, -1, -2, -6, -4, -0, -5, -3, -4, -0, -6, -6, -6, -4, -6, -4, -5, -1, -6, -6, -3, -4, -2, -7, -7, -3, -3, -4, -4, -6, -0, -2, -5, -6, -7, -1, -7, -1, -1, -4, -7, -2, -2, -3, -3, -1, -7, -5, -0, -7, -3, -4, -5, -1, -7, -5, -6, -4, -0, -1, -7, -6, -0, -2, -5, -2, -5, -3, -0, -3, -5, -3, -1, -6, -5, -3, -1, -2, -5, -4, -6, -3, -6, -6, -7, -3, -0, -3, -3, -5, -7, -5, -1, -4, -6, -6, -0, -1, -3, -4, -0, -2, -4, -2, -2, -1, -5, -1, -3, -3, -1, -5, -7, -0, -7, -0, -4, -2, -4, -2, -7, -4, -3, -4, -1, -0, -1, -6, -2, -2, -3, -4, -0, -5, -0, -1, -5, -6, -1, -3, -7, -3, -1, -2, -5, -0, -7, -6, -7, -7, -5, -1, -5, -7, -6, -1, -1, -6, -1, -0, -6, -7, -5, -1, -1, -6, -3, -7, -0, -5, -7, -0, -4, -0, -7, -7, -7, -4, -0, -5, -3, -0, -0, -0, -4, -1, -2, -4, -2, -6, -1, -5, -1, -5, -3, -0, -2, -0, -6, -3, -4, -5, -0, -7, -3, -0, -1, -6, -5, -1, -3, -3, -2, -2, -7, -6, -0, -1, -1, -1, -0, -0, -1, -2, -5, -2, -3, -6, -7, -0, -3, -2, -1, -5, -5, -6, -6, -3, -4, -3, -1, -5, -6, -4, -2, -2, -7, -1, -0, -3, -1, -1, -1, -0, -6, -4, -0, -6, -6, -6, -0, -4, -4, -5, -3, -3, -1, -0, -2, -5, -6, -6, -4, -1, -7, -3, -0, -3, -4, -0, -3, -2, -3, -7, -4, -0, -1, -0, -5, -0, -5, -2, -7, -4, -3, -5, -6, -5, -3, -3, -0, -3, -4, -5, -0, -6, -4, -7, -1, -2, -2, -1, -7, -1, -3, -4, -7, -7, -3, -2, -2, -0, -2, -7, -5, -5, -3, -3, -7, -5, -7, -0, -4, -0, -5, -2, -3, -5, -0, -3, -6, -7, -2, -6, -2, -4, -6, -0, -4, -1, -5, -4, -2, -0, -0, -5, -5, -6, -6, -4, -7, -5, -6, -3, -7, -3, -2, -0, -6, -3, -5, -2, -5, -1, -0, -3, -7, -1, -3, -7, -2, -7, -2, -1, -1, -7, -6, -0, -4, -5, -3, -5, -1, -6, -4, -0, -7, -2, -1, -3, -7, -5, -0, -1, -2, -6, -4, -1, -0, -6, -0, -5, -7, -1, -5, -3, -6, -7, -0, -4, -5, -1, -5, -3, -4, -3, -4, -6, -7, -7, -4, -1, -0, -2, -4, -2, -1, -2, -1, -6, -3, -2, -2, -2, -1, -4, -1, -2, -4, -6, -4, -7, -0, -0, -1, -0, -4, -6, -2, -1, -1, -3, -5, -3, -3, -2, -4, -0, -1, -5, -6, -2, -4, -3, -4, -4, -3, -5, -3, -6, -6, -6, -5, -0, -5, -2, -5, -3, -0, -4, -7, -5, -0, -4, -4, -2, -2, -4, -2, -1, -1, -1, -6, -0, -4, -0, -3, -1, -0, -4, -6, -1, -6, -0, -2, -1, -0, -2, -7, -4, -0, -0, -3, -7, -0, -5, -5, -6, -6, -7, -6, -3, -2, -6, -7, -6, -6, -2, -0, -6, -7, -7, -4, -1, -7, -7, -6, -0, -5, -6, -7, -3, -3, -6, -0, -5, -3, -7, -6, -2, -2, -1, -1, -5, -4, -0, -4, -7, -2, -4, -5, -7, -4, -6, -3, -7, -7, -2, -2, -4, -0, -1, -0, -7, -4, -0, -2, -6, -3, -5, -3, -3, -4, -4, -1, -4, -2, -2, -2, -0, -6, -6, -3, -7, -4, -5, -0, -1, -3, -1, -7, -2, -6, -2, -6, -2, -4, -2, -5, -6, -1, -2, -1, -3, -5, -5, -4, -0, -2, -0, -4, -6, -1, -2, -1, -5, -6, -4, -0, -0, -1, -0, -1, -1, -5, -7, -7, -1, -4, -5, -4, -0, -0, -2, -2, -4, -3, -5, -6, -7, -6, -0, -4, -6, -1, -7, -4, -3, -6, -7, -4, -4, -7, -1, -4, -5, -0, -3, -0, -3, -4, -6, -0, -7, -5, -2, -6, -6, -1, -0, -0, -6, -0, -0, -6, -5, -5, -0, -7, -6, -2, -7, -6, -2, -2, -2, -3, -7, -1, -0, -5, -5, -0, -7, -7, -5, -5, -3, -3, -2, -3, -0, -1, -4, -6, -2, -1, -2, -0, -7, -6, -2, -6, -6, -3, -3, -7, -6, -5, -0, -1, -4, -4, -3, -6, -3, -0, -7, -5, -5, -5, -2, -6, -3, -0, -1, -7, -1, -7, -0, -1, -6, -3, -5, -2, -1, -4, -1, -5, -3, -1, -1, -3, -2, -4, -0, -7, -7, -0, -7, -1, -2, -7, -0, -4, -7, -3, -5, -3, -4, -6, -2, -3, -0, -0, -3, -5, -5, -1, -0, -4, -7, -3, -6, -0, -4, -7, -1, -0, -5, -1, -1, -7, -7, -1, -1, -5, -6, -7, -5, -5, -5, -1, -4, -7, -0, -7, -2, -0, -1, -2, -3, -0, -3, -1, -3, -2, -3, -2, -0, -1, -2, -6, -4, -7, -4, -1, -5, -4, -3, -2, -6, -2, -4, -5, -7, -3, -7, -3, -5, -0, -0, -5, -5, -4, -0, -4, -5, -2, -3, -2, -5, -6, -1, -4, -4, -4, -6, -7, -7, -4, -2, -4, -3, -5, -4, -3, -3, -6, -3, -5, -6, -6, -6, -6, -4, -2, -5, -7, -1, -5, -1, -3, -6, -1, -1, -1, -3, -6, -6, -2, -3, -0, -1, -6, -5, -4, -4, -0, -3, -3, -0, -0, -4, -7, -1, -6, -4, -3, -7, -1, -0, -5, -0, -0, -5, -5, -1, -1, -1, -3, -7, -4, -5, -5, -2, -0, -2, -5, -1, -4, -6, -2, -0, -7, -4, -5, -5, -4, -6, -5, -7, -7, -4, -4, -1, -1, -5, -3, -0, -4, -5, -7, -0, -5, -2, -6, -6, -1, -6, -2, -3, -2, -2, -2, -3, -6, -1, -1, -6, -3, -2, -4, -5, -1, -6, -4, -5, -7, -5, -7, -2, -6, -3, -4, -1, -6, -3, -4, -7, -2, -0, -3, -5, -6, -3, -0, -5, -6, -7, -0, -6, -6, -3, -6, -2, -3, -0, -6, -3, -3, -4, -4, -6, -7, -5, -0, -4, -5, -5, -1, -4, -5, -3, -0, -7, -1, -5, -4, -6, -3, -4, -6, -3, -1, -5, -6, -5, -5, -7, -0, -5, -4, -3, -6, -5, -3, -5, -1, -1, -7, -6, -6, -2, -1, -1, -1, -1, -2, -1, -4, -5, -0, -4, -1, -4, -4, -5, -4, -7, -4, -5, -3, -5, -3, -6, -0, -2, -7, -3, -1, -4, -0, -1, -7, -1, -3, -3, -1, -1, -7, -4, -4, -1, -6, -1, -4, -3, -2, -7, -0, -6, -0, -3, -5, -2, -3, -1, -3, -6, -0, -0, -5, -4, -3, -5, -6, -4, -5, -1, -1, -6, -4, -7, -2, -4, -3, -7, -2, -6, -5, -1, -7, -5, -4, -1, -6, -0, -4, -2, -1, -1, -5, -1, -6, -2, -2, -7, -1, -0, -3, -2, -2, -2, -3, -1, -2, -4, -1, -0, -2, -4, -7, -5, -2, -2, -6, -1, -5, -6, -6, -3, -0, -6, -6, -0, -5, -7, -4, -3, -2, -1, -4, -5, -4, -1, -4, -3, -2, -7, -0, -4, -2, -6, -6, -3, -0, -2, -6, -1, -0, -2, -0, -1, -5, -0, -1, -4, -0, -2, -5, -1, -4, -2, -4, -4, -4, -6, -0, -1, -4, -5, -6, -5, -4, -5, -6, -7, -3, -3, -5, -4, -4, -2, -2, -1, -2, -4, -1, -3, -7, -3, -2, -5, -2, -0, -5, -7, -3, -3, -4, -6, -2, -4, -2, -4, -7, -2, -0, -0, -1, -1, -1, -2, -2, -7, -5, -1, -3, -3, -5, -7, -1, -7, -4, -7, -3, -3, -0, -6, -6, -5, -4, -7, -7, -2, -7, -1, -7, -2, -7, -2, -2, -7, -5, -2, -2, -2, -1, -1, -2, -6, -7, -1, -5, -6, -2, -4, -6, -5, -1, -7, -6, -5, -4, -4, -0, -0, -0, -2, -5, -6, -3, -0, -3, -2, -5, -5, -5, -4, -2, -3, -6, -2, -0, -7, -1, -0, -0, -4, -6, -4, -7, -1, -4, -3, -7, -7, -7, -4, -1, -5, -6, -2, -5, -7, -0, -3, -1, -4, -4, -4, -6, -4, -7, -3, -1, -6, -2, -0, -1, -7, -5, -2, -6, -5, -1, -7, -1, -6, -5, -7, -3, -1, -2, -3, -5, -2, -1, -6, -1, -5, -6, -7, -2, -3, -6, -5, -6, -4, -7, -2, -1, -0, -2, -0, -2, -6, -5, -7, -0, -2, -2, -7, -1, -7, -7, -5, -7, -2, -4, -4, -4, -3, -2, -5, -3, -5, -3, -6, -5, -7, -1, -7, -4, -7, -3, -7, -6, -3, -4, -4, -5, -7, -4, -3, -0, -2, -1, -0, -2, -6, -3, -2, -7, -0, -7, -4, -2, -0, -7, -1, -1, -6, -7, -3, -0, -5, -3, -5, -7, -2, -6, -0, -6, -7, -0, -3, -3, -2, -4, -6, -5, -1, -6, -3, -4, -3, -1, -2, -7, -2, -5, -2, -1, -4, -7, -7, -4, -6, -2, -0, -2, -5, -0, -7, -3, -1, -1, -2, -2, -6, -0, -0, -4, -0, -1, -1, -4, -0, -1, -4, -7, -7, -6, -6, -4, -1, -2, -5, -7, -3, -1, -6, -5, -5, -1, -1, -2, -4, -2, -3, -7, -1, -1, -1, -7, -1, -0, -0, -3, -5, -7, -0, -2, -7, -1, -2, -2, -3, -5, -3, -7, -4, -1, -7, -4, -0, -3, -0, -0, -4, -2, -3, -0, -5, -5, -7, -0, -1, -4, -0, -4, -1, -2, -2, -3, -0, -3, -6, -4, -6, -1, -4, -0, -4, -7, -0, -5, -5, -0, -2, -6, -6, -6, -6, -0, -5, -5, -0, -1, -6, -3, -3, -3, -7, -6, -7, -0, -4, -1, -0, -3, -2, -5, -1, -3, -1, -5, -7, -2, -3, -5, -6, -2, -7, -3, -5, -0, -3, -4, -2, -1, -3, -7, -7, -6, -3, -2, -7, -3, -4, -7, -6, -0, -4, -4, -3, -1, -2, -2, -6, -5, -5, -3, -1, -5, -7, -5, -0, -4, -0, -3, -2, -3, -6, -0, -2, -2, -1, -2, -3, -3, -6, -7, -3, -2, -6, -5, -6, -4, -3, -0, -3, -3, -5, -0, -7, -6, -7, -2, -7, -4, -4, -4, -4, -0, -2, -7, -6, -5, -3, -4, -1, -0, -3, -2, -5, -1, -4, -7, -4, -0, -6, -6, -1, -0, -3, -3, -0, -2, -4, -4, -0, -7, -2, -7, -3, -0, -6, -1, -5, -2, -4, -3, -2, -7, -1, -3, -2, -2, -2, -7, -6, -1, -6, -5, -3, -2, -6, -0, -2, -7, -1, -4, -4, -4, -7, -1, -3, -4, -2, -3, -3, -3, -2, -3, -2, -1, -5, -7, -4, -0, -5, -7, -3, -0, -0, -5, -3, -4, -5, -6, -5, -4, -6, -0, -6, -6, -1, -1, -6, -7, -3, -6, -0, -0, -2, -3, -0, -1, -2, -3, -7, -5, -6, -5, -7, -2, -3, -3, -6, -2, -3, -6, -6, -7, -2, -2, -3, -1, -5, -4, -5, -0, -1, -2, -6, -0, -3, -6, -2, -6, -1, -3, -2, -4, -1, -3, -3, -7, -1, -5, -6, -4, -5, -3, -4, -6, -1, -7, -5, -3, -3, -0, -7, -4, -3, -4, -4, -3, -7, -6, -1, -0, -0, -1, -3, -2, -2, -5, -0, -7, -4, -0, -3, -1, -3, -0, -4, -5, -6, -2, -4, -4, -1, -0, -4, -2, -5, -7, -7, -6, -3, -6, -6, -7, -6, -2, -3, -0, -5, -3, -1, -2, -3, -5, -5, -7, -6, -1, -5, -0, -7, -6, -7, -7, -6, -6, -6, -0, -7, -2, -3, -6, -6, -2, -0, -3, -6, -6, -0, -7, -5, -0, -4, -1, -2, -3, -1, -6, -3, -3, -4, -5, -3, -2, -5, -4, -3, -5, -0, -0, -3, -3, -0, -3, -6, -7, -2, -3, -7, -5, -1, -6, -6, -4, -0, -0, -0, -3, -6, -7, -2, -7, -2, -3, -2, -7, -0, -3, -4, -4, -3, -0, -6, -2, -6, -7, -5, -1, -2, -1, -6, -3, -5, -7, -1, -0, -1, -6, -0, -3, -3, -5, -7, -1, -1, -5, -0, -4, -6, -6, -1, -2, -5, -1, -7, -3, -3, -1, -5, -0, -0, -7, -4, -2, -7, -1, -4, -6, -6, -1, -0, -0, -4, -7, -7, -3, -4, -1, -3, -6, -2, -7, -1, -4, -4, -0, -3, -7, -7, -3, -3, -7, -1, -4, -6, -2, -2, -1, -0, -0, -5, -0, -6, -5, -0, -1, -6, -5, -3, -4, -5, -7, -7, -5, -6, -3, -5, -4, -7, -6, -5, -7, -2, -3, -2, -0, -3, -6, -0, -3, -1, -0, -1, -1, -4, -4, -2, -1, -7, -4, -3, -7, -7, -0, -7, -3, -4, -3, -5, -2, -0, -0, -5, -6, -6, -6, -0, -6, -6, -5, -6, -0, -1, -0, -7, -6, -6, -5, -5, -0, -3, -5, -2, -4, -0, -2, -2, -7, -7, -2, -4, -6, -7, -1, -5, -4, -3, -7, -4, -1, -3, -0, -5, -5, -0, -5, -6, -6, -5, -5, -0, -5, -2, -6, -0, -0, -5, -1, -4, -3, -5, -1, -4, -1, -4, -5, -5, -3, -0, -5, -2, -7, -3, -5, -4, -1, -0, -2, -6, -1, -1, -1, -1, -2, -0, -3, -0, -5, -6, -4, -2, -7, -6, -1, -4, -6, -1, -4, -2, -3, -1, -2, -5, -4, -2, -1, -7, -5, -6, -5, -1, -6, -4, -7, -6, -1, -5, -7, -3, -2, -2, -6, -4, -0, -1, -3, -0, -2, -4, -4, -6, -4, -7, -2, -7, -2, -2, -6, -4, -6, -7, -7, -0, -6, -7, -5, -7, -3, -4, -0, -0, -1, -1, -5, -2, -5, -2, -2, -0, -7, -0, -2, -2, -6, -5, -7, -3, -6, -2, -6, -5, -2, -4, -7, -7, -2, -1, -0, -1, -6, -3, -1, -0, -0, -6, -1, -1, -7, -7, -1, -5, -3, -7, -4, -5, -2, -1, -7, -3, -3, -0, -6, -3, -3, -2, -7, -6, -7, -2, -0, -4, -2, -3, -0, -0, -0, -4, -1, -0, -1, -0, -7, -1, -0, -5, -2, -7, -3, -4, -3, -6, -7, -4, -5, -6, -6, -3, -1, -7, -1, -2, -6, -5, -2, -0, -3, -4, -1, -0, -0, -4, -5, -7, -0, -6, -2, -2, -4, -4, -2, -1, -7, -5, -1, -5, -2, -6, -3, -5, -1, -2, -2, -4, -7, -4, -1, -5, -1, -5, -3, -4, -4, -5, -5, -7, -4, -3, -7, -3, -2, -2, -2, -1, -1, -0, -0, -1, -5, -1, -6, -0, -2, -0, -6, -4, -4, -1, -1, -5, -2, -1, -4, -5, -5, -2, -3, -1, -7, -2, -0, -5, -0, -7, -4, -2, -0, -3, -5, -4, -7, -4, -5, -5, -0, -0, -0, -2, -3, -5, -3, -7, -2, -4, -6, -7, -2, -1, -6, -3, -1, -1, -0, -7, -4, -4, -4, -4, -7, -2, -1, -3, -5, -1, -5, -2, -4, -2, -4, -1, -1, -2, -0, -0, -7, -5, -4, -2, -2, -1, -6, -6, -3, -5, -7, -7, -6, -1, -7, -3, -5, -6, -5, -4, -2, -0, -3, -3, -4, -3, -7, -3, -6, -2, -0, -0, -2, -3, -2, -6, -0, -4, -2, -4, -2, -1, -7, -6, -3, -5, -4, -0, -0, -1, -2, -7, -3, -0, -5, -1, -1, -3, -6, -2, -2, -6, -5, -7, -3, -7, -1, -6, -1, -2, -5, -7, -3, -6, -0, -0, -4, -1, -1, -6, -1, -0, -2, -3, -3, -3, -5, -1, -1, -7, -7, -5, -1, -2, -0, -2, -2, -1, -0, -2, -2, -6, -2, -0, -7, -7, -0, -6, -0, -3, -3, -6, -4, -4, -0, -5, -0, -7, -0, -7, -2, -0, -1, -5, -4, -0, -2, -0, -7, -0, -0, -5, -5, -5 diff --git a/gr-atsc/src/lib/qa_atsci_viterbi_decoder.cc b/gr-atsc/src/lib/qa_atsci_viterbi_decoder.cc deleted file mode 100644 index 8902b6eb8..000000000 --- a/gr-atsc/src/lib/qa_atsci_viterbi_decoder.cc +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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/TestAssert.h> -#include <qa_atsci_viterbi_decoder.h> -#include <qa_atsci_trellis_encoder.h> -#include <cstdio> -#include <string.h> -#include <stdlib.h> -#include <time.h> - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - - -static const int NCODERS = atsci_viterbi_decoder::NCODERS; - -#if 0 -static void -map_to_soft_symbols (atsc_soft_data_segment &out, - const atsc_data_segment &in) -{ - for (unsigned int i = 0; i < NELEM (in.data); i++){ - out.data[i] = in.data[i] * 2 - 7; - } -} -#endif - -static void -pad_decoder_input (atsc_soft_data_segment out[NCODERS]) -{ - memset (out, 0, sizeof (out)); - - // add data segment sync - for (int i = 0; i < NCODERS; i++){ - out[i].data[0] = 5; - out[i].data[1] = -5; - out[i].data[2] = -5; - out[i].data[3] = 5; - out[i].pli.set_regular_seg (false, i); - } -} - -void -qa_atsci_viterbi_decoder::t0 () -{ -#if 0 - atsci_trellis_encoder enc; - atsc_mpeg_packet_rs_encoded encoder_in[NCODERS]; - atsc_data_segment encoder_out[NCODERS]; - atsc_soft_data_segment decoder_in[NCODERS]; - atsc_soft_data_segment decoder_in_pad[NCODERS]; - atsc_mpeg_packet_rs_encoded decoder_out[NCODERS]; - atsc_mpeg_packet_rs_encoded decoder_out_pad[NCODERS]; - - - memset (encoder_in, 0, sizeof (encoder_in)); - memset (encoder_out, 0, sizeof (encoder_out)); - memset (decoder_out_pad, 0, sizeof (decoder_out_pad)); - - srandom (1); - - for (int i = 0; i < NCODERS; i++){ - for (unsigned int j = 0; j < NELEM (encoder_in[i].data); j++){ - int t = (random () >> 8) & 0xff; // 8 random bits - encoder_in[i].data[j] = t; - } - } - - fflush (stdout); - printf ("@@@ ENCODER INPUT @@@\n"); - for (int i = 0; i < NCODERS; i++){ - for (unsigned int j = 0; j < NELEM (encoder_in[i].data); j++){ - printf ("%d\n", encoder_in[i].data[j]); - } - } - - enc.reset (); - enc.encode (encoder_out, encoder_in); - - printf ("@@@ ENCODER OUTPUT @@@\n"); - for (int i = 0; i < NCODERS; i++){ - for (unsigned int j = 0; j < NELEM (encoder_out[i].data); j++){ - printf ("%d\n", encoder_out[i].data[j]); - } - } - - for (int i = 0; i < NCODERS; i++) - map_to_soft_symbols (decoder_in[i], encoder_out[i]); - - viterbi.reset (); - - // this has only the previous (non-existant) output - viterbi.decode (decoder_out_pad, decoder_in); - - // now we'll see the real output - pad_decoder_input (decoder_in_pad); - viterbi.decode (decoder_out, decoder_in_pad); - - printf ("@@@ DECODER OUTPUT @@@\n"); - for (int i = 0; i < NCODERS; i++){ - for (unsigned int j = 0; j < NELEM (decoder_out[i].data); j++){ - printf ("%d\n", decoder_out[i].data[j]); - } - } - fflush (stdout); -#endif -} - -void -qa_atsci_viterbi_decoder::t1 () -{ - atsc_soft_data_segment decoder_in[NCODERS]; - atsc_soft_data_segment decoder_in_pad[NCODERS]; - atsc_mpeg_packet_rs_encoded decoder_out[NCODERS]; - atsc_mpeg_packet_rs_encoded decoder_out_pad[NCODERS]; - atsc_mpeg_packet_rs_encoded expected_out[NCODERS]; - static const float raw_input[NCODERS * NELEM (decoder_in[0].data)] = { -#include "qa_atsci_viterbi_decoder_t1_input.dat" - }; - static const unsigned char raw_output[NCODERS * NELEM (expected_out[0].data)] = { -#include "qa_atsci_viterbi_decoder_t1_output.dat" - }; - - - // load up input - const float *ri = &raw_input[0]; - for (int i = 0; i < NCODERS; i++){ - for (unsigned int j = 0; j < NELEM (decoder_in[i].data); j++){ - decoder_in[i].data[j] = *ri++; - } - decoder_in[i].pli.set_regular_seg (false, i); - } - - // load up expected output - const unsigned char *ro = &raw_output[0]; - for (int i = 0; i < NCODERS; i++){ - for (unsigned int j = 0; j < NELEM (expected_out[i].data); j++){ - expected_out[i].data[j] = *ro++; - } - expected_out[i].pli.set_regular_seg (false, i); - } - - viterbi.reset (); - - // this has only the previous (non-existant) output - viterbi.decode (decoder_out_pad, decoder_in); - - // now we'll see the real output - pad_decoder_input (decoder_in_pad); - viterbi.decode (decoder_out, decoder_in_pad); - - for (int i = 0; i < NCODERS; i++){ // check the result - CPPUNIT_ASSERT (expected_out[i] == decoder_out[i]); - } -} diff --git a/gr-atsc/src/lib/qa_atsci_viterbi_decoder.h b/gr-atsc/src/lib/qa_atsci_viterbi_decoder.h deleted file mode 100644 index 440c79caf..000000000 --- a/gr-atsc/src/lib/qa_atsci_viterbi_decoder.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_ATSC_VITERBI_DECODER_H_ -#define _QA_ATSC_VITERBI_DECODER_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -#include <stdio.h> -#include <atsci_viterbi_decoder.h> - -class qa_atsci_viterbi_decoder : public CppUnit::TestCase { - - public: - - void setUp (void) - { - viterbi.reset (); - } - - CPPUNIT_TEST_SUITE (qa_atsci_viterbi_decoder); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - atsci_viterbi_decoder viterbi; - - void t0 (); - void t1 (); -}; - - -#endif /* _QA_ATSC_VITERBI_DECODER_H_ */ diff --git a/gr-atsc/src/lib/qa_atsci_viterbi_decoder_t1_input.dat b/gr-atsc/src/lib/qa_atsci_viterbi_decoder_t1_input.dat deleted file mode 100644 index b2f356c87..000000000 --- a/gr-atsc/src/lib/qa_atsci_viterbi_decoder_t1_input.dat +++ /dev/null @@ -1,9984 +0,0 @@ - 5 + -0.863407, - -5 + 0.630254, - -5 + 0.766777, - 5 + -0.587788, - -3 + 0.197374, - -7 + -0.928392, - 1 + 0.846137, - -3 + -0.148515, - 5 + 0.20529, - -3 + 0.957658, - 1 + 0.712777, - -3 + -0.783731, - -7 + -0.649688, - -3 + 0.364183, - -3 + 0.766379, - 5 + -0.254228, - -5 + 0.265344, - 1 + -0.0926997, - 5 + -0.729882, - -5 + -0.946608, - 7 + 0.941424, - -1 + 0.00502258, - 5 + 0.353994, - -1 + -0.431315, - -3 + 0.802947, - 7 + 0.0174765, - -1 + 0.107732, - 7 + -0.426013, - -3 + 0.179269, - 1 + -0.334729, - -5 + 0.363112, - 1 + -0.793512, - -1 + -0.386831, - 7 + -0.469307, - 7 + -0.592471, - 3 + -0.0650877, - 7 + 0.465307, - -1 + 0.0575076, - 3 + 0.804467, - 7 + 0.766673, - -3 + 0.177288, - -3 + 0.254259, - -7 + 0.0933109, - 3 + -0.132741, - -7 + 0.226975, - 1 + 0.805, - 3 + 0.474327, - 3 + -0.147847, - -1 + 0.3179, - -7 + -0.141455, - 3 + 0.322113, - -3 + 0.633945, - -1 + -0.950742, - -5 + -0.39542, - 3 + -0.0594983, - -3 + -0.772717, - -5 + 0.545784, - 7 + 0.398416, - 3 + -0.673597, - 3 + -0.790352, - -7 + -0.544624, - 7 + -0.633903, - -1 + -0.908654, - -3 + -0.311397, - -5 + 0.662512, - -3 + -0.135222, - -7 + 0.366291, - 1 + -0.741085, - -7 + -0.29157, - -5 + -0.673842, - 3 + 0.776452, - -5 + -0.0937042, - 3 + 0.683802, - -5 + -0.722854, - -7 + 0.0347072, - -5 + 0.40685, - -5 + 0.31874, - 5 + -0.947299, - 3 + -0.955457, - 1 + 0.742103, - -5 + -0.535021, - -5 + -0.67394, - -5 + -0.108192, - -1 + -0.968649, - 1 + 0.445698, - 3 + -0.476884, - 7 + 0.566045, - -7 + -0.137864, - -1 + -0.190159, - -5 + -0.0220287, - 5 + 0.307356, - 5 + 0.917233, - -7 + 0.320761, - 3 + -0.789388, - -5 + 0.117822, - 5 + -0.604396, - -1 + 0.552753, - 7 + -0.446649, - 7 + -0.810118, - 7 + -0.658175, - -7 + 0.553164, - -7 + -0.344854, - -3 + 0.280593, - 7 + -0.884303, - 7 + 0.720506, - -1 + -0.987799, - 7 + 0.793155, - 1 + -0.850125, - 7 + 0.115369, - 5 + 0.544406, - 5 + -0.276058, - -1 + -0.231108, - -5 + 0.376881, - 3 + -0.559075, - 7 + -0.915446, - -1 + -0.460641, - 3 + 0.818044, - -3 + -0.991244, - 1 + 0.420497, - 1 + 0.485863, - -3 + -0.376003, - 5 + -0.350986, - 5 + 0.430744, - -3 + 0.463798, - 5 + 0.42518, - 5 + -0.290836, - -5 + -0.691567, - -7 + 0.824346, - 3 + 0.450636, - -3 + 0.043629, - 7 + 0.316293, - 5 + -0.120924, - 1 + 0.726472, - -1 + -0.543775, - 3 + 0.933344, - -3 + 0.132114, - -3 + -0.310619, - 5 + 0.911921, - -1 + -0.497207, - 3 + -0.637383, - -5 + -0.732262, - 7 + 0.107649, - 3 + 0.520015, - -1 + 0.157455, - -3 + -0.894858, - -1 + 0.0945327, - 1 + -0.691426, - 7 + 0.144207, - 3 + 0.445607, - -1 + 0.255407, - -7 + 0.306034, - -3 + -0.371352, - -1 + 0.124452, - -5 + 0.359695, - -5 + -0.888643, - 3 + 0.290357, - 3 + -0.0254667, - -3 + 0.407853, - -5 + 0.679174, - -5 + 0.0575717, - -3 + 0.137283, - 3 + 0.729587, - 7 + 0.31509, - -3 + -0.348804, - 1 + 0.57604, - -5 + 0.345748, - 7 + -0.327496, - -5 + -0.425651, - -7 + 0.140657, - -3 + 0.238764, - -7 + -0.143133, - 3 + 0.337288, - 1 + 0.959842, - 7 + -0.977864, - 3 + -0.317419, - 3 + -0.198654, - 3 + 0.955435, - 3 + -0.23876, - 1 + -0.88292, - -5 + -0.511151, - 3 + 0.779996, - 3 + -0.443377, - -1 + -0.192438, - -5 + 0.811447, - -7 + 0.634155, - 1 + -0.762404, - 3 + 0.731365, - 5 + 0.783236, - 5 + -0.307317, - 7 + 0.482175, - 7 + -0.539608, - 7 + -0.775192, - 1 + -0.560785, - -7 + 0.206625, - -5 + -0.038118, - -5 + -0.228189, - 1 + 0.462362, - -5 + 0.72833, - -1 + 0.622996, - -3 + 0.998274, - 5 + 0.142163, - -7 + 0.618011, - 3 + 0.122273, - -7 + -0.483532, - -1 + -0.854097, - -5 + 0.108088, - 7 + -0.193228, - 3 + 0.648767, - -3 + -0.656924, - -7 + -0.991222, - -3 + -0.25652, - 3 + -0.269033, - -1 + 0.324665, - -1 + 0.107827, - -5 + -0.0475933, - -5 + -0.99274, - -5 + -0.30318, - -3 + -0.747831, - -3 + -0.203781, - 3 + -0.010757, - 7 + 0.0734757, - 7 + -0.761203, - -7 + 0.389509, - 1 + -0.25976, - -1 + 0.965806, - 7 + 0.526324, - -1 + -0.298331, - -3 + 0.410725, - -1 + 0.00752225, - 5 + -0.455632, - 1 + -0.884761, - 7 + 0.602377, - 7 + 0.555917, - 3 + -0.160695, - -7 + -0.567533, - 3 + 0.758232, - 1 + -0.587694, - -7 + 0.414466, - -7 + -0.652491, - 1 + 0.0124494, - -7 + 0.389889, - 7 + 0.227003, - 1 + 0.242753, - -7 + 0.913462, - -3 + 0.691642, - -5 + 0.75989, - 1 + -0.596777, - -3 + -0.752662, - 3 + -0.108642, - 7 + -0.60189, - 7 + 0.511322, - -3 + -0.24478, - 7 + -0.849058, - -1 + -0.845527, - -7 + -0.572068, - -5 + -0.661012, - 5 + -0.701889, - 7 + 0.822228, - 1 + -0.00200901, - 5 + -0.71468, - 5 + 0.691151, - 7 + 0.561903, - 3 + -0.527991, - -1 + -0.867353, - 3 + -0.728324, - 5 + -0.813234, - 1 + -0.966217, - 1 + 0.0669532, - 7 + 0.905965, - -3 + -0.937283, - -3 + 0.774056, - 3 + -0.384885, - -7 + 0.175322, - -3 + 0.309913, - -5 + 0.251167, - -1 + 0.381753, - 3 + 0.00625176, - -7 + 0.56373, - -3 + 0.63392, - 3 + 0.762169, - 7 + 0.0347039, - -3 + -0.935108, - -1 + -0.114944, - 1 + -0.424213, - 1 + 0.0317198, - -3 + 0.2139, - -5 + 0.0530905, - -7 + -0.36603, - -5 + -0.851717, - -7 + 0.414219, - -1 + -0.397429, - -3 + -0.995697, - -7 + -0.328063, - -1 + -0.604664, - 7 + -0.45941, - 3 + 0.718596, - -7 + -0.377836, - -1 + 0.915331, - 7 + -0.730175, - -1 + -0.51083, - 7 + -0.923481, - 1 + 0.102495, - -1 + 0.1293, - -3 + 0.812872, - -5 + 0.066343, - -1 + -0.578684, - 1 + 0.926482, - -7 + 0.10389, - 5 + -0.462554, - -5 + -0.108, - 5 + -0.471902, - 7 + -0.34884, - 5 + 0.719192, - -7 + -0.763765, - -3 + 0.257366, - -5 + -0.623314, - -7 + 0.0467943, - 5 + -0.646451, - 7 + 0.54531, - 3 + -0.955682, - -5 + -0.432122, - 3 + -0.886357, - 1 + 0.088559, - 5 + -0.975894, - 5 + -0.105386, - -3 + 0.0978638, - 1 + -0.199998, - 5 + 0.0380346, - 3 + 0.427315, - -3 + 0.214304, - -5 + -0.566543, - -7 + -0.380715, - -3 + -0.877135, - -5 + 0.267701, - -3 + -0.03107, - -3 + 0.595488, - -1 + 0.322574, - -5 + 0.559362, - 1 + -0.0401364, - -7 + 0.528057, - 5 + -0.319427, - -1 + 0.357237, - 7 + 0.222854, - -5 + -0.432566, - 1 + -0.998243, - 7 + 0.742835, - 3 + -0.182255, - 3 + -0.471161, - 3 + 0.606823, - -7 + 0.974148, - 5 + -0.667598, - 1 + -0.811568, - 1 + -0.936551, - 7 + -0.530943, - 5 + 0.908057, - -7 + 0.895185, - 5 + 0.711135, - 1 + -0.95896, - 1 + 0.83532, - 1 + 0.14732, - 3 + 0.90921, - -1 + -0.30945, - -1 + -0.869543, - -7 + -0.360646, - 1 + 0.357157, - -3 + -0.514692, - 5 + 0.896144, - -1 + -0.196886, - -5 + -0.319624, - -1 + -0.472977, - -1 + -0.784624, - -1 + -0.281646, - -5 + -0.559682, - 3 + 0.391078, - 7 + 0.306199, - -3 + 0.962734, - -7 + -0.11162, - -7 + 0.357581, - 3 + 0.0805047, - 3 + -0.922337, - 1 + 0.232492, - -5 + -0.574144, - -1 + 0.710829, - 7 + -0.284843, - -1 + 0.831973, - -1 + -0.336799, - -3 + -0.745866, - -5 + -0.645711, - 5 + 0.0646029, - -3 + 0.252552, - 5 + -0.48003, - -5 + 0.299438, - 7 + 0.738929, - -5 + 0.40337, - 5 + 0.605547, - -3 + -0.525722, - 1 + -0.326724, - 1 + -0.515053, - 5 + 0.261516, - -7 + 0.320474, - -1 + -0.521487, - -5 + 0.903239, - -3 + -0.403525, - 7 + 0.0639151, - 3 + 0.359482, - 3 + 0.823776, - 5 + 0.0387504, - -7 + 0.109849, - 3 + -0.097467, - -5 + -0.832645, - -5 + 0.526237, - 7 + 0.438123, - 3 + -0.519244, - 1 + -0.0476922, - 3 + 0.191197, - -7 + -0.534928, - 3 + 0.462164, - 7 + -0.895527, - -1 + 0.473474, - -7 + 0.146189, - 5 + -0.179909, - -3 + -0.285322, - 5 + 0.613479, - -1 + -0.0315166, - 7 + 0.698841, - 3 + -0.774282, - 1 + 0.818017, - 7 + -0.932623, - 3 + 0.0664446, - -7 + 0.06308, - 3 + -0.519814, - 5 + -0.576546, - 5 + -0.267179, - -3 + -0.837482, - 5 + -0.255068, - 5 + -0.0568383, - -3 + 0.888405, - -3 + -0.366288, - -5 + -0.552696, - -1 + 0.541689, - 7 + -0.0454361, - -5 + 0.608489, - 3 + -0.922755, - -5 + 0.406846, - -5 + -0.506253, - 7 + -0.688017, - -5 + 0.776949, - 1 + -0.378568, - 5 + -0.727209, - -7 + 0.613322, - 5 + 0.962756, - -7 + -0.893482, - -7 + -0.987528, - -7 + 0.456806, - 7 + 0.786419, - 1 + 0.034181, - -7 + 0.790939, - -5 + -0.0300588, - 1 + 0.1652, - -7 + -0.481907, - 3 + 0.0991387, - -7 + -0.564886, - 5 + 0.85039, - -1 + 0.812973, - -1 + -0.407522, - 7 + -0.952524, - 5 + 0.765642, - -5 + -0.337741, - 7 + 0.957819, - 3 + -0.899041, - -1 + -0.671052, - -3 + 0.983954, - 1 + -0.89124, - -3 + 0.0940522, - -1 + 0.611417, - 7 + -0.937967, - -1 + 0.941416, - -1 + -0.359601, - 5 + 0.747211, - -7 + -0.111301, - 3 + -0.640113, - 7 + 0.0550081, - 7 + -0.189345, - 3 + 0.214366, - -5 + 0.135666, - -5 + 0.226602, - 3 + -0.410662, - 5 + -0.843728, - -3 + -0.371912, - -7 + -0.989917, - -1 + 0.690856, - -1 + 0.0420038, - 7 + 0.00959448, - 5 + -0.815518, - 1 + 0.430825, - -7 + 0.609881, - 5 + -0.688188, - 5 + -0.60674, - -1 + 0.0334734, - 1 + 0.722216, - -3 + 0.285942, - 7 + 0.519757, - 3 + -0.27104, - -1 + 0.509289, - -3 + -0.81976, - 5 + 0.481086, - 3 + -0.974128, - 7 + -0.337838, - 5 + 0.962801, - -3 + -0.798452, - -3 + 0.457351, - 1 + 0.103281, - -1 + -0.0256317, - 7 + 0.802218, - 7 + 0.689228, - -7 + -0.276751, - 5 + 0.404102, - -1 + -0.860859, - -7 + -0.0371287, - -1 + 0.370437, - -5 + -0.616334, - -5 + -0.758392, - 1 + -0.454585, - 1 + -0.137519, - 7 + -0.261276, - 5 + 0.558348, - 1 + -0.948463, - -5 + 0.523879, - -5 + 0.555652, - -1 + 0.840325, - 7 + 0.279812, - 5 + 0.617966, - 1 + 0.192231, - 5 + 0.132018, - -7 + -0.11959, - 1 + -0.894721, - -7 + -0.504819, - 5 + -0.419666, - 7 + -0.391328, - -3 + -0.24103, - -7 + -0.852627, - -7 + 0.990221, - 7 + 0.822151, - -7 + 0.170617, - 3 + 0.614475, - -7 + 0.446277, - -7 + -0.371819, - 1 + 0.831829, - -5 + 0.0787276, - -1 + -0.684313, - 3 + -0.611736, - 5 + 0.472613, - 7 + 0.730033, - -5 + -0.811217, - 1 + -0.760817, - -3 + 0.268843, - 5 + 0.584456, - 1 + 0.823053, - -7 + 0.80804, - -7 + 0.457053, - 5 + -0.577104, - -5 + -0.224893, - -5 + -0.107738, - -1 + -0.51484, - 3 + -0.198893, - -7 + 0.278753, - 7 + 0.502244, - -1 + 0.0510433, - 1 + -0.402208, - -7 + 0.343478, - 1 + -0.901047, - 1 + 0.369701, - -3 + -0.944263, - -5 + 0.386476, - 3 + -0.954781, - 7 + -0.688498, - 7 + -0.365083, - 3 + -0.776885, - -1 + -0.598649, - 3 + -0.87102, - 1 + 0.975515, - -3 + -0.467838, - 1 + 0.466075, - -7 + 0.271324, - -1 + 0.978247, - 7 + 0.112029, - -1 + 0.601593, - -3 + -0.412666, - 1 + -0.601096, - 5 + -0.0684049, - -7 + 0.552019, - -5 + 0.313324, - 5 + -0.836011, - -1 + 0.528016, - -3 + 0.284965, - -3 + 0.700575, - -5 + 0.0874079, - -7 + -0.0126598, - -7 + -0.276119, - 5 + -0.218603, - -5 + -0.0014039, - -3 + 0.189325, - 7 + 0.429569, - -5 + 0.837003, - 3 + 0.703335, - 7 + -0.216503, - 7 + 0.0920741, - 7 + 0.750109, - -1 + -0.322132, - 7 + -0.128556, - -1 + 0.00373274, - -1 + -0.17115, - 1 + 0.264227, - 3 + 0.988822, - -1 + 0.0243255, - -5 + 0.605084, - -7 + 0.295968, - 5 + 0.873413, - -1 + 0.434273, - -5 + -0.781778, - 5 + -0.0426681, - -5 + 0.167692, - -1 + -0.334183, - -1 + 0.07798, - -1 + -0.297114, - -3 + 0.816338, - 1 + -0.611242, - 3 + -0.423656, - 3 + -0.432077, - 1 + -0.145807, - 5 + 0.10632, - -5 + 0.756861, - -7 + -0.931971, - 7 + -0.397063, - 5 + 0.283628, - -7 + 0.721398, - 7 + 0.348194, - -3 + -0.33922, - 3 + 0.412108, - 7 + 0.510752, - -3 + -0.263234, - -7 + 0.485708, - 5 + 0.573377, - 3 + 0.244824, - -7 + 0.756185, - 5 + -0.981843, - -7 + 0.890249, - -5 + -0.785723, - 1 + 0.429159, - 7 + 0.891205, - 5 + -0.310018, - 5 + -0.0331806, - -7 + 0.567766, - -7 + -0.172382, - 3 + -0.0973954, - -1 + -0.726783, - -7 + 0.86626, - -3 + 0.640023, - 5 + -0.104726, - -3 + -0.213919, - -5 + -0.131563, - 3 + 0.108026, - 1 + 0.426832, - -7 + 0.631181, - -3 + -0.911012, - 5 + 0.232769, - -3 + -0.124074, - 5 + -0.263584, - -3 + 0.246066, - 7 + 0.833384, - -5 + -0.798822, - 1 + -0.281957, - 1 + -0.527281, - 3 + 0.918325, - 5 + -0.872591, - -3 + 0.987781, - 7 + -0.724259, - 7 + 0.73749, - 5 + -0.179643, - 1 + -0.480496, - -1 + -0.0747694, - 3 + -0.162109, - 1 + 0.655518, - 5 + 0.815859, - 7 + -0.422858, - -1 + 0.19599, - 3 + -0.601651, - 7 + -0.598413, - -5 + -0.951473, - 7 + 0.684015, - 7 + 0.121945, - 5 + 0.330604, - -1 + 0.800472, - -5 + -0.892743, - -5 + -0.0700532, - -1 + 0.143832, - -1 + 0.713388, - 1 + -0.253503, - 1 + -0.0462767, - 3 + 0.140933, - -5 + 0.94534, - -7 + 0.665662, - -5 + 0.207102, - 3 + -0.327194, - 5 + 0.110171, - -5 + 0.225803, - 1 + -0.900872, - -5 + 0.0169889, - 5 + 0.152721, - 7 + 0.125242, - -1 + 0.63948, - 7 + 0.0639926, - -5 + -0.869524, - 7 + -0.160608, - -1 + -0.465428, - 5 + -0.2185, - -7 + -0.465846, - -1 + 0.0973919, - 3 + 0.450568, - -5 + -0.451587, - -7 + -0.83918, - -1 + 0.709855, - 3 + -0.86862, - 5 + 0.676479, - 7 + -0.125049, - -1 + -0.191198, - 5 + -0.925049, - 1 + -0.521026, - -3 + -0.0364143, - -7 + 0.600769, - -7 + 0.164072, - -5 + 0.416589, - -7 + -0.595857, - -3 + 0.220567, - 3 + 0.0636474, - -7 + 0.644101, - 5 + -0.775524, - -3 + -0.192748, - 1 + 0.0538391, - 1 + 0.29524, - -5 + 0.882538, - -5 + -0.816844, - -5 + 0.862396, - -5 + 0.314402, - 1 + -0.392808, - -3 + 0.651255, - -1 + -0.231968, - 1 + 0.738021, - 5 + 0.84997, - -3 + 0.186296, - 1 + 0.741231, - 1 + -0.177977, - 5 + 0.522434, - -7 + 0.597047, - -3 + 0.0266608, - -5 + -0.152547, - 5 + -0.579447, - -1 + -0.357272, - -7 + -0.497293, - 5 + 0.869424, - -5 + -0.0230876, - -5 + -0.132476, - -3 + 0.936738, - 5 + 0.558816, - -3 + -0.0384813, - -1 + 0.483534, - -7 + 0.867384, - -1 + 0.42158, - 3 + 0.420513, - 7 + -0.0754159, - -5 + -0.379954, - 7 + 0.769618, - -7 + 0.340938, - -7 + -0.869991, - 3 + 0.830734, - 3 + 0.94181, - 3 + -0.130749, - 3 + 0.517635, - -3 + -0.252298, - -3 + -0.0496521, - 1 + 0.684225, - 1 + 0.172965, - 1 + 0.417296, - 7 + -0.466398, - 7 + -0.114508, - -1 + -0.109476, - -7 + 0.00148834, - 1 + 0.0949139, - 1 + 0.432791, - -1 + -0.240929, - -1 + 0.652485, - 5 + -0.217385, - 7 + -0.8724, - -1 + 0.387098, - 3 + -0.444865, - -3 + 0.184706, - 7 + -0.730551, - 7 + 0.754565, - 7 + -0.604301, - 3 + -0.119371, - -1 + -0.28214, - 5 + 0.143776, - 3 + 0.957703, - 3 + -0.104371, - -5 + -0.261664, - -1 + 0.495793, - 1 + -0.734588, - -3 + 0.628134, - -3 + 0.817538, - -7 + 0.361645, - 3 + 0.162489, - 5 + -0.536024, - 7 + -0.486136, - 5 + -0.776124, - -5 + -0.629988, - 1 + -0.0367843, - -5 + -0.493533, - -7 + -0.725222, - -5 + 0.492433, - 7 + 0.288113, - -3 + -0.784857, - -5 + 0.824698, - -1 + -0.545993, - -3 + -0.306256, - 1 + -0.877171, - -1 + 0.567034, - 3 + -0.440337, - -1 + 0.14643, - 7 + -0.755017, - -1 + -0.832763, - 5 + -0.498979, - 3 + 0.763625, - 5 + 0.566975, - -5 + 0.0534092, - -5 + -0.963171, - 5 + 0.0216508, - 7 + 0.597324, - 7 + -0.441571, - 7 + 0.0347587, - 3 + 0.983787, - 1 + 0.188113, - -1 + -0.171194, - -7 + -0.641733, - 7 + 0.36138, - -1 + -0.566453, - 1 + 0.882606, - 1 + 0.61524, - -1 + -0.773541, - 3 + 0.153026, - 5 + -0.621578, - -7 + -0.904904, - -5 + 0.0406272, - -5 + 0.415864, - 5 + -0.60085, - 1 + 0.727596, - -7 + -0.0860673, - -1 + -0.785685, - -5 + -0.889453, - 7 + -0.141489, - -5 + 0.04296, - -5 + 0.564742, - -7 + -0.12966, - -1 + 0.841196, - -5 + 0.71528, - 1 + -0.104704, - 1 + -0.263372, - -7 + 0.680698, - 3 + 0.756433, - -3 + -0.200798, - 1 + 0.027729, - -1 + -0.464512, - 7 + -0.60066, - -1 + 0.104495, - -3 + 0.713626, - -5 + -0.776119, - 3 + 0.168751, - -1 + -0.905566, - 5 + -0.955254, - -7 + -0.407108, - -3 + 0.170629, - -3 + -0.453202, - -1 + -0.907515, - 5 + -0.210368, - -3 + -0.98412, - -3 + -0.798125, - 3 + -0.414919, - -1 + -0.236897, - 3 + -0.491091, - -5 + -0.77713, - 3 + 0.230108, - 1 + -0.796737, - 5 + -0.26121, - 3 + 0.397635, - -1 + 0.85451, - -3 + -0.393889, - 5 + 0.983874, - 5 + 0.942163, - -3 + 0.74394, - 1 + 0.242709, - 3 + -0.779053, - -1 + 0.341856, - -7 + -0.116747, - -7 + -0.640877, - -1 + -0.318128, - -7 + 0.00367009, - -3 + 0.617172, - 7 + -0.204651, - -5 + 0.0780388, - 7 + 0.626396, - 1 + -0.638141, - -1 + -0.882934, - -5 + -0.704026, - -3 + 0.851265, - 7 + 0.0141939, - -7 + 0.611678, - -1 + 0.341055, - 3 + -0.405282, - -7 + 0.993071, - -5 + -0.0799289, - 1 + -0.967094, - -5 + -0.893374, - 5 + -0.606802, - -1 + -0.296088, - 3 + 0.578082, - 1 + 0.630626, - -1 + -0.256433, - -7 + 0.023755, - 5 + -0.565901, - 1 + -0.87536, - -7 + 0.591114, - 3 + -0.0151382, - 3 + -0.218575, - -1 + -0.571426, - 7 + -0.817884, - 1 + -0.105616, - -5 + 0.226052, - 1 + -0.197419, - 1 + -0.804454, - 1 + -0.957871, - -7 + 0.869702, - 7 + -0.118016, - -7 + 0.231177, - -1 + 0.143965, - -7 + -0.544014, - -7 + -0.125394, - -5 + 0.66333, - -5 + 0.0453925, - 3 + -0.445539, - -3 + -0.841133, - -1 + 0.406819, - 1 + 0.066009, - -7 + -0.141267, - 7 + 0.20172, - 1 + -0.397711, - -3 + -0.341991, - 3 + -0.66472, - -1 + 0.1133, - -1 + -0.0874664, - 1 + 0.460378, - -5 + 0.833044, - -1 + 0.694845, - -5 + -0.814154, - 5 + 0.190124, - 5 + 0.90168, - -3 + 0.150333, - 5 + -0.832164, - 5 + -0.623571, - 5 + 0.116979, - 7 + -0.623282, - -3 + 0.724953, - 3 + -0.656996, - 7 + 0.0645319, - 3 + 0.0895726, - 7 + -0.776726, - -1 + 0.318608, - 3 + 0.0496206, - -3 + 0.0368759, - -1 + 0.555521, - -5 + -0.673436, - 1 + 0.0103849, - -3 + 0.0743446, - -3 + -0.259726, - 5 + 0.0216708, - 1 + 0.769972, - -5 + -0.441797, - -3 + 0.719177, - 3 + 0.576816, - 1 + -0.95444, - 3 + 0.385715, - 7 + 0.215961, - -7 + -0.0887377, - -3 + 0.9093, - 5 + 0.231244, - -5 + 0.878044, - 1 + 0.237768, - -5 + -0.224173, - 7 + 0.115184, - 5 + -0.507669, - 3 + -0.4694, - -5 + -0.559494, - -7 + 0.256493, - -3 + 0.691867, - 7 + 0.760056, - -5 + -0.0235437, - -1 + -0.491056, - -7 + -0.632234, - -7 + 0.688073, - -3 + 0.448912, - 1 + 0.806255, - 3 + 0.174302, - -1 + 0.924295, - 1 + -0.0079971, - 7 + 0.585534, - 5 + -0.106368, - 7 + -0.647104, - -3 + -0.232442, - -1 + 0.103303, - 3 + -0.545308, - -7 + 0.171427, - 1 + -0.150061, - -5 + 0.124142, - 1 + 0.609533, - 1 + -0.51341, - 3 + 0.372706, - -5 + 0.406665, - 3 + -0.277069, - -3 + 0.316304, - -7 + -0.233404, - -7 + 0.0158354, - -3 + -0.376876, - 1 + -0.914291, - -3 + -0.819444, - -7 + 0.566109, - -5 + -0.582836, - -5 + -0.839922, - 5 + 0.186932, - -5 + -0.675285, - 5 + -0.957952, - -7 + -0.784832, - -3 + 0.403649, - 3 + 0.798144, - -3 + -0.880645, - -3 + 0.528126, - -1 + -0.657318, - 3 + 0.890482, - 5 + -0.46684, - 5 + -0.566931, - -7 + 0.81062, - -1 + -0.0238388, - -7 + -0.377402, - -3 + -0.21429, - -5 + -0.505753, - -7 + -0.951982, - -1 + -0.515628, - 3 + -0.871026, - -1 + -0.838789, - -7 + -0.725925, - 1 + 0.77047, - -3 + 0.858867, - 5 + 0.600752, - -3 + 0.0665514, - 1 + -0.317725, - 3 + -0.843704, - 5 + 0.219384, - -5 + -0.586559, - 7 + -0.240551, - -3 + -0.209033, - -7 + 0.493641, - 7 + 0.152856, - -7 + -0.597324, - -1 + -0.276392, - -1 + 0.831608, - 5 + 0.470546, - 5 + 0.330143, - -7 + 0.642262, - -7 + 0.977435, - -7 + 0.313444, - -7 + -0.10048, - 5 + 0.563594, - -1 + -0.186187, - -1 + -0.365659, - 1 + -0.837578, - -5 + 0.140403, - 7 + -0.78022, - -1 + 0.844668, - 7 + 0.375148, - 7 + -0.0498808, - 1 + 0.40211, - -1 + 0.744509, - 3 + 0.079077, - 7 + 0.296291, - 7 + -0.27219, - -7 + -0.660157, - -3 + 0.915867, - -1 + 0.102478, - 1 + -0.851214, - 7 + -0.634492, - -5 + -0.253903, - -5 + -0.598679, - -7 + -0.223802, - 3 + 0.0226067, - 1 + 0.696982, - -5 + -0.0351859, - 5 + -0.481739, - -1 + -0.00746336, - 3 + 0.416315, - 5 + 0.321218, - 3 + -0.283638, - -7 + 0.752743, - 3 + -0.774599, - -1 + 0.30598, - 5 + -0.0478183, - 7 + 0.791332, - -5 + -0.235768, - 3 + 0.292966, - -3 + 0.414722, - 3 + -0.665212, - 5 + -0.710929, - -3 + -0.588074, - -3 + 0.331691, - 7 + 0.882629, - 3 + -0.550038, - 1 + -0.957022, - -5 + 0.990136, - 5 + -0.558498, - -3 + -0.842342, - -1 + 0.000248163, - -5 + 0.131952, - 7 + -0.167911, - 1 + -0.425364, - 7 + -0.372087, - 1 + 0.526899, - -1 + -0.638801, - -5 + -0.386877, - 7 + 0.871863, - -7 + 0.459965, - 5 + -0.165079, - 5 + 0.296509, - -3 + 0.833452, - -7 + 0.744527, - -3 + 0.626609, - 1 + -0.814472, - 3 + 0.998261, - -7 + 0.270782, - 1 + -0.904688, - -5 + 0.723069, - -1 + -0.664172, - -5 + -0.019654, - -1 + 0.757106, - 7 + 0.780875, - 1 + -0.898937, - 3 + -0.485577, - -3 + -0.140519, - -3 + -0.240458, - -1 + 0.353802, - -7 + -0.918099, - 3 + -0.32276, - 3 + 0.672086, - -3 + -0.335273, - 1 + -0.999146, - -1 + -0.630338, - 7 + -0.544571, - -7 + 0.470793, - -3 + -0.581126, - -1 + 0.135819, - -1 + 0.0451301, - 5 + 0.479837, - -3 + 0.172697, - 5 + 0.796663, - -1 + -0.566894, - 1 + 0.470888, - 3 + 0.0653015, - -7 + 0.792323, - 1 + -0.867727, - -3 + 0.829587, - -3 + -0.740408, - 3 + -0.830687, - 3 + 0.957641, - -7 + -0.423364, - 3 + -0.893497, - 1 + -0.853771, - -3 + 0.92187, - 1 + -0.929865, - -3 + 0.198643, - 7 + 0.961747, - -1 + -0.431994, - 7 + 0.35683, - -1 + -0.871135, - 7 + 0.727451, - 7 + 0.458093, - -3 + 0.22682, - -3 + -0.827643, - -3 + -0.189953, - 5 + -0.688236, - -3 + -0.294562, - 5 + -0.903106, - -5 + 0.444196, - -1 + 0.2121, - -5 + -0.214493, - -5 + -0.392994, - -3 + 0.665017, - 1 + 0.269187, - 7 + -0.745741, - 1 + -0.185388, - -5 + -0.795616, - -5 + -0.989525, - -5 + -0.0291574, - 7 + 0.577641, - 3 + -0.98546, - 5 + 0.696809, - -5 + 0.649647, - 3 + -0.401609, - -7 + 0.29181, - -1 + -0.336865, - 3 + -0.279985, - -7 + 0.819639, - 1 + -0.69903, - 5 + -0.956345, - -3 + 0.917636, - 3 + -0.539845, - 3 + -0.58337, - 5 + 0.0319712, - 3 + -0.682523, - 3 + -0.160175, - 1 + -0.707552, - 3 + -0.197245, - -1 + 0.583643, - -7 + 0.128135, - 3 + 0.240791, - -7 + -0.289134, - -7 + 0.955084, - -5 + 0.495007, - -1 + 0.955188, - 3 + 0.523281, - -1 + 0.468672, - -5 + -0.467838, - -3 + 0.654833, - -5 + 0.85963, - -3 + 0.532693, - -3 + -0.11304, - 5 + 0.947132, - 5 + 0.395143, - 1 + -0.114501, - -5 + 0.275912, - -7 + -0.816982, - -3 + 0.280537, - 1 + -0.290476, - 3 + 0.753207, - 3 + -0.37078, - -5 + -0.73641, - 1 + 0.720629, - -1 + 0.61751, - 5 + -0.114619, - 3 + -0.509509, - 1 + 0.349672, - 7 + 0.426544, - -5 + -0.567438, - -7 + -0.52387, - 3 + -0.376306, - 3 + -0.49252, - 5 + 0.441628, - 3 + 0.703002, - -7 + 0.62187, - 3 + 0.754402, - -1 + -0.344451, - 5 + -0.0148834, - -7 + 0.449515, - 5 + 0.230859, - 1 + 0.724024, - 5 + 0.190704, - 1 + -0.69348, - -5 + 0.586233, - 5 + 0.0794267, - -5 + -0.631736, - 1 + 0.105417, - -5 + 0.136263, - 7 + -0.642064, - 1 + 0.0430542, - -7 + -0.41497, - 5 + 0.775936, - -1 + 0.687085, - -5 + 0.925474, - -5 + 0.0990985, - 3 + -0.277763, - -1 + 0.299999, - 3 + 0.392572, - -7 + -0.546367, - 7 + 0.403084, - 5 + -0.0418944, - -7 + 0.446579, - -7 + 0.372017, - -1 + 0.459786, - 7 + -0.0032825, - 5 + 0.189248, - 5 + -0.155126, - 3 + 0.53685, - 3 + 0.933272, - 3 + -0.384181, - 5 + 0.204225, - 1 + -0.327539, - -7 + 0.348723, - 1 + -0.685387, - -7 + -0.750799, - -1 + -0.627168, - -7 + 0.610837, - 5 + -0.957175, - -3 + 0.834856, - -1 + 0.528653, - 7 + -0.780567, - 7 + 0.0884855, - 3 + 0.648985, - -1 + 0.218943, - -7 + 0.832075, - 5 + 0.811807, - -3 + -0.685713, - -3 + -0.296578, - 3 + 0.000125931, - -5 + -0.996983, - -5 + -0.193044, - 5 + -0.0545228, - 1 + 0.893854, - 5 + 0.97836, - -3 + -0.748222, - -1 + 0.196022, - 1 + 0.163083, - -5 + -0.180233, - -1 + 0.209452, - -3 + 0.744591, - -3 + -0.1817, - 1 + -0.447565, - 5 + 0.528624, - -7 + -0.692082, - 7 + -0.428345, - -7 + 0.0934917, - 1 + 0.678237, - -7 + -0.298993, - -3 + 0.654322, - -3 + -0.942614, - 7 + 0.783697, - 3 + 0.395035, - 1 + -0.372332, - 3 + -0.859733, - 1 + 0.4468, - 5 + 0.822121, - -5 + 0.201003, - -7 + -0.74061, - 5 + -0.568736, - 3 + 0.904994, - -5 + 0.325172, - 5 + 0.292775, - 5 + 0.511914, - -7 + 0.675604, - 5 + 0.907106, - -7 + 0.676053, - -3 + -0.64883, - -1 + -0.451512, - 3 + -0.841985, - -7 + 0.0817016, - -1 + 0.111568, - -7 + -0.594469, - -3 + -0.844349, - 3 + -0.26745, - -3 + -0.559703, - 7 + 0.53067, - 3 + -0.256771, - -1 + -0.170001, - -1 + -0.775529, - -1 + -0.456536, - 3 + -0.998071, - 1 + 0.941052, - 7 + 0.130878, - 7 + 0.838738, - 1 + 0.856186, - 1 + 0.846151, - -1 + -0.737487, - 3 + -0.76553, - -3 + 0.222, - -1 + -0.387758, - 7 + -0.269319, - -3 + 0.0668951, - 3 + 0.731949, - 5 + -0.741075, - -7 + -0.219907, - 3 + 0.487581, - 1 + -0.973969, - 7 + 0.639967, - 3 + 0.809232, - 3 + -0.642748, - 5 + -0.453162, - -7 + -0.474022, - -3 + -0.631836, - -3 + 0.0981818, - 7 + 0.684498, - -1 + -0.654845, - -5 + -0.612608, - 7 + 0.610862, - -3 + -0.369351, - 3 + -0.261936, - 7 + -0.814926, - 7 + 0.390131, - -5 + 0.531136, - 3 + 0.974289, - -3 + -0.111925, - 3 + 0.376471, - -3 + -0.941562, - 7 + -0.410982, - -7 + 0.875953, - 5 + -0.448872, - -1 + -0.806028, - -1 + -0.814961, - 5 + 0.395374, - -7 + 0.814904, - 1 + 0.383855, - 1 + -0.252184, - 3 + 0.524843, - -7 + -0.233859, - -7 + 0.764495, - -7 + 0.817705, - -5 + 0.641853, - -3 + -0.758414, - -1 + -0.260464, - -7 + -0.240351, - -3 + 0.0476139, - -1 + -0.220685, - -1 + -0.993293, - 7 + 0.627481, - -3 + -0.950516, - -5 + -0.0848613, - 5 + 0.670037, - 7 + 0.825011, - -7 + 0.111405, - 7 + 0.0703245, - -3 + 0.177663, - 7 + -0.739343, - 3 + -0.673892, - 7 + -0.947279, - -5 + 0.732764, - 7 + -0.807932, - 1 + -0.494108, - 1 + 0.611574, - -1 + 0.205265, - -1 + -0.485118, - -5 + 0.0552847, - -5 + -0.176059, - 5 + 0.00244508, - 7 + -0.773636, - 5 + 0.951496, - -7 + 0.525518, - -5 + 0.968101, - -7 + 0.10137, - 5 + -0.4487, - 7 + 0.215142, - -5 + -0.162651, - 5 + -0.520808, - 1 + -0.89087, - -1 + -0.804296, - 7 + -0.341382, - -7 + 0.793131, - 5 + -0.724335, - 7 + 0.0832606, - 3 + -0.819473, - 7 + -0.613928, - -1 + -0.975915, - 7 + 0.555494, - -1 + -0.753698, - 1 + -0.570132, - -5 + -0.00221921, - 1 + 0.010534, - -5 + -0.825051, - -5 + 0.528378, - 3 + 0.559274, - -5 + 0.826081, - 7 + -0.349553, - 3 + 0.36511, - -5 + -0.881283, - 1 + 0.833997, - 1 + 0.00815386, - -3 + -0.820684, - 1 + 0.952573, - -5 + 0.378794, - -5 + 0.465909, - 1 + -0.166333, - 1 + 0.0746185, - -1 + 0.431021, - 5 + 0.266922, - -1 + 0.339902, - -1 + 0.372874, - 7 + -0.0149696, - -1 + 0.0317811, - 7 + -0.691387, - -1 + 0.929823, - 5 + -0.295751, - 7 + -0.851862, - -1 + 0.33382, - 7 + -0.589562, - -7 + -0.217095, - -7 + 0.115214, - -7 + 0.220949, - 1 + 0.800567, - 3 + -0.251049, - -5 + -0.626753, - 7 + -0.450723, - 7 + 0.22979, - -3 + -0.342451, - -3 + 0.997709, - -1 + 0.582385, - -5 + 0.191317, - 7 + -0.873862, - 5 + 0.213097, - 7 + -0.762892, - 7 + 0.954305, - 7 + 0.188828, - 7 + 0.931783, - -7 + -0.839115, - 5 + -0.738813, - 3 + 0.926841, - 5 + 0.399905, - -7 + 0.0123429, - -5 + 0.545699, - 3 + -0.661568, - 3 + -0.261673, - -5 + -0.81428, - 7 + 0.866628, - 5 + -0.048188, - -3 + 0.165017, - 7 + -0.698899, - -7 + 0.0783355, - -7 + 0.693822, - 7 + 0.726706, - -1 + 0.148921, - 7 + -0.685703, - 3 + 0.548864, - -7 + -0.878148, - 3 + 0.205964, - 5 + -0.271077, - -7 + -0.15239, - 1 + -0.949635, - -1 + 0.961041, - -7 + 0.0868696, - 3 + -0.361298, - 3 + 0.624626, - 3 + -0.0838945, - 5 + 0.132301, - -1 + 0.192646, - -5 + -0.579731, - -5 + -0.101051, - 5 + 0.870131, - 1 + 0.535988, - 5 + 0.255953, - 1 + 0.314134, - -7 + 0.762894, - -7 + 0.127185, - 7 + -0.222042, - -5 + -0.529038, - -3 + 0.231572, - 1 + 0.788721, - 5 + -0.891869, - -5 + -0.472732, - 3 + -0.0128941, - 1 + -0.623197, - 7 + -0.490687, - -1 + -0.441505, - 1 + -0.0410075, - -5 + 0.847264, - -7 + -0.371955, - -1 + 0.41401, - -1 + -0.742, - 3 + 0.0546079, - 5 + -0.529726, - 7 + -0.0630406, - 1 + 0.196568, - -3 + 0.488722, - -5 + -0.357116, - 3 + -0.179397, - -3 + 0.358234, - -7 + 0.821111, - 7 + -0.634397, - 5 + -0.490498, - -5 + -0.103393, - -7 + -0.996996, - -5 + 0.358586, - -7 + 0.785637, - -5 + 0.46574, - -1 + -0.714036, - 7 + 0.73281, - -1 + -0.980125, - -5 + 0.152175, - -1 + -0.468575, - -1 + -0.154831, - 5 + -0.257122, - 3 + -0.414745, - 3 + 0.663051, - -3 + 0.787162, - -1 + 0.773088, - 5 + -0.0174988, - 7 + 0.348241, - 1 + 0.856018, - -7 + -0.177525, - 1 + 0.409387, - 3 + 0.0205055, - -3 + 0.212273, - 7 + -0.35314, - -1 + 0.253691, - -7 + 0.988757, - 1 + 0.915514, - 7 + -0.0632796, - -3 + -0.0794022, - 5 + 0.905145, - 3 + -0.678132, - 7 + 0.842035, - -1 + 0.189324, - -1 + 0.431813, - 5 + 0.855323, - 3 + -0.285528, - -3 + -0.740299, - 3 + 0.526598, - -3 + -0.807057, - -3 + -0.907001, - -1 + 0.673215, - 1 + -0.806326, - -7 + -0.0179321, - 7 + 0.0822508, - -1 + 0.850969, - 5 + 0.18839, - 3 + -0.692543, - -5 + 0.064437, - -7 + -0.112983, - -3 + -0.0709171, - -5 + 0.327346, - 1 + -0.595314, - -1 + 0.878245, - 1 + 0.291632, - -1 + -0.922109, - -3 + -0.872261, - -7 + -0.212876, - 1 + -0.348517, - 5 + -0.24286, - 3 + 0.777443, - 5 + 0.00615786, - 5 + 0.834023, - 1 + -0.590069, - -7 + 0.653321, - 1 + -0.234737, - -7 + 0.664936, - 7 + 0.411378, - -7 + -0.88205, - -1 + -0.855369, - 1 + 0.377919, - -7 + -0.456485, - -5 + -0.949986, - -5 + -0.0158651, - 3 + 0.535672, - -1 + -0.687636, - 1 + 0.736756, - 7 + -0.696999, - 1 + 0.847792, - -3 + -0.349274, - 1 + -0.544481, - 7 + 0.608189, - -7 + 0.608384, - 5 + -0.323123, - 7 + -0.947181, - 5 + 0.753829, - 5 + -0.573138, - 5 + -0.485321, - -5 + 0.480423, - -5 + -0.371829, - 5 + -0.853753, - -7 + 0.878959, - -7 + 0.0642654, - 1 + 0.680307, - 1 + 0.291632, - 7 + -0.853807, - 5 + 0.644158, - 5 + -0.355364, - 1 + 0.190966, - 3 + -0.294411, - -7 + -0.67303, - -5 + -0.965702, - -3 + 0.55212, - 1 + -0.804562, - -7 + -0.494127, - -5 + -0.983771, - 1 + -0.133138, - -1 + -0.607814, - 1 + -0.742387, - -5 + -0.411707, - -3 + -0.816862, - 7 + 0.426785, - 5 + -0.089001, - 3 + -0.966127, - 3 + -0.784032, - 5 + -0.356036, - 5 + 0.475987, - 1 + 0.970457, - -3 + 0.678356, - 1 + -0.430618, - 5 + 0.942241, - -3 + -0.913966, - 7 + -0.730373, - -3 + 0.640682, - 7 + -0.024488, - -5 + 0.462632, - -3 + -0.609614, - -1 + -0.482857, - -5 + 0.535506, - 7 + 0.821051, - -1 + 0.793945, - 3 + -0.0835013, - -5 + -0.393026, - 1 + -0.415528, - -5 + 0.182819, - 1 + -0.561988, - -5 + -0.417262, - 7 + 0.708211, - 1 + -0.207354, - -5 + -0.844518, - -7 + 0.604461, - 7 + 0.787027, - 7 + 0.763122, - 1 + 0.300372, - -3 + -0.0203687, - -7 + -0.500432, - 7 + -0.5601, - 5 + -0.682225, - -5 + -0.547398, - -3 + 0.769381, - -3 + 0.750163, - -5 + -0.820679, - 3 + 0.236003, - 1 + -0.316465, - -3 + 0.802262, - 3 + -0.399964, - 5 + -0.166494, - 1 + 0.776745, - 5 + 0.716541, - 7 + -0.251088, - -5 + -0.42548, - -3 + -0.761153, - 7 + -0.0766243, - 3 + -0.180629, - 5 + -0.166458, - -5 + -0.833394, - -7 + 0.0297446, - -7 + -0.362676, - 7 + -0.644897, - -7 + 0.283366, - 5 + -0.665628, - 3 + -0.488068, - -1 + -0.902438, - -5 + -0.355751, - 3 + -0.419479, - 7 + -0.370073, - -3 + 0.480753, - 1 + -0.420338, - -7 + -0.24157, - 7 + 0.207747, - -1 + -0.777488, - 5 + 0.341417, - -1 + -0.33618, - -5 + 0.598459, - -3 + -0.280681, - 1 + -0.0398586, - 7 + 0.717195, - 5 + 0.431427, - -5 + -0.839676, - -1 + -0.74745, - 1 + 0.73193, - -1 + 0.729311, - 5 + 0.561066, - -5 + -0.670177, - -1 + -0.254041, - 3 + 0.0451663, - -7 + -0.160697, - 7 + 0.13319, - -3 + 0.360953, - -3 + 0.264897, - 1 + -0.566809, - -5 + 0.291045, - 1 + -0.573798, - -3 + 0.854987, - -3 + -0.973763, - -7 + -0.958898, - 1 + -0.945093, - -1 + -0.72672, - 5 + 0.814473, - 7 + -0.794704, - -3 + 0.229887, - -1 + 0.801239, - -5 + 0.531782, - -1 + 0.247072, - 1 + -0.179189, - -3 + 0.401884, - 7 + 0.236019, - -1 + 0.725281, - -5 + 0.74655, - 5 + -0.427725, - -1 + 0.967868, - -7 + -0.432802, - -1 + 0.541378, - 7 + -0.555299, - -3 + 0.166895, - -7 + 0.921733, - -3 + 0.840396, - -5 + -0.602658, - -1 + -0.189227, - -5 + 0.605957, - 5 + -0.525512, - 5 + 0.433278, - -1 + 0.554043, - -1 + 0.353735, - 3 + -0.493134, - -7 + 0.86014, - -3 + 0.543759, - -1 + 0.248284, - -5 + -0.502769, - 5 + -0.984136, - 5 + 0.407552, - -1 + 0.869081, - -3 + -0.7676, - -1 + 0.940972, - 1 + -0.511719, - 7 + 0.870979, - 3 + -0.0582847, - 7 + -0.628254, - 7 + -0.780393, - 3 + -0.227097, - 1 + -0.738505, - 1 + 0.364707, - 1 + -0.522339, - -3 + -0.123359, - -5 + 0.911237, - 7 + -0.856169, - -5 + 0.878138, - 1 + -0.761068, - 3 + 0.341228, - 7 + 0.0689835, - 3 + -0.15808, - 7 + -0.138551, - 3 + 0.368672, - 5 + -0.617489, - 1 + 0.404668, - -7 + -0.699522, - 5 + -0.997434, - 5 + 0.36597, - 5 + 0.785275, - 3 + -0.231849, - 3 + -0.0999933, - 1 + -0.109, - 3 + -0.686237, - 1 + -0.902631, - -7 + 0.51259, - -5 + 0.0942837, - 1 + 0.708383, - -3 + -0.861124, - -3 + -0.179481, - -3 + 0.779682, - 1 + -0.493657, - 1 + -0.418592, - -1 + 0.856146, - 3 + -0.0875076, - 7 + -0.483033, - -1 + 0.646554, - -1 + 0.974864, - -3 + -0.841565, - -7 + 0.228352, - -1 + -0.0205758, - 7 + -0.359954, - 7 + 0.314803, - 1 + -0.357785, - 7 + 0.751935, - 1 + 0.215695, - 5 + -0.190122, - -7 + 0.428353, - -1 + -0.890184, - 7 + 0.122886, - 1 + -0.557184, - 5 + -0.556109, - 7 + 0.828952, - -5 + -0.989435, - 7 + 0.830655, - -3 + -0.217279, - -1 + -0.835888, - -1 + 0.254548, - 5 + 0.523081, - 3 + 0.584681, - 1 + -0.0839997, - 5 + -0.186458, - 1 + 0.0540011, - -1 + 0.274899, - -7 + 0.116505, - 3 + 0.723544, - 5 + 0.136319, - 7 + -0.419947, - 5 + 0.476982, - 3 + 0.243726, - 3 + 0.0739162, - -3 + -0.028526, - -1 + -0.915011, - -7 + 0.764662, - 5 + -0.449836, - -1 + 0.54113, - -5 + 0.435229, - 3 + 0.0290581, - -7 + -0.416793, - 7 + 0.733392, - 1 + -0.222058, - -1 + -0.70491, - 1 + -0.738726, - 5 + 0.467214, - -5 + -0.820001, - 5 + -0.100838, - 3 + -0.867579, - -3 + 0.682739, - 5 + -0.418042, - -1 + 0.451298, - 5 + 0.494458, - 1 + -0.849409, - 1 + -0.69703, - 1 + 0.852578, - -1 + -0.781506, - -1 + 0.477606, - 3 + -0.215093, - -1 + 0.741802, - -7 + 0.574622, - 5 + 0.855315, - 5 + 0.655386, - 1 + -0.0553299, - -1 + -0.801709, - -1 + 0.610893, - 1 + -0.996069, - -1 + -0.632696, - 7 + 0.337866, - -5 + -0.444426, - 7 + 0.557502, - 3 + 0.171951, - 7 + 0.0341445, - 3 + 0.332677, - 3 + 0.169284, - 3 + -0.273138, - -5 + 0.31627, - -1 + -0.456444, - 5 + -0.892569, - 3 + 0.936689, - 5 + -0.406369, - -5 + 0.589934, - -3 + -0.20777, - -1 + 0.757187, - -5 + 0.629676, - 5 + 0.365524, - 5 + 0.289739, - -7 + -0.182101, - -1 + 0.784527, - -3 + 0.382947, - 3 + -0.380673, - 3 + -0.748491, - 1 + 0.642036, - -1 + 0.423028, - -3 + -0.740949, - -7 + 0.0430477, - -5 + 0.916659, - 1 + -0.858744, - 1 + 0.354461, - -5 + 0.197777, - 1 + 0.132034, - 5 + -0.935967, - -7 + 0.920792, - 3 + -0.456423, - 1 + -0.288826, - 1 + -0.600615, - 7 + -0.975289, - -5 + -0.259924, - -1 + -0.640925, - -3 + 0.531508, - 1 + 0.560676, - 1 + -0.36099, - -5 + 0.122059, - -5 + -0.701523, - 3 + -0.620508, - 3 + -0.918876, - 5 + -0.716268, - 7 + -0.885677, - 7 + -0.812334, - 5 + -0.427292, - -7 + -0.543744, - 3 + -0.917745, - 1 + 0.285421, - 7 + -0.938258, - -3 + 0.845977, - 5 + -0.817096, - -3 + -0.81931, - 7 + 0.384529, - -5 + 0.923807, - -5 + -0.835286, - -3 + 0.495043, - -7 + 0.610036, - 3 + 0.691557, - 1 + 0.262664, - -7 + 0.312157, - -5 + -0.629477, - -7 + -0.396994, - 5 + -0.749666, - -3 + -0.693143, - 5 + 0.427751, - 1 + 0.18179, - -5 + 0.994096, - 5 + -0.868472, - -3 + -0.000652722, - 5 + -0.826959, - 7 + 0.810413, - -7 + 0.624387, - 3 + -0.0808038, - -3 + 0.766962, - 7 + -0.576073, - -1 + 0.549271, - -7 + -0.831344, - 7 + -0.693934, - -1 + 0.494453, - -1 + 0.201426, - 7 + 0.722833, - 5 + -0.156928, - -5 + 0.470001, - 5 + 0.928162, - 3 + 0.282769, - -1 + 0.914984, - 7 + 0.453746, - 7 + 0.641607, - -7 + -0.00260904, - -5 + -0.1964, - -3 + 0.251894, - 7 + 0.528101, - 3 + 0.110567, - 3 + 0.589285, - 3 + -0.820993, - -1 + 0.933257, - 3 + 0.400226, - 3 + 0.307276, - 5 + -0.485213, - -7 + 0.442066, - 1 + -0.967156, - 3 + 0.725474, - 1 + -0.699786, - -7 + 0.506006, - 7 + 0.513752, - -3 + -0.55039, - -5 + 0.997721, - -1 + 0.875475, - 3 + 0.935239, - -5 + 0.114364, - 1 + -0.956559, - 7 + -0.360408, - 1 + 0.198951, - -1 + -0.202082, - 5 + 0.6909, - -1 + 0.530785, - -7 + 0.117763, - 1 + -0.671653, - -1 + -0.301334, - -3 + -0.0852486, - -5 + 0.24372, - 7 + -0.937574, - -3 + 0.970979, - -5 + -0.307326, - -3 + 0.755383, - -7 + -0.0614709, - 7 + -0.354787, - 3 + -0.195025, - 7 + -0.294593, - 1 + 0.679208, - 5 + 0.876946, - 1 + 0.896838, - -1 + 0.343962, - -7 + -0.0557097, - 3 + 0.335734, - -1 + 0.00658689, - 7 + -0.707898, - -1 + 0.355665, - -1 + -0.598976, - -5 + -0.591982, - 7 + -0.485165, - 1 + -0.624015, - -3 + -0.545053, - -3 + -0.584821, - 1 + -0.748295, - -1 + 0.603633, - 5 + -0.281878, - -3 + 0.887608, - -5 + -0.701604, - 3 + 0.583568, - -7 + -0.987855, - 7 + 0.0166069, - -3 + 0.156798, - -7 + 0.693214, - 7 + 0.197865, - 7 + 0.461644, - 7 + -0.751676, - -1 + 0.989154, - -3 + -0.828416, - 5 + 0.478627, - -5 + -0.225786, - 3 + 0.146553, - 3 + 0.242108, - 1 + -0.991743, - 5 + -0.23658, - 1 + 0.712781, - -1 + -0.320432, - -1 + -0.272036, - 3 + 0.601587, - 5 + -0.176224, - 7 + -0.599448, - -5 + 0.821199, - -5 + -0.650962, - -5 + 0.54749, - -7 + 0.846249, - -5 + 0.895817, - 3 + -0.368985, - 1 + -0.479081, - -3 + 0.780251, - -3 + 0.30783, - -5 + -0.0721856, - -7 + -0.0359803, - 3 + -0.559485, - 1 + 0.296459, - 7 + 0.19517, - -5 + -0.686891, - 3 + 0.126611, - 5 + -0.0218955, - 5 + -0.0897653, - 5 + -0.476869, - 5 + -0.36738, - 1 + -0.905938, - -5 + 0.769578, - -7 + -0.911913, - -5 + 0.243897, - 3 + 0.688956, - 5 + 0.278523, - -5 + 0.119666, - 5 + -0.0967183, - -7 + -0.925501, - 1 + -0.609733, - -1 + 0.538315, - 3 + -0.49403, - -7 + 0.00403903, - -1 + 0.422778, - 1 + -0.676254, - -5 + -0.495082, - -3 + 0.887213, - -7 + -0.210539, - -5 + 0.802399, - -3 + -0.205944, - 5 + -0.684772, - -7 + 0.844196, - -5 + -0.69577, - 5 + -0.822575, - -7 + -0.158769, - 5 + 0.942987, - -7 + -0.739025, - 3 + 0.791325, - 1 + -0.931093, - -7 + -0.8201, - 3 + -0.732275, - -1 + 0.945871, - 3 + -0.891814, - -7 + 0.0258538, - 3 + 0.892123, - 1 + -0.880949, - -3 + -0.633805, - -3 + -0.709181, - -3 + -0.383623, - 3 + -0.150093, - -7 + -0.117931, - 1 + -0.307017, - 3 + 0.380702, - -5 + -0.594801, - 5 + -0.43212, - 5 + 0.920089, - 7 + -0.804395, - 1 + -0.918654, - -1 + -0.904769, - 7 + -0.78175, - 7 + 0.322011, - 3 + -0.294538, - -7 + 0.930585, - 1 + -0.477718, - -5 + -0.989844, - -1 + 0.902946, - -7 + -0.350604, - 7 + 0.126035, - -7 + -0.920143, - -7 + 0.851657, - 3 + -0.136341, - 3 + 0.593154, - -5 + -0.803969, - -5 + 0.503475, - 5 + 0.0188022, - 5 + 0.631931, - 7 + 0.91577, - -7 + -0.549304, - 1 + -0.723671, - -1 + -0.305956, - -5 + 0.74761, - -3 + 0.355676, - -1 + 0.855675, - 3 + 0.613764, - 7 + 0.700543, - -5 + -0.132191, - -1 + -0.0646009, - -5 + 0.590769, - -3 + -0.49326, - -1 + 0.216807, - -3 + -0.946063, - 1 + 0.186966, - -7 + 0.790963, - -1 + 0.45715, - 1 + 0.743977, - -5 + -0.136574, - -3 + -0.888679, - -5 + -0.732167, - 7 + -0.397459, - -7 + -0.0469681, - -7 + 0.615953, - -5 + 0.439568, - 3 + 0.273846, - 7 + 0.314949, - 3 + 0.911291, - -5 + -0.453662, - 3 + 0.80863, - 3 + -0.0106643, - 5 + 0.607597, - 7 + 0.356758, - 1 + -0.6931, - -5 + 0.371134, - -3 + -0.711628, - 7 + 0.944743, - -7 + 0.202408, - -1 + 0.728236, - -3 + 0.684351, - 3 + -0.40255, - 1 + -0.186503, - -1 + 0.0150248, - 3 + 0.185297, - -7 + 0.36002, - 3 + 0.750152, - 5 + -0.381467, - 7 + 0.334737, - -3 + 0.0568684, - 3 + -0.567396, - 5 + -0.995164, - 1 + 0.602424, - 7 + 0.0454783, - 3 + 0.516061, - 5 + -0.199994, - 1 + 0.737877, - 7 + 0.411311, - 5 + -0.853456, - 5 + -0.121685, - 7 + -0.507778, - -7 + 0.152738, - -7 + 0.094981, - 1 + -0.681713, - 5 + 0.442789, - 5 + 0.973592, - 1 + -0.323444, - 1 + 0.863931, - -1 + 0.396984, - 7 + 0.249854, - 1 + 0.807021, - 7 + 0.644638, - -7 + -0.422386, - 1 + 0.0698824, - -1 + 0.24009, - -3 + -0.406826, - 3 + -0.997362, - -7 + -0.410919, - 3 + 0.0102449, - 5 + -0.495212, - 3 + 0.260833, - -7 + -0.397034, - 1 + -0.379961, - 3 + 0.483326, - 7 + -0.909255, - -7 + 0.950334, - -1 + -0.970264, - -1 + 0.276129, - -7 + -0.0553154, - -7 + 0.322334, - -3 + -0.902084, - 7 + 0.29514, - -5 + 0.864139, - 3 + 0.925323, - -3 + 0.338491, - 3 + -0.0651398, - 3 + 0.912289, - -3 + 0.52022, - -3 + -0.709139, - 3 + -0.742856, - 7 + 0.565104, - 5 + 0.894589, - 5 + -0.556394, - -1 + -0.864631, - -5 + 0.794986, - -7 + -0.869075, - 7 + 0.774674, - 3 + 0.428512, - -5 + 0.839244, - -1 + 0.357717, - -7 + 0.199788, - -1 + -0.458671, - 7 + 0.526558, - -1 + -0.318607, - -5 + 0.630471, - -3 + -0.441537, - -1 + -0.580994, - -1 + 0.690485, - 3 + -0.547178, - 7 + 0.0732123, - 7 + -0.552486, - 3 + -0.133145, - 5 + -0.933638, - 1 + 0.255392, - -3 + -0.280157, - -5 + -0.150034, - 5 + -0.122912, - 5 + 0.941452, - -3 + 0.188547, - 3 + -0.211247, - 7 + 0.946076, - -3 + 0.92071, - 1 + 0.972226, - -5 + 0.852144, - 3 + 0.377145, - -1 + 0.413943, - -7 + 0.439598, - -5 + -0.13615, - 5 + 0.171454, - -5 + 0.845844, - -7 + 0.783942, - 3 + -0.618869, - -7 + 0.760145, - 5 + -0.0578561, - -1 + -0.582842, - 3 + -0.155049, - 5 + -0.220217, - 7 + -0.73738, - 1 + -0.767926, - -1 + -0.1484, - 7 + 0.834785, - 1 + 0.101825, - -7 + -0.449194, - 3 + 0.11657, - -1 + 0.904672, - -5 + 0.054498, - 3 + 0.924094, - -5 + -0.0965653, - 1 + -0.613703, - -7 + 0.4126, - -3 + 0.584113, - -7 + 0.159096, - -5 + -0.485646, - 3 + -0.0365765, - -3 + -0.417187, - 7 + 0.916336, - -1 + 0.725319, - 1 + 0.494014, - -5 + -0.532621, - -1 + 0.646111, - -7 + -0.417253, - -1 + -0.0992868, - -1 + 0.654899, - 3 + -0.444689, - 3 + 0.800794, - 1 + -0.112122, - -1 + -0.712385, - -3 + 0.166391, - 5 + 0.314575, - -5 + 0.950806, - 3 + -0.44719, - 1 + -0.175398, - 5 + -0.225897, - 3 + 0.258122, - -1 + -0.571683, - -3 + 0.745108, - 7 + -0.489975, - 3 + 0.869279, - 3 + -0.536627, - 5 + -0.828879, - -7 + -0.62512, - -7 + -0.456803, - 7 + 0.142581, - 7 + -0.220935, - 7 + 0.012534, - -5 + -0.681989, - -7 + 0.622798, - 1 + -0.557702, - -3 + 0.482869, - 5 + 0.197984, - 3 + 0.934018, - 7 + -0.094445, - -7 + 0.325073, - 7 + 0.917923, - -7 + 0.17338, - -5 + -0.354761, - -5 + 0.71292, - -1 + -0.877613, - 7 + -0.857628, - -7 + 0.5547, - 5 + 0.819892, - 5 + 0.550559, - 3 + -0.0277248, - 3 + 0.0711193, - -3 + -0.0491096, - -5 + -0.860672, - 3 + -0.0807872, - -5 + 0.651853, - 7 + 0.104082, - -7 + 0.236164, - -1 + -0.330286, - -7 + -0.480073, - 3 + 0.406925, - -5 + -0.518305, - -1 + -0.605615, - -1 + 0.381587, - -1 + -0.11044, - 3 + -0.160278, - 1 + -0.304637, - -1 + -0.527384, - -7 + 0.882399, - 3 + -0.777911, - -7 + -0.0419154, - 1 + -0.719173, - -7 + 0.936713, - -3 + -0.751213, - -3 + 0.441754, - 1 + -0.0637285, - -1 + 0.375699, - 7 + -0.153902, - 7 + -0.792171, - 5 + 0.655847, - 7 + 0.882999, - 5 + 0.0812634, - 3 + 0.546496, - -7 + -0.223494, - -1 + -0.356427, - 1 + 0.310918, - -7 + 0.571231, - -1 + 0.798337, - -3 + 0.598408, - -3 + 0.72025, - 3 + 0.51356, - -3 + -0.167374, - 3 + 0.240713, - 5 + 0.933577, - 5 + 0.267443, - -7 + 0.853163, - 7 + 0.751923, - 1 + -0.76546, - 1 + -0.464537, - -5 + -0.307334, - 1 + 0.78241, - -3 + -0.998566, - -1 + 0.35207, - -5 + 0.427847, - -5 + 0.110459, - 3 + 0.834955, - -7 + 0.254993, - 5 + 0.368997, - 1 + 0.697111, - 5 + 0.458215, - 5 + 0.0957664, - 7 + -0.97862, - -7 + -0.615026, - 3 + 0.859467, - 5 + -0.306685, - 1 + 0.305295, - -5 + 0.093081, - -3 + 0.673005, - 1 + 0.985715, - -5 + -0.944994, - -5 + 0.817741, - 7 + -0.898887, - 7 + -0.742699, - -7 + 0.298725, - 5 + -0.180113, - -7 + 0.18706, - 1 + 0.185461, - -1 + -0.522394, - -1 + -0.117225, - -7 + -0.143794, - -3 + -0.273471, - 1 + 0.139797, - 5 + -0.265773, - 3 + 0.427259, - 3 + -0.869272, - -5 + -0.144366, - -1 + 0.337665, - -1 + 0.171026, - 5 + -0.79788, - -5 + 0.192947, - -5 + -0.311556, - 5 + 0.785642, - -1 + -0.505434, - -1 + 0.233518, - 1 + 0.420173, - -1 + 0.163412, - 7 + 0.605216, - 1 + -0.593143, - -1 + -0.957213, - -1 + -0.515973, - 1 + 0.525257, - -5 + 0.446536, - 1 + 0.486375, - -3 + -0.5737, - 3 + -0.217493, - -1 + 0.517623, - -7 + 0.920525, - 5 + 0.365421, - 5 + 0.00848039, - -5 + 0.153402, - 1 + 0.13929, - 5 + 0.977456, - -7 + 0.22807, - -1 + -0.119464, - -1 + -0.351284, - -1 + -0.991155, - 7 + 0.889795, - -3 + 0.691846, - 1 + -0.746596, - -3 + 0.586713, - 5 + 0.596188, - -7 + -0.477961, - 3 + -0.620132, - 5 + -0.0775085, - 1 + -0.165338, - 5 + -0.211165, - 7 + -0.0470844, - 7 + -0.748061, - -3 + -0.810057, - 5 + -0.196284, - -7 + 0.0831261, - 7 + 0.823358, - 3 + -0.628647, - 7 + 0.576381, - -3 + -0.347779, - 7 + 0.223497, - -7 + -0.526754, - -7 + 0.806814, - -7 + -0.725776, - 5 + -0.793048, - -3 + -0.678268, - 7 + -0.718848, - 1 + 0.914832, - -5 + 0.808905, - 5 + 0.664148, - 3 + -0.151127, - -3 + -0.289634, - 7 + 0.276275, - 5 + 0.0411116, - -3 + 0.180697, - 7 + -0.957571, - 5 + -0.931349, - 3 + 0.346197, - 3 + 0.855933, - 1 + -0.9529, - -1 + -0.687524, - 1 + 0.393423, - 7 + 0.946512, - -5 + 0.361563, - 1 + 0.197133, - -5 + 0.313557, - 3 + -0.932788, - 3 + -0.342819, - 3 + 0.07439, - -7 + 0.703045, - -5 + -0.37896, - 1 + -0.175719, - 5 + 0.223835, - 5 + -0.516742, - -7 + 0.791386, - -3 + 0.594912, - 3 + 0.917958, - -3 + -0.550284, - 5 + 0.161439, - -1 + 0.308031, - -3 + 0.129603, - -5 + -0.755601, - -5 + -0.0725142, - -3 + 0.900576, - 5 + -0.0439364, - 3 + -0.571107, - -5 + -0.696274, - -7 + -0.101347, - 1 + 0.364593, - -7 + -0.428825, - -7 + 0.723648, - -7 + -0.196055, - 5 + -0.466505, - -3 + 0.906948, - 7 + 0.869376, - -1 + 0.965839, - 3 + -0.279962, - 1 + 0.734883, - 5 + 0.829225, - -3 + 0.931521, - 3 + 0.362365, - -7 + 0.797885, - -7 + 0.497423, - 3 + 0.776487, - 7 + 0.636682, - 1 + 0.285877, - 5 + 0.662518, - 3 + -0.273415, - -3 + -0.609258, - 7 + -0.621225, - 5 + 0.795938, - -1 + 0.330694, - -3 + 0.690014, - 1 + -0.493836, - -7 + 0.308625, - -3 + -0.948984, - -1 + -0.553156, - 1 + -0.561592, - 5 + 0.835248, - 7 + -0.722998, - -3 + -0.147382, - 3 + -0.986829, - 3 + -0.428939, - 7 + -0.486681, - -3 + -0.512164, - -7 + -0.849359, - 1 + 0.169338, - -3 + 0.794093, - 5 + -0.54137, - 5 + -0.526859, - -1 + 0.452928, - 1 + -0.42493, - -1 + 0.121008, - 3 + 0.227603, - -3 + -0.933629, - -7 + -0.176661, - 7 + -0.444884, - 5 + 0.0810715, - 5 + -0.139102, - 7 + -0.726052, - -3 + 0.342913, - 3 + -0.586903, - 7 + 0.619812, - 7 + 0.513767, - 3 + 0.179749, - -5 + 0.28388, - 5 + 0.494988, - 7 + -0.697871, - -1 + 0.320561, - 3 + 0.336703, - -5 + 0.277044, - -5 + 0.637778, - 3 + -0.778878, - -7 + 0.563479, - 5 + 0.933587, - -1 + -0.0155785, - 7 + 0.967945, - 7 + -0.441443, - -1 + 0.476776, - -1 + 0.784109, - 1 + 0.282272, - -3 + 0.120237, - 5 + 0.909491, - 7 + 0.0166548, - 1 + 0.0874624, - 7 + -0.943263, - -7 + 0.404136, - -3 + -0.425458, - 5 + -0.279096, - -7 + 0.297659, - -5 + -0.909941, - -3 + 0.417617, - 3 + 0.541595, - 5 + 0.553146, - -7 + -0.758788, - -3 + 0.810651, - 3 + 0.824127, - 3 + -0.860216, - 1 + -0.301784, - -7 + 0.774392, - -3 + -0.409294, - -1 + -0.233762, - 7 + -0.169785, - -3 + 0.0785076, - 5 + 0.612462, - 3 + -0.436439, - -7 + 0.879343, - 1 + 0.639467, - 1 + 0.052389, - -5 + -0.0166562, - -3 + 0.341038, - 5 + -0.828713, - 3 + 0.794875, - -1 + 0.45125, - -3 + 0.681263, - -5 + 0.420113, - -7 + -0.367513, - -7 + 0.706676, - -3 + -0.494458, - -3 + -0.834332, - -5 + -0.683485, - -1 + -0.0354494, - -5 + -0.604827, - 3 + 0.413222, - -3 + 0.275839, - 1 + 0.456946, - -7 + -0.171177, - -7 + -0.518215, - -7 + 0.0480101, - 3 + -0.543404, - 3 + 0.634555, - 7 + 0.509344, - 5 + 0.032606, - -7 + 0.847702, - -7 + -0.382019, - 1 + -0.893403, - -3 + 0.0839257, - -5 + -0.605519, - 5 + -0.398689, - -1 + 0.777001, - 1 + 0.557634, - 5 + -0.203117, - -7 + 0.388056, - -1 + -0.841352, - 5 + 0.571447, - -1 + 0.540101, - 7 + 0.707744, - 3 + 0.0310338, - -1 + -0.222217, - -3 + 0.878539, - 7 + 0.0656955, - -1 + 0.579365, - -7 + 0.77745, - 5 + -0.330132, - -1 + -0.181327, - 5 + -0.936911, - 7 + -0.28417, - -1 + 0.184943, - 3 + 0.470113, - -3 + -0.668268, - 3 + 0.443922, - -7 + -0.254059, - -5 + -0.998164, - -7 + -0.293805, - -7 + 0.0910158, - 7 + 0.692813, - -1 + -0.0799075, - -7 + 0.721993, - -1 + 0.385094, - 5 + -0.00619203, - 7 + 0.552784, - 1 + -0.596967, - -5 + -0.00704482, - 1 + -0.110811, - 3 + 0.121887, - 3 + 0.674047, - -3 + 0.170743, - 3 + 0.760664, - -3 + 0.42977, - 1 + 0.315997, - 5 + 0.154003, - -3 + 0.369766, - -3 + 0.646692, - -3 + -0.0673465, - 3 + -0.0560396, - -7 + 0.138723, - 7 + -0.0105182, - -7 + -0.742613, - -1 + -0.0661037, - 3 + 0.00532501, - 5 + -0.755478, - -3 + 0.363332, - -7 + -0.299669, - -1 + 0.27668, - 1 + -0.117032, - -1 + -0.0241725, - 3 + 0.0823766, - -7 + -0.207114, - 5 + -0.0581861, - -5 + 0.689536, - -5 + -0.206481, - 3 + -0.457966, - 7 + -0.489086, - -5 + 0.467335, - -3 + -0.360001, - -1 + -0.138445, - -7 + -0.914763, - 7 + 0.588969, - -5 + 0.283839, - -7 + 0.959326, - -7 + -0.67792, - -7 + -0.334574, - 7 + 0.370579, - 7 + -0.171007, - 3 + -0.868796, - -3 + -0.319757, - 3 + -0.879288, - -3 + -0.435152, - 1 + -0.700487, - 5 + -0.313853, - -5 + 0.0436639, - -3 + -0.579779, - -3 + -0.778584, - -5 + -0.789192, - -7 + -0.0165036, - 5 + -0.746662, - 3 + 0.423599, - 1 + -0.896458, - 1 + 0.884175, - -7 + -0.861808, - 1 + 0.0740701, - -7 + 0.338526, - 7 + 0.292062, - 3 + 0.948647, - 3 + -0.473585, - 5 + -0.420246, - 3 + -0.949748, - -3 + -0.593698, - -1 + -0.996076, - 1 + -0.862255, - 7 + 0.137548, - -7 + -0.28388, - 5 + 0.534124, - 5 + 0.434866, - 5 + 0.139012, - 5 + -0.468484, - -7 + 0.740186, - -7 + -0.376626, - -3 + -0.183861, - -1 + 0.669948, - 5 + 0.859722, - 1 + -0.138174, - -5 + -0.573832, - 5 + -0.940617, - 7 + -0.267174, - 7 + -0.3461, - -7 + -0.741914, - -3 + -0.322358, - -5 + 0.718059, - -7 + -0.97611, - -3 + 0.154576, - -1 + -0.183644, - 1 + -0.575116, - -3 + 0.825954, - 3 + -0.751385, - 7 + -0.607166, - -5 + -0.500472, - 7 + 0.882115, - -7 + 0.0493956, - -5 + 0.362625, - -3 + 0.492293, - 5 + 0.389105, - -5 + 0.800949, - 1 + 0.94705, - -7 + -0.377441, - 7 + 0.351678, - 7 + -0.44366, - -1 + 0.320667, - -1 + 0.752543, - 1 + 0.969968, - -7 + 0.0223379, - 5 + -0.91498, - -7 + -0.172866, - -5 + -0.173087, - 5 + 0.996417, - -1 + -0.490241, - -3 + 0.91821, - 7 + -0.563976, - 5 + -0.485962, - -7 + 0.892581, - -3 + -0.460805, - 3 + 0.941525, - 1 + -0.174042, - -3 + 0.838862, - -7 + -0.156077, - -7 + 0.466488, - 1 + -0.724364, - 7 + 0.587571, - 3 + -0.274185, - 5 + -0.514854, - -3 + 0.254629, - 7 + -0.291446, - 5 + -0.0912776, - -3 + -0.54812, - 5 + -0.0964439, - -1 + -0.952324, - -3 + 0.477252, - -5 + -0.75421, - -7 + -0.536212, - 1 + 0.97589, - 1 + -0.534707, - 1 + -0.610279, - -5 + -0.380512, - 3 + -0.213305, - 7 + 0.951862, - 1 + 0.514467, - 3 + -0.52728, - 7 + -0.107415, - -1 + 0.530744, - -7 + -0.780547, - -7 + 0.601507, - -1 + -0.884028, - -5 + 0.295033, - 5 + 0.216542, - -3 + 0.803556, - -5 + 0.408551, - -1 + 0.0640241, - -7 + 0.337687, - -3 + 0.973948, - -7 + -0.112561, - 3 + 0.497891, - -1 + -0.360651, - 1 + 0.429832, - 3 + 0.599578, - -7 + 0.62018, - -5 + 0.00679079, - -7 + 0.214149, - 7 + 0.840447, - -3 + -0.167543, - 5 + 0.0564775, - -7 + 0.824302, - 3 + 0.0793194, - 3 + 0.999321, - -1 + -0.446545, - -3 + 0.703463, - 7 + 0.991686, - -1 + -0.894842, - -7 + -0.011711, - 5 + 0.280148, - -7 + 0.854388, - -7 + -0.187445, - -1 + 0.594443, - -7 + 0.933654, - 1 + 0.297684, - 7 + 0.305794, - 5 + -0.871352, - -5 + -0.415714, - -3 + -0.437484, - -5 + 0.425868, - 3 + 0.413091, - -5 + 0.413299, - 7 + -0.94675, - 1 + 0.403995, - 7 + 0.792962, - -3 + -0.663822, - -1 + 0.782255, - 5 + 0.740358, - 5 + 0.64335, - -3 + -0.677456, - -7 + 0.318753, - 3 + 0.637624, - 5 + 0.716802, - -3 + 0.506525, - -5 + -0.0154431, - 5 + -0.413524, - -3 + -0.97805, - 3 + -0.715193, - -1 + 0.855351, - -3 + -0.547344, - -1 + 0.707832, - -7 + -0.100186, - -3 + 0.1044, - -1 + 0.834975, - 5 + 0.950804, - -3 + -0.146867, - 7 + -0.922332, - -5 + 0.361724, - 1 + -0.376783, - 1 + -0.979652, - -3 + -0.860688, - 7 + -0.0470151, - 7 + -0.29374, - 1 + -0.820914, - -1 + -0.811114, - 5 + -0.585238, - 3 + 0.0997306, - -5 + -0.789875, - 5 + -0.240234, - 5 + -0.795669, - -3 + 0.834812, - -5 + -0.0813862, - 5 + -0.154017, - -5 + 0.414384, - 1 + 0.878358, - -7 + -0.0818945, - 3 + -0.239543, - -3 + -0.203324, - -3 + -0.921207, - 5 + 0.69081, - 1 + -0.727172, - 1 + 0.287061, - 3 + 0.216088, - 1 + -0.47675, - -1 + 0.679726, - -1 + 0.147156, - 3 + 0.785956, - 5 + -0.0128753, - -1 + -0.198679, - 7 + 0.16421, - -7 + -0.41241, - -7 + 0.785757, - 1 + 0.502945, - -3 + -0.611199, - 1 + 0.589565, - -1 + -0.0650551, - -5 + -0.575992, - -3 + -0.744359, - 5 + -0.856259, - -1 + 0.95337, - -7 + 0.285215, - 3 + -0.692112, - 1 + 0.427753, - 5 + -0.771773, - 1 + 0.469569, - -1 + -0.428564, - 7 + 0.465778, - 7 + -0.468184, - 7 + 0.958522, - 1 + -0.129728, - -7 + 0.48096, - 7 + -0.127209, - 7 + -0.725595, - -5 + -0.100204, - -3 + 0.231591, - 7 + 0.54961, - 5 + 0.714396, - -5 + -0.891057, - 7 + 0.0990063, - 5 + -0.0485793, - 5 + 0.350462, - -7 + 0.683771, - 1 + -0.69861, - 1 + 0.0453779, - -1 + -0.609794, - 3 + -0.30366, - -1 + -0.0804034, - -1 + -0.119469, - 3 + 0.0833771, - -1 + 0.365207, - -3 + 0.569098, - 1 + 0.122556, - -3 + 0.383273, - -3 + 0.873332, - 5 + -0.992991, - -5 + -0.888515, - 5 + 0.0792137, - 7 + -0.949043, - -5 + -0.311345, - 1 + 0.129391, - -7 + 0.514229, - -7 + -0.889496, - 1 + -0.188848, - 5 + -0.47186, - -5 + -0.0947434, - -5 + -0.860318, - -5 + 0.240262, - 5 + -0.855161, - -7 + -0.682376, - 5 + -0.268279, - -1 + 0.574063, - -1 + -0.607989, - 3 + 0.563884, - -1 + -0.28172, - 5 + 0.889506, - 3 + 0.961434, - 1 + 0.701135, - -3 + -0.36667, - -7 + -0.665516, - 5 + -0.982884, - -7 + -0.444751, - -3 + -0.0457394, - 1 + 0.686493, - 3 + -0.763344, - -3 + -0.969778, - -5 + 0.557193, - 3 + -0.70817, - -3 + -0.0794386, - 7 + -0.674222, - 1 + 0.776054, - 3 + 0.0315101, - -5 + 0.629314, - -3 + 0.0376186, - -1 + 0.363226, - 7 + -0.829763, - 7 + -0.252856, - 5 + -0.622667, - 3 + -0.409799, - 1 + 0.33154, - 5 + 0.731536, - 7 + 0.702268, - 5 + 0.926338, - 5 + 0.843521, - -3 + -0.505366, - 3 + 0.034738, - 7 + 0.935227, - 3 + -0.633068, - 5 + 0.612473, - 7 + -0.0785781, - 7 + -0.209858, - 3 + -0.519326, - -1 + -0.900059, - 5 + 0.167903, - 7 + -0.237923, - 1 + 0.568017, - -3 + 0.338209, - 1 + -0.262908, - 1 + 0.0486361, - 7 + 0.05413, - 5 + -0.900298, - -1 + 0.13673, - 5 + 0.256166, - 5 + 0.302061, - -5 + 0.399097, - 5 + -0.379186, - -5 + 0.623826, - 5 + -0.436995, - 3 + 0.15716, - -1 + -0.839201, - -5 + -0.0482146, - 5 + -0.580043, - -5 + -0.276397, - -7 + -0.224163, - -7 + 0.569099, - 1 + 0.112961, - 7 + 0.695617, - -5 + -0.985498, - -5 + 0.624633, - -5 + -0.698944, - 1 + 0.290597, - -1 + 0.492301, - 5 + -0.873225, - 5 + 0.517916, - 1 + -0.739614, - -5 + -0.118872, - -7 + 0.429263, - 5 + -0.374059, - -3 + -0.196779, - 5 + 0.845428, - 3 + -0.825515, - 1 + -0.324621, - 3 + -0.321085, - 5 + 0.659568, - -7 + 0.507627, - 3 + -0.762506, - -5 + 0.0177499, - 1 + -0.969493, - 5 + -0.989013, - 7 + 0.639013, - 5 + -0.293451, - -3 + -0.399314, - 3 + -0.164182, - -5 + -0.0115777, - -7 + 0.728109, - 1 + 0.0601385, - -3 + 0.53905, - -3 + 0.557821, - -3 + 0.267226, - 7 + 0.484006, - 3 + -0.462906, - 7 + 0.593879, - 7 + 0.70928, - 3 + 0.783019, - 7 + -0.390819, - 5 + 0.447453, - -1 + -0.327203, - -7 + -0.249398, - -5 + -0.100986, - 1 + -0.155282, - -7 + -0.798511, - -5 + -0.415777, - 1 + 0.971724, - -3 + -0.087326, - 7 + 0.946116, - -7 + -0.681513, - 1 + -0.564743, - 5 + 0.939016, - 3 + -0.437047, - -7 + -0.551414, - -3 + 0.489793, - 5 + -0.535763, - -3 + -0.98994, - 7 + 0.192269, - -5 + 0.802636, - -3 + 0.335588, - -7 + -0.346334, - 7 + 0.710128, - 7 + 0.359396, - 7 + 0.167325, - -1 + -0.359781, - 5 + -0.450043, - -3 + -0.399062, - -1 + 0.220616, - -1 + -0.713507, - 5 + -0.323577, - -3 + -0.324612, - -5 + -0.0478501, - 7 + 0.0652244, - -1 + 0.694262, - -5 + 0.234324, - -1 + 0.684074, - -3 + 0.885926, - -1 + 0.709219, - 7 + -0.403976, - -5 + 0.0613845, - -5 + 0.578585, - 5 + 0.531759, - 5 + -0.823466, - 1 + 0.885001, - -5 + 0.678863, - 1 + 0.235131, - -5 + 0.741793, - -7 + 0.831432, - -3 + 0.524304, - 3 + -0.740704, - 7 + 0.507732, - 3 + -0.0357639, - 7 + 0.863181, - -1 + 0.576264, - 3 + 0.516363, - 3 + -0.764998, - -1 + -0.362159, - -5 + 0.197446, - 3 + -0.446453, - 3 + 0.981725, - 7 + 0.0734841, - 3 + 0.256196, - -3 + -0.77722, - -5 + 0.791577, - -7 + 0.402091, - 7 + 0.553504, - 1 + -0.93853, - -7 + 0.584471, - -3 + -0.437479, - 5 + 0.997935, - -5 + 0.682598, - -7 + 0.641139, - 3 + -0.732735, - -1 + 0.930625, - -7 + -0.488808, - 7 + -0.985779, - 7 + 0.526349, - 1 + 0.412067, - 7 + 0.405549, - 3 + 0.95903, - -3 + 0.304788, - 5 + -0.344784, - 7 + -0.707093, - 7 + 0.508233, - 3 + 0.704947, - 1 + 0.790839, - -7 + -0.789173, - -3 + -0.320104, - -5 + -0.0990607, - -1 + -0.181266, - 3 + 0.413149, - 5 + -0.445842, - 7 + 0.114297, - -1 + -0.0193645, - -3 + -0.630197, - 7 + 0.549956, - 3 + 0.832843, - -1 + 0.709999, - 5 + 0.35154, - -3 + 0.488788, - -1 + -0.367693, - 7 + 0.81898, - 3 + -0.977579, - -7 + 0.677679, - 3 + 0.0798718, - -5 + -0.361776, - -7 + 0.029239, - -3 + 0.752219, - -5 + 0.36909, - -1 + -0.845805, - -5 + 0.552649, - 7 + -0.320622, - 5 + -0.0791636, - -7 + 0.155842, - -5 + -0.383591, - -7 + -0.921708, - 7 + 0.262659, - -5 + -0.311854, - -3 + 0.909658, - 5 + 0.220908, - -5 + -0.24149, - 5 + 0.424055, - -7 + -0.115968, - -1 + -0.837231, - -3 + -0.943953, - -1 + -0.501246, - 3 + -0.30943, - -7 + 0.726022, - 5 + 0.468604, - 7 + -0.536298, - -5 + 0.180367, - -5 + 0.478635, - -5 + -0.983354, - -7 + 0.948823, - 7 + -0.964671, - -7 + 0.83219, - -1 + -0.00482819, - -5 + 0.910779, - 7 + 0.0379913, - 5 + 0.958815, - -7 + 0.37621, - 5 + -0.348852, - 1 + 0.251557, - 5 + 0.421582, - 7 + 0.100173, - -3 + -0.343514, - 7 + 0.866663, - -1 + 0.442026, - 7 + 0.0442502, - 3 + -0.617214, - 1 + -0.743735, - -5 + 0.458965, - 5 + -0.572788, - 5 + 0.040819, - 3 + -0.445056, - 5 + -0.58016, - 5 + 0.386475, - -5 + 0.470098, - 5 + -0.00197146, - 7 + -0.614743, - -7 + 0.632339, - 5 + -0.445174, - -5 + -0.462788, - -5 + 0.994442, - 5 + -0.0414883, - -5 + 0.882532, - 1 + 0.694469, - -5 + -0.36298, - -7 + 0.836014, - 1 + 0.247427, - 5 + -0.623588, - -3 + 0.509161, - 3 + -0.0136789, - -5 + 0.551708, - -5 + 0.714889, - 5 + 0.948555, - 7 + -0.542934, - -3 + 0.284379, - -1 + 0.445103, - 5 + -0.302788, - -3 + 0.782427, - -1 + -0.137974, - -1 + 0.874363, - -3 + -0.450784, - 1 + -0.962429, - -5 + 0.938102, - -7 + -0.879492, - 5 + 0.666352, - -5 + 0.146655, - -3 + 0.505806, - 3 + -0.90168, - 5 + -0.00662362, - -5 + 0.401645, - -5 + 0.516729, - 7 + -0.325518, - 7 + -0.670081, - 3 + -0.898185, - 7 + 0.725776, - -1 + -0.519448, - -1 + 0.101936, - 3 + -0.800607, - 7 + -0.407942, - 7 + -0.249011, - 7 + 0.974777, - -7 + 0.984282, - -1 + 0.177661, - -3 + 0.165499, - -5 + -0.145106, - 1 + 0.092101, - -3 + -0.287475, - -1 + -0.160128, - -5 + 0.20695, - -1 + 0.278086, - 7 + 0.376328, - -7 + 0.854766, - 7 + 0.242705, - -5 + -0.623362, - 1 + -0.755314, - -3 + -0.498729, - -5 + -0.742776, - 3 + -0.17839, - -7 + -0.141452, - -7 + 0.0890251, - 3 + -0.761854, - -7 + 0.316197, - 1 + 0.531921, - -1 + 0.763375, - -7 + 0.398482, - 1 + -0.930327, - -5 + 0.559533, - 3 + -0.782727, - -1 + -0.809251, - -3 + -0.827661, - -7 + -0.790187, - 3 + 0.886559, - 3 + -0.312838, - 7 + -0.205646, - 3 + 0.538917, - -5 + -0.151619, - 7 + -0.498444, - -1 + -0.777891, - -7 + 0.709902, - 5 + -0.842215, - -3 + -0.0873613, - -3 + 0.88423, - 1 + 0.50133, - 5 + 0.87654, - -1 + 0.775389, - -1 + 0.274183, - -7 + -0.1128, - 7 + 0.129837, - 7 + -0.138116, - 7 + 0.697651, - 3 + -0.363404, - 5 + -0.51758, - 5 + 0.276224, - -5 + -0.843988, - 5 + 0.965171, - 5 + -0.433201, - 5 + 0.77057, - 5 + -0.347871, - -1 + -0.337877, - 5 + 0.0192994, - 5 + -0.00149202, - 5 + -0.705596, - -7 + 0.848062, - 3 + -0.780618, - 3 + 0.33526, - -3 + -0.0251735, - 7 + -0.148926, - -1 + -0.655041, - -3 + -0.559493, - -3 + -0.604536, - 3 + -0.0386967, - -3 + 0.830413, - 1 + -0.428, - 5 + -0.0231212, - 7 + -0.199671, - 5 + -0.396984, - -3 + 0.687779, - -7 + -0.126673, - 3 + -0.14281, - 3 + -0.663755, - -1 + 0.590741, - 7 + -0.259138, - -1 + 0.36915, - 7 + -0.193918, - -3 + 0.074994, - 3 + 0.0734893, - 3 + -0.87442, - 5 + -0.277579, - -7 + 0.874191, - 1 + 0.603273, - -1 + -0.933543, - 7 + 0.952655, - 3 + -0.0753299, - -1 + -0.0547395, - 1 + 0.298926, - 7 + 0.89666, - -1 + -0.169361, - -7 + -0.0164988, - -1 + 0.536616, - 3 + 0.123214, - -3 + -0.686119, - -3 + 0.207928, - 1 + 0.690104, - -7 + -0.840309, - -1 + 0.22515, - 5 + -0.848586, - 7 + -0.266778, - -7 + -0.573275, - -1 + 0.792824, - 7 + -0.984161, - -3 + -0.188004, - 5 + -0.461688, - -1 + -0.62303, - 3 + -0.513087, - -1 + -0.0713464, - 7 + -0.4341, - 1 + 0.791935, - -7 + -0.216476, - -5 + -0.472753, - 7 + 0.887405, - 5 + -0.629382, - -1 + 0.960013, - -7 + -0.225607, - 5 + -0.783357, - 3 + 0.238133, - 1 + -0.939504, - 7 + 0.300807, - 7 + 0.714341, - -1 + 0.0662017, - -3 + 0.709742, - -1 + 0.80212, - -5 + 0.78005, - -3 + 0.252241, - -3 + -0.848605, - -7 + -0.928371, - -1 + 0.6205, - 3 + -0.355202, - 3 + -0.884526, - 1 + 0.766157, - 1 + -0.48066, - -5 + 0.148214, - -5 + 0.416083, - 1 + 0.141582, - 3 + 0.954276, - 7 + -0.598539, - 1 + 0.302432, - -7 + -0.302829, - -5 + 0.365095, - -5 + 0.291996, - -7 + -0.853708, - 3 + -0.27352, - 3 + 0.544414, - -1 + -0.459018, - 1 + 0.184556, - 3 + -0.52332, - -1 + -0.191827, - -1 + 0.670293, - 1 + 0.519123, - 5 + 0.841211, - -1 + -0.940759, - -1 + -0.251439, - -1 + 0.695483, - -3 + 0.557767, - -3 + 0.26932, - 1 + 0.0599606, - -5 + -0.731488, - -3 + -0.559606, - -7 + -0.161615, - -7 + -0.269363, - -3 + 0.700813, - -5 + -0.598768, - -3 + 0.805228, - 5 + -0.856961, - -1 + -0.385613, - -3 + -0.323487, - -7 + 0.411967, - -5 + 0.21551, - -7 + 0.010317, - -3 + 0.573196, - 3 + -0.360943, - -1 + 0.564722, - 7 + 0.0449874, - 5 + -0.230872, - -3 + -0.394789, - -3 + 0.992717, - 5 + 0.241152, - -1 + -0.849168, - 5 + 0.828781, - 5 + -0.408953, - -1 + -0.289148, - -1 + 0.222295, - 1 + -0.537086, - 3 + 0.306834, - -1 + -0.585661, - -7 + 0.538775, - 3 + -0.204193, - 7 + -0.77022, - 1 + -0.540422, - -5 + 0.104483, - 3 + 0.0113785, - -3 + 0.358089, - 7 + 0.83108, - 7 + -0.810261, - -1 + 0.0540461, - -1 + 0.87434, - -7 + -0.379698, - 5 + -0.722662, - -7 + -0.587491, - 3 + -0.152501, - 1 + -0.137736, - -1 + 0.137048, - -7 + -0.993715, - -5 + -0.817584, - -7 + 0.192652, - -7 + 0.965716, - 3 + -0.497121, - -3 + -0.583623, - 3 + 0.724106, - 3 + 0.906286, - 3 + 0.369401, - -5 + -0.333858, - -7 + 0.201107, - 1 + -0.481391, - 3 + 0.214079, - 1 + -0.634333, - 3 + 0.32668, - -5 + 0.438198, - 3 + 0.0183425, - -7 + -0.854446, - -3 + -0.749623, - 5 + 0.260525, - -3 + -0.246166, - 7 + -0.256046, - 5 + -0.0506104, - -5 + -0.546944, - -3 + 0.70895, - 7 + 0.671615, - -7 + -0.178744, - -7 + -0.296848, - 3 + -0.786894, - 1 + 0.486466, - 5 + 0.984005, - -3 + 0.755768, - -3 + 0.60431, - -7 + -0.658241, - 7 + -0.99308, - -7 + 0.730603, - 1 + -0.147345, - 3 + -0.914348, - -5 + 0.176437, - -5 + -0.883513, - -5 + -0.746214, - 1 + 0.599807, - -1 + -0.826388, - -1 + -0.231019, - 7 + -0.427187, - 3 + 0.436418, - -5 + -0.0296006, - 3 + 0.342193, - 5 + -0.02255, - -1 + 0.332447, - 1 + 0.627013, - -7 + -0.257934, - -5 + -0.61819, - -7 + 0.660406, - 7 + -0.749068, - -1 + -0.826357, - 7 + 0.259934, - 1 + 0.624619, - -5 + -0.409846, - -7 + 0.175771, - 7 + 0.841248, - -7 + -0.182872, - 7 + 0.728087, - 3 + -0.272224, - -1 + 0.694387, - 1 + 0.87123, - -7 + -0.36121, - -3 + 0.231829, - -3 + -0.288232, - -1 + 0.860921, - 3 + -0.667815, - -1 + -0.9711, - 3 + -0.778314, - 3 + -0.298502, - 7 + 0.460686, - -7 + -0.972103, - 1 + -0.791205, - -7 + -0.527057, - 3 + 0.680872, - 1 + 0.854739, - -7 + -0.673826, - -1 + 0.137268, - -1 + 0.333986, - -1 + 0.901741, - -1 + -0.202348, - -3 + -0.774122, - 1 + 0.589625, - 3 + -0.849021, - 7 + -0.456618, - 5 + 0.567717, - 5 + -0.636284, - 1 + 0.365766, - 1 + -0.511727, - -7 + 0.166757, - 5 + 0.919885, - 1 + -0.642062, - 5 + -0.296797, - -7 + -0.385574, - 7 + 0.591877, - -7 + 0.436025, - 3 + 0.451077, - -1 + -0.716762, - -3 + 0.374155, - 5 + 0.337632, - -7 + 0.723804, - -5 + 0.383933, - -3 + -0.0862489, - 3 + 0.990362, - 5 + 0.133119, - 1 + -0.12971, - 3 + 0.044241, - 3 + -0.964742, - -5 + 0.702827, - -5 + 0.52507, - 7 + 0.813182, - 7 + 0.456129, - -7 + -0.564425, - -3 + 0.681494, - -1 + 0.503007, - 1 + 0.488921, - -5 + -0.978964, - 5 + -0.978504, - -5 + 0.458051, - -7 + 0.0654869, - 3 + -0.245564, - -1 + -0.337528, - -5 + -0.55446, - -5 + 0.273099, - -7 + 0.215733, - 1 + -0.138924, - 7 + -0.219671, - 3 + -0.887201, - -7 + -0.516248, - -5 + -0.396037, - -5 + 0.818756, - 3 + -0.712209, - 7 + -0.282743, - -3 + 0.707385, - 7 + 0.359774, - -5 + -0.845302, - 1 + -0.1686, - -7 + -0.483578, - 1 + 0.720247, - 1 + 0.626128, - 7 + -0.2298, - -7 + -0.491252, - -1 + 0.568972, - 1 + 0.348875, - 5 + -0.21767, - 5 + -0.844788, - -7 + 0.212711, - -5 + -0.728646, - 5 + -0.257998, - -3 + 0.91577, - 3 + -0.356945, - -5 + -0.727851, - 3 + -0.839908, - -5 + -0.87513, - 5 + 0.492427, - 7 + 0.859239, - 5 + 0.63738, - 7 + -0.567552, - 7 + -0.311746, - -5 + -0.293624, - -5 + -0.0892278, - -1 + 0.68692, - -3 + -0.584071, - -7 + -0.368564, - 3 + 0.685985, - 1 + -0.443952, - 5 + -0.799968, - -5 + 0.849293, - 7 + 0.419622, - 7 + -0.719699, - -5 + 0.776349, - 7 + 0.353652, - -3 + -0.957607, - 7 + -0.233657, - -3 + 0.110137, - -5 + -0.825374, - -5 + 0.936229, - 3 + 0.611605, - -5 + 0.598961, - 3 + 0.914424, - -5 + 0.185668, - 1 + -0.506371, - -1 + 0.19368, - -3 + 0.135954, - 5 + 0.0317122, - -3 + 0.926598, - 3 + 0.841409, - -7 + -0.995628, - 7 + -0.516938, - 1 + -0.327213, - -7 + -0.988622, - 7 + 0.0436381, - -1 + -0.736482, - 3 + 0.0252206, - -7 + -0.999107, - 1 + 0.287324, - 3 + -0.710148, - -3 + -0.863982, - 5 + -0.110109, - -1 + -0.382303, - 1 + -0.00955381, - 7 + 0.574434, - 3 + 0.772632, - -3 + 0.427061, - -3 + -0.47615, - 1 + 0.159639, - -1 + 0.0973485, - -7 + 0.670094, - -3 + 0.66009, - 3 + -0.966069, - 5 + 0.729848, - -1 + -0.165828, - -5 + -0.991247, - 3 + -0.796155, - -3 + -0.665567, - 1 + 0.705734, - -3 + -0.0729422, - -5 + 0.569012, - -5 + 0.532164, - -3 + 0.114169, - -3 + -0.79896, - 5 + -0.434429, - 3 + 0.0409003, - 5 + -0.656138, - 1 + 0.80331, - -1 + -0.832592, - 1 + -0.512036, - 5 + 0.821594, - -5 + 0.153262, - -7 + 0.742653, - 7 + 0.775938, - 7 + 0.794682, - -1 + 0.436735, - 1 + 0.232814, - 5 + 0.173647, - -7 + 0.0346826, - -5 + -0.764013, - -3 + 0.414464, - -7 + -0.107918, - -5 + -0.909358, - -3 + -0.855809, - 3 + 0.321112, - -7 + -0.853217, - -1 + 0.240779, - -5 + 0.308181, - -3 + -0.101137, - -3 + 0.0592809, - 1 + -0.475771, - 1 + -0.805118, - 1 + -0.497502, - 1 + 0.0533702, - 1 + 0.256822, - 1 + 0.943496, - 5 + 0.195682, - 3 + 0.84158, - -7 + 0.691885, - 7 + 0.702398, - -5 + -0.0240126, - 3 + 0.0729154, - 1 + 0.683697, - -5 + 0.261411, - 5 + 0.953329, - 5 + -0.728981, - -5 + -0.635009, - 5 + -0.630682, - -7 + 0.122834, - -3 + 0.959923, - -1 + 0.374435, - 1 + 0.720612, - 5 + 0.664998, - 1 + 0.00891615, - -7 + 0.432124, - -3 + 0.0339184, - -1 + -0.257549, - 7 + 0.584476, - -3 + 0.0935045, - -1 + -0.804627, - 1 + -0.992967, - -3 + 0.538947, - 7 + 0.180181, - -5 + -0.90103, - -3 + -0.368599, - 7 + 0.775146, - -3 + -0.990663, - 5 + -0.991429, - 3 + 0.229796, - 3 + 0.933547, - -7 + 0.629628, - 7 + -0.128119, - -3 + 0.993864, - 3 + -0.518632, - 1 + 0.431409, - 5 + 0.162359, - -1 + 0.340156, - 7 + 0.99834, - -1 + -0.37602, - 7 + 0.798388, - -5 + -0.977304, - -1 + -0.714549, - -7 + 0.371461, - -3 + 0.429763, - -5 + -0.176519, - 1 + 0.130875, - 3 + -0.192991, - -3 + 0.926126, - 3 + -0.756796, - -3 + 0.0799201, - -5 + -0.885874, - -5 + -0.922719, - -1 + 0.788957, - 1 + 0.876735, - 1 + 0.505541, - 1 + 0.0568082, - 5 + -0.546276, - -5 + 0.987925, - 1 + 0.559679, - -5 + 0.240393, - 7 + 0.460363, - 5 + 0.194578, - 3 + 0.987203, - 7 + 0.781711, - -7 + -0.0489823, - -1 + -0.776679, - -7 + -0.496617, - 5 + -0.488827, - -3 + -0.501392, - 5 + 0.703741, - 7 + -0.0924905, - 5 + -0.948555, - -3 + -0.508697, - -5 + -0.211705, - -1 + -0.0656021, - 1 + 0.526428, - 3 + 0.977313, - 7 + 0.717488, - 1 + 0.987358, - -1 + -0.492118, - -1 + 0.765235, - 1 + -0.576154, - 3 + 0.52365, - -7 + 0.253303, - 1 + -0.492177, - 5 + 0.865942, - 5 + 0.977195, - 7 + 0.161001, - 5 + -0.907593, - -7 + -0.557902, - -7 + 0.825849, - 7 + -0.120301, - -5 + 0.531996, - 1 + 0.80755, - 7 + 0.969872, - -7 + -0.738685, - -3 + 0.636749, - 1 + -0.655666, - -3 + 0.999979, - 7 + -0.843387, - -3 + 0.693217, - 7 + 0.615595, - -3 + -0.585734, - 5 + -0.349962, - -5 + -0.708827, - 5 + 0.767043, - -3 + -0.561155, - 5 + 0.0547506, - 7 + -0.00058388, - 5 + 0.683614, - -5 + 0.933133, - -7 + -0.705963, - -1 + 0.432718, - -5 + -0.745574, - -1 + 0.578781, - -3 + 0.265256, - -1 + -0.723166, - 3 + -0.609362, - -3 + 0.897704, - -1 + 0.630349, - -5 + 0.582721, - -5 + -0.0955401, - 5 + -0.235266, - -1 + 0.829279, - -5 + -0.824548, - 3 + -0.803079, - 3 + -0.505004, - -1 + -0.492252, - 1 + -0.92866, - 1 + -0.193727, - 7 + 0.855165, - -5 + -0.409258, - 3 + 0.483943, - 5 + -0.711778, - 1 + -0.291856, - -1 + -0.309453, - -1 + -0.961907, - 3 + 0.239915, - 3 + 0.333033, - -5 + -0.520074, - 7 + 0.80808, - 7 + -0.392463, - -5 + -0.268562, - 7 + 0.963694, - -5 + -0.27416, - -3 + 0.136372, - -3 + -0.533467, - 5 + 0.0336407, - 5 + 0.269954, - -1 + 0.481331, - -5 + 0.883264, - -5 + 0.917248, - -5 + 0.841082, - 7 + -0.272449, - -1 + 0.612493, - -7 + -0.0456689, - 3 + -0.468522, - -5 + -0.783857, - -5 + -0.963398, - -7 + 0.0600612, - -3 + 0.80801, - -3 + -0.969476, - -5 + 0.949233, - 7 + -0.954761, - 7 + -0.0774834, - 5 + -0.245508, - 5 + 0.345368, - 3 + -0.476338, - -5 + -0.322511, - -3 + 0.450538, - -7 + -0.678719, - -3 + -0.172123, - -5 + -0.209171, - -3 + -0.420884, - -1 + 0.00383168, - -3 + -0.312955, - -7 + -0.0884187, - -7 + 0.201349, - 5 + -0.601248, - 5 + -0.413319, - 3 + -0.246626, - 5 + 0.977104, - -5 + 0.0133906, - 7 + 0.349431, - 5 + 0.216145, - -1 + -0.529927, - 1 + -0.249291, - 1 + 0.658874, - 7 + 0.43074, - 5 + 0.124815, - 7 + -0.553229, - 1 + 0.116857, - -5 + 0.734356, - -1 + -0.647581, - 5 + -0.323226, - -5 + -0.810003, - -3 + 0.822276, - -1 + -0.591676, - -5 + -0.434047, - 1 + 0.15821, - 7 + 0.165069, - 3 + 0.253866, - 3 + 0.973848, - -7 + 0.713996, - -5 + 0.215808, - -1 + 0.0812883, - -3 + 0.846565, - -5 + -0.947667, - 3 + 0.409641, - 5 + -0.385462, - -3 + 0.787733, - 1 + 0.844418, - 1 + 0.349241, - 5 + -0.586969, - 7 + 0.257519, - 1 + -0.315586, - -1 + -0.327033, - 1 + 0.767669, - -1 + -0.292183, - 3 + 0.389264, - -7 + 0.339534, - -3 + 0.477526, - -3 + 0.11475, - -7 + -0.119439, - 3 + 0.406966, - 5 + 0.419678, - 1 + 0.76062, - -7 + 0.536916, - -7 + -0.510681, - -5 + 0.905296, - 7 + 0.13423, - -5 + 0.748596, - 3 + -0.431882, - 7 + 0.33909, - 3 + 0.341309, - 5 + -0.172616, - -7 + -0.778667, - -5 + -0.984483, - 7 + 0.04289, - -3 + 0.791158, - -1 + -0.606419, - -3 + 0.939034, - 5 + -0.688122, - 7 + -0.0797096, - -3 + -0.176378, - 3 + -0.200208, - -3 + 0.539966, - -5 + 0.55811, - -1 + -0.965644, - -7 + -0.62776, - 3 + -0.327998, - 3 + -0.518732, - 3 + 0.713363, - 5 + 0.082287, - -7 + -0.799949, - 5 + -0.144101, - -7 + -0.416404, - 3 + 0.926589, - -3 + -0.0426248, - -3 + 0.823828, - 3 + -0.899492, - -1 + 0.925421, - -5 + -0.987104, - -3 + -0.667032, - -1 + -0.376583, - -1 + 0.776434, - 5 + 0.838315, - -3 + -0.411202, - -7 + -0.918427, - -5 + 0.627889, - 7 + -0.542975, - -3 + -0.0689918, - -5 + -0.55104, - -5 + 0.829815, - 7 + 0.466128, - -7 + -0.910729, - -3 + 0.587943, - -5 + -0.989778, - 3 + 0.429693, - -5 + 0.363276, - 5 + 0.48865, - -1 + 0.462889, - -1 + 0.933537, - -1 + -0.237365, - 7 + -0.503287, - 3 + 0.898831, - 5 + -0.88925, - 1 + 0.491187, - -3 + 0.819494, - 7 + -0.841093, - 5 + -0.172405, - -3 + 0.296082, - -5 + 0.230588, - 1 + -0.135964, - -7 + -0.24852, - 7 + 0.779819, - 1 + -0.0197039, - 3 + 0.690689, - 5 + 0.201188, - -3 + 0.316178, - 3 + -0.790151, - -3 + 0.353513, - 1 + 0.482168, - -7 + 0.5088, - 5 + -0.619387, - 3 + -0.572638, - -1 + 0.737113, - -3 + -0.330907, - 3 + -0.642647, - 7 + -0.587751, - 7 + 0.705296, - -1 + 0.765705, - -7 + 0.342622, - 1 + -0.443867, - -7 + 0.64285, - 5 + 0.119933, - 1 + 0.146719, - -3 + 0.808331, - 5 + 0.362826, - -5 + 0.649288, - -5 + -0.919914, - 5 + 0.530805, - 7 + 0.836641, - -1 + -0.33567, - 7 + -0.814941, - -3 + 0.521328, - -7 + -0.0633902, - 3 + 0.637973, - 5 + -0.448024, - -7 + 0.529787, - -1 + 0.158647, - 1 + -0.343875, - 5 + 0.862299, - -7 + 0.269423, - -3 + 0.205924, - -3 + 0.543444, - -1 + -0.0442747, - -1 + -0.514346, - -7 + -0.538346, - 5 + -0.134437, - 3 + -0.242908, - -3 + 0.960616, - -3 + 0.613265, - 5 + -0.578398, - 5 + -0.196621, - -1 + 0.99966, - -7 + -0.206926, - -7 + 0.149597, - 1 + -0.618079, - 7 + -0.779085, - 5 + 0.78756, - -3 + -0.461424, - 1 + -0.8271, - 7 + -0.779893, - 1 + -0.034591, - 3 + -0.618594, - 7 + -0.508509, - 3 + 0.858569, - -3 + -0.292217, - -3 + 0.638647, - 7 + 0.429429, - -3 + 0.0850469, - 3 + 0.840684, - -5 + -0.361285, - -1 + -0.0439304, - -5 + -0.464768, - 5 + 0.814776, - -7 + 0.838205, - -1 + 0.932473, - 3 + 0.0800499, - 3 + 0.430625, - -1 + -0.379486, - -5 + 0.566269, - 1 + -0.191075, - 1 + 0.426799, - -3 + -0.865195, - -1 + -0.286844, - -5 + -0.347813, - -1 + 0.254653, - -5 + -0.0217081, - -7 + 0.712565, - -5 + 0.626585, - -3 + 0.407399, - -1 + -0.495544, - 7 + 0.988263, - 5 + 0.752268, - 7 + -0.57751, - 1 + -0.699522, - -3 + -0.559222, - -5 + -0.142211, - -5 + -0.984406, - -7 + 0.478908, - 3 + -0.492842, - -1 + -0.75382, - 1 + 0.00969996, - 1 + -0.893656, - -7 + 0.928332, - 7 + -0.310557, - 3 + -0.203997, - -3 + -0.119623, - -3 + 0.23919, - -5 + 0.89898, - 3 + -0.000236075, - -1 + -0.75715, - 5 + -0.946444, - 5 + 0.830343, - 5 + 0.170209, - -5 + 0.0682683, - 7 + 0.490712, - 3 + 0.0912319, - 7 + -0.939061, - -5 + -0.27871, - 3 + 0.292512, - 3 + 0.7815, - 3 + 0.780423, - 3 + -0.995218, - 1 + -0.971244, - 5 + 0.863878, - 3 + 0.605471, - 1 + 0.615707, - -1 + -0.430001, - 7 + 0.137532, - -7 + 0.420738, - 5 + -0.511889, - -7 + -0.894203, - -1 + -0.442678, - 7 + 0.58245, - -1 + -0.302989, - -7 + 0.046658, - -1 + 0.213312, - -3 + -0.40466, - 3 + 0.119842, - -3 + -0.209236, - 1 + 0.489636, - -1 + 0.0750853, - 1 + -0.138393, - 3 + 0.197677, - 1 + 0.801, - 5 + -0.737093, - 5 + 0.0908536, - -7 + -0.604504, - -5 + 0.56203, - -3 + 0.309546, - 1 + -0.966521, - 5 + 0.977852, - 7 + 0.73063, - -5 + -0.256762, - -3 + -0.431265, - 5 + 0.661912, - -1 + 0.865871, - -3 + 0.10026, - -3 + 0.979883, - -3 + -0.50973, - 7 + -0.387004, - -5 + 0.872216, - -1 + -0.552574, - 3 + -0.00281111, - -5 + -0.433458, - 3 + 0.228333, - -5 + -0.784953, - 5 + 0.571488, - -5 + -0.107047, - 3 + 0.598395, - 7 + -0.209076, - 7 + 0.968037, - -7 + 0.133602, - -3 + 0.197601, - -1 + -0.737348, - -7 + -0.0987225, - -1 + -0.680374, - -5 + 0.902133, - 5 + -0.065214, - 7 + 0.820436, - -1 + -0.994703, - 5 + 0.928257, - 3 + 0.387782, - -1 + -0.867014, - -1 + -0.343716, - -3 + -0.0119044, - 5 + -0.882348, - 3 + -0.349223, - -3 + -0.423901, - -1 + -0.358375, - -7 + 0.877898, - -1 + -0.0346012, - -3 + -0.731243, - 1 + -0.0103546, - -1 + -0.662776, - 1 + 0.486511, - -1 + -0.0129122, - -5 + 0.0121863, - -3 + 0.550817, - -3 + 0.0375324, - 5 + 0.371006, - 5 + -0.111812, - 5 + 0.963243, - 1 + 0.36354, - -3 + -0.0390213, - -7 + -0.512331, - -3 + 0.530897, - -1 + -0.961326, - 1 + -0.128698, - 5 + -0.0345879, - 7 + -0.724934, - -7 + -0.990395, - 7 + -0.0956077, - 5 + 0.998217, - -1 + -0.38503, - -5 + 0.431693, - 3 + -0.322315, - 1 + -0.520076, - -3 + -0.403514, - 3 + -0.638799, - -1 + -0.665616, - -7 + 0.866326, - 7 + -0.314543, - -3 + -0.752403, - 7 + 0.180847, - 7 + -0.924565, - 3 + 0.431162, - -7 + -0.844134, - 5 + -0.621084, - 1 + 0.678683, - 7 + -0.643627, - -1 + 0.464485, - 3 + 0.311484, - 1 + 0.61938, - 1 + -0.362697, - -1 + -0.545854, - -7 + -0.693428, - 3 + -0.162961, - 3 + 0.362332, - -5 + -0.0418496, - -3 + -0.790282, - 1 + -0.362329, - -5 + -0.679632, - -7 + 0.193632, - 7 + 0.169699, - 5 + -0.0276975, - 3 + 0.145423, - 7 + -0.526892, - 7 + 0.23963, - -5 + -0.0191274, - 3 + 0.267953, - 5 + -0.963432, - 7 + 0.72934, - 5 + -0.0415711, - 3 + -0.0615771, - -1 + -0.441843, - 5 + -0.196666, - -5 + 0.656983, - 5 + 0.764159, - -7 + -0.0188419, - -1 + 0.515285, - -5 + 0.77527, - -1 + -0.362528, - 1 + 0.360052, - 3 + 0.134359, - -5 + 0.37625, - 7 + -0.511201, - 7 + -0.846493, - 5 + 0.94168, - 1 + -0.100134, - 5 + -0.157002, - 3 + -0.374631, - -7 + -0.364117, - -1 + -0.142558, - -7 + 0.0265685, - -3 + 0.138828, - -5 + -0.289868, - 1 + 0.664193, - -7 + 0.887828, - 1 + -0.652588, - 3 + -0.527631, - -1 + 0.284251, - -5 + 0.278712, - 1 + -0.105013, - -1 + 0.853542, - 1 + -0.436623, - -5 + -0.867476, - 3 + 0.96232, - 7 + 0.427617, - 3 + -0.501165, - -5 + 0.411637, - 7 + 0.891616, - -7 + 0.664072, - -1 + -0.888475, - 5 + 0.548079, - 3 + 0.503912, - -5 + -0.612317, - -1 + -0.180983, - 1 + -0.239876, - 1 + 0.596635, - -3 + -0.0827705, - -7 + 0.277359, - 5 + -0.941413, - -5 + 0.697875, - 3 + 0.714356, - 1 + -0.558584, - 1 + -0.0174082, - 5 + -0.587225, - -5 + -0.512741, - 7 + -0.434388, - 7 + -0.473811, - -1 + 0.285865, - 5 + 0.988991, - -5 + -0.991867, - -3 + 0.864291, - -5 + 0.661288, - 5 + -0.460111, - 7 + 0.366331, - -7 + 0.784093, - 5 + 0.918848, - 7 + 0.965396, - -3 + -0.161624, - 7 + -0.476323, - -5 + 0.501047, - 7 + 0.964268, - 1 + -0.388995, - -1 + 0.308069, - 7 + 0.449621, - -3 + 0.517261, - -1 + -0.931887, - -3 + -0.314139, - -1 + -0.88269, - 1 + -0.641202, - -7 + 0.426506, - -7 + 0.765908, - 3 + -0.839435, - -1 + 0.85062, - -5 + -0.068266, - 7 + -0.336073, - 5 + -0.552052, - 7 + 0.968225, - 5 + -0.489061, - -1 + 0.549817, - 7 + 0.155363, - 7 + 0.287813, - 5 + -0.0712527, - 7 + -0.539294, - 3 + 0.515963, - -7 + 0.309448, - 5 + -0.400565, - -3 + 0.772515, - -3 + 0.47223, - -5 + -0.377265, - -3 + -0.277457, - 3 + -0.0481647, - 1 + 0.253072, - 7 + -0.701416, - 3 + -0.983524, - -1 + 0.859256, - 3 + 0.684439, - 7 + -0.715583, - 1 + -0.927083, - 5 + -0.820364, - 3 + -0.818987, - -1 + 0.0484889, - -5 + 0.88172, - -1 + 0.642372, - 7 + -0.486761, - 1 + -0.154892, - -3 + 0.620922, - -7 + -0.307461, - -5 + 0.958143, - -5 + -0.945751, - -7 + 0.420205, - 3 + 0.212257, - -7 + 0.343969, - -7 + -0.56883, - -7 + 0.542757, - 1 + 0.338133, - -1 + 0.205287, - 3 + -0.678275, - -3 + 0.162556, - 7 + 0.7356, - -1 + -0.366469, - -5 + 0.818684, - 1 + -0.375059, - -7 + -0.326917, - -1 + 0.21386, - -1 + 0.933421, - -5 + -0.0965871, - -1 + -0.327707, - -3 + -0.293112, - 5 + -0.399372, - -1 + -0.243464, - -1 + -0.477791, - 5 + 0.160018, - 3 + 0.0379489, - -7 + -0.468135, - -5 + -0.924231, - 7 + -0.559268, - -1 + -0.869929, - 1 + 0.644987, - 7 + -0.416144, - -3 + -0.64862, - 1 + 0.0932449, - -1 + -0.941752, - -7 + -0.448205, - 5 + 0.816932, - -1 + -0.010022, - -3 + -0.611324, - 5 + -0.688206, - 1 + 0.868089, - -3 + -0.454031, - 3 + -0.633225, - 5 + -0.11036, - 7 + 0.119173, - -7 + -0.663239, - -7 + 0.86954, - 7 + 0.335132, - -1 + 0.512855, - 1 + -0.130088, - 3 + -0.225548, - 5 + -0.745615, - 7 + 0.963223, - -3 + -0.678778, - -7 + -0.430329, - -3 + 0.964206, - 7 + 0.808534, - 5 + -0.632605, - -5 + -0.728056, - -5 + -0.0283051, - -1 + -0.292853, - 3 + -0.960114, - 1 + 0.266249, - 7 + -0.94076, - 7 + -0.680042, - -1 + 0.678469, - 3 + 0.553279, - 7 + 0.392802, - 1 + -0.308376, - 7 + -0.588163, - 5 + -0.235282, - 7 + -0.490381, - 5 + 0.412499, - -7 + -0.148118, - 7 + -0.20069, - -1 + -0.256974, - 1 + -0.946528, - -5 + -0.190544, - 1 + -0.774484, - -1 + 0.939011, - 3 + 0.401197, - 7 + 0.763682, - -7 + 0.970152, - 5 + -0.471915, - -3 + -0.0230657, - -1 + 0.666549, - 3 + -0.312851, - 5 + 0.909774, - -5 + 0.608703, - -1 + -0.398985, - -1 + -0.579955, - -3 + 0.427466, - -3 + -0.406024, - 5 + -0.923879, - 5 + -0.124516, - -7 + 0.389177, - -1 + 0.978163, - 7 + 0.321733, - -5 + -0.401276, - -3 + -0.669763, - 5 + 0.837051, - -3 + -0.507979, - -5 + 0.650163, - 5 + -0.533125, - -7 + -0.352708, - -3 + 0.975917, - -1 + 0.333199, - 1 + 0.786429, - 7 + 0.588826, - -3 + -0.254794, - -5 + 0.577074, - 3 + -0.445216, - -3 + -0.913091, - 1 + 0.833436, - 3 + 0.879009, - 7 + -0.420452, - -7 + -0.841488, - 3 + 0.941771, - -5 + -0.516194, - 1 + -0.111796, - 1 + 0.913016, - -3 + 0.831405, - 7 + -0.456459, - 5 + 0.52518, - 7 + 0.407003, - 5 + 0.477567, - -1 + 0.420401, - -1 + 0.437449, - -7 + -0.0206778, - -3 + 0.132506, - 3 + -0.0369548, - -3 + -0.66723, - 3 + 0.639026, - -5 + 0.818826, - -3 + 0.521142, - -7 + 0.239988, - 7 + 0.798847, - 3 + 0.568449, - -7 + -0.322325, - 1 + 0.74602, - 5 + -0.820488, - 5 + 0.422569, - -5 + 0.154974, - 3 + -0.598438, - -3 + -0.0493216, - 5 + -0.437171, - -7 + 0.91565, - 1 + -0.76322, - -7 + 0.655683, - 1 + -0.221855, - 3 + 0.499042, - 7 + -0.551781, - -1 + 0.776521, - 3 + 0.364049, - 7 + 0.76778, - 1 + 0.98362, - 1 + 0.901754, - -7 + -0.301171, - -7 + -0.154012, - -3 + -0.967804, - -1 + 0.205987, - 7 + -0.231608, - 1 + 0.577335, - -5 + 0.133768, - -5 + 0.959646, - -3 + -0.0372217, - -3 + 0.404834, - -1 + 0.457923, - 1 + 0.0552233, - -3 + 0.2, - 5 + -0.787169, - -1 + 0.572437, - 7 + -0.18741, - -1 + 0.0523727, - -1 + -0.804208, - 7 + -0.303471, - 7 + 0.73635, - -3 + -0.804122, - 1 + 0.962955, - 7 + 0.065147, - -7 + -0.464851, - 7 + 0.410402, - -1 + -0.213138, - 7 + 0.323269, - 5 + -0.812589, - 1 + -0.924136, - 3 + -0.0515391, - 5 + -0.942719, - -7 + 0.0813437, - -5 + -0.919358, - -3 + 0.09817, - -3 + 0.204768, - -3 + 0.895305, - -5 + 0.426145, - -1 + -0.654514, - 1 + -0.527968, - 1 + -0.93447, - 7 + -0.259295, - -5 + -0.357566, - -3 + 0.820761, - 3 + 0.061946, - 1 + -0.365104, - -1 + -0.484186, - 5 + -0.0747202, - 7 + 0.373292, - 3 + -0.225615, - 1 + 0.387072, - -1 + 0.0964885, - 5 + 0.318965, - -5 + -0.574407, - -1 + -0.5876, - 3 + -0.0651205, - -7 + -0.131517, - -5 + -0.700999, - -1 + 0.431009, - -5 + -0.378572, - -5 + -0.438665, - 3 + -0.0663064, - -1 + 0.303877, - 7 + 0.252822, - -5 + 0.127981, - -5 + -0.979741, - -7 + -0.977809, - 1 + -0.939208, - -5 + -0.619289, - -3 + -0.817288, - -7 + -0.682975, - 5 + 0.945473, - 3 + 0.696275, - -1 + 0.466816, - 3 + -0.632966, - -3 + 0.078222, - 5 + 0.546507, - -1 + 0.977089, - 7 + -0.133295, - -5 + -0.604371, - -3 + 0.365631, - -3 + 0.673212, - -1 + 0.180141, - 5 + 0.223484, - -1 + 0.146777, - 1 + -0.319683, - -1 + 0.857262, - 5 + -0.356152, - 5 + -0.598653, - 1 + 0.975409, - -5 + -0.881246, - -7 + -0.472377, - -3 + 0.0214979, - 7 + -0.788032, - 7 + -0.333508, - 7 + -0.750094, - -3 + -0.814424, - 7 + -0.965833, - 5 + -0.36787, - 3 + -0.612635, - -5 + 0.236003, - -5 + -0.785485, - -5 + 0.745934, - 3 + 0.841095, - 3 + 0.331357, - 3 + -0.341722, - 1 + 0.0449292, - 7 + -0.256584, - -3 + -0.666529, - 7 + -0.203782, - 1 + -0.442113, - 5 + 0.281735, - -7 + -0.600958, - 5 + -0.297631, - 7 + 0.834514, - 1 + -0.965433, - -7 + 0.980322, - -5 + -0.275104, - -5 + 0.501189, - 1 + 0.861033, - 3 + -0.186388, - -7 + -0.783021, - -3 + -0.331772, - -7 + -0.923864, - 7 + 0.981171, - -7 + 0.677146, - 5 + -0.764622, - 7 + 0.544671, - 3 + -0.149741, - -1 + -0.115158, - 5 + 0.315554, - 3 + -0.0435786, - -7 + -0.198421, - 3 + 0.728623, - 3 + 0.917598, - -7 + -0.222429, - -1 + -0.839337, - 1 + -0.837996, - 5 + 0.7184, - 3 + 0.279682, - 5 + 0.89931, - 1 + -0.0903269, - -3 + 0.311248, - -3 + -0.0615842, - -5 + 0.978228, - 5 + -0.0288547, - -7 + -0.319235, - 1 + 0.459872, - -7 + -0.762583, - 1 + 0.430673, - 7 + -0.202576, - 7 + -0.508028, - 5 + -0.563939, - 7 + 0.431253, - 3 + 0.924691, - -7 + -0.929823, - -7 + -0.745149, - -3 + -0.54763, - 7 + -0.233056, - -3 + 0.0728049, - 3 + 0.173541, - 5 + -0.99085, - -5 + -0.509606, - -7 + -0.0573629, - -5 + 0.146235, - 7 + -0.530049, - 5 + -0.92378, - 5 + -0.150627, - 7 + -0.632136, - 3 + -0.544558, - -1 + -0.559563, - -5 + -0.183858, - -3 + -0.0823922, - 3 + -0.845123, - -5 + 0.740183, - -1 + -0.864943, - -7 + -0.517753, - -7 + 0.273158, - -7 + 0.597718, - 7 + -0.960088, - -1 + 0.628689, - 5 + -0.100486, - 5 + -0.28978, - -3 + 0.591832, - 5 + -0.225949, - 1 + 0.434438, - 3 + 0.701275, - -5 + -0.110868, - 3 + -0.993528, - -1 + -0.279674, - -7 + -0.695508, - 3 + 0.208776, - 5 + 0.280286, - -7 + 0.098819, - 1 + -0.270841, - -3 + 0.163315, - 7 + -0.339504, - -1 + 0.503129, - -5 + -0.42331, - -5 + 0.289597, - 5 + -0.48842, - -1 + -0.301035, - -7 + 0.307344, - 3 + 0.149469, - -7 + -0.91815, - -7 + 0.735915, - -7 + 0.651662, - -5 + -0.367747, - 3 + 0.571618, - 3 + -0.0886024, - 7 + -0.287501, - 3 + -0.332199, - -3 + 0.103811, - 1 + 0.281067, - 1 + -0.380718, - -1 + 0.343006, - -7 + -0.940098, - -3 + 0.722196, - 5 + 0.874495, - 1 + 0.990522, - 3 + -0.915597, - -5 + -0.278943, - -7 + 0.203699, - -5 + 0.170043, - 7 + 0.536621, - -5 + 0.824829, - 5 + -0.832656, - -7 + 0.333, - -3 + -0.667407, - 7 + 0.105231, - 7 + -0.905234, - -1 + -0.810245, - 3 + 0.294136, - -1 + -0.514902, - 3 + -0.2467, - 3 + -0.587121, - 3 + 0.60538, - -3 + 0.0694657, - -5 + 0.0962229, - 7 + -0.291999, - -5 + 0.450209, - 3 + -0.147034, - -1 + -0.0838816, - 3 + 0.112086, - -5 + 0.194085, - 5 + -0.0903105, - -7 + -0.919954, - -5 + -0.967825, - -1 + -0.441373, - 5 + 0.768526, - 5 + 0.38484, - 3 + -0.947454, - 5 + -0.262922, - 7 + -0.593716, - -3 + 0.219333, - 3 + 0.076773, - 7 + 0.192425, - 1 + 0.970687, - 7 + -0.00340885, - 3 + -0.199764, - -3 + 0.255666, - -5 + 0.439951, - 1 + 0.505418, - 3 + -0.356007, - 5 + -0.318271, - -3 + 0.788047, - 5 + -0.924415, - -1 + 0.394691, - 1 + 0.972997, - 1 + 0.357046, - 3 + 0.419342, - -5 + -0.774465, - -7 + 0.0996104, - 5 + -0.458399, - -3 + -0.133173, - -1 + -0.671463, - 7 + -0.916153, - -7 + 0.110461, - 3 + 0.409689, - -3 + -0.355372, - -5 + -0.896134, - -7 + -0.950039, - 7 + 0.386037, - 3 + -0.798405, - -3 + -0.744455, - 1 + -0.572819, - -1 + 0.839239, - -3 + 0.570676, - 3 + -0.835377, - -7 + 0.034378, - 5 + 0.724415, - 5 + -0.252927, - -3 + 0.287315, - -3 + 0.334237, - 5 + -0.118203, - -1 + 0.502825, - -5 + -0.154511, - 5 + -0.127665, - 7 + 0.0817964, - 1 + 0.132329, - -5 + -0.546248, - -3 + 0.874254, - -3 + 0.421468, - 3 + -0.928829, - 5 + 0.620968, - 7 + 0.0580643, - -7 + -0.687253, - -7 + -0.628005, - 5 + -0.883083, - -5 + -0.270135, - 1 + -0.623219, - -7 + 0.277921, - 3 + 0.116588, - -5 + 0.264649, - -1 + -0.593871, - -7 + 0.329278, - -1 + -0.0926952, - -1 + 0.64349, - 1 + -0.10689, - 3 + -0.541441, - 1 + 0.499186, - -3 + 0.920398, - -1 + 0.381933, - 5 + -0.518618, - -5 + 0.618314, - 1 + 0.110954, - -1 + 0.576074, - 3 + 0.45385, - -5 + -0.917242, - 5 + -0.451152, - 5 + -0.705703, - -5 + -0.97524, - -5 + -0.732996, - 5 + 0.702813, - 3 + -0.229341, - 7 + -0.13257, - 7 + 0.994484, - 7 + -0.0231948, - 5 + 0.538224, - 1 + -0.838791, - 7 + 0.848763, - -7 + -0.539283, - -3 + 0.321736, - 5 + 0.22943, - 1 + -0.626804, - 5 + 0.209983, - -5 + 0.977037, - 3 + 0.448198, - 5 + -0.419565, - 7 + 0.666147, - -7 + 0.412532, - 7 + -0.0260039, - 1 + 0.545681, - 1 + 0.657399, - -5 + 0.275525, - 5 + 0.563082, - 1 + 0.88785, - -5 + 0.855898, - -1 + -0.758617, - -1 + 0.0505126, - 5 + 0.0387102, - 5 + 0.574784, - 1 + 0.1487, - 7 + -0.234118, - -1 + 0.458783, - 5 + -0.798949, - -7 + -0.300432, - 3 + -0.455072, - 1 + 0.24667, - -3 + 0.034758, - 1 + -0.491485, - 1 + 0.27987, - -5 + -0.92334, - 1 + 0.486993, - 5 + -0.624284, - -3 + 0.259474, - 3 + 0.384827, - 7 + -0.744943, - 3 + 0.669036, - -7 + -0.171024, - 1 + -0.963747, - -3 + -0.457945, - -1 + -0.271542, - 3 + -0.642662, - 5 + 0.867933, - -7 + 0.872486, - -5 + -0.0610653, - -3 + 0.0567537, - -5 + -0.384634, - -1 + -0.810843, - 1 + -0.210336, - 7 + -0.782186, - -3 + 0.206301, - 3 + -0.532726, - -1 + 0.792476, - 1 + -0.0254994, - 1 + -0.38317, - 5 + -0.444631, - -3 + 0.202259, - 7 + 0.906256, - -5 + -0.283238, - 1 + 0.761982, - -1 + 0.456456, - 7 + -0.213898, - 7 + -0.98443, - -7 + -0.984132, - -3 + -0.549083, - 7 + 0.946917, - 1 + -0.817794, - 3 + -0.902041, - -7 + 0.667457, - 7 + 0.476978, - -1 + 0.864841, - -1 + -0.100561, - -1 + 0.589944, - 1 + -0.417731, - -5 + -0.291668, - 3 + -0.341364, - 1 + -0.116372, - -5 + -0.678389, - 5 + -0.621016, - -7 + -0.557662, - 5 + -0.916104, - 1 + 0.416737, - -3 + -0.397013, - 3 + -0.767577, - 1 + 0.340769, - 7 + -0.54333, - -5 + 0.825698, - -7 + -0.0227328, - 1 + 0.688705, - -5 + 0.783876, - -5 + 0.36354, - 3 + -0.405894, - -1 + -0.505203, - 3 + -0.280375, - -7 + -0.0717587, - -5 + 0.254936, - -5 + -0.792482, - 7 + -0.425804, - 3 + 0.295604, - -5 + 0.294844, - -3 + 0.730185, - 3 + 0.0271969, - 5 + -0.303161, - -3 + 0.883759, - 3 + 0.827756, - -7 + 0.450664, - 5 + 0.435759, - 3 + 0.360285, - -7 + 0.409698, - 1 + 0.230758, - 7 + -0.352144, - 1 + -0.389721, - 7 + -0.718911, - 3 + 0.41957, - -3 + 0.620353, - -7 + 0.254944, - -1 + 0.81995, - 3 + -0.280774, - 3 + 0.906947, - 7 + -0.349169, - -1 + -0.00793728, - -5 + -0.64104, - -7 + 0.445183, - 3 + 0.914473, - 3 + -0.570084, - -1 + 0.594879, - -5 + -0.521969, - 1 + 0.0416743, - -3 + -0.799298, - 5 + -0.041766, - -7 + -0.218755, - 1 + 0.173665, - 7 + -0.880771, - -7 + 0.339146, - -1 + 0.961946, - 1 + 0.859441, - -5 + 0.0599979, - -3 + -0.243646, - 1 + 0.642304, - 5 + 0.427633, - -3 + 0.337803, - 5 + -0.876868, - -5 + 0.124084, - 7 + -0.390476, - 5 + -0.889517, - 7 + -0.0881519, - -5 + -0.985327, - -1 + 0.364205, - -1 + 0.481156, - 1 + 0.878136, - 3 + 0.270873, - -1 + -0.133771, - 7 + -0.599314, - 7 + 0.784159, - 1 + 0.555296, - 7 + -0.974226, - 5 + 0.520163, - -5 + 0.046348, - -5 + -0.487602, - 3 + 0.0383354, - -7 + -0.969134, - 5 + -0.00830264, - 5 + 0.582434, - -5 + 0.498667, - -5 + 0.0475678, - 7 + -0.011481, - -5 + 0.0134767, - 1 + 0.897857, - -1 + 0.859261, - 3 + -0.741447, - -5 + 0.61813, - 3 + 0.976057, - -5 + 0.671342, - -1 + -0.480269, - -7 + -0.183415, - 3 + -0.955847, - 3 + 0.770801, - -3 + 0.470981, - -7 + -0.778816, - 3 + -0.906343, - -1 + -0.727997, - 7 + -0.39431, - 7 + 0.80919, - 7 + -0.973433, - -3 + -0.627311, - 3 + 0.373299, - 5 + 0.907636, - -5 + 0.658848, - 7 + 0.681815, - 5 + 0.589045, - -5 + 0.0950571, - -7 + 0.112081, - 5 + 0.34511, - -3 + 0.315859, - 5 + -0.181386, - -3 + -0.714938, - 1 + 0.308135, - 7 + 0.535557, - 7 + -0.0709868, - -1 + 0.552407, - -7 + -0.847801, - 7 + 0.160415, - 5 + -0.51117, - 3 + -0.951139, - -3 + 0.0406191, - 5 + -0.895575, - 5 + 0.0746354, - -3 + 0.915248, - -3 + 0.842174, - -7 + 0.595946, - 3 + 0.700337, - -3 + -0.23779, - 3 + -0.655733, - -5 + -0.894634, - -3 + -0.695807, - 5 + -0.476673, - 7 + -0.279169, - -5 + 0.507948, - -5 + 0.499507, - 3 + 0.0916842, - 3 + -0.837399, - -5 + 0.143527, - 3 + 0.58052, - -7 + 0.378768, - 5 + 0.811361, - -1 + 0.0748057, - 3 + 0.453959, - -7 + 0.990606, - 3 + -0.450379, - 5 + 0.395584, - -7 + -0.114441, - 5 + 0.426232, - 1 + -0.711673, - 1 + 0.077825, - -5 + -0.584918, - 1 + -0.457057, - -3 + -0.366392, - -7 + 0.00484131, - -3 + 0.215838, - -3 + -0.19239, - -5 + 0.300349, - 5 + 0.925702, - 7 + 0.693147, - -3 + -0.771327, - 7 + 0.850479, - 7 + 0.55379, - -5 + -0.622361, - -7 + -0.797468, - -1 + 0.865325, - -1 + 0.594149, - -3 + 0.402537, - 3 + 0.5647, - -5 + 0.408661, - 7 + 0.434393, - -5 + 0.369053, - 7 + 0.193313, - 7 + 0.0768285, - -5 + -0.966767, - 7 + 0.316068, - 5 + 0.393416, - -1 + 0.678055, - -1 + -0.426397, - 7 + -0.0972791, - 5 + 0.863534, - 7 + 0.857534, - 3 + -0.591288, - -1 + -0.978807, - -5 + 0.47735, - 1 + -0.387742, - 7 + 0.418231, - -7 + -0.918646, - 3 + -0.487032, - -7 + 0.169229, - 5 + 0.963037, - 3 + -0.651308, - 1 + -0.963926, - -7 + -0.870113, - -1 + -0.598625, - 1 + 0.578904, - -1 + -0.0948276, - -5 + 0.227649, - 1 + 0.555606, - -1 + -0.668322, - 1 + 0.0749024, - -5 + -0.607571, - 5 + -0.349931, - -1 + -0.898107, - 5 + 0.312465, - 7 + 0.772347, - 5 + 0.0899041, - -1 + -0.741034, - -3 + 0.26158, - 1 + -0.539694, - 7 + -0.115106, - -1 + -0.411724, - 3 + 0.0316011, - -7 + -0.810337, - -5 + 0.181813, - 5 + 0.318575, - -5 + -0.176396, - -1 + -0.639559, - 1 + 0.966577, - 7 + -0.685124, - -3 + -0.036449, - -5 + -0.456288, - -1 + 0.80942, - 1 + -0.842449, - -7 + 0.390273, - 3 + -0.931459, - 5 + 0.693488, - -7 + 0.247743, - -3 + -0.848713, - -3 + 0.137249, - -7 + -0.213185, - -7 + -0.755191, - 7 + -0.639001, - 5 + 0.91416, - 5 + -0.193425, - -5 + 0.80731, - -1 + -0.716912, - 5 + -0.503475, - 5 + -0.0585372, - 5 + -0.0209306, - 5 + -0.150028, - -3 + 0.634776, - 5 + 0.538764, - 7 + 0.704398, - -1 + -0.61061, - -7 + -0.624288, - 1 + -0.926651, - -7 + 0.580724, - 3 + 0.24162, - 1 + 0.447202, - 7 + -0.76537, - 7 + -0.753749, - 7 + -0.93289, - 7 + 0.570568, - -1 + 0.901893, - -1 + -0.297356, - 5 + -0.189813, - -3 + 0.21001, - -3 + 0.541859, - -5 + -0.73421, - 7 + 0.928552, - -7 + -0.355678, - -5 + -0.221657, - -5 + -0.0512875, - 3 + -0.298442, - -1 + -0.820576, - 7 + -0.771328, - 1 + -0.961217, - 5 + -0.161851, - -1 + -0.405209, - 3 + -0.662432, - -3 + 0.528404, - 1 + -0.226934, - -3 + 0.0363932, - 7 + 0.886687, - 3 + 0.393918, - -5 + -0.507128, - 1 + -0.189558, - -7 + -0.823271, - 7 + -0.180617, - -1 + 0.321553, - -1 + 0.989206, - -7 + -0.874277, - 1 + -0.113906, - 7 + 0.161257, - 3 + 0.670416, - -3 + -0.763578, - -1 + 0.424893, - 3 + -0.0447045, - -5 + -0.957789, - -1 + 0.196626, - -5 + 0.00535004, - 3 + 0.254757, - -7 + -0.927024, - 3 + -0.959979, - 1 + -0.949363, - -5 + 0.674222, - 1 + -0.848884, - -7 + 0.0919615, - 1 + -0.58394, - -1 + -0.515551, - -7 + -0.961024, - 7 + -0.978422, - 7 + 0.86705, - 7 + -0.323448, - -5 + -0.916549, - -3 + -0.512443, - -3 + -0.892435, - -1 + 0.0811992, - 7 + -0.1951, - 1 + -0.31832, - 7 + 0.389861, - -7 + -0.429737, - 7 + 0.14079, - -7 + -0.306634, - 1 + -0.0533624, - 1 + -0.438584, - -7 + -0.63111, - -7 + -0.559344, - -5 + 0.783094, - -7 + -0.735777, - 7 + -0.58636, - -7 + -0.116192, - -5 + -0.801831, - -5 + 0.969511, - -5 + 0.144718, - -5 + 0.363059, - -1 + -0.667404, - 3 + -0.134134, - -1 + 0.734085, - 5 + -0.165216, - 1 + 0.149468, - -5 + -0.15301, - -3 + 0.83035, - -3 + -0.27281, - -1 + 0.688733, - 5 + -0.406828, - -5 + -0.018298, - 5 + 0.219722, - -5 + 0.840822, - -7 + 0.256695, - -1 + -0.300632, - -5 + 0.403999, - -5 + 0.574885, - -3 + -0.92988, - 1 + -0.837794, - 3 + 0.510347, - 1 + 0.946242, - 1 + -0.558269, - 7 + -0.945935, - -7 + -0.106771, - 3 + -0.383966, - -5 + 0.370004, - -7 + 0.428693, - 5 + 0.936122, - 1 + -0.782085, - -7 + 0.528864, - 1 + 0.697761, - -7 + -0.681381, - -5 + 0.152231, - 5 + -0.900638, - 5 + -0.334353, - 1 + 0.862458, - -5 + -0.694343, - -7 + -0.938721, - -5 + 0.119729, - -7 + -0.874769, - -5 + -0.120494, - -3 + 0.506938, - 5 + 0.965172, - -1 + -0.888394, - -3 + -0.595798, - -5 + 0.802503, - -3 + -0.789257, - -3 + 0.351862, - 3 + -0.750966, - -1 + 0.584273, - -3 + -0.0831131, - -7 + -0.28384, - -3 + 0.806411, - 7 + -0.200101, - 3 + 0.640918, - -1 + 0.977479, - 1 + 0.865009, - -3 + -0.368203, - 7 + 0.556652, - -1 + -0.991885, - -5 + 0.332904, - 3 + 0.470344, - -7 + 0.205081, - -7 + -0.314842, - -3 + -0.62, - 3 + 0.34363, - 1 + -0.425907, - -7 + -0.702084, - -3 + -0.288143, - -7 + 0.243932, - -1 + 0.0855131, - -5 + -0.139345, - 3 + -0.959163, - 3 + 0.431497, - -7 + 0.261823, - -3 + 0.914225, - -1 + 0.325961, - 3 + -0.359881, - 7 + -0.468639, - 7 + -0.803865, - -1 + 0.343444, - 1 + 0.736499, - 5 + 0.382909, - -1 + -0.721058, - -1 + -0.823382, - 3 + -0.176144, - 5 + 0.251272, - -1 + -0.786581, - -5 + 0.273133, - 7 + -0.41622, - 3 + 0.121719, - 7 + 0.620911, - -1 + 0.237504, - 1 + -0.335624, - -7 + 0.42324, - -3 + 0.729575, - -7 + -0.723781, - 3 + 0.273075, - 3 + -0.229695, - 3 + 0.507748, - -5 + 0.294614, - -7 + -0.490011, - 3 + 0.297713, - -3 + -0.330685, - -7 + 0.441233, - 5 + -0.622061, - 5 + -0.208099, - 5 + -0.710362, - -1 + 0.154774, - -5 + 0.486696, - 5 + -0.168477, - 7 + -0.653855, - 7 + -0.0172002, - -1 + -0.1059, - 3 + 0.654305, - 1 + -0.459053, - 7 + 0.751362, - 7 + 0.407269, - 7 + 0.871658, - 7 + 0.654213, - 7 + 0.0624889, - 7 + -0.583527, - 1 + -0.252231, - 1 + -0.320237, - 5 + -0.0136125, - 7 + -0.729181, - -5 + -0.0353086, - 5 + -0.0951113, - 3 + -0.0836304, - -1 + -0.11923, - 7 + 0.962136, - -5 + -0.830669, - 1 + 0.29644, - 5 + 0.045498, - 1 + 0.76292, - -5 + -0.929796, - 5 + -0.083544, - -7 + 0.472663, - 7 + -0.746787, - 3 + 0.662228, - -5 + -0.41748, - -7 + 0.850784, - -7 + -0.130054, - -1 + 0.432904, - 7 + -0.787268, - -3 + -0.248262, - 5 + 0.406222, - 5 + -0.775207, - 7 + -0.0549824, - -1 + 0.930082, - -3 + 0.651628, - -7 + -0.373963, - 7 + -0.38767, - -5 + -0.199335, - 3 + -0.0845591, - -3 + -0.400573, - -1 + -0.423932, - 3 + 0.496079, - 3 + -0.0049753, - 5 + -0.937373, - -1 + 0.00805519, - 7 + -0.387026, - -7 + 0.379173, - 3 + -0.509631, - -3 + 0.0652572, - -7 + 0.292195, - -3 + -0.0630124, - -3 + 0.210706, - -7 + 0.0474516, - -3 + 0.088253, - 5 + -0.729131, - -1 + -0.118407, - 5 + 0.587638, - -7 + 0.963741, - -3 + 0.912494, - -7 + 0.723939, - 5 + 0.977461, - 3 + 0.230908, - -7 + 0.0875093, - -5 + 0.827526, - 7 + -0.821136, - -3 + 0.402932, - -7 + 0.441547, - 7 + 0.416953, - 5 + 0.70044, - 3 + 0.973559, - 3 + 0.407091, - -5 + -0.826277, - 3 + -0.389221, - 5 + -0.583906, - 1 + -0.0841909, - -7 + 0.530444, - -1 + -0.918261, - 3 + -0.638232, - 1 + -0.776938, - -7 + 0.706762, - -1 + 0.16429, - -7 + -0.306863, - -3 + -0.670615, - 1 + -0.819745, - 1 + -0.014878, - -3 + 0.178679, - 1 + 0.441678, - -1 + -0.193108, - -3 + -0.33399, - 5 + 0.275276, - -7 + 0.167054, - -5 + 0.134306, - 7 + -0.394252, - 3 + 0.941986, - -7 + -0.878877, - -5 + 0.770656, - -5 + 0.730814, - -1 + 0.143592, - -3 + 0.442492, - -1 + -0.712593, - 5 + 0.599122, - 1 + 0.263907, - -7 + 0.47737, - -7 + 0.0559669, - -3 + 0.208639, - 1 + 0.827161, - 1 + 0.886639, - 1 + 0.598246, - -7 + -0.191541, - 3 + 0.511962, - 3 + -0.645528, - 1 + -0.593154, - -5 + 0.52999, - 5 + -0.653963, - 1 + 0.574099, - -5 + -0.0896155, - 1 + -0.636268, - 7 + 0.343794, - -7 + 0.155548, - -1 + -0.121609, - -1 + -0.297629, - -5 + -0.468962, - 5 + -0.555227, - -1 + -0.296793, - -3 + -0.855934, - 7 + -0.739775, - 1 + -0.756048, - 1 + -0.46236, - -7 + -0.179736, - 3 + 0.125628, - 1 + 0.10038, - -5 + -0.380856, - 7 + 0.450066, - 7 + 0.959734, - -3 + 0.796831, - -1 + 0.23315, - -3 + 0.298099, - -5 + -0.383893, - -3 + -0.296636, - -5 + 0.138614, - 1 + -0.114746, - 7 + 0.555051, - 1 + -0.950471, - -1 + 0.124465, - 1 + 0.037862, - 1 + 0.719934, - 7 + -0.0167727, - -7 + -0.983453, - -5 + -0.418557, - 7 + -0.192828, - 7 + -0.0814223, - 1 + 0.224621, - 5 + -0.597524, - 5 + 0.415634, - 1 + -0.954608, - -3 + 0.227498, - -5 + -0.108549, - 7 + 0.0881721, - 3 + 0.845206, - 3 + -0.913562, - -7 + 0.24586, - -7 + 0.289418, - -1 + 0.194941, - 3 + 0.793157, - 7 + -0.434518, - -7 + 0.820917, - 5 + 0.2382, - 5 + -0.946464, - 1 + 0.686291, - 3 + -0.265611, - -1 + -0.215793, - 1 + 0.247293, - 3 + 0.370775, - -1 + -0.1934, - 5 + 0.306202, - 5 + -0.454743, - -1 + -0.529622, - 1 + 0.856026, - -5 + -0.672594, - -5 + -0.429688, - 7 + -0.898493, - 3 + -0.296784, - -7 + -0.839249, - 7 + -0.238149, - -3 + 0.87197, - 7 + -0.985437, - -3 + 0.243879, - 1 + -0.0590569, - -7 + 0.3087, - -7 + -0.415904, - -3 + 0.238146, - -3 + -0.00380364, - 7 + -0.524692, - -1 + 0.715206, - -1 + -0.382632, - 7 + -0.433315, - -3 + 0.671116, - 5 + 0.319951, - -5 + -0.467809, - 1 + -0.914862, - -1 + -0.848039, - -7 + 0.916399, - -3 + 0.158824, - -7 + 0.432194, - 5 + 0.939947, - -3 + -0.938313, - -1 + 0.111712, - 1 + -0.830159, - -1 + 0.269145, - -3 + -0.282773, - -7 + 0.397815, - -7 + 0.312644, - 7 + 0.101858, - 5 + 0.398991, - 7 + 0.931748, - 5 + -0.216404, - 5 + -0.739909, - -3 + 0.837449, - 5 + -0.292918, - 3 + -0.811216, - 3 + -0.54535, - 3 + -0.206546, - 7 + 0.287012, - 5 + 0.416343, - -7 + 0.226965, - 3 + 0.650639, - 7 + -0.513567, - 3 + 0.35494, - 7 + 0.251297, - 3 + 0.222854, - -3 + 0.631017, - 1 + -0.834925, - -5 + 0.302606, - 5 + -0.161238, - -1 + -0.717755, - -1 + 0.163733, - 7 + 0.683634, - -3 + -0.0890416, - 5 + -0.0241376, - -7 + -0.331885, - -1 + -0.566607, - 5 + -0.0680727, - -1 + 0.69374, - -5 + -0.441671, - 3 + -0.917287, - 5 + -0.447226, - 5 + 0.530121, - 3 + -0.393156, - 7 + -0.625747, - 1 + 0.660945, - 1 + 0.0093144, - 7 + -0.198812, - 5 + 0.442133, - 1 + -0.569587, - -1 + 0.969233, - -3 + 0.831887, - 7 + -0.129281, - -5 + 0.790104, - -3 + -0.329582, - 3 + -0.846209, - 5 + 0.921283, - 5 + 0.0625507, - -3 + 0.292014, - -5 + 0.833173, - -7 + -0.674783, - -3 + -0.846611, - 1 + 0.893338, - -7 + 0.983207, - -7 + -0.776993, - -7 + 0.250987, - -5 + 0.0683537, - 7 + -0.183423, - 1 + -0.0923144, - 3 + 0.316882, - 3 + 0.436083, - -1 + 0.561959, - 5 + 0.199397, - 3 + 0.998894, - -5 + -0.762317, - 1 + -0.264652, - -1 + 0.000935957, - -5 + -0.737429, - 5 + -0.449802, - -3 + -0.153005, - -7 + -0.825486, - -3 + 0.381528, - -3 + -0.834704, - 1 + -0.869081, - -5 + 0.658949, - -7 + 0.538412, - 1 + -0.274676, - -3 + -0.131948, - -5 + -0.89239, - 5 + -0.216419, - 5 + 0.0464617, - -5 + -0.202859, - -5 + 0.937449, - 5 + 0.424624, - 1 + 0.22882, - 7 + 0.683182, - 1 + -0.649762, - 3 + -0.764787, - 7 + -0.573145, - -5 + 0.304541, - 3 + 0.3929, - -7 + -0.210616, - -3 + 0.373165, - -7 + -0.21229, - -7 + 0.897832, - -7 + 0.909656, - 1 + 0.948898, - 3 + -0.42523, - 3 + 0.567772, - -3 + -0.527982, - 3 + -0.189502, - 5 + 0.970517, - 7 + 0.282051, - -3 + 0.430664, - 3 + -0.793949, - -7 + 0.545716, - -3 + 0.35154, - -3 + -0.821351, - 5 + -0.395689, - -5 + -0.620034, - 5 + -0.608408, - -3 + 0.94029, - -1 + 0.0666049, - 5 + -0.51607, - 1 + 0.991041, - 7 + 0.172753, - 5 + -0.0221328, - 5 + -0.193889, - -5 + -0.13076, - 3 + 0.138734, - 3 + 0.59089, - 3 + -0.887206, - -3 + 0.845891, - -1 + -0.347074, - 5 + -0.0834612, - 3 + -0.876824, - -1 + -0.810422, - -1 + -0.231434, - 1 + -0.239487, - -5 + 0.0323537, - 1 + -0.581238, - 5 + 0.00602403, - 5 + 0.0905542, - 3 + 0.498012, - -5 + 0.254225, - 3 + 0.314102, - 5 + 0.0299345, - 5 + -0.45939, - -1 + 0.448653, - -3 + 0.647585, - 1 + 0.318478, - 5 + 0.455767, - -1 + 0.133022, - 1 + 0.614847, - 1 + 0.120892, - -5 + 0.224634, - 5 + 0.132055, - -1 + 0.743952, - -5 + 0.425553, - 5 + -0.111105, - 1 + 0.174118, - 1 + 0.221772, - -7 + -0.845315, - -3 + 0.19196, - 7 + -0.840461, - 5 + -0.129635, - 1 + -0.596764, - 3 + -0.955832, - 1 + 0.585824, - 5 + 0.0742671, - 5 + -0.517633, - -1 + 0.48289, - 7 + 0.0644312, - 1 + -0.795109, - -7 + -0.782286, - -1 + 0.0230929, - 1 + -0.718512, - -1 + 0.764088, - 5 + 0.510258, - -5 + 0.657883, - -7 + -0.345766, - -3 + 0.430414, - 5 + 0.0833478, - -5 + -0.264892, - 3 + 0.710985, - 1 + 0.150336, - 5 + -0.861506, - 3 + -0.0429562, - -1 + 0.434927, - 7 + 0.815823, - -5 + -0.824405, - 7 + -0.262346, - -7 + -0.164051, - -5 + -0.646918, - 3 + -0.147091, - 3 + 0.13859, - -1 + -0.575533, - -3 + 0.103353, - -5 + 0.992246, - -1 + -0.611302, - 7 + -0.0318776, - 1 + 0.460203, - -3 + 0.548152, - -7 + 0.0172631, - -3 + -0.485489, - -7 + -0.980713, - -7 + -0.827265, - -1 + -0.864176, - -7 + 0.851271, - 7 + -0.466744, - -7 + 0.436088, - -3 + 0.576107, - -7 + -0.637538, - 7 + 0.655137, - 5 + -0.826798, - -5 + 0.848056, - 3 + 0.666798, - -1 + -0.180115, - 7 + 0.419637, - 5 + -0.0167801, - 3 + -0.68837, - 3 + 0.946745, - 3 + -0.0950071, - -7 + -0.827281, - -1 + 0.78343, - -5 + -0.582113, - 7 + 0.299523, - 1 + -0.488113, - 5 + -0.341736, - 7 + 0.530617, - 7 + -0.326339, - -7 + -0.817531, - -3 + -0.221869, - -5 + 0.416757, - 1 + 0.506333, - 1 + -0.2654, - 7 + 0.763487, - -5 + -0.943085, - 7 + 0.791527, - -5 + 0.0668543, - -7 + 0.938847, - -3 + 0.143887, - -3 + 0.381707, - -3 + 0.19505, - -3 + -0.920517, - -5 + 0.145063, - -5 + 0.237513, - -7 + -0.120207, - -7 + -0.0991134, - -5 + 0.0680013, - 1 + -0.0638738, - 5 + 0.970159, - 5 + 0.213576, - 1 + -0.263613, - -7 + -0.544301, - -5 + -0.828692, - -5 + 0.166918, - -5 + -0.761728, - 5 + 0.120694, - 5 + 0.903705, - -5 + 0.211521, - 3 + 0.290967, - 7 + -0.464751, - -7 + 0.186847, - 7 + 0.32524, - -7 + 0.111797, - 1 + -0.788556, - 1 + -0.14745, - -3 + -0.968889, - 3 + -0.37981, - 5 + 0.00729347, - 7 + 0.504821, - 1 + -0.961113, - 3 + 0.710415, - -5 + -0.613475, - 5 + -0.895771, - -1 + -0.895503, - 5 + -0.461719, - 5 + 0.0161815, - -5 + -0.24625, - -7 + -0.572922, - -1 + -0.459816, - 7 + -0.419624, - -5 + 0.696952, - -5 + 0.927165, - -5 + 0.243638, - 7 + 0.360799, - 3 + 0.347879, - -3 + -0.0232377, - 3 + 0.712201, - -1 + 0.759489, - -7 + 0.438561, - -7 + -0.572822, - 1 + -0.737766, - 3 + 0.0680258, - -1 + 0.686509, - 5 + -0.262713, - -5 + -0.79966, - 5 + -0.236232, - -7 + -0.0260004, - -7 + 0.218216, - -3 + 0.370607, - 3 + 0.816354, - 7 + 0.452291, - -3 + -0.822625, - 3 + 0.848817, - 7 + 0.365835, - 1 + -0.676283, - 1 + -0.0594598, - -5 + 0.521534, - 1 + -0.486592, - 7 + -0.986362, - -7 + 0.0779941, - -3 + -0.08751, - 7 + -0.491647, - 7 + -0.270531, - -1 + -0.204778, - 1 + -0.231377, - -7 + -0.469895, - -1 + -0.844354, - -7 + -0.264911, - -1 + -0.1599, - -7 + -0.44972, - -1 + 0.194789, - 1 + -0.104809, - 3 + -0.228419, - -7 + -0.803297, - -7 + 0.625464, - -1 + -0.352292, - -1 + -0.755153, - -1 + -0.67635, - 7 + 0.297913, - 5 + 0.57017, - 5 + -0.173484, - 5 + 0.668881, - 1 + 0.277459, - -3 + -0.784868, - 5 + -0.499577, - 3 + -0.10745, - 7 + 0.92074, - -3 + -0.987991, - 7 + 0.915782, - 3 + -0.98239, - 1 + -0.781632, - -5 + 0.853114, - 5 + -0.13405, - -5 + 0.870097, - 7 + -0.696323, - 7 + -0.94934, - -3 + -0.398685, - -7 + 0.869119, - -5 + -0.903581, - -7 + 0.131423, - -3 + 0.834563, - 7 + 0.143985, - 3 + 0.145958, - -3 + 0.536994, - -5 + -0.691582, - 5 + 0.556042, - 7 + -0.58014, - -5 + -0.103551, - -1 + 0.15221, - 3 + -0.757364, - -5 + 0.580815, - 5 + 0.852026, - -7 + -0.470408, - -3 + 0.0561844, - 5 + -0.515549, - 1 + 0.173103, - -3 + -0.168945, - 5 + -0.762956, - -3 + 0.793081, - -1 + -0.676991, - 3 + 0.665824, - 5 + 0.121066, - -5 + 0.731384, - -5 + 0.671191, - -7 + -0.175862, - -7 + 0.486734, - 5 + 0.163906, - -3 + -0.529629, - -3 + -0.741516, - -5 + 0.780671, - -7 + -0.230291, - -3 + 0.302234, - 7 + -0.987584, - -7 + 0.429419, - 7 + -0.123349, - -3 + -0.693596, - 1 + 0.156304, - -7 + -0.070418, - -5 + 0.939389, - 3 + -0.282077, - 7 + -0.461724, - -7 + -0.266467, - -3 + 0.973726, - 5 + 0.324534, - 1 + 0.798357, - -3 + -0.225007, - -3 + 0.326469, - 1 + 0.217389, - -7 + 0.771884, - 1 + -0.448262, - 1 + 0.834186, - 5 + -0.8447, - 7 + 0.265382, - 7 + 0.882236, - 7 + 0.951853, - 3 + -0.212489, - 7 + -0.900493, - -1 + 0.827988, - 5 + -0.96957, - 5 + -0.794382, - 1 + -0.360357, - -7 + 0.686111, - -5 + -0.770717, - -3 + 0.777591, - 1 + -0.164214, - -1 + 0.85202, - -1 + -0.838606, - 5 + 0.727194, - 3 + 0.628267, - 3 + 0.94657, - 3 + 0.664833, - -1 + -0.545169, - 1 + -0.791937, - 5 + -0.863989, - 1 + -0.433051, - 7 + 0.604505, - -5 + 0.469176, - 5 + 0.521661, - 5 + -0.652277, - 5 + -0.956757, - -1 + 0.179364, - 3 + 0.0835185, - 5 + 0.379708, - -5 + -0.00418501, - -3 + 0.802623, - -1 + 0.127959, - 3 + 0.740128, - 7 + 0.0877058, - -3 + -0.644691, - -7 + 0.803557, - -3 + 0.35763, - 7 + -0.896354, - 5 + -0.985988, - -5 + -0.475576, - -7 + -0.837911, - -5 + 0.399102, - -1 + 0.180557, - 7 + -0.257409, - -3 + 0.748304, - 1 + 0.488153, - 1 + -0.528074, - -7 + -0.568786, - -1 + -0.209861, - 7 + 0.758874, - -7 + 0.690599, - -5 + 0.29666, - -7 + 0.14263, - -5 + -0.580595, - -5 + 0.436222, - -7 + -0.230854, - 1 + -0.0199466, - 7 + 0.0582533, - 1 + -0.241347, - -7 + 0.120772, - -5 + 0.158568, - -7 + 0.590528, - 1 + 0.26066, - 7 + 0.696681, - -3 + 0.343628, - -1 + -0.341235, - -1 + 0.426748, - -5 + -0.39029, - -3 + 0.0793041, - -1 + 0.240872, - -7 + -0.986816, - 5 + -0.546091, - 7 + -0.435825, - -5 + 0.631116, - 5 + 0.793044, - -3 + -0.219459, - 7 + 0.140597, - 5 + 0.447243, - 1 + -0.968491, - 5 + 0.843524, - -5 + -0.860415, - 5 + -0.620946, - 1 + -0.41902, - 7 + -0.81125, - 5 + 0.753432, - -3 + -0.727435, - -1 + -0.141588, - -3 + -0.551413, - -5 + 0.381663, - 5 + -0.0711982, - -5 + 0.390526, - 1 + 0.783724, - -7 + 0.573399, - -3 + -0.939007, - -7 + 0.238314, - -1 + -0.521158, - 5 + 0.779281, - -7 + -0.53298, - 3 + 0.21555, - 3 + 0.482487, - 7 + -0.514751, - -1 + -0.800237, - 1 + -0.764197, - -3 + 0.647617, - 7 + 0.0499004, - -5 + 0.979748, - -3 + 0.67735, - -7 + 0.183253, - -5 + 0.362151, - 5 + -0.545888, - 3 + 0.771438, - -3 + 0.255733, - -7 + 0.115492, - 3 + 0.469995, - -1 + 0.129762, - 3 + -0.767167, - -1 + 0.59735, - -7 + 0.999858, - -5 + -0.412252, - -5 + -0.240744, - -7 + -0.94988, - 7 + -0.533656, - 3 + 0.842152, - 5 + -0.0103345, - 7 + 0.0454008, - 3 + 0.333439, - 3 + -0.456548, - -3 + -0.295064, - 1 + -0.0291067, - 3 + -0.980701, - 5 + 0.0998633, - -7 + -0.236756, - -1 + -0.209321, - 3 + -0.238139, - -1 + 0.873939, - 3 + -0.723713, - -5 + 0.814455, - 3 + 0.679885, - -5 + -0.309287, - 1 + 0.911921, - -5 + -0.330781, - 5 + 0.780826, - 1 + 0.715838, - 3 + -0.334343, - -1 + 0.986761, - -1 + -0.439617, - -3 + -0.590452, - 1 + -0.263775, - 7 + 0.667562, - -5 + -0.76034, - -5 + 0.362745, - 1 + -0.472352, - -7 + 0.206034, - -3 + 0.376895, - 5 + 0.551758, - -3 + 0.0431443, - 5 + -0.310862, - -3 + -0.430074, - 5 + 0.275111, - 7 + -0.912242, - 5 + -0.535872, - 3 + 0.320622, - 3 + 0.381784, - 5 + 0.39575, - -5 + 0.419947, - -1 + 0.632249, - 7 + 0.699329, - 5 + -0.53677, - -7 + 0.160241, - 5 + -0.293807, - -5 + 0.291076, - -5 + 0.691705, - 1 + 0.759055, - 3 + -0.907042, - -5 + -0.23742, - -1 + -0.718808, - -3 + 0.324324, - -5 + 0.768603, - -1 + -0.765854, - 3 + -0.270759, - -3 + -0.780064, - 7 + 0.530695, - 5 + -0.923683, - -1 + -0.209208, - 5 + -0.3521, - 7 + -0.81082, - 7 + -0.472168, - 7 + 0.56371, - 5 + -0.87698, - 3 + -0.0658053, - -3 + 0.646983, - 1 + -0.603423, - 7 + 0.458566, - 7 + 0.32752, - -7 + 0.852152, - 1 + 0.996179, - -1 + 0.686456, - -3 + -0.484814, - 5 + -0.675017, - 5 + -0.458211, - 3 + -0.984357, - -1 + 0.266912, - -7 + -0.589247, - -5 + 0.082882, - -5 + -0.885084, - -3 + -0.560765, - 5 + -0.942018, - 7 + 0.572901, - 7 + -0.171902, - -3 + 0.895929, - -7 + -0.655681, - 5 + -0.029179, - 1 + -0.978318, - 1 + -0.0494022, - -3 + 0.315903, - -7 + -0.249841, - 7 + -0.960858, - -3 + 0.444645, - 3 + -0.725221, - -1 + -0.250617, - 5 + 0.072717, - 3 + -0.348692, - -7 + 0.465731, - 7 + 0.770554, - -1 + 0.161133, - 3 + 0.0440529, - -1 + -0.245592, - -1 + -0.286838, - 1 + 0.710223, - 7 + -0.744359, - -7 + 0.754745, - -3 + 0.268595, - -7 + -0.952184, - 5 + -0.12754, - 1 + -0.113531, - 3 + -0.965244, - 3 + -0.295564, - 5 + -0.589246, - -5 + 0.901493, - 7 + 0.499927, - -1 + 0.205479, - -1 + 0.799496, - 7 + 0.159986, - 1 + 0.0494691, - 5 + 0.414586, - 1 + 0.160234, - 5 + -0.754135, - 7 + 0.533292, - 3 + 0.20959, - -3 + 0.265984, - -1 + -0.596171, - -3 + 0.59227, - -5 + 0.809165, - -3 + 0.731077, - -5 + 0.77249, - -3 + 0.114624, - 7 + -0.612689, - -3 + -0.226237, - -1 + -0.491637, - 5 + -0.902752, - 7 + -0.340862, - 7 + -0.764615, - 1 + 0.361337, - 5 + 0.907293, - -1 + -0.207671, - -7 + 0.749045, - 7 + -0.736116, - 7 + 0.331618, - -5 + -0.0821605, - 3 + -0.784978, - 3 + -0.962937, - 5 + 0.0240877, - -7 + -0.357058, - 7 + 0.582812, - -1 + 0.300038, - 3 + 0.442207, - 1 + 0.311886, - 1 + -0.0907658, - -3 + -0.190202, - 3 + 0.752307, - -5 + 0.110897, - -3 + -0.130689, - 3 + 0.604778, - -5 + 0.832513, - -5 + 0.20769, - 1 + 0.918947, - 7 + 0.635097, - -3 + -0.250696, - -5 + -0.673562, - -7 + 0.188827, - -7 + 0.859836, - -5 + -0.553663, - -1 + -0.693482, - -3 + -0.0370091, - -5 + -0.945403, - -3 + -0.0942642, - 5 + -0.788987, - 7 + 0.130865, - -3 + -0.0568169, - 1 + 0.469934, - -3 + 0.236228, - -3 + 0.969961, - -7 + 0.777844, - -1 + -0.863909, - 1 + -0.0100366, - 3 + -0.901984, - 7 + -0.188674, - -3 + -0.0859814, - -7 + 0.289988, - -5 + 0.216434, - 5 + 0.373371, - -3 + 0.756403, - -3 + -0.327696, - -1 + 0.500791, - 5 + 0.577182, - 1 + 0.846249, - 7 + -0.851769, - -7 + 0.957447, - -3 + -0.351796, - -1 + -0.985339, - -7 + -0.840053, - 7 + -0.911335, - 3 + 0.856743, - 3 + -0.901107, - 3 + -0.966849, - 7 + -0.885129, - -5 + -0.284155, - 7 + -0.344691, - -5 + 0.355503, - 7 + 0.752017, - 5 + -0.243656, - 3 + -0.928544, - 5 + 0.782105, - -7 + -0.759649, - 1 + -0.0744518, - -3 + 0.609258, - 5 + -0.125631, - 5 + 0.25112, - -7 + -0.339128, - 7 + 0.412046, - -5 + 0.555857, - 7 + -0.635087, - 7 + 0.516426, - -1 + 0.74659, - 3 + 0.969918, - -1 + 0.436694, - -5 + 0.0135384, - -3 + 0.340553, - 1 + -0.333334, - 5 + -0.401135, - 3 + 0.217065, - 5 + -0.585701, - 7 + 0.283774, - 1 + 0.436392, - 7 + 0.636664, - 5 + -0.0233952, - 5 + 0.966634, - -5 + 0.792896, - 5 + 0.946402, - -1 + -0.831078, - -7 + -0.944117, - 7 + 0.832928, - -3 + -0.37542, - -7 + -0.951767, - -7 + -0.414159, - 3 + -0.440777, - 5 + -0.591346, - -3 + -0.942129, - 1 + -0.475855, - -1 + -0.452418, - -7 + 0.0502203, - -1 + -0.715986, - 5 + -0.39207, - -1 + 0.00692897, - 1 + -0.305166, - -3 + -0.469096, - -1 + 0.214434, - -7 + 0.0882326, - -7 + -0.311931, - 7 + 0.289892, - 5 + 0.529032, - -3 + 0.543897, - -7 + 0.734108, - 5 + 0.760244, - 7 + -0.921361, - -7 + -0.499923, - 5 + 0.932586, - 3 + -0.492252, - -5 + 0.29961, - 3 + 0.40997, - 1 + 0.607012, - -1 + 0.0977883, - 7 + -0.666918, - 1 + 0.092606, - -3 + 0.48582, - -7 + -0.413194, - -1 + 0.657655, - 7 + -0.790176, - 3 + -0.79396, - 5 + -0.401432, - 3 + 0.241941, - -7 + -0.0372352, - 1 + -0.422785, - -7 + 0.412112, - 3 + -0.649941, - 5 + -0.885332, - -1 + 0.918587, - 5 + 0.580861, - 5 + -0.56943, - 7 + -0.313623, - 1 + 0.508329, - -7 + -0.311971, - -1 + 0.384163, - 7 + -0.407872, - 5 + 0.252608, - -5 + -0.748733, - 7 + -0.766854, - 7 + 0.963027, - 7 + 0.370056, - 7 + 0.91614, - 5 + -0.10655, - 5 + 0.114024, - 3 + 0.6354, - -3 + 0.526766, - -3 + 0.0656808, - -1 + 0.273656, - 3 + -0.518891, - 5 + 0.602608, - -3 + 0.14799, - -5 + -0.304276, - 5 + 0.282315, - -5 + 0.525241, - 3 + 0.917138, - 1 + -0.407829, - 1 + 0.148744, - 7 + 0.374387, - 1 + 0.719541, - 5 + -0.845279, - -7 + -0.271885, - -3 + 0.498453, - -3 + -0.108517, - 7 + -0.916167, - 1 + -0.00524844, - 3 + 0.230628, - 1 + 0.928817, - 5 + 0.961846, - 3 + -0.970376, - -5 + -0.991187, - 1 + -0.988078, - -3 + -0.321644, - 7 + 0.299365, - -1 + 0.260651, - -5 + 0.901838, - -7 + 0.905185, - -7 + -0.998068, - -1 + -0.717301, - 3 + -0.448447, - -5 + 0.853505, - 1 + 0.691012, - -5 + 0.858187, - -7 + 0.744305, - -1 + -0.546463, - -5 + 0.0513083, - -5 + 0.113148, - 1 + 0.753596, - -1 + 0.453985, - 1 + -0.558975, - -3 + -0.931769, - -7 + -0.421414, - -7 + -0.61578, - 3 + -0.601418, - -1 + 0.384031, - 1 + 0.180447, - -1 + 0.160505, - 7 + -0.14269, - 3 + 0.553436, - 3 + 0.842422, - -1 + -0.298941, - -3 + -0.704512, - 1 + -0.817883, - -5 + 0.689056, - 3 + 0.54275, - -7 + -0.244876, - -7 + 0.497505, - -3 + -0.385801, - -7 + -0.228079, - 1 + 0.607185, - 7 + -0.625709, - 5 + -0.851795, - -3 + 0.657661, - 7 + 0.568546, - 1 + -0.0359739, - 1 + 0.836243, - 1 + -0.747603, - -5 + 0.463366, - 7 + -0.62775, - -5 + -0.129517, - 7 + -0.0784853, - -5 + -0.338617, - 1 + -0.0951821, - -3 + -0.0586496, - 1 + 0.548171, - -5 + -0.142791, - 1 + -0.137619, - -5 + 0.86615, - 3 + 0.337578, - -7 + -0.0597365, - -5 + -0.843939, - -3 + -0.607342, - -1 + -0.630138, - -3 + -0.393534, - 7 + 0.354908, - -5 + 0.184251, - 5 + -0.154522, - -5 + 0.828516, - 5 + 0.817169, - -5 + 0.833938, - -5 + 0.689288, - 5 + -0.995259, - -1 + -0.932191, - -7 + 0.964076, - 1 + -0.85304, - -3 + -0.0782913, - 7 + -0.696813, - 5 + 0.231297, - 7 + 0.688421, - 7 + 0.0322752, - 1 + 0.839409, - 1 + -0.362455, - -3 + 0.561378, - 3 + -0.496498, - 1 + 0.841212, - -7 + -0.299443, - 7 + 0.527505, - -1 + 0.51827, - 5 + -0.348049, - -3 + -0.983604, - -1 + 0.694304, - 1 + -0.31786, - -3 + 0.643969, - -1 + -0.650723, - -7 + -0.14479, - -3 + 0.455813, - 7 + -0.627596, - -3 + -0.245695, - -5 + 0.0893783, - 3 + -0.236629, - 5 + -0.277597, - 7 + 0.481512, - -7 + 0.143052, - 3 + 0.615401, - 7 + -0.975698, - -1 + 0.50143, - -3 + 0.0737497, - 1 + 0.345961, - -1 + 0.944933, - -1 + 0.00710848, - 3 + -0.908855, - 3 + -0.104037, - -1 + -0.0996714, - -1 + 0.480154, - -5 + -0.684452, - -3 + -0.104955, - -1 + -0.972497, - 5 + 0.619405, - -5 + -0.361996, - 1 + -0.780079, - -7 + 0.443635, - 7 + 0.527956, - -1 + 0.927314, - 3 + 0.606136, - 3 + -0.22611, - 1 + -0.288871, - -3 + 0.683856, - 5 + 0.486252, - -7 + -0.781706, - 5 + 0.348522, - -7 + -0.743252, - 5 + 0.790582, - -1 + -0.417564, - 1 + 0.971814, - 1 + -0.394633, - 3 + -0.538042, - 7 + -0.82342, - -5 + 0.46215, - -3 + -0.725289, - -1 + -0.248699, - 3 + 0.194388, - -1 + 0.572686, - -1 + 0.57203, - -1 + -0.73258, - 3 + -0.841193, - 3 + 0.846292, - 7 + -0.106951, - -1 + -0.82125, - 5 + -0.565781, - -7 + -0.178221, - 3 + -0.396988, - -1 + -0.194377, - -7 + -0.184276, - 3 + 0.530178, - -1 + 0.0792818, - 3 + 0.698151, - 7 + 0.540132, - 5 + -0.0324876, - -5 + -0.539282, - 1 + -0.0612176, - 1 + -0.00825787, - -5 + -0.594088, - 5 + -0.720534, - -3 + -0.726017, - 3 + -0.247803, - -5 + -0.0351876, - -3 + -0.485217, - 7 + -0.711281, - 1 + -0.143779, - 5 + 0.830104, - -1 + -0.680937, - -5 + -0.406956, - -7 + -0.572693, - 1 + -0.916711, - -7 + -0.361021, - 5 + -0.669143, - -7 + 0.0977001, - -1 + -0.351618, - -3 + -0.292778, - -3 + 0.94385, - -5 + 0.64688, - -5 + 0.462901, - -7 + 0.139473, - 5 + -0.923586, - -7 + 0.100025, - 7 + 0.762592, - 5 + -0.669251, - -5 + 0.552417, - 3 + 0.578362, - -3 + 0.286511, - -5 + -0.819517, - 5 + -0.174663, - 1 + 0.898405, - -3 + 0.276757, - -5 + -0.860502, - -3 + -0.508774, - -7 + -0.619703, - -1 + -0.576515, - 7 + 0.442863, - 1 + -0.792524, - 1 + -0.967062, - -7 + 0.495375, - -7 + -0.497338, - -5 + -0.649645, - -1 + -0.692724, - -7 + -0.681675, - 5 + 0.80008, - -1 + -0.476369, - -3 + 0.102149, - -3 + -0.595665, - -5 + -0.961165, - 7 + -0.990363, - -5 + 0.716457, - -7 + -0.404208, - -1 + -0.483432, - 1 + 0.236347, - -1 + 0.376305, - 1 + -0.0533286, - -7 + -0.610223, - 3 + 0.843043, - -1 + -0.609047, - 1 + 0.725496, - -1 + -0.31617, - -5 + -0.0189003, - -3 + -0.425178, - -7 + -0.321938, - 3 + 0.0120751, - -1 + 0.315381, - -3 + -0.324733, - -3 + -0.571329, - 5 + -0.30955, - 3 + -0.997293, - 3 + 0.105692, - 1 + 0.0166829, - -7 + 0.295209, - -5 + 0.0396503, - -7 + -0.698527, - 1 + -0.983116, - 7 + 0.659054, - -1 + 0.33142, - -7 + -0.0377453, - -5 + -0.0574753, - -1 + 0.852526, - -1 + 0.983994, - -5 + 0.938022, - 1 + 0.513438, - 3 + 0.0546758, - -5 + 0.0823434, - -7 + 0.166195, - -3 + -0.852176, - 1 + 0.366113, - 1 + -0.397224, - -7 + 0.665549, - 1 + -0.0446258, - 3 + 0.702024, - 5 + -0.733169, - -1 + -0.0454769, - -7 + -0.668073, - 1 + 0.27592, - 7 + -0.323333, - 5 + -0.674522, - 7 + 0.0814798, - 7 + -0.782666, - 3 + -0.0710991, - 5 + 0.773968, - -1 + 0.803732, - -1 + 0.142462, - -3 + -0.243322, - -3 + -0.958958, - 5 + 0.308394, - 7 + -0.500096, - -7 + 0.914925, - 7 + 0.150591, - -5 + 0.58597, - 7 + 0.251341, - -3 + -0.636188, - 7 + 0.909046, - 3 + -0.577617, - -7 + -0.903661, - 7 + -0.275888, - 1 + -0.21705, - -5 + 0.736324, - -1 + -0.820161, - -1 + -0.545268, - 3 + -0.0618935, - 7 + -0.126791, - 1 + -0.792842, - -7 + -0.398747, - 3 + -0.583208, - -5 + -0.325178, - 7 + -0.0370357, - -5 + -0.083306, - 5 + 0.819585, - -7 + 0.0991425, - -3 + -0.130402, - -5 + -0.157376, - 7 + 0.691842, - 5 + -0.748137, - -1 + 0.758925, - 1 + -0.312916, - 3 + -0.820843, - 7 + -0.261816, - 7 + -0.172358, - 7 + 0.536986, - 7 + 0.759576, - 7 + -0.754446, - -7 + 0.567095, - -1 + -0.524981, - -3 + -0.802519, - -3 + 0.3109, - 3 + -0.248219, - 5 + 0.0748601, - 7 + 0.960564, - 1 + 0.667926, - -7 + -0.706296, - -3 + 0.635725, - 7 + 0.978146, - -1 + -0.574543, - 5 + -0.430696, - 1 + 0.0996064, - 1 + -0.00163434, - 3 + 0.14937, - 3 + -0.0844981, - 3 + -0.136261, - 5 + 0.973049, - 3 + 0.282247, - 7 + 0.579739, - 5 + -0.0823847, - 5 + -0.0467881, - 5 + 0.596636, - -1 + -0.297972, - -5 + 0.706257, - -7 + 0.604586, - -3 + 0.0669439, - -1 + -0.453354, - 5 + -0.477196, - 5 + 0.311931, - 5 + 0.166079, - 3 + 0.412152, - 7 + 0.474994, - 5 + -0.771076, - 5 + 0.536177, - -5 + -0.0305953, - -3 + 0.580228, - -3 + 0.284461, - -7 + -0.726361, - -3 + -0.726564, - 1 + -0.345421, - 3 + 0.80056, - 1 + 0.878273, - -5 + 0.654627, - -1 + 0.295187, - 7 + 0.591756, - 3 + 0.260911, - 3 + 0.481528, - -3 + -0.77778, - 3 + -0.683316, - -7 + -0.658198, - -3 + -0.74585, - 1 + 0.938157, - 1 + 0.192402, - 5 + 0.361699, - 3 + -0.163265, - -3 + 0.783476, - -5 + 0.737259, - 1 + -0.569672, - 7 + 0.10586, - -1 + -0.173976, - 1 + 0.935026, - -7 + 0.356488, - -1 + 0.0017309, - 5 + -0.675919, - -1 + 0.0665381, - -1 + -0.307875, - 7 + 0.0983045, - 5 + 0.963101, - 3 + -0.519587, - -5 + 0.899631, - 1 + 0.31666, - 7 + -0.756871, - 7 + 0.333545, - -3 + -0.168074, - 7 + 0.87813, - -1 + 0.779471, - -5 + 0.754198, - 7 + -0.868269, - 1 + 0.333521, - 7 + -0.731973, - -1 + 0.33527, - -3 + -0.467703, - -1 + 0.234056, - -3 + -0.237028, - 3 + 0.74204, - 7 + -0.257894, - -7 + 0.690854, - -1 + 0.652636, - 3 + 0.0301753, - -7 + 0.814373, - -1 + -0.951698, - -5 + 0.976247, - -3 + 0.431324, - -3 + 0.192437, - 3 + 0.31289, - -3 + 0.422132, - 3 + -0.00384281, - 3 + 0.72445, - -5 + 0.920278, - -3 + -0.324996, - 3 + 0.181187, - 7 + 0.658717, - -5 + -0.977313, - -1 + 0.378038, - 1 + 0.615551, - -1 + 0.475454, - 3 + 0.735309, - 7 + -0.398705, - 7 + 0.0674037, - -1 + 0.273941, - 5 + -0.376697, - 1 + -0.934663, - 3 + 0.764279, - -5 + -0.67983, - -5 + -0.951744, - -7 + 0.559239, - -7 + 0.123601, - -1 + 0.279154, - 7 + -0.349745, - -1 + 0.881504, - 5 + 0.743417, - -7 + -0.126299, - -3 + 0.129631, - -7 + -0.248369, - 3 + -0.582388, - 7 + 0.606937, - -1 + -0.766819, - -1 + -0.887898, - -3 + 0.628891, - -3 + 0.797051, - 1 + 0.258235, - 1 + -0.289372, - -7 + -0.689227, - -5 + -0.223412, - -5 + -0.0717334, - 5 + 0.444987, - 3 + -0.47443, - 5 + -0.622907, - 1 + 0.231064, - 7 + 0.0643792, - -5 + -0.545879, - -3 + 0.881704, - 7 + 0.421487, - 7 + -0.163227, - 1 + -0.19334, - 5 + 0.754454, - -7 + -0.173896, - -1 + -0.148776, - -5 + 0.342022, - -3 + 0.00779013, - 7 + -0.959293, - 5 + 0.888742, - 1 + -0.0373372, - 3 + 0.154647, - 7 + 0.522902, - -1 + -0.91692, - 1 + -0.762814, - 1 + -0.308587, - -5 + 0.252501, - 3 + 0.186752, - 7 + -0.897854, - 3 + -0.314141, - 7 + -0.123752, - 5 + -0.986531, - 7 + 0.89791, - 1 + -0.133572, - -7 + -0.828677, - -7 + -0.362269, - 1 + -0.231981, - 1 + 0.6903, - 5 + 0.212784, - -1 + 0.790468, - -7 + -0.822496, - 1 + -0.215268, - 5 + -0.232525, - -1 + -0.479589, - 3 + -0.79679, - -5 + -0.604188, - 7 + -0.201313, - -1 + -0.525663, - -7 + -0.155085, - 1 + -0.820419, - -3 + -0.37499, - -3 + -0.983146, - -5 + -0.793733, - -1 + -0.0931721, - 5 + -0.601751, - 3 + 0.0783009, - -1 + 0.768638, - 1 + 0.492399, - -5 + -0.0098969, - -1 + 0.19191, - -7 + -0.979377, - -7 + -0.0178371, - -5 + -0.329518, - 1 + 0.373382, - -7 + -0.845312, - 3 + -0.922893, - 3 + 0.315986, - 3 + 0.486665, - 1 + -0.263414, - -5 + 0.375741, - 3 + 0.909047, - 1 + -0.905982, - 1 + -0.887325, - 1 + -0.20989, - 5 + -0.476245, - 1 + -0.937806, - 3 + -0.749343, - 3 + -0.786876, - -3 + -0.67605, - -1 + 0.0446474, - -5 + 0.652167, - 1 + 0.543258, - -5 + 0.15279, - -5 + 0.148326, - 5 + 0.254656, - -3 + 0.856795, - -7 + 0.751831, - -3 + 0.630068, - 5 + 0.0417778, - -5 + -0.789099, - -7 + 0.741281, - -3 + 0.391712, - -3 + -0.134653, - -1 + 0.326939, - 7 + -0.0234458, - -3 + -0.23408, - -5 + -0.239154, - -5 + -0.832932, - 5 + -0.305414, - 7 + 0.447744, - -3 + -0.729455, - 7 + 0.48413, - 5 + 0.236162, - 5 + -0.534741, - 5 + 0.00340226, - -5 + -0.92795, - 5 + -0.802271, - 5 + -0.486955, - -3 + -0.958796, - 5 + -0.576444, - -1 + 0.107654, - -5 + -0.759059, - -5 + 0.292163, - 1 + -0.785662, - 3 + -0.374019, - 7 + -0.0159586, - -1 + 0.70116, - -5 + 0.0846993, - 1 + 0.401001, - 7 + 0.0279956, - -7 + -0.394888, - 5 + 0.505212, - 7 + 0.786975, - 3 + 0.532436, - -7 + 0.204459, - 3 + -0.615921, - -3 + 0.0758607, - -5 + 0.130031, - -5 + -0.772899, - 3 + -0.274121, - 5 + 0.056024, - -1 + -0.218418, - -7 + -0.183809, - -5 + 0.109609, - 5 + -0.821093, - 7 + -0.353014, - 3 + 0.228901, - 1 + -0.594237, - -3 + 0.39832, - -5 + 0.575415, - -1 + 0.398899, - -5 + -0.239754, - 3 + -0.535948, - 5 + -0.487767, - 5 + 0.282845, - 1 + -0.720766, - -7 + 0.678491, - -3 + 0.389419, - 5 + -0.862186, - 7 + -0.942864, - 7 + -0.341864, - 7 + -0.332763, - -7 + 0.290539, - -5 + -0.076314, - -3 + 0.14099, - 1 + -0.0547188, - 3 + 0.735025, - 3 + -0.197414, - 5 + 0.690544, - 5 + 0.630046, - -3 + -0.117688, - 7 + 0.656909, - 7 + 0.417193, - -3 + -0.489404, - -1 + 0.66448, - 3 + 0.109689, - 1 + -0.601325, - 5 + 0.930691, - 1 + 0.122041, - -3 + 0.991223, - -5 + -0.700354, - -1 + 0.0347951, - 7 + 0.122125, - 1 + 0.218395, - -7 + -0.177617, - 5 + 0.209456, - -5 + -0.976741, - -5 + -0.41843, - -3 + -0.580374, - -1 + -0.424389, - -5 + -0.183439, - 1 + 0.159905, - 1 + -0.825052, - -1 + -0.783269, - 3 + 0.150836, - -5 + 0.385557, - -1 + -0.657701, - -5 + 0.739214, - 7 + -0.990613, - -5 + 0.787245, - -5 + 0.604144, - -5 + -0.871588, - 5 + 0.721765, - 5 + 0.118939, - -5 + -0.859039, - -3 + 0.111408, - -1 + -0.479201, - 1 + -0.470303, - -1 + -0.136117, - 5 + 0.956995, - 1 + -0.39388, - -1 + 0.614385, - 1 + 0.556813, - 7 + 0.844387, - 1 + -0.436025, - -5 + -0.108634, - 5 + -0.100592, - -7 + -0.723946, - 1 + 0.0688398, - 7 + 0.180889, - -3 + 0.628736, - 1 + 0.112598, - 3 + 0.318029, - -3 + 0.634139, - 7 + -0.691032, - 1 + 0.356673, - 5 + 0.0566803, - 1 + -0.351812, - 5 + 0.531286, - -7 + -0.157417, - 7 + -0.99541, - 7 + -0.681986, - 5 + -0.997084, - -7 + 0.741155, - 1 + -0.622678, - 1 + 0.705248, - -5 + 0.711669, - 7 + 0.377357, - -5 + -0.62871, - -5 + 0.0214289, - -1 + -0.997903, - 5 + 0.0933239, - 3 + -0.526274, - -7 + -0.951203, - -1 + -0.755676, - 5 + 0.339232, - -1 + 0.773219, - -3 + 0.426269, - 3 + -0.396471, - 7 + 0.567064, - 5 + 0.633394, - -7 + 0.791714, - 3 + 0.787449, - 3 + -0.472383, - -5 + -0.155762, - -5 + -0.0783671, - -5 + -0.338965, - 3 + -0.793645, - -5 + 0.876857, - -5 + -0.02886, - -1 + 0.566931, - 5 + 0.623439, - 5 + 0.50836, - 7 + -0.3025, - 7 + -0.714796, - -7 + 0.179475, - 7 + -0.662018, - 1 + -0.348355, - 3 + -0.794334, - -3 + -0.157082, - 7 + 0.149085, - 1 + 0.640906, - -3 + 0.349559, - -3 + 0.857413, - -1 + -0.0283983, - -1 + 0.693171, - -3 + -0.214092, - -5 + -0.98936, - 1 + 0.639767, - 3 + -0.194655, - -5 + 0.940209, - -3 + 0.20604, - -3 + -0.564045, - 3 + -0.590761, - 5 + 0.685986, - 3 + -0.764822, - -1 + 0.42185, - -3 + -0.295677, - 1 + 0.216797, - 1 + -0.814246, - -1 + 0.206404, - -3 + 0.328757, - 7 + -0.566083, - 3 + 0.597134, - -3 + 0.642763, - -7 + -0.395769, - 7 + -0.935252, - -7 + 0.626113, - -3 + -0.849858, - 5 + 0.917923, - 5 + -0.376758, - 3 + 0.849631, - -5 + -0.327594, - -7 + -0.0529906, - -3 + -0.923709, - 1 + 0.0692206, - -5 + 0.056296, - 3 + 0.467438, - -1 + -0.814233, - -5 + -0.302013, - -3 + 0.695497, - 7 + 0.651437, - 3 + 0.168943, - 5 + 0.605341, - -1 + -0.372329, - 1 + 0.765342, - 1 + 0.947534, - -5 + 0.116956, - -3 + 0.577997, - 5 + 0.810715, - 1 + -0.779946, - -7 + -0.370998, - 3 + 0.558406, - -1 + -0.233575, - 1 + 0.77588, - -7 + -0.311882, - 5 + -0.910265, - 5 + -0.992932, - 5 + -0.760745, - 1 + 0.318678, - 5 + -0.210387, - 1 + 0.872963, - 3 + 0.220112, - -5 + -0.811578, - 5 + -0.711665, - 5 + -0.150111, - -1 + 0.641725, - 1 + 0.898414, - -3 + -0.650104, - 7 + -0.14629, - 7 + 0.865109, - -1 + -0.347701, - -1 + 0.921759, - 1 + 0.697452, - 1 + 0.0354798, - 5 + -0.176528, - -7 + 0.664795, - -3 + 0.896781, - 3 + -0.958731, - 5 + -0.141991, - 7 + 0.120368, - -5 + 0.485083, - 7 + -0.376901, - -5 + -0.43829, - -5 + -0.586847, - 1 + -0.959211, - 7 + 0.0708796, - -3 + 0.0492324, - -3 + -0.993246, - -1 + 0.650188, - -1 + -0.865149, - -5 + 0.37034, - 7 + -0.338674, - 3 + 0.623087, - -7 + -0.321175, - 7 + -0.764244, - -1 + 0.378604, - 1 + -0.812146, - 3 + 0.444655, - -5 + 0.253273, - 7 + 0.481744, - 3 + 0.455208, - 5 + 0.908443, - 1 + 0.0686094, - -7 + 0.844868, - -5 + -0.976591, - 7 + -0.72575, - 5 + 0.675135, - -7 + 0.274097, - -3 + 0.409609, - 3 + -0.175133, - -3 + 0.796693, - 3 + -0.247288, - -1 + -0.549564, - -7 + 0.967288, - -1 + -0.839667, - 3 + -0.681989, - -1 + -0.523145, - -5 + 0.396439, - 5 + -0.120618, - 3 + 0.693885, - -1 + -0.816144, - -5 + -0.968818, - -3 + -0.390704, - 3 + -0.448062, - 1 + 0.569756, - 5 + -0.336729, - -1 + 0.136729, - 5 + 0.941006, - 5 + -0.465103, - 7 + 0.468966, - -1 + 0.355103, - -7 + 0.615847, - -1 + -0.692941, - -1 + -0.173114, - 3 + 0.594599, - 7 + 0.557483, - 3 + 0.997697, - -5 + 0.24401, - 1 + -0.00963287, - 5 + 0.0275448, - 5 + 0.659747, - -7 + -0.567272, - -5 + -0.405348, - -1 + -0.614457, - 1 + 0.19472, - -7 + 0.553533, - -3 + -0.612328, - 1 + -0.348393, - -3 + 0.771169, - -3 + 0.354427, - -5 + 0.785281, - 3 + -0.318974, - -5 + -0.170041, - -1 + -0.667593, - -1 + -0.514524, - -5 + -0.76729, - 3 + 0.924267, - 7 + -0.893804, - -7 + -0.250356, - 7 + -0.732358, - -7 + 0.490774, - 1 + -0.437992, - -3 + 0.469562, - 1 + 0.436426, - -3 + -0.400156, - 7 + -0.860264, - 1 + 0.0900252, - -1 + -0.754367, - 1 + -0.838147, - -5 + 0.404529, - -7 + -0.437069, - -5 + -0.496662, - 5 + 0.952867, - -3 + 0.894237, - -3 + -0.555447, - -1 + -0.354976, - 1 + -0.60926, - -7 + 0.759444, - 3 + 0.662752, - -7 + -0.815089, - -5 + 0.98253, - 3 + -0.817391, - 5 + -0.61243, - -5 + -0.456923, - -1 + -0.824931, - 7 + 0.514605, - -1 + 0.828664, - -5 + -0.195044, - -3 + -0.333318, - 3 + 0.164695, - -7 + 0.0349422, - 7 + 0.118845, - 5 + -0.174882, - 7 + -0.872202, - 7 + 0.710986, - 3 + 0.699916, - -5 + 0.066256, - 3 + -0.148756, - 7 + 0.508584, - 5 + 0.825367, - -5 + -0.729841, - -5 + -0.887612, - 5 + -0.758424, - -5 + 0.998181, - -7 + 0.65577, - 5 + -0.474471, - 7 + -0.269234, - 3 + 0.104569, - -5 + -0.102212, - -5 + 0.738547, - 5 + -0.94242, - -1 + 0.15571, - 7 + -0.421775, - -7 + 0.804305, - 3 + 0.770802, - 7 + 0.642568, - -7 + 0.971034, - 1 + -0.144741, - -7 + 0.902049, - 7 + 0.157032, - 7 + -0.710021, - 7 + 0.719006, - 1 + -0.119823, - -7 + 0.156298, - 3 + 0.970851, - -1 + -0.163907, - -7 + -0.353286, - -7 + 0.497258, - -7 + 0.283671, - 1 + 0.0405689, - -5 + -0.962454, - -3 + -0.219818, - 1 + -0.436599, - -3 + -0.651331, - 5 + 0.192501, - -5 + 0.627465, - 3 + -0.0387857, - -5 + 0.235464, - 3 + -0.0781319, - -1 + 0.372664, - -7 + 0.144817, - -3 + -0.981248, - -7 + -0.438408, - 5 + 0.851478, - -1 + -0.473764, - 1 + 0.00188464, - 3 + 0.433134, - -7 + -0.132385, - 7 + -0.0645663, - -1 + -0.202906, - -7 + -0.19273, - -5 + 0.490564, - 5 + -0.986688, - 3 + -0.259055, - -5 + -0.0975989, - -1 + -0.599443, - -1 + 0.313751, - -3 + 0.839625, - -3 + 0.0875769, - 7 + 0.531778, - 5 + 0.78374, - -7 + -0.568377, - -5 + -0.772801, - -5 + -0.0559519, - -5 + 0.945151, - -7 + 0.260123, - -7 + -0.909106, - -5 + 0.0617756, - -3 + -0.0675705, - 3 + 0.425518, - -3 + 0.0981296, - -1 + -0.137702, - 5 + 0.353555, - 7 + 0.895279, - -7 + 0.247132, - -1 + 0.346749, - -3 + 0.748198, - -5 + 0.584672, - 3 + -0.731422, - 3 + 0.0579248, - 5 + 0.212579, - 5 + 0.1419, - -1 + -0.51401, - 1 + -0.844899, - -1 + -0.478985, - -5 + 0.918879, - 3 + -0.0802303, - 5 + 0.995209, - 1 + 0.228169, - -3 + 0.580333, - -3 + -0.866062, - 7 + -0.978268, - -5 + 0.501526, - -7 + 0.334392, - -1 + 0.442487, - -5 + 0.0704108, - -5 + -0.711541, - -5 + 0.982968, - -7 + 0.722414, - 5 + -0.799889, - 1 + -0.853645, - -7 + 0.997917, - 5 + -0.513696, - 5 + 0.0364606, - 5 + -0.248071, - -7 + -0.387232, - 1 + -0.811699, - 1 + 0.732048, - 3 + -0.679307, - -1 + -0.978209, - -1 + -0.964028, - -5 + -0.611812, - -7 + -0.902063, - -3 + 0.398009, - 3 + 0.00542146, - 5 + 0.601782, - 5 + -0.104203, - 1 + 0.506752, - -5 + 0.436524, - 7 + 0.982469, - -1 + -0.0633421, - -7 + 0.446072, - -1 + 0.927761, - 1 + 0.658156, - -7 + 0.785148, - -1 + -0.591183, - -3 + 0.0137029, - -1 + -0.388246, - 7 + -0.675978, - 1 + 0.0143937, - -7 + 0.690042, - -5 + -0.693171, - -7 + -0.352858, - 3 + -0.970363, - -7 + -0.723423, - 3 + 0.724452, - -3 + 0.158585, - 7 + -0.175004, - 1 + -0.19285, - -1 + 0.992788, - 3 + -0.851952, - 5 + 0.81, - 3 + -0.0435364, - -1 + -0.0813053, - -1 + -0.765415, - -7 + -0.0372974, - -1 + 0.694064, - 1 + -0.136753, - 3 + 0.826244, - -7 + 0.140024, - 5 + -0.0882701, - 1 + 0.295136, - 7 + -0.5227, - -5 + -0.237363, - -3 + 0.709084, - -3 + 0.629578, - -5 + 0.643857, - 7 + -0.668263, - -5 + 0.249376, - -1 + -0.760648, - 1 + -0.927984, - 7 + -0.659877, - 7 + -0.567002, - -1 + 0.0565217, - -3 + 0.805679, - -3 + -0.528236, - -7 + -0.13752, - -3 + 0.887507, - 7 + 0.63262, - 3 + -0.119278, - 3 + 0.890306, - -1 + -0.274285, - -1 + 0.369489, - 7 + 0.0317755, - 3 + -0.856605, - 7 + 0.912634, - -7 + 0.0492215, - 1 + -0.276292, - -7 + -0.177337, - 3 + -0.787517, - -3 + -0.53, - -1 + -0.186417, - 3 + -0.949098, - -7 + -0.517213, - -1 + -0.986841, - 5 + 0.600896, - 7 + 0.48168, - -3 + -0.458465, - 5 + 0.321443, - -3 + -0.234238, - 1 + -0.954936, - 5 + -0.0275234, - -7 + 0.924262, - 1 + 0.977532, - -5 + -0.669258, - 3 + 0.364021, - 1 + 0.135028, - -3 + -0.473695, - -7 + -0.185051, - -7 + -0.232574, - 3 + -0.944187, - 3 + -0.0543526, - 5 + 0.673031, - 5 + 0.195805, - 1 + -0.45507, - 7 + 0.404971, - 3 + -0.610784, - 5 + 0.0659073, - -1 + -0.207704, - 7 + 0.644995, - -1 + 0.121214, - -3 + -0.483027, - -7 + 0.711033, - 5 + -0.673219, - -1 + -0.895776, - 3 + 0.951024, - -3 + 0.56215, - 3 + -0.329154, - -5 + -0.577541, - -7 + -0.309147, - -1 + -0.511309, - 7 + 0.499812, - -5 + -0.681876, - -1 + -0.801156, - 7 + 0.151605, - -3 + 0.241685, - 7 + 0.992835, - -3 + 0.982038, - -5 + 0.0631867, - -5 + 0.950436, - 7 + 0.31088, - 5 + -0.708879, - -7 + 0.460315, - 1 + 0.397522, - 3 + -0.830289, - -1 + -0.146992, - 3 + 0.667571, - -5 + 0.870575, - 5 + -0.692335, - 1 + -0.399896, - -7 + -0.421033, - 7 + -0.740574, - -3 + 0.0441913, - -5 + 0.000759854, - -1 + -0.526559, - 7 + -0.50311, - 3 + -0.00944866, - -7 + 0.250031, - -5 + 0.579793, - -3 + 0.554107, - 5 + 0.737397, - 1 + 0.434328, - -5 + -0.698991, - -7 + 0.0322755, - 5 + -0.995791, - -7 + 0.233862, - 3 + -0.201264, - 7 + -0.297969, - -5 + 0.377501, - 3 + -0.571389, - -1 + 0.530284, - 5 + -0.179379, - 7 + -0.356844, - -7 + 0.941165, - 1 + 0.339271, - 3 + -0.66842, - -5 + -0.423012, - 3 + 0.316588, - -1 + -0.984114, - 1 + -0.5428, - -1 + 0.766658, - 1 + -0.960606, - 5 + -0.620487, - 7 + 0.266202, - 7 + 0.901102, - 1 + -0.268669, - -5 + -0.607472, - -7 + -0.52709, - -3 + 0.0705389, - 1 + -0.608374, - -3 + -0.288577, - -5 + 0.843351, - -3 + 0.612135, - -5 + 0.230486, - 5 + -0.244291, - -1 + 0.576229, - -3 + 0.446377, - -3 + -0.106511, - -3 + 0.889909, - -5 + -0.918941, - 1 + 0.848997, - -5 + 0.10993, - -3 + 0.256356, - 1 + 0.504098, - 5 + -0.170462, - 1 + 0.835316, - 7 + 0.644516, - -7 + 0.90372, - -7 + 0.463742, - -5 + 0.349377, - -7 + -0.553437, - 1 + 0.330349, - 5 + 0.710921, - -3 + 0.654504, - -5 + -0.447801, - -5 + 0.0517276, - -1 + 0.975718, - 3 + 0.874352, - -1 + 0.678769, - -1 + -0.264881, - -3 + -0.0680661, - 1 + -0.824504, - -7 + -0.0992408, - -5 + -0.862084, - 3 + -0.805812, - 5 + 0.237566, - -3 + 0.888929, - 1 + -0.476846, - -1 + 0.621217, - 1 + 0.65046, - 1 + -0.177248, - -1 + 0.0533044, - 3 + -0.176522, - -1 + 0.676266, - 5 + 0.0818662, - 5 + -0.0801649, - 5 + -0.430938, - 3 + -0.763183, - -7 + -0.453813, - 3 + 0.555379, - -3 + 0.858594, - 3 + 0.227172, - -1 + -0.632746, - -7 + 0.627382, - 1 + -0.0489046, - 7 + -0.828429, - 3 + 0.555978, - -7 + -0.130752, - 1 + 0.978551, - 1 + 0.985192, - -3 + -0.601231, - -3 + 0.3876, - 1 + 0.907771, - -3 + -0.183183, - -5 + -0.297217, - -5 + 0.579173, - -5 + 0.751301, - 5 + 0.675477, - -7 + -0.700691, - 1 + 0.947316, - -7 + -0.635739, - -1 + -0.1091, - -5 + -0.655627, - -7 + -0.74121, - 1 + 0.334598, - 5 + -0.133385, - -5 + 0.364959, - 5 + -0.692856, - -7 + -0.432334, - -3 + 0.0911902, - -5 + 0.670209, - -7 + -0.0777559, - -3 + 0.769741, - 7 + 0.0235715, - 1 + 0.181115, - -7 + -0.688748, - -7 + -0.641734, - -1 + 0.972104, - 7 + -0.474228, - -7 + -0.984007, - 3 + 0.25339, - 3 + 0.87889, - 5 + 0.624509, - 5 + -0.896409, - 7 + -0.146804, - 5 + 0.79753, - -1 + 0.0419583, - -3 + -0.978575, - 5 + -0.799147, - 7 + -0.100029, - 5 + 0.34877, - 5 + 0.726533, - -3 + 0.902539, - -7 + -0.0300989, - 5 + 0.843366, - 7 + 0.98872, - 7 + -0.428589, - 1 + 0.644193, - -5 + 0.0228081, - 7 + -0.754224, - 7 + 0.805301, - 5 + 0.695254, - -7 + -0.188701, - 3 + -0.581044, - 5 + 0.799149, - 7 + 0.353339, - -1 + -0.9622, - -1 + -0.230887, - 5 + -0.787056, - -7 + -0.706222, - 3 + 0.0197935, - -1 + 0.805143, - 7 + 0.951379, - 5 + -0.333186, - -3 + -0.0693998, - -3 + 0.993613, - -5 + -0.548791, - -5 + -0.964111, - 3 + -0.584394, - 1 + 0.867385, - -7 + -0.480054, - 1 + -0.994699, - 7 + 0.090273, - -3 + 0.901709, - 1 + 0.715806, - 3 + 0.304813, - 7 + 0.403796, - 1 + -0.473723, - 5 + 0.475125, - -1 + 0.0271961, - 7 + -0.487227, - 7 + 0.229468, - -3 + -0.189796, - -3 + -0.625003, - 1 + -0.401116, - -7 + 0.67123, - -5 + -0.927091, - -7 + 0.270972, - 7 + -0.617139, - 1 + -0.91671, - -7 + -0.712691, - -3 + -0.840406, - 5 + -0.406998, - -1 + -0.849947, - 3 + -0.158653, - -1 + 0.0696663, - -1 + 0.758415, - 1 + 0.0694559, - 1 + 0.462296, - -5 + 0.217909, - 1 + 0.473663, - -3 + 0.473242, - -3 + -0.890317, - -3 + -0.397198, - -7 + -0.508332, - 5 + 0.990104, - 5 + -0.32464, - -1 + -0.869012, - 7 + 0.567209, - 1 + -0.495974, - 3 + -0.101183, - -7 + -0.74694, - -5 + -0.675854, - -1 + 0.110992, - -5 + 0.247456, - 7 + 0.840274, - -3 + 0.395728, - 5 + -0.362192, - -3 + -0.680363, - 5 + -0.602484, - -3 + 0.738772, - 1 + -0.644167, - -3 + 0.634913, - 3 + -0.384876, - 5 + -0.916855, - -5 + -0.227988, - -3 + -0.625356, - -5 + -0.740278, - -1 + -0.41118, - 3 + 0.443345, - 3 + 0.736942, - 1 + -0.354426, - -7 + -0.870946, - -3 + -0.546137, - -7 + 0.272889, - 1 + 0.0801028, - 5 + -0.274639, - -5 + -0.154875, - -3 + -0.580005, - -5 + -0.398665, - 3 + -0.385197, - 5 + -0.285359, - 1 + 0.362706, - -7 + -0.855772, - -7 + 0.0454971, - -5 + -0.424857, - -7 + -0.504577, - -5 + -0.00591926, - -5 + 0.149346, - 3 + -0.328489, - 7 + 0.015029, - 7 + 0.747577, - -5 + -0.714686, - 1 + -0.101717, - 3 + 0.656319, - 1 + 0.5271, - -7 + -0.64961, - -7 + -0.359428, - -3 + -0.298523, - -3 + -0.0788614, - 1 + 0.621573, - -1 + 0.0175043, - 3 + -0.579268, - 5 + 0.710546, - 7 + -0.511833, - 5 + 0.162637, - -7 + -0.226472, - 1 + 0.0095225, - 5 + 0.21144, - -5 + -0.582375, - 7 + 0.231257, - 1 + 0.248058, - -1 + 0.922646, - 5 + 0.00967738, - 7 + -0.00782117, - 1 + 0.930862, - 1 + 0.920455, - 7 + -0.994076, - -5 + -0.462763, - 1 + 0.627409, - 3 + 0.936991, - -7 + 0.800793, - -1 + 0.193107, - -7 + 0.703299, - -1 + 0.132479, - 1 + -0.152733, - 5 + -0.953622, - -7 + -0.997253, - 7 + 0.556477, - 3 + 0.272056, - -3 + -0.51489, - 5 + 0.398802, - 5 + 0.602265, - -5 + 0.274229, - -7 + -0.700344, - -7 + 0.0901991, - 5 + 0.0552389, - -7 + -0.536972, - -7 + -0.0797897, - 5 + 0.291342, - 3 + -0.846983, - 3 + 0.700542, - -7 + 0.192372, - 7 + -0.362972, - 5 + 0.180049, - -3 + 0.792655, - 7 + -0.662956, - 5 + -0.142891, - -3 + 0.244501, - -3 + -0.510171, - -3 + 0.321085, - -1 + 0.664982, - 7 + -0.905902, - -5 + 0.966882, - -7 + 0.735439, - 3 + 0.261407, - 3 + 0.963571, - -7 + -0.475502, - 7 + 0.78978, - 7 + 0.365208, - 3 + 0.820723, - 3 + -0.594815, - -1 + -0.942558, - -1 + -0.304459, - -3 + 0.391556, - -1 + -0.795303, - -7 + 0.136453, - -5 + -0.955505, - 1 + -0.534127, - 5 + -0.981382, - -3 + 0.557188, - -5 + -0.118641, - -3 + -0.621408, - -7 + -0.74375, - 7 + 0.0227463, - 5 + 0.112073, - -3 + 0.950711, - 5 + 0.643199, - 5 + -0.351889, - -1 + -0.221595, - -1 + 0.00700172, - 7 + 0.928086, - 5 + 0.0356548, - 3 + -0.370036, - -7 + -0.830755, - -5 + -0.222917, - 1 + -0.782772, - 1 + 0.237148, - -1 + 0.86974, - 5 + -0.537617, - -1 + -0.434889, - -7 + -0.0111739, - 7 + -0.715952, - 3 + -0.40804, - 3 + -0.360795, - 3 + 0.653046, - -3 + 0.706949, - 5 + -0.554727, - -1 + 0.183029, - -7 + -0.239732, - -5 + -0.658072, - 7 + -0.752212, - -5 + 0.293207, - 7 + -0.34722, - -7 + -0.326367, - -5 + -0.0589863, - 5 + -0.927616, - -1 + -0.866135, - 3 + 0.00235856, - -3 + -0.0437649, - -5 + -0.585851, - 1 + -0.481841, - -5 + 0.632601, - 3 + -0.874934, - -1 + -0.230124, - -5 + 0.403241, - -5 + -0.986698, - -1 + 0.968435, - -3 + -0.530127, - 1 + 0.919559, - -7 + 0.425743, - 7 + 0.123378, - 7 + -0.142707, - -7 + -0.494815, - 7 + 0.440976, - -5 + 0.890096, - -3 + -0.708126, - 7 + 0.943091, - -7 + -0.0667361, - 1 + 0.417654, - 7 + 0.25984, - -1 + 0.846645, - 3 + -0.416033, - -1 + -0.149707, - 1 + 0.889424, - 5 + 0.866725, - -3 + 0.625568, - -1 + -0.376365, - -7 + 0.362419, - -7 + 0.212156, - -1 + 0.898672, - 3 + -0.684527, - 3 + 0.350536, - -5 + -0.10858, - -7 + 0.363887, - 1 + 0.431342, - 7 + -0.426099, - -1 + -0.0357183, - 5 + 0.969688, - -7 + 0.436647, - 1 + 0.144824, - 7 + -0.689202, - -5 + -0.369132, - -7 + 0.447801, - 3 + 0.991838, - -5 + -0.95315, - -5 + -0.486236, - 7 + 0.635678, - 7 + -0.672488, - -5 + -0.134572, - -5 + -0.698523, - 3 + 0.0914014, - 5 + 0.826151, - 7 + 0.179363, - 3 + 0.905552, - 3 + 0.460779, - 3 + -0.195297, - -5 + 0.965511, - 1 + -0.98716, - 7 + 0.142015, - -7 + -0.156042, - 7 + 0.338355, - -3 + 0.630815, - -7 + -0.716086, - -5 + 0.30445, - -3 + -0.0663283, - -1 + 0.954605, - -7 + -0.516684, - -1 + 0.739518, - -5 + 0.0926331, - -1 + -0.964479, - -3 + 0.738004, - -1 + -0.0623072, - -3 + 0.994729, - -7 + -0.483703, - -5 + -0.116232, - -3 + 0.608111, - 5 + -0.169533, - 1 + 0.700974, - 7 + 0.344404, - 1 + -0.234486, - -5 + 0.753821, - 3 + 0.264031, - 1 + 0.365123, - -1 + 0.735946, - -3 + 0.075701, - 5 + 0.0457206, - -3 + 0.594172, - 1 + 0.144428, - 3 + -0.945545, - 7 + -0.49231, - -1 + 0.196516, - 7 + 0.397096, - -1 + 0.68979, - 3 + -0.283773, - -7 + -0.891651, - -7 + 0.0992016, - 3 + 0.364927, - 3 + 0.692215, - 1 + 0.902593, - -7 + 0.511356, - 1 + -0.329667, - 3 + 0.151807, - -3 + -0.469367, - -1 + 0.839886, - -3 + 0.990307, - 3 + 0.318869, - 5 + -0.74034, - -5 + -0.339204, - 1 + -0.452787, - 1 + -0.736788, - 1 + -0.248248, - 5 + 0.785201, - 7 + -0.243082, - 7 + -0.107551, - 1 + -0.729608, - -3 + -0.358678, - 1 + -0.786071, - -1 + 0.370913, - 3 + -0.398804, - 1 + 0.0692376, - -1 + -0.103113, - -1 + 0.153375, - 5 + 0.548651, - -1 + -0.306503, - 3 + -0.96292, - 5 + -0.221047, - 5 + 0.567843, - 5 + 0.41284, - 5 + 0.88284, - 1 + -0.629206, - -3 + -0.494796, - 3 + 0.424972, - 7 + 0.365256, - -5 + -0.739219, - 3 + 0.640667, - -5 + 0.633005, - -1 + 0.759701, - 5 + -0.0691017, - -5 + -0.0647394, - -5 + -0.348828, - -5 + 0.665346, - -1 + -0.135857, - 5 + 0.437672, - 5 + 0.381016, - -3 + -0.842788, - -1 + -0.85829, - -7 + 0.19863, - -5 + -0.877027, - 5 + -0.776832, - 3 + -0.591161, - 1 + 0.272311, - 1 + 0.729332, - -7 + -0.085479, - -1 + 0.867551, - -1 + 0.850484, - -7 + 0.688455, - -7 + 0.657501, - 1 + -0.781022, - 7 + -0.853813, - -5 + 0.963325, - 5 + -0.61377, - 1 + -0.946282, - -1 + -0.398061, - 7 + -0.618336, - -5 + 0.210241, - -7 + 0.245468, - 3 + -0.503244, - -7 + -0.991443, - -7 + -0.832428, - 3 + 0.633537, - 3 + -0.0513143, - -5 + -0.740331, - -5 + -0.571087, - -5 + 0.932409, - -1 + 0.310949, - 7 + 0.803959, - 1 + -0.37293, - 3 + 0.625741, - 3 + 0.335055, - -3 + -0.0665732, - -7 + -0.546747, - -3 + -0.824097, - 3 + 0.185571, - -5 + -0.963157, - 1 + -0.575186, - 5 + -0.380057, - -3 + -0.0146486, - -7 + 0.548562, - 7 + -0.294831, - 1 + 0.190966, - 3 + -0.200531, - 3 + 0.769514, - 1 + -0.758442, - 5 + -0.563297, - 3 + -0.268245, - 7 + 0.115331, - 7 + 0.635215, - 1 + -0.393521, - 1 + -0.618453, - -5 + 0.766947, - -5 + -0.89702, - 3 + -0.290726, - -1 + -0.146228, - -7 + -0.671038, - 1 + -0.598244, - 3 + -0.56863, - 7 + -0.501319, - -7 + 0.627518, - 3 + -0.389303, - -3 + 0.0746856, - 5 + -0.0666037, - 5 + -0.275337, - -5 + 0.132165, - 5 + -0.379456, - -3 + -0.232648, - -1 + -0.722393, - -3 + -0.848371, - -3 + -0.894514, - -3 + -0.52825, - -1 + 0.868408, - 5 + 0.305525, - -5 + -0.274425, - -5 + 0.22874, - 5 + 0.71816, - -1 + -0.744417, - -3 + 0.874223, - 1 + -0.0454682, - 3 + 0.998097, - -5 + 0.393407, - 5 + 0.187479, - 1 + 0.85875, - 3 + -0.930842, - 7 + -0.683711, - 3 + -0.625096, - 7 + -0.363623, - -3 + -0.478099, - 5 + 0.0397175, - -1 + 0.772844, - 1 + 0.0351828, - -5 + -0.450596, - 5 + -0.747949, - -1 + -0.901913, - 1 + -0.396489, - 7 + 0.266602, - -3 + -0.144345, - -7 + 0.357022, - -1 + 0.17734, - 3 + -0.490206, - 5 + -0.0589478, - -1 + 0.0215372, - -7 + 0.626992, - 3 + 0.805443, - 5 + -0.774861, - 7 + 0.548483, - -7 + -0.659366, - 5 + -0.399126, - 5 + 0.280639, - -1 + 0.382537, - 5 + 0.253533, - -3 + 0.484453, - -1 + -0.182041, - -7 + 0.403929, - 5 + 0.799799, - -1 + 0.872509, - -1 + 0.446505, - 1 + 0.072863, - 1 + 0.511757, - 5 + -0.0447141, - 7 + 0.418114, - 3 + -0.412815, - -7 + 0.270519, - 1 + -0.691355, - 3 + -0.197421, - 3 + -0.86134, - -5 + -0.0102158, - 1 + 0.35777, - 3 + 0.447566, - -1 + 0.0185418, - -7 + 0.78905, - 7 + 0.691196, - -5 + -0.980607, - 3 + 0.307422, - 1 + 0.612522, - 5 + -0.199466, - -1 + -0.459671, - 1 + 0.170203, - 5 + 0.345741, - -1 + 0.442178, - -5 + 0.431563, - 3 + -0.534043, - 5 + -0.76423, - 3 + 0.121284, - 3 + 0.645713, - 7 + 0.96808, - -7 + 0.488072, - 3 + -0.00669708, - 1 + -0.971889, - -1 + -0.315525, - 5 + 0.541525, - 3 + -0.787017, - -1 + 0.544075, - 3 + -0.0730717, - -5 + 0.522401, - -5 + -0.323174, - 7 + 0.526918, - 5 + -0.385761, - 5 + -0.895487, - -3 + 0.0897052, - -5 + -0.670281, - -5 + -0.182219, - -5 + 0.303178, - -5 + -0.947146, - -3 + -0.721791, - -5 + -0.626817, - 1 + -0.583032, - 3 + 0.641241, - -7 + -0.520007, - 1 + -0.425207, - -5 + 0.0712658, - 1 + 0.812682, - 1 + -0.143148, - 3 + 0.0762144, - 1 + 0.0785892, - 7 + -0.568785, - 1 + -0.59096, - 3 + 0.756584, - -1 + 0.128497, - 3 + -0.975302, - -1 + -0.757146, - 5 + 0.448678, - -7 + 0.00292395, - -3 + -0.0190117, - 7 + -0.211027, - -1 + -0.668733, - -5 + -0.447823, - 1 + -0.502645, - -7 + 0.47152, - -5 + -0.364533, - 7 + 0.745433, - -5 + 0.753726, - -1 + -0.307681, - -1 + 0.791775, - -5 + -0.151863, - -5 + 0.815651, - 7 + -0.0787568, - 1 + 0.901984, - 1 + 0.446558, - -5 + 0.035328, - 5 + -0.461488, - -5 + 0.702664, - 1 + 0.477797, - -1 + -0.0921929, - -3 + -0.231008, - 7 + 0.369765, - -7 + 0.0220315, - 5 + -0.0497525, - -7 + -0.0740606, - -1 + 0.885344, - 3 + 0.332343, - -3 + 0.220104, - -1 + 0.384649, - -5 + -0.196536, - -1 + 0.442901, - 5 + 0.226845, - -7 + 0.378706, - -7 + 0.165296, - 3 + 0.201761, - 1 + -0.666372, - -1 + -0.0523257, - 3 + 0.636851, - 5 + -0.717434, - 1 + -0.354993, - 3 + -0.720888, - -5 + -0.133448, - -5 + -0.12999, - 5 + -0.64646, - 1 + 0.66513, - 7 + 0.38796, - -3 + 0.983196, - 1 + 0.156689, - -1 + -0.598867, - 7 + 0.0891009, - -3 + 0.564803, - 5 + 0.647083, - 3 + 0.28552, - -5 + -0.550295, - 7 + -0.535946, - 3 + -0.323109, - 1 + 0.968116, - -5 + 0.670887, - 5 + 0.723851, - -7 + 0.14941, - 1 + 0.751713, - -3 + 0.379236, - -5 + 0.339108, - -5 + -0.301987, - 3 + -0.683341, - -5 + -0.359829, - 5 + -0.84713, - -3 + 0.304565, - -3 + 0.861481, - 7 + -0.877059, - -5 + 0.289428, - -7 + -0.434084, - -1 + -0.481805, - -3 + 0.932735, - -3 + -0.309733, - -3 + -0.656653, - -1 + 0.858222, - -5 + -0.945002, - -3 + -0.379574, - 1 + -0.329053, - -5 + -0.965912, - -7 + -0.0862743, - -3 + 0.564742, - 1 + 0.430712, - 7 + -0.134825, - 3 + -0.0142276, - -3 + 0.461407, - -3 + 0.237931, - 5 + 0.189721, - -5 + -0.164975, - 3 + 0.158177, - 5 + 0.761349, - 5 + -0.603701, - -1 + 0.343416, - -7 + 0.479708, - 5 + -0.54804, - 5 + 0.0522417, - -7 + -0.975275, - 3 + 0.908053, - 7 + -0.324028, - 1 + 0.20481, - -1 + 0.501097, - -3 + -0.562607, - -5 + 0.555231, - 1 + -0.158267, - 3 + -0.0687857, - 1 + 0.511831, - -5 + -0.607408, - 1 + 0.360143, - -1 + 0.437194, - -3 + -0.092719, - 7 + 0.66663, - -7 + 0.610324, - 1 + 0.477642, - -3 + -0.690053, - 5 + -0.239834, - 5 + 0.430824, - -1 + -0.74709, - -7 + 0.666542, - -3 + 0.787307, - 5 + 0.12119, - -5 + 0.468506, - -7 + -0.655536, - -3 + -0.362963, - -7 + -0.444575, - -5 + -0.813438, - 3 + -0.658917, - -7 + -0.846612, - -5 + 0.47478, - 1 + -0.486082, - -7 + 0.325601, - -3 + 0.10135, - 3 + 0.616988, - -5 + 0.030061, - 1 + 0.546106, - -3 + -0.107568, - 1 + -0.526698, - 1 + -0.402568, - 1 + 0.476488, - 5 + -0.876816, - -7 + -0.814004, - -5 + -0.742022, - 1 + 0.396799, - 3 + 0.302924, - 5 + -0.330856, - 3 + -0.20346, - 1 + -0.0134361, - 3 + 0.603609, - 5 + -0.531407, - 7 + 0.711484, - -1 + 0.520469, - -1 + 0.148813, - 3 + 0.0432309, - 1 + 0.669779, - 1 + -0.428549, - -3 + 0.260938, - -3 + 0.941317, - -5 + -0.780941, - -3 + -0.747831, - 1 + -0.998692, - -5 + 0.892504, - -1 + 0.62686, - 7 + 0.940684, - -1 + -0.157277, - -3 + -0.215904, - 3 + -0.149222, - -3 + -0.876603, - -7 + -0.20916, - 3 + -0.984649, - 7 + -0.60173, - -1 + -0.806134, - -1 + 0.209397, - 1 + 0.310198, - 5 + -0.348507, - -3 + 0.966827, - 1 + -0.781644, - -3 + -0.417686, - 1 + -0.618801, - 7 + 0.862017, - -3 + -0.405402, - -7 + 0.125069, - -7 + 0.815787, - -5 + 0.135567, - -5 + 0.652664, - -5 + 0.509215, - -3 + -0.247757, - -3 + -0.697007, - 7 + -0.760593, - 3 + -0.772638, - -5 + 0.870941, - -1 + 0.864873, - -1 + -0.695855, - 3 + -0.952328, - 7 + -0.984213, - -5 + -0.825547, - 7 + -0.937066, - 1 + -0.030252, - 7 + -0.370309, - -1 + 0.976445, - -1 + 0.105839, - -7 + -0.151788, - 5 + 0.329837, - 5 + 0.484323, - 3 + -0.185114, - 1 + -0.450171, - 7 + -0.174316, - 7 + -0.840168, - -3 + -0.188744, - 7 + 0.4487, - -5 + 0.0857224, - 7 + 0.836002, - -3 + -0.180574, - 7 + 0.933189, - -3 + 0.850465, - -3 + 0.217683, - 7 + -0.504985, - 3 + -0.244207, - -3 + 0.827852, - -3 + 0.231895, - -3 + -0.210397, - -5 + 0.225256, - -5 + -0.424323, - -3 + 0.584223, - 5 + -0.21417, - 7 + 0.0492111, - -5 + 0.717212, - 3 + 0.127463, - 5 + -0.412335, - -3 + -0.235105, - 1 + -0.142685, - 5 + -0.499895, - 3 + -0.081105, - -5 + -0.145618, - 7 + -0.823428, - 5 + -0.860577, - 3 + -0.433851, - 1 + -0.917788, - 1 + 0.0316082, - -7 + 0.825787, - -7 + -0.453454, - -7 + 0.00504467, - -3 + 0.495271, - 3 + 0.0318126, - 5 + -0.344928, - -1 + -0.550629, - -7 + -0.352606, - -1 + -0.122732, - -3 + 0.159171, - 3 + 0.261004, - 3 + -0.691171, - 3 + -0.746879, - 1 + 0.626657, - -3 + 0.0388675, - -1 + 0.51117, - 5 + -0.673213, - -3 + 0.864677, - -7 + -0.726019, - 7 + -0.729394, - -5 + 0.330155, - -7 + -0.0177368, - -7 + -0.300845, - 1 + 0.615713, - 5 + 0.00178831, - 1 + 0.0232089, - 7 + 0.0501066, - -5 + -0.620755, - 1 + -0.446627, - -1 + -0.417687, - 7 + 0.871591, - 7 + -0.750383, - 7 + 0.402812, - 1 + -0.147176, - -5 + 0.443187, - 3 + 0.286959, - 5 + 0.608735, - -3 + 0.380043, - 3 + -0.175819, - 7 + -0.829562, - -7 + -0.79598, - -1 + -0.192267, - -5 + -0.110678, - 1 + 0.6394, - 1 + -0.0846046, - 1 + 0.714054, - 5 + 0.811509, - 1 + -0.398193, - 7 + 0.760568, - -1 + -0.452345, - -5 + 0.687367, - 5 + -0.318674, - -3 + 0.324117, - -7 + 0.236211, - -5 + 0.649759, - 7 + -0.548562, - 3 + 0.0579074, - -3 + 0.967526, - 5 + 0.205966, - 3 + -0.575908, - -5 + -0.137605, - 7 + 0.927195, - -5 + 0.454236, - 5 + -0.445633, - 3 + 0.770301, - 7 + -0.281772, - -1 + -0.810031, - -5 + 0.104421, - -3 + 0.920684, - -1 + 0.868938, - 3 + -0.0053164, - -3 + -0.718631, - -5 + 0.455326, - 5 + -0.820026, - -5 + -0.768273, - 3 + 0.0752762, - 5 + 0.714693, - 7 + -0.17771, - -3 + 0.42292, - -1 + -0.0175617, - 5 + 0.528179, - 3 + 0.568353, - 5 + -0.587159, - 1 + 0.801071, - 7 + 0.0826319, - -3 + 0.0275306, - -5 + 0.676104, - -7 + 0.583124, - -3 + 0.218791, - -7 + 0.227567, - -3 + -0.430536, - 5 + 0.654163, - 3 + -0.467692, - 7 + -0.155845, - -7 + 0.089255, - -3 + 0.938383, - -3 + 0.906627, - 7 + 0.950595, - -5 + -0.489709, - 7 + 0.671718, - 7 + 0.164742, - 3 + -0.852821, - 7 + 0.582895, - -3 + -0.742699, - 1 + -0.0381558, - 1 + 0.752823, - 1 + 0.749102, - -1 + 0.403834, - -3 + -0.442988, - 3 + 0.769955, - -1 + 0.729227, - 3 + -0.464394, - -1 + 0.982971, - 5 + 0.32225, - 3 + 0.707018, - 7 + 0.284523, - -5 + -0.390641, - 7 + 0.838552, - 1 + -0.261646, - 7 + 0.763129, - -1 + 0.26582, - 7 + 0.47961, - 5 + 0.195016, - -1 + 0.442942, - 1 + -0.566928, - 1 + -0.885894, - 3 + 0.809517, - 7 + -0.794782, - 1 + 0.396051, - -1 + -0.717371, - -7 + -0.372855, - -3 + -0.435502, - -5 + 0.486243, - -7 + 0.226385, - -3 + -0.674962, - 5 + -0.818546, - -1 + 0.662066, - -3 + 0.371445, - 7 + -0.181262, - -7 + -0.96998, - 7 + -0.243668, - 1 + -0.622788, - -3 + -0.934349, - -7 + -0.531977, - 7 + 0.913129, - -5 + 0.0873188, - -5 + -0.802866, - 5 + 0.176445, - 7 + 0.931233, - -1 + -0.345816, - -7 + -0.698489, - 3 + -0.0641756, - -1 + 0.20042, - 3 + -0.225253, - 7 + 0.611709, - -3 + -0.526143, - 5 + -0.494852, - -7 + -0.543889, - 5 + -0.865676, - 7 + -0.361067, - -7 + 0.157247, - -1 + -0.148807, - -1 + 0.754306, - -3 + -0.232635, - 1 + 0.285416, - 5 + 0.977439, - 3 + -0.545843, - -5 + -0.684446, - 5 + 0.00538877, - -1 + -0.416723, - 1 + 0.455052, - -1 + -0.694408, - -5 + 0.5697, - -3 + 0.239728, - 7 + -0.157425, - -3 + 0.307093, - 3 + 0.598074, - -3 + -0.192316, - -5 + 0.683009, - 1 + -0.276813, - 7 + -0.0605859, - 7 + -0.160651, - 1 + 0.745574, - 5 + -0.595225, - -3 + 0.679057, - -7 + 0.681067, - -3 + 0.254237, - 3 + -0.309311, - -7 + 0.537294, - 7 + -0.527087, - -1 + -0.914636, - -5 + 0.3696, - -5 + 0.758544, - -3 + 0.615554, - -3 + -0.800559, - 5 + 0.857245, - -7 + 0.911095, - -7 + -0.476043, - 1 + 0.286482, - -7 + -0.106087, - -5 + 0.396264, - -5 + -0.897017, - 1 + -0.963821, - -7 + -0.566173, - -5 + 0.578676, - 1 + 0.813064, - 7 + 0.491473, - 7 + -0.270985, - 5 + 0.132949, - 5 + 0.0161494, - 1 + 0.474008, - -5 + 0.796655, - -3 + -0.63918, - 3 + -0.967985, - 7 + 0.879643, - -1 + 0.214509, - -5 + 0.00227151, - 5 + 0.0762274, - 3 + 0.59941, - 3 + 0.340686, - -5 + -0.518312, - -5 + -0.6534, - -3 + -0.133582, - 1 + 0.772737, - -3 + -0.796512, - -1 + -0.232784, - 7 + -0.567475, - -5 + -0.612535, - -5 + -0.743451, - -5 + 0.922795, - 7 + -0.360325, - -5 + 0.664416, - -7 + 0.537588, - -7 + 0.090611, - -1 + -0.411909, - 3 + -0.926915, - 7 + 0.395344, - -7 + -0.661518, - -3 + -0.170838, - 7 + -0.357837, - -5 + 0.471491, - -3 + -0.382249, - -3 + -0.52305, - -1 + -0.97666, - 3 + 0.0582765, - -1 + -0.0656394, - 7 + -0.406727, - 1 + 0.00918714, - -5 + -0.137935, - 7 + -0.614004, - 1 + -0.979364, - -7 + 0.416733, - -1 + -0.759126, - -7 + -0.370293, - -7 + -0.100497, - 1 + 0.869131, - -3 + 0.164885, - -1 + -0.0975662, - -7 + 0.186475, - 3 + -0.918565, - 3 + -0.0801415, - 7 + -0.100654, - -7 + -0.0564053, - -5 + -0.266266, - 1 + -0.250558, - -7 + 0.00064827, - 1 + 0.0900851, - -5 + -0.598895, - -3 + -0.300177, - -3 + -0.733429, - -1 + 0.644141, - -7 + 0.473614, - -1 + -0.641922, - 5 + -0.771156, - 1 + -0.408759, - 5 + 0.12316, - -5 + 0.293248, - 1 + -0.878825, - -7 + -0.414203, - 1 + -0.158712, - 7 + 0.739709, - -7 + -0.86936, - 3 + 0.642115, - 3 + -0.385535, - -7 + 0.143439, - -3 + 0.698413, - 5 + -0.678345, - 5 + 0.565038, - 5 + 0.815733, - 5 + -0.707831, - -7 + -0.849665, - 3 + -0.293231, - 3 + 0.511878, - -7 + 0.0476101, - -5 + -0.612903, - 5 + 0.912856, - -1 + -0.229084, - -1 + -0.228542, - -1 + 0.543728, - 7 + -0.254476, - 5 + -0.538093, - 7 + 0.873386, - -7 + -0.797387, - 1 + 0.472407, - -5 + 0.952256, - -7 + 0.795923, - -1 + -0.0898826, - -3 + 0.851045, - 3 + 0.649821, - -5 + -0.623912, - -1 + -0.232825, - -5 + -0.293336, - 3 + -0.175406, - 7 + -0.126623, - -3 + -0.458458, - -1 + -0.716308, - 3 + -0.442831, - 5 + -0.240306, - -3 + 0.62798, - 7 + -0.901771, - -1 + 0.980463, - 3 + -0.502372, - -7 + -0.861722, - -1 + 0.827093, - 1 + 0.12554, - -3 + 0.270311, - -5 + 0.348095, - -1 + 0.913085, - 7 + 0.957399, - 7 + 0.340458, - 5 + 0.0422461, - -1 + -0.369125, - -3 + 0.43044, - 7 + -0.632377, - -1 + -0.90659, - 1 + -0.89239, - 7 + 0.828316, - 5 + 0.824523, - -7 + -0.0536567, - 1 + -0.0399239, - 1 + 0.197041, - -1 + -0.554157, - -5 + 0.0431199, - -3 + -0.304071, - -3 + -0.331796, - 5 + 0.822257, - 3 + -0.638709, - 3 + 0.639501, - -1 + -0.549931, - -5 + 0.893208, - 3 + 0.791099, - 7 + 0.153618, - 3 + -0.838246, - -7 + 0.475597, - 1 + -0.354901, - -7 + -0.761264, - -1 + 0.106035, - -3 + -0.481434, - -1 + 0.234136, - 5 + 0.375285, - -7 + -0.539323, - -3 + -0.671027, - -3 + 0.212608, - -5 + 0.992672, - -3 + -0.655146, - -1 + -0.675066, - -1 + 0.944776, - 5 + 0.653261, - 7 + 0.703227, - -1 + -0.329846, - -3 + -0.29662, - 5 + 0.0306179, - 3 + 0.308382, - 5 + -0.37852, - 1 + 0.569875, - -1 + 0.262195, - -7 + 0.65172, - -1 + -0.324076, - -1 + -0.592955, - 3 + 0.330534, - -7 + 0.236835, - 7 + -0.16363, - 5 + -0.350766, - 7 + 0.33076, - -3 + 0.713702, - 7 + 0.986953, - 1 + -0.484957, - 1 + 0.232317, - 1 + -0.241183, - 1 + -0.652168, - -7 + -0.969083, - -3 + -0.00466762, - 7 + -0.643621, - 5 + -0.512406, - 3 + 0.559345, - -1 + 0.876841, - 1 + 0.0247327, - -5 + 0.579806, - -7 + -0.45585, - -1 + -0.978404, - -3 + -0.211921, - 3 + 0.0595151, - -5 + -0.772737, - 1 + 0.701463, - 7 + -0.055659, - 1 + -0.434081, - -7 + -0.748698, - 5 + -0.742137, - 5 + -0.0588123, - -5 + 0.446934, - -7 + -0.9576, - -1 + -0.910423, - -1 + -0.798973, - -7 + 0.643822, - -3 + -0.240149, - 1 + -0.366265, - 1 + -0.168219, - -7 + -0.030838, - 7 + -0.591915, - -3 + -0.92018, - 7 + 0.57597, - -1 + 0.351344, - -7 + 0.647625, - 5 + -0.537432, - -5 + -0.69753, - 3 + 0.489766, - -3 + -0.263308, - 1 + 0.40383, - -1 + 0.0716793, - -3 + 0.0739884, - 7 + -0.543397, - -5 + 0.313842, - -1 + -0.290457, - -3 + -0.84267, - -3 + -0.568324, - -3 + -0.18694, - 7 + 0.544842, - 5 + 0.340199, - -5 + -0.465435, - 5 + 0.386054, - 3 + -0.248471, - -1 + -0.536871, - -3 + -0.00456425, - 5 + 0.30784, - -7 + 0.567282, - -3 + -0.689596, - 7 + -0.973479, - -5 + -0.292588, - 1 + -0.0853992, - 1 + 0.54008, - 1 + 0.933126, - 7 + 0.308498, - -5 + 0.933511, - -1 + -0.616556, - 1 + 0.5256, - -3 + 0.11786, - -1 + 0.742156, - -1 + 0.169955, - -1 + -0.96657, - -3 + 0.556796, - -1 + -0.865691, - -3 + -0.238262, - -5 + 0.647911, - 3 + 0.359834, - 7 + 0.613736, - 1 + 0.507745, - -7 + -0.892512, - 3 + 0.444704, - 7 + -0.939748, - -1 + 0.672554, - -7 + 0.136662, - -7 + 0.565658, - 3 + 0.942443, - -1 + 0.0449975, - 1 + 0.92684, - 3 + -0.297685, - 5 + 0.568496, - 3 + -0.144333, - 1 + -0.166059, - 5 + 0.245617, - -7 + 0.0561295, - 5 + -0.053852, - 5 + 0.796947, - -5 + 0.352517, - -5 + 0.967329, - 5 + -0.892274, - 7 + -0.335576, - -1 + -0.545664, - 5 + 0.768217, - -7 + -0.188918, - -7 + 0.285642, - -3 + -0.467917, - -1 + 0.356141, - -7 + -0.382192, - -5 + 0.0410403, - -3 + 0.593099, - -1 + -0.407076, - 7 + 0.399012, - 3 + -0.215368, - 5 + 0.00567285, - 3 + 0.833758, - 7 + -0.469107, - -3 + 0.84339, - -1 + -0.648244, - -1 + 0.45709, - 5 + 0.221697, - -3 + 0.2979, - -1 + -0.801441, - 5 + 0.358525, - 5 + 0.0155232, - 7 + -0.613239, - -3 + 0.770038, - -3 + 0.386763, - -1 + -0.977012, - -5 + 0.0247041, - 3 + -0.774763, - 1 + -0.269862, - 3 + 0.598317, - -7 + -0.604919, - -5 + -0.295425, - -3 + -0.501016, - 5 + 0.893051, - -7 + 0.592268, - -1 + -0.135156, - 5 + -0.766252, - -3 + 0.445672, - 5 + 0.612924, - -5 + 0.107889, - -1 + 0.306333, - -3 + -0.720024, - 1 + -0.256542, - -5 + -0.644907, - -1 + -0.198375, - -1 + 0.530318, - 7 + 0.865427, - -5 + -0.186188, - 3 + 0.15118, - 5 + 0.652307, - 1 + 0.908472, - 3 + 0.747761, - -1 + -0.654492, - 1 + -0.454527, - 5 + 0.682724, - -5 + 0.372245, - 7 + 0.871819, - 3 + -0.80367, - -1 + 0.448117, - -1 + 0.948526, - -7 + -0.348271, - 7 + -0.927127, - 1 + 0.449701, - -1 + -0.680563, - 1 + 0.892784, - 1 + -0.0924386, - -1 + -0.959661, - 7 + -0.081394, - 5 + -0.963336, - -5 + 0.805157, - -7 + -0.285785, - -7 + -0.592211, - -5 + 0.413432, - -1 + -0.723101, - -3 + -0.0432179, - -3 + 0.357774, - 3 + -0.969629, - -7 + 0.840992, - 7 + -0.0670359, - 1 + -0.230027, - -7 + 0.00539775, - -1 + 0.992222, - -5 + 0.508197, - -1 + -0.0701932, - -7 + -0.916136, - 1 + 0.121754, - 3 + 0.979212, - 5 + 0.710977, - -3 + -0.444553, - 1 + 0.775755, - 1 + -0.731095, - -5 + -0.962054, - -7 + -0.137716, - 1 + 0.0744596, - -3 + -0.298853, - 3 + -0.287877, - 7 + -0.537653, - 7 + -0.370057, - 5 + 0.558642, - -1 + -0.306097, - 5 + 0.298301, - 5 + 0.890951, - 7 + 0.461226, - 5 + -0.273165, - -3 + 0.767864, - -1 + -0.427128, - -7 + 0.0742497, - 3 + -0.628171, - -1 + -0.383706, - -5 + 0.926895, - -3 + -0.111893, - -1 + -0.568481, - 3 + 0.982367, - 3 + -0.746265, - 7 + 0.602531, - 5 + 0.639663, - -5 + 0.640932, - 3 + -0.339199, - -7 + -0.872224, - 7 + 0.493771, - 5 + -0.0426846, - 7 + -0.222289, - 7 + -0.802753, - 5 + -0.998975, - 5 + 0.739618, - 5 + -0.949418, - -7 + -0.348646, - 7 + -0.122117, - -3 + -0.786274, - -1 + -0.910026, - 5 + -0.521515, - 5 + 0.786492, - -3 + -0.956601, - -7 + -0.935189, - -1 + 0.816024, - 5 + 0.675236, - 5 + 0.0495799, - -7 + 0.738648, - 7 + 0.424409, - 3 + -0.438266, - -7 + -0.491474, - 1 + 0.22495, - -5 + -0.0235629, - -3 + 0.479672, - -1 + 0.84058, - -5 + -0.166951, - 5 + -0.0577841, - -1 + -0.642721, - -1 + 0.723607, - 1 + -0.873909, - 3 + -0.888751, - -1 + -0.370589, - -3 + -0.0403842, - 3 + 0.564038, - 1 + -0.590923, - -1 + -0.301823, - 3 + -0.525907, - -7 + -0.700129, - -7 + -0.286343, - -1 + -0.746766, - -1 + 0.510312, - -7 + 0.68781, - -1 + -0.071507, - 5 + 0.20512, - 7 + 0.193939, - -3 + 0.0940258, - -1 + -0.815724, - 7 + 0.914182, - 3 + 0.582396, - -5 + 0.182791, - 5 + -0.169328, - 5 + -0.539398, - 1 + -0.544711, - -7 + -0.29523, - -7 + -0.220718, - -7 + -0.424836, - -1 + -0.583509, - 5 + -0.998364, - 7 + -0.624936, - -3 + 0.682019, - 7 + -0.0926723, - -3 + -0.596477, - -1 + -0.380871, - -3 + -0.215605, - 7 + -0.0981703, - -7 + -0.181927, - -1 + 0.668344, - 1 + 0.550972, - 1 + -0.362117, - -1 + 0.434212, - -7 + 0.529025, - 5 + -0.166071, - -3 + 0.473601, - 5 + 0.555215, - 7 + 0.878004, - 3 + 0.90408, - -5 + 0.504969, - -3 + -0.667642, - -5 + -0.538538, - 5 + 0.188161, - -1 + 0.914107, - 3 + 0.472097, - 7 + 0.510842, - -5 + 0.985461, - -7 + -0.394255, - -5 + 0.890095, - 5 + 0.634067, - -7 + -0.944812, - -1 + -0.199624, - -1 + -0.447444, - 3 + -0.228946, - 7 + 0.22322, - -5 + 0.654362, - -5 + -0.200935, - 3 + -0.833657, - -7 + 0.802499, - 1 + -0.704644, - 5 + -0.415231, - 5 + -0.488818, - -5 + -0.405574, - -3 + -0.551587, - 3 + -0.143344, - -5 + 0.992058, - 7 + 0.973004, - -1 + 0.899068, - -1 + -0.201666, - -5 + -0.327868, - 3 + -0.727053, - -7 + 0.268601, - -7 + 0.109424, - 7 + -0.950672, - 1 + 0.76586, - -3 + 0.875399, - 7 + 0.0168127, - -5 + -0.751942, - 1 + 0.455423, - 5 + -0.133098, - 5 + 0.576325, - -5 + -0.760309, - -7 + -0.273288, - -7 + -0.766843, - 1 + -0.862775, - 7 + -0.885211, - 7 + 0.696724, - -1 + 0.0780369, - 1 + 0.275855, - -5 + 0.21323, - -1 + 0.30191, - 5 + -0.129398, - -3 + -0.659394, - 7 + -0.537345, - -5 + 0.726379, - 1 + -0.351187, - 1 + 0.413273, - -7 + -0.460414, - -1 + 0.780082, - 7 + -0.750839, - 7 + 0.140123, - -1 + 0.431409, - -1 + 0.467309, - 7 + -0.189717, - -5 + -0.619566, - 1 + -0.664491, - 5 + -0.259023, - -3 + 0.956683, - -3 + -0.749516, - -5 + 0.131912, - -7 + 0.20736, - -7 + -0.370862, - 3 + -0.38448, - -7 + -0.0683076, - 5 + -0.0808511, - 3 + -0.716107, - -7 + 0.282494, - -5 + 0.690208, - 5 + -0.0140297, - 3 + -0.0253589, - -1 + -0.286539, - 1 + 0.632755, - 3 + 0.678366, - 7 + -0.298717, - 7 + 0.931446, - 3 + -0.000155271, - 5 + 0.593412, - -1 + -0.237465, - 3 + 0.495449, - 1 + 0.854041, - 7 + 0.417438, - 5 + 0.130533, - 3 + 0.11828, - 7 + -0.492641, - -3 + 0.31251, - -1 + -0.746348, - -3 + 0.00667295, - -7 + -0.849606, - -1 + -0.621633, - 5 + -0.780689, - -7 + 0.325068, - -1 + 0.14253, - -5 + -0.467373, - -7 + -0.215694, - -5 + 0.473324, - -5 + -0.0749665, - 1 + 0.0177372, - 1 + 0.874646, - -3 + -0.548775, - -5 + -0.644173, - 7 + 0.890543, - 1 + -0.258939, - -1 + -0.381203, - 7 + -0.989668, - 7 + -0.370075, - -7 + 0.0443089, - 7 + -0.655745, - -1 + 0.576317, - 1 + -0.867409, - -1 + -0.242211, - 3 + -0.414673, - -3 + -0.668824, - -7 + -0.880169, - -7 + -0.337623, - 3 + 0.421604, - 5 + 0.213655, - 5 + -0.797275, - 5 + 0.0784746, - -7 + 0.29279, - 5 + -0.266808, - 5 + -0.847968, - 3 + 0.627592, - 5 + 0.100925, - -7 + -0.836569, - -5 + -0.484448, - -7 + -0.260665, - 7 + 0.98659, - 5 + 0.811925, - 5 + -0.263092, - 3 + -0.423208, - 3 + -0.219005, - -7 + -0.0725037, - -1 + -0.814871, - 3 + 0.181891, - -3 + 0.309198, - 1 + 0.951535, - -7 + 0.694465, - -3 + 0.851734, - -3 + 0.240617, - 7 + -0.545582, - 7 + -0.582447, - -3 + -0.895393, - 1 + -0.607017, - 5 + 0.575812, - 7 + 0.0485804, - -5 + -0.609581, - 3 + -0.991071, - 1 + -0.69817, - -1 + 0.612983, - 7 + 0.124632, - 1 + -0.934992, - -5 + 0.629333, - -1 + -0.479678, - -7 + -0.690851, - 3 + 0.0123024, - 3 + 0.579883, - -7 + -0.797862, - 3 + 0.930494, - 5 + 0.0959856, - 5 + 0.799511, - 3 + -0.702544, - 3 + 0.863534, - -7 + 0.723902, - 3 + -0.925485, - -3 + 0.0838314, - 5 + -0.539124, - -7 + 0.795782, - -7 + -0.508871, - 3 + -0.666186, - -5 + -0.437818, - 1 + 0.430824, - -1 + 0.890288, - 3 + 0.0323077, - -5 + -0.451717, - 1 + -0.994217, - -5 + -0.889329, - 1 + -0.154296, - 3 + -0.139546, - 3 + 0.783946, - -1 + 0.843542, - -7 + 0.742655, - 3 + 0.0644047, - -3 + 0.707173, - 7 + -0.292937, - -1 + 0.978045, - 3 + -0.495493, - 1 + 0.576421, - -5 + 0.830068, - -7 + -0.7389, - -3 + 0.545496, - 5 + 0.525718, - -5 + 0.491613, - -5 + 0.0724149, - -5 + -0.581892, - -5 + 0.148299, - -3 + -0.0143521, - -7 + 0.224096, - -1 + -0.58379, - -7 + -0.746189, - 3 + 0.678161, - 5 + -0.60352, - 1 + -0.0123151, - -3 + 0.935789, - 7 + 0.146463, - 5 + 0.0833464, - -5 + 0.0973773, - 1 + -0.634221, - 5 + -0.199689, - -5 + -0.977316, - 1 + -0.468532, - -3 + 0.912407, - -1 + 0.618525, - -5 + 0.641828, - -3 + 0.161639, - 3 + -0.521444, - 1 + 0.217545, - -3 + 0.776886, - -5 + -0.0861521, - 7 + -0.684462, - 3 + 0.025459, - 5 + -0.588791, - 3 + -0.968869, - -5 + 0.936218, - 5 + -0.962381, - 1 + 0.102731, - 7 + 0.487412, - 5 + -0.586347, - -5 + 0.483033, - 3 + 0.147303, - 7 + 0.545176, - -1 + -0.346122, - -3 + -0.550012, - -3 + 0.175068, - 5 + -0.32015, - 1 + 0.524341, - -7 + 0.645118, - -5 + -0.940018, - -1 + -0.97908, - -7 + -0.515108, - -3 + 0.367395, - 1 + 0.545659, - 1 + -0.286328, - 5 + -0.58779, - 1 + 0.337098, - 7 + -0.330973, - -3 + 0.374149, - 7 + -0.0352384, - -3 + 0.100802, - -3 + -0.496571, - 5 + -0.780307, - 1 + -0.478443, - 5 + 0.67526, - 7 + -0.425565, - 7 + 0.754558, - -7 + -0.775828, - 5 + 0.655701, - 7 + -0.438407, - 3 + -0.775985, - 7 + -0.666725, - -1 + 0.797674, - 1 + -0.749333, - -7 + 0.194764, - -7 + 0.625181, - -5 + -0.060977, - -5 + 0.643178, - 3 + -0.933005, - -3 + -0.998434, - 3 + 0.713815, - -3 + -0.574046, - -3 + -0.0416154, - -7 + 0.296629, - 7 + 0.191779, - -7 + 0.833033, - -3 + 0.487987, - -3 + -0.575328, - 5 + 0.496461, - 3 + 0.589905, - 7 + -0.924183, - -1 + 0.696718, - 5 + -0.875373, - -3 + 0.0319824, - 5 + -0.207871, - 3 + 0.177233, - -3 + -0.761711, - 1 + 0.401589, - 7 + 0.538526, - 7 + -0.320289, - -3 + -0.281917, - -5 + -0.547839, - -7 + -0.322797, - -5 + -0.605992, - 5 + 0.785395, - -1 + 0.0550308, - -5 + 0.511285, - -7 + 0.402531, - -7 + -0.464181, - 5 + -0.160938, - -5 + -0.735561, - -5 + 0.0996571, - 7 + 0.593118, - 7 + -0.0328994, - -5 + -0.98964, - 3 + 0.205471, - -1 + 0.200857, - 7 + -0.771514, - 1 + -0.587245, - 3 + 0.26805, - -3 + 0.784424, - -5 + -0.963779, - 7 + -0.505932, - -1 + -0.171588, - -1 + 0.670593, - -7 + 0.301767, - 5 + 0.0138393, - -1 + -0.984387, - -1 + 0.0391519, - -3 + -0.222087, - 7 + 0.0864488, - 5 + -0.4927, - 7 + 0.257574, - -3 + 0.232144, - -7 + 0.327466, - 1 + -0.464061, - -3 + -0.275329, - -1 + -0.0648923, - -7 + 0.674159, - -7 + -0.413218, - -7 + -0.692417, - 1 + -0.762459, - -5 + -0.913253, - -7 + 0.36255, - -5 + 0.917413, - -7 + 0.556944, - 7 + 0.869794, - -5 + 0.599393, - -7 + -0.957509, - 3 + -0.0653876, - -3 + 0.542317, - 7 + -0.919778, - -1 + 0.389195, - 1 + -0.694826, - -1 + -0.684451, - 5 + -0.232338, - 7 + 0.107159, - 1 + -0.408376, - 3 + -0.669585, - 5 + 0.257082, - 5 + 0.831891, - -1 + 0.211606, - -5 + -0.384855, - 7 + 0.020007, - -5 + -0.428625, - -3 + -0.0360878, - 5 + -0.848203, - 3 + 0.0254734, - -3 + 0.749542, - -7 + -0.804563, - -1 + -0.0972806, - 1 + -0.248763, - -5 + -0.480906, - -7 + 0.494774, - -7 + 0.809284, - 1 + 0.892301, - 3 + -0.866702, - 7 + 0.549121, - -7 + -0.807113, - 5 + 0.817796, - -3 + -0.258985, - -3 + -0.652257, - 1 + 0.857754, - 1 + 0.602559, - -3 + 0.459551, - -5 + 0.12109, - 7 + 0.228169, - 3 + 0.268535, - -5 + -0.511365, - 3 + 0.473797, - -3 + 0.789188, - 5 + -0.233201, - -1 + 0.337202, - 3 + 0.0872898, - -5 + -0.577231, - -3 + -0.794605, - -3 + 0.948282, - 1 + 0.86739, - 7 + -0.853303, - 1 + 0.585277, - -5 + -0.0480538, - 3 + 0.131517, - -5 + 0.256086, - 3 + -0.220017, - -1 + 0.968746, - 1 + -0.866085, - 1 + -0.75045, - 3 + 0.103057, - 3 + -0.280213, - 7 + -0.915525, - 1 + 0.910469, - -1 + 0.122471, - 7 + 0.756213, - -1 + -0.979998, - -3 + -0.526045, - -3 + -0.515105, - -3 + 0.191857, - -5 + 0.861293, - -5 + 0.557644, - -7 + 0.955665, - -7 + -0.218954, - -5 + 0.843849, - 3 + 0.700339, - -5 + 0.308848, - 5 + -0.671504, - -7 + -0.977673, - -3 + -0.243973, - -7 + -0.21181, - 5 + -0.722984, - 1 + -0.679969, - 1 + -0.943541, - -5 + 0.705531, - -5 + -0.327772, - 3 + -0.462895, - -3 + 0.0536484, - -5 + -0.181505, - 1 + -0.89014, - 3 + -0.24572, - 3 + -0.890222, - -3 + 0.668824, - -1 + -0.785433, - -5 + -0.835302, - 7 + -0.464588, - -3 + -0.970526, - -7 + -0.881556, - 3 + -0.690873, - -7 + 0.627452, - 7 + 0.162041, - 1 + 0.574909, - -3 + -0.436167, - -7 + -0.415736, - -1 + -0.330565, - 3 + -0.0637465, - 1 + -0.952135, - 7 + 0.820211, - 1 + 0.670167, - 3 + -0.227245, - 3 + 0.784935, - -7 + -0.114356, - -7 + -0.79073, - -7 + -0.0845568, - -3 + 0.0352457, - -1 + 0.23913, - 3 + -0.319363, - -1 + -0.784674, - 7 + 0.182406, - -3 + -0.208943, - 1 + -0.0539068, - 5 + -0.793545, - 7 + -0.926668, - -3 + -0.327488, - -5 + 0.286006, - 5 + 0.755716, - -1 + 0.396711, - -5 + 0.50953, - -5 + 0.0396668, - -7 + 0.294158, - 7 + 0.191498, - 1 + -0.157408, - 1 + -0.341843, - 1 + 0.34502, - 1 + 0.892611, - 7 + 0.205394, - -3 + 0.558871, - -5 + 0.209696, - -1 + 0.119176, - 3 + -0.0071817, - -5 + -0.177535, - 3 + 0.909066, - -3 + -0.741923, - 1 + -0.539941, - -3 + -0.037078, - 1 + 0.791042, - -5 + 0.482362, - -5 + -0.0119576, - -3 + 0.52501, - -7 + 0.76094, - -7 + 0.813217, - 7 + 0.985842, - 3 + -0.529906, - 1 + -0.423377, - -3 + 0.0981717, - -3 + -0.223135, - -5 + -0.61793, - 5 + -0.559953, - 5 + -0.469591, - -1 + 0.342377, - 3 + -0.0782716, - 7 + -0.684588, - 7 + 0.389739, - 5 + 0.10658, - -5 + 0.922608, - 7 + 0.602939, - -1 + 0.464956, - 3 + -0.789037, - 5 + 0.429394, - 3 + -0.550469, - 1 + -0.900731, - -3 + -0.623247, - -7 + -0.650424, - -1 + 0.131661, - -1 + -0.806985, - 1 + 0.960326, - -1 + -0.193632, - 7 + 0.582939, - -1 + -0.468436, - 5 + 0.0584084, - -3 + 0.989501, - -7 + -0.836051, - -7 + 0.494241, - -3 + 0.338635, - -1 + -0.648491, - -3 + 0.319444, - 5 + -0.976509, - -7 + -0.560152, - 1 + 0.968145, - -3 + 0.506876, - 1 + -0.446687, - -3 + -0.557403, - -5 + 0.386343, - 7 + -0.26601, - 5 + 0.768097, - -1 + -0.862516, - 3 + 0.092811, - 1 + 0.688699, - -7 + 0.437148, - -7 + 0.819611, - -5 + 0.433439, - -3 + 0.0525214, - 7 + -0.875873, - -1 + -0.318693, - -7 + 0.941041, - 3 + -0.938497, - -5 + -0.700787, - -5 + -0.208713, - -1 + -0.926069, - 5 + 0.763435, - -3 + -0.753673, - -3 + -0.436892, - 5 + 0.25309, - 3 + 0.376517, - 7 + 0.234089, - -1 + 0.602584, - 7 + -0.729457, - -5 + 0.528713, - 5 + -0.0616122, - -5 + 0.485624, - -3 + 0.341517, - 3 + -0.364478, - 7 + 0.124957, - -1 + -0.27282, - 5 + 0.606241, - -7 + 0.409408, - -7 + 0.326685, - 1 + -0.778263, - -5 + -0.479604, - -5 + 0.454517, - 5 + -0.236371, - -5 + -0.208087, - -7 + -0.336902, - -3 + 0.704184, - -1 + -0.607403, - -1 + 0.790341, - -1 + -0.458402, - 3 + 0.29028, - -5 + 0.608615, - -5 + 0.064577, - 7 + -0.440438, - 7 + 0.518133, - 3 + -0.400959, - -5 + 0.957821, - -3 + 0.832433, - -7 + -0.941491, - -3 + -0.158894, - -3 + 0.735858, - -5 + -0.942659, - -7 + 0.362461, - -3 + 0.175003, - -3 + 0.756938, - 5 + -0.586989, - -3 + -0.867437, - -7 + 0.204605, - 7 + -0.447344, - 7 + 0.37656, - -7 + 0.548076, - 5 + -0.720016, - -7 + -0.533887, - -1 + 0.0948688, - -1 + 0.921622, - 5 + -0.363181, - 1 + 0.875163, - 1 + -0.975703, - -7 + -0.991177, - 3 + 0.142339, - -7 + -0.670125, - 7 + 0.835181, - -7 + -0.176508, - 7 + -0.391808, - -3 + 0.659639, - -7 + 0.311382, - -5 + 0.965804, - 3 + 0.127325, - 1 + -0.000208556, - -7 + -0.777168, - -3 + 0.467445, - -7 + -0.274472, - 7 + -0.125423, - -7 + -0.341567, - -7 + -0.152778, - 3 + 0.328462, - 3 + 0.96799, - 3 + -0.863599, diff --git a/gr-atsc/src/lib/qa_atsci_viterbi_decoder_t1_output.dat b/gr-atsc/src/lib/qa_atsci_viterbi_decoder_t1_output.dat deleted file mode 100644 index 462b664b5..000000000 --- a/gr-atsc/src/lib/qa_atsci_viterbi_decoder_t1_output.dat +++ /dev/null @@ -1,2484 +0,0 @@ -69, -35, -24, -72, -92, -92, -20, -88, -31, -124, -88, -87, -65, -30, -169, -225, -0, -98, -8, -39, -35, -233, -205, -67, -15, -37, -249, -114, -194, -215, -196, -7, -251, -93, -80, -215, -186, -228, -48, -217, -97, -137, -177, -163, -168, -90, -132, -168, -189, -140, -208, -224, -118, -158, -36, -134, -196, -29, -248, -134, -245, -189, -141, -240, -26, -221, -200, -212, -194, -248, -173, -35, -130, -95, -198, -42, -185, -74, -211, -119, -215, -164, -88, -78, -66, -124, -212, -6, -154, -204, -141, -143, -137, -27, -127, -164, -249, -72, -120, -187, -64, -38, -222, -195, -133, -165, -237, -63, -240, -193, -183, -199, -101, -15, -21, -168, -140, -233, -175, -38, -182, -60, -182, -64, -87, -53, -228, -80, -126, -93, -11, -191, -132, -234, -130, -10, -143, -112, -74, -127, -49, -2, -71, -150, -18, -93, -63, -158, -71, -238, -197, -253, -43, -123, -62, -130, -177, -35, -211, -47, -129, -223, -238, -6, -202, -112, -17, -89, -224, -91, -217, -17, -94, -33, -168, -112, -126, -231, -14, -197, -214, -212, -195, -1, -79, -1, -132, -1, -36, -87, -48, -165, -55, -30, -172, -1, -143, -189, -90, -112, -24, -52, -130, -119, -85, -42, -231, -211, -18, -246, -153, -232, -202, -92, -234, -26, -93, -110, -27, -130, -197, -75, -40, -253, -106, -212, -254, -250, -145, -89, -106, -170, -141, -236, -33, -227, -23, -9, -183, -41, -255, -80, -18, -201, -172, -252, -227, -10, -107, -255, -141, -49, -74, -181, -46, -181, -138, -44, -175, -27, -133, -26, -198, -19, -6, -232, -246, -29, -241, -174, -71, -240, -254, -90, -185, -171, -87, -157, -182, -194, -157, -67, -243, -232, -248, -34, -157, -130, -78, -77, -158, -212, -103, -100, -231, -110, -76, -222, -140, -61, -140, -211, -46, -138, -46, -232, -54, -133, -133, -236, -72, -35, -47, -59, -11, -40, -94, -168, -171, -172, -246, -74, -128, -93, -174, -104, -204, -251, -70, -88, -57, -210, -44, -103, -93, -90, -79, -148, -223, -213, -129, -39, -248, -177, -99, -4, -217, -193, -172, -133, -110, -162, -207, -239, -0, -126, -87, -205, -121, -158, -37, -179, -113, -81, -27, -207, -171, -107, -99, -139, -65, -228, -178, -58, -149, -22, -62, -111, -216, -234, -244, -70, -141, -195, -54, -142, -66, -141, -91, -187, -44, -129, -111, -157, -210, -138, -108, -126, -245, -208, -9, -55, -180, -188, -113, -74, -211, -175, -185, -171, -154, -174, -242, -40, -114, -40, -183, -180, -182, -19, -112, -226, -148, -223, -128, -103, -106, -237, -229, -96, -189, -239, -151, -114, -172, -8, -189, -127, -184, -118, -43, -83, -37, -29, -123, -151, -70, -50, -76, -252, -69, -188, -223, -218, -156, -96, -65, -6, -77, -39, -102, -11, -23, -254, -125, -195, -7, -59, -67, -191, -178, -111, -18, -215, -141, -142, -111, -211, -192, -187, -208, -6, -119, -176, -225, -19, -16, -34, -26, -94, -74, -128, -105, -97, -127, -231, -37, -134, -35, -104, -69, -213, -215, -88, -172, -101, -230, -27, -56, -167, -214, -9, -174, -78, -185, -143, -98, -202, -178, -124, -40, -253, -253, -146, -94, -124, -122, -131, -2, -157, -236, -72, -114, -196, -161, -31, -41, -136, -58, -98, -47, -17, -107, -222, -96, -37, -110, -194, -239, -32, -63, -24, -29, -60, -170, -124, -185, -37, -0, -188, -195, -237, -4, -53, -178, -165, -84, -219, -45, -143, -62, -93, -161, -169, -60, -1, -206, -170, -196, -190, -203, -4, -214, -232, -65, -129, -101, -250, -166, -102, -182, -105, -83, -186, -159, -5, -96, -244, -225, -142, -132, -31, -236, -37, -201, -40, -39, -152, -210, -236, -86, -157, -240, -44, -134, -49, -173, -235, -44, -83, -81, -226, -189, -165, -157, -93, -170, -254, -81, -140, -141, -213, -171, -121, -251, -117, -161, -35, -13, -116, -16, -99, -17, -0, -144, -152, -50, -61, -132, -95, -145, -214, -66, -79, -123, -223, -172, -38, -222, -254, -178, -107, -211, -94, -229, -207, -212, -134, -242, -225, -251, -2, -69, -12, -3, -214, -164, -54, -20, -40, -149, -165, -254, -215, -245, -122, -183, -162, -160, -150, -160, -83, -1, -116, -177, -230, -67, -133, -109, -54, -103, -104, -56, -173, -117, -60, -131, -26, -115, -151, -67, -9, -61, -65, -224, -50, -188, -152, -212, -92, -46, -116, -175, -48, -232, -97, -23, -44, -231, -132, -98, -78, -237, -155, -251, -98, -215, -126, -124, -74, -22, -191, -83, -83, -1, -52, -133, -189, -205, -90, -26, -252, -207, -202, -45, -183, -43, -68, -228, -19, -201, -70, -98, -182, -225, -93, -25, -185, -220, -150, -4, -243, -86, -88, -70, -88, -141, -203, -21, -90, -38, -48, -87, -245, -250, -132, -173, -38, -200, -145, -57, -145, -215, -156, -72, -185, -250, -98, -114, -215, -248, -119, -202, -78, -207, -16, -166, -92, -220, -188, -183, -2, -237, -14, -247, -231, -146, -164, -14, -91, -53, -72, -237, -13, -228, -53, -199, -222, -151, -57, -181, -144, -177, -127, -222, -128, -143, -133, -220, -107, -66, -147, -109, -47, -162, -101, -23, -52, -9, -37, -143, -63, -110, -125, -77, -82, -179, -20, -49, -75, -78, -230, -219, -255, -102, -186, -127, -246, -64, -92, -98, -130, -240, -208, -177, -146, -53, -200, -198, -63, -238, -86, -127, -92, -212, -204, -175, -135, -224, -224, -210, -47, -199, -173, -46, -45, -104, -174, -36, -168, -10, -134, -42, -250, -86, -220, -141, -139, -165, -83, -203, -148, -170, -74, -241, -126, -22, -160, -6, -247, -128, -216, -38, -72, -134, -85, -117, -238, -3, -153, -151, -13, -32, -194, -8, -118, -158, -149, -2, -68, -233, -205, -217, -148, -23, -202, -19, -46, -106, -25, -38, -235, -241, -76, -51, -120, -162, -169, -103, -165, -66, -254, -179, -98, -192, -188, -217, -95, -82, -219, -164, -59, -169, -125, -208, -193, -71, -227, -239, -177, -252, -22, -157, -238, -98, -208, -102, -5, -121, -206, -170, -188, -204, -94, -31, -141, -26, -248, -237, -108, -212, -146, -168, -125, -15, -120, -62, -87, -91, -46, -9, -88, -68, -166, -70, -167, -118, -173, -172, -240, -124, -87, -172, -72, -181, -203, -214, -207, -196, -196, -59, -152, -86, -228, -21, -102, -92, -84, -190, -183, -131, -199, -16, -199, -110, -86, -110, -229, -4, -27, -213, -128, -114, -129, -201, -39, -77, -160, -247, -17, -100, -51, -169, -187, -23, -191, -33, -115, -20, -223, -43, -151, -167, -59, -94, -21, -146, -205, -251, -150, -233, -208, -23, -91, -82, -224, -131, -159, -129, -122, -177, -229, -173, -91, -160, -196, -27, -194, -56, -47, -162, -99, -198, -74, -159, -37, -95, -49, -243, -91, -200, -220, -43, -223, -55, -126, -192, -187, -29, -65, -53, -207, -39, -226, -42, -200, -167, -69, -138, -223, -116, -45, -67, -59, -119, -226, -97, -215, -20, -84, -50, -221, -48, -94, -188, -104, -220, -125, -35, -249, -191, -89, -200, -230, -60, -243, -175, -227, -56, -57, -195, -173, -103, -7, -233, -222, -234, -74, -181, -254, -158, -232, -219, -207, -70, -152, -56, -34, -22, -92, -28, -213, -181, -229, -188, -241, -216, -107, -213, -17, -165, -153, -190, -12, -160, -167, -235, -139, -242, -161, -138, -144, -137, -101, -96, -208, -254, -152, -242, -20, -244, -14, -234, -170, -243, -167, -155, -204, -19, -113, -221, -184, -11, -156, -197, -171, -68, -177, -55, -54, -82, -193, -199, -220, -39, -39, -172, -37, -192, -158, -58, -180, -173, -37, -94, -161, -204, -250, -109, -224, -108, -75, -153, -119, -232, -94, -35, -45, -15, -90, -99, -98, -27, -43, -62, -66, -83, -234, -104, -20, -137, -162, -201, -54, -200, -39, -215, -149, -34, -69, -117, -142, -144, -14, -6, -121, -109, -41, -166, -125, -131, -10, -223, -159, -53, -29, -225, -137, -8, -74, -157, -145, -237, -102, -200, -181, -142, -159, -74, -177, -229, -192, -64, -118, -207, -70, -239, -60, -111, -149, -185, -243, -160, -153, -146, -214, -182, -116, -95, -191, -190, -253, -80, -171, -99, -25, -97, -242, -185, -172, -163, -158, -108, -228, -20, -59, -42, -4, -120, -154, -154, -49, -141, -58, -202, -32, -16, -129, -149, -112, -65, -83, -109, -146, -255, -209, -171, -96, -196, -100, -13, -103, -2, -121, -76, -23, -181, -118, -28, -45, -17, -183, -95, -158, -241, -42, -191, -2, -172, -84, -115, -237, -168, -224, -127, -168, -178, -42, -8, -118, -142, -22, -222, -145, -143, -42, -169, -69, -160, -197, -114, -177, -124, -210, -80, -110, -252, -16, -113, -168, -101, -228, -149, -13, -197, -20, -181, -119, -63, -190, -237, -206, -212, -203, -95, -100, -245, -9, -169, -150, -207, -28, -72, -76, -238, -153, -186, -234, -169, -44, -146, -14, -17, -40, -28, -214, -61, -209, -77, -125, -144, -59, -75, -100, -6, -171, -200, -252, -180, -114, -147, -131, -142, -219, -207, -124, -117, -138, -102, -31, -183, -249, -45, -200, -34, -74, -158, -96, -27, -236, -221, -172, -39, -40, -16, -46, -212, -217, -43, -136, -75, -190, -11, -217, -154, -219, -85, -15, -102, -188, -46, -29, -182, -92, -229, -217, -166, -131, -57, -194, -112, -22, -110, -151, -63, -127, -197, -19, -88, -241, -156, -163, -175, -168, -125, -73, -131, -211, -88, -233, -143, -135, -7, -70, -227, -236, -31, -138, -112, -88, -77, -224, -111, -187, -120, -174, -59, -62, -194, -147, -47, -94, -55, -222, -6, -180, -40, -138, -135, -129, -116, -23, -8, -123, -93, -236, -103, -125, -118, -216, -213, -195, -184, -69, -127, -49, -244, -187, -111, -182, -78, -158, -21, -134, -125, -27, -59, -165, -165, -195, -38, -25, -218, -47, -149, -56, -27, -252, -181, -146, -213, -139, -86, -142, -208, -213, -191, -196, -145, -46, -123, -223, -205, -144, -102, -75, -171, -161, -240, -81, -101, -23, -107, -64, -70, -0, -120, -98, -253, -46, -244, -210, -185, -74, -96, -138, -32, -32, -78, -177, -79, -201, -145, -28, -89, -248, -103, -5, -154, -88, -87, -255, -112, -195, -63, -183, -196, -184, -25, -193, -230, -14, -148, -160, -89, -245, -42, -122, -21, -121, -43, -100, -67, -189, -129, -157, -182, -233, -162, -80, -65, -250, -80, -178, -190, -143, -105, -130, -72, -131, -67, -47, -145, -216, -208, -235, -205, -251, -101, -227, -116, -145, -71, -183, -78, -201, -84, -4, -178, -247, -85, -244, -242, -165, -166, -176, -53, -16, -50, -126, -147, -118, -173, -37, -78, -125, -16, -28, -120, -117, -0, -237, -6, -71, -164, -85, -17, -249, -90, -195, -240, -175, -184, -227, -85, -94, -147, -138, -110, -197, -8, -2, -60, -182, -39, -139, -51, -55, -167, -172, -173, -167, -153, -179, -239, -62, -9, -1, -55, -99, -196, -40, -19, -124, -12, -104, -219, -159, -243, -74, -101, -251, -76, -161, -178, -115, -44, -230, -171, -212, -146, -88, -124, -44, -12, -108, -107, -21, -109, -163, -121, -50, -204, -140, -175, -216, -244, -138, -119, -232, -213, -221, -228, -33, -127, -150, -149, -172, -124, -64, -129, -15, -153, -253, -59, -166, -105, -167, -187, -215, -74, -53, -9, -22, -193, -184, -238, -182, -67, -102, -158, -24, -68, -130, -58, -195, -24, -207, -111, -149, -16, -240, -164, -170, -238, -224, -80, -88, -135, -12, -47, -209, -65, -57, -232, -2, -242, -215, -185, -53, -62, -87, -78, -130, -218, -136, -69, -243, -87, -181, -136, -104, -166, -44, -18, -148, -13, -99, -237, -148, -111, -28, -102, -176, -86, -79, -179, -72, -38, -109, -125, -100, -197, -203, -231, -159, -83, -44, -146, -171, -226, -27, -20, -137, -72, -39, -29, -85, -138, -10, -234, -249, -39, -81, -170, -125, -160, -94, -197, -198, -203, -67, -43, -145, -15, -18, -48, -98, -63, -195, -14, -34, -222, -35, -171, -39, -74, -201, -125, -212, -212, -103, -206, -251, -185, -121, -121, -89, -215, -63, -32, -163, -130, -75, -52, -145, -94, -101, -244, -158, -40, -3, -192, -7, -38, -107, -47, -113, -52, -172, -69, -8, -20, -20, -4, -205, -141, -126, -38, -101, -189, -71, -9, -64, -147, -62, -210, -241, -163, -198, -143, -204, -202, -80, -212, -241, -187, -4, -98, -240, -176, -168, -249, -197, -188, -254, -146, -73, -124, -185, -175, -57, -1, -184, -122, -148, -246, -76, -134, -154, -19, -21, -102, -222, -102, -59, -207, -33, -63, -49, -18, -240, -218, -11, -181, -150, -9, -72, -224, -134, -2, -143, -192, -3, -71, -58, -151, -62, -135, -29, -216, -154, -51, -63, -120, -153, -123, -72, -187, -187, -122, -206, -171, -84, -218, -97, -234, -228, -169, -203, -106, -172, -90, -42, -175, -162, -101, -71, -224, -236, -101, -185, -135, -153, -248, -0, -51, -116, -72, -238, -47, -194, -189, -218, -22, -151, -60, -1, -123, -230, -204, -230, -146, -38, -17, -66, -200, -118, -137, -169, -99, -239, -98, -234, -136, -91, -234, -187, -208, -51, -170, -255, -245, -103, -218, -11, -255, -22, -12, -123, -252, -217, -97, -142, -255, -115, -208, -200, -234, -90, -114, -77, -73, -212, -56, -209, -48, -35, -141, -0, -86, -55, -0, -75, -159, -218, -87, -159, -240, -100, -26, -237, -61, -124, -124, -61, -239, -77, -6, -218, -167, -120, -39, -241, -77, -96, -195, -125, -132, -80, -126, -218, -136, -126, -38, -40, -88, -126, -199, -73, -226, -225, -55, -32, -94, -179, -94, -78, -1, -100, -40, -168, -220, -80, -154, -41, -177, -93, -167, -53, -173, -37, -16, -54, -164, -55, -94, -253, -181, -37, -70, -152, -7, -126, -184, -102, -50, -22, -180, -51, -123, -221, -220, -87, -46, -118, -129, -223, -211, -41, -20, -129, -78, -37, -183, -243, -92, -21, -240, -17, -59, -55, -169, -67, -181, -98, -170, -231, -121, -94, -27, -244, -60, -247, -76, -106, -109, -206, -73, -64, -247, -94, -193, -70, -131, -121, -57, -223, -143, -41, -241, -203, -97, -155, -14, -23, -253, -184, -255, -119, -23, -26, -108, -83, -17, -184, -190, -127, -135, -7, -191, -126, -102, -129, -196, -233, -251, -254, -200, -138, -40, -186, -85, -137, -85, -100, -160, -83, -29, -159, -202, -53, -185, -54, -137, -203, -239, -71, -74, -119, -79, -10, -245, -181, -140, -186, -158, -135, -184, -103, -18, -224, -33, -103, -106, -118, -204, -10, -201, -234, -170, -147, -31, -99, -202, -168, -47, -186, -239, -121, -50, -62, -131, -39, -243, -15, -225, -146, -151, -154, -249, -169, -123, -26, -17, -229, -145, -221, -239, -90, -199, -153, -238, -230, -253, -185, -142, -44, -116, -126, -166, -166, -189, -41, -206, -176, -57, -176, -67, -208, -74, -60, -121, -197, -87, -138, -170, -232, -104, -154, -67, -48, -52, -50, -22, -49, -236, -165, -94, -96, -36, -4, -7, -225, -46, -213, -146, -104, -133, -213, -57, -207, -18, -178, -149, -105, -61, -63, -82, -166, -218, -150, -214, -14, -200, -237, -64, -180, -147, -159, -21, -183, -164, -28, -152, -210, -241, -42, -59, -118, -0, -116, -70, -18, diff --git a/gr-atsc/src/lib/qa_convolutional_interleaver.cc b/gr-atsc/src/lib/qa_convolutional_interleaver.cc deleted file mode 100644 index bfe86f0ea..000000000 --- a/gr-atsc/src/lib/qa_convolutional_interleaver.cc +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cppunit/TestAssert.h> -#include <qa_convolutional_interleaver.h> - -void -qa_convolutional_interleaver::t0 () -{ - static int input[16] = { - 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16 - }; - - static int output[16] = { - 1, 0, 0, 0, - 5, 2, 0, 0, - 9, 6, 3, 0, - 13, 10, 7, 4 - }; - - // test interleaver - intl = new convolutional_interleaver<int>(true, 4, 1); - - for (int i = 0; i < 16; i++) - CPPUNIT_ASSERT_EQUAL (output[i], intl->transform (input[i])); -} - -void -qa_convolutional_interleaver::t1 () -{ - static int input[16] = { - 1, 0, 0, 0, - 5, 2, 0, 0, - 9, 6, 3, 0, - 13, 10, 7, 4 - }; - - static int output[16] = { - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 1, 2, 3, 4 - }; - - // test deinterleaver - intl = new convolutional_interleaver<int>(false, 4, 1); - - for (int i = 0; i < 16; i++) - CPPUNIT_ASSERT_EQUAL (output[i], intl->transform (input[i])); -} - -void -qa_convolutional_interleaver::t2 () -{ - intl = new convolutional_interleaver<int>(true, 4, 1); - deintl = new convolutional_interleaver<int>(false, 4, 1); - - int icount = 6000; - int dcount = 6000; - - int end_to_end_delay = intl->end_to_end_delay (); - for (int i = 0; i < end_to_end_delay; i++){ - CPPUNIT_ASSERT_EQUAL (0, deintl->transform (intl->transform (icount++))); - } - - for (int i = 0; i < 3 * end_to_end_delay; i++){ - CPPUNIT_ASSERT_EQUAL (dcount++, deintl->transform (intl->transform (icount++))); - } -} - -void -qa_convolutional_interleaver::t3 () -{ - intl = new convolutional_interleaver<int>(true, 4, 2); - deintl = new convolutional_interleaver<int>(false, 4, 2); - - int icount = 6000; - int dcount = 6000; - - int end_to_end_delay = intl->end_to_end_delay (); - for (int i = 0; i < end_to_end_delay; i++){ - CPPUNIT_ASSERT_EQUAL (0, deintl->transform (intl->transform (icount++))); - } - - for (int i = 0; i < 3 * end_to_end_delay; i++){ - CPPUNIT_ASSERT_EQUAL (dcount++, deintl->transform (intl->transform (icount++))); - } -} - -void -qa_convolutional_interleaver::t4 () -{ - intl = new convolutional_interleaver<int>(true, 52, 4); - deintl = new convolutional_interleaver<int>(false, 52, 4); - - int icount = 6000; - int dcount = 6000; - - int end_to_end_delay = intl->end_to_end_delay (); - CPPUNIT_ASSERT_EQUAL (10608, end_to_end_delay); - - for (int i = 0; i < end_to_end_delay; i++){ - CPPUNIT_ASSERT_EQUAL (0, deintl->transform (intl->transform (icount++))); - } - - for (int i = 0; i < 3 * end_to_end_delay; i++){ - CPPUNIT_ASSERT_EQUAL (dcount++, deintl->transform (intl->transform (icount++))); - } -} diff --git a/gr-atsc/src/lib/qa_convolutional_interleaver.h b/gr-atsc/src/lib/qa_convolutional_interleaver.h deleted file mode 100644 index b60181d73..000000000 --- a/gr-atsc/src/lib/qa_convolutional_interleaver.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_CONVOLUTIONAL_INTERLEAVER_H_ -#define _QA_CONVOLUTIONAL_INTERLEAVER_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -#include <convolutional_interleaver.h> - -class qa_convolutional_interleaver : public CppUnit::TestCase { - private: - convolutional_interleaver<int> *intl; - convolutional_interleaver<int> *deintl; - - CPPUNIT_TEST_SUITE (qa_convolutional_interleaver); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST (t4); - CPPUNIT_TEST_SUITE_END (); - - public: - - void setUp (){ - intl = 0; - deintl = 0; - } - - void tearDown (){ - delete intl; - intl = 0; - delete deintl; - deintl = 0; - } - - private: - - void t0 (); - void t1 (); - void t2 (); - void t3 (); - void t4 (); - -}; - - -#endif /* _QA_CONVOLUTIONAL_INTERLEAVER_H_ */ diff --git a/gr-atsc/src/lib/qa_interleaver_fifo.cc b/gr-atsc/src/lib/qa_interleaver_fifo.cc deleted file mode 100644 index a9de97ff3..000000000 --- a/gr-atsc/src/lib/qa_interleaver_fifo.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cppunit/TestAssert.h> -#include <qa_interleaver_fifo.h> - -void -qa_interleaver_fifo::t0 () -{ - fifo = new interleaver_fifo<int>(0); - - for (int i = 10; i < 20; i++) - CPPUNIT_ASSERT_EQUAL (i, fifo->stuff (i)); -} - -void -qa_interleaver_fifo::t1 () -{ - fifo = new interleaver_fifo<int>(1); - - CPPUNIT_ASSERT_EQUAL (0, fifo->stuff (2)); - - for (int i = 1; i < 10; i++) - CPPUNIT_ASSERT_EQUAL (i * 2, fifo->stuff ((i + 1) * 2)); -} - -void -qa_interleaver_fifo::t2 () -{ - fifo = new interleaver_fifo<int>(4); - - CPPUNIT_ASSERT_EQUAL (0, fifo->stuff (1)); - CPPUNIT_ASSERT_EQUAL (0, fifo->stuff (2)); - CPPUNIT_ASSERT_EQUAL (0, fifo->stuff (3)); - CPPUNIT_ASSERT_EQUAL (0, fifo->stuff (4)); - - for (int i = 5; i < 20; i++) - CPPUNIT_ASSERT_EQUAL (i - 4, fifo->stuff (i)); -} diff --git a/gr-atsc/src/lib/qa_interleaver_fifo.h b/gr-atsc/src/lib/qa_interleaver_fifo.h deleted file mode 100644 index 9783548ca..000000000 --- a/gr-atsc/src/lib/qa_interleaver_fifo.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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_INTERLEAVER_FIFO_H_ -#define _QA_INTERLEAVER_FIFO_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -#include <interleaver_fifo.h> - -class qa_interleaver_fifo : public CppUnit::TestCase { - private: - interleaver_fifo<int> *fifo; - - public: - - void tearDown (){ - delete fifo; - fifo = 0; - } - - CPPUNIT_TEST_SUITE (qa_interleaver_fifo); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t0 (); - void t1 (); - void t2 (); - -}; - - -#endif /* _QA_INTERLEAVER_FIFO_H_ */ diff --git a/gr-atsc/src/lib/test_atsci.cc b/gr-atsc/src/lib/test_atsci.cc deleted file mode 100644 index bf0a7eafc..000000000 --- a/gr-atsc/src/lib/test_atsci.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2006,2010,2011 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. - */ - -#include <gr_unittests.h> -#include <cppunit/TextTestRunner.h> -#include <cppunit/XmlOutputter.h> -#include <qa_atsci.h> - -int -main (int argc, char **argv) -{ - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(get_unittest_path("gr_atsc.xml").c_str()); - CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); - - runner.addTest (qa_atsc::suite ()); - runner.setOutputter(xmlout); - - bool was_successful = runner.run ("", false); - - return was_successful ? 0 : 1; -} diff --git a/gr-atsc/src/python/CMakeLists.txt b/gr-atsc/src/python/CMakeLists.txt deleted file mode 100644 index fa9f91156..000000000 --- a/gr-atsc/src/python/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2011-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. - -######################################################################## -# Install python examples -######################################################################## -include(GrPython) - -GR_PYTHON_INSTALL( - PROGRAMS - btl-fsd.py - fpll.py - interp.py - xlate.py - viterbi-out.py - DESTINATION ${GR_PKG_DATA_DIR}/examples/atsc - COMPONENT "atsc_examples" -) - -install( - FILES README - DESTINATION ${GR_PKG_DATA_DIR}/examples/atsc - COMPONENT "atsc_examples" -) - -######################################################################## -# Handle the unit tests -######################################################################## -if(ENABLE_TESTING) - -list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-atsc/src/lib -) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-atsc) - -include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) -endif(ENABLE_TESTING) diff --git a/gr-atsc/src/python/README b/gr-atsc/src/python/README deleted file mode 100644 index 74d6ba134..000000000 --- a/gr-atsc/src/python/README +++ /dev/null @@ -1,34 +0,0 @@ -Decoding ATSC using 19.2MSps rate over 5 processes --------------------------------------------------- - -1) Verify signal, adjust antenna and find best gain setting using uhd_fft.py, -station frequency from the fcc video database, and sample rate to 6.4e6. - -2) Capture data - adjust gain (-g) frequency (-f) and which side -the tvrx is on to fit your local setup: - -uhd_rx_cfile.py -s --samp-rate=6.4e6 -g 65 -f 503e6 atsc_data_6-4m_complex - -You probably still need fast disks to take the data, like a raid-0 set of -striped sata drives. Make sure there are no or very few Ou overruns. Saving -the raw usrp data in 'short' form halves the disk space/bus bandwidth that -the usual complex form uses. - -3) Make pipes: - -mkfifo /tmp/atsc_pipe_1 -mkfifo /tmp/atsc_pipe_2 -mkfifo /tmp/atsc_pipe_3 -mkfifo /tmp/atsc_pipe_4 -mkfifo /tmp/atsc_pipe_5 - -4) In seperate windows run processes: - -./interp_short.py <input rf data at 6.4Msps> -./xlate.py -./fpll.py -./btl-fsd.py -./viterbi-out.py <output mpeg transport stream> - - - diff --git a/gr-atsc/src/python/all_atsc.py b/gr-atsc/src/python/all_atsc.py deleted file mode 100644 index 0137839bd..000000000 --- a/gr-atsc/src/python/all_atsc.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env /usr/bin/python -# -# Copyright 2004 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 2, 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# -# This module starts the atsc processing chain taking the captured -# off-air signal created with: -# -# uhd_rx_cfile.py --samp-rate=6.4e6 -# -f <center of tv signal channel freq> -# -g <appropriate gain for best signal / noise> -# -s output shorts -# -# All this module does is multiply the sample rate by 3, from 6.4e6 to -# 19.2e6 complex samples / sec, then lowpass filter with a cutoff of 3.2MHz -# and a transition band width of .5MHz. Center of the tv channels is -# then at 0 with edges at -3.2MHz and 3.2MHz. - -from gnuradio import gr, atsc -import sys, os, math - -def graph (args): - - nargs = len(args) - if nargs == 2: - infile = args[0] - outfile = args[1] - else: - raise ValueError('usage: interp.py input_file output_file\n') - - tb = gr.top_block () - - # Convert to a from shorts to a stream of complex numbers. - srcf = gr.file_source (gr.sizeof_short,infile) - s2ss = gr.stream_to_streams(gr.sizeof_short,2) - s2f1 = gr.short_to_float() - s2f2 = gr.short_to_float() - src0 = gr.float_to_complex() - tb.connect(srcf, s2ss) - tb.connect((s2ss, 0), s2f1, (src0, 0)) - tb.connect((s2ss, 1), s2f2, (src0, 1)) - - # Low pass filter it and increase sample rate by a factor of 3. - lp_coeffs = gr.firdes.low_pass ( 3, 19.2e6, 3.2e6, .5e6, gr.firdes.WIN_HAMMING ) - lp = gr.interp_fir_filter_ccf ( 3, lp_coeffs ) - tb.connect(src0, lp) - - # Upconvert it. - duc_coeffs = gr.firdes.low_pass ( 1, 19.2e6, 9e6, 1e6, gr.firdes.WIN_HAMMING ) - duc = gr.freq_xlating_fir_filter_ccf ( 1, duc_coeffs, 5.75e6, 19.2e6 ) - # Discard the imaginary component. - c2f = gr.complex_to_float() - tb.connect(lp, duc, c2f) - - # Frequency Phase Lock Loop - input_rate = 19.2e6 - IF_freq = 5.75e6 - # 1/2 as wide because we're designing lp filter - symbol_rate = atsc.ATSC_SYMBOL_RATE/2. - NTAPS = 279 - tt = gr.firdes.root_raised_cosine (1.0, input_rate, symbol_rate, .115, NTAPS) - # heterodyne the low pass coefficients up to the specified bandpass - # center frequency. Note that when we do this, the filter bandwidth - # is effectively twice the low pass (2.69 * 2 = 5.38) and hence - # matches the diagram in the ATSC spec. - arg = 2. * math.pi * IF_freq / input_rate - t=[] - for i in range(len(tt)): - t += [tt[i] * 2. * math.cos(arg * i)] - rrc = gr.fir_filter_fff(1, t) - - fpll = atsc.fpll() - - pilot_freq = IF_freq - 3e6 + 0.31e6 - lower_edge = 6e6 - 0.31e6 - upper_edge = IF_freq - 3e6 + pilot_freq - transition_width = upper_edge - lower_edge - lp_coeffs = gr.firdes.low_pass (1.0, - input_rate, - (lower_edge + upper_edge) * 0.5, - transition_width, - gr.firdes.WIN_HAMMING); - - lp_filter = gr.fir_filter_fff (1,lp_coeffs) - - alpha = 1e-5 - iir = gr.single_pole_iir_filter_ff(alpha) - remove_dc = gr.sub_ff() - - tb.connect(c2f, fpll, lp_filter) - tb.connect(lp_filter, iir) - tb.connect(lp_filter, (remove_dc,0)) - tb.connect(iir, (remove_dc,1)) - - # Bit Timing Loop, Field Sync Checker and Equalizer - - btl = atsc.bit_timing_loop() - fsc = atsc.fs_checker() - eq = atsc.equalizer() - fsd = atsc.field_sync_demux() - - tb.connect(remove_dc, btl) - tb.connect((btl, 0),(fsc, 0),(eq, 0),(fsd, 0)) - tb.connect((btl, 1),(fsc, 1),(eq, 1),(fsd, 1)) - - # Viterbi - - viterbi = atsc.viterbi_decoder() - deinter = atsc.deinterleaver() - rs_dec = atsc.rs_decoder() - derand = atsc.derandomizer() - depad = atsc.depad() - dst = gr.file_sink(gr.sizeof_char, outfile) - tb.connect(fsd, viterbi, deinter, rs_dec, derand, depad, dst) - - dst2 = gr.file_sink(gr.sizeof_gr_complex, "atsc_complex.data") - tb.connect(src0, dst2) - - tb.run () - -if __name__ == '__main__': - graph (sys.argv[1:]) - - diff --git a/gr-atsc/src/python/atsc_utils.py b/gr-atsc/src/python/atsc_utils.py deleted file mode 100644 index fced6d190..000000000 --- a/gr-atsc/src/python/atsc_utils.py +++ /dev/null @@ -1,74 +0,0 @@ -# -# Copyright 2006 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. -# - -import random -import sys - -MPEG_SYNC_BYTE = 0x47 - -def make_fake_transport_stream_packet(npkts): - """ - Return a sequence of 8-bit ints that represents an MPEG Transport Stream packet. - - @param npkts: how many 188-byte packets to return - - FYI, each ATSC Data Frame contains two Data Fields, each of which contains - 312 data segments. Each transport stream packet maps to a data segment. - """ - r = [0] * (npkts * 188) - i = 0 - for j in range(npkts): - r[i+0] = MPEG_SYNC_BYTE - r[i+1] = random.randint(0, 127) # top bit (transport error bit) clear - i = i + 2 - for n in range(186): - r[i + n] = random.randint(0, 255) - i = i + 186 - - return r - - -def pad_stream(src, sizeof_total, sizeof_pad): - sizeof_valid = sizeof_total - sizeof_pad - assert sizeof_valid > 0 - assert (len(src) % sizeof_valid) == 0 - npkts = len(src) // sizeof_valid - dst = [0] * (npkts * sizeof_total) - for i in range(npkts): - src_s = i * sizeof_valid - dst_s = i * sizeof_total - dst[dst_s:dst_s + sizeof_valid] = src[src_s:src_s + sizeof_valid] - return dst - - -def depad_stream(src, sizeof_total, sizeof_pad): - sizeof_valid = sizeof_total - sizeof_pad - assert sizeof_valid > 0 - assert (len(src) % sizeof_total) == 0 - npkts = len(src) // sizeof_total - dst = [0] * (npkts * sizeof_valid) - for i in range(npkts): - src_s = i * sizeof_total - dst_s = i * sizeof_valid - dst[dst_s:dst_s + sizeof_valid] = src[src_s:src_s + sizeof_valid] - return dst - - diff --git a/gr-atsc/src/python/btl-fsd.py b/gr-atsc/src/python/btl-fsd.py deleted file mode 100755 index 826e71016..000000000 --- a/gr-atsc/src/python/btl-fsd.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# - -from gnuradio import gr -from gnuradio import atsc -import os - -print os.getpid() - -tb = gr.top_block() - -btl = atsc.bit_timing_loop() -fsc = atsc.fs_checker() -eq = atsc.equalizer() -fsd = atsc.field_sync_demux() - -out_data = gr.file_sink(atsc.sizeof_atsc_soft_data_segment,"/tmp/atsc_pipe_5") - -inp = gr.file_source(gr.sizeof_float,"/tmp/atsc_pipe_3") - -tb.connect(inp,btl) -tb.connect((btl,0),(fsc,0),(eq,0),(fsd,0)) -tb.connect((btl,1),(fsc,1),(eq,1),(fsd,1)) -tb.connect(fsd,out_data) - -tb.run() - - diff --git a/gr-atsc/src/python/fpll.py b/gr-atsc/src/python/fpll.py deleted file mode 100755 index aed975557..000000000 --- a/gr-atsc/src/python/fpll.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# - -from gnuradio import gr, atsc -import math, os - -def main(): - - print os.getpid() - - tb = gr.top_block() - - u = gr.file_source(gr.sizeof_float,"/tmp/atsc_pipe_2") - - input_rate = 19.2e6 - IF_freq = 5.75e6 - - - # 1/2 as wide because we're designing lp filter - symbol_rate = atsc.ATSC_SYMBOL_RATE/2. - NTAPS = 279 - tt = gr.firdes.root_raised_cosine (1.0, input_rate, symbol_rate, .115, NTAPS) - # heterodyne the low pass coefficients up to the specified bandpass - # center frequency. Note that when we do this, the filter bandwidth - # is effectively twice the low pass (2.69 * 2 = 5.38) and hence - # matches the diagram in the ATSC spec. - arg = 2. * math.pi * IF_freq / input_rate - t=[] - for i in range(len(tt)): - t += [tt[i] * 2. * math.cos(arg * i)] - rrc = gr.fir_filter_fff(1, t) - - fpll = atsc.fpll() - - pilot_freq = IF_freq - 3e6 + 0.31e6 - lower_edge = 6e6 - 0.31e6 - upper_edge = IF_freq - 3e6 + pilot_freq - transition_width = upper_edge - lower_edge - lp_coeffs = gr.firdes.low_pass (1.0, - input_rate, - (lower_edge + upper_edge) * 0.5, - transition_width, - gr.firdes.WIN_HAMMING); - - lp_filter = gr.fir_filter_fff (1,lp_coeffs) - - alpha = 1e-5 - iir = gr.single_pole_iir_filter_ff(alpha) - remove_dc = gr.sub_ff() - - out = gr.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_3") - # out = gr.file_sink(gr.sizeof_float,"/mnt/sata/atsc_data_float") - - tb.connect(u, fpll, lp_filter) - tb.connect(lp_filter, iir) - tb.connect(lp_filter, (remove_dc,0)) - tb.connect(iir, (remove_dc,1)) - tb.connect(remove_dc, out) - - tb.run() - - -if __name__ == '__main__': - main () - - - diff --git a/gr-atsc/src/python/interp.py b/gr-atsc/src/python/interp.py deleted file mode 100755 index 8a3cc8d4c..000000000 --- a/gr-atsc/src/python/interp.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env /usr/bin/python -# -# Copyright 2004,2007 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# -# This module starts the atsc processing chain taking the captured -# off-air signal created with: -# -# uhd_rx_cfile.py --samp-rate=6.4e6 -# -f <center of tv signal channel freq> -# -g <appropriate gain for best signal / noise> -# -# All this module does is multiply the sample rate by 3, from 6.4e6 to -# 19.2e6 complex samples / sec, then lowpass filter with a cutoff of 3.2MHz -# and a transition band width of .5MHz. Center of the tv channels is -# then at 0 with edges at -3.2MHz and 3.2MHz. - -from gnuradio import gr -import sys - -def graph (args): - - nargs = len (args) - if nargs == 1: - infile = args[0] - else: - sys.stderr.write('usage: interp.py input_file\n') - sys.exit (1) - - tb = gr.top_block () - - src0 = gr.file_source (gr.sizeof_gr_complex,infile) - - lp_coeffs = gr.firdes.low_pass ( 3, 19.2e6, 3.2e6, .5e6, gr.firdes.WIN_HAMMING ) - lp = gr.interp_fir_filter_ccf ( 1, lp_coeffs ) - - file = gr.file_sink(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1") - - tb.connect( src0, lp, file ) - - tb.start() - raw_input ('Head End: Press Enter to stop') - tb.stop() - -if __name__ == '__main__': - graph (sys.argv[1:]) - - diff --git a/gr-atsc/src/python/interp_short.py b/gr-atsc/src/python/interp_short.py deleted file mode 100755 index c5ea337f9..000000000 --- a/gr-atsc/src/python/interp_short.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env /usr/bin/python -# -# Copyright 2004 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 2, 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# -# This module starts the atsc processing chain taking the captured -# off-air signal created with: -# -# uhd_rx_cfile.py --samp-rate=6.4e6 -# -f <center of tv signal channel freq> -# -g <appropriate gain for best signal / noise> -# -s output shorts -# -# All this module does is multiply the sample rate by 3, from 6.4e6 to -# 19.2e6 complex samples / sec, then lowpass filter with a cutoff of 3.2MHz -# and a transition band width of .5MHz. Center of the tv channels is -# then at 0 with edges at -3.2MHz and 3.2MHz. - -from gnuradio import gr -import sys, os - -def graph (args): - - print os.getpid() - - nargs = len (args) - if nargs == 1: - infile = args[0] - else: - sys.stderr.write('usage: interp.py input_file\n') - sys.exit (1) - - tb = gr.top_block () - - srcf = gr.file_source (gr.sizeof_short,infile) - s2ss = gr.stream_to_streams(gr.sizeof_short,2) - s2f1 = gr.short_to_float() - s2f2 = gr.short_to_float() - src0 = gr.float_to_complex() - - - lp_coeffs = gr.firdes.low_pass ( 3, 19.2e6, 3.2e6, .5e6, gr.firdes.WIN_HAMMING ) - lp = gr.interp_fir_filter_ccf ( 3, lp_coeffs ) - - file = gr.file_sink(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1") - - tb.connect( srcf, s2ss ) - tb.connect( (s2ss, 0), s2f1, (src0,0) ) - tb.connect( (s2ss, 1), s2f2, (src0,1) ) - tb.connect( src0, lp, file) - - tb.start() - raw_input ('Head End: Press Enter to stop') - tb.stop() - -if __name__ == '__main__': - graph (sys.argv[1:]) - - diff --git a/gr-atsc/src/python/qa_atsc.py b/gr-atsc/src/python/qa_atsc.py deleted file mode 100755 index c6b8d2e95..000000000 --- a/gr-atsc/src/python/qa_atsc.py +++ /dev/null @@ -1,222 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2006,2007 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. -# - -from gnuradio import gr, gr_unittest -import atsc # qa code needs to run without being installed -#from gnuradio import atsc -from atsc_utils import * -import sys - - -class memoize(object): - def __init__(self, thunk): - self.thunk = thunk - self.cached = False - self.value = None - - def __call__(self): - if self.cached: - return self.value - self.value = self.thunk() - self.cached = True - return self.value - - -""" -Make a fake transport stream that's big enough for our purposes. -We generate 8 full fields. This is relatively expensive. It -takes about 2 seconds to execute. -""" -make_transport_stream = \ - memoize(lambda : tuple(make_fake_transport_stream_packet(8 * atsc.ATSC_DSEGS_PER_FIELD))) - - -def pad_transport_stream(src): - """ - An MPEG transport stream packet is 188 bytes long. Internally we use a packet - that is 256 bytes long to help with buffer alignment. This function adds the - appropriate trailing padding to convert each packet from 188 to 256 bytes. - """ - return pad_stream(src, atsc.sizeof_atsc_mpeg_packet, atsc.sizeof_atsc_mpeg_packet_pad) - - -def depad_transport_stream(src): - """ - An MPEG transport stream packet is 188 bytes long. Internally we use a packet - that is 256 bytes long to help with buffer alignment. This function removes the - trailing padding to convert each packet from 256 back to 188 bytes. - """ - return depad_stream(src, atsc.sizeof_atsc_mpeg_packet, atsc.sizeof_atsc_mpeg_packet_pad) - - -class vector_source_ts(gr.hier_block2): - """ - MPEG Transport stream source for testing. - """ - def __init__(self, ts): - """ - Pad tranport stream packets to 256 bytes and reformat appropriately. - - @param ts: MPEG transport stream. - @type ts: sequence of ints in [0,255]; len(ts) % 188 == 0 - """ - - src = gr.vector_source_b(pad_transport_stream(ts)) - s2v = gr.stream_to_vector(gr.sizeof_char, atsc.sizeof_atsc_mpeg_packet) - - gr.hier_block2.__init__(self, "vector_source_ts", - gr.io_signature(0, 0, 0), - s2v.output_signature()) - self.connect(src, s2v, self) - - -class vector_sink_ts(gr.hier_block2): - """ - MPEG Transport stream sink for testing. - """ - def __init__(self): - """ - """ - - v2s = gr.vector_to_stream(gr.sizeof_char, atsc.sizeof_atsc_mpeg_packet) - self.sink = gr.vector_sink_b() - gr.hier_block2.__init__(self, "vector_sink_ts", - v2s.input_signature(), - gr.io_signature(0, 0, 0)) - self.connect(self, v2s, self.sink) - - def data(self): - """ - Extracts tranport stream from sink and returns it to python. - - Depads tranport stream packets from 256 back to 188 bytes. - @rtype: tuple of ints in [0,255]; len(result) % 188 == 0 - """ - return tuple(depad_transport_stream(self.sink.data())) - - - -class qa_atsc(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - - # The tests are run in alphabetical order - - def test_loopback_000(self): - """ - Loopback randomizer to derandomizer - """ - src_data = make_transport_stream() - expected_result = src_data - - src = vector_source_ts(src_data) - rand = atsc.randomizer() - derand = atsc.derandomizer() - dst = vector_sink_ts() - self.tb.connect(src, rand, derand, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (expected_result, result_data) - - def test_loopback_001(self): - """ - Loopback randomizer/rs_encoder to rs_decoder/derandomizer - """ - src_data = make_transport_stream() - expected_result = src_data - - src = vector_source_ts(src_data) - rand = atsc.randomizer() - rs_enc = atsc.rs_encoder() - rs_dec = atsc.rs_decoder() - derand = atsc.derandomizer() - dst = vector_sink_ts() - self.tb.connect(src, rand, rs_enc, rs_dec, derand, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (expected_result, result_data) - - def test_loopback_002(self): - """ - Loopback randomizer/rs_encoder/interleaver to - deinterleaver/rs_decoder/derandomizer - """ - src_data = make_transport_stream() - interleaver_delay = 52 - expected_result = src_data[0:len(src_data)-(interleaver_delay*atsc.ATSC_MPEG_PKT_LENGTH)] - - src = vector_source_ts(src_data) - rand = atsc.randomizer() - rs_enc = atsc.rs_encoder() - inter = atsc.interleaver() - deinter = atsc.deinterleaver() - rs_dec = atsc.rs_decoder() - derand = atsc.derandomizer() - dst = vector_sink_ts() - self.tb.connect(src, rand, rs_enc, inter, deinter, rs_dec, derand, dst) - self.tb.run () - result_data = dst.data () - result_data = result_data[(interleaver_delay*atsc.ATSC_MPEG_PKT_LENGTH):len(result_data)] - self.assertEqual (expected_result, result_data) - - - def test_loopback_003(self): - """ - Loopback randomizer/rs_encoder/interleaver/trellis_encoder - via ds_to_softds to - viterbi_decoder/deinterleaver/rs_decoder/derandomizer - """ - src_data = make_transport_stream() - interleaver_delay = 52 - viterbi_delay = 12 - expected_result = src_data[0:len(src_data)-((interleaver_delay+viterbi_delay)*atsc.ATSC_MPEG_PKT_LENGTH)] - - src = vector_source_ts(src_data) - rand = atsc.randomizer() - rs_enc = atsc.rs_encoder() - inter = atsc.interleaver() - trellis = atsc.trellis_encoder() - softds = atsc.ds_to_softds() - viterbi = atsc.viterbi_decoder() - deinter = atsc.deinterleaver() - rs_dec = atsc.rs_decoder() - derand = atsc.derandomizer() - dst = vector_sink_ts() - self.tb.connect(src, rand, rs_enc, inter, trellis, softds, viterbi, deinter, rs_dec, derand, dst) - self.tb.run () - result_data = dst.data ()[((interleaver_delay+viterbi_delay)*atsc.ATSC_MPEG_PKT_LENGTH):len(dst.data())] - self.assertEqual (expected_result, result_data) - - -if __name__ == '__main__': - gr_unittest.main() - - - - - - diff --git a/gr-atsc/src/python/viterbi-out.py b/gr-atsc/src/python/viterbi-out.py deleted file mode 100755 index 67edd99b2..000000000 --- a/gr-atsc/src/python/viterbi-out.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2006,2007 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# - -from gnuradio import gr, atsc -import sys, os - -def main(args): - - print os.getpid() - - nargs = len (args) - if nargs == 1: - outfile = args[0] - else: - sys.stderr.write ('usage: viterbi_out.py output_file\n') - sys.exit (1) - - tb = gr.top_block() - - src = gr.file_source(atsc.sizeof_atsc_soft_data_segment, "/tmp/atsc_pipe_5") - viterbi = atsc.viterbi_decoder() - deinter = atsc.deinterleaver() - rs_dec = atsc.rs_decoder() - derand = atsc.derandomizer() - depad = atsc.depad() - dst = gr.file_sink(gr.sizeof_char,outfile) - tb.connect(src, viterbi, deinter, rs_dec, derand, depad, dst) - tb.run () - - -if __name__ == '__main__': - main(sys.argv[1:]) - - - - - - diff --git a/gr-atsc/src/python/xlate.py b/gr-atsc/src/python/xlate.py deleted file mode 100755 index 68e280a8c..000000000 --- a/gr-atsc/src/python/xlate.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env /usr/bin/python -# -# Copyright 2004,2007 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# -# This module upconverts the 19.2e6 sample rate signal from a center -# of 0 to 5.75e6 and converts to float, to prepare the signal for -# the old gnuradio 0.9 block (bit timing loop, field sync checker, -# equalizer and field sync demux), effectively simulating an -# mc4020 card, except the sample rate is 19.2e6 instead of 20e6. -# -# The signal is then centered on 5.75e6 with edges at 5.75 + 3.2 = 8.95MHz -# and 5.75 - 3.2 = 2.55Mhz, low pass filtered with cutoff at 9Mhz and a -# transition band width of 1Mhz. -# -# Input complex -3.2 to 3.2Mhz, output float 2.55 to 8.95Mhz. - -from gnuradio import gr -import os - -def graph (): - print os.getpid() - sampling_freq = 19200000 - - tb = gr.top_block () - - src0 = gr.file_source (gr.sizeof_gr_complex,"/tmp/atsc_pipe_1") - - duc_coeffs = gr.firdes.low_pass ( 1, 19.2e6, 9e6, 1e6, gr.firdes.WIN_HAMMING ) - duc = gr.freq_xlating_fir_filter_ccf ( 1, duc_coeffs, 5.75e6, 19.2e6 ) - - c2f = gr.complex_to_float() - file = gr.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_2") - - tb.connect( src0, duc, c2f, file ) - - tb.run() - -if __name__ == '__main__': - graph () diff --git a/gr-audio/CMakeLists.txt b/gr-audio/CMakeLists.txt deleted file mode 100644 index 35fd7fc23..000000000 --- a/gr-audio/CMakeLists.txt +++ /dev/null @@ -1,112 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) -GR_REGISTER_COMPONENT("gr-audio" ENABLE_GR_AUDIO - Boost_FOUND - ENABLE_GR_CORE -) - -GR_SET_GLOBAL(GR_AUDIO_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) - -SET(GR_PKG_AUDIO_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/audio) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_AUDIO) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_AUDIO_DESCRIPTION "GNU Radio Audio Blocks") - -CPACK_COMPONENT("audio_runtime" - GROUP "Audio" - DISPLAY_NAME "Runtime" - DESCRIPTION "Runtime" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("audio_devel" - GROUP "Audio" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("audio_python" - GROUP "Audio" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime; GRC xml files" - DEPENDS "core_python;audio_runtime" -) - -CPACK_COMPONENT("audio_examples" - GROUP "Audio" - DISPLAY_NAME "Examples" - DESCRIPTION "Example programs" - DEPENDS "audio_runtime" -) - -CPACK_COMPONENT("audio_swig" - GROUP "Audio" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;audio_python;audio_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(include) -add_subdirectory(lib) -add_subdirectory(doc) -add_subdirectory(examples/c++) -if(ENABLE_PYTHON) - add_subdirectory(swig) - add_subdirectory(grc) - add_subdirectory(examples/python) - add_subdirectory(examples/grc) -endif(ENABLE_PYTHON) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-audio.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-audio.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-audio.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "audio_devel" -) - -endif(ENABLE_GR_AUDIO) diff --git a/gr-audio/README b/gr-audio/README deleted file mode 100644 index ae929a94a..000000000 --- a/gr-audio/README +++ /dev/null @@ -1,11 +0,0 @@ -The gnuradio audio component provides an audio_source and audio_sink block. -The audio blocks stream floating point samples to and from audio hardware. - -The gr-audio will be built automatically when gnuradio-core is enabled. -Support for underlying audio architectures depends on OS and installed libraries. -At the time of writing, gr-audio supports oss, alsa, jack, portaudio, audiounit, and winmm. - -At runtime, gr-audio will automatically select from the available architectures. -The user can override the selection via configuration file by setting "audio_module" -to one of the following strings: oss, alsa, jack, portaudio, osx, or windows. -See gr-audio.conf for an example. diff --git a/gr-audio/doc/CMakeLists.txt b/gr-audio/doc/CMakeLists.txt deleted file mode 100644 index 483554a0e..000000000 --- a/gr-audio/doc/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2011 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. - -install( - FILES README.audio - DESTINATION ${GR_PKG_DOC_DIR} -) diff --git a/gr-audio/doc/README.audio b/gr-audio/doc/README.audio deleted file mode 100644 index 754c849c8..000000000 --- a/gr-audio/doc/README.audio +++ /dev/null @@ -1,20 +0,0 @@ -This is the gr-audio package. This package includes all of the -supported audio interfaces, including: - - alsa - - oss - - jack - - portaudio - - osx - - windows - -Typically, the audio package will auto-detect the proper driver to use -based on the system it is run on. Import this package with: - - from gnuradio import audio - -See the Doxygen documentation for details about the blocks available -in this package. A quick listing of the details can be found in Python -after importing by using: - - help(audio) - diff --git a/gr-audio/doc/audio.dox b/gr-audio/doc/audio.dox deleted file mode 100644 index 3a0cb5e48..000000000 --- a/gr-audio/doc/audio.dox +++ /dev/null @@ -1,51 +0,0 @@ -/*! \page page_audio Audio Interface - -\section Introduction - -This is the gr-audio package. This package includes all of the -supported audio interfaces, including: - -\li alsa -\li oss -\li jack -\li portaudio -\li osx -\li windows - -\code - from gnuradio import audio -\endcode - -See the Doxygen documentation for details about the blocks available -in this package. The relevant blocks are listed in the \ref audio_blk group. - -A quick listing of the details can be found in Python after importing -by using: - -\code - help(digital) -\endcode - - -\section Usage -For an audio source, a typical OptionParser option and it's use looks -like: - -\code - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") - audio_rate = 32e3 - audio_sink = audio.sink (int (audio_rate), options.audio_output) -\endcode - -Similarly, an audio sink would have a typical OptionParser option and -its use would look like: - -\code - parser.add_option("-I", "--audio-input", type="string", default="", - help="pcm input device name. E.g., hw:0,0 or /dev/dsp") - audio_rate = 32e3 - audio_source = audio.source(int(audio_rate), audio_input) -\endcode - -*/ diff --git a/gr-audio/examples/c++/CMakeLists.txt b/gr-audio/examples/c++/CMakeLists.txt deleted file mode 100644 index d4ce0bef4..000000000 --- a/gr-audio/examples/c++/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2011 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. - -include_directories( - ${GR_AUDIO_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) -add_executable(dial_tone dial_tone.cc) -target_link_libraries(dial_tone gnuradio-audio ${GRAS_LIBRARIES}) - -INSTALL(TARGETS - dial_tone - DESTINATION ${GR_PKG_AUDIO_EXAMPLES_DIR} - COMPONENT "audio_examples" -) diff --git a/gr-audio/examples/c++/dial_tone.cc b/gr-audio/examples/c++/dial_tone.cc deleted file mode 100644 index 4cd0ff59c..000000000 --- a/gr-audio/examples/c++/dial_tone.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2011 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. - */ - - -/* - * GNU Radio C++ example creating dial tone - * ("the simplest thing that could possibly work") - * - * Send a tone each to the left and right channels of stereo audio - * output and let the user's brain sum them. - * - * GNU Radio makes extensive use of Boost shared pointers. Signal processing - * blocks are typically created by calling a "make" factory function, which - * returns an instance of the block as a typedef'd shared pointer that can - * be used in any way a regular pointer can. Shared pointers created this way - * keep track of their memory and free it at the right time, so the user - * doesn't need to worry about it (really). - * - */ - -// Include header files for each block used in flowgraph -#include <gr_top_block.h> -#include <gr_sig_source_f.h> -#include <gr_audio_sink.h> - -int main(int argc, char **argv) -{ - int rate = 48000; // Audio card sample rate - float ampl = 0.1; // Don't exceed 0.5 or clipping will occur - - // Construct a top block that will contain flowgraph blocks. Alternatively, - // one may create a derived class from gr_top_block and hold instantiated blocks - // as member data for later manipulation. - gr_top_block_sptr tb = gr_make_top_block("dial_tone"); - - // Construct a real-valued signal source for each tone, at given sample rate - gr_sig_source_f_sptr src0 = gr_make_sig_source_f(rate, GR_SIN_WAVE, 350, ampl); - gr_sig_source_f_sptr src1 = gr_make_sig_source_f(rate, GR_SIN_WAVE, 440, ampl); - - // Construct an audio sink to accept audio tones - audio_sink::sptr sink = audio_make_sink(rate); - - // Connect output #0 of src0 to input #0 of sink (left channel) - tb->connect(src0, 0, sink, 0); - - // Connect output #0 of src1 to input #1 of sink (right channel) - tb->connect(src1, 0, sink, 1); - - // Tell GNU Radio runtime to start flowgraph threads; the foreground thread - // will block until either flowgraph exits (this example doesn't) or the - // application receives SIGINT (e.g., user hits CTRL-C). - // - // Real applications may use tb->start() which returns, allowing the foreground - // thread to proceed, then later use tb->stop(), followed by tb->wait(), to cleanup - // GNU Radio before exiting. - tb->run(); - - // Exit normally. - return 0; -} diff --git a/gr-audio/examples/grc/CMakeLists.txt b/gr-audio/examples/grc/CMakeLists.txt deleted file mode 100644 index 179b42fcc..000000000 --- a/gr-audio/examples/grc/CMakeLists.txt +++ /dev/null @@ -1,27 +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. - -install( - FILES - cvsd_sweep.grc - dial_tone.grc - DESTINATION ${GR_PKG_AUDIO_EXAMPLES_DIR} - COMPONENT "audio_python" -) - diff --git a/gr-audio/examples/grc/cvsd_sweep.grc b/gr-audio/examples/grc/cvsd_sweep.grc deleted file mode 100644 index b645b747a..000000000 --- a/gr-audio/examples/grc/cvsd_sweep.grc +++ /dev/null @@ -1,918 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sat Sep 19 20:30:08 2009</timestamp> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import math</value> - </param> - <param> - <key>_coordinate</key> - <value>(157, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>vocoder_cvsd_decode_bf</key> - <param> - <key>id</key> - <value>vocoder_cvsd_decode_bf_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>resample</key> - <value>resample</value> - </param> - <param> - <key>bw</key> - <value>bw</value> - </param> - <param> - <key>_coordinate</key> - <value>(887, 340)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>tri_source</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>audio_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_TRI_WAVE</value> - </param> - <param> - <key>freq</key> - <value>0.05</value> - </param> - <param> - <key>amp</key> - <value>0.5</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(44, 316)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>throttle</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>audio_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(238, 348)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_vco_f</key> - <param> - <key>id</key> - <value>vco</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>samp_rate</key> - <value>audio_rate</value> - </param> - <param> - <key>sensitivity</key> - <value>audio_rate*2*math.pi</value> - </param> - <param> - <key>amplitude</key> - <value>0.9</value> - </param> - <param> - <key>_coordinate</key> - <value>(427, 332)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>vocoder_cvsd_encode_fb</key> - <param> - <key>id</key> - <value>enc</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>resample</key> - <value>resample</value> - </param> - <param> - <key>bw</key> - <value>bw</value> - </param> - <param> - <key>_coordinate</key> - <value>(655, 340)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_packed_to_unpacked_xx</key> - <param> - <key>id</key> - <value>p2u</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>bits_per_chunk</key> - <value>1</value> - </param> - <param> - <key>endianness</key> - <value>gr.GR_MSB_FIRST</value> - </param> - <param> - <key>_coordinate</key> - <value>(648, 415)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>gr_char_to_float</key> - <param> - <key>id</key> - <value>c2f</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(676, 483)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>audio_sink</key> - <param> - <key>id</key> - <value>audio_sink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>samp_rate</key> - <value>audio_rate</value> - </param> - <param> - <key>device_name</key> - <value>plughw:0,0</value> - </param> - <param> - <key>ok_to_block</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1127, 340)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>audio_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>8000</value> - </param> - <param> - <key>_coordinate</key> - <value>(251, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>resample</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>8</value> - </param> - <param> - <key>_coordinate</key> - <value>(344, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>bw</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.5</value> - </param> - <param> - <key>_coordinate</key> - <value>(431, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>displays</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['Original','Encoded','Decoded']</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(12, 106)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>orig_fft</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Original Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>audio_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 0</value> - </param> - <param> - <key>_coordinate</key> - <value>(415, 97)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>orig_scope</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Original Waveform</value> - </param> - <param> - <key>samp_rate</key> - <value>audio_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 0</value> - </param> - <param> - <key>_coordinate</key> - <value>(414, 425)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>enc_fft</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Encoded Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>audio_rate*resample</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>8</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 1</value> - </param> - <param> - <key>_coordinate</key> - <value>(610, 551)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>enc_scope</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Encoded Waveform</value> - </param> - <param> - <key>samp_rate</key> - <value>audio_rate*resample</value> - </param> - <param> - <key>v_scale</key> - <value>0.5</value> - </param> - <param> - <key>t_scale</key> - <value>20.0/(audio_rate*resample)</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 1</value> - </param> - <param> - <key>_coordinate</key> - <value>(858, 591)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>dec_fft</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Decoded Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>audio_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>5</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>0.1</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 2</value> - </param> - <param> - <key>_coordinate</key> - <value>(891, 98)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>dec_scope</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Decoded Waveform</value> - </param> - <param> - <key>samp_rate</key> - <value>audio_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 2</value> - </param> - <param> - <key>_coordinate</key> - <value>(889, 422)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>options</key> - <param> - <key>id</key> - <value>cvsd_sweep</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>CVSD Vocoder Test</value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>vco</source_block_id> - <sink_block_id>orig_fft</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>tri_source</source_block_id> - <sink_block_id>throttle</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>throttle</source_block_id> - <sink_block_id>vco</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>vco</source_block_id> - <sink_block_id>enc</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>enc</source_block_id> - <sink_block_id>vocoder_cvsd_decode_bf_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>vco</source_block_id> - <sink_block_id>orig_scope</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>vocoder_cvsd_decode_bf_0</source_block_id> - <sink_block_id>dec_fft</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>vocoder_cvsd_decode_bf_0</source_block_id> - <sink_block_id>dec_scope</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>vocoder_cvsd_decode_bf_0</source_block_id> - <sink_block_id>audio_sink</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>enc</source_block_id> - <sink_block_id>p2u</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>p2u</source_block_id> - <sink_block_id>c2f</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>c2f</source_block_id> - <sink_block_id>enc_fft</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>c2f</source_block_id> - <sink_block_id>enc_scope</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-audio/examples/grc/dial_tone.grc b/gr-audio/examples/grc/dial_tone.grc deleted file mode 100644 index ac8cbef27..000000000 --- a/gr-audio/examples/grc/dial_tone.grc +++ /dev/null @@ -1,375 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Jul 24 14:27:48 2008</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>dial_tone</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Dial Tone</value> - </param> - <param> - <key>author</key> - <value>Example</value> - </param> - <param> - <key>description</key> - <value>example flow graph</value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>num_inputs</key> - <value>3</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(513, 277)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>audio_sink</key> - <param> - <key>id</key> - <value>audio_sink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>samp_rate</key> - <value>32000</value> - </param> - <param> - <key>device_name</key> - <value/> - </param> - <param> - <key>ok_to_block</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(699, 112)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noise</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(238, 380)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>440</value> - </param> - <param> - <key>amp</key> - <value>ampl</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(240, 208)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>350</value> - </param> - <param> - <key>amp</key> - <value>ampl</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(240, 38)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>ampl</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Volume</value> - </param> - <param> - <key>value</key> - <value>.4</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>.5</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>slider_type</key> - <value>horizontal</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 2</value> - </param> - <param> - <key>_coordinate</key> - <value>(634, 413)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>noise</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Noise</value> - </param> - <param> - <key>value</key> - <value>.005</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>.2</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>slider_type</key> - <value>horizontal</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 2</value> - </param> - <param> - <key>_coordinate</key> - <value>(443, 412)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32000</value> - </param> - <param> - <key>_coordinate</key> - <value>(11, 171)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_sig_source_x0</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sig_source_x</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>2</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx</source_block_id> - <sink_block_id>audio_sink</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-audio/examples/python/CMakeLists.txt b/gr-audio/examples/python/CMakeLists.txt deleted file mode 100644 index 24e29e234..000000000 --- a/gr-audio/examples/python/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2011 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. - -include(GrPython) - -GR_PYTHON_INSTALL(PROGRAMS - audio_copy.py - audio_fft.py - audio_play.py - audio_to_file.py - dial_tone.py - dial_tone_daemon.py - dial_tone_wav.py - mono_tone.py - multi_tone.py - noise.py - spectrum_inversion.py - test_resampler.py - DESTINATION ${GR_PKG_AUDIO_EXAMPLES_DIR} - COMPONENT "audio_python" -) diff --git a/gr-audio/examples/python/audio_copy.py b/gr-audio/examples/python/audio_copy.py deleted file mode 100755 index 946aae1c2..000000000 --- a/gr-audio/examples/python/audio_copy.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-I", "--audio-input", type="string", default="", - help="pcm input device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, - help="set sample rate to RATE (48000)") - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - sample_rate = int(options.sample_rate) - src = audio.source (sample_rate, options.audio_input) - dst = audio.sink (sample_rate, options.audio_output) - - # Determine the maximum number of outputs on the source and - # maximum number of inputs on the sink, then connect together - # the most channels we can without overlap - nchan = min (src.output_signature().max_streams(), - dst.input_signature().max_streams()) - - for i in range (nchan): - self.connect ((src, i), (dst, i)) - - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass - diff --git a/gr-audio/examples/python/audio_fft.py b/gr-audio/examples/python/audio_fft.py deleted file mode 100755 index 519963da5..000000000 --- a/gr-audio/examples/python/audio_fft.py +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007 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. -# - -from gnuradio import gr, gru, audio -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import stdgui2, fftsink2, waterfallsink2, scopesink2, form, slider -from optparse import OptionParser -import wx -import sys - -class app_top_block(stdgui2.std_top_block): - def __init__(self, frame, panel, vbox, argv): - stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv) - - self.frame = frame - self.panel = panel - - parser = OptionParser(option_class=eng_option) - parser.add_option("-W", "--waterfall", action="store_true", default=False, - help="Enable waterfall display") - parser.add_option("-S", "--oscilloscope", action="store_true", default=False, - help="Enable oscilloscope display") - parser.add_option("-I", "--audio-input", type="string", default="", - help="pcm input device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, - help="set sample rate to RATE (48000)") - - (options, args) = parser.parse_args() - sample_rate = int(options.sample_rate) - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - self.show_debug_info = True - - # build the graph - if options.waterfall: - self.scope = \ - waterfallsink2.waterfall_sink_f (panel, fft_size=1024, sample_rate=sample_rate) - elif options.oscilloscope: - self.scope = scopesink2.scope_sink_f(panel, sample_rate=sample_rate) - else: - self.scope = fftsink2.fft_sink_f (panel, fft_size=1024, sample_rate=sample_rate, fft_rate=30, - ref_scale=1.0, ref_level=0, y_divs=12) - - self.src = audio.source (sample_rate, options.audio_input) - - self.connect(self.src, self.scope) - - self._build_gui(vbox) - - # set initial values - - def _set_status_msg(self, msg): - self.frame.GetStatusBar().SetStatusText(msg, 0) - - def _build_gui(self, vbox): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - vbox.Add(self.scope.win, 10, wx.EXPAND) - - #self._build_subpanel(vbox) - - def _build_subpanel(self, vbox_arg): - # build a secondary information panel (sometimes hidden) - - # FIXME figure out how to have this be a subpanel that is always - # created, but has its visibility controlled by foo.Show(True/False) - - def _form_set_decim(kv): - return self.set_decim(kv['decim']) - - if not(self.show_debug_info): - return - - panel = self.panel - vbox = vbox_arg - myform = self.myform - - #panel = wx.Panel(self.panel, -1) - #vbox = wx.BoxSizer(wx.VERTICAL) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - - myform['decim'] = form.int_field( - parent=panel, sizer=hbox, label="Decim", - callback=myform.check_input_and_call(_form_set_decim, self._set_status_msg)) - - hbox.Add((5,0), 1) - myform['fs@usb'] = form.static_float_field( - parent=panel, sizer=hbox, label="Fs@USB") - - hbox.Add((5,0), 1) - myform['dbname'] = form.static_text_field( - parent=panel, sizer=hbox) - - hbox.Add((5,0), 1) - myform['baseband'] = form.static_float_field( - parent=panel, sizer=hbox, label="Analog BB") - - hbox.Add((5,0), 1) - myform['ddc'] = form.static_float_field( - parent=panel, sizer=hbox, label="DDC") - - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - -def main (): - app = stdgui2.stdapp(app_top_block, "Audio FFT", nstatus=1) - app.MainLoop() - -if __name__ == '__main__': - main () diff --git a/gr-audio/examples/python/audio_play.py b/gr-audio/examples/python/audio_play.py deleted file mode 100755 index 465590f69..000000000 --- a/gr-audio/examples/python/audio_play.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser - - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-F", "--filename", type="string", default="audio.dat", - help="read input from FILE") - parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, - help="set sample rate to RATE (48000)") - parser.add_option("-R", "--repeat", action="store_true", default=False) - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - sample_rate = int(options.sample_rate) - src = gr.file_source (gr.sizeof_float, options.filename, options.repeat) - dst = audio.sink (sample_rate, options.audio_output) - self.connect(src, dst) - - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-audio/examples/python/audio_to_file.py b/gr-audio/examples/python/audio_to_file.py deleted file mode 100755 index 3f7a4f8d1..000000000 --- a/gr-audio/examples/python/audio_to_file.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - usage="%prog: [options] output_filename" - parser = OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-I", "--audio-input", type="string", default="", - help="pcm input device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, - help="set sample rate to RATE (48000)") - parser.add_option("-N", "--nsamples", type="eng_float", default=None, - help="number of samples to collect [default=+inf]") - - (options, args) = parser.parse_args () - if len(args) != 1: - parser.print_help() - raise SystemExit, 1 - filename = args[0] - - sample_rate = int(options.sample_rate) - src = audio.source (sample_rate, options.audio_input) - dst = gr.file_sink (gr.sizeof_float, filename) - - if options.nsamples is None: - self.connect((src, 0), dst) - else: - head = gr.head(gr.sizeof_float, int(options.nsamples)) - self.connect((src, 0), head, dst) - - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-audio/examples/python/dial_tone.py b/gr-audio/examples/python/dial_tone.py deleted file mode 100755 index 5661d13d4..000000000 --- a/gr-audio/examples/python/dial_tone.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, - help="set sample rate to RATE (48000)") - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - sample_rate = int(options.sample_rate) - ampl = 0.1 - - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl) - src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl) - dst = audio.sink (sample_rate, options.audio_output) - self.connect (src0, (dst, 0)) - self.connect (src1, (dst, 1)) - - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-audio/examples/python/dial_tone_daemon.py b/gr-audio/examples/python/dial_tone_daemon.py deleted file mode 100755 index b25baebee..000000000 --- a/gr-audio/examples/python/dial_tone_daemon.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007,2008 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. -# - -from gnuradio import gr, gru -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import os - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, - help="set sample rate to RATE (48000)") - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - sample_rate = int(options.sample_rate) - ampl = 0.1 - - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl) - src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl) - dst = audio.sink (sample_rate, options.audio_output) - self.connect (src0, (dst, 0)) - self.connect (src1, (dst, 1)) - - -if __name__ == '__main__': - pid = gru.daemonize() - print "To stop this program, enter 'kill %d'" % pid - my_top_block().run() diff --git a/gr-audio/examples/python/dial_tone_wav.py b/gr-audio/examples/python/dial_tone_wav.py deleted file mode 100755 index c06af55b7..000000000 --- a/gr-audio/examples/python/dial_tone_wav.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007,2008 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. -# - -# GNU Radio example program to record a dial tone to a WAV file - -from gnuradio import gr -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - usage = "%prog: [options] filename" - parser = OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, - help="set sample rate to RATE (48000)") - parser.add_option("-N", "--samples", type="eng_float", default=None, - help="number of samples to record") - (options, args) = parser.parse_args () - if len(args) != 1 or options.samples is None: - parser.print_help() - raise SystemExit, 1 - - sample_rate = int(options.sample_rate) - ampl = 0.1 - - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl) - src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl) - head0 = gr.head(gr.sizeof_float, int(options.samples)) - head1 = gr.head(gr.sizeof_float, int(options.samples)) - dst = gr.wavfile_sink(args[0], 2, int(options.sample_rate), 16) - - self.connect(src0, head0, (dst, 0)) - self.connect(src1, head1, (dst, 1)) - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-audio/examples/python/mono_tone.py b/gr-audio/examples/python/mono_tone.py deleted file mode 100755 index bce486e4a..000000000 --- a/gr-audio/examples/python/mono_tone.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -#import os -#print os.getpid() -#raw_input('Attach gdb and press Enter: ') - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, - help="set sample rate to RATE (48000)") - parser.add_option("-D", "--dont-block", action="store_false", default=True, - dest="ok_to_block") - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - sample_rate = int(options.sample_rate) - ampl = 0.1 - - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 650, ampl) - - dst = audio.sink (sample_rate, - options.audio_output, - options.ok_to_block) - - self.connect (src0, (dst, 0)) - - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-audio/examples/python/multi_tone.py b/gr-audio/examples/python/multi_tone.py deleted file mode 100755 index 00c213b63..000000000 --- a/gr-audio/examples/python/multi_tone.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2006,2007 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -#import os -#print os.getpid() -#raw_input('Attach gdb and press Enter: ') - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, - help="set sample rate to RATE (48000)") - parser.add_option ("-m", "--max-channels", type="int", default="16", - help="set maximum channels to use") - parser.add_option("-D", "--dont-block", action="store_false", default=True, - dest="ok_to_block") - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - sample_rate = int(options.sample_rate) - limit_channels = options.max_channels - - ampl = 0.1 - - # With a tip of the hat to Harry Partch, may he R.I.P. - # See "Genesis of a Music". He was into some very wild tunings... - base = 392 - ratios = { 1 : 1.0, - 3 : 3.0/2, - 5 : 5.0/4, - 7 : 7.0/4, - 9 : 9.0/8, - 11 : 11.0/8 } - - # progression = (1, 5, 3, 7) - # progression = (1, 9, 3, 7) - # progression = (3, 7, 9, 11) - # progression = (7, 11, 1, 5) - progression = (7, 11, 1, 5, 9) - - dst = audio.sink (sample_rate, - options.audio_output, - options.ok_to_block) - - max_chan = dst.input_signature().max_streams() - if (max_chan == -1) or (max_chan > limit_channels): - max_chan = limit_channels - - for i in range (max_chan): - quo, rem = divmod (i, len (progression)) - freq = base * ratios[progression[rem]] * (quo + 1) - src = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, freq, ampl) - self.connect (src, (dst, i)) - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-audio/examples/python/noise.py b/gr-audio/examples/python/noise.py deleted file mode 100755 index 12eee1906..000000000 --- a/gr-audio/examples/python/noise.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, - help="set sample rate to RATE (48000)") - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - sample_rate = int(options.sample_rate) - ampl = 0.1 - - src = gr.glfsr_source_b(32) # Pseudorandom noise source - b2f = gr.chunks_to_symbols_bf([ampl, -ampl], 1) - dst = audio.sink(sample_rate, options.audio_output) - self.connect(src, b2f, dst) - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-audio/examples/python/spectrum_inversion.py b/gr-audio/examples/python/spectrum_inversion.py deleted file mode 100755 index e152430cd..000000000 --- a/gr-audio/examples/python/spectrum_inversion.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007 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. - -# -# Gang - Here's a simple script that demonstrates spectrum inversion -# using the multiply by [1,-1] method (mixing with Nyquist frequency). -# Requires nothing but a sound card, and sounds just like listening -# to a SSB signal on the wrong sideband. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-I", "--audio-input", type="string", default="", - help="pcm input device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-r", "--sample-rate", type="eng_float", default=8000, - help="set sample rate to RATE (8000)") - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - sample_rate = int(options.sample_rate) - src = audio.source (sample_rate, options.audio_input) - dst = audio.sink (sample_rate, options.audio_output) - - vec1 = [1, -1] - vsource = gr.vector_source_f(vec1, True) - multiply = gr.multiply_ff() - - self.connect(src, (multiply, 0)) - self.connect(vsource, (multiply, 1)) - self.connect(multiply, dst) - - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-audio/examples/python/test_resampler.py b/gr-audio/examples/python/test_resampler.py deleted file mode 100755 index db7f79fba..000000000 --- a/gr-audio/examples/python/test_resampler.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007 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. -# - -from gnuradio import gr, gru, blks2 -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser - - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-i", "--input-rate", type="eng_float", default=8000, - help="set input sample rate to RATE (%default)") - parser.add_option("-o", "--output-rate", type="eng_float", default=48000, - help="set output sample rate to RATE (%default)") - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - input_rate = int(options.input_rate) - output_rate = int(options.output_rate) - - interp = gru.lcm(input_rate, output_rate) / input_rate - decim = gru.lcm(input_rate, output_rate) / output_rate - - print "interp =", interp - print "decim =", decim - - ampl = 0.1 - src0 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 650, ampl) - rr = blks2.rational_resampler_fff(interp, decim) - dst = audio.sink (output_rate, options.audio_output) - self.connect (src0, rr, (dst, 0)) - - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-audio/gnuradio-audio.pc.in b/gr-audio/gnuradio-audio.pc.in deleted file mode 100644 index 1cd6d4051..000000000 --- a/gr-audio/gnuradio-audio.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-audio -Description: The GNU Radio block for all supported audio sound systems -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-audio -Cflags: -I${includedir} diff --git a/gr-audio/grc/CMakeLists.txt b/gr-audio/grc/CMakeLists.txt deleted file mode 100644 index 35c540ad3..000000000 --- a/gr-audio/grc/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -file(GLOB xml_files "*.xml") -install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "audio_python") diff --git a/gr-audio/grc/audio_sink.xml b/gr-audio/grc/audio_sink.xml deleted file mode 100644 index 4a88a7fa2..000000000 --- a/gr-audio/grc/audio_sink.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Audio Sink -################################################### - --> -<block> - <name>Audio Sink</name> - <key>audio_sink</key> - <category>Sinks</category> - <throttle>1</throttle> - <import>from gnuradio import audio</import> - <make>audio.sink($samp_rate, $device_name, $ok_to_block)</make> - <param> - <name>Sample Rate</name> - <key>samp_rate</key> - <value>samp_rate</value> - <type>int</type> - <option> - <name>16KHz</name> - <key>16000</key> - </option> - <option> - <name>22.05KHz</name> - <key>22050</key> - </option> - <option> - <name>24KHz</name> - <key>24000</key> - </option> - <option> - <name>32KHz</name> - <key>32000</key> - </option> - <option> - <name>44.1KHz</name> - <key>44100</key> - </option> - <option> - <name>48KHz</name> - <key>48000</key> - </option> - </param> - <param> - <name>Device Name</name> - <key>device_name</key> - <value></value> - <type>string</type> - <hide>#if $device_name() then 'none' else 'part'#</hide> - </param> - <param> - <name>OK to Block</name> - <key>ok_to_block</key> - <value>True</value> - <type>enum</type> - <hide>part</hide> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Num Inputs</name> - <key>num_inputs</key> - <value>1</value> - <type>int</type> - </param> - <check>0 < $num_inputs</check> - <sink> - <name>in</name> - <type>float</type> - <nports>$num_inputs</nports> - </sink> - <doc> -Not all sampling rates will be supported by your hardware. - -Leave the device name blank to choose deafult audio device. \ -ALSA users with audio trouble may try setting the device name to plughw:0,0 - -The audio sink can have multiple inputs depending upon your hardware. \ -For example, set the inputs to 2 for stereo audio. - </doc> -</block> diff --git a/gr-audio/grc/audio_source.xml b/gr-audio/grc/audio_source.xml deleted file mode 100644 index d56e9153a..000000000 --- a/gr-audio/grc/audio_source.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Audio Source -################################################### - --> -<block> - <name>Audio Source</name> - <key>audio_source</key> - <category>Sources</category> - <throttle>1</throttle> - <import>from gnuradio import audio</import> - <make>audio.source($samp_rate, $device_name, $ok_to_block)</make> - <param> - <name>Sample Rate</name> - <key>samp_rate</key> - <value>samp_rate</value> - <type>int</type> - <option> - <name>16KHz</name> - <key>16000</key> - </option> - <option> - <name>22.05KHz</name> - <key>22050</key> - </option> - <option> - <name>24KHz</name> - <key>24000</key> - </option> - <option> - <name>32KHz</name> - <key>32000</key> - </option> - <option> - <name>44.1KHz</name> - <key>44100</key> - </option> - <option> - <name>48KHz</name> - <key>48000</key> - </option> - </param> - <param> - <name>Device Name</name> - <key>device_name</key> - <value></value> - <type>string</type> - <hide>#if $device_name() then 'none' else 'part'#</hide> - </param> - <param> - <name>OK to Block</name> - <key>ok_to_block</key> - <value>True</value> - <type>enum</type> - <hide>part</hide> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Num Outputs</name> - <key>num_outputs</key> - <value>1</value> - <type>int</type> - </param> - <check>0 < $num_outputs</check> - <source> - <name>out</name> - <type>float</type> - <nports>$num_outputs</nports> - </source> - <doc> -Not all sampling rates will be supported by your hardware. - -Leave the device name blank to choose deafult audio device. \ -ALSA users with audio trouble may try setting the device name to plughw:0,0 - -The audio source can have multiple outputs depending upon your hardware. \ -For example, set the outputs to 2 for stereo audio. - </doc> -</block> diff --git a/gr-audio/include/CMakeLists.txt b/gr-audio/include/CMakeLists.txt deleted file mode 100644 index a41506373..000000000 --- a/gr-audio/include/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Install header files -######################################################################## -install(FILES - gr_audio_api.h - gr_audio_source.h - gr_audio_sink.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "audio_devel" -) diff --git a/gr-audio/include/gr_audio_api.h b/gr-audio/include/gr_audio_api.h deleted file mode 100644 index 2ddd0fec6..000000000 --- a/gr-audio/include/gr_audio_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_GR_AUDIO_API_H -#define INCLUDED_GR_AUDIO_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_audio_EXPORTS -# define GR_AUDIO_API __GR_ATTR_EXPORT -#else -# define GR_AUDIO_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_GR_AUDIO_API_H */ diff --git a/gr-audio/include/gr_audio_sink.h b/gr-audio/include/gr_audio_sink.h deleted file mode 100644 index c2c8bdc30..000000000 --- a/gr-audio/include/gr_audio_sink.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_GR_AUDIO_SINK_H -#define INCLUDED_GR_AUDIO_SINK_H - -#include <gr_audio_api.h> -#include <gr_sync_block.h> - -/*! - * \brief Creates a sink from an audio device. - * \ingroup audio_blk - */ -class GR_AUDIO_API audio_sink : virtual public gr_sync_block{ -public: - typedef boost::shared_ptr<audio_sink> sptr; -}; - -/*! - * Creates a sink from an audio device at a specified - * sample_rate. The specific audio device to use can be specified as - * the device_name parameter. Typical choices are: - * \li pulse - * \li hw:0,0 - * \li plughw:0,0 - * \li surround51 - * \li /dev/dsp - * - * \xmlonly - * - pulse, hw:0,0, plughw:0,0, surround51, /dev/dsp - * \endxmlonly - */ -GR_AUDIO_API audio_sink::sptr audio_make_sink( - int sampling_rate, - const std::string device_name = "", - bool ok_to_block = true -); - -#endif /* INCLUDED_GR_AUDIO_SINK_H */ diff --git a/gr-audio/include/gr_audio_source.h b/gr-audio/include/gr_audio_source.h deleted file mode 100644 index 0e46ab198..000000000 --- a/gr-audio/include/gr_audio_source.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_GR_AUDIO_SOURCE_H -#define INCLUDED_GR_AUDIO_SOURCE_H - -#include <gr_audio_api.h> -#include <gr_sync_block.h> - -/*! - * \brief Creates a source from an audio device. - * \ingroup audio_blk - */ -class GR_AUDIO_API audio_source : virtual public gr_sync_block{ -public: - typedef boost::shared_ptr<audio_source> sptr; -}; - -/*! - * Creates a source from an audio device at a specified - * sample_rate. The specific audio device to use can be specified as - * the device_name parameter. Typical choices are: - * \li pulse - * \li hw:0,0 - * \li plughw:0,0 - * \li surround51 - * \li /dev/dsp - * - * \xmlonly - * - pulse, hw:0,0, plughw:0,0, surround51, /dev/dsp - * \endxmlonly - */ -GR_AUDIO_API audio_source::sptr audio_make_source( - int sampling_rate, - const std::string device_name = "", - bool ok_to_block = true -); - -#endif /* INCLUDED_GR_AUDIO_SOURCE_H */ diff --git a/gr-audio/lib/CMakeLists.txt b/gr-audio/lib/CMakeLists.txt deleted file mode 100644 index f39264d5d..000000000 --- a/gr-audio/lib/CMakeLists.txt +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${GR_AUDIO_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -link_directories(${Boost_LIBRARY_DIRS}) - -list(APPEND gr_audio_libs gnuradio-core ${Boost_LIBRARIES}) -list(APPEND gr_audio_sources gr_audio_registry.cc) -list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/gr-audio.conf) - -######################################################################## -## ALSA Support -######################################################################## -find_package(ALSA) - -if(ALSA_FOUND) - - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/alsa ${ALSA_INCLUDE_DIRS}) - list(APPEND gr_audio_libs ${ALSA_LIBRARIES}) - list(APPEND gr_audio_sources - ${CMAKE_CURRENT_SOURCE_DIR}/alsa/gri_alsa.cc - ${CMAKE_CURRENT_SOURCE_DIR}/alsa/audio_alsa_source.cc - ${CMAKE_CURRENT_SOURCE_DIR}/alsa/audio_alsa_sink.cc - ) - list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/alsa/gr-audio-alsa.conf) - -endif(ALSA_FOUND) - -######################################################################## -## OSS Support -######################################################################## -find_package(OSS) - -if(OSS_FOUND) - - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/oss ${OSS_INCLUDE_DIRS}) - list(APPEND gr_audio_sources - ${CMAKE_CURRENT_SOURCE_DIR}/oss/audio_oss_source.cc - ${CMAKE_CURRENT_SOURCE_DIR}/oss/audio_oss_sink.cc - ) - list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/oss/gr-audio-oss.conf) - -endif(OSS_FOUND) - - -######################################################################## -## Jack Support -######################################################################## -find_package(Jack) - -if(JACK_FOUND) - - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/jack ${JACK_INCLUDE_DIRS}) - list(APPEND gr_audio_libs ${JACK_LIBRARIES}) - add_definitions(${JACK_DEFINITIONS}) - list(APPEND gr_audio_sources - ${CMAKE_CURRENT_SOURCE_DIR}/jack/gri_jack.cc - ${CMAKE_CURRENT_SOURCE_DIR}/jack/audio_jack_source.cc - ${CMAKE_CURRENT_SOURCE_DIR}/jack/audio_jack_sink.cc - ) - list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/jack/gr-audio-jack.conf) - -endif(JACK_FOUND) - -######################################################################## -## OSX Support -######################################################################## -include(CheckIncludeFileCXX) -CHECK_INCLUDE_FILE_CXX(AudioUnit/AudioUnit.h AUDIO_UNIT_H) -CHECK_INCLUDE_FILE_CXX(AudioToolbox/AudioToolbox.h AUDIO_TOOLBOX_H) - -if(AUDIO_UNIT_H AND AUDIO_TOOLBOX_H) - - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/osx) - list(APPEND gr_audio_libs - "-framework AudioUnit" - "-framework CoreAudio" - "-framework AudioToolbox" - "-framework Carbon" - ) - list(APPEND gr_audio_sources - ${CMAKE_CURRENT_SOURCE_DIR}/osx/audio_osx_source.cc - ${CMAKE_CURRENT_SOURCE_DIR}/osx/audio_osx_sink.cc - ) - -endif(AUDIO_UNIT_H AND AUDIO_TOOLBOX_H) - -######################################################################## -## PortAudio Support -######################################################################## -find_package(Portaudio) - -if(PORTAUDIO_FOUND) - - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/portaudio ${PORTAUDIO_INCLUDE_DIRS}) - list(APPEND gr_audio_libs ${PORTAUDIO_LIBRARIES}) - add_definitions(${PORTAUDIO_DEFINITIONS}) - list(APPEND gr_audio_sources - ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/gri_portaudio.cc - ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/audio_portaudio_source.cc - ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/audio_portaudio_sink.cc - ) - list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/gr-audio-portaudio.conf) - -endif(PORTAUDIO_FOUND) - -######################################################################## -## Windows Support -######################################################################## -if(WIN32) - - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/windows) - list(APPEND gr_audio_libs winmm.lib) - list(APPEND gr_audio_sources - ${CMAKE_CURRENT_SOURCE_DIR}/windows/audio_windows_source.cc - ${CMAKE_CURRENT_SOURCE_DIR}/windows/audio_windows_sink.cc - ) - -endif(WIN32) - -######################################################################## -# Setup library -######################################################################## -add_library(gnuradio-audio SHARED ${gr_audio_sources}) -target_link_libraries(gnuradio-audio ${gr_audio_libs}) -GR_LIBRARY_FOO(gnuradio-audio RUNTIME_COMPONENT "audio_runtime" DEVEL_COMPONENT "audio_devel") - -install(FILES ${gr_audio_confs} DESTINATION ${GR_PREFSDIR} COMPONENT "audio_runtime") diff --git a/gr-audio/lib/alsa/audio_alsa_sink.cc b/gr-audio/lib/alsa/audio_alsa_sink.cc deleted file mode 100644 index 687f24bde..000000000 --- a/gr-audio/lib/alsa/audio_alsa_sink.cc +++ /dev/null @@ -1,548 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2011 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 "gr_audio_registry.h" -#include <audio_alsa_sink.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <stdio.h> -#include <iostream> -#include <stdexcept> -#include <gri_alsa.h> - -AUDIO_REGISTER_SINK(REG_PRIO_HIGH, alsa)( - int sampling_rate, const std::string &device_name, bool ok_to_block -){ - return audio_sink::sptr(new audio_alsa_sink(sampling_rate, device_name, ok_to_block)); -} - -static bool CHATTY_DEBUG = false; - - -static snd_pcm_format_t acceptable_formats[] = { - // these are in our preferred order... - SND_PCM_FORMAT_S32, - SND_PCM_FORMAT_S16 -}; - -#define NELEMS(x) (sizeof(x)/sizeof(x[0])) - - -static std::string -default_device_name () -{ - return gr_prefs::singleton()->get_string("audio_alsa", "default_output_device", "hw:0,0"); -} - -static double -default_period_time () -{ - return std::max(0.001, gr_prefs::singleton()->get_double("audio_alsa", "period_time", 0.010)); -} - -static int -default_nperiods () -{ - return std::max(2L, gr_prefs::singleton()->get_long("audio_alsa", "nperiods", 4)); -} - -// ---------------------------------------------------------------- - -audio_alsa_sink::audio_alsa_sink (int sampling_rate, - const std::string device_name, - bool ok_to_block) - : gr_sync_block ("audio_alsa_sink", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (0, 0, 0)), - d_sampling_rate (sampling_rate), - d_device_name (device_name.empty() ? default_device_name() : device_name), - d_pcm_handle (0), - d_hw_params ((snd_pcm_hw_params_t *)(new char[snd_pcm_hw_params_sizeof()])), - d_sw_params ((snd_pcm_sw_params_t *)(new char[snd_pcm_sw_params_sizeof()])), - d_nperiods (default_nperiods()), - d_period_time_us ((unsigned int) (default_period_time() * 1e6)), - d_period_size (0), - d_buffer_size_bytes (0), d_buffer (0), - d_worker (0), d_special_case_mono_to_stereo (false), - d_nunderuns (0), d_nsuspends (0), d_ok_to_block(ok_to_block) -{ - CHATTY_DEBUG = gr_prefs::singleton()->get_bool("audio_alsa", "verbose", false); - - int error; - int dir; - - // open the device for playback - error = snd_pcm_open(&d_pcm_handle, d_device_name.c_str (), - SND_PCM_STREAM_PLAYBACK, 0); - if (ok_to_block == false) - snd_pcm_nonblock(d_pcm_handle, !ok_to_block); - if (error < 0){ - fprintf (stderr, "audio_alsa_sink[%s]: %s\n", - d_device_name.c_str(), snd_strerror(error)); - throw std::runtime_error ("audio_alsa_sink"); - } - - // Fill params with a full configuration space for a PCM. - error = snd_pcm_hw_params_any(d_pcm_handle, d_hw_params); - if (error < 0) - bail ("broken configuration for playback", error); - - - if (CHATTY_DEBUG) - gri_alsa_dump_hw_params (d_pcm_handle, d_hw_params, stdout); - - - // now that we know how many channels the h/w can handle, set input signature - unsigned int umin_chan, umax_chan; - snd_pcm_hw_params_get_channels_min (d_hw_params, &umin_chan); - snd_pcm_hw_params_get_channels_max (d_hw_params, &umax_chan); - int min_chan = std::min (umin_chan, 1000U); - int max_chan = std::min (umax_chan, 1000U); - - // As a special case, if the hw's min_chan is two, we'll accept - // a single input and handle the duplication ourselves. - - if (min_chan == 2){ - min_chan = 1; - d_special_case_mono_to_stereo = true; - } - set_input_signature (gr_make_io_signature (min_chan, max_chan, - sizeof (float))); - - // fill in portions of the d_hw_params that we know now... - - // Specify the access methods we implement - // For now, we only handle RW_INTERLEAVED... - snd_pcm_access_mask_t *access_mask; - snd_pcm_access_mask_t **access_mask_ptr = &access_mask; // FIXME: workaround for compiler warning - snd_pcm_access_mask_alloca (access_mask_ptr); - snd_pcm_access_mask_none (access_mask); - snd_pcm_access_mask_set (access_mask, SND_PCM_ACCESS_RW_INTERLEAVED); - // snd_pcm_access_mask_set (access_mask, SND_PCM_ACCESS_RW_NONINTERLEAVED); - - if ((error = snd_pcm_hw_params_set_access_mask (d_pcm_handle, - d_hw_params, access_mask)) < 0) - bail ("failed to set access mask", error); - - - // set sample format - if (!gri_alsa_pick_acceptable_format (d_pcm_handle, d_hw_params, - acceptable_formats, - NELEMS (acceptable_formats), - &d_format, - "audio_alsa_sink", - CHATTY_DEBUG)) - throw std::runtime_error ("audio_alsa_sink"); - - - // sampling rate - unsigned int orig_sampling_rate = d_sampling_rate; - if ((error = snd_pcm_hw_params_set_rate_near (d_pcm_handle, d_hw_params, - &d_sampling_rate, 0)) < 0) - bail ("failed to set rate near", error); - - if (orig_sampling_rate != d_sampling_rate){ - fprintf (stderr, "audio_alsa_sink[%s]: unable to support sampling rate %d\n", - snd_pcm_name (d_pcm_handle), orig_sampling_rate); - fprintf (stderr, " card requested %d instead.\n", d_sampling_rate); - } - - /* - * ALSA transfers data in units of "periods". - * We indirectly determine the underlying buffersize by specifying - * the number of periods we want (typically 4) and the length of each - * period in units of time (typically 1ms). - */ - unsigned int min_nperiods, max_nperiods; - snd_pcm_hw_params_get_periods_min (d_hw_params, &min_nperiods, &dir); - snd_pcm_hw_params_get_periods_max (d_hw_params, &max_nperiods, &dir); - //fprintf (stderr, "alsa_sink: min_nperiods = %d, max_nperiods = %d\n", - // min_nperiods, max_nperiods); - - unsigned int orig_nperiods = d_nperiods; - d_nperiods = std::min (std::max (min_nperiods, d_nperiods), max_nperiods); - - // adjust period time so that total buffering remains more-or-less constant - d_period_time_us = (d_period_time_us * orig_nperiods) / d_nperiods; - - error = snd_pcm_hw_params_set_periods (d_pcm_handle, d_hw_params, - d_nperiods, 0); - if (error < 0) - bail ("set_periods failed", error); - - dir = 0; - error = snd_pcm_hw_params_set_period_time_near (d_pcm_handle, d_hw_params, - &d_period_time_us, &dir); - if (error < 0) - bail ("set_period_time_near failed", error); - - dir = 0; - error = snd_pcm_hw_params_get_period_size (d_hw_params, - &d_period_size, &dir); - if (error < 0) - bail ("get_period_size failed", error); - - set_output_multiple (d_period_size); -} - - -bool -audio_alsa_sink::check_topology (int ninputs, int noutputs) -{ - // ninputs is how many channels the user has connected. - // Now we can finish up setting up the hw params... - - int nchan = ninputs; - int err; - - // Check the state of the stream - // Ensure that the pcm is in a state where we can still mess with the hw_params - snd_pcm_state_t state; - state=snd_pcm_state(d_pcm_handle); - if ( state== SND_PCM_STATE_RUNNING) - return true; // If stream is running, don't change any parameters - else if(state == SND_PCM_STATE_XRUN ) - snd_pcm_prepare ( d_pcm_handle ); // Prepare stream on underrun, and we can set parameters; - - bool special_case = nchan == 1 && d_special_case_mono_to_stereo; - if (special_case) - nchan = 2; - - err = snd_pcm_hw_params_set_channels (d_pcm_handle, d_hw_params, nchan); - - if (err < 0){ - output_error_msg ("set_channels failed", err); - return false; - } - - // set the parameters into the driver... - err = snd_pcm_hw_params(d_pcm_handle, d_hw_params); - if (err < 0){ - output_error_msg ("snd_pcm_hw_params failed", err); - return false; - } - - // get current s/w params - err = snd_pcm_sw_params_current (d_pcm_handle, d_sw_params); - if (err < 0) - bail ("snd_pcm_sw_params_current", err); - - // Tell the PCM device to wait to start until we've filled - // it's buffers half way full. This helps avoid audio underruns. - - err = snd_pcm_sw_params_set_start_threshold(d_pcm_handle, - d_sw_params, - d_nperiods * d_period_size / 2); - if (err < 0) - bail ("snd_pcm_sw_params_set_start_threshold", err); - - // store the s/w params - err = snd_pcm_sw_params (d_pcm_handle, d_sw_params); - if (err < 0) - bail ("snd_pcm_sw_params", err); - - d_buffer_size_bytes = - d_period_size * nchan * snd_pcm_format_size (d_format, 1); - - d_buffer = new char [d_buffer_size_bytes]; - - if (CHATTY_DEBUG) - fprintf (stdout, "audio_alsa_sink[%s]: sample resolution = %d bits\n", - snd_pcm_name (d_pcm_handle), - snd_pcm_hw_params_get_sbits (d_hw_params)); - - switch (d_format){ - case SND_PCM_FORMAT_S16: - if (special_case) - d_worker = &audio_alsa_sink::work_s16_1x2; - else - d_worker = &audio_alsa_sink::work_s16; - break; - - case SND_PCM_FORMAT_S32: - if (special_case) - d_worker = &audio_alsa_sink::work_s32_1x2; - else - d_worker = &audio_alsa_sink::work_s32; - break; - - default: - assert (0); - } - return true; -} - -audio_alsa_sink::~audio_alsa_sink () -{ - if (snd_pcm_state (d_pcm_handle) == SND_PCM_STATE_RUNNING) - snd_pcm_drop (d_pcm_handle); - - snd_pcm_close(d_pcm_handle); - delete [] ((char *) d_hw_params); - delete [] ((char *) d_sw_params); - delete [] d_buffer; -} - -int -audio_alsa_sink::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert ((noutput_items % d_period_size) == 0); - - // this is a call through a pointer to a method... - return (this->*d_worker)(noutput_items, input_items, output_items); -} - -/* - * Work function that deals with float to S16 conversion - */ -int -audio_alsa_sink::work_s16 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - typedef gr_int16 sample_t; // the type of samples we're creating - static const float scale_factor = std::pow(2.0f, 16-1) - 1; - - unsigned int nchan = input_items.size (); - const float **in = (const float **) &input_items[0]; - sample_t *buf = (sample_t *) d_buffer; - int bi; - int n; - - unsigned int sizeof_frame = nchan * sizeof (sample_t); - assert (d_buffer_size_bytes == d_period_size * sizeof_frame); - - for (n = 0; n < noutput_items; n += d_period_size){ - - // process one period of data - bi = 0; - for (unsigned int i = 0; i < d_period_size; i++){ - for (unsigned int chan = 0; chan < nchan; chan++){ - buf[bi++] = (sample_t) (in[chan][i] * scale_factor); - } - } - - // update src pointers - for (unsigned int chan = 0; chan < nchan; chan++) - in[chan] += d_period_size; - - if (!write_buffer (buf, d_period_size, sizeof_frame)) - return -1; // No fixing this problem. Say we're done. - } - - return n; -} - - -/* - * Work function that deals with float to S32 conversion - */ -int -audio_alsa_sink::work_s32 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - typedef gr_int32 sample_t; // the type of samples we're creating - static const float scale_factor = std::pow(2.0f, 32-1) - 1; - - unsigned int nchan = input_items.size (); - const float **in = (const float **) &input_items[0]; - sample_t *buf = (sample_t *) d_buffer; - int bi; - int n; - - unsigned int sizeof_frame = nchan * sizeof (sample_t); - assert (d_buffer_size_bytes == d_period_size * sizeof_frame); - - for (n = 0; n < noutput_items; n += d_period_size){ - - // process one period of data - bi = 0; - for (unsigned int i = 0; i < d_period_size; i++){ - for (unsigned int chan = 0; chan < nchan; chan++){ - buf[bi++] = (sample_t) (in[chan][i] * scale_factor); - } - } - - // update src pointers - for (unsigned int chan = 0; chan < nchan; chan++) - in[chan] += d_period_size; - - if (!write_buffer (buf, d_period_size, sizeof_frame)) - return -1; // No fixing this problem. Say we're done. - } - - return n; -} - -/* - * Work function that deals with float to S16 conversion and - * mono to stereo kludge. - */ -int -audio_alsa_sink::work_s16_1x2 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - typedef gr_int16 sample_t; // the type of samples we're creating - static const float scale_factor = std::pow(2.0f, 16-1) - 1; - - assert (input_items.size () == 1); - static const unsigned int nchan = 2; - const float **in = (const float **) &input_items[0]; - sample_t *buf = (sample_t *) d_buffer; - int bi; - int n; - - unsigned int sizeof_frame = nchan * sizeof (sample_t); - assert (d_buffer_size_bytes == d_period_size * sizeof_frame); - - for (n = 0; n < noutput_items; n += d_period_size){ - - // process one period of data - bi = 0; - for (unsigned int i = 0; i < d_period_size; i++){ - sample_t t = (sample_t) (in[0][i] * scale_factor); - buf[bi++] = t; - buf[bi++] = t; - } - - // update src pointers - in[0] += d_period_size; - - if (!write_buffer (buf, d_period_size, sizeof_frame)) - return -1; // No fixing this problem. Say we're done. - } - - return n; -} - -/* - * Work function that deals with float to S32 conversion and - * mono to stereo kludge. - */ -int -audio_alsa_sink::work_s32_1x2 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - typedef gr_int32 sample_t; // the type of samples we're creating - static const float scale_factor = std::pow(2.0f, 32-1) - 1; - - assert (input_items.size () == 1); - static unsigned int nchan = 2; - const float **in = (const float **) &input_items[0]; - sample_t *buf = (sample_t *) d_buffer; - int bi; - int n; - - unsigned int sizeof_frame = nchan * sizeof (sample_t); - assert (d_buffer_size_bytes == d_period_size * sizeof_frame); - - for (n = 0; n < noutput_items; n += d_period_size){ - - // process one period of data - bi = 0; - for (unsigned int i = 0; i < d_period_size; i++){ - sample_t t = (sample_t) (in[0][i] * scale_factor); - buf[bi++] = t; - buf[bi++] = t; - } - - // update src pointers - in[0] += d_period_size; - - if (!write_buffer (buf, d_period_size, sizeof_frame)) - return -1; // No fixing this problem. Say we're done. - } - - return n; -} - -bool -audio_alsa_sink::write_buffer (const void *vbuffer, - unsigned nframes, unsigned sizeof_frame) -{ - const unsigned char *buffer = (const unsigned char *) vbuffer; - - while (nframes > 0){ - int r = snd_pcm_writei (d_pcm_handle, buffer, nframes); - if (r == -EAGAIN) - { - if (d_ok_to_block == true) - continue; // try again - - break; - } - - else if (r == -EPIPE){ // underrun - d_nunderuns++; - fputs ("aU", stderr); - if ((r = snd_pcm_prepare (d_pcm_handle)) < 0){ - output_error_msg ("snd_pcm_prepare failed. Can't recover from underrun", r); - return false; - } - continue; // try again - } - - else if (r == -ESTRPIPE){ // h/w is suspended (whatever that means) - // This is apparently related to power management - d_nsuspends++; - if ((r = snd_pcm_resume (d_pcm_handle)) < 0){ - output_error_msg ("failed to resume from suspend", r); - return false; - } - continue; // try again - } - - else if (r < 0){ - output_error_msg ("snd_pcm_writei failed", r); - return false; - } - - nframes -= r; - buffer += r * sizeof_frame; - } - - return true; -} - - -void -audio_alsa_sink::output_error_msg (const char *msg, int err) -{ - fprintf (stderr, "audio_alsa_sink[%s]: %s: %s\n", - snd_pcm_name (d_pcm_handle), msg, snd_strerror (err)); -} - -void -audio_alsa_sink::bail (const char *msg, int err) throw (std::runtime_error) -{ - output_error_msg (msg, err); - throw std::runtime_error ("audio_alsa_sink"); -} diff --git a/gr-audio/lib/alsa/audio_alsa_sink.h b/gr-audio/lib/alsa/audio_alsa_sink.h deleted file mode 100644 index d456e53de..000000000 --- a/gr-audio/lib/alsa/audio_alsa_sink.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2011 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 INCLUDED_AUDIO_ALSA_SINK_H -#define INCLUDED_AUDIO_ALSA_SINK_H - -// use new ALSA API -#define ALSA_PCM_NEW_HW_PARAMS_API -#define ALSA_PCM_NEW_SW_PARAMS_API - -#include <gr_audio_sink.h> -#include <string> -#include <alsa/asoundlib.h> -#include <stdexcept> - -/*! - * \brief audio sink using ALSA - * \ingroup audio_blk - * - * The sink has N input streams of floats, where N depends - * on the hardware characteristics of the selected device. - * - * Input samples must be in the range [-1,1]. - */ -class audio_alsa_sink : public audio_sink { - // typedef for pointer to class work method - typedef int (audio_alsa_sink::*work_t)(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - unsigned int d_sampling_rate; - std::string d_device_name; - snd_pcm_t *d_pcm_handle; - snd_pcm_hw_params_t *d_hw_params; - snd_pcm_sw_params_t *d_sw_params; - snd_pcm_format_t d_format; - unsigned int d_nperiods; - unsigned int d_period_time_us; // microseconds - snd_pcm_uframes_t d_period_size; // in frames - unsigned int d_buffer_size_bytes; // sizeof of d_buffer - char *d_buffer; - work_t d_worker; // the work method to use - bool d_special_case_mono_to_stereo; - - // random stats - int d_nunderuns; // count of underruns - int d_nsuspends; // count of suspends - bool d_ok_to_block; // defaults to "true", controls blocking/non-block I/O - - void output_error_msg (const char *msg, int err); - void bail (const char *msg, int err) throw (std::runtime_error); - -public: - audio_alsa_sink (int sampling_rate, const std::string device_name, - bool ok_to_block); - - ~audio_alsa_sink (); - - bool check_topology (int ninputs, int noutputs); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - -protected: - bool write_buffer (const void *buffer, unsigned nframes, unsigned sizeof_frame); - - int work_s16 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - int work_s16_1x2 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - int work_s32 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - int work_s32_1x2 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_AUDIO_ALSA_SINK_H */ diff --git a/gr-audio/lib/alsa/audio_alsa_source.cc b/gr-audio/lib/alsa/audio_alsa_source.cc deleted file mode 100644 index 9fdf80b43..000000000 --- a/gr-audio/lib/alsa/audio_alsa_source.cc +++ /dev/null @@ -1,509 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2011 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 "gr_audio_registry.h" -#include <audio_alsa_source.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <stdio.h> -#include <iostream> -#include <stdexcept> -#include <gri_alsa.h> - -AUDIO_REGISTER_SOURCE(REG_PRIO_HIGH, alsa)( - int sampling_rate, const std::string &device_name, bool ok_to_block -){ - return audio_source::sptr(new audio_alsa_source(sampling_rate, device_name, ok_to_block)); -} - -static bool CHATTY_DEBUG = false; - -static snd_pcm_format_t acceptable_formats[] = { - // these are in our preferred order... - SND_PCM_FORMAT_S32, - SND_PCM_FORMAT_S16 -}; - -#define NELEMS(x) (sizeof(x)/sizeof(x[0])) - - -static std::string -default_device_name () -{ - return gr_prefs::singleton()->get_string("audio_alsa", "default_input_device", "hw:0,0"); -} - -static double -default_period_time () -{ - return std::max(0.001, gr_prefs::singleton()->get_double("audio_alsa", "period_time", 0.010)); -} - -static int -default_nperiods () -{ - return std::max(2L, gr_prefs::singleton()->get_long("audio_alsa", "nperiods", 4)); -} - -// ---------------------------------------------------------------- - -audio_alsa_source::audio_alsa_source (int sampling_rate, - const std::string device_name, - bool ok_to_block) - : gr_sync_block ("audio_alsa_source", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (0, 0, 0)), - d_sampling_rate (sampling_rate), - d_device_name (device_name.empty() ? default_device_name() : device_name), - d_pcm_handle (0), - d_hw_params ((snd_pcm_hw_params_t *)(new char[snd_pcm_hw_params_sizeof()])), - d_sw_params ((snd_pcm_sw_params_t *)(new char[snd_pcm_sw_params_sizeof()])), - d_nperiods (default_nperiods()), - d_period_time_us ((unsigned int) (default_period_time() * 1e6)), - d_period_size (0), - d_buffer_size_bytes (0), d_buffer (0), - d_worker (0), d_hw_nchan (0), - d_special_case_stereo_to_mono (false), - d_noverruns (0), d_nsuspends (0) -{ - - CHATTY_DEBUG = gr_prefs::singleton()->get_bool("audio_alsa", "verbose", false); - - int error; - int dir; - - // open the device for capture - error = snd_pcm_open(&d_pcm_handle, d_device_name.c_str (), - SND_PCM_STREAM_CAPTURE, 0); - if (error < 0){ - fprintf (stderr, "audio_alsa_source[%s]: %s\n", - d_device_name.c_str(), snd_strerror(error)); - throw std::runtime_error ("audio_alsa_source"); - } - - // Fill params with a full configuration space for a PCM. - error = snd_pcm_hw_params_any(d_pcm_handle, d_hw_params); - if (error < 0) - bail ("broken configuration for playback", error); - - if (CHATTY_DEBUG) - gri_alsa_dump_hw_params (d_pcm_handle, d_hw_params, stdout); - - // now that we know how many channels the h/w can handle, set output signature - unsigned int umax_chan; - unsigned int umin_chan; - snd_pcm_hw_params_get_channels_min (d_hw_params, &umin_chan); - snd_pcm_hw_params_get_channels_max (d_hw_params, &umax_chan); - int min_chan = std::min (umin_chan, 1000U); - int max_chan = std::min (umax_chan, 1000U); - - // As a special case, if the hw's min_chan is two, we'll accept - // a single output and handle the demux ourselves. - - if (min_chan == 2){ - min_chan = 1; - d_special_case_stereo_to_mono = true; - } - - set_output_signature (gr_make_io_signature (min_chan, max_chan, - sizeof (float))); - - // fill in portions of the d_hw_params that we know now... - - // Specify the access methods we implement - // For now, we only handle RW_INTERLEAVED... - snd_pcm_access_mask_t *access_mask; - snd_pcm_access_mask_t **access_mask_ptr = &access_mask; // FIXME: workaround for compiler warning - snd_pcm_access_mask_alloca (access_mask_ptr); - snd_pcm_access_mask_none (access_mask); - snd_pcm_access_mask_set (access_mask, SND_PCM_ACCESS_RW_INTERLEAVED); - // snd_pcm_access_mask_set (access_mask, SND_PCM_ACCESS_RW_NONINTERLEAVED); - - if ((error = snd_pcm_hw_params_set_access_mask (d_pcm_handle, - d_hw_params, access_mask)) < 0) - bail ("failed to set access mask", error); - - - // set sample format - if (!gri_alsa_pick_acceptable_format (d_pcm_handle, d_hw_params, - acceptable_formats, - NELEMS (acceptable_formats), - &d_format, - "audio_alsa_source", - CHATTY_DEBUG)) - throw std::runtime_error ("audio_alsa_source"); - - - // sampling rate - unsigned int orig_sampling_rate = d_sampling_rate; - if ((error = snd_pcm_hw_params_set_rate_near (d_pcm_handle, d_hw_params, - &d_sampling_rate, 0)) < 0) - bail ("failed to set rate near", error); - - if (orig_sampling_rate != d_sampling_rate){ - fprintf (stderr, "audio_alsa_source[%s]: unable to support sampling rate %d\n", - snd_pcm_name (d_pcm_handle), orig_sampling_rate); - fprintf (stderr, " card requested %d instead.\n", d_sampling_rate); - } - - /* - * ALSA transfers data in units of "periods". - * We indirectly determine the underlying buffersize by specifying - * the number of periods we want (typically 4) and the length of each - * period in units of time (typically 1ms). - */ - unsigned int min_nperiods, max_nperiods; - snd_pcm_hw_params_get_periods_min (d_hw_params, &min_nperiods, &dir); - snd_pcm_hw_params_get_periods_max (d_hw_params, &max_nperiods, &dir); - //fprintf (stderr, "alsa_source: min_nperiods = %d, max_nperiods = %d\n", - // min_nperiods, max_nperiods); - - - unsigned int orig_nperiods = d_nperiods; - d_nperiods = std::min (std::max (min_nperiods, d_nperiods), max_nperiods); - - // adjust period time so that total buffering remains more-or-less constant - d_period_time_us = (d_period_time_us * orig_nperiods) / d_nperiods; - - error = snd_pcm_hw_params_set_periods (d_pcm_handle, d_hw_params, - d_nperiods, 0); - if (error < 0) - bail ("set_periods failed", error); - - dir = 0; - error = snd_pcm_hw_params_set_period_time_near (d_pcm_handle, d_hw_params, - &d_period_time_us, &dir); - if (error < 0) - bail ("set_period_time_near failed", error); - - dir = 0; - error = snd_pcm_hw_params_get_period_size (d_hw_params, - &d_period_size, &dir); - if (error < 0) - bail ("get_period_size failed", error); - - set_output_multiple (d_period_size); -} - -bool -audio_alsa_source::check_topology (int ninputs, int noutputs) -{ - // noutputs is how many channels the user has connected. - // Now we can finish up setting up the hw params... - - unsigned int nchan = noutputs; - int err; - - // Check the state of the stream - // Ensure that the pcm is in a state where we can still mess with the hw_params - snd_pcm_state_t state; - state=snd_pcm_state(d_pcm_handle); - if ( state== SND_PCM_STATE_RUNNING) - return true; // If stream is running, don't change any parameters - else if(state == SND_PCM_STATE_XRUN ) - snd_pcm_prepare ( d_pcm_handle ); // Prepare stream on underrun, and we can set parameters; - - bool special_case = nchan == 1 && d_special_case_stereo_to_mono; - if (special_case) - nchan = 2; - - d_hw_nchan = nchan; - err = snd_pcm_hw_params_set_channels (d_pcm_handle, d_hw_params, d_hw_nchan); - if (err < 0){ - output_error_msg ("set_channels failed", err); - return false; - } - - // set the parameters into the driver... - err = snd_pcm_hw_params(d_pcm_handle, d_hw_params); - if (err < 0){ - output_error_msg ("snd_pcm_hw_params failed", err); - return false; - } - - d_buffer_size_bytes = - d_period_size * d_hw_nchan * snd_pcm_format_size (d_format, 1); - - d_buffer = new char [d_buffer_size_bytes]; - - if (CHATTY_DEBUG) - fprintf (stdout, "audio_alsa_source[%s]: sample resolution = %d bits\n", - snd_pcm_name (d_pcm_handle), - snd_pcm_hw_params_get_sbits (d_hw_params)); - - switch (d_format){ - case SND_PCM_FORMAT_S16: - if (special_case) - d_worker = &audio_alsa_source::work_s16_2x1; - else - d_worker = &audio_alsa_source::work_s16; - break; - - case SND_PCM_FORMAT_S32: - if (special_case) - d_worker = &audio_alsa_source::work_s32_2x1; - else - d_worker = &audio_alsa_source::work_s32; - break; - - default: - assert (0); - } - - return true; -} - -audio_alsa_source::~audio_alsa_source () -{ - if (snd_pcm_state (d_pcm_handle) == SND_PCM_STATE_RUNNING) - snd_pcm_drop (d_pcm_handle); - - snd_pcm_close(d_pcm_handle); - delete [] ((char *) d_hw_params); - delete [] ((char *) d_sw_params); - delete [] d_buffer; -} - -int -audio_alsa_source::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert ((noutput_items % d_period_size) == 0); - assert (noutput_items != 0); - - // this is a call through a pointer to a method... - return (this->*d_worker)(noutput_items, input_items, output_items); -} - -/* - * Work function that deals with float to S16 conversion - */ -int -audio_alsa_source::work_s16 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - typedef gr_int16 sample_t; // the type of samples we're creating - static const float scale_factor = 1.0 / std::pow(2.0f, 16-1); - - unsigned int nchan = output_items.size (); - float **out = (float **) &output_items[0]; - sample_t *buf = (sample_t *) d_buffer; - int bi; - - unsigned int sizeof_frame = d_hw_nchan * sizeof (sample_t); - assert (d_buffer_size_bytes == d_period_size * sizeof_frame); - - // To minimize latency, return at most a single period's worth of samples. - // [We could also read the first one in a blocking mode and subsequent - // ones in non-blocking mode, but we'll leave that for later (or never).] - - if (!read_buffer (buf, d_period_size, sizeof_frame)) - return -1; // No fixing this problem. Say we're done. - - // process one period of data - bi = 0; - for (unsigned int i = 0; i < d_period_size; i++){ - for (unsigned int chan = 0; chan < nchan; chan++){ - out[chan][i] = (float) buf[bi++] * scale_factor; - } - } - - return d_period_size; -} - -/* - * Work function that deals with float to S16 conversion - * and stereo to mono kludge... - */ -int -audio_alsa_source::work_s16_2x1 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - typedef gr_int16 sample_t; // the type of samples we're creating - static const float scale_factor = 1.0 / std::pow(2.0f, 16-1); - - float **out = (float **) &output_items[0]; - sample_t *buf = (sample_t *) d_buffer; - int bi; - - assert (output_items.size () == 1); - - unsigned int sizeof_frame = d_hw_nchan * sizeof (sample_t); - assert (d_buffer_size_bytes == d_period_size * sizeof_frame); - - // To minimize latency, return at most a single period's worth of samples. - // [We could also read the first one in a blocking mode and subsequent - // ones in non-blocking mode, but we'll leave that for later (or never).] - - if (!read_buffer (buf, d_period_size, sizeof_frame)) - return -1; // No fixing this problem. Say we're done. - - // process one period of data - bi = 0; - for (unsigned int i = 0; i < d_period_size; i++){ - int t = (buf[bi] + buf[bi+1]) / 2; - bi += 2; - out[0][i] = (float) t * scale_factor; - } - - return d_period_size; -} - -/* - * Work function that deals with float to S32 conversion - */ -int -audio_alsa_source::work_s32 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - typedef gr_int32 sample_t; // the type of samples we're creating - static const float scale_factor = 1.0 / std::pow(2.0f, 32-1); - - unsigned int nchan = output_items.size (); - float **out = (float **) &output_items[0]; - sample_t *buf = (sample_t *) d_buffer; - int bi; - - unsigned int sizeof_frame = d_hw_nchan * sizeof (sample_t); - assert (d_buffer_size_bytes == d_period_size * sizeof_frame); - - // To minimize latency, return at most a single period's worth of samples. - // [We could also read the first one in a blocking mode and subsequent - // ones in non-blocking mode, but we'll leave that for later (or never).] - - if (!read_buffer (buf, d_period_size, sizeof_frame)) - return -1; // No fixing this problem. Say we're done. - - // process one period of data - bi = 0; - for (unsigned int i = 0; i < d_period_size; i++){ - for (unsigned int chan = 0; chan < nchan; chan++){ - out[chan][i] = (float) buf[bi++] * scale_factor; - } - } - - return d_period_size; -} - -/* - * Work function that deals with float to S32 conversion - * and stereo to mono kludge... - */ -int -audio_alsa_source::work_s32_2x1 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - typedef gr_int32 sample_t; // the type of samples we're creating - static const float scale_factor = 1.0 / std::pow(2.0f, 32-1); - - float **out = (float **) &output_items[0]; - sample_t *buf = (sample_t *) d_buffer; - int bi; - - assert (output_items.size () == 1); - - unsigned int sizeof_frame = d_hw_nchan * sizeof (sample_t); - assert (d_buffer_size_bytes == d_period_size * sizeof_frame); - - // To minimize latency, return at most a single period's worth of samples. - // [We could also read the first one in a blocking mode and subsequent - // ones in non-blocking mode, but we'll leave that for later (or never).] - - if (!read_buffer (buf, d_period_size, sizeof_frame)) - return -1; // No fixing this problem. Say we're done. - - // process one period of data - bi = 0; - for (unsigned int i = 0; i < d_period_size; i++){ - int t = (buf[bi] + buf[bi+1]) / 2; - bi += 2; - out[0][i] = (float) t * scale_factor; - } - - return d_period_size; -} - -bool -audio_alsa_source::read_buffer (void *vbuffer, unsigned nframes, unsigned sizeof_frame) -{ - unsigned char *buffer = (unsigned char *) vbuffer; - - while (nframes > 0){ - int r = snd_pcm_readi (d_pcm_handle, buffer, nframes); - if (r == -EAGAIN) - continue; // try again - - else if (r == -EPIPE){ // overrun - d_noverruns++; - fputs ("aO", stderr); - if ((r = snd_pcm_prepare (d_pcm_handle)) < 0){ - output_error_msg ("snd_pcm_prepare failed. Can't recover from overrun", r); - return false; - } - continue; // try again - } - - else if (r == -ESTRPIPE){ // h/w is suspended (whatever that means) - // This is apparently related to power management - d_nsuspends++; - if ((r = snd_pcm_resume (d_pcm_handle)) < 0){ - output_error_msg ("failed to resume from suspend", r); - return false; - } - continue; // try again - } - - else if (r < 0){ - output_error_msg ("snd_pcm_readi failed", r); - return false; - } - - nframes -= r; - buffer += r * sizeof_frame; - } - - return true; -} - - -void -audio_alsa_source::output_error_msg (const char *msg, int err) -{ - fprintf (stderr, "audio_alsa_source[%s]: %s: %s\n", - snd_pcm_name (d_pcm_handle), msg, snd_strerror (err)); -} - -void -audio_alsa_source::bail (const char *msg, int err) throw (std::runtime_error) -{ - output_error_msg (msg, err); - throw std::runtime_error ("audio_alsa_source"); -} diff --git a/gr-audio/lib/alsa/audio_alsa_source.h b/gr-audio/lib/alsa/audio_alsa_source.h deleted file mode 100644 index 320d49bd2..000000000 --- a/gr-audio/lib/alsa/audio_alsa_source.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2011 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 INCLUDED_AUDIO_ALSA_SOURCE_H -#define INCLUDED_AUDIO_ALSA_SOURCE_H - -// use new ALSA API -#define ALSA_PCM_NEW_HW_PARAMS_API -#define ALSA_PCM_NEW_SW_PARAMS_API - -#include <gr_audio_source.h> -#include <string> -#include <alsa/asoundlib.h> -#include <stdexcept> - -class audio_alsa_source; -typedef boost::shared_ptr<audio_alsa_source> audio_alsa_source_sptr; - -/*! - * \brief audio source using ALSA - * \ingroup audio_blk - * - * The source has between 1 and N input streams of floats, where N is - * depends on the hardware characteristics of the selected device. - * - * Output samples will be in the range [-1,1]. - */ -class audio_alsa_source : public audio_source { - // typedef for pointer to class work method - typedef int (audio_alsa_source::*work_t)(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - unsigned int d_sampling_rate; - std::string d_device_name; - snd_pcm_t *d_pcm_handle; - snd_pcm_hw_params_t *d_hw_params; - snd_pcm_sw_params_t *d_sw_params; - snd_pcm_format_t d_format; - unsigned int d_nperiods; - unsigned int d_period_time_us; // microseconds - snd_pcm_uframes_t d_period_size; // in frames - unsigned int d_buffer_size_bytes; // sizeof of d_buffer - char *d_buffer; - work_t d_worker; // the work method to use - unsigned int d_hw_nchan; // # of configured h/w channels - bool d_special_case_stereo_to_mono; - - // random stats - int d_noverruns; // count of overruns - int d_nsuspends; // count of suspends - - void output_error_msg (const char *msg, int err); - void bail (const char *msg, int err) throw (std::runtime_error); - -public: - audio_alsa_source (int sampling_rate, const std::string device_name, - bool ok_to_block); - - ~audio_alsa_source (); - - bool check_topology (int ninputs, int noutputs); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -protected: - bool read_buffer (void *buffer, unsigned nframes, unsigned sizeof_frame); - - int work_s16 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - int work_s16_2x1 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - int work_s32 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - int work_s32_2x1 (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_AUDIO_ALSA_SOURCE_H */ diff --git a/gr-audio/lib/alsa/gr-audio-alsa.conf b/gr-audio/lib/alsa/gr-audio-alsa.conf deleted file mode 100644 index 5cec63e7a..000000000 --- a/gr-audio/lib/alsa/gr-audio-alsa.conf +++ /dev/null @@ -1,11 +0,0 @@ -# This file contains system wide configuration data for GNU Radio. -# You may override any setting on a per-user basis by editing -# ~/.gnuradio/config.conf - -[audio_alsa] - -default_input_device = hw:0,0 -default_output_device = hw:0,0 -period_time = 0.010 # in seconds -nperiods = 4 # total buffering = period_time * nperiods -verbose = false diff --git a/gr-audio/lib/alsa/gri_alsa.cc b/gr-audio/lib/alsa/gri_alsa.cc deleted file mode 100644 index 7bae0937d..000000000 --- a/gr-audio/lib/alsa/gri_alsa.cc +++ /dev/null @@ -1,175 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 <gri_alsa.h> -#include <algorithm> - -static snd_pcm_access_t access_types[] = { - SND_PCM_ACCESS_MMAP_INTERLEAVED, - SND_PCM_ACCESS_MMAP_NONINTERLEAVED, - SND_PCM_ACCESS_MMAP_COMPLEX, - SND_PCM_ACCESS_RW_INTERLEAVED, - SND_PCM_ACCESS_RW_NONINTERLEAVED -}; - -static snd_pcm_format_t format_types[] = { - // SND_PCM_FORMAT_UNKNOWN, - SND_PCM_FORMAT_S8, - SND_PCM_FORMAT_U8, - SND_PCM_FORMAT_S16_LE, - SND_PCM_FORMAT_S16_BE, - SND_PCM_FORMAT_U16_LE, - SND_PCM_FORMAT_U16_BE, - SND_PCM_FORMAT_S24_LE, - SND_PCM_FORMAT_S24_BE, - SND_PCM_FORMAT_U24_LE, - SND_PCM_FORMAT_U24_BE, - SND_PCM_FORMAT_S32_LE, - SND_PCM_FORMAT_S32_BE, - SND_PCM_FORMAT_U32_LE, - SND_PCM_FORMAT_U32_BE, - SND_PCM_FORMAT_FLOAT_LE, - SND_PCM_FORMAT_FLOAT_BE, - SND_PCM_FORMAT_FLOAT64_LE, - SND_PCM_FORMAT_FLOAT64_BE, - SND_PCM_FORMAT_IEC958_SUBFRAME_LE, - SND_PCM_FORMAT_IEC958_SUBFRAME_BE, - SND_PCM_FORMAT_MU_LAW, - SND_PCM_FORMAT_A_LAW, - SND_PCM_FORMAT_IMA_ADPCM, - SND_PCM_FORMAT_MPEG, - SND_PCM_FORMAT_GSM, - SND_PCM_FORMAT_SPECIAL, - SND_PCM_FORMAT_S24_3LE, - SND_PCM_FORMAT_S24_3BE, - SND_PCM_FORMAT_U24_3LE, - SND_PCM_FORMAT_U24_3BE, - SND_PCM_FORMAT_S20_3LE, - SND_PCM_FORMAT_S20_3BE, - SND_PCM_FORMAT_U20_3LE, - SND_PCM_FORMAT_U20_3BE, - SND_PCM_FORMAT_S18_3LE, - SND_PCM_FORMAT_S18_3BE, - SND_PCM_FORMAT_U18_3LE, - SND_PCM_FORMAT_U18_3BE -}; - -static unsigned int test_rates[] = { - 8000, 16000, 22050, 32000, 44100, 48000, 96000, 192000 -}; - -#define NELEMS(x) (sizeof(x)/sizeof(x[0])) - -void -gri_alsa_dump_hw_params (snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, FILE *fp) -{ - fprintf (fp, "PCM name: %s\n", snd_pcm_name (pcm)); - - fprintf (fp, "Access types:\n"); - for (unsigned i = 0; i < NELEMS (access_types); i++){ - snd_pcm_access_t at = access_types[i]; - fprintf (fp, " %-20s %s\n", - snd_pcm_access_name (at), - snd_pcm_hw_params_test_access (pcm, hwparams, at) == 0 ? "YES" : "NO"); - } - - fprintf (fp, "Formats:\n"); - for (unsigned i = 0; i < NELEMS (format_types); i++){ - snd_pcm_format_t ft = format_types[i]; - if (0) - fprintf (fp, " %-20s %s\n", - snd_pcm_format_name (ft), - snd_pcm_hw_params_test_format (pcm, hwparams, ft) == 0 ? "YES" : "NO"); - else { - if (snd_pcm_hw_params_test_format (pcm, hwparams, ft) == 0) - fprintf (fp, " %-20s YES\n", snd_pcm_format_name (ft)); - } - } - - fprintf (fp, "Number of channels\n"); - unsigned int min_chan, max_chan; - snd_pcm_hw_params_get_channels_min (hwparams, &min_chan); - snd_pcm_hw_params_get_channels_max (hwparams, &max_chan); - fprintf (fp, " min channels: %d\n", min_chan); - fprintf (fp, " max channels: %d\n", max_chan); - unsigned int chan; - max_chan = std::min (max_chan, 16U); // truncate display... - for (chan = min_chan; chan <= max_chan; chan++){ - fprintf (fp, " %d channels\t%s\n", chan, - snd_pcm_hw_params_test_channels (pcm, hwparams, chan) == 0 ? "YES" : "NO"); - } - - fprintf (fp, "Sample Rates:\n"); - unsigned int min_rate, max_rate; - int min_dir, max_dir; - - snd_pcm_hw_params_get_rate_min (hwparams, &min_rate, &min_dir); - snd_pcm_hw_params_get_rate_max (hwparams, &max_rate, &max_dir); - fprintf (fp, " min rate: %7d (dir = %d)\n", min_rate, min_dir); - fprintf (fp, " max rate: %7d (dir = %d)\n", max_rate, max_dir); - for (unsigned i = 0; i < NELEMS (test_rates); i++){ - unsigned int rate = test_rates[i]; - fprintf (fp, " %6u %s\n", rate, - snd_pcm_hw_params_test_rate (pcm, hwparams, rate, 0) == 0 ? "YES" : "NO"); - } - - fflush (fp); -} - -bool -gri_alsa_pick_acceptable_format (snd_pcm_t *pcm, - snd_pcm_hw_params_t *hwparams, - snd_pcm_format_t acceptable_formats[], - unsigned nacceptable_formats, - snd_pcm_format_t *selected_format, - const char *error_msg_tag, - bool verbose) -{ - int err; - - // pick a format that we like... - for (unsigned i = 0; i < nacceptable_formats; i++){ - if (snd_pcm_hw_params_test_format (pcm, hwparams, - acceptable_formats[i]) == 0){ - err = snd_pcm_hw_params_set_format (pcm, hwparams, acceptable_formats[i]); - if (err < 0){ - fprintf (stderr, "%s[%s]: failed to set format: %s\n", - error_msg_tag, snd_pcm_name (pcm), snd_strerror (err)); - return false; - } - if (verbose) - fprintf (stdout, "%s[%s]: using %s\n", - error_msg_tag, snd_pcm_name (pcm), - snd_pcm_format_name (acceptable_formats[i])); - *selected_format = acceptable_formats[i]; - return true; - } - } - - fprintf (stderr, "%s[%s]: failed to find acceptable format", - error_msg_tag, snd_pcm_name (pcm)); - return false; -} diff --git a/gr-audio/lib/alsa/gri_alsa.h b/gr-audio/lib/alsa/gri_alsa.h deleted file mode 100644 index 9c64e2c36..000000000 --- a/gr-audio/lib/alsa/gri_alsa.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 INCLUDED_GRI_ALSA_H -#define INCLUDED_GRI_ALSA_H - -#include <stdio.h> -#include <alsa/asoundlib.h> - -void -gri_alsa_dump_hw_params (snd_pcm_t *pcm, - snd_pcm_hw_params_t *hwparams, - FILE *fp); - -bool -gri_alsa_pick_acceptable_format (snd_pcm_t *pcm, - snd_pcm_hw_params_t *hwparams, - snd_pcm_format_t acceptable_formats[], - unsigned nacceptable_formats, - snd_pcm_format_t *selected_format, - const char *error_msg_tag, - bool verbose); - - -#endif /* INCLUDED_GRI_ALSA_H */ diff --git a/gr-audio/lib/gr-audio.conf b/gr-audio/lib/gr-audio.conf deleted file mode 100644 index e0d9221c3..000000000 --- a/gr-audio/lib/gr-audio.conf +++ /dev/null @@ -1,12 +0,0 @@ -# This file contains system wide configuration data for GNU Radio. -# You may override any setting on a per-user basis by editing -# ~/.gnuradio/config.conf - -# specify which audio module to load, or use "auto" to have the system -# select one. Valid choices depend on your OS and which modules -# you've installed, but typically include: -# auto, alsa, oss, portaudio, jack, osx, windows - -[audio] - -audio_module = auto diff --git a/gr-audio/lib/gr_audio_registry.cc b/gr-audio/lib/gr_audio_registry.cc deleted file mode 100644 index e07bf844a..000000000 --- a/gr-audio/lib/gr_audio_registry.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2011 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. - */ - -#include "gr_audio_registry.h" -#include <boost/foreach.hpp> -#include <gr_prefs.h> -#include <stdexcept> -#include <vector> -#include <iostream> - -/*********************************************************************** - * Create registries - **********************************************************************/ - -struct source_entry_t{ - reg_prio_type prio; - std::string arch; - source_factory_t source; -}; - -static std::vector<source_entry_t> &get_source_registry(void){ - static std::vector<source_entry_t> _registry; - return _registry; -} - -struct sink_entry_t{ - reg_prio_type prio; - std::string arch; - sink_factory_t sink; -}; - -static std::vector<sink_entry_t> &get_sink_registry(void){ - static std::vector<sink_entry_t> _registry; - return _registry; -} - -/*********************************************************************** - * Register functions - **********************************************************************/ -void audio_register_source( - reg_prio_type prio, const std::string &arch, source_factory_t source -){ - source_entry_t entry; - entry.prio = prio; - entry.arch = arch; - entry.source = source; - get_source_registry().push_back(entry); -} - -void audio_register_sink( - reg_prio_type prio, const std::string &arch, sink_factory_t sink -){ - sink_entry_t entry; - entry.prio = prio; - entry.arch = arch; - entry.sink = sink; - get_sink_registry().push_back(entry); -} - -/*********************************************************************** - * Factory functions - **********************************************************************/ -static std::string default_arch_name(void){ - return gr_prefs::singleton()->get_string("audio", "audio_module", "auto"); -} - -static void do_arch_warning(const std::string &arch){ - if (arch == "auto") return; //no warning when arch not specified - std::cerr << "Could not find audio architecture \"" << arch << "\" in registry." << std::endl; - std::cerr << " Defaulting to the first available architecture..." << std::endl; -} - -audio_source::sptr audio_make_source( - int sampling_rate, - const std::string device_name, - bool ok_to_block -){ - if (get_source_registry().empty()){ - throw std::runtime_error("no available audio source factories"); - } - - std::string arch = default_arch_name(); - source_entry_t entry = get_source_registry().front(); - - BOOST_FOREACH(const source_entry_t &e, get_source_registry()){ - if (e.prio > entry.prio) entry = e; //entry is highest prio - if (arch != e.arch) continue; //continue when no match - return e.source(sampling_rate, device_name, ok_to_block); - } - //std::cout << "Audio source arch: " << entry.name << std::endl; - return entry.source(sampling_rate, device_name, ok_to_block); -} - -audio_sink::sptr audio_make_sink( - int sampling_rate, - const std::string device_name, - bool ok_to_block -){ - if (get_sink_registry().empty()){ - throw std::runtime_error("no available audio sink factories"); - } - - std::string arch = default_arch_name(); - sink_entry_t entry = get_sink_registry().front(); - - BOOST_FOREACH(const sink_entry_t &e, get_sink_registry()){ - if (e.prio > entry.prio) entry = e; //entry is highest prio - if (arch != e.arch) continue; //continue when no match - return e.sink(sampling_rate, device_name, ok_to_block); - } - do_arch_warning(arch); - //std::cout << "Audio sink arch: " << entry.name << std::endl; - return entry.sink(sampling_rate, device_name, ok_to_block); -} diff --git a/gr-audio/lib/gr_audio_registry.h b/gr-audio/lib/gr_audio_registry.h deleted file mode 100644 index c40e15657..000000000 --- a/gr-audio/lib/gr_audio_registry.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_GR_AUDIO_REGISTRY_H -#define INCLUDED_GR_AUDIO_REGISTRY_H - -#include <gr_audio_sink.h> -#include <gr_audio_source.h> -#include <string> - -typedef audio_source::sptr(*source_factory_t)(int, const std::string &, bool); -typedef audio_sink::sptr(*sink_factory_t)(int, const std::string &, bool); - -enum reg_prio_type{ - REG_PRIO_LOW = 100, - REG_PRIO_MED = 200, - REG_PRIO_HIGH = 300 -}; - -void audio_register_source(reg_prio_type prio, const std::string &arch, source_factory_t source); -void audio_register_sink(reg_prio_type prio, const std::string &arch, sink_factory_t sink); - -#define AUDIO_REGISTER_FIXTURE(x) static struct x{x();}x;x::x() - -#define AUDIO_REGISTER_SOURCE(prio, arch) \ - static audio_source::sptr arch##_source_fcn(int, const std::string &, bool); \ - AUDIO_REGISTER_FIXTURE(arch##_source_reg){ \ - audio_register_source(prio, #arch, &arch##_source_fcn); \ - } static audio_source::sptr arch##_source_fcn - -#define AUDIO_REGISTER_SINK(prio, arch) \ - static audio_sink::sptr arch##_sink_fcn(int, const std::string &, bool); \ - AUDIO_REGISTER_FIXTURE(arch##_sink_reg){ \ - audio_register_sink(prio, #arch, &arch##_sink_fcn); \ - } static audio_sink::sptr arch##_sink_fcn - -#endif /* INCLUDED_GR_AUDIO_REGISTRY_H */ diff --git a/gr-audio/lib/jack/audio_jack_sink.cc b/gr-audio/lib/jack/audio_jack_sink.cc deleted file mode 100644 index 9caabe8e2..000000000 --- a/gr-audio/lib/jack/audio_jack_sink.cc +++ /dev/null @@ -1,236 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-2011 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 "gr_audio_registry.h" -#include <audio_jack_sink.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <stdio.h> -#include <iostream> -#include <stdexcept> -#include <gri_jack.h> - -#ifndef NO_PTHREAD -#include <pthread.h> -#endif - -AUDIO_REGISTER_SINK(REG_PRIO_MED, jack)( - int sampling_rate, const std::string &device_name, bool ok_to_block -){ - return audio_sink::sptr(new audio_jack_sink(sampling_rate, device_name, ok_to_block)); -} - -typedef jack_default_audio_sample_t sample_t; - - -// Number of jack buffers in the ringbuffer -// TODO: make it to match at least the quantity of items passed by work() -static const unsigned int N_BUFFERS = 16; - -static std::string -default_device_name () -{ - return gr_prefs::singleton()->get_string("audio_jack", "default_output_device", "gr_sink"); -} - -int -jack_sink_process (jack_nframes_t nframes, void *arg) -{ - audio_jack_sink *self = (audio_jack_sink *)arg; - unsigned int read_size = nframes*sizeof(sample_t); - - if (jack_ringbuffer_read_space (self->d_ringbuffer) < read_size) { - self->d_nunderuns++; - // FIXME: move this fputs out, we shouldn't use blocking calls in process() - fputs ("jU", stderr); - return 0; - } - - char *buffer = (char *) jack_port_get_buffer (self->d_jack_output_port, nframes); - - jack_ringbuffer_read (self->d_ringbuffer, buffer, read_size); - -#ifndef NO_PTHREAD - // Tell the sink thread there is room in the ringbuffer. - // If it is already running, the lock will not be available. - // We can't wait here in the process() thread, but we don't - // need to signal in that case, because the sink thread will - // check for room availability. - - if (pthread_mutex_trylock (&self->d_jack_process_lock) == 0) { - pthread_cond_signal (&self->d_ringbuffer_ready); - pthread_mutex_unlock (&self->d_jack_process_lock); - } -#endif - - return 0; -} - -// ---------------------------------------------------------------- - -audio_jack_sink::audio_jack_sink (int sampling_rate, - const std::string device_name, - bool ok_to_block) - : gr_sync_block ("audio_jack_sink", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (0, 0, 0)), - d_sampling_rate (sampling_rate), - d_device_name (device_name.empty() ? default_device_name() : device_name), - d_ok_to_block (ok_to_block), - d_jack_client (0), - d_ringbuffer (0), - d_nunderuns (0) -{ -#ifndef NO_PTHREAD - pthread_cond_init(&d_ringbuffer_ready, NULL);; - pthread_mutex_init(&d_jack_process_lock, NULL); -#endif - - // try to become a client of the JACK server - jack_options_t options = JackNullOption; - jack_status_t status; - const char *server_name = NULL; - if ((d_jack_client = jack_client_open (d_device_name.c_str (), - options, &status, - server_name)) == NULL) { - fprintf (stderr, "audio_jack_sink[%s]: jack server not running?\n", - d_device_name.c_str()); - throw std::runtime_error ("audio_jack_sink"); - } - - // tell the JACK server to call `jack_sink_process()' whenever - // there is work to be done. - jack_set_process_callback (d_jack_client, &jack_sink_process, (void*)this); - - // tell the JACK server to call `jack_shutdown()' if - // it ever shuts down, either entirely, or if it - // just decides to stop calling us. - - //jack_on_shutdown (d_jack_client, &jack_shutdown, (void*)this); - - d_jack_output_port = - jack_port_register (d_jack_client, "out", - JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); - - - d_jack_buffer_size = jack_get_buffer_size (d_jack_client); - - set_output_multiple (d_jack_buffer_size); - - d_ringbuffer = - jack_ringbuffer_create (N_BUFFERS*d_jack_buffer_size*sizeof(sample_t)); - if (d_ringbuffer == NULL) - bail ("jack_ringbuffer_create failed", 0); - - assert(sizeof(float)==sizeof(sample_t)); - set_input_signature (gr_make_io_signature (1, 1, sizeof (sample_t))); - - - jack_nframes_t sample_rate = jack_get_sample_rate (d_jack_client); - - if ((jack_nframes_t)sampling_rate != sample_rate){ - fprintf (stderr, "audio_jack_sink[%s]: unable to support sampling rate %d\n", - d_device_name.c_str (), sampling_rate); - fprintf (stderr, " card requested %d instead.\n", sample_rate); - } -} - - -bool -audio_jack_sink::check_topology (int ninputs, int noutputs) -{ - if (ninputs != 1) - return false; - - // tell the JACK server that we are ready to roll - if (jack_activate (d_jack_client)) - throw std::runtime_error ("audio_jack_sink"); - - return true; -} - -audio_jack_sink::~audio_jack_sink () -{ - jack_client_close (d_jack_client); - jack_ringbuffer_free (d_ringbuffer); -} - -int -audio_jack_sink::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - // write_size and work_size are in bytes - int work_size = noutput_items*sizeof(sample_t); - unsigned int write_size; - - while (work_size > 0) { - unsigned int write_space; // bytes - -#ifdef NO_PTHREAD - while ((write_space=jack_ringbuffer_write_space (d_ringbuffer)) < - d_jack_buffer_size*sizeof(sample_t)) { - usleep(1000000*((d_jack_buffer_size-write_space/sizeof(sample_t))/d_sampling_rate)); - } -#else - // JACK actually requires POSIX - - pthread_mutex_lock (&d_jack_process_lock); - while ((write_space=jack_ringbuffer_write_space (d_ringbuffer)) < - d_jack_buffer_size*sizeof(sample_t)) { - - // wait until jack_sink_process() signals more room - pthread_cond_wait (&d_ringbuffer_ready, &d_jack_process_lock); - } - pthread_mutex_unlock (&d_jack_process_lock); -#endif - - write_space -= write_space%(d_jack_buffer_size*sizeof(sample_t)); - write_size = std::min(write_space, (unsigned int)work_size); - - if (jack_ringbuffer_write (d_ringbuffer, (char *) input_items[0], - write_size) < write_size) { - bail ("jack_ringbuffer_write failed", 0); - } - work_size -= write_size; - } - - return noutput_items; -} - -void -audio_jack_sink::output_error_msg (const char *msg, int err) -{ - fprintf (stderr, "audio_jack_sink[%s]: %s: %d\n", - d_device_name.c_str (), msg, err); -} - -void -audio_jack_sink::bail (const char *msg, int err) throw (std::runtime_error) -{ - output_error_msg (msg, err); - throw std::runtime_error ("audio_jack_sink"); -} diff --git a/gr-audio/lib/jack/audio_jack_sink.h b/gr-audio/lib/jack/audio_jack_sink.h deleted file mode 100644 index 8cc343937..000000000 --- a/gr-audio/lib/jack/audio_jack_sink.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-2011 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 INCLUDED_AUDIO_JACK_SINK_H -#define INCLUDED_AUDIO_JACK_SINK_H - -#include <gr_audio_sink.h> -#include <string> -#include <jack/jack.h> -#include <jack/ringbuffer.h> -#include <stdexcept> - -int jack_sink_process (jack_nframes_t nframes, void *arg); - -/*! - * \brief audio sink using JACK - * \ingroup audio_blk - * - * The sink has one input stream of floats. - * - * Input samples must be in the range [-1,1]. - */ -class audio_jack_sink : public audio_sink { - - friend int jack_sink_process (jack_nframes_t nframes, void *arg); - - // typedef for pointer to class work method - typedef int (audio_jack_sink::*work_t)(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - unsigned int d_sampling_rate; - std::string d_device_name; - bool d_ok_to_block; - - jack_client_t *d_jack_client; - jack_port_t *d_jack_output_port; - jack_ringbuffer_t *d_ringbuffer; - jack_nframes_t d_jack_buffer_size; - pthread_cond_t d_ringbuffer_ready; - pthread_mutex_t d_jack_process_lock; - - // random stats - int d_nunderuns; // count of underruns - - void output_error_msg (const char *msg, int err); - void bail (const char *msg, int err) throw (std::runtime_error); - - -public: - audio_jack_sink (int sampling_rate, const std::string device_name, bool ok_to_block); - - ~audio_jack_sink (); - - bool check_topology (int ninputs, int noutputs); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_AUDIO_JACK_SINK_H */ diff --git a/gr-audio/lib/jack/audio_jack_source.cc b/gr-audio/lib/jack/audio_jack_source.cc deleted file mode 100644 index 137fd538e..000000000 --- a/gr-audio/lib/jack/audio_jack_source.cc +++ /dev/null @@ -1,237 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2010 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 "gr_audio_registry.h" -#include <audio_jack_source.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <stdio.h> -#include <iostream> -#include <stdexcept> -#include <gri_jack.h> - -#ifndef NO_PTHREAD -#include <pthread.h> -#endif - -AUDIO_REGISTER_SOURCE(REG_PRIO_MED, jack)( - int sampling_rate, const std::string &device_name, bool ok_to_block -){ - return audio_source::sptr(new audio_jack_source(sampling_rate, device_name, ok_to_block)); -} - -typedef jack_default_audio_sample_t sample_t; - - -// Number of jack buffers in the ringbuffer -// TODO: make it to match at least the quantity of items passed to work() -static const unsigned int N_BUFFERS = 16; - -static std::string -default_device_name () -{ - return gr_prefs::singleton()->get_string("audio_jack", "default_input_device", "gr_source"); -} - - -int -jack_source_process (jack_nframes_t nframes, void *arg) -{ - audio_jack_source *self = (audio_jack_source *)arg; - unsigned int write_size = nframes*sizeof(sample_t); - - if (jack_ringbuffer_write_space (self->d_ringbuffer) < write_size) { - self->d_noverruns++; - // FIXME: move this fputs out, we shouldn't use blocking calls in process() - fputs ("jO", stderr); - return 0; - } - - char *buffer = (char *) jack_port_get_buffer (self->d_jack_input_port, nframes); - - jack_ringbuffer_write (self->d_ringbuffer, buffer, write_size); - -#ifndef NO_PTHREAD - // Tell the source thread there is data in the ringbuffer. - // If it is already running, the lock will not be available. - // We can't wait here in the process() thread, but we don't - // need to signal in that case, because the source thread will - // check for data availability. - - if (pthread_mutex_trylock (&self->d_jack_process_lock) == 0) { - pthread_cond_signal (&self->d_ringbuffer_ready); - pthread_mutex_unlock (&self->d_jack_process_lock); - } -#endif - - return 0; -} - -// ---------------------------------------------------------------- - -audio_jack_source::audio_jack_source (int sampling_rate, - const std::string device_name, - bool ok_to_block) - : gr_sync_block ("audio_jack_source", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (0, 0, 0)), - d_sampling_rate (sampling_rate), - d_device_name (device_name.empty() ? default_device_name() : device_name), - d_ok_to_block(ok_to_block), - d_jack_client (0), - d_ringbuffer (0), - d_noverruns (0) -{ -#ifndef NO_PTHREAD - pthread_cond_init(&d_ringbuffer_ready, NULL);; - pthread_mutex_init(&d_jack_process_lock, NULL); -#endif - - // try to become a client of the JACK server - jack_options_t options = JackNullOption; - jack_status_t status; - const char *server_name = NULL; - if ((d_jack_client = jack_client_open (d_device_name.c_str (), - options, &status, - server_name)) == NULL) { - fprintf (stderr, "audio_jack_source[%s]: jack server not running?\n", - d_device_name.c_str()); - throw std::runtime_error ("audio_jack_source"); - } - - // tell the JACK server to call `jack_source_process()' whenever - // there is work to be done. - jack_set_process_callback (d_jack_client, &jack_source_process, (void*)this); - - // tell the JACK server to call `jack_shutdown()' if - // it ever shuts down, either entirely, or if it - // just decides to stop calling us. - - //jack_on_shutdown (d_jack_client, &jack_shutdown, (void*)this); - - d_jack_input_port = jack_port_register (d_jack_client, "in", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsInput, 0); - - - d_jack_buffer_size = jack_get_buffer_size (d_jack_client); - - set_output_multiple (d_jack_buffer_size); - - d_ringbuffer = jack_ringbuffer_create (N_BUFFERS*d_jack_buffer_size*sizeof(sample_t)); - if (d_ringbuffer == NULL) - bail ("jack_ringbuffer_create failed", 0); - - assert(sizeof(float)==sizeof(sample_t)); - set_output_signature (gr_make_io_signature (1, 1, sizeof (sample_t))); - - - jack_nframes_t sample_rate = jack_get_sample_rate (d_jack_client); - - if ((jack_nframes_t)sampling_rate != sample_rate){ - fprintf (stderr, "audio_jack_source[%s]: unable to support sampling rate %d\n", - d_device_name.c_str (), sampling_rate); - fprintf (stderr, " card requested %d instead.\n", sample_rate); - } -} - - -bool -audio_jack_source::check_topology (int ninputs, int noutputs) -{ - // tell the JACK server that we are ready to roll - if (jack_activate (d_jack_client)) - throw std::runtime_error ("audio_jack_source"); - - return true; -} - -audio_jack_source::~audio_jack_source () -{ - jack_client_close (d_jack_client); - jack_ringbuffer_free (d_ringbuffer); -} - -int -audio_jack_source::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - // read_size and work_size are in bytes - unsigned int read_size; - - // Minimize latency - noutput_items = std::min (noutput_items, (int)d_jack_buffer_size); - - int work_size = noutput_items*sizeof(sample_t); - - while (work_size > 0) { - unsigned int read_space; // bytes - -#ifdef NO_PTHREAD - while ((read_space=jack_ringbuffer_read_space (d_ringbuffer)) < - d_jack_buffer_size*sizeof(sample_t)) { - usleep(1000000*((d_jack_buffer_size-read_space/sizeof(sample_t))/d_sampling_rate)); - } -#else - // JACK actually requires POSIX - - pthread_mutex_lock (&d_jack_process_lock); - while ((read_space=jack_ringbuffer_read_space (d_ringbuffer)) < - d_jack_buffer_size*sizeof(sample_t)) { - - // wait until jack_source_process() signals more data - pthread_cond_wait (&d_ringbuffer_ready, &d_jack_process_lock); - } - pthread_mutex_unlock (&d_jack_process_lock); -#endif - - read_space -= read_space%(d_jack_buffer_size*sizeof(sample_t)); - read_size = std::min(read_space, (unsigned int)work_size); - - if (jack_ringbuffer_read (d_ringbuffer, (char *) output_items[0], - read_size) < read_size) { - bail ("jack_ringbuffer_read failed", 0); - } - work_size -= read_size; - } - - return noutput_items; -} - -void -audio_jack_source::output_error_msg (const char *msg, int err) -{ - fprintf (stderr, "audio_jack_source[%s]: %s: %d\n", - d_device_name.c_str (), msg, err); -} - -void -audio_jack_source::bail (const char *msg, int err) throw (std::runtime_error) -{ - output_error_msg (msg, err); - throw std::runtime_error ("audio_jack_source"); -} diff --git a/gr-audio/lib/jack/audio_jack_source.h b/gr-audio/lib/jack/audio_jack_source.h deleted file mode 100644 index 2849c84b0..000000000 --- a/gr-audio/lib/jack/audio_jack_source.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-2011 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 INCLUDED_AUDIO_JACK_SOURCE_H -#define INCLUDED_AUDIO_JACK_SOURCE_H - -#include <gr_audio_source.h> -#include <string> -#include <jack/jack.h> -#include <jack/ringbuffer.h> -#include <stdexcept> - -int jack_source_process (jack_nframes_t nframes, void *arg); - -/*! - * \brief audio source using JACK - * \ingroup audio_blk - * - * The source has one input stream of floats. - * - * Output samples will be in the range [-1,1]. - */ -class audio_jack_source : public audio_source { - - friend int jack_source_process (jack_nframes_t nframes, void *arg); - - // typedef for pointer to class work method - typedef int (audio_jack_source::*work_t)(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - unsigned int d_sampling_rate; - std::string d_device_name; - bool d_ok_to_block; - - jack_client_t *d_jack_client; - jack_port_t *d_jack_input_port; - jack_ringbuffer_t *d_ringbuffer; - jack_nframes_t d_jack_buffer_size; - pthread_cond_t d_ringbuffer_ready; - pthread_mutex_t d_jack_process_lock; - - // random stats - int d_noverruns; // count of overruns - - void output_error_msg (const char *msg, int err); - void bail (const char *msg, int err) throw (std::runtime_error); - - -public: - audio_jack_source (int sampling_rate, const std::string device_name, bool ok_to_block); - - ~audio_jack_source (); - - bool check_topology (int ninputs, int noutputs); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_AUDIO_JACK_SOURCE_H */ diff --git a/gr-audio/lib/jack/gr-audio-jack.conf b/gr-audio/lib/jack/gr-audio-jack.conf deleted file mode 100644 index bdbc1fd1d..000000000 --- a/gr-audio/lib/jack/gr-audio-jack.conf +++ /dev/null @@ -1,8 +0,0 @@ -# This file contains system wide configuration data for GNU Radio. -# You may override any setting on a per-user basis by editing -# ~/.gnuradio/config.conf - -[audio_jack] - -default_input_device = gr_source -default_output_device = gr_sink diff --git a/gr-audio/lib/jack/gri_jack.cc b/gr-audio/lib/jack/gri_jack.cc deleted file mode 100644 index 793ed8336..000000000 --- a/gr-audio/lib/jack/gri_jack.cc +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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 <gri_jack.h> -#include <algorithm> - - diff --git a/gr-audio/lib/jack/gri_jack.h b/gr-audio/lib/jack/gri_jack.h deleted file mode 100644 index 5dcd3b811..000000000 --- a/gr-audio/lib/jack/gri_jack.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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 INCLUDED_GRI_JACK_H -#define INCLUDED_GRI_JACK_H - -#include <stdio.h> - -#endif /* INCLUDED_GRI_JACK_H */ diff --git a/gr-audio/lib/oss/audio_oss_sink.cc b/gr-audio/lib/oss/audio_oss_sink.cc deleted file mode 100644 index 26b71be24..000000000 --- a/gr-audio/lib/oss/audio_oss_sink.cc +++ /dev/null @@ -1,161 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2011 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 "gr_audio_registry.h" -#include <audio_oss_sink.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <sys/soundcard.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdio.h> -#include <iostream> -#include <stdexcept> - -AUDIO_REGISTER_SINK(REG_PRIO_LOW, oss)( - int sampling_rate, const std::string &device_name, bool ok_to_block -){ - return audio_sink::sptr(new audio_oss_sink(sampling_rate, device_name, ok_to_block)); -} - -static std::string -default_device_name () -{ - return gr_prefs::singleton()->get_string("audio_oss", "default_output_device", "/dev/dsp"); -} - -audio_oss_sink::audio_oss_sink (int sampling_rate, - const std::string device_name, - bool ok_to_block) - : gr_sync_block ("audio_oss_sink", - gr_make_io_signature (1, 2, sizeof (float)), - gr_make_io_signature (0, 0, 0)), - d_sampling_rate (sampling_rate), - d_device_name (device_name.empty() ? default_device_name() : device_name), - d_fd (-1), d_buffer (0), d_chunk_size (0) -{ - if ((d_fd = open (d_device_name.c_str (), O_WRONLY)) < 0){ - fprintf (stderr, "audio_oss_sink: "); - perror (d_device_name.c_str ()); - throw std::runtime_error ("audio_oss_sink"); - } - - double CHUNK_TIME = - std::max(0.001, gr_prefs::singleton()->get_double("audio_oss", "latency", 0.005)); - - d_chunk_size = (int) (d_sampling_rate * CHUNK_TIME); - set_output_multiple (d_chunk_size); - - d_buffer = new short [d_chunk_size * 2]; - - int format = AFMT_S16_NE; - int orig_format = format; - if (ioctl (d_fd, SNDCTL_DSP_SETFMT, &format) < 0){ - std::cerr << "audio_oss_sink: " << d_device_name << " ioctl failed\n"; - perror (d_device_name.c_str ()); - throw std::runtime_error ("audio_oss_sink"); - } - - if (format != orig_format){ - fprintf (stderr, "audio_oss_sink: unable to support format %d\n", orig_format); - fprintf (stderr, " card requested %d instead.\n", format); - } - - // set to stereo no matter what. Some hardware only does stereo - int channels = 2; - if (ioctl (d_fd, SNDCTL_DSP_CHANNELS, &channels) < 0 || channels != 2){ - perror ("audio_oss_sink: could not set STEREO mode"); - throw std::runtime_error ("audio_oss_sink"); - } - - // set sampling freq - int sf = sampling_rate; - if (ioctl (d_fd, SNDCTL_DSP_SPEED, &sf) < 0){ - std::cerr << "audio_oss_sink: " - << d_device_name << ": invalid sampling_rate " - << sampling_rate << "\n"; - sampling_rate = 8000; - if (ioctl (d_fd, SNDCTL_DSP_SPEED, &sf) < 0){ - std::cerr << "audio_oss_sink: failed to set sampling_rate to 8000\n"; - throw std::runtime_error ("audio_oss_sink"); - } - } -} - -audio_oss_sink::~audio_oss_sink () -{ - close (d_fd); - delete [] d_buffer; -} - - -int -audio_oss_sink::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *f0, *f1; - - switch (input_items.size ()){ - - case 1: // mono input - - f0 = (const float *) input_items[0]; - - for (int i = 0; i < noutput_items; i += d_chunk_size){ - for (int j = 0; j < d_chunk_size; j++){ - d_buffer[2*j+0] = (short) (f0[j] * 32767); - d_buffer[2*j+1] = (short) (f0[j] * 32767); - } - f0 += d_chunk_size; - if (write (d_fd, d_buffer, 2 * d_chunk_size * sizeof (short)) < 0) - perror ("audio_oss_sink: write"); - } - break; - - case 2: // stereo input - - f0 = (const float *) input_items[0]; - f1 = (const float *) input_items[1]; - - for (int i = 0; i < noutput_items; i += d_chunk_size){ - for (int j = 0; j < d_chunk_size; j++){ - d_buffer[2*j+0] = (short) (f0[j] * 32767); - d_buffer[2*j+1] = (short) (f1[j] * 32767); - } - f0 += d_chunk_size; - f1 += d_chunk_size; - if (write (d_fd, d_buffer, 2 * d_chunk_size * sizeof (short)) < 0) - perror ("audio_oss_sink: write"); - } - break; - } - - return noutput_items; -} diff --git a/gr-audio/lib/oss/audio_oss_sink.h b/gr-audio/lib/oss/audio_oss_sink.h deleted file mode 100644 index 8148ec34b..000000000 --- a/gr-audio/lib/oss/audio_oss_sink.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2011 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 INCLUDED_AUDIO_OSS_SINK_H -#define INCLUDED_AUDIO_OSS_SINK_H - -#include <gr_audio_sink.h> -#include <string> - -/*! - * \brief audio sink using OSS - * \ingroup audio_blk - * - * input signature is one or two streams of floats. - * Input samples must be in the range [-1,1]. - */ - -class audio_oss_sink : public audio_sink { - - int d_sampling_rate; - std::string d_device_name; - int d_fd; - short *d_buffer; - int d_chunk_size; - -public: - audio_oss_sink (int sampling_rate, const std::string device_name = "", bool ok_to_block = true); - - ~audio_oss_sink (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_AUDIO_OSS_SINK_H */ diff --git a/gr-audio/lib/oss/audio_oss_source.cc b/gr-audio/lib/oss/audio_oss_source.cc deleted file mode 100644 index e186e30ae..000000000 --- a/gr-audio/lib/oss/audio_oss_source.cc +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2011 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 "gr_audio_registry.h" -#include <audio_oss_source.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <sys/soundcard.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdio.h> -#include <iostream> -#include <stdexcept> - -AUDIO_REGISTER_SOURCE(REG_PRIO_LOW, oss)( - int sampling_rate, const std::string &device_name, bool ok_to_block -){ - return audio_source::sptr(new audio_oss_source(sampling_rate, device_name, ok_to_block)); -} - -static std::string -default_device_name () -{ - return gr_prefs::singleton()->get_string("audio_oss", "default_input_device", "/dev/dsp"); -} - -audio_oss_source::audio_oss_source (int sampling_rate, - const std::string device_name, - bool ok_to_block) - : gr_sync_block ("audio_oss_source", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 2, sizeof (float))), - d_sampling_rate (sampling_rate), - d_device_name (device_name.empty() ? default_device_name() : device_name), - d_fd (-1), d_buffer (0), d_chunk_size (0) -{ - if ((d_fd = open (d_device_name.c_str (), O_RDONLY)) < 0){ - fprintf (stderr, "audio_oss_source: "); - perror (d_device_name.c_str ()); - throw std::runtime_error ("audio_oss_source"); - } - - double CHUNK_TIME = - std::max(0.001, gr_prefs::singleton()->get_double("audio_oss", "latency", 0.005)); - - d_chunk_size = (int) (d_sampling_rate * CHUNK_TIME); - set_output_multiple (d_chunk_size); - - d_buffer = new short [d_chunk_size * 2]; - - int format = AFMT_S16_NE; - int orig_format = format; - if (ioctl (d_fd, SNDCTL_DSP_SETFMT, &format) < 0){ - std::cerr << "audio_oss_source: " << d_device_name << " ioctl failed\n"; - perror (d_device_name.c_str ()); - throw std::runtime_error ("audio_oss_source"); - } - - if (format != orig_format){ - fprintf (stderr, "audio_oss_source: unable to support format %d\n", orig_format); - fprintf (stderr, " card requested %d instead.\n", format); - } - - // set to stereo no matter what. Some hardware only does stereo - int channels = 2; - if (ioctl (d_fd, SNDCTL_DSP_CHANNELS, &channels) < 0 || channels != 2){ - perror ("audio_oss_source: could not set STEREO mode"); - throw std::runtime_error ("audio_oss_source"); - } - - // set sampling freq - int sf = sampling_rate; - if (ioctl (d_fd, SNDCTL_DSP_SPEED, &sf) < 0){ - std::cerr << "audio_oss_source: " - << d_device_name << ": invalid sampling_rate " - << sampling_rate << "\n"; - sampling_rate = 8000; - if (ioctl (d_fd, SNDCTL_DSP_SPEED, &sf) < 0){ - std::cerr << "audio_oss_source: failed to set sampling_rate to 8000\n"; - throw std::runtime_error ("audio_oss_source"); - } - } -} - -audio_oss_source::~audio_oss_source () -{ - close (d_fd); - delete [] d_buffer; -} - -int -audio_oss_source::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *f0 = (float *) output_items[0]; - float *f1 = (float *) output_items[1]; // will be invalid if this is mono output - - const int shorts_per_item = 2; // L + R - const int bytes_per_item = shorts_per_item * sizeof (short); - - // To minimize latency, never return more than CHUNK_TIME - // worth of samples per call to work. - - noutput_items = std::min (noutput_items, d_chunk_size); - - int base = 0; - int ntogo = noutput_items; - - while (ntogo > 0){ - int nbytes = std::min (ntogo, d_chunk_size) * bytes_per_item; - int result_nbytes = read (d_fd, d_buffer, nbytes); - - if (result_nbytes < 0){ - perror ("audio_oss_source"); - return -1; // say we're done - } - - if ((result_nbytes & (bytes_per_item - 1)) != 0){ - fprintf (stderr, "audio_oss_source: internal error.\n"); - throw std::runtime_error ("internal error"); - } - - int result_nitems = result_nbytes / bytes_per_item; - - // now unpack samples into output streams - - switch (output_items.size ()){ - case 1: // mono output - for (int i = 0; i < result_nitems; i++){ - f0[base+i] = d_buffer[2*i+0] * (1.0 / 32767); - } - break; - - case 2: // stereo output - for (int i = 0; i < result_nitems; i++){ - f0[base+i] = d_buffer[2*i+0] * (1.0 / 32767); - f1[base+i] = d_buffer[2*i+1] * (1.0 / 32767); - } - break; - - default: - assert (0); - } - - ntogo -= result_nitems; - base += result_nitems; - } - - return noutput_items - ntogo; -} diff --git a/gr-audio/lib/oss/audio_oss_source.h b/gr-audio/lib/oss/audio_oss_source.h deleted file mode 100644 index abb2db1f8..000000000 --- a/gr-audio/lib/oss/audio_oss_source.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2011 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 INCLUDED_AUDIO_OSS_SOURCE_H -#define INCLUDED_AUDIO_OSS_SOURCE_H - -#include <gr_audio_source.h> -#include <string> - -/*! - * \brief audio source using OSS - * \ingroup audio_blk - * - * Output signature is one or two streams of floats. - * Output samples will be in the range [-1,1]. - */ - -class audio_oss_source : public audio_source { - - int d_sampling_rate; - std::string d_device_name; - int d_fd; - short *d_buffer; - int d_chunk_size; - -public: - audio_oss_source (int sampling_rate, - const std::string device_name = "", - bool ok_to_block = true); - - ~audio_oss_source (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - - -#endif /* INCLUDED_AUDIO_OSS_SOURCE_H */ diff --git a/gr-audio/lib/oss/gr-audio-oss.conf b/gr-audio/lib/oss/gr-audio-oss.conf deleted file mode 100644 index 6ea14d67e..000000000 --- a/gr-audio/lib/oss/gr-audio-oss.conf +++ /dev/null @@ -1,9 +0,0 @@ -# This file contains system wide configuration data for GNU Radio. -# You may override any setting on a per-user basis by editing -# ~/.gnuradio/config.conf - -[audio_oss] - -default_input_device = /dev/dsp -default_output_device = /dev/dsp -latency = 0.005 # in seconds diff --git a/gr-audio/lib/osx/audio_osx.h b/gr-audio/lib/osx/audio_osx.h deleted file mode 100644 index 8c9543d0d..000000000 --- a/gr-audio/lib/osx/audio_osx.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_AUDIO_OSX_H -#define INCLUDED_AUDIO_OSX_H - -#include <iostream> -#include <string.h> - -#define CheckErrorAndThrow(err,what,throw_str) \ - if (err) { \ - OSStatus error = static_cast<OSStatus>(err); \ - char err_str[4]; \ - strncpy (err_str, (char*)(&err), 4); \ - std::cerr << what << std::endl; \ - std::cerr << " Error# " << error << " ('" << err_str \ - << "')" << std::endl; \ - std::cerr << " " << __FILE__ << ":" << __LINE__ << std::endl; \ - fflush (stderr); \ - throw std::runtime_error (throw_str); \ - } - -#define CheckError(err,what) \ - if (err) { \ - OSStatus error = static_cast<OSStatus>(err); \ - char err_str[4]; \ - strncpy (err_str, (char*)(&err), 4); \ - std::cerr << what << std::endl; \ - std::cerr << " Error# " << error << " ('" << err_str \ - << "')" << std::endl; \ - std::cerr << " " << __FILE__ << ":" << __LINE__ << std::endl; \ - fflush (stderr); \ - } - -#include <boost/detail/endian.hpp> //BOOST_BIG_ENDIAN -#ifdef BOOST_BIG_ENDIAN -#define GR_PCM_ENDIANNESS kLinearPCMFormatFlagIsBigEndian -#else -#define GR_PCM_ENDIANNESS 0 -#endif - -// Check the version of MacOSX being used -#ifdef __APPLE_CC__ -#include <AvailabilityMacros.h> -#ifndef MAC_OS_X_VERSION_10_6 -#define MAC_OS_X_VERSION_10_6 1060 -#endif -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 -#define GR_USE_OLD_AUDIO_UNIT -#endif -#endif - -#endif /* INCLUDED_AUDIO_OSX_H */ diff --git a/gr-audio/lib/osx/audio_osx_sink.cc b/gr-audio/lib/osx/audio_osx_sink.cc deleted file mode 100644 index 939e5e0a1..000000000 --- a/gr-audio/lib/osx/audio_osx_sink.cc +++ /dev/null @@ -1,404 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006-2011 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 "gr_audio_registry.h" -#include <audio_osx_sink.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <audio_osx.h> - -#define _OSX_AU_DEBUG_ 0 - -AUDIO_REGISTER_SINK(REG_PRIO_HIGH, osx)( - int sampling_rate, const std::string &device_name, bool ok_to_block -){ - return audio_sink::sptr(new audio_osx_sink(sampling_rate, device_name, ok_to_block)); -} - -audio_osx_sink::audio_osx_sink (int sample_rate, - const std::string device_name, - bool do_block, - int channel_config, - int max_sample_count) - : gr_sync_block ("audio_osx_sink", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (0, 0, 0)), - d_sample_rate (0.0), d_channel_config (0), d_n_channels (0), - d_queueSampleCount (0), d_max_sample_count (0), - d_do_block (do_block), d_internal (0), d_cond_data (0), - d_OutputAU (0) -{ - if (sample_rate <= 0) { - std::cerr << "Invalid Sample Rate: " << sample_rate << std::endl; - throw std::invalid_argument ("audio_osx_sink::audio_osx_sink"); - } else - d_sample_rate = (Float64) sample_rate; - - if (channel_config <= 0 & channel_config != -1) { - std::cerr << "Invalid Channel Config: " << channel_config << std::endl; - throw std::invalid_argument ("audio_osx_sink::audio_osx_sink"); - } else if (channel_config == -1) { -// no user input; try "device name" instead - int l_n_channels = (int) strtol (device_name.data(), (char **)NULL, 10); - if (l_n_channels == 0 & errno) { - std::cerr << "Error Converting Device Name: " << errno << std::endl; - throw std::invalid_argument ("audio_osx_sink::audio_osx_sink"); - } - if (l_n_channels <= 0) - channel_config = 2; - else - channel_config = l_n_channels; - } - - d_n_channels = d_channel_config = channel_config; - -// set the input signature - - set_input_signature (gr_make_io_signature (1, d_n_channels, sizeof (float))); - -// check that the max # of samples to store is valid - - if (max_sample_count == -1) - max_sample_count = sample_rate; - else if (max_sample_count <= 0) { - std::cerr << "Invalid Max Sample Count: " << max_sample_count << std::endl; - throw std::invalid_argument ("audio_osx_sink::audio_osx_sink"); - } - - d_max_sample_count = max_sample_count; - -// allocate the output circular buffer(s), one per channel - - d_buffers = (circular_buffer<float>**) new - circular_buffer<float>* [d_n_channels]; - UInt32 n_alloc = (UInt32) ceil ((double) d_max_sample_count); - for (UInt32 n = 0; n < d_n_channels; n++) { - d_buffers[n] = new circular_buffer<float> (n_alloc, false, false); - } - -// create the default AudioUnit for output - OSStatus err = noErr; - -// Open the default output unit -#ifndef GR_USE_OLD_AUDIO_UNIT - AudioComponentDescription desc; -#else - ComponentDescription desc; -#endif - - desc.componentType = kAudioUnitType_Output; - desc.componentSubType = kAudioUnitSubType_DefaultOutput; - desc.componentManufacturer = kAudioUnitManufacturer_Apple; - desc.componentFlags = 0; - desc.componentFlagsMask = 0; - -#ifndef GR_USE_OLD_AUDIO_UNIT - AudioComponent comp = AudioComponentFindNext(NULL, &desc); - if (comp == NULL) { - std::cerr << "AudioComponentFindNext Error" << std::endl; - throw std::runtime_error ("audio_osx_sink::audio_osx_sink"); - } -#else - Component comp = FindNextComponent (NULL, &desc); - if (comp == NULL) { - std::cerr << "FindNextComponent Error" << std::endl; - throw std::runtime_error ("audio_osx_sink::audio_osx_sink"); - } -#endif - -#ifndef GR_USE_OLD_AUDIO_UNIT - err = AudioComponentInstanceNew (comp, &d_OutputAU); - CheckErrorAndThrow (err, "AudioComponentInstanceNew", "audio_osx_sink::audio_osx_sink"); -#else - err = OpenAComponent (comp, &d_OutputAU); - CheckErrorAndThrow (err, "OpenAComponent", "audio_osx_sink::audio_osx_sink"); -#endif - -// Set up a callback function to generate output to the output unit - - AURenderCallbackStruct input; - input.inputProc = (AURenderCallback)(audio_osx_sink::AUOutputCallback); - input.inputProcRefCon = this; - - err = AudioUnitSetProperty (d_OutputAU, - kAudioUnitProperty_SetRenderCallback, - kAudioUnitScope_Input, - 0, - &input, - sizeof (input)); - CheckErrorAndThrow (err, "AudioUnitSetProperty Render Callback", "audio_osx_sink::audio_osx_sink"); - -// tell the Output Unit what format data will be supplied to it -// so that it handles any format conversions - - AudioStreamBasicDescription streamFormat; - streamFormat.mSampleRate = (Float64)(sample_rate); - streamFormat.mFormatID = kAudioFormatLinearPCM; - streamFormat.mFormatFlags = (kLinearPCMFormatFlagIsFloat | - GR_PCM_ENDIANNESS | - kLinearPCMFormatFlagIsPacked | - kAudioFormatFlagIsNonInterleaved); - streamFormat.mBytesPerPacket = 4; - streamFormat.mFramesPerPacket = 1; - streamFormat.mBytesPerFrame = 4; - streamFormat.mChannelsPerFrame = d_n_channels; - streamFormat.mBitsPerChannel = 32; - - err = AudioUnitSetProperty (d_OutputAU, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Input, - 0, - &streamFormat, - sizeof (AudioStreamBasicDescription)); - CheckErrorAndThrow (err, "AudioUnitSetProperty StreamFormat", "audio_osx_sink::audio_osx_sink"); - -// create the stuff to regulate I/O - - d_cond_data = new gruel::condition_variable (); - if (d_cond_data == NULL) - CheckErrorAndThrow (errno, "new condition (data)", - "audio_osx_sink::audio_osx_sink"); - - d_internal = new gruel::mutex (); - if (d_internal == NULL) - CheckErrorAndThrow (errno, "new mutex (internal)", - "audio_osx_sink::audio_osx_sink"); - -// initialize the AU for output - - err = AudioUnitInitialize (d_OutputAU); - CheckErrorAndThrow (err, "AudioUnitInitialize", - "audio_osx_sink::audio_osx_sink"); - -#if _OSX_AU_DEBUG_ - std::cerr << "audio_osx_sink Parameters:" << std::endl; - std::cerr << " Sample Rate is " << d_sample_rate << std::endl; - std::cerr << " Number of Channels is " << d_n_channels << std::endl; - std::cerr << " Max # samples to store per channel is " << d_max_sample_count << std::endl; -#endif -} - -bool audio_osx_sink::IsRunning () -{ - UInt32 AURunning = 0, AUSize = sizeof (UInt32); - - OSStatus err = AudioUnitGetProperty (d_OutputAU, - kAudioOutputUnitProperty_IsRunning, - kAudioUnitScope_Global, - 0, - &AURunning, - &AUSize); - CheckErrorAndThrow (err, "AudioUnitGetProperty IsRunning", - "audio_osx_sink::IsRunning"); - - return (AURunning); -} - -bool audio_osx_sink::start () -{ - if (! IsRunning ()) { - OSStatus err = AudioOutputUnitStart (d_OutputAU); - CheckErrorAndThrow (err, "AudioOutputUnitStart", "audio_osx_sink::start"); - } - - return (true); -} - -bool audio_osx_sink::stop () -{ - if (IsRunning ()) { - OSStatus err = AudioOutputUnitStop (d_OutputAU); - CheckErrorAndThrow (err, "AudioOutputUnitStop", "audio_osx_sink::stop"); - - for (UInt32 n = 0; n < d_n_channels; n++) { - d_buffers[n]->abort (); - } - } - - return (true); -} - -audio_osx_sink::~audio_osx_sink () -{ -// stop and close the AudioUnit - stop (); - AudioUnitUninitialize (d_OutputAU); -#ifndef GR_USE_OLD_AUDIO_UNIT - AudioComponentInstanceDispose (d_OutputAU); -#else - CloseComponent (d_OutputAU); -#endif - -// empty and delete the queues - for (UInt32 n = 0; n < d_n_channels; n++) { - delete d_buffers[n]; - d_buffers[n] = 0; - } - delete [] d_buffers; - d_buffers = 0; - -// close and delete control stuff - delete d_cond_data; - d_cond_data = 0; - delete d_internal; - d_internal = 0; -} - -int -audio_osx_sink::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gruel::scoped_lock l (*d_internal); - - /* take the input data, copy it, and push it to the bottom of the queue - mono input are pushed onto queue[0]; - stereo input are pushed onto queue[1]. - Start the AudioUnit if necessary. */ - - UInt32 l_max_count; - int diff_count = d_max_sample_count - noutput_items; - if (diff_count < 0) - l_max_count = 0; - else - l_max_count = (UInt32) diff_count; - -#if 0 - if (l_max_count < d_queueItemLength->back()) { -// allow 2 buffers at a time, regardless of length - l_max_count = d_queueItemLength->back(); - } -#endif - -#if _OSX_AU_DEBUG_ - std::cerr << "work1: qSC = " << d_queueSampleCount << ", lMC = "<< l_max_count - << ", dmSC = " << d_max_sample_count << ", nOI = " << noutput_items << std::endl; -#endif - - if (d_queueSampleCount > l_max_count) { -// data coming in too fast; do_block decides what to do - if (d_do_block == true) { -// block until there is data to return - while (d_queueSampleCount > l_max_count) { -// release control so-as to allow data to be retrieved; -// block until there is data to return - d_cond_data->wait (l); -// the condition's 'notify' was called; acquire control -// to keep thread safe - } - } - } -// not blocking case and overflow is handled by the circular buffer - -// add the input frames to the buffers' queue, checking for overflow - - UInt32 l_counter; - int res = 0; - float* inBuffer = (float*) input_items[0]; - const UInt32 l_size = input_items.size(); - for (l_counter = 0; l_counter < l_size; l_counter++) { - inBuffer = (float*) input_items[l_counter]; - int l_res = d_buffers[l_counter]->enqueue (inBuffer, - noutput_items); - if (l_res == -1) - res = -1; - } - while (l_counter < d_n_channels) { -// for extra channels, copy the last input's data - int l_res = d_buffers[l_counter++]->enqueue (inBuffer, - noutput_items); - if (l_res == -1) - res = -1; - } - - if (res == -1) { -// data coming in too fast -// drop oldest buffer - fputs ("aO", stderr); - fflush (stderr); -// set the local number of samples available to the max - d_queueSampleCount = d_buffers[0]->buffer_length_items (); - } else { -// keep up the local sample count - d_queueSampleCount += noutput_items; - } - -#if _OSX_AU_DEBUG_ - std::cerr << "work2: #OI = " << noutput_items << ", #Cnt = " - << d_queueSampleCount << ", mSC = " << d_max_sample_count << std::endl; -#endif - - return (noutput_items); -} - -OSStatus audio_osx_sink::AUOutputCallback -(void *inRefCon, - AudioUnitRenderActionFlags *ioActionFlags, - const AudioTimeStamp *inTimeStamp, - UInt32 inBusNumber, - UInt32 inNumberFrames, - AudioBufferList *ioData) -{ - audio_osx_sink* This = (audio_osx_sink*) inRefCon; - OSStatus err = noErr; - - gruel::scoped_lock l (*This->d_internal); - -#if _OSX_AU_DEBUG_ - std::cerr << "cb_in: SC = " << This->d_queueSampleCount - << ", in#F = " << inNumberFrames << std::endl; -#endif - - if (This->d_queueSampleCount < inNumberFrames) { -// not enough data to fill request - err = -1; - } else { -// enough data; remove data from our buffers into the AU's buffers - int l_counter = This->d_n_channels; - - while (--l_counter >= 0) { - size_t t_n_output_items = inNumberFrames; - float* outBuffer = (float*) ioData->mBuffers[l_counter].mData; - This->d_buffers[l_counter]->dequeue (outBuffer, &t_n_output_items); - if (t_n_output_items != inNumberFrames) { - throw std::runtime_error ("audio_osx_sink::AUOutputCallback(): " - "number of available items changing " - "unexpectedly.\n"); - } - } - - This->d_queueSampleCount -= inNumberFrames; - } - -#if _OSX_AU_DEBUG_ - std::cerr << "cb_out: SC = " << This->d_queueSampleCount << std::endl; -#endif - -// signal that data is available - This->d_cond_data->notify_one (); - - return (err); -} diff --git a/gr-audio/lib/osx/audio_osx_sink.h b/gr-audio/lib/osx/audio_osx_sink.h deleted file mode 100644 index 73b3db40d..000000000 --- a/gr-audio/lib/osx/audio_osx_sink.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006-2011 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 INCLUDED_AUDIO_OSX_SINK_H -#define INCLUDED_AUDIO_OSX_SINK_H - -#include <gr_audio_sink.h> -#include <string> -#include <list> -#include <AudioUnit/AudioUnit.h> -#include <circular_buffer.h> - -/*! - * \brief audio sink using OSX - * \ingroup audio_blk - * - * input signature is one or two streams of floats. - * Input samples must be in the range [-1,1]. - */ - -class audio_osx_sink : public audio_sink { - - Float64 d_sample_rate; - int d_channel_config; - UInt32 d_n_channels; - UInt32 d_queueSampleCount, d_max_sample_count; - bool d_do_block; - gruel::mutex* d_internal; - gruel::condition_variable* d_cond_data; - circular_buffer<float>** d_buffers; - -// AudioUnits and Such - AudioUnit d_OutputAU; - -public: - audio_osx_sink (int sample_rate = 44100, - const std::string device_name = "2", - bool do_block = true, - int channel_config = -1, - int max_sample_count = -1); - - ~audio_osx_sink (); - - bool IsRunning (); - bool start (); - bool stop (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - static OSStatus AUOutputCallback (void *inRefCon, - AudioUnitRenderActionFlags *ioActionFlags, - const AudioTimeStamp *inTimeStamp, - UInt32 inBusNumber, - UInt32 inNumberFrames, - AudioBufferList *ioData); -}; - -#endif /* INCLUDED_AUDIO_OSX_SINK_H */ diff --git a/gr-audio/lib/osx/audio_osx_source.cc b/gr-audio/lib/osx/audio_osx_source.cc deleted file mode 100644 index 29f0ac381..000000000 --- a/gr-audio/lib/osx/audio_osx_source.cc +++ /dev/null @@ -1,1065 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006-2011 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 "gr_audio_registry.h" -#include <audio_osx_source.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <audio_osx.h> - -#define _OSX_AU_DEBUG_ 0 -#define _OSX_DO_LISTENERS_ 0 - -AUDIO_REGISTER_SOURCE(REG_PRIO_HIGH, osx)( - int sampling_rate, const std::string &device_name, bool ok_to_block -){ - return audio_source::sptr(new audio_osx_source(sampling_rate, device_name, ok_to_block)); -} - -void PrintStreamDesc (AudioStreamBasicDescription *inDesc) -{ - if (inDesc == NULL) { - std::cerr << "PrintStreamDesc: Can't print a NULL desc!" << std::endl; - return; - } - - std::cerr << " Sample Rate : " << inDesc->mSampleRate << std::endl; - char format_id[4]; - strncpy (format_id, (char*)(&inDesc->mFormatID), 4); - std::cerr << " Format ID : " << format_id << std::endl; - std::cerr << " Format Flags : " << inDesc->mFormatFlags << std::endl; - std::cerr << " Bytes per Packet : " << inDesc->mBytesPerPacket << std::endl; - std::cerr << " Frames per Packet : " << inDesc->mFramesPerPacket << std::endl; - std::cerr << " Bytes per Frame : " << inDesc->mBytesPerFrame << std::endl; - std::cerr << " Channels per Frame : " << inDesc->mChannelsPerFrame << std::endl; - std::cerr << " Bits per Channel : " << inDesc->mBitsPerChannel << std::endl; -} - -// FIXME these should query some kind of user preference - -audio_osx_source::audio_osx_source (int sample_rate, - const std::string device_name, - bool do_block, - int channel_config, - int max_sample_count) - : gr_sync_block ("audio_osx_source", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (0, 0, 0)), - d_deviceSampleRate (0.0), d_outputSampleRate (0.0), - d_channel_config (0), - d_inputBufferSizeFrames (0), d_inputBufferSizeBytes (0), - d_outputBufferSizeFrames (0), d_outputBufferSizeBytes (0), - d_deviceBufferSizeFrames (0), d_deviceBufferSizeBytes (0), - d_leadSizeFrames (0), d_leadSizeBytes (0), - d_trailSizeFrames (0), d_trailSizeBytes (0), - d_extraBufferSizeFrames (0), d_extraBufferSizeBytes (0), - d_queueSampleCount (0), d_max_sample_count (0), - d_n_AvailableInputFrames (0), d_n_ActualInputFrames (0), - d_n_user_channels (0), d_n_max_channels (0), d_n_deviceChannels (0), - d_do_block (do_block), d_passThrough (false), - d_internal (0), d_cond_data (0), - d_buffers (0), - d_InputAU (0), d_InputBuffer (0), d_OutputBuffer (0), - d_AudioConverter (0) -{ - if (sample_rate <= 0) { - std::cerr << "Invalid Sample Rate: " << sample_rate << std::endl; - throw std::invalid_argument ("audio_osx_source::audio_osx_source"); - } else - d_outputSampleRate = (Float64) sample_rate; - - if (channel_config <= 0 & channel_config != -1) { - std::cerr << "Invalid Channel Config: " << channel_config << std::endl; - throw std::invalid_argument ("audio_osx_source::audio_osx_source"); - } else if (channel_config == -1) { -// no user input; try "device name" instead - int l_n_channels = (int) strtol (device_name.data(), (char **)NULL, 10); - if (l_n_channels == 0 & errno) { - std::cerr << "Error Converting Device Name: " << errno << std::endl; - throw std::invalid_argument ("audio_osx_source::audio_osx_source"); - } - if (l_n_channels <= 0) - channel_config = 2; - else - channel_config = l_n_channels; - } - - d_channel_config = channel_config; - -// check that the max # of samples to store is valid - - if (max_sample_count == -1) - max_sample_count = sample_rate; - else if (max_sample_count <= 0) { - std::cerr << "Invalid Max Sample Count: " << max_sample_count << std::endl; - throw std::invalid_argument ("audio_osx_source::audio_osx_source"); - } - - d_max_sample_count = max_sample_count; - -#if _OSX_AU_DEBUG_ - std::cerr << "source(): max # samples = " << d_max_sample_count << std::endl; -#endif - - OSStatus err = noErr; - -// create the default AudioUnit for input - -// Open the default input unit -#ifndef GR_USE_OLD_AUDIO_UNIT - AudioComponentDescription InputDesc; -#else - ComponentDescription InputDesc; -#endif - - - InputDesc.componentType = kAudioUnitType_Output; - InputDesc.componentSubType = kAudioUnitSubType_HALOutput; - InputDesc.componentManufacturer = kAudioUnitManufacturer_Apple; - InputDesc.componentFlags = 0; - InputDesc.componentFlagsMask = 0; - -#ifndef GR_USE_OLD_AUDIO_UNIT - AudioComponent comp = AudioComponentFindNext (NULL, &InputDesc); -#else - Component comp = FindNextComponent (NULL, &InputDesc); -#endif - - if (comp == NULL) { -#ifndef GR_USE_OLD_AUDIO_UNIT - std::cerr << "AudioComponentFindNext Error" << std::endl; -#else - std::cerr << "FindNextComponent Error" << std::endl; -#endif - throw std::runtime_error ("audio_osx_source::audio_osx_source"); - } - -#ifndef GR_USE_OLD_AUDIO_UNIT - err = AudioComponentInstanceNew (comp, &d_InputAU); - CheckErrorAndThrow (err, "AudioComponentInstanceNew", - "audio_osx_source::audio_osx_source"); -#else - err = OpenAComponent (comp, &d_InputAU); - CheckErrorAndThrow (err, "OpenAComponent", - "audio_osx_source::audio_osx_source"); -#endif - - - UInt32 enableIO; - -// must enable the AUHAL for input and disable output -// before setting the AUHAL's current device - -// Enable input on the AUHAL - enableIO = 1; - err = AudioUnitSetProperty (d_InputAU, - kAudioOutputUnitProperty_EnableIO, - kAudioUnitScope_Input, - 1, // input element - &enableIO, - sizeof (UInt32)); - CheckErrorAndThrow (err, "AudioUnitSetProperty Input Enable", - "audio_osx_source::audio_osx_source"); - -// Disable output on the AUHAL - enableIO = 0; - err = AudioUnitSetProperty (d_InputAU, - kAudioOutputUnitProperty_EnableIO, - kAudioUnitScope_Output, - 0, // output element - &enableIO, - sizeof (UInt32)); - CheckErrorAndThrow (err, "AudioUnitSetProperty Output Disable", - "audio_osx_source::audio_osx_source"); - -// set the default input device for our input AU - - SetDefaultInputDeviceAsCurrent (); - -#if _OSX_DO_LISTENERS_ -// set up a listener if default hardware input device changes - - err = AudioHardwareAddPropertyListener - (kAudioHardwarePropertyDefaultInputDevice, - (AudioHardwarePropertyListenerProc) HardwareListener, - this); - - CheckErrorAndThrow (err, "AudioHardwareAddPropertyListener", - "audio_osx_source::audio_osx_source"); - -// Add a listener for any changes in the input AU's output stream -// the function "UnitListener" will be called if the stream format -// changes for whatever reason - - err = AudioUnitAddPropertyListener - (d_InputAU, - kAudioUnitProperty_StreamFormat, - (AudioUnitPropertyListenerProc) UnitListener, - this); - CheckErrorAndThrow (err, "Adding Unit Property Listener", - "audio_osx_source::audio_osx_source"); -#endif - -// Now find out if it actually can do input. - - UInt32 hasInput = 0; - UInt32 dataSize = sizeof (hasInput); - err = AudioUnitGetProperty (d_InputAU, - kAudioOutputUnitProperty_HasIO, - kAudioUnitScope_Input, - 1, - &hasInput, - &dataSize); - CheckErrorAndThrow (err, "AudioUnitGetProperty HasIO", - "audio_osx_source::audio_osx_source"); - if (hasInput == 0) { - std::cerr << "Selected Audio Device does not support Input." << std::endl; - throw std::runtime_error ("audio_osx_source::audio_osx_source"); - } - -// Set up a callback function to retrieve input from the Audio Device - - AURenderCallbackStruct AUCallBack; - - AUCallBack.inputProc = (AURenderCallback)(audio_osx_source::AUInputCallback); - AUCallBack.inputProcRefCon = this; - - err = AudioUnitSetProperty (d_InputAU, - kAudioOutputUnitProperty_SetInputCallback, - kAudioUnitScope_Global, - 0, - &AUCallBack, - sizeof (AURenderCallbackStruct)); - CheckErrorAndThrow (err, "AudioUnitSetProperty Input Callback", - "audio_osx_source::audio_osx_source"); - - UInt32 propertySize; - AudioStreamBasicDescription asbd_device, asbd_client, asbd_user; - -// asbd_device: ASBD of the device that is creating the input data stream -// asbd_client: ASBD of the client size (output) of the hardware device -// asbd_user: ASBD of the user's arguments - -// Get the Stream Format (device side) - - propertySize = sizeof (asbd_device); - err = AudioUnitGetProperty (d_InputAU, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Input, - 1, - &asbd_device, - &propertySize); - CheckErrorAndThrow (err, "AudioUnitGetProperty Device Input Stream Format", - "audio_osx_source::audio_osx_source"); - -#if _OSX_AU_DEBUG_ - std::cerr << std::endl << "---- Device Stream Format ----" << std::endl; - PrintStreamDesc (&asbd_device); -#endif - -// Get the Stream Format (client side) - propertySize = sizeof (asbd_client); - err = AudioUnitGetProperty (d_InputAU, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Output, - 1, - &asbd_client, - &propertySize); - CheckErrorAndThrow (err, "AudioUnitGetProperty Device Ouput Stream Format", - "audio_osx_source::audio_osx_source"); - -#if _OSX_AU_DEBUG_ - std::cerr << std::endl << "---- Client Stream Format ----" << std::endl; - PrintStreamDesc (&asbd_client); -#endif - -// Set the format of all the AUs to the input/output devices channel count - -// get the max number of input (& thus output) channels supported by -// this device - d_n_max_channels = asbd_device.mChannelsPerFrame; - -// create the output io signature; -// no input siganture to set (source is hardware) - set_output_signature (gr_make_io_signature (1, - d_n_max_channels, - sizeof (float))); - -// allocate the output circular buffer(s), one per channel - d_buffers = (circular_buffer<float>**) new - circular_buffer<float>* [d_n_max_channels]; - UInt32 n_alloc = (UInt32) ceil ((double) d_max_sample_count); - for (UInt32 n = 0; n < d_n_max_channels; n++) { - d_buffers[n] = new circular_buffer<float> (n_alloc, false, false); - } - - d_deviceSampleRate = asbd_device.mSampleRate; - d_n_deviceChannels = asbd_device.mChannelsPerFrame; - - asbd_client.mSampleRate = asbd_device.mSampleRate; - asbd_client.mFormatID = kAudioFormatLinearPCM; - asbd_client.mFormatFlags = (kAudioFormatFlagIsFloat | - kAudioFormatFlagIsPacked | - kAudioFormatFlagIsNonInterleaved); - if ((asbd_client.mFormatID == kAudioFormatLinearPCM) && - (d_n_deviceChannels == 1)) { - asbd_client.mFormatFlags &= ~kLinearPCMFormatFlagIsNonInterleaved; - } - asbd_client.mBytesPerFrame = sizeof (float); - asbd_client.mFramesPerPacket = 1; - asbd_client.mBitsPerChannel = asbd_client.mBytesPerFrame * 8; - asbd_client.mChannelsPerFrame = d_n_deviceChannels; - asbd_client.mBytesPerPacket = asbd_client.mBytesPerFrame; - - propertySize = sizeof(AudioStreamBasicDescription); - err = AudioUnitSetProperty (d_InputAU, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Output, - 1, - &asbd_client, - propertySize); - CheckErrorAndThrow (err, "AudioUnitSetProperty Device Ouput Stream Format", - "audio_osx_source::audio_osx_source"); - -// create an ASBD for the user's wants - - asbd_user.mSampleRate = d_outputSampleRate; - asbd_user.mFormatID = kAudioFormatLinearPCM; - asbd_user.mFormatFlags = (kLinearPCMFormatFlagIsFloat | - GR_PCM_ENDIANNESS | - kLinearPCMFormatFlagIsPacked | - kAudioFormatFlagIsNonInterleaved); - asbd_user.mBytesPerPacket = sizeof (float); - asbd_user.mFramesPerPacket = 1; - asbd_user.mBytesPerFrame = asbd_user.mBytesPerPacket; - asbd_user.mChannelsPerFrame = d_n_deviceChannels; - asbd_user.mBitsPerChannel = asbd_user.mBytesPerPacket * 8; - - if (d_deviceSampleRate == d_outputSampleRate) { -// no need to do conversion if asbd_client matches user wants - d_passThrough = true; - d_leadSizeFrames = d_trailSizeFrames = 0L; - } else { - d_passThrough = false; -// Create the audio converter - - err = AudioConverterNew (&asbd_client, &asbd_user, &d_AudioConverter); - CheckErrorAndThrow (err, "AudioConverterNew", - "audio_osx_source::audio_osx_source"); - -// Set the audio converter sample rate quality to "max" ... -// requires more samples, but should sound nicer - - UInt32 ACQuality = kAudioConverterQuality_Max; - propertySize = sizeof (ACQuality); - err = AudioConverterSetProperty (d_AudioConverter, - kAudioConverterSampleRateConverterQuality, - propertySize, - &ACQuality); - CheckErrorAndThrow (err, "AudioConverterSetProperty " - "SampleRateConverterQuality", - "audio_osx_source::audio_osx_source"); - -// set the audio converter's prime method to "pre", -// which uses both leading and trailing frames -// from the "current input". All of this is handled -// internally by the AudioConverter; we just supply -// the frames for conversion. - -// UInt32 ACPrimeMethod = kConverterPrimeMethod_None; - UInt32 ACPrimeMethod = kConverterPrimeMethod_Pre; - propertySize = sizeof (ACPrimeMethod); - err = AudioConverterSetProperty (d_AudioConverter, - kAudioConverterPrimeMethod, - propertySize, - &ACPrimeMethod); - CheckErrorAndThrow (err, "AudioConverterSetProperty PrimeMethod", - "audio_osx_source::audio_osx_source"); - -// Get the size of the I/O buffer(s) to allow for pre-allocated buffers - -// lead frame info (trail frame info is ignored) - - AudioConverterPrimeInfo ACPrimeInfo = {0, 0}; - propertySize = sizeof (ACPrimeInfo); - err = AudioConverterGetProperty (d_AudioConverter, - kAudioConverterPrimeInfo, - &propertySize, - &ACPrimeInfo); - CheckErrorAndThrow (err, "AudioConverterGetProperty PrimeInfo", - "audio_osx_source::audio_osx_source"); - - switch (ACPrimeMethod) { - case (kConverterPrimeMethod_None): - d_leadSizeFrames = - d_trailSizeFrames = 0L; - break; - case (kConverterPrimeMethod_Normal): - d_leadSizeFrames = 0L; - d_trailSizeFrames = ACPrimeInfo.trailingFrames; - break; - default: - d_leadSizeFrames = ACPrimeInfo.leadingFrames; - d_trailSizeFrames = ACPrimeInfo.trailingFrames; - } - } - d_leadSizeBytes = d_leadSizeFrames * sizeof (Float32); - d_trailSizeBytes = d_trailSizeFrames * sizeof (Float32); - - propertySize = sizeof (d_deviceBufferSizeFrames); - err = AudioUnitGetProperty (d_InputAU, - kAudioDevicePropertyBufferFrameSize, - kAudioUnitScope_Global, - 0, - &d_deviceBufferSizeFrames, - &propertySize); - CheckErrorAndThrow (err, "AudioUnitGetProperty Buffer Frame Size", - "audio_osx_source::audio_osx_source"); - - d_deviceBufferSizeBytes = d_deviceBufferSizeFrames * sizeof (Float32); - d_inputBufferSizeBytes = d_deviceBufferSizeBytes + d_leadSizeBytes; - d_inputBufferSizeFrames = d_deviceBufferSizeFrames + d_leadSizeFrames; - -// outBufSizeBytes = floor (inBufSizeBytes * rate_out / rate_in) -// since this is rarely exact, we need another buffer to hold -// "extra" samples not processed at any given sampling period -// this buffer must be at least 4 floats in size, but generally -// follows the rule that -// extraBufSize = ceil (rate_in / rate_out)*sizeof(float) - - d_extraBufferSizeFrames = ((UInt32) ceil (d_deviceSampleRate - / d_outputSampleRate) - * sizeof (float)); - if (d_extraBufferSizeFrames < 4) - d_extraBufferSizeFrames = 4; - d_extraBufferSizeBytes = d_extraBufferSizeFrames * sizeof (float); - - d_outputBufferSizeFrames = (UInt32) ceil (((Float64) d_inputBufferSizeFrames) - * d_outputSampleRate - / d_deviceSampleRate); - d_outputBufferSizeBytes = d_outputBufferSizeFrames * sizeof (float); - d_inputBufferSizeFrames += d_extraBufferSizeFrames; - -// pre-alloc all buffers - - AllocAudioBufferList (&d_InputBuffer, d_n_deviceChannels, - d_inputBufferSizeBytes); - if (d_passThrough == false) { - AllocAudioBufferList (&d_OutputBuffer, d_n_max_channels, - d_outputBufferSizeBytes); - } else { - d_OutputBuffer = d_InputBuffer; - } - -// create the stuff to regulate I/O - - d_cond_data = new gruel::condition_variable (); - if (d_cond_data == NULL) - CheckErrorAndThrow (errno, "new condition (data)", - "audio_osx_source::audio_osx_source"); - - d_internal = new gruel::mutex (); - if (d_internal == NULL) - CheckErrorAndThrow (errno, "new mutex (internal)", - "audio_osx_source::audio_osx_source"); - -// initialize the AU for input - - err = AudioUnitInitialize (d_InputAU); - CheckErrorAndThrow (err, "AudioUnitInitialize", - "audio_osx_source::audio_osx_source"); - -#if _OSX_AU_DEBUG_ - std::cerr << "audio_osx_source Parameters:" << std::endl; - std::cerr << " Device Sample Rate is " << d_deviceSampleRate << std::endl; - std::cerr << " User Sample Rate is " << d_outputSampleRate << std::endl; - std::cerr << " Max Sample Count is " << d_max_sample_count << std::endl; - std::cerr << " # Device Channels is " << d_n_deviceChannels << std::endl; - std::cerr << " # Max Channels is " << d_n_max_channels << std::endl; - std::cerr << " Device Buffer Size is Frames = " << d_deviceBufferSizeFrames << std::endl; - std::cerr << " Lead Size is Frames = " << d_leadSizeFrames << std::endl; - std::cerr << " Trail Size is Frames = " << d_trailSizeFrames << std::endl; - std::cerr << " Input Buffer Size is Frames = " << d_inputBufferSizeFrames << std::endl; - std::cerr << " Output Buffer Size is Frames = " << d_outputBufferSizeFrames << std::endl; -#endif -} - -void -audio_osx_source::AllocAudioBufferList (AudioBufferList** t_ABL, - UInt32 n_channels, - UInt32 bufferSizeBytes) -{ - FreeAudioBufferList (t_ABL); - UInt32 propertySize = (offsetof (AudioBufferList, mBuffers[0]) + - (sizeof (AudioBuffer) * n_channels)); - *t_ABL = (AudioBufferList*) calloc (1, propertySize); - (*t_ABL)->mNumberBuffers = n_channels; - - int counter = n_channels; - - while (--counter >= 0) { - (*t_ABL)->mBuffers[counter].mNumberChannels = 1; - (*t_ABL)->mBuffers[counter].mDataByteSize = bufferSizeBytes; - (*t_ABL)->mBuffers[counter].mData = calloc (1, bufferSizeBytes); - } -} - -void -audio_osx_source::FreeAudioBufferList (AudioBufferList** t_ABL) -{ -// free pre-allocated audio buffer, if it exists - if (*t_ABL != NULL) { - int counter = (*t_ABL)->mNumberBuffers; - while (--counter >= 0) - free ((*t_ABL)->mBuffers[counter].mData); - free (*t_ABL); - (*t_ABL) = 0; - } -} - -bool audio_osx_source::IsRunning () -{ - UInt32 AURunning = 0, AUSize = sizeof (UInt32); - - OSStatus err = AudioUnitGetProperty (d_InputAU, - kAudioOutputUnitProperty_IsRunning, - kAudioUnitScope_Global, - 0, - &AURunning, - &AUSize); - CheckErrorAndThrow (err, "AudioUnitGetProperty IsRunning", - "audio_osx_source::IsRunning"); - - return (AURunning); -} - -bool audio_osx_source::start () -{ - if (! IsRunning ()) { - OSStatus err = AudioOutputUnitStart (d_InputAU); - CheckErrorAndThrow (err, "AudioOutputUnitStart", - "audio_osx_source::start"); - } - - return (true); -} - -bool audio_osx_source::stop () -{ - if (IsRunning ()) { - OSStatus err = AudioOutputUnitStop (d_InputAU); - CheckErrorAndThrow (err, "AudioOutputUnitStart", - "audio_osx_source::stop"); - for (UInt32 n = 0; n < d_n_user_channels; n++) { - d_buffers[n]->abort (); - } - } - - return (true); -} - -audio_osx_source::~audio_osx_source () -{ - OSStatus err = noErr; - -// stop the AudioUnit - stop(); - -#if _OSX_DO_LISTENERS_ -// remove the listeners - - err = AudioUnitRemovePropertyListener - (d_InputAU, - kAudioUnitProperty_StreamFormat, - (AudioUnitPropertyListenerProc) UnitListener); - CheckError (err, "~audio_osx_source: AudioUnitRemovePropertyListener"); - - err = AudioHardwareRemovePropertyListener - (kAudioHardwarePropertyDefaultInputDevice, - (AudioHardwarePropertyListenerProc) HardwareListener); - CheckError (err, "~audio_osx_source: AudioHardwareRemovePropertyListener"); -#endif - -// free pre-allocated audio buffers - FreeAudioBufferList (&d_InputBuffer); - - if (d_passThrough == false) { - err = AudioConverterDispose (d_AudioConverter); - CheckError (err, "~audio_osx_source: AudioConverterDispose"); - FreeAudioBufferList (&d_OutputBuffer); - } - -// remove the audio unit - err = AudioUnitUninitialize (d_InputAU); - CheckError (err, "~audio_osx_source: AudioUnitUninitialize"); - -#ifndef GR_USE_OLD_AUDIO_UNIT - err = AudioComponentInstanceDispose (d_InputAU); - CheckError (err, "~audio_osx_source: AudioComponentInstanceDispose"); -#else - err = CloseComponent (d_InputAU); - CheckError (err, "~audio_osx_source: CloseComponent"); -#endif - -// empty and delete the queues - for (UInt32 n = 0; n < d_n_max_channels; n++) { - delete d_buffers[n]; - d_buffers[n] = 0; - } - delete [] d_buffers; - d_buffers = 0; - -// close and delete the control stuff - delete d_cond_data; - d_cond_data = 0; - delete d_internal; - d_internal = 0; -} - -bool -audio_osx_source::check_topology (int ninputs, int noutputs) -{ -// check # inputs to make sure it's valid - if (ninputs != 0) { - std::cerr << "audio_osx_source::check_topology(): number of input " - << "streams provided (" << ninputs - << ") should be 0." << std::endl; - throw std::runtime_error ("audio_osx_source::check_topology()"); - } - -// check # outputs to make sure it's valid - if ((noutputs < 1) | (noutputs > (int) d_n_max_channels)) { - std::cerr << "audio_osx_source::check_topology(): number of output " - << "streams provided (" << noutputs << ") should be in [1," - << d_n_max_channels << "] for the selected audio device." - << std::endl; - throw std::runtime_error ("audio_osx_source::check_topology()"); - } - -// save the actual number of output (user) channels - d_n_user_channels = noutputs; - -#if _OSX_AU_DEBUG_ - std::cerr << "chk_topo: Actual # user output channels = " - << noutputs << std::endl; -#endif - - return (true); -} - -int -audio_osx_source::work -(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - // acquire control to do processing here only - gruel::scoped_lock l (*d_internal); - -#if _OSX_AU_DEBUG_ - std::cerr << "work1: SC = " << d_queueSampleCount - << ", #OI = " << noutput_items - << ", #Chan = " << output_items.size() << std::endl; -#endif - - // set the actual # of output items to the 'desired' amount then - // verify that data is available; if not enough data is available, - // either wait until it is (is "do_block" is true), return (0) is no - // data is available and "do_block" is false, or process the actual - // amount of available data. - - UInt32 actual_noutput_items = noutput_items; - - if (d_queueSampleCount < actual_noutput_items) { - if (d_queueSampleCount == 0) { - // no data; do_block decides what to do - if (d_do_block == true) { - while (d_queueSampleCount == 0) { - // release control so-as to allow data to be retrieved; - // block until there is data to return - d_cond_data->wait (l); - // the condition's 'notify' was called; acquire control to - // keep thread safe - } - } else { - // no data & not blocking; return nothing - return (0); - } - } - // use the actual amount of available data - actual_noutput_items = d_queueSampleCount; - } - - // number of channels - int l_counter = (int) output_items.size(); - - // copy the items from the circular buffer(s) to 'work's output buffers - // verify that the number copied out is as expected. - - while (--l_counter >= 0) { - size_t t_n_output_items = actual_noutput_items; - d_buffers[l_counter]->dequeue ((float*) output_items[l_counter], - &t_n_output_items); - if (t_n_output_items != actual_noutput_items) { - std::cerr << "audio_osx_source::work(): ERROR: number of " - << "available items changing unexpectedly; expecting " - << actual_noutput_items << ", got " - << t_n_output_items << "." << std::endl; - throw std::runtime_error ("audio_osx_source::work()"); - } - } - - // subtract the actual number of items removed from the buffer(s) - // from the local accounting of the number of available samples - - d_queueSampleCount -= actual_noutput_items; - -#if _OSX_AU_DEBUG_ - std::cerr << "work2: SC = " << d_queueSampleCount - << ", act#OI = " << actual_noutput_items << std::endl - << "Returning." << std::endl; -#endif - - return (actual_noutput_items); -} - -OSStatus -audio_osx_source::ConverterCallback -(AudioConverterRef inAudioConverter, - UInt32* ioNumberDataPackets, - AudioBufferList* ioData, - AudioStreamPacketDescription** ioASPD, - void* inUserData) -{ - // take current device buffers and copy them to the tail of the - // input buffers the lead buffer is already there in the first - // d_leadSizeFrames slots - - audio_osx_source* This = static_cast<audio_osx_source*>(inUserData); - AudioBufferList* l_inputABL = This->d_InputBuffer; - UInt32 totalInputBufferSizeBytes = ((*ioNumberDataPackets) * sizeof (float)); - int counter = This->d_n_deviceChannels; - ioData->mNumberBuffers = This->d_n_deviceChannels; - This->d_n_ActualInputFrames = (*ioNumberDataPackets); - -#if _OSX_AU_DEBUG_ - std::cerr << "cc1: io#DP = " << (*ioNumberDataPackets) - << ", TIBSB = " << totalInputBufferSizeBytes - << ", #C = " << counter << std::endl; -#endif - - while (--counter >= 0) { - AudioBuffer* l_ioD_AB = &(ioData->mBuffers[counter]); - l_ioD_AB->mNumberChannels = 1; - l_ioD_AB->mData = (float*)(l_inputABL->mBuffers[counter].mData); - l_ioD_AB->mDataByteSize = totalInputBufferSizeBytes; - } - -#if _OSX_AU_DEBUG_ - std::cerr << "cc2: Returning." << std::endl; -#endif - - return (noErr); -} - -OSStatus -audio_osx_source::AUInputCallback (void* inRefCon, - AudioUnitRenderActionFlags* ioActionFlags, - const AudioTimeStamp* inTimeStamp, - UInt32 inBusNumber, - UInt32 inNumberFrames, - AudioBufferList* ioData) -{ - OSStatus err = noErr; - audio_osx_source* This = static_cast<audio_osx_source*>(inRefCon); - - gruel::scoped_lock l (*This->d_internal); - -#if _OSX_AU_DEBUG_ - std::cerr << "cb0: in#F = " << inNumberFrames - << ", inBN = " << inBusNumber - << ", SC = " << This->d_queueSampleCount << std::endl; -#endif - -// Get the new audio data from the input device - - err = AudioUnitRender (This->d_InputAU, - ioActionFlags, - inTimeStamp, - 1, //inBusNumber, - inNumberFrames, - This->d_InputBuffer); - CheckErrorAndThrow (err, "AudioUnitRender", - "audio_osx_source::AUInputCallback"); - - UInt32 AvailableInputFrames = inNumberFrames; - This->d_n_AvailableInputFrames = inNumberFrames; - -// get the number of actual output frames, -// either via converting the buffer or not - - UInt32 ActualOutputFrames; - - if (This->d_passThrough == true) { - ActualOutputFrames = AvailableInputFrames; - } else { - UInt32 AvailableInputBytes = AvailableInputFrames * sizeof (float); - UInt32 AvailableOutputBytes = AvailableInputBytes; - UInt32 AvailableOutputFrames = AvailableOutputBytes / sizeof (float); - UInt32 propertySize = sizeof (AvailableOutputBytes); - err = AudioConverterGetProperty (This->d_AudioConverter, - kAudioConverterPropertyCalculateOutputBufferSize, - &propertySize, - &AvailableOutputBytes); - CheckErrorAndThrow (err, "AudioConverterGetProperty CalculateOutputBufferSize", "audio_osx_source::audio_osx_source"); - - AvailableOutputFrames = AvailableOutputBytes / sizeof (float); - -#if 0 -// when decimating too much, the output sounds warbly due to -// fluctuating # of output frames -// This should not be a surprise, but there's probably some -// clever programming that could lessed the effect ... -// like finding the "ideal" # of output frames, and keeping -// that number constant no matter the # of input frames - UInt32 l_InputBytes = AvailableOutputBytes; - propertySize = sizeof (AvailableOutputBytes); - err = AudioConverterGetProperty (This->d_AudioConverter, - kAudioConverterPropertyCalculateInputBufferSize, - &propertySize, - &l_InputBytes); - CheckErrorAndThrow (err, "AudioConverterGetProperty CalculateInputBufferSize", "audio_osx_source::audio_osx_source"); - - if (l_InputBytes < AvailableInputBytes) { -// OK to zero pad the input a little - AvailableOutputFrames += 1; - AvailableOutputBytes = AvailableOutputFrames * sizeof (float); - } -#endif - -#if _OSX_AU_DEBUG_ - std::cerr << "cb1: avail: #IF = " << AvailableInputFrames - << ", #OF = " << AvailableOutputFrames << std::endl; -#endif - ActualOutputFrames = AvailableOutputFrames; - -// convert the data to the correct rate -// on input, ActualOutputFrames is the number of available output frames - - err = AudioConverterFillComplexBuffer (This->d_AudioConverter, - (AudioConverterComplexInputDataProc)(This->ConverterCallback), - inRefCon, - &ActualOutputFrames, - This->d_OutputBuffer, - NULL); - CheckErrorAndThrow (err, "AudioConverterFillComplexBuffer", - "audio_osx_source::AUInputCallback"); - -// on output, ActualOutputFrames is the actual number of output frames - -#if _OSX_AU_DEBUG_ - std::cerr << "cb2: actual: #IF = " << This->d_n_ActualInputFrames - << ", #OF = " << AvailableOutputFrames << std::endl; - if (This->d_n_ActualInputFrames != AvailableInputFrames) - std::cerr << "cb2.1: avail#IF = " << AvailableInputFrames - << ", actual#IF = " << This->d_n_ActualInputFrames << std::endl; -#endif - } - -// add the output frames to the buffers' queue, checking for overflow - - int l_counter = This->d_n_user_channels; - int res = 0; - - while (--l_counter >= 0) { - float* inBuffer = (float*) This->d_OutputBuffer->mBuffers[l_counter].mData; - -#if _OSX_AU_DEBUG_ - std::cerr << "cb3: enqueuing audio data." << std::endl; -#endif - - int l_res = This->d_buffers[l_counter]->enqueue (inBuffer, ActualOutputFrames); - if (l_res == -1) - res = -1; - } - - if (res == -1) { -// data coming in too fast -// drop oldest buffer - fputs ("aO", stderr); - fflush (stderr); -// set the local number of samples available to the max - This->d_queueSampleCount = This->d_buffers[0]->buffer_length_items (); - } else { -// keep up the local sample count - This->d_queueSampleCount += ActualOutputFrames; - } - -#if _OSX_AU_DEBUG_ - std::cerr << "cb4: #OI = " << ActualOutputFrames - << ", #Cnt = " << This->d_queueSampleCount - << ", mSC = " << This->d_max_sample_count << std::endl; -#endif - -// signal that data is available, if appropraite - This->d_cond_data->notify_one (); - -#if _OSX_AU_DEBUG_ - std::cerr << "cb5: returning." << std::endl; -#endif - - return (err); -} - -void -audio_osx_source::SetDefaultInputDeviceAsCurrent -() -{ -// set the default input device - AudioDeviceID deviceID = 0; - UInt32 dataSize = sizeof (AudioDeviceID); - OSStatus err = noErr; - -#ifndef GR_USE_OLD_AUDIO_UNIT - AudioObjectPropertyAddress theAddress = - { kAudioHardwarePropertyDefaultInputDevice, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster }; - - err = AudioObjectGetPropertyData - (kAudioObjectSystemObject, - &theAddress, - 0, - NULL, - &dataSize, - &deviceID); -#else - err = AudioHardwareGetProperty - (kAudioHardwarePropertyDefaultInputDevice, - &dataSize, - &deviceID); -#endif - - CheckErrorAndThrow (err, "Get Audio Unit Property for Current Device", - "audio_osx_source::SetDefaultInputDeviceAsCurrent"); - - err = AudioUnitSetProperty - (d_InputAU, - kAudioOutputUnitProperty_CurrentDevice, - kAudioUnitScope_Global, - 0, - &deviceID, - sizeof (AudioDeviceID)); - - CheckErrorAndThrow (err, "AudioUnitSetProperty Current Device", - "audio_osx_source::SetDefaultInputDeviceAsCurrent"); -} - -#if _OSX_DO_LISTENERS_ -OSStatus -audio_osx_source::HardwareListener -(AudioHardwarePropertyID inPropertyID, - void *inClientData) -{ - OSStatus err = noErr; - audio_osx_source* This = static_cast<audio_osx_source*>(inClientData); - - std::cerr << "a_o_s::HardwareListener" << std::endl; - -// set the new default hardware input device for use by our AU - - This->SetDefaultInputDeviceAsCurrent (); - -// reset the converter to tell it that the stream has changed - - err = AudioConverterReset (This->d_AudioConverter); - CheckErrorAndThrow (err, "AudioConverterReset", - "audio_osx_source::UnitListener"); - - return (err); -} - -OSStatus -audio_osx_source::UnitListener -(void *inRefCon, - AudioUnit ci, - AudioUnitPropertyID inID, - AudioUnitScope inScope, - AudioUnitElement inElement) -{ - OSStatus err = noErr; - audio_osx_source* This = static_cast<audio_osx_source*>(inRefCon); - AudioStreamBasicDescription asbd; - - std::cerr << "a_o_s::UnitListener" << std::endl; - -// get the converter's input ASBD (for printing) - - UInt32 propertySize = sizeof (asbd); - err = AudioConverterGetProperty (This->d_AudioConverter, - kAudioConverterCurrentInputStreamDescription, - &propertySize, - &asbd); - CheckErrorAndThrow (err, "AudioConverterGetProperty " - "CurrentInputStreamDescription", - "audio_osx_source::UnitListener"); - - std::cerr << "UnitListener: Input Source changed." << std::endl - << "Old Source Output Info:" << std::endl; - PrintStreamDesc (&asbd); - -// get the new input unit's output ASBD - - propertySize = sizeof (asbd); - err = AudioUnitGetProperty (This->d_InputAU, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Output, 1, - &asbd, &propertySize); - CheckErrorAndThrow (err, "AudioUnitGetProperty StreamFormat", - "audio_osx_source::UnitListener"); - - std::cerr << "New Source Output Info:" << std::endl; - PrintStreamDesc (&asbd); - -// set the converter's input ASBD to this - - err = AudioConverterSetProperty (This->d_AudioConverter, - kAudioConverterCurrentInputStreamDescription, - propertySize, - &asbd); - CheckErrorAndThrow (err, "AudioConverterSetProperty " - "CurrentInputStreamDescription", - "audio_osx_source::UnitListener"); - -// reset the converter to tell it that the stream has changed - - err = AudioConverterReset (This->d_AudioConverter); - CheckErrorAndThrow (err, "AudioConverterReset", - "audio_osx_source::UnitListener"); - - return (err); -} -#endif diff --git a/gr-audio/lib/osx/audio_osx_source.h b/gr-audio/lib/osx/audio_osx_source.h deleted file mode 100644 index bb34d972c..000000000 --- a/gr-audio/lib/osx/audio_osx_source.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006-2011 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 INCLUDED_AUDIO_OSX_SOURCE_H -#define INCLUDED_AUDIO_OSX_SOURCE_H - -#include <gr_audio_source.h> -#include <string> -#include <AudioToolbox/AudioToolbox.h> -#include <AudioUnit/AudioUnit.h> -#include <circular_buffer.h> - -/*! - * \brief audio source using OSX - * \ingroup audio_blk - * - * Input signature is one or two streams of floats. - * Samples must be in the range [-1,1]. - */ - -class audio_osx_source : public audio_source { - - Float64 d_deviceSampleRate, d_outputSampleRate; - int d_channel_config; - UInt32 d_inputBufferSizeFrames, d_inputBufferSizeBytes; - UInt32 d_outputBufferSizeFrames, d_outputBufferSizeBytes; - UInt32 d_deviceBufferSizeFrames, d_deviceBufferSizeBytes; - UInt32 d_leadSizeFrames, d_leadSizeBytes; - UInt32 d_trailSizeFrames, d_trailSizeBytes; - UInt32 d_extraBufferSizeFrames, d_extraBufferSizeBytes; - UInt32 d_queueSampleCount, d_max_sample_count; - UInt32 d_n_AvailableInputFrames, d_n_ActualInputFrames; - UInt32 d_n_user_channels, d_n_max_channels, d_n_deviceChannels; - bool d_do_block, d_passThrough, d_waiting_for_data; - gruel::mutex* d_internal; - gruel::condition_variable* d_cond_data; - circular_buffer<float>** d_buffers; - -// AudioUnits and Such - AudioUnit d_InputAU; - AudioBufferList* d_InputBuffer; - AudioBufferList* d_OutputBuffer; - AudioConverterRef d_AudioConverter; - -public: - audio_osx_source (int sample_rate = 44100, - const std::string device_name = "", - bool do_block = true, - int channel_config = -1, - int max_sample_count = -1); - - ~audio_osx_source (); - - bool start (); - bool stop (); - bool IsRunning (); - - bool check_topology (int ninputs, int noutputs); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - void SetDefaultInputDeviceAsCurrent (); - - void AllocAudioBufferList (AudioBufferList** t_ABL, - UInt32 n_channels, - UInt32 inputBufferSizeBytes); - - void FreeAudioBufferList (AudioBufferList** t_ABL); - - static OSStatus ConverterCallback (AudioConverterRef inAudioConverter, - UInt32* ioNumberDataPackets, - AudioBufferList* ioData, - AudioStreamPacketDescription** outASPD, - void* inUserData); - - static OSStatus AUInputCallback (void *inRefCon, - AudioUnitRenderActionFlags *ioActionFlags, - const AudioTimeStamp *inTimeStamp, - UInt32 inBusNumber, - UInt32 inNumberFrames, - AudioBufferList *ioData); -#if _OSX_DO_LISTENERS_ - static OSStatus UnitListener (void *inRefCon, - AudioUnit ci, - AudioUnitPropertyID inID, - AudioUnitScope inScope, - AudioUnitElement inElement); - - static OSStatus HardwareListener (AudioHardwarePropertyID inPropertyID, - void *inClientData); -#endif -}; - -#endif /* INCLUDED_AUDIO_OSX_SOURCE_H */ diff --git a/gr-audio/lib/osx/circular_buffer.h b/gr-audio/lib/osx/circular_buffer.h deleted file mode 100644 index 65788d482..000000000 --- a/gr-audio/lib/osx/circular_buffer.h +++ /dev/null @@ -1,315 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009,2010 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 _CIRCULAR_BUFFER_H_ -#define _CIRCULAR_BUFFER_H_ - -#include <gruel/thread.h> -#include <iostream> -#include <stdexcept> - -#ifndef DO_DEBUG -#define DO_DEBUG 0 -#endif - -#if DO_DEBUG -#define DEBUG(X) do{X} while(0); -#else -#define DEBUG(X) do{} while(0); -#endif - -template <class T> -class circular_buffer -{ -private: -// the buffer to use - T* d_buffer; - -// the following are in Items (type T) - size_t d_bufLen_I, d_readNdx_I, d_writeNdx_I; - size_t d_n_avail_write_I, d_n_avail_read_I; - -// stuff to control access to class internals - gruel::mutex* d_internal; - gruel::condition_variable* d_readBlock; - gruel::condition_variable* d_writeBlock; - -// booleans to decide how to control reading, writing, and aborting - bool d_doWriteBlock, d_doFullRead, d_doAbort; - - void delete_mutex_cond () { - if (d_internal) { - delete d_internal; - d_internal = NULL; - } - if (d_readBlock) { - delete d_readBlock; - d_readBlock = NULL; - } - if (d_writeBlock) { - delete d_writeBlock; - d_writeBlock = NULL; - } - }; - -public: - circular_buffer (size_t bufLen_I, - bool doWriteBlock = true, bool doFullRead = false) { - if (bufLen_I == 0) - throw std::runtime_error ("circular_buffer(): " - "Number of items to buffer must be > 0.\n"); - d_bufLen_I = bufLen_I; - d_buffer = (T*) new T[d_bufLen_I]; - d_doWriteBlock = doWriteBlock; - d_doFullRead = doFullRead; - d_internal = NULL; - d_readBlock = d_writeBlock = NULL; - reset (); - DEBUG (std::cerr << "c_b(): buf len (items) = " << d_bufLen_ - << ", doWriteBlock = " << (d_doWriteBlock ? "true" : "false") - << ", doFullRead = " << (d_doFullRead ? "true" : "false") - << std::endl); - }; - - ~circular_buffer () { - delete_mutex_cond (); - delete [] d_buffer; - }; - - inline size_t n_avail_write_items () { - gruel::scoped_lock l (*d_internal); - size_t retVal = d_n_avail_write_I; - return (retVal); - }; - - inline size_t n_avail_read_items () { - gruel::scoped_lock l (*d_internal); - size_t retVal = d_n_avail_read_I; - return (retVal); - }; - - inline size_t buffer_length_items () {return (d_bufLen_I);}; - inline bool do_write_block () {return (d_doWriteBlock);}; - inline bool do_full_read () {return (d_doFullRead);}; - - void reset () { - d_doAbort = false; - bzero (d_buffer, d_bufLen_I * sizeof (T)); - d_readNdx_I = d_writeNdx_I = d_n_avail_read_I = 0; - d_n_avail_write_I = d_bufLen_I; - delete_mutex_cond (); - // create a mutex to handle contention of shared resources; - // any routine needed access to shared resources uses lock() - // before doing anything, then unlock() when finished. - d_internal = new gruel::mutex (); - // link the internal mutex to the read and write conditions; - // when wait() is called, the internal mutex will automatically - // be unlock()'ed. Upon return (from a notify_one() to the condition), - // the internal mutex will be lock()'ed. - d_readBlock = new gruel::condition_variable (); - d_writeBlock = new gruel::condition_variable (); - }; - -/* - * enqueue: add the given buffer of item-length to the queue, - * first-in-first-out (FIFO). - * - * inputs: - * buf: a pointer to the buffer holding the data - * - * bufLen_I: the buffer length in items (of the instantiated type) - * - * returns: - * -1: on overflow (write is not blocking, and data is being - * written faster than it is being read) - * 0: if nothing to do (0 length buffer) - * 1: if success - * 2: in the process of aborting, do doing nothing - * - * will throw runtime errors if inputs are improper: - * buffer pointer is NULL - * buffer length is larger than the instantiated buffer length - */ - - int enqueue (T* buf, size_t bufLen_I) { - DEBUG (std::cerr << "enqueue: buf = " << (void*) buf - << ", bufLen = " << bufLen_I - << ", #av_wr = " << d_n_avail_write_I - << ", #av_rd = " << d_n_avail_read_I << std::endl); - if (bufLen_I > d_bufLen_I) { - std::cerr << "ERROR: cannot add buffer longer (" - << bufLen_I << ") than instantiated length (" - << d_bufLen_I << ")." << std::endl; - throw std::runtime_error ("circular_buffer::enqueue()"); - } - - if (bufLen_I == 0) - return (0); - if (!buf) - throw std::runtime_error ("circular_buffer::enqueue(): " - "input buffer is NULL.\n"); - gruel::scoped_lock l (*d_internal); - if (d_doAbort) { - return (2); - } - // set the return value to 1: success; change if needed - int retval = 1; - if (bufLen_I > d_n_avail_write_I) { - if (d_doWriteBlock) { - while (bufLen_I > d_n_avail_write_I) { - DEBUG (std::cerr << "enqueue: #len > #a, waiting." << std::endl); - // wait; will automatically unlock() the internal mutex via - // the scoped lock - d_writeBlock->wait (l); - // and auto re-lock() it here. - if (d_doAbort) { - DEBUG (std::cerr << "enqueue: #len > #a, aborting." << std::endl); - return (2); - } - DEBUG (std::cerr << "enqueue: #len > #a, done waiting." << std::endl); - } - } else { - d_n_avail_read_I = d_bufLen_I - bufLen_I; - d_n_avail_write_I = bufLen_I; - DEBUG (std::cerr << "circular_buffer::enqueue: overflow" << std::endl); - retval = -1; - } - } - size_t n_now_I = d_bufLen_I - d_writeNdx_I, n_start_I = 0; - if (n_now_I > bufLen_I) - n_now_I = bufLen_I; - else if (n_now_I < bufLen_I) - n_start_I = bufLen_I - n_now_I; - bcopy (buf, &(d_buffer[d_writeNdx_I]), n_now_I * sizeof (T)); - if (n_start_I) { - bcopy (&(buf[n_now_I]), d_buffer, n_start_I * sizeof (T)); - d_writeNdx_I = n_start_I; - } else - d_writeNdx_I += n_now_I; - d_n_avail_read_I += bufLen_I; - d_n_avail_write_I -= bufLen_I; - d_readBlock->notify_one (); - return (retval); - }; - -/* - * dequeue: removes from the queue the number of items requested, or - * available, into the given buffer on a FIFO basis. - * - * inputs: - * buf: a pointer to the buffer into which to copy the data - * - * bufLen_I: pointer to the number of items to remove in items - * (of the instantiated type) - * - * returns: - * 0: if nothing to do (0 length buffer) - * 1: if success - * 2: in the process of aborting, do doing nothing - * - * will throw runtime errors if inputs are improper: - * buffer pointer is NULL - * buffer length pointer is NULL - * buffer length is larger than the instantiated buffer length - */ - - int dequeue (T* buf, size_t* bufLen_I) { - DEBUG (std::cerr << "dequeue: buf = " << ((void*) buf) - << ", *bufLen = " << (*bufLen_I) - << ", #av_wr = " << d_n_avail_write_I - << ", #av_rd = " << d_n_avail_read_I << std::endl); - if (!bufLen_I) - throw std::runtime_error ("circular_buffer::dequeue(): " - "input bufLen pointer is NULL.\n"); - if (!buf) - throw std::runtime_error ("circular_buffer::dequeue(): " - "input buffer pointer is NULL.\n"); - size_t l_bufLen_I = *bufLen_I; - if (l_bufLen_I == 0) - return (0); - if (l_bufLen_I > d_bufLen_I) { - std::cerr << "ERROR: cannot remove buffer longer (" - << l_bufLen_I << ") than instantiated length (" - << d_bufLen_I << ")." << std::endl; - throw std::runtime_error ("circular_buffer::dequeue()"); - } - - gruel::scoped_lock l (*d_internal); - if (d_doAbort) { - return (2); - } - if (d_doFullRead) { - while (d_n_avail_read_I < l_bufLen_I) { - DEBUG (std::cerr << "dequeue: #a < #len, waiting." << std::endl); - // wait; will automatically unlock() the internal mutex via - // the scoped lock - d_readBlock->wait (l); - // and re-lock() it here. - if (d_doAbort) { - DEBUG (std::cerr << "dequeue: #a < #len, aborting." << std::endl); - return (2); - } - DEBUG (std::cerr << "dequeue: #a < #len, done waiting." << std::endl); - } - } else { - while (d_n_avail_read_I == 0) { - DEBUG (std::cerr << "dequeue: #a == 0, waiting." << std::endl); - // wait; will automatically unlock() the internal mutex via - // the scoped lock - d_readBlock->wait (l); - // and re-lock() it here. - if (d_doAbort) { - DEBUG (std::cerr << "dequeue: #a == 0, aborting." << std::endl); - return (2); - } - DEBUG (std::cerr << "dequeue: #a == 0, done waiting." << std::endl); - } - } - if (l_bufLen_I > d_n_avail_read_I) - l_bufLen_I = d_n_avail_read_I; - size_t n_now_I = d_bufLen_I - d_readNdx_I, n_start_I = 0; - if (n_now_I > l_bufLen_I) - n_now_I = l_bufLen_I; - else if (n_now_I < l_bufLen_I) - n_start_I = l_bufLen_I - n_now_I; - bcopy (&(d_buffer[d_readNdx_I]), buf, n_now_I * sizeof (T)); - if (n_start_I) { - bcopy (d_buffer, &(buf[n_now_I]), n_start_I * sizeof (T)); - d_readNdx_I = n_start_I; - } else - d_readNdx_I += n_now_I; - *bufLen_I = l_bufLen_I; - d_n_avail_read_I -= l_bufLen_I; - d_n_avail_write_I += l_bufLen_I; - d_writeBlock->notify_one (); - return (1); - }; - - void abort () { - gruel::scoped_lock l (*d_internal); - d_doAbort = true; - d_writeBlock->notify_one (); - d_readBlock->notify_one (); - }; -}; - -#endif /* _CIRCULAR_BUFFER_H_ */ diff --git a/gr-audio/lib/portaudio/audio_portaudio_sink.cc b/gr-audio/lib/portaudio/audio_portaudio_sink.cc deleted file mode 100644 index af7f1e48c..000000000 --- a/gr-audio/lib/portaudio/audio_portaudio_sink.cc +++ /dev/null @@ -1,362 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006-2011 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 he 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 "gr_audio_registry.h" -#include <audio_portaudio_sink.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <stdio.h> -#include <iostream> -#include <unistd.h> -#include <stdexcept> -#include <gri_portaudio.h> -#include <string.h> - -AUDIO_REGISTER_SINK(REG_PRIO_MED, portaudio)( - int sampling_rate, const std::string &device_name, bool ok_to_block -){ - return audio_sink::sptr(new audio_portaudio_sink(sampling_rate, device_name, ok_to_block)); -} - -//#define LOGGING 0 // define to 0 or 1 - -#define SAMPLE_FORMAT paFloat32 -typedef float sample_t; - -// Number of portaudio buffers in the ringbuffer -static const unsigned int N_BUFFERS = 4; - -static std::string -default_device_name () -{ - return gr_prefs::singleton()->get_string("audio_portaudio", "default_output_device", ""); -} - -void -audio_portaudio_sink::create_ringbuffer(void) -{ - int bufsize_samples = d_portaudio_buffer_size_frames * d_output_parameters.channelCount; - - if (d_verbose) - fprintf(stderr,"ring buffer size = %d frames\n", - N_BUFFERS*bufsize_samples/d_output_parameters.channelCount); - - // FYI, the buffer indicies are in units of samples. - d_writer = gr_make_buffer(N_BUFFERS * bufsize_samples, sizeof(sample_t)); - d_reader = gr_buffer_add_reader(d_writer, 0); -} - -/* - * This routine will be called by the PortAudio engine when audio is needed. - * It may called at interrupt level on some machines so don't do anything - * that could mess up the system like calling malloc() or free(). - * - * Our job is to write framesPerBuffer frames into outputBuffer. - */ -int -portaudio_sink_callback (const void *inputBuffer, - void *outputBuffer, - unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo* timeInfo, - PaStreamCallbackFlags statusFlags, - void *arg) -{ - audio_portaudio_sink *self = (audio_portaudio_sink *)arg; - int nreqd_samples = - framesPerBuffer * self->d_output_parameters.channelCount; - - int navail_samples = self->d_reader->items_available(); - - if (nreqd_samples <= navail_samples) { // We've got enough data... - { - gruel::scoped_lock guard(self->d_ringbuffer_mutex); - - memcpy(outputBuffer, - self->d_reader->read_pointer(), - nreqd_samples * sizeof(sample_t)); - self->d_reader->update_read_pointer(nreqd_samples); - - self->d_ringbuffer_ready = true; - } - - // Tell the sink thread there is new room in the ringbuffer. - self->d_ringbuffer_cond.notify_one(); - return paContinue; - } - - else { // underrun - self->d_nunderuns++; - ssize_t r = ::write(2, "aU", 2); // FIXME change to non-blocking call - if(r == -1) { - perror("audio_portaudio_source::portaudio_source_callback write error to stderr."); - } - - // FIXME we should transfer what we've got and pad the rest - memset(outputBuffer, 0, nreqd_samples * sizeof(sample_t)); - - self->d_ringbuffer_ready = true; - self->d_ringbuffer_cond.notify_one(); // Tell the sink to get going! - - return paContinue; - } -} - - -// ---------------------------------------------------------------- - -audio_portaudio_sink::audio_portaudio_sink(int sampling_rate, - const std::string device_name, - bool ok_to_block) - : gr_sync_block ("audio_portaudio_sink", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), - d_sampling_rate(sampling_rate), - d_device_name(device_name.empty() ? default_device_name() : device_name), - d_ok_to_block(ok_to_block), - d_verbose(gr_prefs::singleton()->get_bool("audio_portaudio", "verbose", false)), - d_portaudio_buffer_size_frames(0), - d_stream(0), - d_ringbuffer_mutex(), - d_ringbuffer_cond(), - d_ringbuffer_ready(false), - d_nunderuns(0) -{ - memset(&d_output_parameters, 0, sizeof(d_output_parameters)); - //if (LOGGING) - // d_log = gri_logger::singleton(); - - PaError err; - int i, numDevices; - PaDeviceIndex device = 0; - const PaDeviceInfo *deviceInfo = NULL; - - err = Pa_Initialize(); - if (err != paNoError) { - bail ("Initialize failed", err); - } - - if (d_verbose) - gri_print_devices(); - - numDevices = Pa_GetDeviceCount(); - if (numDevices < 0) - bail("Pa Device count failed", 0); - if (numDevices == 0) - bail("no devices available", 0); - - if (d_device_name.empty()) - { - // FIXME Get smarter about picking something - fprintf(stderr,"\nUsing Default Device\n"); - device = Pa_GetDefaultOutputDevice(); - deviceInfo = Pa_GetDeviceInfo(device); - fprintf(stderr,"%s is the chosen device using %s as the host\n", - deviceInfo->name, Pa_GetHostApiInfo(deviceInfo->hostApi)->name); - } - else - { - bool found = false; - fprintf(stderr,"\nTest Devices\n"); - for (i=0;i<numDevices;i++) { - deviceInfo = Pa_GetDeviceInfo( i ); - fprintf(stderr,"Testing device name: %s",deviceInfo->name); - if (deviceInfo->maxOutputChannels <= 0) { - fprintf(stderr,"\n"); - continue; - } - if (strstr(deviceInfo->name, d_device_name.c_str())){ - fprintf(stderr," Chosen!\n"); - device = i; - fprintf(stderr,"%s using %s as the host\n",d_device_name.c_str(), - Pa_GetHostApiInfo(deviceInfo->hostApi)->name), fflush(stderr); - found = true; - deviceInfo = Pa_GetDeviceInfo(device); - i = numDevices; // force loop exit - } - else - fprintf(stderr,"\n"),fflush(stderr); - } - - if (!found){ - bail("Failed to find specified device name", 0); - exit(1); - } - } - - - d_output_parameters.device = device; - d_output_parameters.channelCount = deviceInfo->maxOutputChannels; - d_output_parameters.sampleFormat = SAMPLE_FORMAT; - d_output_parameters.suggestedLatency = deviceInfo->defaultLowOutputLatency; - d_output_parameters.hostApiSpecificStreamInfo = NULL; - - // We fill in the real channelCount in check_topology when we know - // how many inputs are connected to us. - - // Now that we know the maximum number of channels (allegedly) - // supported by the h/w, we can compute a reasonable input - // signature. The portaudio specs say that they'll accept any - // number of channels from 1 to max. - set_input_signature(gr_make_io_signature(1, deviceInfo->maxOutputChannels, - sizeof (sample_t))); -} - - -bool -audio_portaudio_sink::check_topology (int ninputs, int noutputs) -{ - PaError err; - - if (Pa_IsStreamActive(d_stream)) - { - Pa_CloseStream(d_stream); - d_stream = 0; - d_reader.reset(); // boost::shared_ptr for d_reader = 0 - d_writer.reset(); // boost::shared_ptr for d_write = 0 - } - - d_output_parameters.channelCount = ninputs; // # of channels we're really using - -#if 1 - d_portaudio_buffer_size_frames = (int)(0.0213333333 * d_sampling_rate + 0.5); // Force 1024 frame buffers at 48000 - fprintf(stderr, "Latency = %8.5f, requested sampling_rate = %g\n", // Force latency to 21.3333333.. ms - 0.0213333333, (double)d_sampling_rate); -#endif - err = Pa_OpenStream(&d_stream, - NULL, // No input - &d_output_parameters, - d_sampling_rate, - d_portaudio_buffer_size_frames, - paClipOff, - &portaudio_sink_callback, - (void*)this); - - if (err != paNoError) { - output_error_msg ("OpenStream failed", err); - return false; - } - -#if 0 - const PaStreamInfo *psi = Pa_GetStreamInfo(d_stream); - - d_portaudio_buffer_size_frames = (int)(d_output_parameters.suggestedLatency * psi->sampleRate); - fprintf(stderr, "Latency = %7.4f, psi->sampleRate = %g\n", - d_output_parameters.suggestedLatency, psi->sampleRate); -#endif - - fprintf(stderr, "d_portaudio_buffer_size_frames = %d\n", d_portaudio_buffer_size_frames); - - assert(d_portaudio_buffer_size_frames != 0); - - create_ringbuffer(); - - err = Pa_StartStream(d_stream); - if (err != paNoError) { - output_error_msg ("StartStream failed", err); - return false; - } - - return true; -} - -audio_portaudio_sink::~audio_portaudio_sink () -{ - Pa_StopStream(d_stream); // wait for output to drain - Pa_CloseStream(d_stream); - Pa_Terminate(); -} - -/* - * This version consumes everything sent to it, blocking if required. - * I think this will allow us better control of the total buffering/latency - * in the audio path. - */ -int -audio_portaudio_sink::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]; - const unsigned nchan = d_output_parameters.channelCount; // # of channels == samples/frame - - int k; - - for (k = 0; k < noutput_items; ){ - int nframes = d_writer->space_available() / nchan; // How much space in ringbuffer - if (nframes == 0){ // no room... - if (d_ok_to_block){ - { - gruel::scoped_lock guard(d_ringbuffer_mutex); - while (!d_ringbuffer_ready) - d_ringbuffer_cond.wait(guard); - } - - continue; - } - else { - // There's no room and we're not allowed to block. - // (A USRP is most likely controlling the pacing through the pipeline.) - // We drop the samples on the ground, and say we processed them all ;) - // - // FIXME, there's probably room for a bit more finesse here. - return noutput_items; - } - } - - // We can write the smaller of the request and the room we've got - { - gruel::scoped_lock guard(d_ringbuffer_mutex); - - int nf = std::min(noutput_items - k, nframes); - float *p = (float *) d_writer->write_pointer(); - - for (int i = 0; i < nf; i++) - for (unsigned int c = 0; c < nchan; c++) - *p++ = in[c][k + i]; - - d_writer->update_write_pointer(nf * nchan); - k += nf; - - d_ringbuffer_ready = false; - } - } - - return k; // tell how many we actually did -} - -void -audio_portaudio_sink::output_error_msg (const char *msg, int err) -{ - fprintf (stderr, "audio_portaudio_sink[%s]: %s: %s\n", - d_device_name.c_str (), msg, Pa_GetErrorText(err)); -} - -void -audio_portaudio_sink::bail (const char *msg, int err) throw (std::runtime_error) -{ - output_error_msg (msg, err); - throw std::runtime_error ("audio_portaudio_sink"); -} diff --git a/gr-audio/lib/portaudio/audio_portaudio_sink.h b/gr-audio/lib/portaudio/audio_portaudio_sink.h deleted file mode 100644 index cf64d3da0..000000000 --- a/gr-audio/lib/portaudio/audio_portaudio_sink.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006-2011 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 INCLUDED_AUDIO_PORTAUDIO_SINK_H -#define INCLUDED_AUDIO_PORTAUDIO_SINK_H - -#include <gr_audio_sink.h> -#include <gr_buffer.h> -#include <gruel/thread.h> -#include <string> -#include <portaudio.h> -#include <stdexcept> -//#include <gri_logger.h> - -PaStreamCallback portaudio_sink_callback; - - -/*! - * \brief Audio sink using PORTAUDIO - * \ingroup audio_blk - * - * Input samples must be in the range [-1,1]. - */ -class audio_portaudio_sink : public audio_sink { - - friend PaStreamCallback portaudio_sink_callback; - - - unsigned int d_sampling_rate; - std::string d_device_name; - bool d_ok_to_block; - bool d_verbose; - - unsigned int d_portaudio_buffer_size_frames; // number of frames in a portaudio buffer - - PaStream *d_stream; - PaStreamParameters d_output_parameters; - - gr_buffer_sptr d_writer; // buffer used between work and callback - gr_buffer_reader_sptr d_reader; - - gruel::mutex d_ringbuffer_mutex; - gruel::condition_variable d_ringbuffer_cond; - bool d_ringbuffer_ready; - - // random stats - int d_nunderuns; // count of underruns - //gri_logger_sptr d_log; // handle to non-blocking logging instance - - void output_error_msg (const char *msg, int err); - void bail (const char *msg, int err) throw (std::runtime_error); - void create_ringbuffer(); - - -public: - audio_portaudio_sink (int sampling_rate, const std::string device_name, - bool ok_to_block); - - ~audio_portaudio_sink (); - - bool check_topology (int ninputs, int noutputs); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_AUDIO_PORTAUDIO_SINK_H */ diff --git a/gr-audio/lib/portaudio/audio_portaudio_source.cc b/gr-audio/lib/portaudio/audio_portaudio_source.cc deleted file mode 100644 index ddb1a6fb6..000000000 --- a/gr-audio/lib/portaudio/audio_portaudio_source.cc +++ /dev/null @@ -1,374 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006-2011 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 he 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 "gr_audio_registry.h" -#include <audio_portaudio_source.h> -#include <gr_io_signature.h> -#include <gr_prefs.h> -#include <stdio.h> -#include <iostream> -#include <unistd.h> -#include <stdexcept> -#include <gri_portaudio.h> -#include <string.h> - -AUDIO_REGISTER_SOURCE(REG_PRIO_MED, portaudio)( - int sampling_rate, const std::string &device_name, bool ok_to_block -){ - return audio_source::sptr(new audio_portaudio_source(sampling_rate, device_name, ok_to_block)); -} - -//#define LOGGING 0 // define to 0 or 1 - -#define SAMPLE_FORMAT paFloat32 -typedef float sample_t; - -// Number of portaudio buffers in the ringbuffer -static const unsigned int N_BUFFERS = 4; - -static std::string -default_device_name () -{ - return gr_prefs::singleton()->get_string("audio_portaudio", "default_input_device", ""); -} - -void -audio_portaudio_source::create_ringbuffer(void) -{ - int bufsize_samples = d_portaudio_buffer_size_frames * d_input_parameters.channelCount; - - if (d_verbose) - fprintf(stderr, "ring buffer size = %d frames\n", - N_BUFFERS*bufsize_samples/d_input_parameters.channelCount); - - // FYI, the buffer indicies are in units of samples. - d_writer = gr_make_buffer(N_BUFFERS * bufsize_samples, sizeof(sample_t)); - d_reader = gr_buffer_add_reader(d_writer, 0); -} - -/* - * This routine will be called by the PortAudio engine when audio is needed. - * It may called at interrupt level on some machines so don't do anything - * that could mess up the system like calling malloc() or free(). - * - * Our job is to copy framesPerBuffer frames from inputBuffer. - */ -int -portaudio_source_callback (const void *inputBuffer, - void *outputBuffer, - unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo* timeInfo, - PaStreamCallbackFlags statusFlags, - void *arg) -{ - audio_portaudio_source *self = (audio_portaudio_source *)arg; - int nchan = self->d_input_parameters.channelCount; - int nframes_to_copy = framesPerBuffer; - int nframes_room = self->d_writer->space_available() / nchan; - - if (nframes_to_copy <= nframes_room){ // We've got room for the data .. - //if (LOGGING) - // self->d_log->printf("PAsrc cb: f/b = %4ld\n", framesPerBuffer); - - // copy from input buffer to ringbuffer - { - gruel::scoped_lock(d_ringbuffer_mutex); - - memcpy(self->d_writer->write_pointer(), - inputBuffer, - nframes_to_copy * nchan * sizeof(sample_t)); - self->d_writer->update_write_pointer(nframes_to_copy * nchan); - - // Tell the source thread there is new data in the ringbuffer. - self->d_ringbuffer_ready = true; - } - - self->d_ringbuffer_cond.notify_one(); - return paContinue; - } - - else { // overrun - self->d_noverruns++; - ssize_t r = ::write(2, "aO", 2); // FIXME change to non-blocking call - if(r == -1) { - perror("audio_portaudio_source::portaudio_source_callback write error to stderr."); - } - - self->d_ringbuffer_ready = false; - self->d_ringbuffer_cond.notify_one(); // Tell the sink to get going! - return paContinue; - } -} - - -// ---------------------------------------------------------------- - -audio_portaudio_source::audio_portaudio_source(int sampling_rate, - const std::string device_name, - bool ok_to_block) - : gr_sync_block ("audio_portaudio_source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(0, 0, 0)), - d_sampling_rate(sampling_rate), - d_device_name(device_name.empty() ? default_device_name() : device_name), - d_ok_to_block(ok_to_block), - d_verbose(gr_prefs::singleton()->get_bool("audio_portaudio", "verbose", false)), - d_portaudio_buffer_size_frames(0), - d_stream(0), - d_ringbuffer_mutex(), - d_ringbuffer_cond(), - d_ringbuffer_ready(false), - d_noverruns(0) -{ - memset(&d_input_parameters, 0, sizeof(d_input_parameters)); - //if (LOGGING) - // d_log = gri_logger::singleton(); - - PaError err; - int i, numDevices; - PaDeviceIndex device = 0; - const PaDeviceInfo *deviceInfo = NULL; - - - err = Pa_Initialize(); - if (err != paNoError) { - bail ("Initialize failed", err); - } - - if (d_verbose) - gri_print_devices(); - - numDevices = Pa_GetDeviceCount(); - if (numDevices < 0) - bail("Pa Device count failed", 0); - if (numDevices == 0) - bail("no devices available", 0); - - if (d_device_name.empty()) - { - // FIXME Get smarter about picking something - device = Pa_GetDefaultInputDevice(); - deviceInfo = Pa_GetDeviceInfo(device); - fprintf(stderr,"%s is the chosen device using %s as the host\n", - deviceInfo->name, Pa_GetHostApiInfo(deviceInfo->hostApi)->name); - } - else - { - bool found = false; - - for (i=0;i<numDevices;i++) { - deviceInfo = Pa_GetDeviceInfo( i ); - fprintf(stderr,"Testing device name: %s",deviceInfo->name); - if (deviceInfo->maxInputChannels <= 0) { - fprintf(stderr,"\n"); - continue; - } - if (strstr(deviceInfo->name, d_device_name.c_str())){ - fprintf(stderr," Chosen!\n"); - device = i; - fprintf(stderr,"%s using %s as the host\n",d_device_name.c_str(), - Pa_GetHostApiInfo(deviceInfo->hostApi)->name), fflush(stderr); - found = true; - deviceInfo = Pa_GetDeviceInfo(device); - i = numDevices; // force loop exit - } - else - fprintf(stderr,"\n"),fflush(stderr); - } - - if (!found){ - bail("Failed to find specified device name", 0); - } - } - - - d_input_parameters.device = device; - d_input_parameters.channelCount = deviceInfo->maxInputChannels; - d_input_parameters.sampleFormat = SAMPLE_FORMAT; - d_input_parameters.suggestedLatency = deviceInfo->defaultLowInputLatency; - d_input_parameters.hostApiSpecificStreamInfo = NULL; - - // We fill in the real channelCount in check_topology when we know - // how many inputs are connected to us. - - // Now that we know the maximum number of channels (allegedly) - // supported by the h/w, we can compute a reasonable output - // signature. The portaudio specs say that they'll accept any - // number of channels from 1 to max. - set_output_signature(gr_make_io_signature(1, deviceInfo->maxInputChannels, - sizeof (sample_t))); -} - - -bool -audio_portaudio_source::check_topology (int ninputs, int noutputs) -{ - PaError err; - - if (Pa_IsStreamActive(d_stream)) - { - Pa_CloseStream(d_stream); - d_stream = 0; - d_reader.reset(); // boost::shared_ptr for d_reader = 0 - d_writer.reset(); // boost::shared_ptr for d_write = 0 - } - - d_input_parameters.channelCount = noutputs; // # of channels we're really using - -#if 1 - d_portaudio_buffer_size_frames = (int)(0.0213333333 * d_sampling_rate + 0.5); // Force 512 frame buffers at 48000 - fprintf(stderr, "Latency = %8.5f, requested sampling_rate = %g\n", // Force latency to 21.3333333.. ms - 0.0213333333, (double)d_sampling_rate); -#endif - err = Pa_OpenStream(&d_stream, - &d_input_parameters, - NULL, // No output - d_sampling_rate, - d_portaudio_buffer_size_frames, - paClipOff, - &portaudio_source_callback, - (void*)this); - - if (err != paNoError) { - output_error_msg ("OpenStream failed", err); - return false; - } - -#if 0 - const PaStreamInfo *psi = Pa_GetStreamInfo(d_stream); - - d_portaudio_buffer_size_frames = (int)(d_input_parameters.suggestedLatency * psi->sampleRate); - fprintf(stderr, "Latency = %7.4f, psi->sampleRate = %g\n", - d_input_parameters.suggestedLatency, psi->sampleRate); -#endif - - fprintf(stderr, "d_portaudio_buffer_size_frames = %d\n", d_portaudio_buffer_size_frames); - - assert(d_portaudio_buffer_size_frames != 0); - - create_ringbuffer(); - - err = Pa_StartStream(d_stream); - if (err != paNoError) { - output_error_msg ("StartStream failed", err); - return false; - } - - return true; -} - -audio_portaudio_source::~audio_portaudio_source () -{ - Pa_StopStream(d_stream); // wait for output to drain - Pa_CloseStream(d_stream); - Pa_Terminate(); -} - -int -audio_portaudio_source::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float **out = (float **) &output_items[0]; - const unsigned nchan = d_input_parameters.channelCount; // # of channels == samples/frame - - int k; - for (k = 0; k < noutput_items; ){ - - int nframes = d_reader->items_available() / nchan; // # of frames in ringbuffer - if (nframes == 0){ // no data right now... - if (k > 0) // If we've produced anything so far, return that - return k; - - if (d_ok_to_block) { - gruel:: scoped_lock guard(d_ringbuffer_mutex); - while (d_ringbuffer_ready == false) - d_ringbuffer_cond.wait(guard); // block here, then try again - continue; - } - - assert(k == 0); - - // There's no data and we're not allowed to block. - // (A USRP is most likely controlling the pacing through the pipeline.) - // This is an underun. The scheduler wouldn't have called us if it - // had anything better to do. Thus we really need to produce some amount - // of "fill". - // - // There are lots of options for comfort noise, etc. - // FIXME We'll fill with zeros for now. Yes, it will "click"... - - // Fill with some frames of zeros - { - gruel::scoped_lock guard(d_ringbuffer_mutex); - - int nf = std::min(noutput_items - k, (int) d_portaudio_buffer_size_frames); - for (int i = 0; i < nf; i++){ - for (unsigned int c = 0; c < nchan; c++){ - out[c][k + i] = 0; - } - } - k += nf; - - d_ringbuffer_ready = false; - return k; - } - } - - // We can read the smaller of the request and what's in the buffer. - { - gruel::scoped_lock guard(d_ringbuffer_mutex); - - int nf = std::min(noutput_items - k, nframes); - - const float *p = (const float *) d_reader->read_pointer(); - for (int i = 0; i < nf; i++){ - for (unsigned int c = 0; c < nchan; c++){ - out[c][k + i] = *p++; - } - } - d_reader->update_read_pointer(nf * nchan); - k += nf; - d_ringbuffer_ready = false; - } - } - - return k; // tell how many we actually did -} - -void -audio_portaudio_source::output_error_msg (const char *msg, int err) -{ - fprintf (stderr, "audio_portaudio_source[%s]: %s: %s\n", - d_device_name.c_str (), msg, Pa_GetErrorText(err)); -} - -void -audio_portaudio_source::bail (const char *msg, int err) throw (std::runtime_error) -{ - output_error_msg (msg, err); - throw std::runtime_error ("audio_portaudio_source"); -} diff --git a/gr-audio/lib/portaudio/audio_portaudio_source.h b/gr-audio/lib/portaudio/audio_portaudio_source.h deleted file mode 100644 index e81389a3b..000000000 --- a/gr-audio/lib/portaudio/audio_portaudio_source.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006-2011 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 INCLUDED_AUDIO_PORTAUDIO_SOURCE_H -#define INCLUDED_AUDIO_PORTAUDIO_SOURCE_H - -#include <gr_audio_source.h> -#include <gr_buffer.h> -#include <gruel/thread.h> -#include <string> -#include <portaudio.h> -#include <stdexcept> - -PaStreamCallback portaudio_source_callback; - - -/*! - * \brief Audio source using PORTAUDIO - * \ingroup audio_blk - * - * Input samples must be in the range [-1,1]. - */ -class audio_portaudio_source : public audio_source { - - friend PaStreamCallback portaudio_source_callback; - - - unsigned int d_sampling_rate; - std::string d_device_name; - bool d_ok_to_block; - bool d_verbose; - - unsigned int d_portaudio_buffer_size_frames; // number of frames in a portaudio buffer - - PaStream *d_stream; - PaStreamParameters d_input_parameters; - - gr_buffer_sptr d_writer; // buffer used between work and callback - gr_buffer_reader_sptr d_reader; - - gruel::mutex d_ringbuffer_mutex; - gruel::condition_variable d_ringbuffer_cond; - bool d_ringbuffer_ready; - - // random stats - int d_noverruns; // count of overruns - - void output_error_msg (const char *msg, int err); - void bail (const char *msg, int err) throw (std::runtime_error); - void create_ringbuffer(); - - -public: - audio_portaudio_source (int sampling_rate, const std::string device_name, - bool ok_to_block); - - ~audio_portaudio_source (); - - bool check_topology (int ninputs, int noutputs); - - int work (int ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_AUDIO_PORTAUDIO_SOURCE_H */ diff --git a/gr-audio/lib/portaudio/gr-audio-portaudio.conf b/gr-audio/lib/portaudio/gr-audio-portaudio.conf deleted file mode 100644 index 0dd147443..000000000 --- a/gr-audio/lib/portaudio/gr-audio-portaudio.conf +++ /dev/null @@ -1,10 +0,0 @@ -# This file contains system wide configuration data for GNU Radio. -# You may override any setting on a per-user basis by editing -# ~/.gnuradio/config.conf - -[audio_portaudio] - -#default_input_device = hw:0,0 -#default_output_device = hw:0,0 - -verbose = false diff --git a/gr-audio/lib/portaudio/gri_portaudio.cc b/gr-audio/lib/portaudio/gri_portaudio.cc deleted file mode 100644 index 66f3d4647..000000000 --- a/gr-audio/lib/portaudio/gri_portaudio.cc +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 <gri_portaudio.h> -#include <portaudio.h> -#include <string.h> - - -PaDeviceIndex -gri_pa_find_device_by_name(const char *name) -{ - int i; - int numDevices; - const PaDeviceInfo *pdi; - int len = strlen( name ); - PaDeviceIndex result = paNoDevice; - numDevices = Pa_GetDeviceCount(); - for( i=0; i<numDevices; i++ ) - { - pdi = Pa_GetDeviceInfo( i ); - if( strncmp( name, pdi->name, len ) == 0 ) - { - result = i; - break; - } - } - return result; -} - - -void -gri_print_devices() -{ - int numDevices, defaultDisplayed, myDevice=0; - const PaDeviceInfo *deviceInfo; - - numDevices = Pa_GetDeviceCount(); - if (numDevices < 0) - return; - - printf("Number of devices found = %d\n", numDevices); - - for (int i=0; i < numDevices; i++ ) { - deviceInfo = Pa_GetDeviceInfo( i ); - printf( "--------------------------------------- device #%d\n", i ); - /* Mark global and API specific default devices */ - defaultDisplayed = 0; - if( i == Pa_GetDefaultInputDevice() ) - { - myDevice = i; - printf( "[ Default Input" ); - defaultDisplayed = 1; - } - else if( i == Pa_GetHostApiInfo( deviceInfo->hostApi )->defaultInputDevice ) - { - const PaHostApiInfo *hostInfo = Pa_GetHostApiInfo( deviceInfo->hostApi ); - printf( "[ Default %s Input", hostInfo->name ); - defaultDisplayed = 1; - } - - if( i == Pa_GetDefaultOutputDevice() ) - { - printf( (defaultDisplayed ? "," : "[") ); - printf( " Default Output" ); - defaultDisplayed = 1; - } - else if( i == Pa_GetHostApiInfo( deviceInfo->hostApi )->defaultOutputDevice ) - { - const PaHostApiInfo *hostInfo = Pa_GetHostApiInfo( deviceInfo->hostApi ); - printf( (defaultDisplayed ? "," : "[") ); - printf( " Default %s Output", hostInfo->name ); - defaultDisplayed = 1; - } - if( defaultDisplayed ) - printf( " ]\n" ); - - /* print device info fields */ - printf( "Name = %s\n", deviceInfo->name ); - printf( "Host API = %s\n", Pa_GetHostApiInfo( deviceInfo->hostApi )->name ); - printf( "Max inputs = %d", deviceInfo->maxInputChannels ); - printf( ", Max outputs = %d\n", deviceInfo->maxOutputChannels ); - - printf( "Default low input latency = %8.3f\n", deviceInfo->defaultLowInputLatency ); - printf( "Default low output latency = %8.3f\n", deviceInfo->defaultLowOutputLatency ); - printf( "Default high input latency = %8.3f\n", deviceInfo->defaultHighInputLatency ); - printf( "Default high output latency = %8.3f\n", deviceInfo->defaultHighOutputLatency ); - } -} diff --git a/gr-audio/lib/portaudio/gri_portaudio.h b/gr-audio/lib/portaudio/gri_portaudio.h deleted file mode 100644 index c3ea7d064..000000000 --- a/gr-audio/lib/portaudio/gri_portaudio.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_GRI_PORTAUDIO_H -#define INCLUDED_GRI_PORTAUDIO_H - -#include <stdio.h> -#include <portaudio.h> - -PaDeviceIndex gri_pa_find_device_by_name(const char *name); -void gri_print_devices(); - -#endif /* INCLUDED_GRI_PORTAUDIO_H */ diff --git a/gr-audio/lib/windows/audio_windows_sink.cc b/gr-audio/lib/windows/audio_windows_sink.cc deleted file mode 100644 index 5284ce173..000000000 --- a/gr-audio/lib/windows/audio_windows_sink.cc +++ /dev/null @@ -1,323 +0,0 @@ -/* -*- c++ -*- */ -/* -* Copyright 2004-2011 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 "gr_audio_registry.h" -#include <audio_windows_sink.h> -#include <gr_io_signature.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdio.h> -#include <iostream> -#include <stdexcept> -#include <string> -#include <sstream> - -AUDIO_REGISTER_SINK(REG_PRIO_HIGH, windows)( - int sampling_rate, const std::string &device_name, bool -){ - return audio_sink::sptr(new audio_windows_sink(sampling_rate, device_name)); -} - -static const double CHUNK_TIME = 0.1; //0.001; // 100 ms - -// FIXME these should query some kind of user preference - -static std::string -default_device_name () -{ - return "WAVE_MAPPER"; -} - -audio_windows_sink::audio_windows_sink (int sampling_freq, const std::string device_name) - : gr_sync_block ("audio_windows_sink", - gr_make_io_signature (1, 2, sizeof (float)), - gr_make_io_signature (0, 0, 0)), - d_sampling_freq (sampling_freq), - d_device_name (device_name.empty ()? default_device_name () : device_name), - d_fd (-1), d_buffer (0), d_chunk_size (0) -{ - d_wave_write_event = CreateEvent (NULL, FALSE, FALSE, NULL); - if (open_waveout_device () < 0) - { - //fprintf (stderr, "audio_windows_sink:open_waveout_device() failed\n"); - perror ("audio_windows_sink:open_waveout_device( ) failed\n"); - throw - std::runtime_error ("audio_windows_sink:open_waveout_device() failed"); - } - - d_chunk_size = (int) (d_sampling_freq * CHUNK_TIME); - set_output_multiple (d_chunk_size); - - d_buffer = new short[d_chunk_size * 2]; - -} - -audio_windows_sink::~audio_windows_sink () -{ - /* Free the callback Event */ - CloseHandle (d_wave_write_event); - waveOutClose (d_h_waveout); - delete[]d_buffer; -} - -int -audio_windows_sink::work (int noutput_items, - gr_vector_const_void_star & input_items, - gr_vector_void_star & output_items) -{ - const float *f0, *f1; - bool playtestsound = false; - if (playtestsound) - { - // dummy - - f0 = (const float *) input_items[0]; - - for (int i = 0; i < noutput_items; i += d_chunk_size) - { - for (int j = 0; j < d_chunk_size; j++) - { - d_buffer[2 * j + 0] = (short) (sin (2.0 * 3.1415926535897932384626 * (float) j * 1000.0 / (float) d_sampling_freq) * 8192 + 0); //+32767 - d_buffer[2 * j + 1] = d_buffer[2 * j + 0]; - } - f0 += d_chunk_size; - if (write_waveout - ((HPSTR) d_buffer, 2 * d_chunk_size * sizeof (short)) < 0) - { - fprintf (stderr, "audio_windows_sink: write failed\n"); - perror ("audio_windows_sink: write failed"); - } - } - // break; - } - else - { - switch (input_items.size ()) - { - - case 1: // mono input - - f0 = (const float *) input_items[0]; - - for (int i = 0; i < noutput_items; i += d_chunk_size) - { - for (int j = 0; j < d_chunk_size; j++) - { - d_buffer[2 * j + 0] = (short) (f0[j] * 32767); - d_buffer[2 * j + 1] = (short) (f0[j] * 32767); - } - f0 += d_chunk_size; - if (write_waveout - ((HPSTR) d_buffer, 2 * d_chunk_size * sizeof (short)) < 0) - { - //fprintf (stderr, "audio_windows_sink: write failed\n"); - perror ("audio_windows_sink: write failed"); - } - } - break; - - case 2: // stereo input - - f0 = (const float *) input_items[0]; - f1 = (const float *) input_items[1]; - - for (int i = 0; i < noutput_items; i += d_chunk_size) - { - for (int j = 0; j < d_chunk_size; j++) - { - d_buffer[2 * j + 0] = (short) (f0[j] * 32767); - d_buffer[2 * j + 1] = (short) (f1[j] * 32767); - } - f0 += d_chunk_size; - f1 += d_chunk_size; - if (write_waveout - ((HPSTR) d_buffer, 2 * d_chunk_size * sizeof (short)) < 0) - { - //fprintf (stderr, "audio_windows_sink: write failed\n"); - perror ("audio_windows_sink: write failed"); - } - } - break; - } - } - return noutput_items; -} - -int -audio_windows_sink::string_to_int (const std::string & s) -{ - int i; - std::istringstream (s) >> i; - return i; -} //ToInt() - -int -audio_windows_sink::open_waveout_device (void) -{ - - UINT /*UINT_PTR */ u_device_id; - /** Identifier of the waveform-audio output device to open. It can be either a device identifier or a handle of an open waveform-audio input device. You can use the following flag instead of a device identifier. - * - * Value Meaning - * WAVE_MAPPER The function selects a waveform-audio output device capable of playing the given format. - */ - if (d_device_name.empty () || default_device_name () == d_device_name) - u_device_id = WAVE_MAPPER; - else - u_device_id = (UINT) string_to_int (d_device_name); - // Open a waveform device for output using event callback. - - unsigned long result; - //HWAVEOUT outHandle; - WAVEFORMATEX wave_format; - - /* Initialize the WAVEFORMATEX for 16-bit, 44KHz, stereo */ - wave_format.wFormatTag = WAVE_FORMAT_PCM; - wave_format.nChannels = 2; - wave_format.nSamplesPerSec = d_sampling_freq; //44100; - wave_format.wBitsPerSample = 16; - wave_format.nBlockAlign = - wave_format.nChannels * (wave_format.wBitsPerSample / 8); - wave_format.nAvgBytesPerSec = - wave_format.nSamplesPerSec * wave_format.nBlockAlign; - wave_format.cbSize = 0; - - /* Open the (preferred) Digital Audio Out device. */ - result = waveOutOpen (&d_h_waveout, WAVE_MAPPER, &wave_format, (DWORD_PTR) d_wave_write_event, 0, CALLBACK_EVENT | WAVE_ALLOWSYNC); //|WAVE_FORMAT_DIRECT | CALLBACK_EVENT| WAVE_ALLOWSYNC - if (result) - { - fprintf (stderr, - "audio_windows_sink: Failed to open waveform output device.\n"); - perror ("audio_windows_sink: Failed to open waveform output device."); - //LocalUnlock(hFormat); - //LocalFree(hFormat); - //mmioClose(hmmio, 0); - return -1; - } - - // - // Do not Swallow the "open" event. - // - //WaitForSingleObject(d_wave_write_event, INFINITE); - - // Allocate and lock memory for the header. - - d_h_wave_hdr = GlobalAlloc (GMEM_MOVEABLE | GMEM_SHARE, - (DWORD) sizeof (WAVEHDR)); - if (d_h_wave_hdr == NULL) - { - //GlobalUnlock(hData); - //GlobalFree(hData); - //fprintf (stderr, "audio_windows_sink: Not enough memory for header.\n"); - perror ("audio_windows_sink: Not enough memory for header."); - return -1; - } - - d_lp_wave_hdr = (LPWAVEHDR) GlobalLock (d_h_wave_hdr); - if (d_lp_wave_hdr == NULL) - { - //GlobalUnlock(hData); - //GlobalFree(hData); - //fprintf (stderr, "audio_windows_sink: Failed to lock memory for header.\n"); - perror ("audio_windows_sink: Failed to lock memory for header."); - return -1; - } - //d_lp_wave_hdr->dwFlags = WHDR_DONE; - return 0; -} - -int -audio_windows_sink::write_waveout (HPSTR lp_data, DWORD dw_data_size) -{ - UINT w_result; - int teller = 100; - // After allocation, set up and prepare header. - /*while ((d_lp_wave_hdr->dwFlags & WHDR_DONE)==0 && teller>0) - { - teller--; - Sleep(1); - } */ - // Wait until previous wave write completes (first event is the open event). - WaitForSingleObject (d_wave_write_event, 100); //INFINITE - d_lp_wave_hdr->lpData = lp_data; - d_lp_wave_hdr->dwBufferLength = dw_data_size; - d_lp_wave_hdr->dwFlags = 0L; - /* Clear the WHDR_DONE bit (which the driver set last time that - this WAVEHDR was sent via waveOutWrite and was played). Some - drivers need this to be cleared */ - //d_lp_wave_hdr->dwFlags &= ~WHDR_DONE; - - d_lp_wave_hdr->dwLoops = 0L; - w_result = - waveOutPrepareHeader (d_h_waveout, d_lp_wave_hdr, sizeof (WAVEHDR)); - if (w_result != 0) - { - //GlobalUnlock( hData); - //GlobalFree(hData); - //fprintf (stderr, "audio_windows_sink: Failed to waveOutPrepareHeader. error %i\n",w_result); - perror ("audio_windows_sink: Failed to waveOutPrepareHeader"); - } - // Now the data block can be sent to the output device. The - // waveOutWrite function returns immediately and waveform - // data is sent to the output device in the background. - //while (! readyforplayback) Sleep(1); - //readyforplayback=false; - // - // - - w_result = waveOutWrite (d_h_waveout, d_lp_wave_hdr, sizeof (WAVEHDR)); - if (w_result != 0) - { - //GlobalUnlock( hData); - //GlobalFree(hData); - //fprintf (stderr, "audio_windows_sink: Failed to write block to device.error %i\n",w_result); - perror ("audio_windows_sink: Failed to write block to device"); - switch (w_result) - { - case MMSYSERR_INVALHANDLE: - fprintf (stderr, "Specified device handle is invalid. \n"); - break; - case MMSYSERR_NODRIVER: - fprintf (stderr, " No device driver is present. \n"); - break; - case MMSYSERR_NOMEM: - fprintf (stderr, " Unable to allocate or lock memory. \n"); - break; - case WAVERR_UNPREPARED: - fprintf (stderr, - " The data block pointed to by the pwh parameter hasn't been prepared. \n"); - break; - default: - fprintf (stderr, "Unknown error %i\n", w_result); - } - waveOutUnprepareHeader (d_h_waveout, d_lp_wave_hdr, sizeof (WAVEHDR)); - return -1; - } - // WaitForSingleObject(d_wave_write_event, INFINITE); - return 0; -} diff --git a/gr-audio/lib/windows/audio_windows_sink.h b/gr-audio/lib/windows/audio_windows_sink.h deleted file mode 100644 index d4ca259b3..000000000 --- a/gr-audio/lib/windows/audio_windows_sink.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2011 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 INCLUDED_AUDIO_WINDOWS_SINK_H -#define INCLUDED_AUDIO_WINDOWS_SINK_H - -#define WIN32_LEAN_AND_MEAN -#define NOMINMAX // stops windef.h defining max/min under cygwin - -#include <windows.h> -#include <mmsystem.h> - -#include <gr_audio_sink.h> -#include <string> - -/*! - * \brief audio sink using winmm mmsystem (win32 only) - * \ingroup audio_blk - * - * input signature is one or two streams of floats. - * Input samples must be in the range [-1,1]. - */ - -class audio_windows_sink : public audio_sink -{ - int d_sampling_freq; - std::string d_device_name; - int d_fd; - short *d_buffer; - int d_chunk_size; - HWAVEOUT d_h_waveout; - HGLOBAL d_h_wave_hdr; - LPWAVEHDR d_lp_wave_hdr; - HANDLE d_wave_write_event; - -protected: - int - string_to_int (const std::string & s); - int - open_waveout_device (void); - int - write_waveout (HPSTR lp_data, DWORD dw_data_size); - -public: - audio_windows_sink (int sampling_freq, const std::string device_name = ""); - ~audio_windows_sink (); - - int - work (int noutput_items, - gr_vector_const_void_star & input_items, - gr_vector_void_star & output_items); -}; - -#endif /* INCLUDED_AUDIO_WINDOWS_SINK_H */ diff --git a/gr-audio/lib/windows/audio_windows_source.cc b/gr-audio/lib/windows/audio_windows_source.cc deleted file mode 100644 index 75b0a33bb..000000000 --- a/gr-audio/lib/windows/audio_windows_source.cc +++ /dev/null @@ -1,205 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2011 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 "gr_audio_registry.h" -#include <audio_windows_source.h> -#include <gr_io_signature.h> -//include <sys/soundcard.h> -//include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdio.h> -#include <iostream> -#include <stdexcept> - -AUDIO_REGISTER_SOURCE(REG_PRIO_HIGH, windows)( - int sampling_rate, const std::string &device_name, bool -){ - return audio_source::sptr(new audio_windows_source(sampling_rate, device_name)); -} - -static const double CHUNK_TIME = 0.005; // 5 ms - -// FIXME these should query some kind of user preference - -static std::string -default_device_name () -{ - return "/dev/dsp"; -} - -audio_windows_source::audio_windows_source (int sampling_freq, const std::string device_name) - : gr_sync_block ("audio_windows_source", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 2, sizeof (float))), - d_sampling_freq (sampling_freq), - d_device_name (device_name.empty ()? default_device_name () : device_name), - d_fd (-1), d_buffer (0), d_chunk_size (0) -{ - //FIXME TODO implement me -#if 0 - if ((d_fd = open (d_device_name.c_str (), O_RDONLY)) < 0) - { - fprintf (stderr, "audio_windows_source: "); - perror (d_device_name.c_str ()); - throw - std::runtime_error ("audio_windows_source"); - } - - d_chunk_size = (int) (d_sampling_freq * CHUNK_TIME); - set_output_multiple (d_chunk_size); - - d_buffer = new short[d_chunk_size * 2]; - - int format = AFMT_S16_NE; - int orig_format = format; - if (ioctl (d_fd, SNDCTL_DSP_SETFMT, &format) < 0) - { - std:: - cerr << "audio_windows_source: " << d_device_name << - " ioctl failed\n"; - perror (d_device_name.c_str ()); - throw - std::runtime_error ("audio_windows_source"); - } - - if (format != orig_format) - { - fprintf (stderr, "audio_windows_source: unable to support format %d\n", - orig_format); - fprintf (stderr, " card requested %d instead.\n", format); - } - - // set to stereo no matter what. Some hardware only does stereo - int channels = 2; - if (ioctl (d_fd, SNDCTL_DSP_CHANNELS, &channels) < 0 || channels != 2) - { - perror ("audio_windows_source: could not set STEREO mode"); - throw - std::runtime_error ("audio_windows_source"); - } - - // set sampling freq - int sf = sampling_freq; - if (ioctl (d_fd, SNDCTL_DSP_SPEED, &sf) < 0) - { - std::cerr << "audio_windows_source: " - << d_device_name << ": invalid sampling_freq " - << sampling_freq << "\n"; - sampling_freq = 8000; - if (ioctl (d_fd, SNDCTL_DSP_SPEED, &sf) < 0) - { - std:: - cerr << - "audio_windows_source: failed to set sampling_freq to 8000\n"; - throw - std::runtime_error ("audio_windows_source"); - } - } -#endif -} - -audio_windows_source::~audio_windows_source () -{ - /*close (d_fd); - delete [] d_buffer; - */ -} - -int -audio_windows_source::work (int noutput_items, - gr_vector_const_void_star & input_items, - gr_vector_void_star & output_items) -{ - //FIXME TODO implement me -#if 0 - float *f0 = (float *) output_items[0]; - float *f1 = (float *) output_items[1]; // will be invalid if this is mono output - - const int shorts_per_item = 2; // L + R - const int bytes_per_item = shorts_per_item * sizeof (short); - - // To minimize latency, never return more than CHUNK_TIME - // worth of samples per call to work. - // FIXME, we need an API to set this value - - noutput_items = std::min (noutput_items, d_chunk_size); - - int base = 0; - int ntogo = noutput_items; - - while (ntogo > 0) - { - int nbytes = std::min (ntogo, d_chunk_size) * bytes_per_item; - int result_nbytes = read (d_fd, d_buffer, nbytes); - - if (result_nbytes < 0) - { - perror ("audio_windows_source"); - return -1; // say we're done - } - - if ((result_nbytes & (bytes_per_item - 1)) != 0) - { - fprintf (stderr, "audio_windows_source: internal error.\n"); - throw std::runtime_error ("internal error"); - } - - int result_nitems = result_nbytes / bytes_per_item; - - // now unpack samples into output streams - - switch (output_items.size ()) - { - case 1: // mono output - for (int i = 0; i < result_nitems; i++) - { - f0[base + i] = d_buffer[2 * i + 0] * (1.0 / 32767); - } - break; - - case 2: // stereo output - for (int i = 0; i < result_nitems; i++) - { - f0[base + i] = d_buffer[2 * i + 0] * (1.0 / 32767); - f1[base + i] = d_buffer[2 * i + 1] * (1.0 / 32767); - } - break; - - default: - assert (0); - } - - ntogo -= result_nitems; - base += result_nitems; - } - - return noutput_items - ntogo; -#endif - return -1; // EOF -} diff --git a/gr-audio/lib/windows/audio_windows_source.h b/gr-audio/lib/windows/audio_windows_source.h deleted file mode 100644 index 9cb789576..000000000 --- a/gr-audio/lib/windows/audio_windows_source.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2011 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 INCLUDED_AUDIO_WINDOWS_SOURCE_H -#define INCLUDED_AUDIO_WINDOWS_SOURCE_H - -#include <gr_audio_source.h> -#include <string> - -/*! - * \brief audio source using winmm mmsystem (win32 only) - * \ingroup audio_blk - * - * Output signature is one or two streams of floats. - * Output samples will be in the range [-1,1]. - */ - -class audio_windows_source : public audio_source -{ - - int d_sampling_freq; - std::string d_device_name; - int d_fd; - short *d_buffer; - int d_chunk_size; - -public: - audio_windows_source (int sampling_freq, const std::string device_name = ""); - - ~audio_windows_source (); - - int - work (int noutput_items, - gr_vector_const_void_star & input_items, - gr_vector_void_star & output_items); -}; - -#endif /* INCLUDED_AUDIO_WINDOWS_SOURCE_H */ diff --git a/gr-audio/swig/CMakeLists.txt b/gr-audio/swig/CMakeLists.txt deleted file mode 100644 index 4f98328a7..000000000 --- a/gr-audio/swig/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_INCLUDE_DIRS - ${GR_AUDIO_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/audio_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include) - -set(GR_SWIG_LIBRARIES gnuradio-audio) - -GR_SWIG_MAKE(audio_swig audio_swig.i) - -GR_SWIG_INSTALL( - TARGETS audio_swig - DESTINATION ${GR_PYTHON_DIR}/gnuradio/audio - COMPONENT "audio_python" -) - -install( - FILES audio_swig.i - ${CMAKE_CURRENT_BINARY_DIR}/audio_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "audio_swig" -) - -GR_PYTHON_INSTALL( - FILES __init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/audio - COMPONENT "audio_python" -) diff --git a/gr-audio/swig/__init__.py b/gr-audio/swig/__init__.py deleted file mode 100644 index ff10a8976..000000000 --- a/gr-audio/swig/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright 2011 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 is the gr-audio package. This package is used to connect to audio -sources (mic-in) and sinks (speaker-out) ports on a computer. The -underlying hardware driver is system and OS dependent and this module -should automatically discover the correct one to use. -''' - -from audio_swig import * diff --git a/gr-audio/swig/audio_swig.i b/gr-audio/swig/audio_swig.i deleted file mode 100644 index 089055dac..000000000 --- a/gr-audio/swig/audio_swig.i +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2011 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. - */ - - -#define GR_AUDIO_API - -//////////////////////////////////////////////////////////////////////// -// standard includes -//////////////////////////////////////////////////////////////////////// -%include "gnuradio.i" - -//load generated python docstrings -%include "audio_swig_doc.i" - -//////////////////////////////////////////////////////////////////////// -// block headers -//////////////////////////////////////////////////////////////////////// -%{ -#include <gr_audio_source.h> -#include <gr_audio_sink.h> -%} - -//////////////////////////////////////////////////////////////////////// -// block magic -//////////////////////////////////////////////////////////////////////// -GR_SWIG_BLOCK_MAGIC(audio,source) -%include <gr_audio_source.h> - -GR_SWIG_BLOCK_MAGIC(audio,sink) -%include <gr_audio_sink.h> diff --git a/gr-digital/CMakeLists.txt b/gr-digital/CMakeLists.txt deleted file mode 100644 index 864cd673a..000000000 --- a/gr-digital/CMakeLists.txt +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) -GR_REGISTER_COMPONENT("gr-digital" ENABLE_GR_DIGITAL - Boost_FOUND - ENABLE_GR_CORE - ENABLE_GR_ANALOG -) - -GR_SET_GLOBAL(GR_DIGITAL_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/include -) - -GR_SET_GLOBAL(GR_DIGITAL_SWIG_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/swig -) - -SET(GR_PKG_DIGITAL_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/digital) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_DIGITAL) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_DIGITAL_DESCRIPTION "GNU Radio Digital Blocks") - -CPACK_COMPONENT("digital_runtime" - GROUP "Digital" - DISPLAY_NAME "Runtime" - DESCRIPTION "Dynamic link libraries" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("digital_devel" - GROUP "Digital" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("digital_python" - GROUP "Digital" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime" - DEPENDS "core_python;digital_runtime" -) - -CPACK_COMPONENT("digital_swig" - GROUP "Digital" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;digital_python;digital_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(include) -add_subdirectory(lib) -add_subdirectory(doc) -if(ENABLE_PYTHON) - add_subdirectory(swig) - add_subdirectory(python) - add_subdirectory(grc) - add_subdirectory(examples) -endif(ENABLE_PYTHON) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-digital.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-digital.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-digital.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "digital_devel" -) - -endif(ENABLE_GR_DIGITAL) diff --git a/gr-digital/README b/gr-digital/README deleted file mode 100644 index af2005c97..000000000 --- a/gr-digital/README +++ /dev/null @@ -1,4 +0,0 @@ -This GNU Radio component for implementing digitial modulators and demodulators. - - -FIXME: just fixme.
\ No newline at end of file diff --git a/gr-digital/doc/CMakeLists.txt b/gr-digital/doc/CMakeLists.txt deleted file mode 100644 index 5383236da..000000000 --- a/gr-digital/doc/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2011 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. - -install( - FILES README.digital - DESTINATION ${GR_PKG_DOC_DIR} -) diff --git a/gr-digital/doc/README.digital b/gr-digital/doc/README.digital deleted file mode 100644 index f4d40f3a0..000000000 --- a/gr-digital/doc/README.digital +++ /dev/null @@ -1,13 +0,0 @@ -This is the gr-digital package. It contains all of the digital -modulation blocks, utilities, and examples. To use the digital blocks, -the Python namespaces is in gnuradio.digital, which would be normally -imported as: - - from gnuradio import digital - -See the Doxygen documentation for details about the blocks available -in this package. A quick listing of the details can be found in Python -after importing by using: - - help(digital) - diff --git a/gr-digital/doc/digital.dox b/gr-digital/doc/digital.dox deleted file mode 100644 index 110dcb677..000000000 --- a/gr-digital/doc/digital.dox +++ /dev/null @@ -1,23 +0,0 @@ -/*! \page page_digital Digital Modulation - -\section Introduction -This is the gr-digital package. It contains all of the digital -modulation blocks, utilities, and examples. To use the digital blocks, -the Python namespaces is in gnuradio.digital, which would be normally -imported as: - -\code - from gnuradio import digital -\endcode - -See the Doxygen documentation for details about the blocks available -in this package. The relevant blocks are listed in the \ref digital group. - -A quick listing of the details can be found in Python after importing -by using: - -\code - help(digital) -\endcode - -*/ diff --git a/gr-digital/examples/CMakeLists.txt b/gr-digital/examples/CMakeLists.txt deleted file mode 100644 index 63e1eba4e..000000000 --- a/gr-digital/examples/CMakeLists.txt +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2011 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. - -include(GrPython) - -# Base stuff -GR_PYTHON_INSTALL(PROGRAMS - example_costas.py - example_fll.py - example_timing.py - run_length.py - gen_whitener.py - snr_estimators.py - DESTINATION ${GR_PKG_DIGITAL_EXAMPLES_DIR} - COMPONENT "digital_python" -) - -# Narrowband -GR_PYTHON_INSTALL(PROGRAMS - narrowband/transmit_path.py - narrowband/receive_path.py - narrowband/uhd_interface.py - narrowband/benchmark_tx.py - narrowband/benchmark_rx.py - narrowband/tx_voice.py - narrowband/rx_voice.py - narrowband/digital_bert_rx.py - narrowband/digital_bert_tx.py - narrowband/tunnel.py - DESTINATION ${GR_PKG_DIGITAL_EXAMPLES_DIR}/narrowband - COMPONENT "digital_python" -) - -# OFDM -GR_PYTHON_INSTALL(PROGRAMS - ofdm/benchmark_add_channel.py - ofdm/benchmark_rx.py - ofdm/benchmark_tx.py - ofdm/gr_plot_ofdm.py - ofdm/ofdm_mod_demod_test.py - ofdm/receive_path.py - ofdm/transmit_path.py - ofdm/tunnel.py - ofdm/uhd_interface.py - DESTINATION ${GR_PKG_DIGITAL_EXAMPLES_DIR}/ofdm - COMPONENT "digital_python" -) - -# DEMOD -install( - FILES - demod/digital_freq_lock.grc - demod/mpsk_demod.grc - demod/pam_sync.grc - demod/pam_timing.grc - demod/ber_simulation.grc - demod/dpsk_loopback.grc - demod/gfsk_loopback.grc - DESTINATION ${GR_PKG_DIGITAL_EXAMPLES_DIR}/demod - COMPONENT "digital_python" -) diff --git a/gr-digital/examples/berawgn.py b/gr-digital/examples/berawgn.py deleted file mode 100755 index d58dfbaae..000000000 --- a/gr-digital/examples/berawgn.py +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env python -""" -BER simulation for QPSK signals, compare to theoretical values. -Change the N_BITS value to simulate more bits per Eb/N0 value, -thus allowing to check for lower BER values. - -Lower values will work faster, higher values will use a lot of RAM. -Also, this app isn't highly optimized--the flow graph is completely -reinstantiated for every Eb/N0 value. -Of course, expect the maximum value for BER to be one order of -magnitude below what you chose for N_BITS. -""" - - -import math -import numpy -from scipy.special import erfc -import pylab -from gnuradio import gr, digital - -# Best to choose powers of 10 -N_BITS = 1e7 -RAND_SEED = 42 - -def berawgn(EbN0): - """ Calculates theoretical bit error rate in AWGN (for BPSK and given Eb/N0) """ - return 0.5 * erfc(math.sqrt(10**(float(EbN0)/10))) - -class BitErrors(gr.hier_block2): - """ Two inputs: true and received bits. We compare them and - add up the number of incorrect bits. Because integrate_ff() - can only add up a certain number of values, the output is - not a scalar, but a sequence of values, the sum of which is - the BER. """ - def __init__(self, bits_per_byte): - gr.hier_block2.__init__(self, "BitErrors", - gr.io_signature(2, 2, gr.sizeof_char), - gr.io_signature(1, 1, gr.sizeof_int)) - - # Bit comparison - comp = gr.xor_bb() - intdump_decim = 100000 - if N_BITS < intdump_decim: - intdump_decim = int(N_BITS) - self.connect(self, - comp, - gr.unpack_k_bits_bb(bits_per_byte), - gr.uchar_to_float(), - gr.integrate_ff(intdump_decim), - gr.multiply_const_ff(1.0/N_BITS), - self) - self.connect((self, 1), (comp, 1)) - -class BERAWGNSimu(gr.top_block): - " This contains the simulation flow graph " - def __init__(self, EbN0): - gr.top_block.__init__(self) - self.const = digital.qpsk_constellation() - # Source is N_BITS bits, non-repeated - data = map(int, numpy.random.randint(0, self.const.arity(), N_BITS/self.const.bits_per_symbol())) - src = gr.vector_source_b(data, False) - mod = gr.chunks_to_symbols_bc((self.const.points()), 1) - add = gr.add_vcc() - noise = gr.noise_source_c(gr.GR_GAUSSIAN, - self.EbN0_to_noise_voltage(EbN0), - RAND_SEED) - demod = digital.constellation_decoder_cb(self.const.base()) - ber = BitErrors(self.const.bits_per_symbol()) - self.sink = gr.vector_sink_f() - self.connect(src, mod, add, demod, ber, self.sink) - self.connect(noise, (add, 1)) - self.connect(src, (ber, 1)) - - def EbN0_to_noise_voltage(self, EbN0): - """ Converts Eb/N0 to a single-sided noise voltage (assuming unit symbol power) """ - return 1.0 / math.sqrt(2.0 * self.const.bits_per_symbol() * 10**(float(EbN0)/10)) - - -def simulate_ber(EbN0): - """ All the work's done here: create flow graph, run, read out BER """ - print "Eb/N0 = %d dB" % EbN0 - fg = BERAWGNSimu(EbN0) - fg.run() - return numpy.sum(fg.sink.data()) - -if __name__ == "__main__": - EbN0_min = 0 - EbN0_max = 15 - EbN0_range = range(EbN0_min, EbN0_max+1) - ber_theory = [berawgn(x) for x in EbN0_range] - print "Simulating..." - ber_simu = [simulate_ber(x) for x in EbN0_range] - - f = pylab.figure() - s = f.add_subplot(1,1,1) - s.semilogy(EbN0_range, ber_theory, 'g-.', label="Theoretical") - s.semilogy(EbN0_range, ber_simu, 'b-o', label="Simulated") - s.set_title('BER Simulation') - s.set_xlabel('Eb/N0 (dB)') - s.set_ylabel('BER') - s.legend() - s.grid() - pylab.show() - diff --git a/gr-digital/examples/demod/ber_simulation.grc b/gr-digital/examples/demod/ber_simulation.grc deleted file mode 100644 index 9d7b9c946..000000000 --- a/gr-digital/examples/demod/ber_simulation.grc +++ /dev/null @@ -1,698 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Mon Jan 14 11:20:53 2013</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>ber_simulation</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>BER Simulation</value> - </param> - <param> - <key>author</key> - <value>Example</value> - </param> - <param> - <key>description</key> - <value>Adjust the noise and constellation... see what happens!</value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(16, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(284, 24)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(486, 151)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER</value> - </param> - <param> - <key>units</key> - <value>%</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>min_value</key> - <value>0.0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>100</value> - </param> - <param> - <key>decimal_places</key> - <value>4</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>show_gauge</key> - <value>False</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(791, 228)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import math</value> - </param> - <param> - <key>_coordinate</key> - <value>(18, 373)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>EbN0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Eb/N0 (dB)</value> - </param> - <param> - <key>value</key> - <value>10</value> - </param> - <param> - <key>min</key> - <value>-10</value> - </param> - <param> - <key>max</key> - <value>200</value> - </param> - <param> - <key>num_steps</key> - <value>211</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(311, 309)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>const</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>(digital.constellation_bpsk(), digital.constellation_qpsk(), digital.constellation_8psk())</value> - </param> - <param> - <key>_coordinate</key> - <value>(116, 310)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>const[const_type].arity()</value> - </param> - <param> - <key>num_samps</key> - <value>10000000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(17, 125)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>1.0 / math.sqrt(2.0 * const[const_type].bits_per_symbol() * 10**(EbN0/10))</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(16, 224)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>byte</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>const[const_type].points()</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(240, 140)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_error_rate</key> - <param> - <key>id</key> - <value>blks2_error_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>'BER'</value> - </param> - <param> - <key>win_size</key> - <value>int(1e7)</value> - </param> - <param> - <key>bits_per_symbol</key> - <value>const[const_type].bits_per_symbol()</value> - </param> - <param> - <key>_coordinate</key> - <value>(720, 25)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_constellation_decoder_cb</key> - <param> - <key>id</key> - <value>digital_constellation_decoder_cb_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>constellation</key> - <value>const[const_type].base()</value> - </param> - <param> - <key>_coordinate</key> - <value>(618, 164)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>"Constellation: "+str(const[const_type].arity()) + "-PSK"</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>2, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(623, 228)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(16, 308)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>const_type</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(18, 428)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>variable_static_text_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Constellation Type</value> - </param> - <param> - <key>value</key> - <value>{0: 'BPSK', 1: 'QPSK', 2: '8-PSK'}[const_type] + " - Change const_type for different constellation types!"</value> - </param> - <param> - <key>converver</key> - <value>str_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(422, 311)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>blks2_error_rate</source_block_id> - <sink_block_id>wxgui_numbersink2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle</source_block_id> - <sink_block_id>blks2_error_rate</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>random_source_x</source_block_id> - <sink_block_id>gr_throttle</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_constellation_decoder_cb_0</source_block_id> - <sink_block_id>blks2_error_rate</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx</source_block_id> - <sink_block_id>digital_constellation_decoder_cb_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/digital_freq_lock.grc b/gr-digital/examples/demod/digital_freq_lock.grc deleted file mode 100644 index 589c651f4..000000000 --- a/gr-digital/examples/demod/digital_freq_lock.grc +++ /dev/null @@ -1,907 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Mon Jan 14 10:49:20 2013</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>digital_freq_lock</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>256</value> - </param> - <param> - <key>num_samps</key> - <value>10000000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(-2, 111)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(456, 134)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4</value> - </param> - <param> - <key>_coordinate</key> - <value>(166, -2)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rolloff</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.35</value> - </param> - <param> - <key>_coordinate</key> - <value>(231, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_fll_band_edge_cc</key> - <param> - <key>id</key> - <value>digital_fll_band_edge_cc_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>cc</value> - </param> - <param> - <key>samps_per_sym</key> - <value>sps</value> - </param> - <param> - <key>rolloff</key> - <value>rolloff</value> - </param> - <param> - <key>filter_size</key> - <value>44</value> - </param> - <param> - <key>w</key> - <value>freq_bw</value> - </param> - <param> - <key>_coordinate</key> - <value>(81, 248)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_bw</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>FLL Loop Bandwidth</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>0.1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(80, 382)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32000</value> - </param> - <param> - <key>_coordinate</key> - <value>(439, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>noise_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Channel Noise</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1.0</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(553, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Frequency Offset</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>-0.5</value> - </param> - <param> - <key>max</key> - <value>0.5</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(673, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_channel_model</key> - <param> - <key>id</key> - <value>gr_channel_model_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>noise_voltage</key> - <value>noise_amp</value> - </param> - <param> - <key>freq_offset</key> - <value>freq_offset</value> - </param> - <param> - <key>epsilon</key> - <value>1.0</value> - </param> - <param> - <key>taps</key> - <value>1.0</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(649, 104)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Signal into Receiver</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,1</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(875, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Signal into Receiver</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,0</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(875, 108)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Frequency Corrected Signal</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,1</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(439, 289)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Frequency Corrected Signal</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,0</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(439, 423)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>notebook_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['Freq', 'Time']</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(114, 521)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_psk_mod</key> - <param> - <key>id</key> - <value>digital_psk_mod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>constellation_points</key> - <value>2</value> - </param> - <param> - <key>mod_code</key> - <value>"gray"</value> - </param> - <param> - <key>differential</key> - <value>False</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>sps</value> - </param> - <param> - <key>excess_bw</key> - <value>rolloff</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(194, 104)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x</source_block_id> - <sink_block_id>digital_psk_mod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_psk_mod_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_channel_model_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>digital_fll_band_edge_cc_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_fll_band_edge_cc_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_fll_band_edge_cc_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/dpsk_loopback.grc b/gr-digital/examples/demod/dpsk_loopback.grc deleted file mode 100644 index c9867bea2..000000000 --- a/gr-digital/examples/demod/dpsk_loopback.grc +++ /dev/null @@ -1,506 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Jul 5 16:26:53 2012</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>dpsk_loopback</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>DPSK Loopback</value> - </param> - <param> - <key>author</key> - <value>GNU Radio</value> - </param> - <param> - <key>description</key> - <value>Encode a signal into a packet, modulate, demodulate, decode and show it's the same data.</value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10000</value> - </param> - <param> - <key>_coordinate</key> - <value>(11, 120)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Frequency (Hz)</value> - </param> - <param> - <key>value</key> - <value>500</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>samp_rate/2</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(13, 188)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>freq</value> - </param> - <param> - <key>amp</key> - <value>1</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(184, 9)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_dxpsk_mod</key> - <param> - <key>id</key> - <value>digital_dxpsk_mod_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>dbpsk</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>2</value> - </param> - <param> - <key>excess_bw</key> - <value>0.35</value> - </param> - <param> - <key>gray_coded</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(745, 16)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(358, 39)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_packet_encoder</key> - <param> - <key>id</key> - <value>blks2_packet_encoder_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>2</value> - </param> - <param> - <key>bits_per_symbol</key> - <value>1</value> - </param> - <param> - <key>access_code</key> - <value></value> - </param> - <param> - <key>pad_for_usrp</key> - <value>True</value> - </param> - <param> - <key>payload_length</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(541, 9)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_dxpsk_demod</key> - <param> - <key>id</key> - <value>digital_dxpsk_demod_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>dbpsk</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>2</value> - </param> - <param> - <key>excess_bw</key> - <value>0.35</value> - </param> - <param> - <key>freq_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>phase_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>timing_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>omega_relative_limit</key> - <value>0.005</value> - </param> - <param> - <key>gray_coded</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>sync_out</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(746, 135)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>blks2_packet_decoder</key> - <param> - <key>id</key> - <value>blks2_packet_decoder_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>access_code</key> - <value></value> - </param> - <param> - <key>threshold</key> - <value>-1</value> - </param> - <param> - <key>_coordinate</key> - <value>(545, 187)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>1./freq</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(184, 165)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <connection> - <source_block_id>blks2_packet_decoder_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_packet_encoder_0</source_block_id> - <sink_block_id>digital_dxpsk_mod_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_dxpsk_mod_1</source_block_id> - <sink_block_id>digital_dxpsk_demod_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_dxpsk_demod_1</source_block_id> - <sink_block_id>blks2_packet_decoder_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0_0</source_block_id> - <sink_block_id>blks2_packet_encoder_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/gfsk_loopback.grc b/gr-digital/examples/demod/gfsk_loopback.grc deleted file mode 100644 index f74a83526..000000000 --- a/gr-digital/examples/demod/gfsk_loopback.grc +++ /dev/null @@ -1,646 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sun Jul 8 16:56:18 2012</timestamp> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Frequency (Hz)</value> - </param> - <param> - <key>value</key> - <value>500</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>samp_rate/2</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(34, 241)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>freq</value> - </param> - <param> - <key>amp</key> - <value>1</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(215, 26)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(272.5, 142.0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_packet_encoder</key> - <param> - <key>id</key> - <value>blks2_packet_encoder_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>2</value> - </param> - <param> - <key>bits_per_symbol</key> - <value>1</value> - </param> - <param> - <key>access_code</key> - <value></value> - </param> - <param> - <key>pad_for_usrp</key> - <value>True</value> - </param> - <param> - <key>payload_length</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(261, 227)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10000</value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_gfsk_demod</key> - <param> - <key>id</key> - <value>digital_gfsk_demod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>sps</value> - </param> - <param> - <key>sensitivity</key> - <value>fm_sensitivity</value> - </param> - <param> - <key>gain_mu</key> - <value>0.175</value> - </param> - <param> - <key>mu</key> - <value>0.5</value> - </param> - <param> - <key>omega_relative_limit</key> - <value>0.005</value> - </param> - <param> - <key>freq_error</key> - <value>0.0</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(669, 257)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>8</value> - </param> - <param> - <key>_coordinate</key> - <value>(47, 445)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_gfsk_mod</key> - <param> - <key>id</key> - <value>digital_gfsk_mod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>sps</value> - </param> - <param> - <key>sensitivity</key> - <value>fm_sensitivity</value> - </param> - <param> - <key>bt</key> - <value>0.35</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(456, 277)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>fm_sensitivity</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(40, 366)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_packet_decoder</key> - <param> - <key>id</key> - <value>blks2_packet_decoder_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>access_code</key> - <value></value> - </param> - <param> - <key>threshold</key> - <value>-1</value> - </param> - <param> - <key>_coordinate</key> - <value>(705, 130)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_quadrature_demod_cf</key> - <param> - <key>id</key> - <value>gr_quadrature_demod_cf_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>gain</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(627, 417)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>options</key> - <param> - <key>id</key> - <value>gfsk_loopback</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>1./freq</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(907, 59)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(853, 400)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>digital_gfsk_mod_0</source_block_id> - <sink_block_id>digital_gfsk_demod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0_0</source_block_id> - <sink_block_id>blks2_packet_encoder_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_packet_encoder_0</source_block_id> - <sink_block_id>digital_gfsk_mod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_gfsk_demod_0</source_block_id> - <sink_block_id>blks2_packet_decoder_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_packet_decoder_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_gfsk_mod_0</source_block_id> - <sink_block_id>gr_quadrature_demod_cf_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_quadrature_demod_cf_0</source_block_id> - <sink_block_id>wxgui_scopesink2_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/mpsk_demod.grc b/gr-digital/examples/demod/mpsk_demod.grc deleted file mode 100644 index b718fb68a..000000000 --- a/gr-digital/examples/demod/mpsk_demod.grc +++ /dev/null @@ -1,606 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Jul 5 16:28:45 2012</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>mpsk_demod</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>MPSK Demod Demo</value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32000</value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samps_per_sym</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4</value> - </param> - <param> - <key>_coordinate</key> - <value>(7, 89)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>noise</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Noise</value> - </param> - <param> - <key>value</key> - <value>.1</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(259, 353)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_off</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Freq Offset</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>-.5</value> - </param> - <param> - <key>max</key> - <value>.5</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(126, 345)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>notebook</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['Constellation', 'Spectrum']</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(520, 407)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_constellationsink2</key> - <param> - <key>id</key> - <value>wxgui_constellationsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Constellation Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>frame_rate</key> - <value>5</value> - </param> - <param> - <key>const_size</key> - <value>2048</value> - </param> - <param> - <key>M</key> - <value>4</value> - </param> - <param> - <key>theta</key> - <value>0</value> - </param> - <param> - <key>loop_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>fmax</key> - <value>0.06</value> - </param> - <param> - <key>mu</key> - <value>0.5</value> - </param> - <param> - <key>gain_mu</key> - <value>0.005</value> - </param> - <param> - <key>symbol_rate</key> - <value>samp_rate/4.</value> - </param> - <param> - <key>omega_limit</key> - <value>0.005</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook, 0</value> - </param> - <param> - <key>_coordinate</key> - <value>(824, 212)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>FFT Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>50</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook, 1</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(847, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_channel_model</key> - <param> - <key>id</key> - <value>gr_channel_model_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>noise_voltage</key> - <value>noise</value> - </param> - <param> - <key>freq_offset</key> - <value>freq_off</value> - </param> - <param> - <key>epsilon</key> - <value>1.0</value> - </param> - <param> - <key>taps</key> - <value>1.0</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(487, 282)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(633, 82)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2**8</value> - </param> - <param> - <key>num_samps</key> - <value>10000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(161, 119)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_dxpsk_mod</key> - <param> - <key>id</key> - <value>digital_dxpsk_mod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>dqpsk</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>samps_per_sym</value> - </param> - <param> - <key>excess_bw</key> - <value>0.35</value> - </param> - <param> - <key>gray_coded</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(361, 119)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>wxgui_constellationsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_dxpsk_mod_0</source_block_id> - <sink_block_id>gr_channel_model_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>digital_dxpsk_mod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/pam_sync.grc b/gr-digital/examples/demod/pam_sync.grc deleted file mode 100644 index 7bc071d11..000000000 --- a/gr-digital/examples/demod/pam_sync.grc +++ /dev/null @@ -1,1431 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Mon Jan 14 10:47:40 2013</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>pam_sync</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>const</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>digital.qpsk_constellation()</value> - </param> - <param> - <key>_coordinate</key> - <value>(336, -2)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>virtual_sink</key> - <param> - <key>id</key> - <value>virtual_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>input_signal_probe</value> - </param> - <param> - <key>_coordinate</key> - <value>(330, 183)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_pfb_clock_sync_xxx</key> - <param> - <key>id</key> - <value>gr_pfb_clock_sync_xxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ccf</value> - </param> - <param> - <key>sps</key> - <value>spb</value> - </param> - <param> - <key>alpha</key> - <value>time_alpha</value> - </param> - <param> - <key>beta</key> - <value>time_beta</value> - </param> - <param> - <key>taps</key> - <value>rrctaps</value> - </param> - <param> - <key>filter_size</key> - <value>nfilts</value> - </param> - <param> - <key>init_phase</key> - <value>16</value> - </param> - <param> - <key>max_dev</key> - <value>1.5</value> - </param> - <param> - <key>osps</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(598, 241)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_fll_band_edge_cc</key> - <param> - <key>id</key> - <value>digital_fll_band_edge_cc_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>cc</value> - </param> - <param> - <key>samps_per_sym</key> - <value>spb</value> - </param> - <param> - <key>rolloff</key> - <value>rolloff</value> - </param> - <param> - <key>filter_size</key> - <value>44</value> - </param> - <param> - <key>w</key> - <value>freq_bw</value> - </param> - <param> - <key>_coordinate</key> - <value>(331, 239)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>128000</value> - </param> - <param> - <key>_coordinate</key> - <value>(193, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>const.arity()</value> - </param> - <param> - <key>num_samps</key> - <value>10000000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(0, 72)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_channel_model</key> - <param> - <key>id</key> - <value>gr_channel_model_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>noise_voltage</key> - <value>noise_amp</value> - </param> - <param> - <key>freq_offset</key> - <value>freq_offset</value> - </param> - <param> - <key>epsilon</key> - <value>interpratio</value> - </param> - <param> - <key>taps</key> - <value>1.0</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(46, 183)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(857, 95)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>virtual_source</key> - <param> - <key>id</key> - <value>virtual_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>input_signal_probe</value> - </param> - <param> - <key>_coordinate</key> - <value>(835, 562)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Pre-sync Signal</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>.5</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,1</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(1081, 439)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Received spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,1</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(1081, 563)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Post-sync spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,0</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(347, 516)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Post-sync Signal</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,0</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(1085, 213)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_bw</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>FLL Bandwidth</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0.0</value> - </param> - <param> - <key>max</key> - <value>0.05</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(4,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(341, 373)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>time_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Alpha</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(5,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(598, 388)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>time_beta</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Beta</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0.0</value> - </param> - <param> - <key>max</key> - <value>0.1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(6,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(708, 388)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>phase_bw</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Costas Loop (Phase) Bandwidth</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>0.1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(7,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(866, 313)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>notebook_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['Synched Signal', 'Received Signal']</value> - </param> - <param> - <key>grid_pos</key> - <value>(1,1,8,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(9, 601)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>interpratio</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Offset</value> - </param> - <param> - <key>value</key> - <value>1.00</value> - </param> - <param> - <key>min</key> - <value>0.99</value> - </param> - <param> - <key>max</key> - <value>1.01</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(3,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(60, 407)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>sig_amp</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(659, 95)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>byte</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>const.points()</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(178, 87)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>spb</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(513, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rolloff</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.35</value> - </param> - <param> - <key>_coordinate</key> - <value>(578, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rrctaps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(nfilts*spb), rolloff, int(11*spb*nfilts))</value> - </param> - <param> - <key>_coordinate</key> - <value>(660, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sig_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(887, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>nfilts</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32</value> - </param> - <param> - <key>_coordinate</key> - <value>(816, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_pfb_arb_resampler_ccf</key> - <param> - <key>id</key> - <value>blks2_pfb_arb_resampler_ccf_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>rate</key> - <value>spb</value> - </param> - <param> - <key>taps</key> - <value>firdes.root_raised_cosine(nfilts, 1.0, 1.0/nfilts, rolloff, int(11*spb*nfilts))</value> - </param> - <param> - <key>size</key> - <value>nfilts</value> - </param> - <param> - <key>_coordinate</key> - <value>(411, 80)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Frequency Offset</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>-0.5</value> - </param> - <param> - <key>max</key> - <value>0.5</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(2,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 285)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>noise_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Channel Noise</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1.0</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(1,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(129, 285)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_costas_loop_cc</key> - <param> - <key>id</key> - <value>digital_costas_loop_cc_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>w</key> - <value>phase_bw</value> - </param> - <param> - <key>order</key> - <value>const.arity()</value> - </param> - <param> - <key>_coordinate</key> - <value>(866, 246)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>virtual_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_fll_band_edge_cc_0</source_block_id> - <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>digital_costas_loop_cc_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_costas_loop_cc_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>digital_fll_band_edge_cc_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_fll_band_edge_cc_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>virtual_source_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>virtual_source_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_channel_model_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx</source_block_id> - <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/pam_timing.grc b/gr-digital/examples/demod/pam_timing.grc deleted file mode 100644 index af14191eb..000000000 --- a/gr-digital/examples/demod/pam_timing.grc +++ /dev/null @@ -1,1240 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Mon Jan 14 11:00:42 2013</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>pam_timing</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>beta</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Beta</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0.0</value> - </param> - <param> - <key>max</key> - <value>0.1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(668, 5)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Alpha</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(552, 4)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>const.arity()</value> - </param> - <param> - <key>num_samps</key> - <value>10000000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 163)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>byte</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>const.points()</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(203, 178)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>sig_amp</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(651, 186)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_channel_model</key> - <param> - <key>id</key> - <value>gr_channel_model_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>noise_voltage</key> - <value>noise_amp</value> - </param> - <param> - <key>freq_offset</key> - <value>freq_offset</value> - </param> - <param> - <key>epsilon</key> - <value>interpratio</value> - </param> - <param> - <key>taps</key> - <value>1.0</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(73, 354)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(274, 384)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sig_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(662, 128)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>interpratio</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Offset</value> - </param> - <param> - <key>value</key> - <value>1.00</value> - </param> - <param> - <key>min</key> - <value>0.99</value> - </param> - <param> - <key>max</key> - <value>1.01</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 465)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>noise_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Channel Noise</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1.0</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(114, 465)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Frequency Offset</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>-0.5</value> - </param> - <param> - <key>max</key> - <value>0.5</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(236, 465)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32000</value> - </param> - <param> - <key>_coordinate</key> - <value>(282, 324)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>const</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>digital.qpsk_constellation()</value> - </param> - <param> - <key>_coordinate</key> - <value>(206, 116)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>from gnuradio import digital</value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 61)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rolloff</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>.35</value> - </param> - <param> - <key>_coordinate</key> - <value>(459, 262)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>nfilts</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32</value> - </param> - <param> - <key>_coordinate</key> - <value>(539, 262)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_pfb_clock_sync_xxx</key> - <param> - <key>id</key> - <value>gr_pfb_clock_sync_xxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ccf</value> - </param> - <param> - <key>sps</key> - <value>spb</value> - </param> - <param> - <key>alpha</key> - <value>alpha</value> - </param> - <param> - <key>beta</key> - <value>beta</value> - </param> - <param> - <key>taps</key> - <value>firdes.root_raised_cosine(nfilts, nfilts*spb, 1.0, rolloff, 44*nfilts)</value> - </param> - <param> - <key>filter_size</key> - <value>nfilts</value> - </param> - <param> - <key>init_phase</key> - <value>16</value> - </param> - <param> - <key>max_dev</key> - <value>1.5</value> - </param> - <param> - <key>osps</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(444, 331)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_pfb_arb_resampler_ccf</key> - <param> - <key>id</key> - <value>blks2_pfb_arb_resampler_ccf_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>rate</key> - <value>spb</value> - </param> - <param> - <key>taps</key> - <value>firdes.root_raised_cosine(nfilts, nfilts, 1.0, rolloff, 44*nfilts)</value> - </param> - <param> - <key>size</key> - <value>nfilts</value> - </param> - <param> - <key>_coordinate</key> - <value>(438, 171)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Error</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>.5</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,3</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(826, 112)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(829, 266)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>1.25</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,2</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(824, 485)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Error</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>3</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,0</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(829, 358)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>9</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,1</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(754, 607)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>notebook_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['error', 'phase', 'freq', 'Resampled Signal']</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(380, 511)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>spb</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4.2563</value> - </param> - <param> - <key>_coordinate</key> - <value>(300, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0_0_0</sink_block_id> - <source_key>2</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>gr_channel_model_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx</source_block_id> - <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0_0</sink_block_id> - <source_key>3</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0</sink_block_id> - <source_key>1</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/example_costas.py b/gr-digital/examples/example_costas.py deleted file mode 100755 index aef0196cc..000000000 --- a/gr-digital/examples/example_costas.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, digital -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -try: - import scipy -except ImportError: - print "Error: could not import scipy (http://www.scipy.org/)" - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: could not import pylab (http://matplotlib.sourceforge.net/)" - sys.exit(1) - -class example_costas(gr.top_block): - def __init__(self, N, sps, rolloff, ntaps, bw, noise, foffset, toffset, poffset): - gr.top_block.__init__(self) - - rrc_taps = gr.firdes.root_raised_cosine( - sps, sps, 1.0, rolloff, ntaps) - - data = 2.0*scipy.random.randint(0, 2, N) - 1.0 - data = scipy.exp(1j*poffset) * data - - self.src = gr.vector_source_c(data.tolist(), False) - self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps) - self.chn = gr.channel_model(noise, foffset, toffset) - self.cst = digital.costas_loop_cc(bw, 2) - - self.vsnk_src = gr.vector_sink_c() - self.vsnk_cst = gr.vector_sink_c() - self.vsnk_frq = gr.vector_sink_f() - - self.connect(self.src, self.rrc, self.chn, self.cst, self.vsnk_cst) - self.connect(self.rrc, self.vsnk_src) - self.connect((self.cst,1), self.vsnk_frq) - -def main(): - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("-N", "--nsamples", type="int", default=2000, - help="Set the number of samples to process [default=%default]") - parser.add_option("-S", "--sps", type="int", default=4, - help="Set the samples per symbol [default=%default]") - parser.add_option("-r", "--rolloff", type="eng_float", default=0.35, - help="Set the rolloff factor [default=%default]") - parser.add_option("-W", "--bandwidth", type="eng_float", default=2*scipy.pi/100.0, - help="Set the loop bandwidth [default=%default]") - parser.add_option("-n", "--ntaps", type="int", default=45, - help="Set the number of taps in the filters [default=%default]") - parser.add_option("", "--noise", type="eng_float", default=0.0, - help="Set the simulation noise voltage [default=%default]") - parser.add_option("-f", "--foffset", type="eng_float", default=0.0, - help="Set the simulation's normalized frequency offset (in Hz) [default=%default]") - parser.add_option("-t", "--toffset", type="eng_float", default=1.0, - help="Set the simulation's timing offset [default=%default]") - parser.add_option("-p", "--poffset", type="eng_float", default=0.707, - help="Set the simulation's phase offset [default=%default]") - (options, args) = parser.parse_args () - - # Adjust N for the interpolation by sps - options.nsamples = options.nsamples // options.sps - - # Set up the program-under-test - put = example_costas(options.nsamples, options.sps, options.rolloff, - options.ntaps, options.bandwidth, options.noise, - options.foffset, options.toffset, options.poffset) - put.run() - - data_src = scipy.array(put.vsnk_src.data()) - - # Convert the FLL's LO frequency from rads/sec to Hz - data_frq = scipy.array(put.vsnk_frq.data()) / (2.0*scipy.pi) - - # adjust this to align with the data. - data_cst = scipy.array(3*[0,]+list(put.vsnk_cst.data())) - - # Plot the Costas loop's LO frequency - f1 = pylab.figure(1, figsize=(12,10), facecolor='w') - s1 = f1.add_subplot(2,2,1) - s1.plot(data_frq) - s1.set_title("Costas LO") - s1.set_xlabel("Samples") - s1.set_ylabel("Frequency (normalized Hz)") - - # Plot the IQ symbols - s3 = f1.add_subplot(2,2,2) - s3.plot(data_src.real, data_src.imag, "o") - s3.plot(data_cst.real, data_cst.imag, "rx") - s3.set_title("IQ") - s3.set_xlabel("Real part") - s3.set_ylabel("Imag part") - s3.set_xlim([-2, 2]) - s3.set_ylim([-2, 2]) - - # Plot the symbols in time - s4 = f1.add_subplot(2,2,3) - s4.set_position([0.125, 0.05, 0.775, 0.4]) - s4.plot(data_src.real, "o-") - s4.plot(data_cst.real, "rx-") - s4.set_title("Symbols") - s4.set_xlabel("Samples") - s4.set_ylabel("Real Part of Signals") - - pylab.show() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gr-digital/examples/example_fll.py b/gr-digital/examples/example_fll.py deleted file mode 100755 index 3b75b5a75..000000000 --- a/gr-digital/examples/example_fll.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, digital -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -try: - import scipy -except ImportError: - print "Error: could not import scipy (http://www.scipy.org/)" - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: could not import pylab (http://matplotlib.sourceforge.net/)" - sys.exit(1) - -class example_fll(gr.top_block): - def __init__(self, N, sps, rolloff, ntaps, bw, noise, foffset, toffset, poffset): - gr.top_block.__init__(self) - - rrc_taps = gr.firdes.root_raised_cosine( - sps, sps, 1.0, rolloff, ntaps) - - data = 2.0*scipy.random.randint(0, 2, N) - 1.0 - data = scipy.exp(1j*poffset) * data - - self.src = gr.vector_source_c(data.tolist(), False) - self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps) - self.chn = gr.channel_model(noise, foffset, toffset) - self.fll = digital.fll_band_edge_cc(sps, rolloff, ntaps, bw) - - self.vsnk_src = gr.vector_sink_c() - self.vsnk_fll = gr.vector_sink_c() - self.vsnk_frq = gr.vector_sink_f() - self.vsnk_phs = gr.vector_sink_f() - self.vsnk_err = gr.vector_sink_f() - - self.connect(self.src, self.rrc, self.chn, self.fll, self.vsnk_fll) - self.connect(self.rrc, self.vsnk_src) - self.connect((self.fll,1), self.vsnk_frq) - self.connect((self.fll,2), self.vsnk_phs) - self.connect((self.fll,3), self.vsnk_err) - -def main(): - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("-N", "--nsamples", type="int", default=2000, - help="Set the number of samples to process [default=%default]") - parser.add_option("-S", "--sps", type="int", default=4, - help="Set the samples per symbol [default=%default]") - parser.add_option("-r", "--rolloff", type="eng_float", default=0.35, - help="Set the rolloff factor [default=%default]") - parser.add_option("-W", "--bandwidth", type="eng_float", default=2*scipy.pi/100.0, - help="Set the loop bandwidth [default=%default]") - parser.add_option("-n", "--ntaps", type="int", default=45, - help="Set the number of taps in the filters [default=%default]") - parser.add_option("", "--noise", type="eng_float", default=0.0, - help="Set the simulation noise voltage [default=%default]") - parser.add_option("-f", "--foffset", type="eng_float", default=0.2, - help="Set the simulation's normalized frequency offset (in Hz) [default=%default]") - parser.add_option("-t", "--toffset", type="eng_float", default=1.0, - help="Set the simulation's timing offset [default=%default]") - parser.add_option("-p", "--poffset", type="eng_float", default=0.0, - help="Set the simulation's phase offset [default=%default]") - (options, args) = parser.parse_args () - - # Adjust N for the interpolation by sps - options.nsamples = options.nsamples // options.sps - - # Set up the program-under-test - put = example_fll(options.nsamples, options.sps, options.rolloff, - options.ntaps, options.bandwidth, options.noise, - options.foffset, options.toffset, options.poffset) - put.run() - - data_src = scipy.array(put.vsnk_src.data()) - data_err = scipy.array(put.vsnk_err.data()) - - # Convert the FLL's LO frequency from rads/sec to Hz - data_frq = scipy.array(put.vsnk_frq.data()) / (2.0*scipy.pi) - - # adjust this to align with the data. There are 2 filters of - # ntaps long and the channel introduces another 4 sample delay. - data_fll = scipy.array(put.vsnk_fll.data()[2*options.ntaps-4:]) - - # Plot the FLL's LO frequency - f1 = pylab.figure(1, figsize=(12,10)) - s1 = f1.add_subplot(2,2,1) - s1.plot(data_frq) - s1.set_title("FLL LO") - s1.set_xlabel("Samples") - s1.set_ylabel("Frequency (normalized Hz)") - - # Plot the FLL's error - s2 = f1.add_subplot(2,2,2) - s2.plot(data_err) - s2.set_title("FLL Error") - s2.set_xlabel("Samples") - s2.set_ylabel("FLL Loop error") - - # Plot the IQ symbols - s3 = f1.add_subplot(2,2,3) - s3.plot(data_src.real, data_src.imag, "o") - s3.plot(data_fll.real, data_fll.imag, "rx") - s3.set_title("IQ") - s3.set_xlabel("Real part") - s3.set_ylabel("Imag part") - - # Plot the symbols in time - s4 = f1.add_subplot(2,2,4) - s4.plot(data_src.real, "o-") - s4.plot(data_fll.real, "rx-") - s4.set_title("Symbols") - s4.set_xlabel("Samples") - s4.set_ylabel("Real Part of Signals") - - pylab.show() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gr-digital/examples/example_timing.py b/gr-digital/examples/example_timing.py deleted file mode 100755 index fd86acfb1..000000000 --- a/gr-digital/examples/example_timing.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, digital -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -try: - import scipy -except ImportError: - print "Error: could not import scipy (http://www.scipy.org/)" - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: could not import pylab (http://matplotlib.sourceforge.net/)" - sys.exit(1) - -from scipy import fftpack - -class example_timing(gr.top_block): - def __init__(self, N, sps, rolloff, ntaps, bw, noise, - foffset, toffset, poffset, mode=0): - gr.top_block.__init__(self) - - rrc_taps = gr.firdes.root_raised_cosine( - sps, sps, 1.0, rolloff, ntaps) - - gain = 2*scipy.pi/100.0 - nfilts = 32 - rrc_taps_rx = gr.firdes.root_raised_cosine( - nfilts, sps*nfilts, 1.0, rolloff, ntaps*nfilts) - - data = 2.0*scipy.random.randint(0, 2, N) - 1.0 - data = scipy.exp(1j*poffset) * data - - self.src = gr.vector_source_c(data.tolist(), False) - self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps) - self.chn = gr.channel_model(noise, foffset, toffset) - self.off = gr.fractional_interpolator_cc(0.20, 1.0) - - if mode == 0: - self.clk = gr.pfb_clock_sync_ccf(sps, gain, rrc_taps_rx, - nfilts, nfilts//2, 3.5) - self.taps = self.clk.get_taps() - self.dtaps = self.clk.get_diff_taps() - - self.vsnk_err = gr.vector_sink_f() - self.vsnk_rat = gr.vector_sink_f() - self.vsnk_phs = gr.vector_sink_f() - - self.connect((self.clk,1), self.vsnk_err) - self.connect((self.clk,2), self.vsnk_rat) - self.connect((self.clk,3), self.vsnk_phs) - - else: # mode == 1 - mu = 0.5 - gain_mu = 0.1 - gain_omega = 0.25*gain_mu*gain_mu - omega_rel_lim = 0.02 - self.clk = digital.clock_recovery_mm_cc(sps, gain_omega, - mu, gain_mu, - omega_rel_lim) - - self.vsnk_err = gr.vector_sink_f() - - self.connect((self.clk,1), self.vsnk_err) - - self.vsnk_src = gr.vector_sink_c() - self.vsnk_clk = gr.vector_sink_c() - - self.connect(self.src, self.rrc, self.chn, self.off, self.clk, self.vsnk_clk) - self.connect(self.off, self.vsnk_src) - - -def main(): - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("-N", "--nsamples", type="int", default=2000, - help="Set the number of samples to process [default=%default]") - parser.add_option("-S", "--sps", type="int", default=4, - help="Set the samples per symbol [default=%default]") - parser.add_option("-r", "--rolloff", type="eng_float", default=0.35, - help="Set the rolloff factor [default=%default]") - parser.add_option("-W", "--bandwidth", type="eng_float", default=2*scipy.pi/100.0, - help="Set the loop bandwidth [default=%default]") - parser.add_option("-n", "--ntaps", type="int", default=45, - help="Set the number of taps in the filters [default=%default]") - parser.add_option("", "--noise", type="eng_float", default=0.0, - help="Set the simulation noise voltage [default=%default]") - parser.add_option("-f", "--foffset", type="eng_float", default=0.0, - help="Set the simulation's normalized frequency offset (in Hz) [default=%default]") - parser.add_option("-t", "--toffset", type="eng_float", default=1.0, - help="Set the simulation's timing offset [default=%default]") - parser.add_option("-p", "--poffset", type="eng_float", default=0.0, - help="Set the simulation's phase offset [default=%default]") - parser.add_option("-M", "--mode", type="int", default=0, - help="Set the recovery mode (0: polyphase, 1: M&M) [default=%default]") - (options, args) = parser.parse_args () - - # Adjust N for the interpolation by sps - options.nsamples = options.nsamples // options.sps - - # Set up the program-under-test - put = example_timing(options.nsamples, options.sps, options.rolloff, - options.ntaps, options.bandwidth, options.noise, - options.foffset, options.toffset, options.poffset, - options.mode) - put.run() - - if options.mode == 0: - data_src = scipy.array(put.vsnk_src.data()[20:]) - data_clk = scipy.array(put.vsnk_clk.data()[20:]) - - data_err = scipy.array(put.vsnk_err.data()[20:]) - data_rat = scipy.array(put.vsnk_rat.data()[20:]) - data_phs = scipy.array(put.vsnk_phs.data()[20:]) - - f1 = pylab.figure(1, figsize=(12,10), facecolor='w') - - # Plot the IQ symbols - s1 = f1.add_subplot(2,2,1) - s1.plot(data_src.real, data_src.imag, "bo") - s1.plot(data_clk.real, data_clk.imag, "ro") - s1.set_title("IQ") - s1.set_xlabel("Real part") - s1.set_ylabel("Imag part") - s1.set_xlim([-2, 2]) - s1.set_ylim([-2, 2]) - - # Plot the symbols in time - s2 = f1.add_subplot(2,2,2) - s2.plot(data_src.real, "bo-") - s2.plot(data_clk.real, "ro") - s2.set_title("Symbols") - s2.set_xlabel("Samples") - s2.set_ylabel("Real Part of Signals") - - # Plot the clock recovery loop's error - s3 = f1.add_subplot(2,2,3) - s3.plot(data_err) - s3.set_title("Clock Recovery Loop Error") - s3.set_xlabel("Samples") - s3.set_ylabel("Error") - - # Plot the clock recovery loop's error - s4 = f1.add_subplot(2,2,4) - s4.plot(data_phs) - s4.set_title("Clock Recovery Loop Filter Phase") - s4.set_xlabel("Samples") - s4.set_ylabel("Filter Phase") - - - diff_taps = put.dtaps - ntaps = len(diff_taps[0]) - nfilts = len(diff_taps) - t = scipy.arange(0, ntaps*nfilts) - - f3 = pylab.figure(3, figsize=(12,10), facecolor='w') - s31 = f3.add_subplot(2,1,1) - s32 = f3.add_subplot(2,1,2) - s31.set_title("Differential Filters") - s32.set_title("FFT of Differential Filters") - - for i,d in enumerate(diff_taps): - D = 20.0*scipy.log10(abs(fftpack.fftshift(fftpack.fft(d, 10000)))) - s31.plot(t[i::nfilts].real, d, "-o") - s32.plot(D) - - # If testing the M&M clock recovery loop - else: - data_src = scipy.array(put.vsnk_src.data()[20:]) - data_clk = scipy.array(put.vsnk_clk.data()[20:]) - - data_err = scipy.array(put.vsnk_err.data()[20:]) - - f1 = pylab.figure(1, figsize=(12,10), facecolor='w') - - # Plot the IQ symbols - s1 = f1.add_subplot(2,2,1) - s1.plot(data_src.real, data_src.imag, "o") - s1.plot(data_clk.real, data_clk.imag, "ro") - s1.set_title("IQ") - s1.set_xlabel("Real part") - s1.set_ylabel("Imag part") - s1.set_xlim([-2, 2]) - s1.set_ylim([-2, 2]) - - # Plot the symbols in time - s2 = f1.add_subplot(2,2,2) - s2.plot(data_src.real, "o-") - s2.plot(data_clk.real, "ro") - s2.set_title("Symbols") - s2.set_xlabel("Samples") - s2.set_ylabel("Real Part of Signals") - - # Plot the clock recovery loop's error - s3 = f1.add_subplot(2,2,3) - s3.plot(data_err) - s3.set_title("Clock Recovery Loop Error") - s3.set_xlabel("Samples") - s3.set_ylabel("Error") - - pylab.show() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gr-digital/examples/gen_whitener.py b/gr-digital/examples/gen_whitener.py deleted file mode 100755 index 9a81e4eaa..000000000 --- a/gr-digital/examples/gen_whitener.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, gru -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -class my_graph(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - src = gr.lfsr_32k_source_s() - head = gr.head(gr.sizeof_short, 2048) - self.dst = gr.vector_sink_s() - self.connect(src, head, self.dst) - -if __name__ == '__main__': - try: - tb = my_graph() - tb.run() - f = sys.stdout - i = 0 - for s in tb.dst.data(): - f.write("%3d, " % (s & 0xff,)) - f.write("%3d, " % ((s >> 8) & 0xff,)) - i = i+2 - if i % 16 == 0: - f.write('\n') - - except KeyboardInterrupt: - pass - - diff --git a/gr-digital/examples/narrowband/README b/gr-digital/examples/narrowband/README deleted file mode 100644 index 1c50ad69b..000000000 --- a/gr-digital/examples/narrowband/README +++ /dev/null @@ -1,153 +0,0 @@ -Quick overview of what's here: - -* benchmark_tx.py: generates packets of the size you -specify and sends them across the air using the USRP. Known to work -well using the USRP with the RFX transceiver daughterboards. -You can specify the bitrate to use with the -r <bitrate> command line -parameter. The default is 500k. Some machines will do 1M or more. -You can select the modulation to use with the -m <modulation> command -line argument. The legal values for <modulation> are gmsk, dbpsk and dqpsk. - -* benchmark_rx.py: the receiver half of benchmark_tx.py. -Command line arguments are pretty much the same as rx. Works well -with a USRP and RFX transceiver daughterboards. Will also work -with TVRX daugherboard, but you'll need to fiddle with the gain. See -below. Prints a summary of each packet received and keeps a running -total of packets received, and how many of them were error free. -There are two levels of error reporting going on. If the access code -(PN code) and header of a packet were properly detected, then you'll -get an output line. If the CRC32 of the payload was correct you get -"ok = True", else "ok = False". The "pktno" is extracted from the -received packet. If there are skipped numbers, you're missing some -packets. Be sure you've got a suitable antenna connected to the TX/RX -port on each board. For the RFX-400, "70 cm" / 420 MHz antennas for ham -handi-talkies work great. These are available at ham radio supplies, -etc. The boards need to be at least 3m apart. You can also try -experimenting with the rx gain (-g <gain> command line option). - -Generally speaking, I start the rx first on one machine, and then fire -up the tx on the other machine. The tx also supports a discontinous -transmission mode where it sends bursts of 5 packets and then waits 1 -second. This is useful for ensuring that all the receiver control -loops lock up fast enough. - -* tunnel.py: This program provides a framework for building your own -MACs. It creates a "TAP" interface in the kernel, typically gr0, -and sends and receives ethernet frames through it. See -/usr/src/linux/Documentation/networking/tuntap.txt and/or Google for -"universal tun tap". The Linux 2.6 kernel includes the tun module, you -don't have to build it. You may have to "modprobe tun" if it's not -loaded by default. If /dev/net/tun doesn't exist, try "modprobe tun". - -To run this program you'll need to be root or running with the -appropriate capability to open the tun interface. You'll need to fire -up two copies on different machines. Once each is running you'll need -to ifconfig the gr0 interface to set the IP address. - -This will allow two machines to talk, but anything beyond the two -machines depends on your networking setup. Left as an exercise... - -On machine A: - - $ su - # ./tunnel.py --freq 423.0M --bitrate 500k - # # in another window on A, also as root... - # ifconfig gr0 192.168.200.1 - - -On machine B: - - $ su - # ./tunnel.py --freq 423.0M --bitrate 500k - # # in another window on B, also as root... - # ifconfig gr0 192.168.200.2 - -Now, on machine A you shold be able to ping machine B: - - $ ping 192.168.200.2 - -and you should see some output for each packet in the -tunnel.py window if you used the -v option. - -Likewise, on machine B: - - $ ping 192.168.200.1 - -This now uses a carrier sense MAC, so you should be able to ssh -between the machines, web browse, etc. - -* run_length.py: This program takes a single argument '-f FILE' and -outputs the number of runs of similar bits within the file. It is -useful as a diagnostic tool when experimenting with line coding or -whitening algorithms. - - - -********************************************************************** -********************************************************************** - - -BERT testing example scripts - -benchmark_tx.py - -This sets up a BPSK transmitter that is modulated with a pseudorandom -sequence of bits. The PN code is generated by sending an all 1s -sequence through a 7-bit scrambler. The transmitter performs the BPSK -modulation, then passes the complex baseband waveform through a -root-raised-cosine filter and onto the USRP. - -The --sps parameter controls how many baseband samples per symbol -are created and passed through the RRC filter, prior to going to the -USRP over the USB for interpolation to the final DAC rate. - -The baseband bit rate is controlled by -r or --rate. This value, when -multiplied by the --sps parameter, must result in valid interpolation -rate for the USRP. For example, if the baseband rate is 250k bits/sec, -and the samples per symbol is 4, then the final rate is 1M samples/sec, -which results in an interpolation rate of 128. The valid interpolation -rates for the USRP are multiples of 4 between 16 and 512. - -Finally, the RRC excess bandwidth may be specified by --excess-bw. -(See ./benchmark_tx.py -h for additional parameters.) - - -benchmark_rx.py - -This sets up a BPSK receiver to demodulate the received waveform. It -accepts a similar set of parameters as the transmitter, except that one -specifies the USRP decimation rate desired. The resulting sample stream -rate must be an integral number of baseband symbols. For example, the -parameters corresponding to the above transmitter would be to use a -decimation rate of 8 (32 sps), 16 (16 sps), 32 (8 sps), 64, (4 sps), or -128 (2 sps). The lower the USRP decimation, the more CPU is required to -demodulate the signal, so not all valid decimation rates will work. - -The baseband signal from the USRP is first passed through an AGC to -establish an average power of 1.0. It is then passed through a matched -filter (another RRC), a Costas phase-locked loop, and a Mueller and -Muller bit timing recovery loop. The resulting constellation has an SNR -estimation probe attached, and is then sliced into a bit stream. - -The recovered bits are then passed through a 7-bit descrambler. If -there are no channel errors, the all 1s sequence is recovered. In the -event of a channel error, there will be a 0 in the bit stream for each -feedback tap in the descrambler. In this case, the CCSDS descrambler is -using 3 feedback taps. - -Finally, the signal is passed into a bit density measurement probe. The -channel BER is measured by dividing the 0s density by three. This -measurement is inaccurate at high BER rates (>10%) as the error 0s -begin to overlap. - -The benchmark script will, once per second, output the Costas loop -frequency offset, the recovered timing error, the estimated SNR, and the -average BER. - -NOTE: The particular SNR estimator used is inaccurate below about 7dB, -and will report erroneously high values even for random noise. - -There are a variety of Costas and M&M loop parameters one can adjust. -See ./benchmark_rx.py -h for the full set. - - diff --git a/gr-digital/examples/narrowband/benchmark_add_channel.py b/gr-digital/examples/narrowband/benchmark_add_channel.py deleted file mode 100755 index c69ee60b0..000000000 --- a/gr-digital/examples/narrowband/benchmark_add_channel.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 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. -# - -from gnuradio import gr -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random, math, sys - -class my_top_block(gr.top_block): - def __init__(self, ifile, ofile, options): - gr.top_block.__init__(self) - - SNR = 10.0**(options.snr/10.0) - frequency_offset = options.frequency_offset - time_offset = options.time_offset - phase_offset = options.phase_offset*(math.pi/180.0) - - # calculate noise voltage from SNR - power_in_signal = abs(options.tx_amplitude)**2 - noise_power = power_in_signal/SNR - noise_voltage = math.sqrt(noise_power) - - self.src = gr.file_source(gr.sizeof_gr_complex, ifile) - #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate) - self.channel = gr.channel_model(noise_voltage, frequency_offset, - time_offset, noise_seed=-random.randint(0,100000)) - self.phase = gr.multiply_const_cc(complex(math.cos(phase_offset), - math.sin(phase_offset))) - self.snk = gr.file_sink(gr.sizeof_gr_complex, ofile) - - self.connect(self.src, self.channel, self.phase, self.snk) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - # Create Options Parser: - usage = "benchmack_add_channel.py [options] <input file> <output file>" - parser = OptionParser (usage=usage, option_class=eng_option, conflict_handler="resolve") - parser.add_option("-n", "--snr", type="eng_float", default=30, - help="set the SNR of the channel in dB [default=%default]") - parser.add_option("", "--seed", action="store_true", default=False, - help="use a random seed for AWGN noise [default=%default]") - parser.add_option("-f", "--frequency-offset", type="eng_float", default=0, - help="set frequency offset introduced by channel [default=%default]") - parser.add_option("-t", "--time-offset", type="eng_float", default=1.0, - help="set timing offset between Tx and Rx [default=%default]") - parser.add_option("-p", "--phase-offset", type="eng_float", default=0, - help="set phase offset (in degrees) between Tx and Rx [default=%default]") - parser.add_option("-m", "--use-multipath", action="store_true", default=False, - help="Use a multipath channel [default=%default]") - parser.add_option("", "--tx-amplitude", type="eng_float", - default=1.0, - help="tell the simulator the signal amplitude [default=%default]") - - (options, args) = parser.parse_args () - - if len(args) != 2: - parser.print_help(sys.stderr) - sys.exit(1) - - ifile = args[0] - ofile = args[1] - - # build the graph - tb = my_top_block(ifile, ofile, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.start() # start flow graph - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/benchmark_rx.py b/gr-digital/examples/narrowband/benchmark_rx.py deleted file mode 100755 index 1962fdc4b..000000000 --- a/gr-digital/examples/narrowband/benchmark_rx.py +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 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. -# - -from gnuradio import gr, gru -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# From gr-digital -from gnuradio import digital - -# from current dir -from receive_path import receive_path -from uhd_interface import uhd_receiver - -import struct -import sys - -#import os -#print os.getpid() -#raw_input('Attach and press enter: ') - -class my_top_block(gr.top_block): - def __init__(self, demodulator, rx_callback, options): - gr.top_block.__init__(self) - - if(options.rx_freq is not None): - # Work-around to get the modulation's bits_per_symbol - args = demodulator.extract_kwargs_from_options(options) - symbol_rate = options.bitrate / demodulator(**args).bits_per_symbol() - - self.source = uhd_receiver(options.args, symbol_rate, - options.samples_per_symbol, - options.rx_freq, options.rx_gain, - options.spec, options.antenna, - options.verbose) - options.samples_per_symbol = self.source._sps - - elif(options.from_file is not None): - sys.stderr.write(("Reading samples from '%s'.\n\n" % (options.from_file))) - self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file) - else: - sys.stderr.write("No source defined, pulling samples from null source.\n\n") - self.source = gr.null_source(gr.sizeof_gr_complex) - - # Set up receive path - # do this after for any adjustments to the options that may - # occur in the sinks (specifically the UHD sink) - self.rxpath = receive_path(demodulator, rx_callback, options) - - self.connect(self.source, self.rxpath) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -global n_rcvd, n_right - -def main(): - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right - (pktno,) = struct.unpack('!H', payload[0:2]) - n_rcvd += 1 - if ok: - n_right += 1 - - print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) - - demods = digital.modulation_utils.type_1_demods() - - # Create Options Parser: - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), - default='psk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(demods.keys()),)) - parser.add_option("","--from-file", default=None, - help="input file of samples to demod") - - receive_path.add_options(parser, expert_grp) - uhd_receiver.add_options(parser) - - for mod in demods.values(): - mod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.from_file is None: - if options.rx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - - # build the graph - tb = my_top_block(demods[options.modulation], rx_callback, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.start() # start flow graph - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/benchmark_tx.py b/gr-digital/examples/narrowband/benchmark_tx.py deleted file mode 100755 index 9afacb495..000000000 --- a/gr-digital/examples/narrowband/benchmark_tx.py +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 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. -# - -from gnuradio import gr -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# From gr-digital -from gnuradio import digital - -# from current dir -from transmit_path import transmit_path -from uhd_interface import uhd_transmitter - -import time, struct, sys - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - -class my_top_block(gr.top_block): - def __init__(self, modulator, options): - gr.top_block.__init__(self) - - if(options.tx_freq is not None): - # Work-around to get the modulation's bits_per_symbol - args = modulator.extract_kwargs_from_options(options) - symbol_rate = options.bitrate / modulator(**args).bits_per_symbol() - - self.sink = uhd_transmitter(options.args, symbol_rate, - options.samples_per_symbol, - options.tx_freq, options.tx_gain, - options.spec, options.antenna, - options.verbose) - options.samples_per_symbol = self.sink._sps - - elif(options.to_file is not None): - sys.stderr.write(("Saving samples to '%s'.\n\n" % (options.to_file))) - self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) - else: - sys.stderr.write("No sink defined, dumping samples to null sink.\n\n") - self.sink = gr.null_sink(gr.sizeof_gr_complex) - - # do this after for any adjustments to the options that may - # occur in the sinks (specifically the UHD sink) - self.txpath = transmit_path(modulator, options) - - self.connect(self.txpath, self.sink) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - def send_pkt(payload='', eof=False): - return tb.txpath.send_pkt(payload, eof) - - mods = digital.modulation_utils.type_1_mods() - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='psk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinous transmission (bursts of 5 packets)") - parser.add_option("","--from-file", default=None, - help="use intput file for packet contents") - parser.add_option("","--to-file", default=None, - help="Output file for modulated samples") - - transmit_path.add_options(parser, expert_grp) - uhd_transmitter.add_options(parser) - - for mod in mods.values(): - mod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.from_file is not None: - source_file = open(options.from_file, 'r') - - # build the graph - tb = my_top_block(mods[options.modulation], options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - tb.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - pkt_size = int(options.size) - - while n < nbytes: - if options.from_file is None: - data = (pkt_size - 2) * chr(pktno & 0xff) - else: - data = source_file.read(pkt_size - 2) - if data == '': - break; - - payload = struct.pack('!H', pktno & 0xffff) + data - send_pkt(payload) - n += len(payload) - sys.stderr.write('.') - if options.discontinuous and pktno % 5 == 4: - time.sleep(1) - pktno += 1 - - send_pkt(eof=True) - - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/digital_bert_rx.py b/gr-digital/examples/narrowband/digital_bert_rx.py deleted file mode 100755 index 4055aa244..000000000 --- a/gr-digital/examples/narrowband/digital_bert_rx.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008,2011 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. -# - -from gnuradio import gr, eng_notation -from optparse import OptionParser -from gnuradio.eng_option import eng_option -import gnuradio.gr.gr_threading as _threading -import sys, time, math - -from gnuradio import digital - -# from current dir -from uhd_interface import uhd_receiver - -n2s = eng_notation.num_to_str - -class status_thread(_threading.Thread): - def __init__(self, tb): - _threading.Thread.__init__(self) - self.setDaemon(1) - self.tb = tb - self.done = False - self.start() - - def run(self): - while not self.done: - print "Freq. Offset: {0:5.0f} Hz Timing Offset: {1:10.1f} ppm Estimated SNR: {2:4.1f} dB BER: {3:g}".format( - tb.frequency_offset(), tb.timing_offset()*1e6, tb.snr(), tb.ber()) - try: - time.sleep(1.0) - except KeyboardInterrupt: - self.done = True - - - -class bert_receiver(gr.hier_block2): - def __init__(self, bitrate, - constellation, samples_per_symbol, - differential, excess_bw, gray_coded, - freq_bw, timing_bw, phase_bw, - verbose, log): - - gr.hier_block2.__init__(self, "bert_receive", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - - self._bitrate = bitrate - - self._demod = digital.generic_demod(constellation, samples_per_symbol, - differential, excess_bw, gray_coded, - freq_bw, timing_bw, phase_bw, - verbose, log) - - self._symbol_rate = self._bitrate / self._demod.bits_per_symbol() - self._sample_rate = self._symbol_rate * samples_per_symbol - - # Add an SNR probe on the demodulated constellation - self._snr_probe = digital.probe_mpsk_snr_est_c(digital.SNR_EST_M2M4, alpha=10.0/self._symbol_rate) - self.connect(self._demod.time_recov, self._snr_probe) - - # Descramble BERT sequence. A channel error will create 3 incorrect bits - self._descrambler = gr.descrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit descrambler - - # Measure BER by the density of 0s in the stream - self._ber = gr.probe_density_b(1.0/self._symbol_rate) - - self.connect(self, self._demod, self._descrambler, self._ber) - - def frequency_offset(self): - return self._demod.freq_recov.get_frequency()*self._sample_rate/(2*math.pi) - - def timing_offset(self): - return self._demod.time_recov.get_clock_rate() - - def snr(self): - return self._snr_probe.snr() - - def ber(self): - return (1.0-self._ber.density())/3.0 - - - -class rx_psk_block(gr.top_block): - def __init__(self, demod, options): - - gr.top_block.__init__(self, "rx_mpsk") - - self._demodulator_class = demod - - # Get demod_kwargs - demod_kwargs = self._demodulator_class.extract_kwargs_from_options(options) - - # demodulator - self._demodulator = self._demodulator_class(**demod_kwargs) - - if(options.rx_freq is not None): - symbol_rate = options.bitrate / self._demodulator.bits_per_symbol() - self._source = uhd_receiver(options.args, symbol_rate, - options.samples_per_symbol, - options.rx_freq, options.rx_gain, - options.spec, - options.antenna, options.verbose) - options.samples_per_symbol = self._source._sps - - elif(options.from_file is not None): - self._source = gr.file_source(gr.sizeof_gr_complex, options.from_file) - else: - self._source = gr.null_source(gr.sizeof_gr_complex) - - # Create the BERT receiver - self._receiver = bert_receiver(options.bitrate, - self._demodulator._constellation, - options.samples_per_symbol, - options.differential, - options.excess_bw, - gray_coded=True, - freq_bw=options.freq_bw, - timing_bw=options.timing_bw, - phase_bw=options.phase_bw, - verbose=options.verbose, - log=options.log) - - self.connect(self._source, self._receiver) - - def snr(self): - return self._receiver.snr() - - def mag(self): - return self._receiver.signal_mean() - - def var(self): - return self._receiver.noise_variance() - - def ber(self): - return self._receiver.ber() - - def frequency_offset(self): - return self._receiver.frequency_offset() - - def timing_offset(self): - return self._receiver.timing_offset() - - -def get_options(demods): - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("","--from-file", default=None, - help="input file of samples to demod") - parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), - default='psk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(demods.keys()),)) - parser.add_option("-r", "--bitrate", type="eng_float", default=250e3, - help="Select modulation bit rate (default=%default)") - parser.add_option("-S", "--samples-per-symbol", type="float", default=2, - help="set samples/symbol [default=%default]") - if not parser.has_option("--verbose"): - parser.add_option("-v", "--verbose", action="store_true", default=False) - if not parser.has_option("--log"): - parser.add_option("", "--log", action="store_true", default=False, - help="Log all parts of flow graph to files (CAUTION: lots of data)") - - uhd_receiver.add_options(parser) - - demods = digital.modulation_utils.type_1_demods() - for mod in demods.values(): - mod.add_options(parser) - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - return (options, args) - - -if __name__ == "__main__": - demods = digital.modulation_utils.type_1_demods() - - (options, args) = get_options(demods) - - demod = demods[options.modulation] - tb = rx_psk_block(demod, options) - - print "\n*** SNR estimator is inaccurate below about 7dB" - print "*** BER estimator is inaccurate above about 10%\n" - updater = status_thread(tb) - - try: - tb.run() - except KeyboardInterrupt: - updater.done = True - updater = None diff --git a/gr-digital/examples/narrowband/digital_bert_tx.py b/gr-digital/examples/narrowband/digital_bert_tx.py deleted file mode 100755 index f29e997af..000000000 --- a/gr-digital/examples/narrowband/digital_bert_tx.py +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008,2011 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. -# - -from gnuradio import gr, eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -from gnuradio import digital - -# from current dir -from uhd_interface import uhd_transmitter - -n2s = eng_notation.num_to_str - -class bert_transmit(gr.hier_block2): - def __init__(self, constellation, samples_per_symbol, - differential, excess_bw, gray_coded, - verbose, log): - - gr.hier_block2.__init__(self, "bert_transmit", - gr.io_signature(0, 0, 0), # Output signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Input signature - - # Create BERT data bit stream - self._bits = gr.vector_source_b([1,], True) # Infinite stream of ones - self._scrambler = gr.scrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit scrambler - - self._mod = digital.generic_mod(constellation, samples_per_symbol, - differential, excess_bw, gray_coded, - verbose, log) - - self._pack = gr.unpacked_to_packed_bb(self._mod.bits_per_symbol(), gr.GR_MSB_FIRST) - - self.connect(self._bits, self._scrambler, self._pack, self._mod, self) - - -class tx_psk_block(gr.top_block): - def __init__(self, mod, options): - gr.top_block.__init__(self, "tx_mpsk") - - self._modulator_class = mod - - # Get mod_kwargs - mod_kwargs = self._modulator_class.extract_kwargs_from_options(options) - - # transmitter - self._modulator = self._modulator_class(**mod_kwargs) - - if(options.tx_freq is not None): - symbol_rate = options.bitrate / self._modulator.bits_per_symbol() - self._sink = uhd_transmitter(options.args, symbol_rate, - options.samples_per_symbol, - options.tx_freq, options.tx_gain, - options.spec, - options.antenna, options.verbose) - options.samples_per_symbol = self._sink._sps - - elif(options.to_file is not None): - self._sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) - else: - self._sink = gr.null_sink(gr.sizeof_gr_complex) - - - self._transmitter = bert_transmit(self._modulator._constellation, - options.samples_per_symbol, - options.differential, - options.excess_bw, - gray_coded=True, - verbose=options.verbose, - log=options.log) - - self.amp = gr.multiply_const_cc(options.amplitude) - self.connect(self._transmitter, self.amp, self._sink) - - -def get_options(mods): - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='psk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - parser.add_option("", "--amplitude", type="eng_float", default=0.2, - help="set Tx amplitude (0-1) (default=%default)") - parser.add_option("-r", "--bitrate", type="eng_float", default=250e3, - help="Select modulation bit rate (default=%default)") - parser.add_option("-S", "--samples-per-symbol", type="float", default=2, - help="set samples/symbol [default=%default]") - parser.add_option("","--to-file", default=None, - help="Output file for modulated samples") - if not parser.has_option("--verbose"): - parser.add_option("-v", "--verbose", action="store_true", default=False) - if not parser.has_option("--log"): - parser.add_option("", "--log", action="store_true", default=False) - - uhd_transmitter.add_options(parser) - - for mod in mods.values(): - mod.add_options(parser) - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - return (options, args) - -if __name__ == "__main__": - mods = digital.modulation_utils.type_1_mods() - - (options, args) = get_options(mods) - - mod = mods[options.modulation] - tb = tx_psk_block(mod, options) - - try: - tb.run() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/receive_path.py b/gr-digital/examples/narrowband/receive_path.py deleted file mode 100644 index 1f9310506..000000000 --- a/gr-digital/examples/narrowband/receive_path.py +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 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. -# - -from gnuradio import gr, gru -from gnuradio import eng_notation -from gnuradio import digital - -import copy -import sys - -# ///////////////////////////////////////////////////////////////////////////// -# receive path -# ///////////////////////////////////////////////////////////////////////////// - -class receive_path(gr.hier_block2): - def __init__(self, demod_class, rx_callback, options): - gr.hier_block2.__init__(self, "receive_path", - gr.io_signature(1, 1, gr.sizeof_gr_complex), - gr.io_signature(0, 0, 0)) - - options = copy.copy(options) # make a copy so we can destructively modify - - self._verbose = options.verbose - self._bitrate = options.bitrate # desired bit rate - - self._rx_callback = rx_callback # this callback is fired when a packet arrives - self._demod_class = demod_class # the demodulator_class we're using - - self._chbw_factor = options.chbw_factor # channel filter bandwidth factor - - # Get demod_kwargs - demod_kwargs = self._demod_class.extract_kwargs_from_options(options) - - # Build the demodulator - self.demodulator = self._demod_class(**demod_kwargs) - - # Make sure the channel BW factor is between 1 and sps/2 - # or the filter won't work. - if(self._chbw_factor < 1.0 or self._chbw_factor > self.samples_per_symbol()/2): - sys.stderr.write("Channel bandwidth factor ({0}) must be within the range [1.0, {1}].\n".format(self._chbw_factor, self.samples_per_symbol()/2)) - sys.exit(1) - - # Design filter to get actual channel we want - sw_decim = 1 - chan_coeffs = gr.firdes.low_pass (1.0, # gain - sw_decim * self.samples_per_symbol(), # sampling rate - self._chbw_factor, # midpoint of trans. band - 0.5, # width of trans. band - gr.firdes.WIN_HANN) # filter type - self.channel_filter = gr.fft_filter_ccc(sw_decim, chan_coeffs) - - # receiver - self.packet_receiver = \ - digital.demod_pkts(self.demodulator, - access_code=None, - callback=self._rx_callback, - threshold=-1) - - # Carrier Sensing Blocks - alpha = 0.001 - thresh = 30 # in dB, will have to adjust - self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha) - - # Display some information about the setup - if self._verbose: - self._print_verbage() - - # connect block input to channel filter - self.connect(self, self.channel_filter) - - # connect the channel input filter to the carrier power detector - self.connect(self.channel_filter, self.probe) - - # connect channel filter to the packet receiver - self.connect(self.channel_filter, self.packet_receiver) - - def bitrate(self): - return self._bitrate - - def samples_per_symbol(self): - return self.demodulator._samples_per_symbol - - def differential(self): - return self.demodulator._differential - - def carrier_sensed(self): - """ - Return True if we think carrier is present. - """ - #return self.probe.level() > X - return self.probe.unmuted() - - def carrier_threshold(self): - """ - Return current setting in dB. - """ - return self.probe.threshold() - - def set_carrier_threshold(self, threshold_in_db): - """ - Set carrier threshold. - - @param threshold_in_db: set detection threshold - @type threshold_in_db: float (dB) - """ - self.probe.set_threshold(threshold_in_db) - - - def add_options(normal, expert): - """ - Adds receiver-specific options to the Options Parser - """ - if not normal.has_option("--bitrate"): - normal.add_option("-r", "--bitrate", type="eng_float", default=100e3, - help="specify bitrate [default=%default].") - normal.add_option("-v", "--verbose", action="store_true", default=False) - expert.add_option("-S", "--samples-per-symbol", type="float", default=2, - help="set samples/symbol [default=%default]") - expert.add_option("", "--log", action="store_true", default=False, - help="Log all parts of flow graph to files (CAUTION: lots of data)") - expert.add_option("", "--chbw-factor", type="float", default=1.0, - help="Channel bandwidth = chbw_factor x signal bandwidth [defaut=%default]") - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - - def _print_verbage(self): - """ - Prints information about the receive path - """ - print "\nReceive Path:" - print "modulation: %s" % (self._demod_class.__name__) - print "bitrate: %sb/s" % (eng_notation.num_to_str(self._bitrate)) - print "samples/symbol: %.4f" % (self.samples_per_symbol()) - print "Differential: %s" % (self.differential()) diff --git a/gr-digital/examples/narrowband/rx_voice.py b/gr-digital/examples/narrowband/rx_voice.py deleted file mode 100755 index 100caff8e..000000000 --- a/gr-digital/examples/narrowband/rx_voice.py +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2009,2011 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. -# - -from gnuradio import gr, blks2, audio, uhd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -from gnuradio import digital -from gnuradio import vocoder - -import random -import struct -import sys - -# from current dir -from receive_path import receive_path -from uhd_interface import uhd_receiver - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - - -class audio_tx(gr.hier_block2): - def __init__(self, audio_output_dev): - gr.hier_block2.__init__(self, "audio_tx", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - - self.sample_rate = sample_rate = 8000 - self.packet_src = gr.message_source(33) - voice_decoder = vocoder.gsm_fr_decode_ps() - s2f = gr.short_to_float () - sink_scale = gr.multiply_const_ff(1.0/32767.) - audio_sink = audio.sink(sample_rate, audio_output_dev) - self.connect(self.packet_src, voice_decoder, s2f, sink_scale, audio_sink) - - def msgq(self): - return self.packet_src.msgq() - - -class my_top_block(gr.top_block): - def __init__(self, demod_class, rx_callback, options): - gr.top_block.__init__(self) - self.rxpath = receive_path(demod_class, rx_callback, options) - self.audio_tx = audio_tx(options.audio_output) - - if(options.rx_freq is not None): - self.source = uhd_receiver(options.args, options.bitrate, - options.samples_per_symbol, - options.rx_freq, options.rx_gain, - options.antenna, options.verbose) - options.samples_per_symbol = self.source._sps - - audio_rate = self.audio_tx.sample_rate - usrp_rate = self.source.get_sample_rate() - rrate = audio_rate / usrp_rate - self.resampler = blks2.pfb_arb_resampler_ccf(rrate) - - self.connect(self.source, self.resampler, self.rxpath) - - elif(options.from_file is not None): - self.thr = gr.throttle(gr.sizeof_gr_complex, options.bitrate) - self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file) - self.connect(self.source, self.thr, self.rxpath) - - else: - self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6) - self.source = gr.null_source(gr.sizeof_gr_complex) - self.connect(self.source, self.thr, self.rxpath) - - self.connect(self.audio_tx) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -global n_rcvd, n_right - -def main(): - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right - n_rcvd += 1 - if ok: - n_right += 1 - - tb.audio_tx.msgq().insert_tail(gr.message_from_string(payload)) - - print "ok = %r n_rcvd = %4d n_right = %4d" % ( - ok, n_rcvd, n_right) - - demods = digital.modulation_utils.type_1_demods() - - # Create Options Parser: - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), - default='gmsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(demods.keys()),)) - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("","--from-file", default=None, - help="input file of samples to demod") - receive_path.add_options(parser, expert_grp) - uhd_receiver.add_options(parser) - - for mod in demods.values(): - mod.add_options(expert_grp) - - parser.set_defaults(bitrate=50e3) # override default bitrate default - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.from_file is None: - if options.rx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - - # build the graph - tb = my_top_block(demods[options.modulation], rx_callback, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.run() - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/transmit_path.py b/gr-digital/examples/narrowband/transmit_path.py deleted file mode 100644 index 4d6162ed6..000000000 --- a/gr-digital/examples/narrowband/transmit_path.py +++ /dev/null @@ -1,126 +0,0 @@ -# -# Copyright 2005-2007,2011 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. -# - -from gnuradio import gr -from gnuradio import eng_notation -from gnuradio import digital - -import copy -import sys - -# ///////////////////////////////////////////////////////////////////////////// -# transmit path -# ///////////////////////////////////////////////////////////////////////////// - -class transmit_path(gr.hier_block2): - def __init__(self, modulator_class, options): - ''' - See below for what options should hold - ''' - gr.hier_block2.__init__(self, "transmit_path", - gr.io_signature(0,0,0), - gr.io_signature(1,1,gr.sizeof_gr_complex)) - - options = copy.copy(options) # make a copy so we can destructively modify - - self._verbose = options.verbose - self._tx_amplitude = options.tx_amplitude # digital amplitude sent to USRP - self._bitrate = options.bitrate # desired bit rate - self._modulator_class = modulator_class # the modulator_class we are using - - # Get mod_kwargs - mod_kwargs = self._modulator_class.extract_kwargs_from_options(options) - - # transmitter - self.modulator = self._modulator_class(**mod_kwargs) - - self.packet_transmitter = \ - digital.mod_pkts(self.modulator, - access_code=None, - msgq_limit=4, - pad_for_usrp=True) - - self.amp = gr.multiply_const_cc(1) - self.set_tx_amplitude(self._tx_amplitude) - - # Display some information about the setup - if self._verbose: - self._print_verbage() - - # Connect components in the flowgraph - self.connect(self.packet_transmitter, self.amp, self) - - def set_tx_amplitude(self, ampl): - """ - Sets the transmit amplitude sent to the USRP in volts - @param: ampl 0 <= ampl < 1. - """ - self._tx_amplitude = max(0.0, min(ampl, 1)) - self.amp.set_k(self._tx_amplitude) - - def send_pkt(self, payload='', eof=False): - """ - Calls the transmitter method to send a packet - """ - return self.packet_transmitter.send_pkt(payload, eof) - - def bitrate(self): - return self._bitrate - - def samples_per_symbol(self): - return self.modulator._samples_per_symbol - - def differential(self): - return self.modulator._differential - - def add_options(normal, expert): - """ - Adds transmitter-specific options to the Options Parser - """ - if not normal.has_option('--bitrate'): - normal.add_option("-r", "--bitrate", type="eng_float", - default=100e3, - help="specify bitrate [default=%default].") - normal.add_option("", "--tx-amplitude", type="eng_float", - default=0.250, metavar="AMPL", - help="set transmitter digital amplitude: 0 <= AMPL < 1 [default=%default]") - normal.add_option("-v", "--verbose", action="store_true", - default=False) - - expert.add_option("-S", "--samples-per-symbol", type="float", - default=2, - help="set samples/symbol [default=%default]") - expert.add_option("", "--log", action="store_true", - default=False, - help="Log all parts of flow graph to file (CAUTION: lots of data)") - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the transmit path - """ - print "Tx amplitude %s" % (self._tx_amplitude) - print "modulation: %s" % (self._modulator_class.__name__) - print "bitrate: %sb/s" % (eng_notation.num_to_str(self._bitrate)) - print "samples/symbol: %.4f" % (self.samples_per_symbol()) - print "Differential: %s" % (self.differential()) diff --git a/gr-digital/examples/narrowband/tunnel.py b/gr-digital/examples/narrowband/tunnel.py deleted file mode 100755 index 65205b9f6..000000000 --- a/gr-digital/examples/narrowband/tunnel.py +++ /dev/null @@ -1,297 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2009,2011 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 code sets up up a virtual ethernet interface (typically -# gr0), and relays packets between the interface and the GNU Radio -# PHY+MAC -# -# What this means in plain language, is that if you've got a couple -# of USRPs on different machines, and if you run this code on those -# machines, you can talk between them using normal TCP/IP -# networking. -# -# //////////////////////////////////////////////////////////////////// - - -from gnuradio import gr, digital -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# from current dir -from receive_path import receive_path -from transmit_path import transmit_path -from uhd_interface import uhd_transmitter -from uhd_interface import uhd_receiver - -import os, sys -import random, time, struct - -#print os.getpid() -#raw_input('Attach and press enter') - -# //////////////////////////////////////////////////////////////////// -# -# Use the Universal TUN/TAP device driver to move packets to/from -# kernel -# -# See /usr/src/linux/Documentation/networking/tuntap.txt -# -# //////////////////////////////////////////////////////////////////// - -# Linux specific... -# TUNSETIFF ifr flags from <linux/tun_if.h> - -IFF_TUN = 0x0001 # tunnel IP packets -IFF_TAP = 0x0002 # tunnel ethernet frames -IFF_NO_PI = 0x1000 # don't pass extra packet info -IFF_ONE_QUEUE = 0x2000 # beats me ;) - -def open_tun_interface(tun_device_filename): - from fcntl import ioctl - - mode = IFF_TAP | IFF_NO_PI - TUNSETIFF = 0x400454ca - - tun = os.open(tun_device_filename, os.O_RDWR) - ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", mode)) - ifname = ifs[:16].strip("\x00") - return (tun, ifname) - - -# //////////////////////////////////////////////////////////////////// -# the flow graph -# //////////////////////////////////////////////////////////////////// - -class my_top_block(gr.top_block): - - def __init__(self, mod_class, demod_class, - rx_callback, options): - - gr.top_block.__init__(self) - - # Get the modulation's bits_per_symbol - args = mod_class.extract_kwargs_from_options(options) - symbol_rate = options.bitrate / mod_class(**args).bits_per_symbol() - - self.source = uhd_receiver(options.args, symbol_rate, - options.samples_per_symbol, - options.rx_freq, options.rx_gain, - options.spec, options.antenna, - options.verbose) - - self.sink = uhd_transmitter(options.args, symbol_rate, - options.samples_per_symbol, - options.tx_freq, options.tx_gain, - options.spec, options.antenna, - options.verbose) - - options.samples_per_symbol = self.source._sps - - self.txpath = transmit_path(mod_class, options) - self.rxpath = receive_path(demod_class, rx_callback, options) - self.connect(self.txpath, self.sink) - self.connect(self.source, self.rxpath) - - def send_pkt(self, payload='', eof=False): - return self.txpath.send_pkt(payload, eof) - - def carrier_sensed(self): - """ - Return True if the receive path thinks there's carrier - """ - return self.rxpath.carrier_sensed() - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - """ - - self.sink.set_freq(target_freq) - self.source.set_freq(target_freq) - - -# //////////////////////////////////////////////////////////////////// -# Carrier Sense MAC -# //////////////////////////////////////////////////////////////////// - -class cs_mac(object): - """ - Prototype carrier sense MAC - - Reads packets from the TUN/TAP interface, and sends them to the - PHY. Receives packets from the PHY via phy_rx_callback, and sends - them into the TUN/TAP interface. - - Of course, we're not restricted to getting packets via TUN/TAP, - this is just an example. - """ - - def __init__(self, tun_fd, verbose=False): - self.tun_fd = tun_fd # file descriptor for TUN/TAP interface - self.verbose = verbose - self.tb = None # top block (access to PHY) - - def set_top_block(self, tb): - self.tb = tb - - def phy_rx_callback(self, ok, payload): - """ - Invoked by thread associated with PHY to pass received packet up. - - @param ok: bool indicating whether payload CRC was OK - @param payload: contents of the packet (string) - """ - if self.verbose: - print "Rx: ok = %r len(payload) = %4d" % (ok, len(payload)) - if ok: - os.write(self.tun_fd, payload) - - def main_loop(self): - """ - Main loop for MAC. - Only returns if we get an error reading from TUN. - - FIXME: may want to check for EINTR and EAGAIN and reissue read - """ - min_delay = 0.001 # seconds - - while 1: - payload = os.read(self.tun_fd, 10*1024) - if not payload: - self.tb.send_pkt(eof=True) - break - - if self.verbose: - print "Tx: len(payload) = %4d" % (len(payload),) - - delay = min_delay - while self.tb.carrier_sensed(): - sys.stderr.write('B') - time.sleep(delay) - if delay < 0.050: - delay = delay * 2 # exponential back-off - - self.tb.send_pkt(payload) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - mods = digital.modulation_utils.type_1_mods() - demods = digital.modulation_utils.type_1_demods() - - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='gmsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("-v","--verbose", action="store_true", default=False) - expert_grp.add_option("-c", "--carrier-threshold", type="eng_float", default=30, - help="set carrier detect threshold (dB) [default=%default]") - expert_grp.add_option("","--tun-device-filename", default="/dev/net/tun", - help="path to tun device file [default=%default]") - - transmit_path.add_options(parser, expert_grp) - receive_path.add_options(parser, expert_grp) - uhd_receiver.add_options(parser) - uhd_transmitter.add_options(parser) - - for mod in mods.values(): - mod.add_options(expert_grp) - - for demod in demods.values(): - demod.add_options(expert_grp) - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - # open the TUN/TAP interface - (tun_fd, tun_ifname) = open_tun_interface(options.tun_device_filename) - - # Attempt to enable realtime scheduling - r = gr.enable_realtime_scheduling() - if r == gr.RT_OK: - realtime = True - else: - realtime = False - print "Note: failed to enable realtime scheduling" - - # instantiate the MAC - mac = cs_mac(tun_fd, verbose=True) - - # build the graph (PHY) - tb = my_top_block(mods[options.modulation], - demods[options.modulation], - mac.phy_rx_callback, - options) - - mac.set_top_block(tb) # give the MAC a handle for the PHY - - if tb.txpath.bitrate() != tb.rxpath.bitrate(): - print "WARNING: Transmit bitrate = %sb/sec, Receive bitrate = %sb/sec" % ( - eng_notation.num_to_str(tb.txpath.bitrate()), - eng_notation.num_to_str(tb.rxpath.bitrate())) - - print "modulation: %s" % (options.modulation,) - print "freq: %s" % (eng_notation.num_to_str(options.tx_freq)) - print "bitrate: %sb/sec" % (eng_notation.num_to_str(tb.txpath.bitrate()),) - print "samples/symbol: %3d" % (tb.txpath.samples_per_symbol(),) - - tb.rxpath.set_carrier_threshold(options.carrier_threshold) - print "Carrier sense threshold:", options.carrier_threshold, "dB" - - print - print "Allocated virtual ethernet interface: %s" % (tun_ifname,) - print "You must now use ifconfig to set its IP address. E.g.," - print - print " $ sudo ifconfig %s 192.168.200.1" % (tun_ifname,) - print - print "Be sure to use a different address in the same subnet for each machine." - print - - - tb.start() # Start executing the flow graph (runs in separate threads) - - mac.main_loop() # don't expect this to return... - - tb.stop() # but if it does, tell flow graph to stop. - tb.wait() # wait for it to finish - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/tx_voice.py b/gr-digital/examples/narrowband/tx_voice.py deleted file mode 100755 index 3d767a077..000000000 --- a/gr-digital/examples/narrowband/tx_voice.py +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2009,2011 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. -# - -from gnuradio import gr, blks2, audio, uhd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -from gnuradio import digital -from gnuradio import vocoder - -import random -import time -import struct -import sys - -# from current dir -from transmit_path import transmit_path -from uhd_interface import uhd_transmitter - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - - -class audio_rx(gr.hier_block2): - def __init__(self, audio_input_dev): - gr.hier_block2.__init__(self, "audio_rx", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - self.sample_rate = sample_rate = 8000 - src = audio.source(sample_rate, audio_input_dev) - src_scale = gr.multiply_const_ff(32767) - f2s = gr.float_to_short() - voice_coder = vocoder.gsm_fr_encode_sp() - self.packets_from_encoder = gr.msg_queue() - packet_sink = gr.message_sink(33, self.packets_from_encoder, False) - self.connect(src, src_scale, f2s, voice_coder, packet_sink) - - def get_encoded_voice_packet(self): - return self.packets_from_encoder.delete_head() - - -class my_top_block(gr.top_block): - - def __init__(self, modulator_class, options): - gr.top_block.__init__(self) - self.txpath = transmit_path(modulator_class, options) - self.audio_rx = audio_rx(options.audio_input) - - if(options.tx_freq is not None): - self.sink = uhd_transmitter(options.address, options.bitrate, - options.samples_per_symbol, - options.tx_freq, options.tx_gain, - options.antenna, options.verbose) - options.samples_per_symbol = self.sink._sps - audio_rate = self.audio_rx.sample_rate - usrp_rate = self.sink.get_sample_rate() - rrate = usrp_rate / audio_rate - - elif(options.to_file is not None): - self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) - rrate = 1 - else: - self.sink = gr.null_sink(gr.sizeof_gr_complex) - rrate = 1 - - self.resampler = blks2.pfb_arb_resampler_ccf(rrate) - - self.connect(self.audio_rx) - self.connect(self.txpath, self.resampler, self.sink) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - def send_pkt(payload='', eof=False): - return tb.txpath.send_pkt(payload, eof) - - def rx_callback(ok, payload): - print "ok = %r, payload = '%s'" % (ok, payload) - - mods = digital.modulation_utils.type_1_mods() - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='gmsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - parser.add_option("-M", "--megabytes", type="eng_float", default=0, - help="set megabytes to transmit [default=inf]") - parser.add_option("-I", "--audio-input", type="string", default="", - help="pcm input device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("","--to-file", default=None, - help="Output file for modulated samples") - - transmit_path.add_options(parser, expert_grp) - uhd_transmitter.add_options(parser) - - for mod in mods.values(): - mod.add_options(expert_grp) - - parser.set_defaults(bitrate=50e3) # override default bitrate default - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.to_file is None: - if options.tx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - # build the graph - tb = my_top_block(mods[options.modulation], options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - - tb.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - - while nbytes == 0 or n < nbytes: - packet = tb.audio_rx.get_encoded_voice_packet() - s = packet.to_string() - send_pkt(s) - n += len(s) - sys.stderr.write('.') - pktno += 1 - - send_pkt(eof=True) - tb.wait() # wait for it to finish - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/uhd_interface.py b/gr-digital/examples/narrowband/uhd_interface.py deleted file mode 100644 index fe022c731..000000000 --- a/gr-digital/examples/narrowband/uhd_interface.py +++ /dev/null @@ -1,225 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 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. -# - -from gnuradio import gr, uhd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import sys - -def add_freq_option(parser): - """ - Hackery that has the -f / --freq option set both tx_freq and rx_freq - """ - def freq_callback(option, opt_str, value, parser): - parser.values.rx_freq = value - parser.values.tx_freq = value - - if not parser.has_option('--freq'): - parser.add_option('-f', '--freq', type="eng_float", - action="callback", callback=freq_callback, - help="set Tx and/or Rx frequency to FREQ [default=%default]", - metavar="FREQ") - -class uhd_interface: - def __init__(self, istx, args, sym_rate, sps, freq=None, - gain=None, spec=None, antenna=None): - - if(istx): - self.u = uhd.usrp_sink(device_addr=args, stream_args=uhd.stream_args('fc32')) - else: - self.u = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(spec): - self.u.set_subdev_spec(spec, 0) - - # Set the antenna - if(antenna): - self.u.set_antenna(antenna, 0) - - self._args = args - self._ant = antenna - self._spec = spec - self._gain = self.set_gain(gain) - self._freq = self.set_freq(freq) - - self._rate, self._sps = self.set_sample_rate(sym_rate, sps) - - def set_sample_rate(self, sym_rate, req_sps): - start_sps = req_sps - while(True): - asked_samp_rate = sym_rate * req_sps - self.u.set_samp_rate(asked_samp_rate) - actual_samp_rate = self.u.get_samp_rate() - - sps = actual_samp_rate/sym_rate - if(sps < 2): - req_sps +=1 - else: - actual_sps = sps - break - - if(sps != req_sps): - print "\nSymbol Rate: %f" % (sym_rate) - print "Requested sps: %f" % (start_sps) - print "Given sample rate: %f" % (actual_samp_rate) - print "Actual sps for rate: %f" % (actual_sps) - - if(actual_samp_rate != asked_samp_rate): - print "\nRequested sample rate: %f" % (asked_samp_rate) - print "Actual sample rate: %f" % (actual_samp_rate) - - return (actual_samp_rate, actual_sps) - - def get_sample_rate(self): - return self.u.get_samp_rate() - - def set_gain(self, gain=None): - if gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - gain = float(g.start()+g.stop())/2 - print "\nNo gain specified." - print "Setting gain to %f (from [%f, %f])" % \ - (gain, g.start(), g.stop()) - - self.u.set_gain(gain, 0) - return gain - - def set_freq(self, freq=None): - if(freq is None): - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - sys.exit(1) - - r = self.u.set_center_freq(freq, 0) - if r: - return freq - else: - frange = self.u.get_freq_range() - sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \ - (freq, frange.start(), frange.stop())) - sys.exit(1) - -#-------------------------------------------------------------------# -# TRANSMITTER -#-------------------------------------------------------------------# - -class uhd_transmitter(uhd_interface, gr.hier_block2): - def __init__(self, args, sym_rate, sps, freq=None, gain=None, - spec=None, antenna=None, verbose=False): - gr.hier_block2.__init__(self, "uhd_transmitter", - gr.io_signature(1,1,gr.sizeof_gr_complex), - gr.io_signature(0,0,0)) - - # Set up the UHD interface as a transmitter - uhd_interface.__init__(self, True, args, sym_rate, sps, - freq, gain, spec, antenna) - - self.connect(self, self.u) - - if(verbose): - self._print_verbage() - - def add_options(parser): - add_freq_option(parser) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--tx-freq", type="eng_float", default=None, - help="set transmit frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("", "--tx-gain", type="eng_float", default=None, - help="set transmit gain in dB (default is midpoint)") - parser.add_option("-v", "--verbose", action="store_true", default=False) - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the UHD transmitter - """ - print "\nUHD Transmitter:" - print "Args: %s" % (self._args) - print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) - print "Gain: %f dB" % (self._gain) - print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)) - print "Antenna: %s" % (self._ant) - print "Subdev Sec: %s" % (self._spec) - - -#-------------------------------------------------------------------# -# RECEIVER -#-------------------------------------------------------------------# - - -class uhd_receiver(uhd_interface, gr.hier_block2): - def __init__(self, args, sym_rate, sps, freq=None, gain=None, - spec=None, antenna=None, verbose=False): - gr.hier_block2.__init__(self, "uhd_receiver", - gr.io_signature(0,0,0), - gr.io_signature(1,1,gr.sizeof_gr_complex)) - - # Set up the UHD interface as a receiver - uhd_interface.__init__(self, False, args, sym_rate, sps, - freq, gain, spec, antenna) - - self.connect(self.u, self) - - if(verbose): - self._print_verbage() - - def add_options(parser): - add_freq_option(parser) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--rx-freq", type="eng_float", default=None, - help="set receive frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("", "--rx-gain", type="eng_float", default=None, - help="set receive gain in dB (default is midpoint)") - if not parser.has_option("--verbose"): - parser.add_option("-v", "--verbose", action="store_true", default=False) - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the UHD transmitter - """ - print "\nUHD Receiver:" - print "UHD Args: %s" % (self._args) - print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) - print "Gain: %f dB" % (self._gain) - print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)) - print "Antenna: %s" % (self._ant) - print "Spec: %s" % (self._spec) diff --git a/gr-digital/examples/ofdm/benchmark_add_channel.py b/gr-digital/examples/ofdm/benchmark_add_channel.py deleted file mode 100755 index cbdd990f4..000000000 --- a/gr-digital/examples/ofdm/benchmark_add_channel.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 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. -# - -from gnuradio import gr -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random, math, sys - -class my_top_block(gr.top_block): - def __init__(self, ifile, ofile, options): - gr.top_block.__init__(self) - - SNR = 10.0**(options.snr/10.0) - time_offset = options.time_offset - phase_offset = options.phase_offset*(math.pi/180.0) - - # calculate noise voltage from SNR - power_in_signal = abs(options.tx_amplitude)**2 - noise_power = power_in_signal/SNR - noise_voltage = math.sqrt(noise_power) - print "Noise voltage: ", noise_voltage - - frequency_offset = options.frequency_offset / options.fft_length - - self.src = gr.file_source(gr.sizeof_gr_complex, ifile) - #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate) - self.channel = gr.channel_model(noise_voltage, frequency_offset, - time_offset, noise_seed=-random.randint(0,100000)) - self.phase = gr.multiply_const_cc(complex(math.cos(phase_offset), - math.sin(phase_offset))) - self.snk = gr.file_sink(gr.sizeof_gr_complex, ofile) - - self.connect(self.src, self.channel, self.phase, self.snk) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - # Create Options Parser: - usage = "benchmack_add_channel.py [options] <input file> <output file>" - parser = OptionParser (usage=usage, option_class=eng_option, conflict_handler="resolve") - parser.add_option("-n", "--snr", type="eng_float", default=30, - help="set the SNR of the channel in dB [default=%default]") - parser.add_option("", "--seed", action="store_true", default=False, - help="use a random seed for AWGN noise [default=%default]") - parser.add_option("-f", "--frequency-offset", type="eng_float", default=0, - help="set frequency offset introduced by channel [default=%default]") - parser.add_option("-t", "--time-offset", type="eng_float", default=1.0, - help="set timing offset between Tx and Rx [default=%default]") - parser.add_option("-p", "--phase-offset", type="eng_float", default=0, - help="set phase offset (in degrees) between Tx and Rx [default=%default]") - parser.add_option("-m", "--use-multipath", action="store_true", default=False, - help="Use a multipath channel [default=%default]") - parser.add_option("", "--fft-length", type="intx", default=None, - help="set the number of FFT bins [default=%default]") - parser.add_option("", "--tx-amplitude", type="eng_float", - default=1.0, - help="tell the simulator the signal amplitude [default=%default]") - - (options, args) = parser.parse_args () - - if len(args) != 2: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.fft_length is None: - sys.stderr.write("Please enter the FFT length of the OFDM signal.\n") - sys.exit(1) - - ifile = args[0] - ofile = args[1] - - # build the graph - tb = my_top_block(ifile, ofile, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.start() # start flow graph - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/ofdm/benchmark_rx.py b/gr-digital/examples/ofdm/benchmark_rx.py deleted file mode 100755 index 57817c501..000000000 --- a/gr-digital/examples/ofdm/benchmark_rx.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2011 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. -# - -from gnuradio import gr, blks2 -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -from gnuradio import digital - -# from current dir -from receive_path import receive_path -from uhd_interface import uhd_receiver - -import struct, sys - -class my_top_block(gr.top_block): - def __init__(self, callback, options): - gr.top_block.__init__(self) - - if(options.rx_freq is not None): - self.source = uhd_receiver(options.args, - options.bandwidth, - options.rx_freq, options.rx_gain, - options.spec, options.antenna, - options.verbose) - elif(options.from_file is not None): - self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file) - else: - self.source = gr.null_source(gr.sizeof_gr_complex) - - # Set up receive path - # do this after for any adjustments to the options that may - # occur in the sinks (specifically the UHD sink) - self.rxpath = receive_path(callback, options) - - self.connect(self.source, self.rxpath) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right - n_rcvd += 1 - (pktno,) = struct.unpack('!H', payload[0:2]) - if ok: - n_right += 1 - print "ok: %r \t pktno: %d \t n_rcvd: %d \t n_right: %d" % (ok, pktno, n_rcvd, n_right) - - if 0: - printlst = list() - for x in payload[2:]: - t = hex(ord(x)).replace('0x', '') - if(len(t) == 1): - t = '0' + t - printlst.append(t) - printable = ''.join(printlst) - - print printable - print "\n" - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinuous") - parser.add_option("","--from-file", default=None, - help="input file of samples to demod") - - receive_path.add_options(parser, expert_grp) - uhd_receiver.add_options(parser) - digital.ofdm_demod.add_options(parser, expert_grp) - - (options, args) = parser.parse_args () - - if options.from_file is None: - if options.rx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - # build the graph - tb = my_top_block(rx_callback, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - tb.start() # start flow graph - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/ofdm/benchmark_tx.py b/gr-digital/examples/ofdm/benchmark_tx.py deleted file mode 100755 index 5962fe7ec..000000000 --- a/gr-digital/examples/ofdm/benchmark_tx.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2011 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. -# - -from gnuradio import gr -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import time, struct, sys - -from gnuradio import digital - -# from current dir -from transmit_path import transmit_path -from uhd_interface import uhd_transmitter - -class my_top_block(gr.top_block): - def __init__(self, options): - gr.top_block.__init__(self) - - if(options.tx_freq is not None): - self.sink = uhd_transmitter(options.args, - options.bandwidth, - options.tx_freq, options.tx_gain, - options.spec, options.antenna, - options.verbose) - elif(options.to_file is not None): - self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) - else: - self.sink = gr.null_sink(gr.sizeof_gr_complex) - - # do this after for any adjustments to the options that may - # occur in the sinks (specifically the UHD sink) - self.txpath = transmit_path(options) - - self.connect(self.txpath, self.sink) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - def send_pkt(payload='', eof=False): - return tb.txpath.send_pkt(payload, eof) - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - parser.add_option("-s", "--size", type="eng_float", default=400, - help="set packet size [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinuous mode") - parser.add_option("","--from-file", default=None, - help="use intput file for packet contents") - parser.add_option("","--to-file", default=None, - help="Output file for modulated samples") - - transmit_path.add_options(parser, expert_grp) - digital.ofdm_mod.add_options(parser, expert_grp) - uhd_transmitter.add_options(parser) - - (options, args) = parser.parse_args () - - # build the graph - tb = my_top_block(options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - tb.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - pkt_size = int(options.size) - - while n < nbytes: - if options.from_file is None: - data = (pkt_size - 2) * chr(pktno & 0xff) - else: - data = source_file.read(pkt_size - 2) - if data == '': - break; - - payload = struct.pack('!H', pktno & 0xffff) + data - send_pkt(payload) - n += len(payload) - sys.stderr.write('.') - if options.discontinuous and pktno % 5 == 4: - time.sleep(1) - pktno += 1 - - send_pkt(eof=True) - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/ofdm/gr_plot_ofdm.py b/gr-digital/examples/ofdm/gr_plot_ofdm.py deleted file mode 100755 index b24855148..000000000 --- a/gr-digital/examples/ofdm/gr_plot_ofdm.py +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007 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. -# - -import math, struct, sys -from optparse import OptionParser -from math import log10 - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - from pylab import * - from matplotlib.font_manager import fontManager, FontProperties -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -matplotlib.interactive(True) -matplotlib.use('TkAgg') - -class draw_constellation: - def __init__(self, options): - derot_file = "ofdm_frame_sink_c.dat" - acq_file = "ofdm_frame_acq_c.dat" - fft_file = "ofdm_receiver-fft_out_c.dat" - - self.h_derot_file = open(derot_file, "r") - self.h_acq_file = open(acq_file, "r") - self.h_fft_file = open(fft_file, "r") - - self.occ_tones = options.occ_tones - self.fft_size = options.fft_size - self.symbol = options.start - self.sample_rate = options.sample_rate - - self.axis_font_size = 16 - self.label_font_size = 18 - self.title_font_size = 20 - self.text_size = 22 - - # Setup PLOT - self.fig = figure(1, figsize=(14, 9), facecolor='w') - rcParams['xtick.labelsize'] = self.axis_font_size - rcParams['ytick.labelsize'] = self.axis_font_size - - self.text_sym = figtext(0.05, 0.95, ("Symbol: %s" % self.symbol), weight="heavy", size=self.text_size) - - self.make_plots() - - self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True) - self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) - - self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True) - self.button_right = Button(self.button_right_axes, ">") - self.button_right_callback = self.button_right.on_clicked(self.button_right_click) - - self.xlim = self.sp_eq.get_xlim() - - self.manager = get_current_fig_manager() - #connect('draw_event', self.zoom) - connect('key_press_event', self.click) - show() - - def get_data(self): - self.text_sym.set_text("Symbol: %d" % (self.symbol)) - - derot_data = scipy.fromfile(self.h_derot_file, dtype=scipy.complex64, count=self.occ_tones) - acq_data = scipy.fromfile(self.h_acq_file, dtype=scipy.complex64, count=self.occ_tones) - fft_data = scipy.fromfile(self.h_fft_file, dtype=scipy.complex64, count=self.fft_size) - if(len(acq_data) == 0): - print "End of File" - else: - self.acq_data_reals = [r.real for r in acq_data] - self.acq_data_imags = [i.imag for i in acq_data] - self.derot_data_reals = [r.real for r in derot_data] - self.derot_data_imags = [i.imag for i in derot_data] - - self.unequalized_angle = [math.atan2(x.imag, x.real) for x in fft_data] - self.equalized_angle = [math.atan2(x.imag, x.real) for x in acq_data] - self.derot_equalized_angle = [math.atan2(x.imag, x.real) for x in derot_data] - - self.time = [i*(1/self.sample_rate) for i in range(len(acq_data))] - ffttime = [i*(1/self.sample_rate) for i in range(len(fft_data))] - - self.freq = self.get_freq(ffttime, self.sample_rate) - - for i in range(len(fft_data)): - if(abs(fft_data[i]) == 0.0): - fft_data[i] = complex(1e-6,1e-6) - self.fft_data = [20*log10(abs(f)) for f in fft_data] - - def get_freq(self, time, sample_rate, T=1): - N = len(time) - Fs = 1.0 / (max(time) - min(time)) - Fn = 0.5 * sample_rate - freq = [-Fn + i*Fs for i in range(N)] - return freq - - def make_plots(self): - self.h_acq_file.seek(8*self.symbol*self.occ_tones, 0) - self.h_fft_file.seek(8*self.symbol*self.fft_size, 0) - self.h_derot_file.seek(8*self.symbol*self.occ_tones, 0) - - self.get_data() - - # Subplot: constellation of rotated symbols - self.sp_const = self.fig.add_subplot(4,1,1, position=[0.15, 0.55, 0.3, 0.35]) - self.sp_const.set_title(("Constellation"), fontsize=self.title_font_size, fontweight="bold") - self.sp_const.set_xlabel("Inphase", fontsize=self.label_font_size, fontweight="bold") - self.sp_const.set_ylabel("Qaudrature", fontsize=self.label_font_size, fontweight="bold") - self.plot_const = plot(self.acq_data_reals, self.acq_data_imags, 'bo') - self.plot_const += plot(self.derot_data_reals, self.derot_data_imags, 'ro') - self.sp_const.axis([-2, 2, -2, 2]) - - # Subplot: unequalized angle - self.sp_uneq = self.fig.add_subplot(4,2,1, position=[0.575, 0.55, 0.3, 0.35]) - self.sp_uneq.set_title(("Unequalized Angle"), fontsize=self.title_font_size, fontweight="bold") - self.sp_uneq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_uneq.set_ylabel("Angle", fontsize=self.label_font_size, fontweight="bold") - uneqscale = range(len(self.unequalized_angle)) - self.plot_uneq = plot(uneqscale, self.unequalized_angle, 'bo') - - # Subplot: equalized angle - self.sp_eq = self.fig.add_subplot(4,1,2, position=[0.15, 0.1, 0.3, 0.35]) - self.sp_eq.set_title(("Equalized Angle"), fontsize=self.title_font_size, fontweight="bold") - self.sp_eq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_eq.set_ylabel("Angle", fontsize=self.label_font_size, fontweight="bold") - eqscale = range(len(self.equalized_angle)) - self.plot_eq = plot(eqscale, self.equalized_angle, 'bo') - self.plot_eq += plot(eqscale, self.derot_equalized_angle, 'ro', markersize=4) - - # Subplot: FFT - self.sp_fft = self.fig.add_subplot(4,2,2, position=[0.575, 0.1, 0.3, 0.35]) - self.sp_fft.set_title(("FFT"), fontsize=self.title_font_size, fontweight="bold") - self.sp_fft.set_xlabel("Frequency (MHz)", fontsize=self.label_font_size, fontweight="bold") - self.sp_fft.set_ylabel("Power (dBm)", fontsize=self.label_font_size, fontweight="bold") - self.plot_fft = plot(self.freq, self.fft_data, '-bo') - - draw() - - def update_plots(self): - eqscale = range(len(self.equalized_angle)) - uneqscale = range(len(self.unequalized_angle)) - self.plot_eq[0].set_data([eqscale, self.equalized_angle]) - self.plot_eq[1].set_data([eqscale, self.derot_equalized_angle]) - self.plot_uneq[0].set_data([uneqscale, self.unequalized_angle]) - self.sp_eq.set_ylim([-4, 4]) - self.sp_uneq.set_ylim([-4, 4]) - - #self.sp_iq.axis([min(self.time), max(self.time), - # 1.5*min([min(self.acq_data_reals), min(self.acq_data_imags)]), - # 1.5*max([max(self.acq_data_reals), max(self.acq_data_imags)])]) - - self.plot_const[0].set_data([self.acq_data_reals, self.acq_data_imags]) - self.plot_const[1].set_data([self.derot_data_reals, self.derot_data_imags]) - self.sp_const.axis([-2, 2, -2, 2]) - - self.plot_fft[0].set_data([self.freq, self.fft_data]) - - draw() - - def zoom(self, event): - newxlim = self.sp_eq.get_xlim() - if(newxlim != self.xlim): - self.xlim = newxlim - r = self.reals[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))] - i = self.imags[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))] - - self.plot_const[0].set_data(r, i) - self.sp_const.axis([-2, 2, -2, 2]) - self.manager.canvas.draw() - draw() - - def click(self, event): - forward_valid_keys = [" ", "down", "right"] - backward_valid_keys = ["up", "left"] - - if(find(event.key, forward_valid_keys)): - self.step_forward() - - elif(find(event.key, backward_valid_keys)): - self.step_backward() - - def button_left_click(self, event): - self.step_backward() - - def button_right_click(self, event): - self.step_forward() - - def step_forward(self): - self.symbol += 1 - self.get_data() - self.update_plots() - - def step_backward(self): - # Step back in file position - self.symbol -= 1 - if(self.h_acq_file.tell() >= 16*self.occ_tones): - self.h_acq_file.seek(-16*self.occ_tones, 1) - else: - self.symbol = 0 - self.h_acq_file.seek(-self.h_acq_file.tell(),1) - - - if(self.h_derot_file.tell() >= 16*self.occ_tones): - self.h_derot_file.seek(-16*self.occ_tones, 1) - else: - self.symbol = 0 - self.h_derot_file.seek(-self.h_derot_file.tell(),1) - - - if(self.h_fft_file.tell() >= 16*self.fft_size): - self.h_fft_file.seek(-16*self.fft_size, 1) - else: - self.symbol = 0 - self.h_fft_file.seek(-self.h_fft_file.tell(),1) - - self.get_data() - self.update_plots() - - - -#FIXME: there must be a way to do this with a Python builtin -def find(item_in, list_search): - for l in list_search: - if item_in == l: - return True - return False - -def main(): - usage="%prog: [options]" - - parser = OptionParser(conflict_handler="resolve", usage=usage) - parser.add_option("", "--fft-size", type="int", default=512, - help="Specify the size of the FFT [default=%default]") - parser.add_option("", "--occ-tones", type="int", default=200, - help="Specify the number of occupied tones [default=%default]") - parser.add_option("-s", "--start", type="int", default=0, - help="Specify the starting symbol to plot [default=%default]") - parser.add_option("-R", "--sample-rate", type="float", default=1.0, - help="Set the sampler rate of the data [default=%default]") - - (options, args) = parser.parse_args () - - dc = draw_constellation(options) - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - - - diff --git a/gr-digital/examples/ofdm/ofdm_mod_demod_test.py b/gr-digital/examples/ofdm/ofdm_mod_demod_test.py deleted file mode 100755 index b1521da6d..000000000 --- a/gr-digital/examples/ofdm/ofdm_mod_demod_test.py +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2008 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. -# - -from gnuradio import gr, ofdm_packet_utils -import gnuradio.gr.gr_threading as _threading -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random, time, struct, sys, math, os - -class my_top_block(gr.top_block): - def __init__(self, callback, options): - gr.top_block.__init__(self) - - # hard-coded known symbol - ks1 = known_symbols_4512_1[0:options.occupied_tones] - ks2 = known_symbols_4512_2[0:options.occupied_tones] - - self._rcvd_pktq = gr.msg_queue() - - # accepts messages from the outside world - self.ofdm_mapper = gr.ofdm_bpsk_mapper(4, options.occupied_tones, options.fft_length, ks1, ks2) - self.ofdm_corr = gr.ofdm_correlator(options.occupied_tones, options.fft_length, 0, ks1, ks2) - self.ofdm_framer = gr.ofdm_frame_sink(self._rcvd_pktq, options.occupied_tones) - - if 0: # set to 1 to put the correlator in the path to take over the signalling - self.connect((self.ofdm_mapper, 0), (self.ofdm_corr, 0)) - self.connect((self.ofdm_corr, 0), (self.ofdm_framer, 0)) - self.connect((self.ofdm_corr, 1), (self.ofdm_framer, 1)) - - self.connect((self.ofdm_mapper,0), gr.file_sink(gr.sizeof_gr_complex*options.fft_length, "ofdm_mapper.dat")) - self.connect((self.ofdm_corr,0), gr.file_sink(gr.sizeof_gr_complex*options.occupied_tones, "ofdm_corr.dat")) - self.connect((self.ofdm_corr,1), gr.file_sink(gr.sizeof_char, "ofdm_sig.dat")) - - else: - self.connect((self.ofdm_mapper, 0), (self.ofdm_framer, 0)) - self.connect((self.ofdm_mapper, 1), (self.ofdm_framer, 1)) - - self.connect((self.ofdm_mapper,0), gr.file_sink(gr.sizeof_gr_complex*options.fft_length, "ofdm_mapper.dat")) - self.connect((self.ofdm_mapper,1), gr.file_sink(gr.sizeof_char, "ofdm_sig.dat")) - - self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback) - - def send_pkt(self, payload='', eof=False): - if eof: - msg = gr.message(1) - else: - pkt = ofdm_packet_utils.make_packet(payload, 1, 1, False, whiten=False) - msg = gr.message_from_string(pkt) - self.ofdm_mapper.msgq().insert_tail(msg) - -class _queue_watcher_thread(_threading.Thread): - def __init__(self, rcvd_pktq, callback): - _threading.Thread.__init__(self) - self.setDaemon(1) - self.rcvd_pktq = rcvd_pktq - self.callback = callback - self.keep_running = True - self.start() - - def run(self): - while self.keep_running: - msg = self.rcvd_pktq.delete_head() - ok, payload = ofdm_packet_utils.unmake_packet(msg.to_string(), whiten=False) - if self.callback: - self.callback(ok, payload) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - ''' Use this program to tie the OFDM modulators straight into the frame sink, with or without - the correlator in between. This is for testing of the modulators and demodulators only without - receiver and sync functionality.''' - - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def send_pkt(payload='', eof=False): - return fg.send_pkt(payload, eof) - - def rx_callback(ok, payload): - global n_rcvd, n_right - n_rcvd += 1 - (pktno,) = struct.unpack('!H', payload[0:2]) - if ok: - n_right += 1 - print "ok: %r \t pktno: %d \t n_rcvd: %d \t n_right: %d" % (ok, pktno, n_rcvd, n_right) - - printlst = list() - for x in payload[2:]: - t = hex(ord(x)).replace('0x', '') - if(len(t) == 1): - t = '0' + t - printlst.append(t) - printable = ''.join(printlst) - - print printable - print "\n" - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert = parser.add_option_group("Expert") - parser.add_option("-s", "--size", type="eng_float", default=1450, - help="set packet size [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - expert.add_option("", "--fft-length", type="intx", default=512, - help="set the number of FFT bins [default=%default]") - expert.add_option("", "--occupied-tones", type="intx", default=200, - help="set the number of occupied FFT bins [default=%default]") - expert.add_option("", "--cp-length", type="intx", default=128, - help="set the number of bits in the cyclic prefix [default=%default]") - expert.add_option("", "--fft-length", type="intx", default=512, - help="set the number of FFT bins [default=%default]") - expert.add_option("", "--occupied-tones", type="intx", default=200, - help="set the number of occupied FFT bins [default=%default]") - expert.add_option("", "--cp-length", type="intx", default=128, - help="set the number of bits in the cyclic prefix [default=%default]") - - (options, args) = parser.parse_args () - - # build the graph - tb = my_top_block(rx_callback, options) - - tb.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - pkt_size = int(options.size) - - while n < nbytes: - #r = ''.join([chr(random.randint(0,255)) for i in range(pkt_size-2)]) - #pkt_contents = struct.pack('!H', pktno) + r - - pkt_contents = struct.pack('!H', pktno) + (pkt_size - 2) * chr(pktno & 0xff) - - send_pkt(pkt_contents) - n += pkt_size - pktno += 1 - - send_pkt(eof=True) - tb.wait() # wait for it to finish - -known_symbols_4512_1 = [-1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1] - -known_symbols_4512_2 = [1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1] - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gr-digital/examples/ofdm/ofdm_sync.m b/gr-digital/examples/ofdm/ofdm_sync.m deleted file mode 100644 index d5df42137..000000000 --- a/gr-digital/examples/ofdm/ofdm_sync.m +++ /dev/null @@ -1,28 +0,0 @@ -% - -function [theta, g, g1, k, h] = ofdm_sync(signal,SNR,FFTSIZE,CPLEN) - - rho = SNR/(SNR+1); - - d = abs(signal).^2; - g = [ zeros(1,FFTSIZE) signal(1:max(size(signal))-FFTSIZE) ]; - g1 = conj(g); - f = abs(g).^2; - c = d + f; - moving_sum_taps = rho/2 * ones(1,CPLEN); - b = conv(c,moving_sum_taps); - b = b(1:max(size(signal))); - %b = b(CPLEN:max(size(b))); - - k = g1 .* signal; - - moving_sum_taps2 = ones(1, CPLEN); - h = conv(k,moving_sum_taps2); - h = h(1:max(size(signal))); - %h = h(CPLEN:max(size(h))); - - a = abs(h); - - theta = a-b; - -endfunction diff --git a/gr-digital/examples/ofdm/ofdm_sync_pn.m b/gr-digital/examples/ofdm/ofdm_sync_pn.m deleted file mode 100644 index d93c0ca92..000000000 --- a/gr-digital/examples/ofdm/ofdm_sync_pn.m +++ /dev/null @@ -1,21 +0,0 @@ -mf = read_float_binary('ofdm_sync_pn-mf_f.dat'); -theta_pn = read_float_binary('ofdm_sync_pn-theta_f.dat'); -peaks_pn = read_char_binary('ofdm_sync_pn-peaks_b.dat'); -regen_pn = read_char_binary('ofdm_sync_pn-regen_b.dat'); -angle_pn = read_float_binary('ofdm_sync_pn-epsilon_f.dat'); - -plot(mf, 'k') -hold -plot(theta_pn, 'g'); -plot(peaks_pn, 'r'); -plot(regen_pn, 'b'); -xlim([100, 50000]); -ylim([0, 1]) -i = find(peaks_pn); -i(100:200) -hold off - -ipeaks = find(peaks_pn); -dpeaks = diff(ipeaks); -hist(dpeaks, 30) -set(gca, 'FontSize', 30, 'FontWeight', 'Bold'); diff --git a/gr-digital/examples/ofdm/plot_ofdm.m b/gr-digital/examples/ofdm/plot_ofdm.m deleted file mode 100755 index 2a649b5f5..000000000 --- a/gr-digital/examples/ofdm/plot_ofdm.m +++ /dev/null @@ -1,74 +0,0 @@ -function plot_ofdm(fft_size, occ_tones) - -ofdm = read_complex_binary('ofdm_frame_acq_c.dat'); -ofdm_split = split_vect(ofdm, occ_tones); - -ofdm_derot = read_complex_binary('ofdm_frame_sink_c.dat'); -ofdm_derot_split = split_vect(ofdm_derot, occ_tones); - -fftc = read_complex_binary('fft_out_c.dat'); -fftc_split = split_vect(fftc, fft_size); - -size(ofdm_split) -size(ofdm_derot_split) -disp "DEROTATED SPLIT" -ofdm_derot(1:100) - - -figure(1) -#set(gcf, 'Position', [50 50 1000 600]); - -a = size(ofdm_split); -if nargin == 3 - maxcount = count; - if maxcount > a(1) - error('plot_ofdm:tolong', 'Requested count size exceeds size of vectors'); - end -else - maxcount = a(1); -end - -for i = 1:size(ofdm_split)[0] - x = ofdm_split(i,:); - y = fftc_split(i+1,:); - - subplot(2,2,1); - plot(real(x), imag(x), 'bo'); - #set(gca, 'FontSize', 30, 'FontWeight', 'Bold'); - axis([-1.5, 1.5, -1.5, 1.5]) - #title('I&Q Constellation', 'FontSize', 36); - #xlabel('Inphase', 'FontSize', 32); - #ylabel('Quadrature', 'FontSize', 32); - - subplot(2,2,3); - plot(angle(x*j), 'bo'); - #set(gca, 'FontSize', 30, 'FontWeight', 'Bold'); - axis([0, occ_tones, -3.5, 3.5]) - #title('Equalized Symbol Angle', 'FontSize', 36); - #xlabel('Bin Number (Occ. Tones)', 'FontSize', 32); - #ylabel('Symbol Angle', 'FontSize', 32); - - subplot(2,2,2); - plot(angle(y*j), 'bo'); - #set(gca, 'FontSize', 30, 'FontWeight', 'Bold'); - axis([0, fft_size, -3.5, 3.5]) - #title('Unequalized Symbol Angle', 'FontSize', 36); - #xlabel('Bin Number (FFT Size)', 'FontSize', 32); - #ylabel('Symbol Angle', 'FontSize', 32); - - Y = 20*log10(abs(y) ./ max(abs(y))); - subplot(2,2,4); - plot(Y, 'b-'); - #set(gca, 'FontSize', 30, 'FontWeight', 'Bold'); - axis([0, fft_size, -50, 1]); - #title('Frequency Domain of Unequalized Rx', 'FontSize', 36); - #xlabel('Bin Number (FFT Size)', 'FontSize', 32); - #ylabel('Power (dB)', 'FontSize', 32); - - #N = 20*log10(var(abs(x)-1)); - - disp(sprintf('Symbol Number: %d\n', i)) - #disp(sprintf('\tFreq Error: %f\n', anglesh_pn(1+(i-1)*fft_size))) - pause - -end diff --git a/gr-digital/examples/ofdm/receive_path.py b/gr-digital/examples/ofdm/receive_path.py deleted file mode 100644 index e1c7868a0..000000000 --- a/gr-digital/examples/ofdm/receive_path.py +++ /dev/null @@ -1,105 +0,0 @@ -# -# Copyright 2005,2006,2011 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. -# - -from gnuradio import gr -from gnuradio import eng_notation -from gnuradio import digital - -import copy -import sys - -# ///////////////////////////////////////////////////////////////////////////// -# receive path -# ///////////////////////////////////////////////////////////////////////////// - -class receive_path(gr.hier_block2): - def __init__(self, rx_callback, options): - - gr.hier_block2.__init__(self, "receive_path", - gr.io_signature(1, 1, gr.sizeof_gr_complex), - gr.io_signature(0, 0, 0)) - - - options = copy.copy(options) # make a copy so we can destructively modify - - self._verbose = options.verbose - self._log = options.log - self._rx_callback = rx_callback # this callback is fired when there's a packet available - - # receiver - self.ofdm_rx = digital.ofdm_demod(options, - callback=self._rx_callback) - - # Carrier Sensing Blocks - alpha = 0.001 - thresh = 30 # in dB, will have to adjust - self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha) - - self.connect(self, self.ofdm_rx) - self.connect(self.ofdm_rx, self.probe) - - # Display some information about the setup - if self._verbose: - self._print_verbage() - - def carrier_sensed(self): - """ - Return True if we think carrier is present. - """ - #return self.probe.level() > X - return self.probe.unmuted() - - def carrier_threshold(self): - """ - Return current setting in dB. - """ - return self.probe.threshold() - - def set_carrier_threshold(self, threshold_in_db): - """ - Set carrier threshold. - - @param threshold_in_db: set detection threshold - @type threshold_in_db: float (dB) - """ - self.probe.set_threshold(threshold_in_db) - - - def add_options(normal, expert): - """ - Adds receiver-specific options to the Options Parser - """ - normal.add_option("-W", "--bandwidth", type="eng_float", - default=500e3, - help="set symbol bandwidth [default=%default]") - normal.add_option("-v", "--verbose", action="store_true", default=False) - expert.add_option("", "--log", action="store_true", default=False, - help="Log all parts of flow graph to files (CAUTION: lots of data)") - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - - def _print_verbage(self): - """ - Prints information about the receive path - """ - pass diff --git a/gr-digital/examples/ofdm/transmit_path.py b/gr-digital/examples/ofdm/transmit_path.py deleted file mode 100644 index ec357d617..000000000 --- a/gr-digital/examples/ofdm/transmit_path.py +++ /dev/null @@ -1,100 +0,0 @@ -# -# Copyright 2005,2006,2011 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. -# - -from gnuradio import gr -from gnuradio import eng_notation -from gnuradio import digital - -import copy -import sys - -# ///////////////////////////////////////////////////////////////////////////// -# transmit path -# ///////////////////////////////////////////////////////////////////////////// - -class transmit_path(gr.hier_block2): - def __init__(self, options): - ''' - See below for what options should hold - ''' - - gr.hier_block2.__init__(self, "transmit_path", - gr.io_signature(0, 0, 0), - gr.io_signature(1, 1, gr.sizeof_gr_complex)) - - options = copy.copy(options) # make a copy so we can destructively modify - - self._verbose = options.verbose # turn verbose mode on/off - self._tx_amplitude = options.tx_amplitude # digital amp sent to radio - - self.ofdm_tx = digital.ofdm_mod(options, - msgq_limit=4, - pad_for_usrp=False) - - self.amp = gr.multiply_const_cc(1) - self.set_tx_amplitude(self._tx_amplitude) - - # Display some information about the setup - if self._verbose: - self._print_verbage() - - # Create and setup transmit path flow graph - self.connect(self.ofdm_tx, self.amp, self) - - def set_tx_amplitude(self, ampl): - """ - Sets the transmit amplitude sent to the USRP - @param: ampl 0 <= ampl < 1.0. Try 0.10 - """ - self._tx_amplitude = max(0.0, min(ampl, 1)) - self.amp.set_k(self._tx_amplitude) - - def send_pkt(self, payload='', eof=False): - """ - Calls the transmitter method to send a packet - """ - return self.ofdm_tx.send_pkt(payload, eof) - - def add_options(normal, expert): - """ - Adds transmitter-specific options to the Options Parser - """ - normal.add_option("", "--tx-amplitude", type="eng_float", - default=0.1, metavar="AMPL", - help="set transmitter digital amplitude: 0 <= AMPL < 1.0 [default=%default]") - normal.add_option("-W", "--bandwidth", type="eng_float", - default=500e3, - help="set symbol bandwidth [default=%default]") - normal.add_option("-v", "--verbose", action="store_true", - default=False) - expert.add_option("", "--log", action="store_true", - default=False, - help="Log all parts of flow graph to file (CAUTION: lots of data)") - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the transmit path - """ - print "Tx amplitude %s" % (self._tx_amplitude) - diff --git a/gr-digital/examples/ofdm/tunnel.py b/gr-digital/examples/ofdm/tunnel.py deleted file mode 100755 index e253cf516..000000000 --- a/gr-digital/examples/ofdm/tunnel.py +++ /dev/null @@ -1,269 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2011 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 2, 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 code sets up up a virtual ethernet interface (typically gr0), -# and relays packets between the interface and the GNU Radio PHY+MAC -# -# What this means in plain language, is that if you've got a couple -# of USRPs on different machines, and if you run this code on those -# machines, you can talk between them using normal TCP/IP networking. -# -# ///////////////////////////////////////////////////////////////////////////// - - -from gnuradio import gr, digital -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# from current dir -from receive_path import receive_path -from transmit_path import transmit_path -from uhd_interface import uhd_transmitter -from uhd_interface import uhd_receiver - -import os, sys -import random, time, struct - -#print os.getpid() -#raw_input('Attach and press enter') - - -# ///////////////////////////////////////////////////////////////////////////// -# -# Use the Universal TUN/TAP device driver to move packets to/from kernel -# -# See /usr/src/linux/Documentation/networking/tuntap.txt -# -# ///////////////////////////////////////////////////////////////////////////// - -# Linux specific... -# TUNSETIFF ifr flags from <linux/tun_if.h> - -IFF_TUN = 0x0001 # tunnel IP packets -IFF_TAP = 0x0002 # tunnel ethernet frames -IFF_NO_PI = 0x1000 # don't pass extra packet info -IFF_ONE_QUEUE = 0x2000 # beats me ;) - -def open_tun_interface(tun_device_filename): - from fcntl import ioctl - - mode = IFF_TAP | IFF_NO_PI - TUNSETIFF = 0x400454ca - - tun = os.open(tun_device_filename, os.O_RDWR) - ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", mode)) - ifname = ifs[:16].strip("\x00") - return (tun, ifname) - - -# ///////////////////////////////////////////////////////////////////////////// -# the flow graph -# ///////////////////////////////////////////////////////////////////////////// - -class my_top_block(gr.top_block): - def __init__(self, callback, options): - gr.top_block.__init__(self) - - self.source = uhd_receiver(options.args, - options.bandwidth, - options.rx_freq, options.rx_gain, - options.spec, options.antenna, - options.verbose) - - self.sink = uhd_transmitter(options.args, - options.bandwidth, - options.tx_freq, options.tx_gain, - options.spec, options.antenna, - options.verbose) - - self.txpath = transmit_path(options) - self.rxpath = receive_path(callback, options) - - self.connect(self.txpath, self.sink) - self.connect(self.source, self.rxpath) - - def carrier_sensed(self): - """ - Return True if the receive path thinks there's carrier - """ - return self.rxpath.carrier_sensed() - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - """ - self.u_snk.set_freq(target_freq) - self.u_src.set_freq(target_freq) - - -# ///////////////////////////////////////////////////////////////////////////// -# Carrier Sense MAC -# ///////////////////////////////////////////////////////////////////////////// - -class cs_mac(object): - """ - Prototype carrier sense MAC - - Reads packets from the TUN/TAP interface, and sends them to the PHY. - Receives packets from the PHY via phy_rx_callback, and sends them - into the TUN/TAP interface. - - Of course, we're not restricted to getting packets via TUN/TAP, this - is just an example. - """ - def __init__(self, tun_fd, verbose=False): - self.tun_fd = tun_fd # file descriptor for TUN/TAP interface - self.verbose = verbose - self.tb = None # top block (access to PHY) - - def set_flow_graph(self, tb): - self.tb = tb - - def phy_rx_callback(self, ok, payload): - """ - Invoked by thread associated with PHY to pass received packet up. - - @param ok: bool indicating whether payload CRC was OK - @param payload: contents of the packet (string) - """ - if self.verbose: - print "Rx: ok = %r len(payload) = %4d" % (ok, len(payload)) - if ok: - os.write(self.tun_fd, payload) - - def main_loop(self): - """ - Main loop for MAC. - Only returns if we get an error reading from TUN. - - FIXME: may want to check for EINTR and EAGAIN and reissue read - """ - min_delay = 0.001 # seconds - - while 1: - payload = os.read(self.tun_fd, 10*1024) - if not payload: - self.tb.txpath.send_pkt(eof=True) - break - - if self.verbose: - print "Tx: len(payload) = %4d" % (len(payload),) - - delay = min_delay - while self.tb.carrier_sensed(): - sys.stderr.write('B') - time.sleep(delay) - if delay < 0.050: - delay = delay * 2 # exponential back-off - - self.tb.txpath.send_pkt(payload) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=['bpsk', 'qpsk'], - default='bpsk', - help="Select modulation from: bpsk, qpsk [default=%%default]") - - parser.add_option("-v","--verbose", action="store_true", default=False) - expert_grp.add_option("-c", "--carrier-threshold", type="eng_float", default=30, - help="set carrier detect threshold (dB) [default=%default]") - expert_grp.add_option("","--tun-device-filename", default="/dev/net/tun", - help="path to tun device file [default=%default]") - - digital.ofdm_mod.add_options(parser, expert_grp) - digital.ofdm_demod.add_options(parser, expert_grp) - transmit_path.add_options(parser, expert_grp) - receive_path.add_options(parser, expert_grp) - uhd_receiver.add_options(parser) - uhd_transmitter.add_options(parser) - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.rx_freq is None or options.tx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - # open the TUN/TAP interface - (tun_fd, tun_ifname) = open_tun_interface(options.tun_device_filename) - - # Attempt to enable realtime scheduling - r = gr.enable_realtime_scheduling() - if r == gr.RT_OK: - realtime = True - else: - realtime = False - print "Note: failed to enable realtime scheduling" - - # instantiate the MAC - mac = cs_mac(tun_fd, verbose=True) - - - # build the graph (PHY) - tb = my_top_block(mac.phy_rx_callback, options) - - mac.set_flow_graph(tb) # give the MAC a handle for the PHY - - print "modulation: %s" % (options.modulation,) - print "freq: %s" % (eng_notation.num_to_str(options.tx_freq)) - - tb.rxpath.set_carrier_threshold(options.carrier_threshold) - print "Carrier sense threshold:", options.carrier_threshold, "dB" - - print - print "Allocated virtual ethernet interface: %s" % (tun_ifname,) - print "You must now use ifconfig to set its IP address. E.g.," - print - print " $ sudo ifconfig %s 192.168.200.1" % (tun_ifname,) - print - print "Be sure to use a different address in the same subnet for each machine." - print - - - tb.start() # Start executing the flow graph (runs in separate threads) - - mac.main_loop() # don't expect this to return... - - tb.stop() # but if it does, tell flow graph to stop. - tb.wait() # wait for it to finish - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/ofdm/uhd_interface.py b/gr-digital/examples/ofdm/uhd_interface.py deleted file mode 100644 index e4b13955d..000000000 --- a/gr-digital/examples/ofdm/uhd_interface.py +++ /dev/null @@ -1,207 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 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. -# - -from gnuradio import gr, uhd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import sys - -def add_freq_option(parser): - """ - Hackery that has the -f / --freq option set both tx_freq and rx_freq - """ - def freq_callback(option, opt_str, value, parser): - parser.values.rx_freq = value - parser.values.tx_freq = value - - if not parser.has_option('--freq'): - parser.add_option('-f', '--freq', type="eng_float", - action="callback", callback=freq_callback, - help="set Tx and/or Rx frequency to FREQ [default=%default]", - metavar="FREQ") - -class uhd_interface: - def __init__(self, istx, args, bandwidth, freq=None, - gain=None, spec=None, antenna=None): - - if(istx): - self.u = uhd.usrp_sink(device_addr=args, stream_args=uhd.stream_args('fc32')) - else: - self.u = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(spec): - self.u.set_subdev_spec(spec, 0) - - # Set the antenna - if(antenna): - self.u.set_antenna(antenna, 0) - - self._args = args - self._ant = antenna - self._spec = spec - self._gain = self.set_gain(gain) - self._freq = self.set_freq(freq) - - self._rate = self.set_sample_rate(bandwidth) - - def set_sample_rate(self, bandwidth): - self.u.set_samp_rate(bandwidth) - actual_bw = self.u.get_samp_rate() - - return actual_bw - - def get_sample_rate(self): - return self.u.get_samp_rate() - - def set_gain(self, gain=None): - if gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - gain = float(g.start()+g.stop())/2 - print "\nNo gain specified." - print "Setting gain to %f (from [%f, %f])" % \ - (gain, g.start(), g.stop()) - - self.u.set_gain(gain, 0) - return gain - - def set_freq(self, freq=None): - if(freq is None): - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - sys.exit(1) - - r = self.u.set_center_freq(freq, 0) - if r: - return freq - else: - frange = self.u.get_freq_range() - sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \ - (freq, frange.start(), frange.stop())) - sys.exit(1) - -#-------------------------------------------------------------------# -# TRANSMITTER -#-------------------------------------------------------------------# - -class uhd_transmitter(uhd_interface, gr.hier_block2): - def __init__(self, args, bandwidth, freq=None, gain=None, - spec=None, antenna=None, verbose=False): - gr.hier_block2.__init__(self, "uhd_transmitter", - gr.io_signature(1,1,gr.sizeof_gr_complex), - gr.io_signature(0,0,0)) - - # Set up the UHD interface as a transmitter - uhd_interface.__init__(self, True, args, bandwidth, - freq, gain, spec, antenna) - - self.connect(self, self.u) - - if(verbose): - self._print_verbage() - - def add_options(parser): - add_freq_option(parser) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--tx-freq", type="eng_float", default=None, - help="set transmit frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("", "--tx-gain", type="eng_float", default=None, - help="set transmit gain in dB (default is midpoint)") - parser.add_option("-v", "--verbose", action="store_true", default=False) - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the UHD transmitter - """ - print "\nUHD Transmitter:" - print "UHD Args: %s" % (self._args) - print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) - print "Gain: %f dB" % (self._gain) - print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)) - print "Antenna: %s" % (self._ant) - print "Subdev Sec: %s" % (self._spec) - - - -#-------------------------------------------------------------------# -# RECEIVER -#-------------------------------------------------------------------# - - -class uhd_receiver(uhd_interface, gr.hier_block2): - def __init__(self, args, bandwidth, freq=None, gain=None, - spec=None, antenna=None, verbose=False): - gr.hier_block2.__init__(self, "uhd_receiver", - gr.io_signature(0,0,0), - gr.io_signature(1,1,gr.sizeof_gr_complex)) - - # Set up the UHD interface as a receiver - uhd_interface.__init__(self, False, args, bandwidth, - freq, gain, spec, antenna) - - self.connect(self.u, self) - - if(verbose): - self._print_verbage() - - def add_options(parser): - add_freq_option(parser) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--rx-freq", type="eng_float", default=None, - help="set receive frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("", "--rx-gain", type="eng_float", default=None, - help="set receive gain in dB (default is midpoint)") - if not parser.has_option("--verbose"): - parser.add_option("-v", "--verbose", action="store_true", default=False) - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the UHD transmitter - """ - print "\nUHD Receiver:" - print "UHD Args: %s" % (self._args) - print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) - print "Gain: %f dB" % (self._gain) - print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)) - print "Antenna: %s" % (self._ant) - print "Subdev Sec: %s" % (self._spec) - diff --git a/gr-digital/examples/run_length.py b/gr-digital/examples/run_length.py deleted file mode 100755 index 5020655db..000000000 --- a/gr-digital/examples/run_length.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007 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. -# - -from optparse import OptionParser -import sys - -def main(): - parser = OptionParser() - parser.add_option("-f", "--file", default=None, - help="Choose file to read data from.") - (options, args) = parser.parse_args() - - if options.file == None: - print "Must specify file to read from using '-f'." - sys.exit(1) - print "Using", options.file, "for data." - - f = open(options.file, 'r') - runs = [] - count = 0 - current = 0 - bytes = 0 - bits = 0 - - for ch in f.read(): - x = ord(ch) - bytes = bytes + 1 - for i in range(7,-1,-1): - bits = bits + 1 - t = (x >> i) & 0x1 - if t == current: - count = count + 1 - else: - if count > 0: - if len(runs) < count: - for j in range(count - len(runs)): - runs.append(0); - runs[count-1] = runs[count-1] + 1 - - current = 1-current; - count = 1 - - # Deal with last run at EOF - if len(runs) < count and count > 0: - for j in range(count - len(runs)): - runs.append(0); - runs[count-1] = runs[count-1] + 1 - - chk = 0 - print "Bytes read: ", bytes - print "Bits read: ", bits - print - for i in range(len(runs)): - chk = chk + runs[i]*(i+1) - print "Runs of length", i+1, ":", runs[i] - print - print "Sum of runs:", chk, "bits" - print - print "Maximum run length is", len(runs), "bits" - -if __name__ == "__main__": - main() - - diff --git a/gr-digital/examples/snr_estimators.py b/gr-digital/examples/snr_estimators.py deleted file mode 100755 index 432abd455..000000000 --- a/gr-digital/examples/snr_estimators.py +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env python - -import sys - -try: - import scipy - from scipy import stats -except ImportError: - print "Error: Program requires scipy (www.scipy.org)." - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: Program requires Matplotlib (matplotlib.sourceforge.net)." - sys.exit(1) - -from gnuradio import gr, digital -from optparse import OptionParser -from gnuradio.eng_option import eng_option - -''' -This example program uses Python and GNU Radio to calculate SNR of a -noise BPSK signal to compare them. - -For an explination of the online algorithms, see: -http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Higher-order_statistics -''' - -def online_skewness(data, alpha): - n = 0 - mean = 0 - M2 = 0 - M3 = 0 - d_M3 = 0 - - for n in xrange(len(data)): - delta = data[n] - mean - delta_n = delta / (n+1) - term1 = delta * delta_n * (n) - mean = mean + delta_n - M3 = term1 * delta_n * (n - 1) - 3 * delta_n * M2 - M2 = M2 + term1 - d_M3 = (0.001)*M3 + (1-0.001)*d_M3; - - return d_M3 - -def snr_est_simple(signal): - y1 = scipy.mean(abs(signal)) - y2 = scipy.real(scipy.mean(signal**2)) - y3 = (y1*y1 - y2) - snr_rat = y1*y1/y3 - return 10.0*scipy.log10(snr_rat), snr_rat - -def snr_est_skew(signal): - y1 = scipy.mean(abs(signal)) - y2 = scipy.mean(scipy.real(signal**2)) - y3 = (y1*y1 - y2) - y4 = online_skewness(abs(signal.real), 0.001) - - skw = y4*y4 / (y2*y2*y2); - snr_rat = y1*y1 / (y3 + skw*y1*y1) - return 10.0*scipy.log10(snr_rat), snr_rat - -def snr_est_m2m4(signal): - M2 = scipy.mean(abs(signal)**2) - M4 = scipy.mean(abs(signal)**4) - snr_rat = 2*scipy.sqrt(2*M2*M2 - M4) / (M2 - scipy.sqrt(2*M2*M2 - M4)) - return 10.0*scipy.log10(snr_rat), snr_rat - -def snr_est_svr(signal): - N = len(signal) - ssum = 0 - msum = 0 - for i in xrange(1, N): - ssum += (abs(signal[i])**2)*(abs(signal[i-1])**2) - msum += (abs(signal[i])**4) - savg = (1.0/(float(N)-1.0))*ssum - mavg = (1.0/(float(N)-1.0))*msum - beta = savg / (mavg - savg) - - snr_rat = 2*((beta - 1) + scipy.sqrt(beta*(beta-1))) - return 10.0*scipy.log10(snr_rat), snr_rat - - -def main(): - gr_estimators = {"simple": digital.SNR_EST_SIMPLE, - "skew": digital.SNR_EST_SKEW, - "m2m4": digital.SNR_EST_M2M4, - "svr": digital.SNR_EST_SVR} - py_estimators = {"simple": snr_est_simple, - "skew": snr_est_skew, - "m2m4": snr_est_m2m4, - "svr": snr_est_svr} - - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("-N", "--nsamples", type="int", default=10000, - help="Set the number of samples to process [default=%default]") - parser.add_option("", "--snr-min", type="float", default=-5, - help="Minimum SNR [default=%default]") - parser.add_option("", "--snr-max", type="float", default=20, - help="Maximum SNR [default=%default]") - parser.add_option("", "--snr-step", type="float", default=0.5, - help="SNR step amount [default=%default]") - parser.add_option("-t", "--type", type="choice", - choices=gr_estimators.keys(), default="simple", - help="Estimator type {0} [default=%default]".format( - gr_estimators.keys())) - (options, args) = parser.parse_args () - - N = options.nsamples - xx = scipy.random.randn(N) - xy = scipy.random.randn(N) - bits = 2*scipy.complex64(scipy.random.randint(0, 2, N)) - 1 - - snr_known = list() - snr_python = list() - snr_gr = list() - - # when to issue an SNR tag; can be ignored in this example. - ntag = 10000 - - n_cpx = xx + 1j*xy - - py_est = py_estimators[options.type] - gr_est = gr_estimators[options.type] - - SNR_min = options.snr_min - SNR_max = options.snr_max - SNR_step = options.snr_step - SNR_dB = scipy.arange(SNR_min, SNR_max+SNR_step, SNR_step) - for snr in SNR_dB: - SNR = 10.0**(snr/10.0) - scale = scipy.sqrt(SNR) - yy = bits + n_cpx/scale - print "SNR: ", snr - - Sknown = scipy.mean(yy**2) - Nknown = scipy.var(n_cpx/scale)/2 - snr0 = Sknown/Nknown - snr0dB = 10.0*scipy.log10(snr0) - snr_known.append(snr0dB) - - snrdB, snr = py_est(yy) - snr_python.append(snrdB) - - gr_src = gr.vector_source_c(bits.tolist(), False) - gr_snr = digital.mpsk_snr_est_cc(gr_est, ntag, 0.001) - gr_chn = gr.channel_model(1.0/scale) - gr_snk = gr.null_sink(gr.sizeof_gr_complex) - tb = gr.top_block() - tb.connect(gr_src, gr_chn, gr_snr, gr_snk) - tb.run() - - snr_gr.append(gr_snr.snr()) - - f1 = pylab.figure(1) - s1 = f1.add_subplot(1,1,1) - s1.plot(SNR_dB, snr_known, "k-o", linewidth=2, label="Known") - s1.plot(SNR_dB, snr_python, "b-o", linewidth=2, label="Python") - s1.plot(SNR_dB, snr_gr, "g-o", linewidth=2, label="GNU Radio") - s1.grid(True) - s1.set_title('SNR Estimators') - s1.set_xlabel('SNR (dB)') - s1.set_ylabel('Estimated SNR') - s1.legend() - - pylab.show() - - -if __name__ == "__main__": - main() - diff --git a/gr-digital/gnuradio-digital.pc.in b/gr-digital/gnuradio-digital.pc.in deleted file mode 100644 index 6c0a7ccf8..000000000 --- a/gr-digital/gnuradio-digital.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-digital -Description: GNU Radio blocks for digital communications -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-digital -Cflags: -I${includedir} diff --git a/gr-digital/grc/CMakeLists.txt b/gr-digital/grc/CMakeLists.txt deleted file mode 100644 index bace20847..000000000 --- a/gr-digital/grc/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2011 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. - -file(GLOB xml_files "*.xml") -install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "digital_python") diff --git a/gr-digital/grc/digital_additive_scrambler_bb.xml b/gr-digital/grc/digital_additive_scrambler_bb.xml deleted file mode 100644 index 5ae5ba06f..000000000 --- a/gr-digital/grc/digital_additive_scrambler_bb.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Additive Scrambler -################################################### - --> -<block> - <name>Additive Scrambler</name> - <key>digital_additive_scrambler_bb</key> - <import>from gnuradio import digital</import> - <make>digital.additive_scrambler_bb($mask, $seed, $len, $count)</make> - <param> - <name>Mask</name> - <key>mask</key> - <value>0x8A</value> - <type>hex</type> - </param> - <param> - <name>Seed</name> - <key>seed</key> - <value>0x7F</value> - <type>hex</type> - </param> - <param> - <name>Length</name> - <key>len</key> - <value>7</value> - <type>int</type> - </param> - <param> - <name>Count</name> - <key>count</key> - <value>0</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_binary_slicer_fb.xml b/gr-digital/grc/digital_binary_slicer_fb.xml deleted file mode 100644 index 3187d13f9..000000000 --- a/gr-digital/grc/digital_binary_slicer_fb.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Binary Slicer -################################################### - --> -<block> - <name>Binary Slicer</name> - <key>digital_binary_slicer_fb</key> - <import>from gnuradio import digital</import> - <make>digital.binary_slicer_fb()</make> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_block_tree.xml b/gr-digital/grc/digital_block_tree.xml deleted file mode 100644 index 36827028e..000000000 --- a/gr-digital/grc/digital_block_tree.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0"?> - -<!-- - Copyright 2011 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. ---> - -<!-- -################################################### -##Block Tree for GR Digital blocks. -################################################### - --> -<cat> - <name></name> <!-- Blank for Root Name --> - <cat> - <name>Digital</name> - <block>digital_additive_scrambler_bb</block> - <block>digital_binary_slicer_fb</block> - <block>digital_bytes_to_syms</block> - <block>digital_chunks_to_symbols_xx</block> - <block>digital_clock_recovery_mm_xx</block> - <block>digital_cma_equalizer_cc</block> - <block>digital_constellation_decoder_cb</block> - <block>digital_constellation_receiver_cb</block> - <block>digital_correlate_access_code_bb</block> - <block>digital_costas_loop_cc</block> - <block>digital_descrambler_bb</block> - <block>digital_fll_band_edge_cc</block> - <block>digital_glfsr_source_x</block> - <block>digital_kurtotic_equalizer_cc</block> - <block>digital_lms_dd_equalizer_cc</block> - <block>digital_map_bb</block> - <block>digital_mpsk_receiver_cc</block> - <block>digital_mpsk_snr_est_cc</block> - <block>digital_pfb_clock_sync_xxx</block> - <block>digital_pn_correlator_cc</block> - <block>digital_probe_density_b</block> - <block>digital_probe_mpsk_snr_est_c</block> - <block>digital_scrambler_bb</block> - <block>digital_diff_decoder_bb</block> - <block>digital_diff_encoder_bb</block> - <block>digital_diff_phasor_cc</block> - <block>digital_framer_sink_1</block> - <block>digital_packet_sink</block> - <block>digital_simple_framer</block> - <block>digital_simple_correlator</block> - </cat> - <cat> - <name>Digital Modulators</name> - <block>digital_dxpsk_mod</block> - <block>digital_dxpsk_demod</block> - <block>digital_psk_mod</block> - <block>digital_psk_demod</block> - <block>digital_qam_mod</block> - <block>digital_qam_demod</block> - <block>digital_gmskmod_bc</block> - <block>digital_cpmmod_bc</block> - <block>digital_gmsk_mod</block> - <block>digital_gmsk_demod</block> - </cat> - <cat> - <name>OFDM</name> - <block>digital_ofdm_mod</block> - <block>digital_ofdm_demod</block> - <block>digital_ofdm_cyclic_prefixer</block> - <block>digital_ofdm_frame_acquisition</block> - <block>digital_ofdm_insert_preamble</block> - <block>digital_ofdm_sampler</block> - <block>digital_ofdm_sync_pn</block> - </cat> -</cat> diff --git a/gr-digital/grc/digital_bytes_to_syms.xml b/gr-digital/grc/digital_bytes_to_syms.xml deleted file mode 100644 index fb17bb6de..000000000 --- a/gr-digital/grc/digital_bytes_to_syms.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Bytes to Syms -################################################### - --> -<block> - <name>Bytes to Symbols</name> - <key>digital_bytes_to_syms</key> - <import>from gnuradio import digital</import> - <make>digital.bytes_to_syms()</make> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> -</block> diff --git a/gr-digital/grc/digital_chunks_to_symbols.xml b/gr-digital/grc/digital_chunks_to_symbols.xml deleted file mode 100644 index 494be274d..000000000 --- a/gr-digital/grc/digital_chunks_to_symbols.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Chunks to Symbols -################################################### - --> -<block> - <name>Chunks to Symbols</name> - <key>digital_chunks_to_symbols_xx</key> - <import>from gnuradio import digital</import> - <make>digital.chunks_to_symbols_$(in_type.fcn)$(out_type.fcn)($symbol_table, $dimension)</make> - <param> - <name>Input Type</name> - <key>in_type</key> - <type>enum</type> - <option> - <name>Int</name> - <key>int</key> - <opt>fcn:i</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:s</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>fcn:b</opt> - </option> - </param> - <param> - <name>Output Type</name> - <key>out_type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:c</opt> - <opt>table:complex_vector</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:f</opt> - <opt>table:real_vector</opt> - </option> - </param> - <param> - <name>Symbol Table</name> - <key>symbol_table</key> - <type>$out_type.table</type> - </param> - <param> - <name>Dimension</name> - <key>dimension</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Num Ports</name> - <key>num_ports</key> - <value>1</value> - <type>int</type> - </param> - <check>$num_ports > 0</check> - <sink> - <name>in</name> - <type>$in_type</type> - <nports>$num_ports</nports> - </sink> - <source> - <name>out</name> - <type>$out_type</type> - <nports>$num_ports</nports> - </source> -</block> diff --git a/gr-digital/grc/digital_clock_recovery_mm_xx.xml b/gr-digital/grc/digital_clock_recovery_mm_xx.xml deleted file mode 100644 index d9c5ea4ff..000000000 --- a/gr-digital/grc/digital_clock_recovery_mm_xx.xml +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Clock Recovery MM -################################################### - --> -<block> - <name>Clock Recovery MM</name> - <key>digital_clock_recovery_mm_xx</key> - <import>from gnuradio import digital</import> - <make>digital.clock_recovery_mm_$(type.fcn)($omega, $gain_omega, $mu, $gain_mu, $omega_relative_limit)</make> - <callback>set_omega($omega)</callback> - <callback>set_gain_omega($gain_omega)</callback> - <callback>set_mu($mu)</callback> - <callback>set_gain_mu($gain_mu)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:cc</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:ff</opt> - </option> - </param> - <param> - <name>Omega</name> - <key>omega</key> - <type>real</type> - </param> - <param> - <name>Gain Omega</name> - <key>gain_omega</key> - <type>real</type> - </param> - <param> - <name>Mu</name> - <key>mu</key> - <type>real</type> - </param> - <param> - <name>Gain Mu</name> - <key>gain_mu</key> - <type>real</type> - </param> - <param> - <name>Omega Relative Limit</name> - <key>omega_relative_limit</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>$type</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - </source> -</block> diff --git a/gr-digital/grc/digital_cma_equalizer_cc.xml b/gr-digital/grc/digital_cma_equalizer_cc.xml deleted file mode 100644 index 118c18e29..000000000 --- a/gr-digital/grc/digital_cma_equalizer_cc.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## CMA Equalizer -################################################### - --> -<block> - <name>CMA Equalizer</name> - <key>digital_cma_equalizer_cc</key> - <import>from gnuradio import digital</import> - <make>digital.cma_equalizer_cc($num_taps, $modulus, $mu, $sps)</make> - <callback>set_gain($mu)</callback> - <callback>set_modulus($modulus)</callback> - <param> - <name>Num. Taps</name> - <key>num_taps</key> - <type>int</type> - </param> - <param> - <name>Modulus</name> - <key>modulus</key> - <type>real</type> - </param> - <param> - <name>Gain</name> - <key>mu</key> - <type>real</type> - </param> - <param> - <name>Samples per Symbol</name> - <key>sps</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_constellation_decoder_cb.xml b/gr-digital/grc/digital_constellation_decoder_cb.xml deleted file mode 100644 index c7353e288..000000000 --- a/gr-digital/grc/digital_constellation_decoder_cb.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Constellation Decoder -################################################### - --> -<block> - <name>Constellation Decoder</name> - <key>digital_constellation_decoder_cb</key> - <import>from gnuradio import digital</import> - <make>digital.constellation_decoder_cb($constellation)</make> - <param> - <name>Constellation Object</name> - <key>constellation</key> - <type>raw</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_constellation_receiver_cb.xml b/gr-digital/grc/digital_constellation_receiver_cb.xml deleted file mode 100644 index ffda8b85b..000000000 --- a/gr-digital/grc/digital_constellation_receiver_cb.xml +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Constellation Receiver -################################################### - --> -<block> - <name>Constellation Receiver</name> - <key>digital_constellation_receiver_cb</key> - <import>from gnuradio import digital</import> - <make>digital.constellation_receiver_cb($constellation, $loop_bw, $fmin, $fmax)</make> - <param> - <name>Constellation Object</name> - <key>constellation</key> - <type>raw</type> - </param> - <param> - <name>Loop Bandwidth</name> - <key>loop_bw</key> - <type>real</type> - </param> - <param> - <name>Minimum Freq Deviation</name> - <key>fmin</key> - <type>real</type> - </param> - <param> - <name>Maximum Freq Deviation</name> - <key>fmax</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> - <source> - <name>error</name> - <type>float</type> - <optional>1</optional> - </source> - <source> - <name>phase</name> - <type>float</type> - <optional>1</optional> - </source> - <source> - <name>frequency</name> - <type>float</type> - <optional>1</optional> - </source> - <source> - <name>symbol</name> - <type>complex</type> - <optional>1</optional> - </source> -</block> diff --git a/gr-digital/grc/digital_correlate_access_code_bb.xml b/gr-digital/grc/digital_correlate_access_code_bb.xml deleted file mode 100644 index 3941834c4..000000000 --- a/gr-digital/grc/digital_correlate_access_code_bb.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Correlate Access Code -################################################### - --> -<block> - <name>Correlate Access Code</name> - <key>digital_correlate_access_code_bb</key> - <import>from gnuradio import digital</import> - <make>digital.correlate_access_code_bb($access_code, $threshold)</make> - <param> - <name>Access Code</name> - <key>access_code</key> - <value>101010</value> - <type>string</type> - </param> - <param> - <name>Threshold</name> - <key>threshold</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_costas_loop_cc.xml b/gr-digital/grc/digital_costas_loop_cc.xml deleted file mode 100644 index 668c43dec..000000000 --- a/gr-digital/grc/digital_costas_loop_cc.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Costas Loop -################################################### - --> -<block> - <name>Costas Loop</name> - <key>digital_costas_loop_cc</key> - <import>from gnuradio import digital</import> - <make>digital.costas_loop_cc($w, $order)</make> - <callback>set_loop_bandwidth($w)</callback> - <param> - <name>Loop Bandwidth</name> - <key>w</key> - <type>real</type> - </param> - <param> - <name>Order</name> - <key>order</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> - - <!-- Optional Outputs --> - <source> - <name>frequency</name> - <type>float</type> - <optional>1</optional> - </source> -</block> diff --git a/gr-digital/grc/digital_cpmmod_bc.xml b/gr-digital/grc/digital_cpmmod_bc.xml deleted file mode 100644 index 01174ef80..000000000 --- a/gr-digital/grc/digital_cpmmod_bc.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Continuous Phase Modulation -################################################### - --> -<block> - <name>Continuous Phase Modulation</name> - <key>digital_cpmmod_bc</key> - <import>from gnuradio import gr, digital</import> - <make>digital.cpmmod_bc($type, $mod_index, $samples_per_symbol, $L, $beta)</make> - <param> - <name>CPM Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>L-REC (Rectangular phase response)</name> - <key>gr.cpm.LREC</key> - </option> - <option> - <name>L-RC (Raised Cosine)</name> - <key>gr.cpm.LRC</key> - </option> - <option> - <name>L-SRC (Spectral raised cosine)</name> - <key>gr.cpm.LSRC</key> - </option> - <option> - <name>TFM (Tamed frequency modulation)</name> - <key>gr.cpm.TFM</key> - </option> - <option> - <name>Gaussian</name> - <key>gr.cpm.GAUSSIAN</key> - </option> - </param> - <param> - <name>Modulation Index</name> - <key>mod_index</key> - <value>0.5</value> - <type>real</type> - </param> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>4</value> - <type>int</type> - </param> - <param> - <name>Pulse Duration (Symbols)</name> - <key>L</key> - <value>4</value> - <type>int</type> - </param> - <param> - <name>Phase Response Parameter (BT or Beta)</name> - <key>beta</key> - <value>0.3</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_descrambler_bb.xml b/gr-digital/grc/digital_descrambler_bb.xml deleted file mode 100644 index 4f52c7964..000000000 --- a/gr-digital/grc/digital_descrambler_bb.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Descrambler -################################################### - --> -<block> - <name>Descrambler</name> - <key>digital_descrambler_bb</key> - <import>from gnuradio import digital</import> - <make>digital.descrambler_bb($mask, $seed, $len)</make> - <param> - <name>Mask</name> - <key>mask</key> - <value>0x8A</value> - <type>hex</type> - </param> - <param> - <name>Seed</name> - <key>seed</key> - <value>0x7F</value> - <type>hex</type> - </param> - <param> - <name>Length</name> - <key>len</key> - <value>7</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_diff_decoder_bb.xml b/gr-digital/grc/digital_diff_decoder_bb.xml deleted file mode 100644 index a7c94b834..000000000 --- a/gr-digital/grc/digital_diff_decoder_bb.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Differential Decoder -################################################### - --> -<block> - <name>Differential Decoder</name> - <key>digital_diff_decoder_bb</key> - <import>from gnuradio import digital</import> - <make>digital.diff_decoder_bb($modulus)</make> - <param> - <name>Modulus</name> - <key>modulus</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_diff_encoder_bb.xml b/gr-digital/grc/digital_diff_encoder_bb.xml deleted file mode 100644 index 3885bed9a..000000000 --- a/gr-digital/grc/digital_diff_encoder_bb.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Differential Encoder -################################################### - --> -<block> - <name>Differential Encoder</name> - <key>digital_diff_encoder_bb</key> - <import>from gnuradio import digital</import> - <make>digital.diff_encoder_bb($modulus)</make> - <param> - <name>Modulus</name> - <key>modulus</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_diff_phasor_cc.xml b/gr-digital/grc/digital_diff_phasor_cc.xml deleted file mode 100644 index 506bf400b..000000000 --- a/gr-digital/grc/digital_diff_phasor_cc.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Differential Phasor -################################################### - --> -<block> - <name>Differential Phasor</name> - <key>digital_diff_phasor_cc</key> - <import>from gnuradio import digital</import> - <make>digital.diff_phasor_cc()</make> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_dxpsk_demod.xml b/gr-digital/grc/digital_dxpsk_demod.xml deleted file mode 100644 index f3e9ee6fc..000000000 --- a/gr-digital/grc/digital_dxpsk_demod.xml +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version="1.0"?> - -<!-- - Copyright 2009,2010,2011 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. ---> - -<!-- -################################################### -##DPSK2 Mod - 2, 4, 8 -################################################### - --> -<block> - <name>DPSK Demod</name> - <key>digital_dxpsk_demod</key> - <import>from gnuradio import digital</import> - <make>digital.$(type)_demod( - samples_per_symbol=$samples_per_symbol, - excess_bw=$excess_bw, - freq_bw=$freq_bw, - phase_bw=$phase_bw, - timing_bw=$timing_bw, - gray_coded=$gray_coded, - verbose=$verbose, - log=$log -)</make> - <callback>clock_recov.set_loop_bandwidth($phase_bw)</callback> - <callback>time_recov.set_loop_bandwidth($timing_bw)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>DBPSK</name> - <key>dbpsk</key> - </option> - <option> - <name>DQPSK</name> - <key>dqpsk</key> - </option> - </param> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Excess BW</name> - <key>excess_bw</key> - <value>0.35</value> - <type>real</type> - </param> - <param> - <name>FLL Bandwidth</name> - <key>freq_bw</key> - <value>6.28/100.0</value> - <type>real</type> - </param> - <param> - <name>Phase Loop Bandwidth</name> - <key>phase_bw</key> - <value>6.28/100.0</value> - <type>real</type> - </param> - <param> - <name>Timing Bandwidth</name> - <key>timing_bw</key> - <value>6.28/100.0</value> - <type>real</type> - </param> - <param> - <name>Gray Code</name> - <key>gray_coded</key> - <value>True</value> - <type>enum</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Verbose</name> - <key>verbose</key> - <value>False</value> - <type>bool</type> - <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <param> - <name>Logging</name> - <key>log</key> - <value>False</value> - <type>bool</type> - <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <param> - <name>Sync Out</name> - <key>sync_out</key> - <value>False</value> - <type>bool</type> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_dxpsk_mod.xml b/gr-digital/grc/digital_dxpsk_mod.xml deleted file mode 100644 index 93334d27d..000000000 --- a/gr-digital/grc/digital_dxpsk_mod.xml +++ /dev/null @@ -1,121 +0,0 @@ -<?xml version="1.0"?> - -<!-- - Copyright 2009,2010,2011 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. ---> - -<!-- -################################################### -## DPSK Mod - 2, 4, 8 -################################################### - --> -<block> - <name>DPSK Mod</name> - <key>digital_dxpsk_mod</key> - <import>from gnuradio import digital</import> - <make>digital.$(type)_mod( - samples_per_symbol=$samples_per_symbol, - excess_bw=$excess_bw, - gray_coded=$gray_coded, - verbose=$verbose, - log=$log) - </make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>DBPSK</name> - <key>dbpsk</key> - </option> - <option> - <name>DQPSK</name> - <key>dqpsk</key> - </option> - <option> - <name>D8PSK</name> - <key>d8psk</key> - </option> - </param> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Excess BW</name> - <key>excess_bw</key> - <value>0.35</value> - <type>real</type> - </param> - <param> - <name>Gray Code</name> - <key>gray_coded</key> - <value>True</value> - <type>enum</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Verbose</name> - <key>verbose</key> - <value>False</value> - <type>bool</type> - <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <param> - <name>Logging</name> - <key>log</key> - <value>False</value> - <type>bool</type> - <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_fll_band_edge_cc.xml b/gr-digital/grc/digital_fll_band_edge_cc.xml deleted file mode 100644 index e4da773db..000000000 --- a/gr-digital/grc/digital_fll_band_edge_cc.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## FLL using Band-Edge Filters -################################################### - --> -<block> - <name>FLL Band-Edge</name> - <key>digital_fll_band_edge_cc</key> - <import>from gnuradio import digital</import> - <make>digital.fll_band_edge_cc($samps_per_sym, $rolloff, $filter_size, $w)</make> - <callback>set_loop_bandwidth($w)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex->Complex</name> - <key>cc</key> - <opt>input:complex</opt> - <opt>output:complex</opt> - </option> - </param> - - <param> - <name>Samples Per Symbol</name> - <key>samps_per_sym</key> - <type>real</type> - </param> - <param> - <name>Filter Rolloff Factor</name> - <key>rolloff</key> - <type>real</type> - </param> - <param> - <name>Prototype Filter Size</name> - <key>filter_size</key> - <type>int</type> - </param> - - <param> - <name>Loop Bandwidth</name> - <key>w</key> - <type>real</type> - </param> - - <sink> - <name>in</name> - <type>$type.input</type> - </sink> - <source> - <name>out</name> - <type>$type.output</type> - </source> - <source> - <name>freq</name> - <type>float</type> - <optional>1</optional> - </source> - <source> - <name>phase</name> - <type>float</type> - <optional>1</optional> - </source> - <source> - <name>error</name> - <type>float</type> - <optional>1</optional> - </source> -</block> diff --git a/gr-digital/grc/digital_framer_sink_1.xml b/gr-digital/grc/digital_framer_sink_1.xml deleted file mode 100644 index 9124e6d0d..000000000 --- a/gr-digital/grc/digital_framer_sink_1.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Framer Sink 1 -################################################### - --> -<block> - <name>Framer Sink 1</name> - <key>digital_framer_sink_1</key> - <import>from gnuradio import digital</import> - <make>digital.framer_sink_1($target_queue)</make> - <param> - <name>Target Message Queue</name> - <key>target_queue</key> - <type>raw</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> -</block> diff --git a/gr-digital/grc/digital_gfsk_demod.xml b/gr-digital/grc/digital_gfsk_demod.xml deleted file mode 100644 index ce3024d89..000000000 --- a/gr-digital/grc/digital_gfsk_demod.xml +++ /dev/null @@ -1,95 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##GFSK Demod -################################################### - --> -<block> - <name>GFSK Demod</name> - <key>digital_gfsk_demod</key> - <import>from gnuradio import digital</import> - <make>digital.gfsk_demod( - samples_per_symbol=$samples_per_symbol, - sensitivity=$sensitivity, - gain_mu=$gain_mu, - mu=$mu, - omega_relative_limit=$omega_relative_limit, - freq_error=$freq_error, - verbose=$verbose, - log=$log, -)</make> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Sensitivity</name> - <key>sensitivity</key> - <value>1.0</value> - <type>real</type> - </param> - <param> - <name>Gain Mu</name> - <key>gain_mu</key> - <value>0.175</value> - <type>real</type> - </param> - <param> - <name>Mu</name> - <key>mu</key> - <value>0.5</value> - <type>real</type> - </param> - <param> - <name>Omega Relative Limit</name> - <key>omega_relative_limit</key> - <value>0.005</value> - <type>real</type> - </param> - <param> - <name>Freq Error</name> - <key>freq_error</key> - <value>0.0</value> - <type>real</type> - </param> - <param> - <name>Verbose</name> - <key>verbose</key> - <value>False</value> - <type>bool</type> - <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <param> - <name>Logging</name> - <key>log</key> - <value>False</value> - <type>bool</type> - <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_gfsk_mod.xml b/gr-digital/grc/digital_gfsk_mod.xml deleted file mode 100644 index 2d6cd1ea5..000000000 --- a/gr-digital/grc/digital_gfsk_mod.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##GFSK Mod -################################################### - --> -<block> - <name>GFSK Mod</name> - <key>digital_gfsk_mod</key> - <import>from gnuradio import digital</import> - <make>digital.gfsk_mod( - samples_per_symbol=$samples_per_symbol, - sensitivity=$sensitivity, - bt=$bt, - verbose=$verbose, - log=$log, -)</make> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Sensitivity</name> - <key>sensitivity</key> - <value>1.0</value> - <type>real</type> - </param> - <param> - <name>BT</name> - <key>bt</key> - <value>0.35</value> - <type>real</type> - </param> - <param> - <name>Verbose</name> - <key>verbose</key> - <value>False</value> - <type>bool</type> - <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <param> - <name>Logging</name> - <key>log</key> - <value>False</value> - <type>bool</type> - <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_glfsr_source_x.xml b/gr-digital/grc/digital_glfsr_source_x.xml deleted file mode 100644 index 654dfa71c..000000000 --- a/gr-digital/grc/digital_glfsr_source_x.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##GLFSR Source -################################################### - --> -<block> - <name>GLFSR Source</name> - <key>digital_glfsr_source_x</key> - <import>from gnuradio import digital</import> - <make>digital.glfsr_source_$(type.fcn)($degree, $repeat, $mask, $seed)</make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:f</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>fcn:b</opt> - </option> - </param> - <param> - <name>Degree</name> - <key>degree</key> - <type>int</type> - </param> - <param> - <name>Repeat</name> - <key>repeat</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Mask</name> - <key>mask</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Seed</name> - <key>seed</key> - <value>1</value> - <type>int</type> - </param> - <source> - <name>out</name> - <type>$type</type> - </source> -</block> diff --git a/gr-digital/grc/digital_gmsk_demod.xml b/gr-digital/grc/digital_gmsk_demod.xml deleted file mode 100644 index e037b8ea0..000000000 --- a/gr-digital/grc/digital_gmsk_demod.xml +++ /dev/null @@ -1,88 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##GMSK Demod -################################################### - --> -<block> - <name>GMSK Demod</name> - <key>digital_gmsk_demod</key> - <import>from gnuradio import digital</import> - <make>digital.gmsk_demod( - samples_per_symbol=$samples_per_symbol, - gain_mu=$gain_mu, - mu=$mu, - omega_relative_limit=$omega_relative_limit, - freq_error=$freq_error, - verbose=$verbose, - log=$log, -)</make> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Gain Mu</name> - <key>gain_mu</key> - <value>0.175</value> - <type>real</type> - </param> - <param> - <name>Mu</name> - <key>mu</key> - <value>0.5</value> - <type>real</type> - </param> - <param> - <name>Omega Relative Limit</name> - <key>omega_relative_limit</key> - <value>0.005</value> - <type>real</type> - </param> - <param> - <name>Freq Error</name> - <key>freq_error</key> - <value>0.0</value> - <type>real</type> - </param> - <param> - <name>Verbose</name> - <key>verbose</key> - <value>False</value> - <type>bool</type> - <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <param> - <name>Logging</name> - <key>log</key> - <value>False</value> - <type>bool</type> - <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_gmsk_mod.xml b/gr-digital/grc/digital_gmsk_mod.xml deleted file mode 100644 index ede76808a..000000000 --- a/gr-digital/grc/digital_gmsk_mod.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##GMSK Mod -################################################### - --> -<block> - <name>GMSK Mod</name> - <key>digital_gmsk_mod</key> - <import>from gnuradio import digital</import> - <make>digital.gmsk_mod( - samples_per_symbol=$samples_per_symbol, - bt=$bt, - verbose=$verbose, - log=$log, -)</make> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>BT</name> - <key>bt</key> - <value>0.35</value> - <type>real</type> - </param> - <param> - <name>Verbose</name> - <key>verbose</key> - <value>False</value> - <type>bool</type> - <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <param> - <name>Logging</name> - <key>log</key> - <value>False</value> - <type>bool</type> - <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_gmskmod_bc.xml b/gr-digital/grc/digital_gmskmod_bc.xml deleted file mode 100644 index a44afe798..000000000 --- a/gr-digital/grc/digital_gmskmod_bc.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## GMSK -################################################### - --> -<block> - <name>GMSK Modulator</name> - <key>digital_gmskmod_bc</key> - <import>from gnuradio import digital</import> - <make>digital.gmskmod_bc($samples_per_symbol, $bt, $L)</make> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>3 dB Time-Bandwith Product</name> - <key>bt</key> - <value>0.3</value> - <type>real</type> - </param> - <param> - <name>Pulse Duration (Symbols)</name> - <key>L</key> - <value>4</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_kurtotic_equalizer_cc.xml b/gr-digital/grc/digital_kurtotic_equalizer_cc.xml deleted file mode 100644 index 8c4a2012d..000000000 --- a/gr-digital/grc/digital_kurtotic_equalizer_cc.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Kurtotic Equalizer -################################################### - --> -<block> - <name>Kurtotic Equalizer</name> - <key>digital_kurtotic_equalizer_cc</key> - <import>from gnuradio import digital</import> - <make>digital.kurtotic_equalizer_cc($num_taps, $mu)</make> - <callback>set_gain($mu)</callback> - <param> - <name>Num. Taps</name> - <key>num_taps</key> - <type>int</type> - </param> - <param> - <name>Mu</name> - <key>mu</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_lms_dd_equalizer_cc.xml b/gr-digital/grc/digital_lms_dd_equalizer_cc.xml deleted file mode 100644 index 0fd7d523b..000000000 --- a/gr-digital/grc/digital_lms_dd_equalizer_cc.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## LMS DD Equalizer -################################################### - --> -<block> - <name>LMS DD Equalizer</name> - <key>digital_lms_dd_equalizer_cc</key> - <import>from gnuradio import digital</import> - <make>digital.lms_dd_equalizer_cc($num_taps, $mu, $sps, $cnst)</make> - <callback>set_gain($mu)</callback> - <param> - <name>Gain</name> - <key>mu</key> - <type>real</type> - </param> - <param> - <name>Num. Taps</name> - <key>num_taps</key> - <type>int</type> - </param> - <param> - <name>Samples per Symbol</name> - <key>sps</key> - <type>int</type> - </param> - <param> - <name>Constellation Object</name> - <key>cnst</key> - <type>raw</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_map_bb.xml b/gr-digital/grc/digital_map_bb.xml deleted file mode 100644 index 1435c5ac7..000000000 --- a/gr-digital/grc/digital_map_bb.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Map -################################################### - --> -<block> - <name>Map</name> - <key>digital_map_bb</key> - <import>from gnuradio import digital</import> - <make>digital.map_bb($map)</make> - <param> - <name>Map</name> - <key>map</key> - <type>int_vector</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_mpsk_receiver_cc.xml b/gr-digital/grc/digital_mpsk_receiver_cc.xml deleted file mode 100644 index bd738fccc..000000000 --- a/gr-digital/grc/digital_mpsk_receiver_cc.xml +++ /dev/null @@ -1,86 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##MPSK Receiver -################################################### - --> -<block> - <name>MPSK Receiver</name> - <key>digital_mpsk_receiver_cc</key> - <import>from gnuradio import digital;import cmath</import> - <make>digital.mpsk_receiver_cc($M, $theta, $w, $fmin, $fmax, $mu, $gain_mu, $omega, $gain_omega, $omega_relative_limit)</make> - <callback>set_loop_bandwidth($w)</callback> - <callback>set_mu($mu)</callback> - <callback>set_gain_mu($gain_mu)</callback> - <callback>set_omega($omega)</callback> - <callback>set_gain_omega($gain_omega)</callback> - <param> - <name>M</name> - <key>M</key> - <value>4</value> - <type>int</type> - </param> - <param> - <name>Theta</name> - <key>theta</key> - <value>0</value> - <type>real</type> - </param> - <param> - <name>Loop Bandwidth</name> - <key>w</key> - <value>cmath.pi/100.0</value> - <type>real</type> - </param> - <param> - <name>Min Freq</name> - <key>fmin</key> - <value>-0.5</value> - <type>real</type> - </param> - <param> - <name>Max Freq</name> - <key>fmax</key> - <value>0.5</value> - <type>real</type> - </param> - <param> - <name>Mu</name> - <key>mu</key> - <value>0.25</value> - <type>real</type> - </param> - <param> - <name>Gain Mu</name> - <key>gain_mu</key> - <value>0.01</value> - <type>real</type> - </param> - <param> - <name>Omega</name> - <key>omega</key> - <value>2</value> - <type>real</type> - </param> - <param> - <name>Gain Omega</name> - <key>gain_omega</key> - <value>0.001</value> - <type>real</type> - </param> - <param> - <name>Omega Relative Limit</name> - <key>omega_relative_limit</key> - <value>0.001</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> - -</block> diff --git a/gr-digital/grc/digital_mpsk_snr_est_cc.xml b/gr-digital/grc/digital_mpsk_snr_est_cc.xml deleted file mode 100644 index 6039e5b13..000000000 --- a/gr-digital/grc/digital_mpsk_snr_est_cc.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##MPSK SNR Estimator -################################################### - --> -<block> - <name>MPSK SNR Estimator</name> - <key>digital_mpsk_snr_est_cc</key> - <import>from gnuradio import digital</import> - <make>digital.mpsk_snr_est_cc($type, $tag_nsamples, $alpha)</make> - <callback>set_type($type)</callback> - <callback>set_tag_nsamples($tag_nsamples)</callback> - <callback>set_alpha($alpha)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Simple</name> - <key>0</key> - </option> - <option> - <name>Skewness</name> - <key>1</key> - </option> - <option> - <name>2nd and 4th Moment</name> - <key>2</key> - </option> - <option> - <name>SVR</name> - <key>3</key> - </option> - </param> - <param> - <name>Samples between tags</name> - <key>tag_nsamples</key> - <value>10000</value> - <type>int</type> - </param> - <param> - <name>Filter Alpha</name> - <key>alpha</key> - <value>0.001</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_ofdm_cyclic_prefixer.xml b/gr-digital/grc/digital_ofdm_cyclic_prefixer.xml deleted file mode 100644 index d5e5d3894..000000000 --- a/gr-digital/grc/digital_ofdm_cyclic_prefixer.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0"?> -<!-- - Copyright 2011 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. ---> - -<!-- -################################################### -##OFDM Cyclic Prefixer -################################################### - --> -<block> - <name>OFDM Cyclic Prefixer</name> - <key>digital_ofdm_cyclic_prefixer</key> - <import>from gnuradio import digital</import> - <make>digital.ofdm_cyclic_prefixer($input_size, $output_size)</make> - <param> - <name>Input Size</name> - <key>input_size</key> - <type>int</type> - </param> - <param> - <name>Output Size</name> - <key>output_size</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - <vlen>$input_size</vlen> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_ofdm_demod.xml b/gr-digital/grc/digital_ofdm_demod.xml deleted file mode 100644 index 9f3a83715..000000000 --- a/gr-digital/grc/digital_ofdm_demod.xml +++ /dev/null @@ -1,143 +0,0 @@ -<?xml version="1.0"?> -<!-- - Copyright 2011 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. ---> - -<!-- -################################################### -##OFDM Demod -################################################### - --> -<block> - <name>OFDM Demod</name> - <key>digital_ofdm_demod</key> - <import>from grc_gnuradio import blks2 as grc_blks2</import> - <import>from gnuradio import digital</import> - <make>grc_blks2.packet_demod_$(type.fcn)(digital.ofdm_demod( - options=grc_blks2.options( - modulation="$modulation", - fft_length=$fft_length, - occupied_tones=$occupied_tones, - cp_length=$cp_length, - snr=$snr, - log=None, - verbose=None, - ), - callback=lambda ok, payload: self.$(id).recv_pkt(ok, payload), - ), -)</make> - <param> - <name>Output Type</name> - <key>type</key> - <value>float</value> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:c</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:f</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>fcn:i</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:s</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>fcn:b</opt> - </option> - </param> - <param> - <name>Modulation</name> - <key>modulation</key> - <type>enum</type> - <option> - <name>BPSK</name> - <key>bpsk</key> - </option> - <option> - <name>QPSK</name> - <key>qpsk</key> - </option> - <option> - <name>8PSK</name> - <key>8psk</key> - </option> - <option> - <name>QAM8</name> - <key>qam8</key> - </option> - <option> - <name>QAM16</name> - <key>qam16</key> - </option> - <option> - <name>QAM64</name> - <key>qam64</key> - </option> - <option> - <name>QAM256</name> - <key>qam256</key> - </option> - </param> - <param> - <name>FFT Length</name> - <key>fft_length</key> - <value>512</value> - <type>int</type> - </param> - <param> - <name>Occupied Tones</name> - <key>occupied_tones</key> - <value>200</value> - <type>int</type> - </param> - <param> - <name>Cyclic Prefix Length</name> - <key>cp_length</key> - <value>128</value> - <type>int</type> - </param> - <param> - <name>SNR</name> - <key>snr</key> - <value>10</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - </source> - <doc>Payload Length: 0 for automatic.</doc> -</block> diff --git a/gr-digital/grc/digital_ofdm_frame_acquisition.xml b/gr-digital/grc/digital_ofdm_frame_acquisition.xml deleted file mode 100644 index 2545f18e6..000000000 --- a/gr-digital/grc/digital_ofdm_frame_acquisition.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0"?> -<!-- - Copyright 2011 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. ---> - -<!-- -################################################### -##OFDM Frame Acquisition -################################################### - --> -<block> - <name>OFDM Frame Acquisition</name> - <key>digital_ofdm_frame_acquisition</key> - <import>from gnuradio import digital</import> - <make>digital.ofdm_frame_acquisition($occupied_carriers, $fft_length, $cplen, $known_symbol, $max_fft_shift_len)</make> - <param> - <name>Occupied Carriers</name> - <key>occupied_carriers</key> - <type>int</type> - </param> - <param> - <name>FFT Length</name> - <key>fft_length</key> - <type>int</type> - </param> - <param> - <name>CP Length</name> - <key>cplen</key> - <type>int</type> - </param> - <param> - <name>Preamble</name> - <key>known_symbol</key> - <type>complex_vector</type> - </param> - <param> - <name>Max FFT Shift</name> - <key>max_fft_shift_len</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - <vlen>$fft_length</vlen> - </sink> - <sink> - <name>flag</name> - <type>byte</type> - <vlen>$fft_length</vlen> - </sink> - <source> - <name>out</name> - <type>complex</type> - <vlen>$occupied_carriers</vlen> - </source> - <source> - <name>flag</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_ofdm_insert_preamble.xml b/gr-digital/grc/digital_ofdm_insert_preamble.xml deleted file mode 100644 index 9ad8fa793..000000000 --- a/gr-digital/grc/digital_ofdm_insert_preamble.xml +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0"?> -<!-- - Copyright 2011 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. ---> - -<!-- -################################################### -##OFDM Insert Preamble -################################################### - --> -<block> - <name>OFDM Insert Preamble</name> - <key>digital_ofdm_insert_preamble</key> - <import>from gnuradio import digital</import> - <make>digital.ofdm_insert_preamble($fft_length, $preamble)</make> - <param> - <name>FFT Length</name> - <key>fft_length</key> - <type>int</type> - </param> - <param> - <name>Preamble</name> - <key>preamble</key> - <type>raw</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - <vlen>$fft_length</vlen> - </sink> - <sink> - <name>flag</name> - <type>byte</type> - <optional>1</optional> - </sink> - <source> - <name>out</name> - <type>complex</type> - <vlen>$fft_length</vlen> - </source> - <source> - <name>flag</name> - <type>byte</type> - <optional>1</optional> - </source> -</block> diff --git a/gr-digital/grc/digital_ofdm_mod.xml b/gr-digital/grc/digital_ofdm_mod.xml deleted file mode 100644 index 24cb2aa33..000000000 --- a/gr-digital/grc/digital_ofdm_mod.xml +++ /dev/null @@ -1,156 +0,0 @@ -<?xml version="1.0"?> -<!-- - Copyright 2011 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. ---> - -<!-- -################################################### -##OFDM Mod -################################################### - --> -<block> - <name>OFDM Mod</name> - <key>digital_ofdm_mod</key> - <import>from grc_gnuradio import blks2 as grc_blks2</import> - <import>from gnuradio import digital</import> - <make>grc_blks2.packet_mod_$(type.fcn)(digital.ofdm_mod( - options=grc_blks2.options( - modulation="$modulation", - fft_length=$fft_length, - occupied_tones=$occupied_tones, - cp_length=$cp_length, - pad_for_usrp=$pad_for_usrp, - log=None, - verbose=None, - ), - ), - payload_length=$payload_length, -)</make> - <param> - <name>Input Type</name> - <key>type</key> - <value>float</value> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:c</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:f</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>fcn:i</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:s</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>fcn:b</opt> - </option> - </param> - <param> - <name>Modulation</name> - <key>modulation</key> - <type>enum</type> - <option> - <name>BPSK</name> - <key>bpsk</key> - </option> - <option> - <name>QPSK</name> - <key>qpsk</key> - </option> - <option> - <name>8PSK</name> - <key>8psk</key> - </option> - <option> - <name>QAM8</name> - <key>qam8</key> - </option> - <option> - <name>QAM16</name> - <key>qam16</key> - </option> - <option> - <name>QAM64</name> - <key>qam64</key> - </option> - <option> - <name>QAM256</name> - <key>qam256</key> - </option> - </param> - <param> - <name>FFT Length</name> - <key>fft_length</key> - <value>512</value> - <type>int</type> - </param> - <param> - <name>Occupied Tones</name> - <key>occupied_tones</key> - <value>200</value> - <type>int</type> - </param> - <param> - <name>Cyclic Prefix Length</name> - <key>cp_length</key> - <value>128</value> - <type>int</type> - </param> - <param> - <name>Pad for USRP</name> - <key>pad_for_usrp</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Payload Length</name> - <key>payload_length</key> - <value>0</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>$type</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> - <doc>Payload Length: 0 for automatic.</doc> -</block> diff --git a/gr-digital/grc/digital_ofdm_sampler.xml b/gr-digital/grc/digital_ofdm_sampler.xml deleted file mode 100644 index f3d5c85f3..000000000 --- a/gr-digital/grc/digital_ofdm_sampler.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0"?> -<!-- - Copyright 2011 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. ---> - -<!-- -################################################### -##OFDM Sampler -################################################### - --> -<block> - <name>OFDM Sampler</name> - <key>digital_ofdm_sampler</key> - <import>from gnuradio import digital</import> - <make>digital.ofdm_sampler($fft_length, $symbol_length, $timeout)</make> - <param> - <name>FFT Length</name> - <key>fft_length</key> - <type>int</type> - </param> - <param> - <name>Symbol Length</name> - <key>symbol_length</key> - <type>int</type> - </param> - <param> - <name>Timeout</name> - <key>timeout</key> - <value>1000</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <sink> - <name>flag</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - <vlen>$fft_length</vlen> - </source> - <source> - <name>flag</name> - <type>byte</type> - <vlen>$fft_length</vlen> - </source> -</block> diff --git a/gr-digital/grc/digital_ofdm_sync_pn.xml b/gr-digital/grc/digital_ofdm_sync_pn.xml deleted file mode 100644 index 7a05f394d..000000000 --- a/gr-digital/grc/digital_ofdm_sync_pn.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0"?> -<!-- - Copyright 2011 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. ---> - -<!-- -################################################### -##OFDM Synchronizer - PN based -################################################### - --> -<block> - <name>OFDM Sync PN</name> - <key>digital_ofdm_sync_pn</key> - <import>from gnuradio import digital</import> - <make>digital.ofdm_sync_pn($fft_length, $cp_length, $logging)</make> - <param> - <name>FFT Length</name> - <key>fft_length</key> - <type>int</type> - </param> - <param> - <name>CP Length</name> - <key>cp_length</key> - <type>int</type> - </param> - <param> - <name>Logging</name> - <key>logging</key> - <value>False</value> - <type>bool</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>fine freq</name> - <type>float</type> - </source> - <source> - <name>timing sig</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_packet_sink.xml b/gr-digital/grc/digital_packet_sink.xml deleted file mode 100644 index e9231bd05..000000000 --- a/gr-digital/grc/digital_packet_sink.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Packet Sink -################################################### - --> -<block> - <name>Packet Sink</name> - <key>digital_packet_sink</key> - <import>from gnuradio import digital</import> - <make>digital.packet_sink($sync_vector, $target_queue, $threshold)</make> - <param> - <name>Sync Vector</name> - <key>sync_vector</key> - <type>int_vector</type> - </param> - <param> - <name>Target Message Queue</name> - <key>target_queue</key> - <type>raw</type> - </param> - <param> - <name>Threshold</name> - <key>threshold</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> -</block> diff --git a/gr-digital/grc/digital_pfb_clock_sync.xml b/gr-digital/grc/digital_pfb_clock_sync.xml deleted file mode 100644 index 255eb7f7a..000000000 --- a/gr-digital/grc/digital_pfb_clock_sync.xml +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Polyphase Filter based Clock Sync -################################################### - --> -<block> - <name>Polyphase Clock Sync</name> - <key>digital_pfb_clock_sync_xxx</key> - <import>from gnuradio import digital</import> - <make>digital.pfb_clock_sync_$(type)($sps, $loop_bw, $taps, $filter_size, $init_phase, $max_dev, $osps)</make> - <callback>set_taps($taps)</callback> - <callback>set_loop_bandwidth($loop_bw)</callback> - - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex->Complex (Real Taps)</name> - <key>ccf</key> - <opt>input:complex</opt> - <opt>output:complex</opt> - <opt>taps:real_vector</opt> - </option> - <option> - <name>Float->Float (Real Taps)</name> - <key>fff</key> - <opt>input:float</opt> - <opt>output:float</opt> - <opt>taps:real_vector</opt> - </option> - </param> - - <param> - <name>Samples/Symbol</name> - <key>sps</key> - <type>real</type> - </param> - <param> - <name>Loop Bandwidth</name> - <key>loop_bw</key> - <type>real</type> - </param> - <param> - <name>Taps</name> - <key>taps</key> - <type>real_vector</type> - </param> - <param> - <name>Filter Size</name> - <key>filter_size</key> - <value>32</value> - <type>int</type> - </param> - <param> - <name>Initial Phase</name> - <key>init_phase</key> - <value>16</value> - <type>real</type> - </param> - <param> - <name>Maximum Rate Deviation</name> - <key>max_dev</key> - <value>1.5</value> - <type>real</type> - </param> - <param> - <name>Output SPS</name> - <key>osps</key> - <value>1</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>$type.input</type> - </sink> - <source> - <name>out</name> - <type>$type.output</type> - </source> - <source> - <name>err</name> - <type>float</type> - <optional>1</optional> - </source> - <source> - <name>rate</name> - <type>float</type> - <optional>1</optional> - </source> - <source> - <name>phase</name> - <type>float</type> - <optional>1</optional> - </source> -</block> diff --git a/gr-digital/grc/digital_pn_correlator_cc.xml b/gr-digital/grc/digital_pn_correlator_cc.xml deleted file mode 100644 index 999cea15d..000000000 --- a/gr-digital/grc/digital_pn_correlator_cc.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##PN Correlator -################################################### - --> -<block> - <name>PN Correlator</name> - <key>digital_pn_correlator_cc</key> - <import>from gnuradio import digital</import> - <make>digital.pn_correlator_cc($degree, $mask, $seed)</make> - <param> - <name>Degree</name> - <key>degree</key> - <type>int</type> - </param> - <param> - <name>Mask</name> - <key>mask</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Seed</name> - <key>seed</key> - <value>1</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_probe_density_b.xml b/gr-digital/grc/digital_probe_density_b.xml deleted file mode 100644 index 8cf5dd894..000000000 --- a/gr-digital/grc/digital_probe_density_b.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Probe Density -################################################### - --> -<block> - <name>Probe Density</name> - <key>digital_probe_density_b</key> - <import>from gnuradio import digital</import> - <make>digital.probe_density_b($alpha)</make> - <callback>set_alpha($alpha)</callback> - <param> - <name>Alpha</name> - <key>alpha</key> - <value>1</value> - <type>real</type> - </param> - <param> - <name>Probe Rate</name> - <key>probe_rate</key> - <value>10</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> -</block> diff --git a/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml b/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml deleted file mode 100644 index 62c5fad97..000000000 --- a/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##MPSK SNR Estimator -################################################### - --> -<block> - <name>MPSK SNR Estimator Probe</name> - <key>digital_probe_mpsk_snr_est_c</key> - <import>from gnuradio import digital</import> - <make>digital.probe_mpsk_snr_est_c($type, $msg_nsamples, $alpha)</make> - <callback>set_type($type)</callback> - <callback>set_msg_nsample($msg_nsamples)</callback> - <callback>set_alpha($alpha)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Simple</name> - <key>0</key> - </option> - <option> - <name>Skewness</name> - <key>1</key> - </option> - <option> - <name>2nd and 4th Moment</name> - <key>2</key> - </option> - <option> - <name>SVR</name> - <key>3</key> - </option> - </param> - <param> - <name>Samples between SNR messages</name> - <key>msg_nsamples</key> - <value>10000</value> - <type>int</type> - </param> - <param> - <name>Filter Alpha</name> - <key>alpha</key> - <value>0.001</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> -</block> diff --git a/gr-digital/grc/digital_psk_demod.xml b/gr-digital/grc/digital_psk_demod.xml deleted file mode 100644 index 2e0e86ebc..000000000 --- a/gr-digital/grc/digital_psk_demod.xml +++ /dev/null @@ -1,145 +0,0 @@ -<?xml version="1.0"?> - -<!-- - Copyright 2009,2010,2011 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. ---> - -<!-- -################################################### -##PSK Demod -################################################### - --> -<block> - <name>PSK Demod</name> - <key>digital_psk_demod</key> - <import>from gnuradio import digital</import> - <make>digital.psk.psk_demod( - constellation_points=$constellation_points, - differential=$differential, - samples_per_symbol=$samples_per_symbol, - excess_bw=$excess_bw, - phase_bw=$phase_bw, - timing_bw=$timing_bw, - mod_code=$mod_code, - verbose=$verbose, - log=$log, - )</make> - <param> - <name>Number of Constellation Points</name> - <key>constellation_points</key> - <value>8</value> - <type>int</type> - </param> - <param> - <name>Differential Encoding</name> - <key>differential</key> - <value>True</value> - <type>bool</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Excess BW</name> - <key>excess_bw</key> - <value>0.35</value> - <type>real</type> - </param> - <param> - <name>Frequency BW</name> - <key>freq_bw</key> - <value>6.28/100.0</value> - <type>real</type> - </param> - <param> - <name>Timing BW</name> - <key>timing_bw</key> - <value>6.28/100.0</value> - <type>real</type> - </param> - <param> - <name>Phase BW</name> - <key>phase_bw</key> - <value>6.28/100.0</value> - <type>real</type> - </param> - <param> - <name>Gray Code</name> - <key>mod_code</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>"gray"</key> - </option> - <option> - <name>No</name> - <key>"none"</key> - </option> - </param> - <param> - <name>Verbose</name> - <key>verbose</key> - <value>False</value> - <type>bool</type> - <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <param> - <name>Logging</name> - <key>log</key> - <value>False</value> - <type>bool</type> - <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_psk_mod.xml b/gr-digital/grc/digital_psk_mod.xml deleted file mode 100644 index cafcf4e50..000000000 --- a/gr-digital/grc/digital_psk_mod.xml +++ /dev/null @@ -1,125 +0,0 @@ -<?xml version="1.0"?> - -<!-- - Copyright 2009,2010,2011 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. ---> - -<!-- -################################################### -##PSK Mod -################################################### - --> -<block> - <name>PSK Mod</name> - <key>digital_psk_mod</key> - <import>from gnuradio import digital</import> - <make>digital.psk.psk_mod( - constellation_points=$constellation_points, - mod_code=$mod_code, - differential=$differential, - samples_per_symbol=$samples_per_symbol, - excess_bw=$excess_bw, - verbose=$verbose, - log=$log, - )</make> - <param> - <name>Number of Constellation Points</name> - <key>constellation_points</key> - <value>8</value> - <type>int</type> - </param> - <param> - <name>Gray Code</name> - <key>mod_code</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>"gray"</key> - </option> - <option> - <name>No</name> - <key>"none"</key> - </option> - </param> - <param> - <name>Differential Encoding</name> - <key>differential</key> - <value>True</value> - <type>bool</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Excess BW</name> - <key>excess_bw</key> - <value>0.35</value> - <type>real</type> - </param> - <param> - <name>Verbose</name> - <key>verbose</key> - <value>False</value> - <type>bool</type> - <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <param> - <name>Logging</name> - <key>log</key> - <value>False</value> - <type>bool</type> - <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_qam_demod.xml b/gr-digital/grc/digital_qam_demod.xml deleted file mode 100644 index 5aaec1bd0..000000000 --- a/gr-digital/grc/digital_qam_demod.xml +++ /dev/null @@ -1,146 +0,0 @@ -<?xml version="1.0"?> - -<!-- - Copyright 2009,2010,2011 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. ---> - -<!-- -################################################### -##QAM Demod -################################################### - --> -<block> - <name>QAM Demod</name> - <key>digital_qam_demod</key> - <import>from gnuradio import digital</import> - <make>digital.qam.qam_demod( - constellation_points=$constellation_points, - differential=$differential, - samples_per_symbol=$samples_per_symbol, - excess_bw=$excess_bw, - freq_bw=$freq_bw, - timing_bw=$timing_bw, - phase_bw=$phase_bw, - mod_code=$mod_code, - verbose=$verbose, - log=$log, - )</make> - <param> - <name>Number of Constellation Points</name> - <key>constellation_points</key> - <value>16</value> - <type>int</type> - </param> - <param> - <name>Differential Encoding</name> - <key>differential</key> - <value>True</value> - <type>bool</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Excess BW</name> - <key>excess_bw</key> - <value>0.35</value> - <type>real</type> - </param> - <param> - <name>Frequency BW</name> - <key>freq_bw</key> - <value>6.28/100.0</value> - <type>real</type> - </param> - <param> - <name>Timing BW</name> - <key>timing_bw</key> - <value>6.28/100.0</value> - <type>real</type> - </param> - <param> - <name>Phase BW</name> - <key>phase_bw</key> - <value>6.28/100.0</value> - <type>real</type> - </param> - <param> - <name>Gray Code</name> - <key>mod_code</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>"gray"</key> - </option> - <option> - <name>No</name> - <key>"none"</key> - </option> - </param> - <param> - <name>Verbose</name> - <key>verbose</key> - <value>False</value> - <type>bool</type> - <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <param> - <name>Logging</name> - <key>log</key> - <value>False</value> - <type>bool</type> - <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_qam_mod.xml b/gr-digital/grc/digital_qam_mod.xml deleted file mode 100644 index 4d73d9a68..000000000 --- a/gr-digital/grc/digital_qam_mod.xml +++ /dev/null @@ -1,125 +0,0 @@ -<?xml version="1.0"?> - -<!-- - Copyright 2009,2010,2011 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. ---> - -<!-- -################################################### -##QAM Mod -################################################### - --> -<block> - <name>QAM Mod</name> - <key>digital_qam_mod</key> - <import>from gnuradio import digital</import> - <make>digital.qam.qam_mod( - constellation_points=$constellation_points, - mod_code=$mod_code, - differential=$differential, - samples_per_symbol=$samples_per_symbol, - excess_bw=$excess_bw, - verbose=$verbose, - log=$log, - )</make> - <param> - <name>Number of Constellation Points</name> - <key>constellation_points</key> - <value>16</value> - <type>int</type> - </param> - <param> - <name>Gray Code</name> - <key>mod_code</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>"gray"</key> - </option> - <option> - <name>No</name> - <key>"none"</key> - </option> - </param> - <param> - <name>Differential Encoding</name> - <key>differential</key> - <value>True</value> - <type>bool</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Samples/Symbol</name> - <key>samples_per_symbol</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Excess BW</name> - <key>excess_bw</key> - <value>0.35</value> - <type>real</type> - </param> - <param> - <name>Verbose</name> - <key>verbose</key> - <value>False</value> - <type>bool</type> - <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <param> - <name>Logging</name> - <key>log</key> - <value>False</value> - <type>bool</type> - <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> - <option> - <name>On</name> - <key>True</key> - </option> - <option> - <name>Off</name> - <key>False</key> - </option> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/grc/digital_scrambler_bb.xml b/gr-digital/grc/digital_scrambler_bb.xml deleted file mode 100644 index 9c40b49f6..000000000 --- a/gr-digital/grc/digital_scrambler_bb.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Descrambler -################################################### - --> -<block> - <name>Scrambler</name> - <key>digital_scrambler_bb</key> - <import>from gnuradio import digital</import> - <make>digital.scrambler_bb($mask, $seed, $len)</make> - <param> - <name>Mask</name> - <key>mask</key> - <value>0x8A</value> - <type>hex</type> - </param> - <param> - <name>Seed</name> - <key>seed</key> - <value>0x7F</value> - <type>hex</type> - </param> - <param> - <name>Length</name> - <key>len</key> - <value>7</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_simple_correlator.xml b/gr-digital/grc/digital_simple_correlator.xml deleted file mode 100644 index 3b70e59b1..000000000 --- a/gr-digital/grc/digital_simple_correlator.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Simple Correlator -################################################### - --> -<block> - <name>Simple Correlator</name> - <key>digital_simple_correlator</key> - <import>from gnuradio import digital</import> - <make>digital.simple_correlator($payload_bytesize)</make> - <param> - <name>Payload Byte Size</name> - <key>payload_bytesize</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/grc/digital_simple_framer.xml b/gr-digital/grc/digital_simple_framer.xml deleted file mode 100644 index bbeed32d3..000000000 --- a/gr-digital/grc/digital_simple_framer.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Simple Framer -################################################### - --> -<block> - <name>Simple Framer</name> - <key>digital_simple_framer</key> - <import>from gnuradio import gr</import> - <make>gr.simple_framer($payload_bytesize)</make> - <param> - <name>Payload Byte Size</name> - <key>payload_bytesize</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/include/CMakeLists.txt b/gr-digital/include/CMakeLists.txt deleted file mode 100644 index ad5baec87..000000000 --- a/gr-digital/include/CMakeLists.txt +++ /dev/null @@ -1,130 +0,0 @@ -# Copyright 2011,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. - - -######################################################################## -# generate helper scripts to expand templated files -######################################################################## -include(GrPython) - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " -#!${PYTHON_EXECUTABLE} - -import sys, os, re -sys.path.append('${GR_CORE_PYTHONPATH}') -os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.chdir('${CMAKE_CURRENT_BINARY_DIR}') - -if __name__ == '__main__': - import build_utils - root, inp = sys.argv[1:3] - for sig in sys.argv[3:]: - name = re.sub ('X+', sig, root) - d = build_utils.standard_dict(name, sig, 'digital') - build_utils.expand_template(d, inp) - -") - -macro(expand_h root) - #make a list of all the generated files - unset(expanded_files_h) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) - endforeach(sig) - - #create a command to generate the files - add_custom_command( - OUTPUT ${expanded_files_h} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.h.t ${ARGN} - ) - - #install rules for the generated h files - list(APPEND generated_includes ${expanded_files_h}) -endmacro(expand_h) - -######################################################################## -# Invoke macro to generate various sources -######################################################################## -expand_h(digital_chunks_to_symbols_XX bf bc sf sc if ic) - -add_custom_target(digital_generated_includes DEPENDS - ${generated_includes} -) - -######################################################################## -# Install header files -######################################################################## -install(FILES - ${generated_includes} - digital_api.h - digital_impl_glfsr.h - digital_impl_mpsk_snr_est.h - digital_additive_scrambler_bb.h - digital_binary_slicer_fb.h - digital_bytes_to_syms.h - digital_clock_recovery_mm_cc.h - digital_clock_recovery_mm_ff.h - digital_cma_equalizer_cc.h - digital_cpmmod_bc.h - digital_constellation.h - digital_constellation_receiver_cb.h - digital_constellation_decoder_cb.h - digital_correlate_access_code_bb.h - digital_correlate_access_code_tag_bb.h - digital_costas_loop_cc.h - digital_crc32.h - digital_descrambler_bb.h - digital_diff_decoder_bb.h - digital_diff_encoder_bb.h - digital_diff_phasor_cc.h - digital_framer_sink_1.h - digital_fll_band_edge_cc.h - digital_glfsr_source_b.h - digital_glfsr_source_f.h - digital_gmskmod_bc.h - digital_lms_dd_equalizer_cc.h - digital_kurtotic_equalizer_cc.h - digital_map_bb.h - digital_metric_type.h - digital_mpsk_receiver_cc.h - digital_mpsk_snr_est_cc.h - digital_ofdm_cyclic_prefixer.h - digital_ofdm_frame_acquisition.h - digital_ofdm_frame_sink.h - digital_ofdm_insert_preamble.h - digital_ofdm_mapper_bcv.h - digital_ofdm_sampler.h - digital_packet_sink.h - digital_pfb_clock_sync_ccf.h - digital_pfb_clock_sync_fff.h - digital_pn_correlator_cc.h - digital_probe_density_b.h - digital_probe_mpsk_snr_est_c.h - digital_scrambler_bb.h - digital_simple_framer.h - digital_simple_framer_sync.h - digital_simple_correlator.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "digital_devel" -) - diff --git a/gr-digital/include/digital_additive_scrambler_bb.h b/gr-digital/include/digital_additive_scrambler_bb.h deleted file mode 100644 index f1d0113e9..000000000 --- a/gr-digital/include/digital_additive_scrambler_bb.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,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 INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H -#define INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <analog/lfsr.h> - -class digital_additive_scrambler_bb; -typedef boost::shared_ptr<digital_additive_scrambler_bb> digital_additive_scrambler_bb_sptr; - -DIGITAL_API digital_additive_scrambler_bb_sptr -digital_make_additive_scrambler_bb(int mask, int seed, - int len, int count=0); - -/*! - * Scramble an input stream using an LFSR. This block works on the LSB only - * of the input data stream, i.e., on an "unpacked binary" stream, and - * produces the same format on its output. - * - * \param mask Polynomial mask for LFSR - * \param seed Initial shift register contents - * \param len Shift register length - * \param count Number of bits after which shift register is reset, 0=never - * - * The scrambler works by XORing the incoming bit stream by the output of - * the LFSR. Optionally, after 'count' bits have been processed, the shift - * register is reset to the seed value. This allows processing fixed length - * vectors of samples. - * - * \ingroup coding_blk - */ - -class DIGITAL_API digital_additive_scrambler_bb : public gr_sync_block -{ - friend DIGITAL_API digital_additive_scrambler_bb_sptr - digital_make_additive_scrambler_bb(int mask, int seed, - int len, int count); - - gr::analog::lfsr d_lfsr; - int d_count; - int d_bits; - - digital_additive_scrambler_bb(int mask, int seed, - int len, int count); - -public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H */ diff --git a/gr-digital/include/digital_api.h b/gr-digital/include/digital_api.h deleted file mode 100644 index d45ace13f..000000000 --- a/gr-digital/include/digital_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_DIGITAL_API_H -#define INCLUDED_DIGITAL_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_digital_EXPORTS -# define DIGITAL_API __GR_ATTR_EXPORT -#else -# define DIGITAL_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_DIGITAL_API_H */ diff --git a/gr-digital/include/digital_binary_slicer_fb.h b/gr-digital/include/digital_binary_slicer_fb.h deleted file mode 100644 index 35a7380fb..000000000 --- a/gr-digital/include/digital_binary_slicer_fb.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2011 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 INCLUDED_DIGITAL_BINARY_SLICER_FB_H -#define INCLUDED_DIGITAL_BINARY_SLICER_FB_H - -#include <digital_api.h> -#include <gr_sync_block.h> - -class digital_binary_slicer_fb; -typedef boost::shared_ptr<digital_binary_slicer_fb> digital_binary_slicer_fb_sptr; - -DIGITAL_API digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb (); - -/*! - * \brief slice float binary symbol outputting 1 bit output - * \ingroup converter_blk - * \ingroup digital - * - * x < 0 --> 0 - * x >= 0 --> 1 - */ -class DIGITAL_API digital_binary_slicer_fb : public gr_sync_block -{ - friend DIGITAL_API digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb (); - digital_binary_slicer_fb (); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-digital/include/digital_bytes_to_syms.h b/gr-digital/include/digital_bytes_to_syms.h deleted file mode 100644 index 3062366b9..000000000 --- a/gr-digital/include/digital_bytes_to_syms.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_GR_BYTES_TO_SYMS_H -#define INCLUDED_GR_BYTES_TO_SYMS_H - -#include <digital_api.h> -#include <gr_sync_interpolator.h> - -class digital_bytes_to_syms; -typedef boost::shared_ptr<digital_bytes_to_syms> digital_bytes_to_syms_sptr; - -DIGITAL_API digital_bytes_to_syms_sptr digital_make_bytes_to_syms(); - -/*! - * \brief Convert stream of bytes to stream of +/- 1 symbols - * \ingroup converter_blk - * - * input: stream of bytes; output: stream of float - * - * This block is deprecated. - * - * The combination of gr_packed_to_unpacked_bb followed by - * gr_chunks_to_symbols_bf or gr_chunks_to_symbols_bc handles the - * general case of mapping from a stream of bytes into arbitrary float - * or complex symbols. - * - * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb, - * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc. - */ -class DIGITAL_API digital_bytes_to_syms : public gr_sync_interpolator -{ - friend DIGITAL_API digital_bytes_to_syms_sptr - digital_make_bytes_to_syms(); - - digital_bytes_to_syms(); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_BYTES_TO_SYMS_H */ diff --git a/gr-digital/include/digital_chunks_to_symbols_XX.h.t b/gr-digital/include/digital_chunks_to_symbols_XX.h.t deleted file mode 100644 index 92b7c94d5..000000000 --- a/gr-digital/include/digital_chunks_to_symbols_XX.h.t +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <digital_api.h> -#include <gr_sync_interpolator.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -DIGITAL_API @SPTR_NAME@ -digital_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1); - -/*! - * \brief Map a stream of symbol indexes (unpacked bytes or shorts) to stream of float or complex constellation points in D dimensions (D = 1 by default) - * \ingroup converter_blk - * - * input: stream of @I_TYPE@; output: stream of @O_TYPE@ - * - * out[n D + k] = symbol_table[in[n] D + k], k=0,1,...,D-1 - * - * The combination of gr_packed_to_unpacked_XX followed by - * gr_chunks_to_symbols_XY handles the general case of mapping - * from a stream of bytes or shorts into arbitrary float - * or complex symbols. - * - * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb, - * \sa gr_packed_to_unpacked_ss, gr_unpacked_to_packed_ss, - * \sa digital_chunks_to_symbols_bf, digital_chunks_to_symbols_bc. - * \sa digital_chunks_to_symbols_sf, digital_chunks_to_symbols_sc. - */ - -class DIGITAL_API @NAME@ : public gr_sync_interpolator -{ - friend DIGITAL_API @SPTR_NAME@ digital_make_@BASE_NAME@ - (const std::vector<@O_TYPE@> &symbol_table, const int D); - - int d_D; - std::vector<@O_TYPE@> d_symbol_table; - @NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1); - - public: - int D () const { return d_D; } - std::vector<@O_TYPE@> symbol_table () const { return d_symbol_table; } - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - bool check_topology(int ninputs, int noutputs) { return ninputs == noutputs; } -}; - -#endif diff --git a/gr-digital/include/digital_clock_recovery_mm_cc.h b/gr-digital/include/digital_clock_recovery_mm_cc.h deleted file mode 100644 index a2577d537..000000000 --- a/gr-digital/include/digital_clock_recovery_mm_cc.h +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011 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 INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H -#define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H - -#include <digital_api.h> -#include <gr_block.h> -#include <gr_complex.h> -#include <gr_math.h> - -class gri_mmse_fir_interpolator_cc; - -class digital_clock_recovery_mm_cc; -typedef boost::shared_ptr<digital_clock_recovery_mm_cc> digital_clock_recovery_mm_cc_sptr; - -// public constructor -DIGITAL_API digital_clock_recovery_mm_cc_sptr -digital_make_clock_recovery_mm_cc (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit=0.001); - -/*! - * \brief Mueller and Müller (M&M) based clock recovery block with complex input, complex output. - * \ingroup sync_blk - * \ingroup digital - * - * This implements the Mueller and Müller (M&M) discrete-time - * error-tracking synchronizer. - * - * The complex version here is based on: - * Modified Mueller and Muller clock recovery circuit - * Based: - * G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller - * and Muller algorithm," Electronics Letters, Vol. 31, no. 13, 22 - * June 1995, pp. 1032 - 1033. - */ -class DIGITAL_API digital_clock_recovery_mm_cc : public gr_block -{ - public: - ~digital_clock_recovery_mm_cc (); - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - float mu() const { return d_mu;} - float omega() const { return d_omega;} - float gain_mu() const { return d_gain_mu;} - float gain_omega() const { return d_gain_omega;} - void set_verbose (bool verbose) { d_verbose = verbose; } - - void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } - void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } - void set_mu (float mu) { d_mu = mu; } - void set_omega (float omega) { - d_omega = omega; - d_min_omega = omega*(1.0 - d_omega_relative_limit); - d_max_omega = omega*(1.0 + d_omega_relative_limit); - d_omega_mid = 0.5*(d_min_omega+d_max_omega); - } - -protected: - digital_clock_recovery_mm_cc (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limi); - - private: - float d_mu; - float d_omega; - float d_gain_omega; - float d_min_omega; // minimum allowed omega - float d_max_omega; // maximum allowed omeg - float d_omega_relative_limit; // used to compute min and max omega - float d_omega_mid; - float d_gain_mu; - gr_complex d_last_sample; - gri_mmse_fir_interpolator_cc *d_interp; - bool d_verbose; - - gr_complex d_p_2T; - gr_complex d_p_1T; - gr_complex d_p_0T; - - gr_complex d_c_2T; - gr_complex d_c_1T; - gr_complex d_c_0T; - - gr_complex slicer_0deg (gr_complex sample); - gr_complex slicer_45deg (gr_complex sample); - - friend DIGITAL_API digital_clock_recovery_mm_cc_sptr - digital_make_clock_recovery_mm_cc (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit); -}; - -#endif diff --git a/gr-digital/include/digital_clock_recovery_mm_ff.h b/gr-digital/include/digital_clock_recovery_mm_ff.h deleted file mode 100644 index 36749553f..000000000 --- a/gr-digital/include/digital_clock_recovery_mm_ff.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011 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 INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H -#define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H - -#include <digital_api.h> -#include <gr_block.h> -#include <gr_math.h> -#include <stdio.h> - -class gri_mmse_fir_interpolator; - -class digital_clock_recovery_mm_ff; -typedef boost::shared_ptr<digital_clock_recovery_mm_ff> digital_clock_recovery_mm_ff_sptr; - -// public constructor -DIGITAL_API digital_clock_recovery_mm_ff_sptr -digital_make_clock_recovery_mm_ff (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit=0.001); - -/*! - * \brief Mueller and Müller (M&M) based clock recovery block with float input, float output. - * \ingroup sync_blk - * \ingroup digital - * - * This implements the Mueller and Müller (M&M) discrete-time error-tracking synchronizer. - * - * See "Digital Communication Receivers: Synchronization, Channel - * Estimation and Signal Processing" by Heinrich Meyr, Marc Moeneclaey, & Stefan Fechtel. - * ISBN 0-471-50275-8. - */ -class DIGITAL_API digital_clock_recovery_mm_ff : public gr_block -{ - public: - ~digital_clock_recovery_mm_ff (); - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - float mu() const { return d_mu;} - float omega() const { return d_omega;} - float gain_mu() const { return d_gain_mu;} - float gain_omega() const { return d_gain_omega;} - - void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } - void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } - void set_mu (float mu) { d_mu = mu; } - void set_omega (float omega){ - d_omega = omega; - d_min_omega = omega*(1.0 - d_omega_relative_limit); - d_max_omega = omega*(1.0 + d_omega_relative_limit); - d_omega_mid = 0.5*(d_min_omega+d_max_omega); - } - -protected: - digital_clock_recovery_mm_ff (float omega, float gain_omega, float mu, float gain_mu, - float omega_relative_limit); - - private: - float d_mu; // fractional sample position [0.0, 1.0] - float d_omega; // nominal frequency - float d_min_omega; // minimum allowed omega - float d_omega_mid; // average omega - float d_max_omega; // maximum allowed omega - float d_gain_omega; // gain for adjusting omega - float d_gain_mu; // gain for adjusting mu - float d_last_sample; - gri_mmse_fir_interpolator *d_interp; - FILE *d_logfile; - float d_omega_relative_limit; // used to compute min and max omega - - friend DIGITAL_API digital_clock_recovery_mm_ff_sptr - digital_make_clock_recovery_mm_ff (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit); -}; - -#endif diff --git a/gr-digital/include/digital_cma_equalizer_cc.h b/gr-digital/include/digital_cma_equalizer_cc.h deleted file mode 100644 index 79e84ca4b..000000000 --- a/gr-digital/include/digital_cma_equalizer_cc.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H -#define INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H - -#include <digital_api.h> -#include <gr_adaptive_fir_ccc.h> -#include <gr_math.h> -#include <iostream> - -class digital_cma_equalizer_cc; -typedef boost::shared_ptr<digital_cma_equalizer_cc> digital_cma_equalizer_cc_sptr; - -DIGITAL_API digital_cma_equalizer_cc_sptr -digital_make_cma_equalizer_cc(int num_taps, float modulus, float mu, int sps); - -/*! - * \brief Implements constant modulus adaptive filter on complex stream - * \ingroup eq_blk - * \ingroup digital - * - * The error value and tap update equations (for p=2) can be found in: - * - * "D. Godard, "Self-Recovering Equalization and Carrier Tracking in - * Two-Dimensional Data Communication Systems," IEEE Transactions on - * Communications, Vol. 28, No. 11, pp. 1867 - 1875, 1980." - */ -class DIGITAL_API digital_cma_equalizer_cc : public gr_adaptive_fir_ccc -{ -private: - float d_modulus; - float d_mu; - - friend DIGITAL_API digital_cma_equalizer_cc_sptr digital_make_cma_equalizer_cc(int num_taps, - float modulus, - float mu, - int sps); - digital_cma_equalizer_cc(int num_taps, float modulus, float mu, int sps); - -protected: - - virtual gr_complex error(const gr_complex &out) - { - gr_complex error = out*(norm(out) - d_modulus); - float re = gr_clip(error.real(), 1.0); - float im = gr_clip(error.imag(), 1.0); - return gr_complex(re, im); - } - - virtual void update_tap(gr_complex &tap, const gr_complex &in) - { - // Hn+1 = Hn - mu*conj(Xn)*zn*(|zn|^2 - 1) - tap -= d_mu*conj(in)*d_error; - } - -public: - float get_gain() - { - return d_mu; - } - - void set_gain(float mu) - { - if(mu < 0.0f || mu > 1.0f) { - throw std::out_of_range("digital_cma_equalizer::set_gain: Gain value must be in [0,1]"); - } - d_mu = mu; - } - - float get_modulus() - { - return d_modulus; - } - - void set_modulus(float mod) - { - if(mod < 0) - throw std::out_of_range("digital_cma_equalizer::set_modulus: Modulus value must be >= 0"); - d_modulus = mod; - } -}; - -#endif diff --git a/gr-digital/include/digital_constellation.h b/gr-digital/include/digital_constellation.h deleted file mode 100644 index 9d34d951f..000000000 --- a/gr-digital/include/digital_constellation.h +++ /dev/null @@ -1,454 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010, 2011 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 INCLUDED_DIGITAL_CONSTELLATION_H -#define INCLUDED_DIGITAL_CONSTELLATION_H - -#include <digital_api.h> -#include <vector> -#include <math.h> -#include <gr_complex.h> -#include <boost/enable_shared_from_this.hpp> -#include <digital_metric_type.h> - -/************************************************************/ -/* digital_constellation */ -/* */ -/* Base class defining interface. */ -/************************************************************/ - -class digital_constellation; -typedef boost::shared_ptr<digital_constellation> digital_constellation_sptr; - -/*! - * \brief An abstracted constellation object - * \ingroup digital - * - * The constellation objects hold the necessary information to pass - * around constellation information for modulators and - * demodulators. These objects contain the mapping between the bits - * and the constellation points used to represent them as well as - * methods for slicing the symbol space. Various implementations are - * possible for efficiency and ease of use. - * - * Standard constellations (BPSK, QPSK, QAM, etc) can be inherited - * from this class and overloaded to perform optimized slicing and - * constellation mappings. - */ -class DIGITAL_API digital_constellation : public boost::enable_shared_from_this<digital_constellation> -{ -public: - digital_constellation (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality); - digital_constellation (); - - virtual ~digital_constellation(); - - //! Returns the constellation points for a symbol value - void map_to_points(unsigned int value, gr_complex *points); - std::vector<gr_complex> map_to_points_v(unsigned int value); - - //! Returns the constellation point that matches best. - virtual unsigned int decision_maker (const gr_complex *sample) = 0; - //! Takes a vector rather than a pointer. Better for SWIG wrapping. - unsigned int decision_maker_v (std::vector<gr_complex> sample); - //! Also calculates the phase error. - unsigned int decision_maker_pe (const gr_complex *sample, float *phase_error); - //! Calculates distance. - unsigned int decision_maker_e (const gr_complex *sample, float *error); - - //! Calculates metrics for all points in the constellation. - //! For use with the viterbi algorithm. - virtual void calc_metric(const gr_complex *sample, float *metric, trellis_metric_type_t type); - virtual void calc_euclidean_metric(const gr_complex *sample, float *metric); - virtual void calc_hard_symbol_metric(const gr_complex *sample, float *metric); - - //! Returns the set of points in this constellation. - std::vector<gr_complex> points() { return d_constellation;} - //! Returns the vector of points in this constellation. - //! Raise error if dimensionality is not one. - std::vector<gr_complex> s_points(); - //! Returns a vector of vectors of points. - std::vector<std::vector<gr_complex> > v_points(); - //! Whether to apply an encoding before doing differential encoding. (e.g. gray coding) - bool apply_pre_diff_code() { return d_apply_pre_diff_code;} - //! Whether to apply an encoding before doing differential encoding. (e.g. gray coding) - void set_pre_diff_code(bool a) { d_apply_pre_diff_code = a;} - //! Returns the encoding to apply before differential encoding. - std::vector<unsigned int> pre_diff_code() { return d_pre_diff_code;} - //! Returns the order of rotational symmetry. - unsigned int rotational_symmetry() { return d_rotational_symmetry;} - //! Returns the number of complex numbers in a single symbol. - unsigned int dimensionality() {return d_dimensionality;} - - unsigned int bits_per_symbol () { - return floor(log(double(d_constellation.size()))/d_dimensionality/log(2.0)); - } - - unsigned int arity () { - return d_arity; - } - - digital_constellation_sptr base() { - return shared_from_this(); - } - - protected: - - std::vector<gr_complex> d_constellation; - std::vector<unsigned int> d_pre_diff_code; - bool d_apply_pre_diff_code; - unsigned int d_rotational_symmetry; - unsigned int d_dimensionality; - unsigned int d_arity; - // The orignal constellation points were multiplied by this factor to get a - // constellation with average magnitude 1. - float d_scalefactor; - - float get_distance(unsigned int index, const gr_complex *sample); - unsigned int get_closest_point(const gr_complex *sample); - void calc_arity (); -}; - -/************************************************************/ -/* digital_constellation_calcdist */ -/* */ -/************************************************************/ - -class digital_constellation_calcdist; -typedef boost::shared_ptr<digital_constellation_calcdist> digital_constellation_calcdist_sptr; - -// public constructor -DIGITAL_API digital_constellation_calcdist_sptr -digital_make_constellation_calcdist (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality); - - -/*! \brief Calculate Euclidian distance for any constellation - * \ingroup digital - * - * Constellation which calculates the distance to each point in the - * constellation for decision making. Inefficient for large - * constellations. - */ -class DIGITAL_API digital_constellation_calcdist : public digital_constellation -{ - public: - digital_constellation_calcdist (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality); - unsigned int decision_maker (const gr_complex *sample); - // void calc_metric(gr_complex *sample, float *metric, trellis_metric_type_t type); - // void calc_euclidean_metric(gr_complex *sample, float *metric); - // void calc_hard_symbol_metric(gr_complex *sample, float *metric); - - private: - friend DIGITAL_API digital_constellation_calcdist_sptr - digital_make_constellation_calcdist (std::vector<gr_complex> constellation); -}; - - -/************************************************************/ -/*! digital_constellation_sector */ -/************************************************************/ - -/*! - * \brief Sectorized digital constellation - * \ingroup digital - * - * Constellation space is divided into sectors. Each sector is - * associated with the nearest constellation point. - * - */ -class DIGITAL_API digital_constellation_sector : public digital_constellation -{ - public: - - digital_constellation_sector (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality, - unsigned int n_sectors); - - unsigned int decision_maker (const gr_complex *sample); - - protected: - - virtual unsigned int get_sector (const gr_complex *sample) = 0; - virtual unsigned int calc_sector_value (unsigned int sector) = 0; - void find_sector_values (); - - unsigned int n_sectors; - - private: - - std::vector<unsigned int> sector_values; - -}; - -/************************************************************/ -/* digital_constellation_rect */ -/************************************************************/ - -/*! - * \brief Rectangular digital constellation - * \ingroup digital - * - * Only implemented for 1-(complex)dimensional constellation. - * - * Constellation space is divided into rectangular sectors. Each - * sector is associated with the nearest constellation point. - * - * Works well for square QAM. - * - * Works for any generic constellation provided sectors are not too - * large. - */ - -class digital_constellation_rect; -typedef boost::shared_ptr<digital_constellation_rect> digital_constellation_rect_sptr; - -// public constructor -DIGITAL_API digital_constellation_rect_sptr -digital_make_constellation_rect (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int real_sectors, - unsigned int imag_sectors, - float width_real_sectors, - float width_imag_sectors); - -class DIGITAL_API digital_constellation_rect : public digital_constellation_sector -{ - public: - - digital_constellation_rect (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int real_sectors, - unsigned int imag_sectors, - float width_real_sectors, - float width_imag_sectors); - - protected: - - unsigned int get_sector (const gr_complex *sample); - - unsigned int calc_sector_value (unsigned int sector); - - private: - - unsigned int n_real_sectors; - unsigned int n_imag_sectors; - float d_width_real_sectors; - float d_width_imag_sectors; - - friend DIGITAL_API digital_constellation_rect_sptr - digital_make_constellation_rect (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int real_sectors, - unsigned int imag_sectors, - float width_real_sectors, - float width_imag_sectors); - -}; - - -/************************************************************/ -/* digital_constellation_psk */ -/************************************************************/ - -class digital_constellation_psk; -typedef boost::shared_ptr<digital_constellation_psk> digital_constellation_psk_sptr; - -// public constructor -DIGITAL_API digital_constellation_psk_sptr -digital_make_constellation_psk (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int n_sectors); - -/*! - * \brief digital_constellation_psk - * \ingroup digital - * - * Constellation space is divided into pie slices sectors. - * - * Each slice is associated with the nearest constellation point. - * - * Works well for PSK but nothing else. - * - * Assumes that there is a constellation point at 1.x - */ -class DIGITAL_API digital_constellation_psk : public digital_constellation_sector -{ - public: - - digital_constellation_psk (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int n_sectors); - - protected: - - unsigned int get_sector (const gr_complex *sample); - - unsigned int calc_sector_value (unsigned int sector); - - private: - - friend DIGITAL_API digital_constellation_psk_sptr - digital_make_constellation_psk (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int n_sectors); - -}; - - -/************************************************************/ -/* digital_constellation_bpsk */ -/* */ -/* Only works for BPSK. */ -/* */ -/************************************************************/ - -class digital_constellation_bpsk; -typedef boost::shared_ptr<digital_constellation_bpsk> digital_constellation_bpsk_sptr; - -// public constructor -DIGITAL_API digital_constellation_bpsk_sptr -digital_make_constellation_bpsk (); - -/*! - * \brief Digital constellation for BPSK - * \ingroup digital - */ -class DIGITAL_API digital_constellation_bpsk : public digital_constellation -{ - public: - - digital_constellation_bpsk (); - unsigned int decision_maker (const gr_complex *sample); - - friend DIGITAL_API digital_constellation_bpsk_sptr - digital_make_constellation_bpsk (); - -}; - - -/************************************************************/ -/* digital_constellation_qpsk */ -/* */ -/* Only works for QPSK. */ -/* */ -/************************************************************/ - -class digital_constellation_qpsk; -typedef boost::shared_ptr<digital_constellation_qpsk> digital_constellation_qpsk_sptr; - -// public constructor -DIGITAL_API digital_constellation_qpsk_sptr -digital_make_constellation_qpsk (); - -/*! - * \brief Digital constellation for QPSK - * \ingroup digital - */ -class DIGITAL_API digital_constellation_qpsk : public digital_constellation -{ - public: - - digital_constellation_qpsk (); - unsigned int decision_maker (const gr_complex *sample); - - friend DIGITAL_API digital_constellation_qpsk_sptr - digital_make_constellation_qpsk (); - -}; - - -/************************************************************/ -/* digital_constellation_dqpsk */ -/* */ -/* Works with differential encoding; slower decisions. */ -/* */ -/************************************************************/ - -class digital_constellation_dqpsk; -typedef boost::shared_ptr<digital_constellation_dqpsk> digital_constellation_dqpsk_sptr; - -// public constructor -DIGITAL_API digital_constellation_dqpsk_sptr -digital_make_constellation_dqpsk (); - -/*! - * \brief Digital constellation for DQPSK - * \ingroup digital - */ -class DIGITAL_API digital_constellation_dqpsk : public digital_constellation -{ - public: - - digital_constellation_dqpsk (); - unsigned int decision_maker (const gr_complex *sample); - - friend DIGITAL_API digital_constellation_dqpsk_sptr - digital_make_constellation_dqpsk (); - -}; - - -/************************************************************/ -/* digital_constellation_8psk */ -/* */ -/* Only works for 8PSK. */ -/* */ -/************************************************************/ - -class digital_constellation_8psk; -typedef boost::shared_ptr<digital_constellation_8psk> digital_constellation_8psk_sptr; - -// public constructor -DIGITAL_API digital_constellation_8psk_sptr -digital_make_constellation_8psk (); - -/*! - * \brief Digital constellation for 8PSK - * \ingroup digital - */ -class DIGITAL_API digital_constellation_8psk : public digital_constellation -{ - public: - - digital_constellation_8psk (); - unsigned int decision_maker (const gr_complex *sample); - - friend DIGITAL_API digital_constellation_8psk_sptr - digital_make_constellation_8psk (); - -}; - -#endif diff --git a/gr-digital/include/digital_constellation_decoder_cb.h b/gr-digital/include/digital_constellation_decoder_cb.h deleted file mode 100644 index cce3a564f..000000000 --- a/gr-digital/include/digital_constellation_decoder_cb.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_H -#define INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_H - -#include <digital_api.h> -#include <gr_block.h> -#include <digital_constellation.h> -#include <vector> - -class digital_constellation_decoder_cb; -typedef boost::shared_ptr<digital_constellation_decoder_cb>digital_constellation_decoder_cb_sptr; - -DIGITAL_API digital_constellation_decoder_cb_sptr -digital_make_constellation_decoder_cb (digital_constellation_sptr constellation); - -/*! - * \brief Constellation Decoder - * \ingroup coding_blk - * \ingroup digital - * - */ -class DIGITAL_API digital_constellation_decoder_cb : public gr_block -{ - - private: - digital_constellation_sptr d_constellation; - unsigned int d_dim; - - friend DIGITAL_API digital_constellation_decoder_cb_sptr - digital_make_constellation_decoder_cb (digital_constellation_sptr constellation); - - digital_constellation_decoder_cb (digital_constellation_sptr constellation); - - public: - - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-digital/include/digital_constellation_receiver_cb.h b/gr-digital/include/digital_constellation_receiver_cb.h deleted file mode 100644 index 92c31311f..000000000 --- a/gr-digital/include/digital_constellation_receiver_cb.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H -#define INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H - -#include <digital_api.h> -#include <gr_block.h> -#include <digital_constellation.h> -#include <gruel/attributes.h> -#include <gri_control_loop.h> -#include <gr_complex.h> -#include <math.h> -#include <fstream> - -class digital_constellation_receiver_cb; -typedef boost::shared_ptr<digital_constellation_receiver_cb> digital_constellation_receiver_cb_sptr; - -// public constructor -DIGITAL_API digital_constellation_receiver_cb_sptr -digital_make_constellation_receiver_cb (digital_constellation_sptr constellation, - float loop_bw, float fmin, float fmax); - -/*! - * \brief This block does fine-phase and frequency locking and decision making. - * \ingroup sync_blk - * \ingroup demod_blk - * \ingroup digital - * - * The phase and frequency synchronization are based on a Costas loop - * that finds the error of the incoming signal point compared to its - * nearest constellation point. The frequency and phase of the NCO are - * updated according to this error. - * - * The decicision making itself is performed by the appropriate method of the - * passed constellation object. - * - */ - -class DIGITAL_API digital_constellation_receiver_cb : public gr_block, public gri_control_loop -{ -public: - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -protected: - - /*! - * \brief Constructor to synchronize incoming M-PSK symbols - * - * \param constellation constellation object for generic demodulation - * \param loop_bw Loop bandwidth of the Costas Loop (~ 2pi/100) - * \param fmin minimum normalized frequency value the loop can achieve - * \param fmax maximum normalized frequency value the loop can achieve - * - */ - digital_constellation_receiver_cb (digital_constellation_sptr constellation, - float loop_bw, float fmin, float fmax); - - void phase_error_tracking(float phase_error); - -private: - unsigned int d_M; - - digital_constellation_sptr d_constellation; - unsigned int d_current_const_point; - - //! delay line length. - static const unsigned int DLLEN = 8; - - //! delay line plus some length for overflow protection - __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN]; - - //! index to delay line - unsigned int d_dl_idx; - - friend DIGITAL_API digital_constellation_receiver_cb_sptr - digital_make_constellation_receiver_cb (digital_constellation_sptr constell, - float loop_bw, float fmin, float fmax); -}; - -#endif diff --git a/gr-digital/include/digital_correlate_access_code_bb.h b/gr-digital/include/digital_correlate_access_code_bb.h deleted file mode 100644 index 8095dd409..000000000 --- a/gr-digital/include/digital_correlate_access_code_bb.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2011 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 INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H -#define INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <string> - -class digital_correlate_access_code_bb; -typedef boost::shared_ptr<digital_correlate_access_code_bb> digital_correlate_access_code_bb_sptr; - -/*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - * \param threshold maximum number of bits that may be wrong - */ -DIGITAL_API digital_correlate_access_code_bb_sptr -digital_make_correlate_access_code_bb (const std::string &access_code, int threshold); - -/*! - * \brief Examine input for specified access code, one bit at a time. - * \ingroup sync_blk - * \ingroup digital - * - * input: stream of bits, 1 bit per input byte (data in LSB) - * output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit) - * - * Each output byte contains two valid bits, the data bit, and the - * flag bit. The LSB (bit 0) is the data bit, and is the original - * input data, delayed 64 bits. Bit 1 is the - * flag bit and is 1 if the corresponding data bit is the first data - * bit following the access code. Otherwise the flag bit is 0. - */ -class DIGITAL_API digital_correlate_access_code_bb : public gr_sync_block -{ - friend DIGITAL_API digital_correlate_access_code_bb_sptr - digital_make_correlate_access_code_bb (const std::string &access_code, int threshold); - private: - unsigned long long d_access_code; // access code to locate start of packet - // access code is left justified in the word - unsigned long long d_data_reg; // used to look for access_code - unsigned long long d_flag_reg; // keep track of decisions - unsigned long long d_flag_bit; // mask containing 1 bit which is location of new flag - unsigned long long d_mask; // masks access_code bits (top N bits are set where - // N is the number of bits in the access code) - unsigned int d_threshold; // how many bits may be wrong in sync vector - - protected: - digital_correlate_access_code_bb(const std::string &access_code, int threshold); - - public: - ~digital_correlate_access_code_bb(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - - /*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - */ - bool set_access_code (const std::string &access_code); -}; - -#endif /* INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H */ diff --git a/gr-digital/include/digital_correlate_access_code_tag_bb.h b/gr-digital/include/digital_correlate_access_code_tag_bb.h deleted file mode 100644 index b4a12108f..000000000 --- a/gr-digital/include/digital_correlate_access_code_tag_bb.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2011,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 INCLUDED_digital_correlate_access_code_tag_bb_H -#define INCLUDED_digital_correlate_access_code_tag_bb_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <string> - -class digital_correlate_access_code_tag_bb; -typedef boost::shared_ptr<digital_correlate_access_code_tag_bb> digital_correlate_access_code_tag_bb_sptr; - -/*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - * \param threshold maximum number of bits that may be wrong - * \param tag_name key of the tag inserted into the tag stream - */ -DIGITAL_API digital_correlate_access_code_tag_bb_sptr -digital_make_correlate_access_code_tag_bb(const std::string &access_code, - int threshold, - const std::string &tag_name); - -/*! - * \brief Examine input for specified access code, one bit at a time. - * \ingroup sync_blk - * - * input: stream of bits, 1 bit per input byte (data in LSB) - * output: unaltered stream of bits (plus tags) - * - * This block annotates the input stream with tags. The tags have key - * name [tag_name], specified in the constructor. Used for searching - * an input data stream for preambles, etc. - */ -class DIGITAL_API digital_correlate_access_code_tag_bb : public gr_sync_block -{ - friend DIGITAL_API digital_correlate_access_code_tag_bb_sptr - digital_make_correlate_access_code_tag_bb(const std::string &access_code, - int threshold, - const std::string &tag_name); - private: - unsigned long long d_access_code; // access code to locate start of packet - // access code is left justified in the word - unsigned long long d_data_reg; // used to look for access_code - unsigned long long d_mask; // masks access_code bits (top N bits are set where - // N is the number of bits in the access code) - unsigned int d_threshold; // how many bits may be wrong in sync vector - unsigned int d_len; // the length of the access code - - pmt::pmt_t d_key, d_me; //d_key is the tag name, d_me is the block name + unique ID - - protected: - digital_correlate_access_code_tag_bb(const std::string &access_code, - int threshold, - const std::string &tag_name); - - public: - ~digital_correlate_access_code_tag_bb(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - /*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - */ - bool set_access_code(const std::string &access_code); -}; - -#endif /* INCLUDED_digital_correlate_access_code_tag_bb_H */ diff --git a/gr-digital/include/digital_costas_loop_cc.h b/gr-digital/include/digital_costas_loop_cc.h deleted file mode 100644 index 4aab22fb4..000000000 --- a/gr-digital/include/digital_costas_loop_cc.h +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2011 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 INCLUDED_DIGITAL_COSTAS_LOOP_CC_H -#define INCLUDED_DIGITAL_COSTAS_LOOP_CC_H - -#include <gr_sync_block.h> -#include <gri_control_loop.h> -#include <stdexcept> -#include <fstream> - - -/*! - * \brief A Costas loop carrier recovery module. - * \ingroup sync_blk - * \ingroup digital - * - * The Costas loop locks to the center frequency of a signal and - * downconverts it to baseband. The second (order=2) order loop is - * used for BPSK where the real part of the output signal is the - * baseband BPSK signal and the imaginary part is the error - * signal. When order=4, it can be used for quadrature modulations - * where both I and Q (real and imaginary) are outputted. - * - * More details can be found online: - * - * J. Feigin, "Practical Costas loop design: Designing a simple and - * inexpensive BPSK Costas loop carrier recovery circuit," RF signal - * processing, pp. 20-36, 2002. - * - * http://rfdesign.com/images/archive/0102Feigin20.pdf - * - * \param loop_bw internal 2nd order loop bandwidth (~ 2pi/100) - * \param order the loop order, either 2, 4, or 8 - */ - -#include <digital_api.h> - -class digital_costas_loop_cc; -typedef boost::shared_ptr<digital_costas_loop_cc> digital_costas_loop_cc_sptr; - - -DIGITAL_API digital_costas_loop_cc_sptr -digital_make_costas_loop_cc (float loop_bw, int order - ) throw (std::invalid_argument); - - -/*! - * \brief Carrier tracking PLL for QPSK - * \ingroup sync_blk - * input: complex; output: complex - * <br>The Costas loop can have two output streams: - * stream 1 is the baseband I and Q; - * stream 2 is the normalized frequency of the loop - * - * \p order must be 2, 4, or 8. - */ -class DIGITAL_API digital_costas_loop_cc : public gr_sync_block, public gri_control_loop -{ - friend DIGITAL_API digital_costas_loop_cc_sptr - digital_make_costas_loop_cc (float loop_bw, int order - ) throw (std::invalid_argument); - - int d_order; - - digital_costas_loop_cc (float loop_bw, int order - ) throw (std::invalid_argument); - - /*! \brief the phase detector circuit for 8th-order PSK loops - * \param sample complex sample - * \return the phase error - */ - float phase_detector_8(gr_complex sample) const; // for 8PSK - - /*! \brief the phase detector circuit for fourth-order loops - * \param sample complex sample - * \return the phase error - */ - float phase_detector_4(gr_complex sample) const; // for QPSK - - /*! \brief the phase detector circuit for second-order loops - * \param sample a complex sample - * \return the phase error - */ - float phase_detector_2(gr_complex sample) const; // for BPSK - - - float (digital_costas_loop_cc::*d_phase_detector)(gr_complex sample) const; - -public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-digital/include/digital_cpmmod_bc.h b/gr-digital/include/digital_cpmmod_bc.h deleted file mode 100644 index f0f11ee30..000000000 --- a/gr-digital/include/digital_cpmmod_bc.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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 INCLUDED_DIGITAL_CPMMOD_BC_H -#define INCLUDED_DIGITAL_CPMMOD_BC_H - -#include <digital_api.h> -#include <gr_hier_block2.h> -#include <gr_char_to_float.h> -#include <gr_interp_fir_filter_fff.h> -#include <gr_frequency_modulator_fc.h> -#include <gr_cpm.h> - - -class digital_cpmmod_bc; -typedef boost::shared_ptr<digital_cpmmod_bc> digital_cpmmod_bc_sptr; - - -DIGITAL_API digital_cpmmod_bc_sptr -digital_make_cpmmod_bc(int type, float h, - unsigned samples_per_sym, - unsigned L, double beta=0.3); - -/*! - * \brief Generic CPM modulator - * - * \ingroup modulation_blk - * \ingroup digital - * - * \param type The modulation type. Can be one of LREC, LRC, LSRC, TFM - * or GAUSSIAN. See gr_cpm::phase_response() for a - * detailed description. - * \param h The modulation index. \f$ h \cdot \pi\f$ is the maximum - * phase change that can occur between two symbols, i.e., if - * you only send ones, the phase will increase by \f$ h \cdot - * \pi\f$ every \p samples_per_sym samples. Set this to 0.5 - * for Minimum Shift Keying variants. - * \param samples_per_sym Samples per symbol. - * \param L The length of the phase duration in symbols. For L=1, this - * yields full- response CPM symbols, for L > 1, - * partial-response. - * \param beta For LSRC, this is the rolloff factor. For Gaussian - * pulses, this is the 3 dB time-bandwidth product. - * - * Examples: - * - Setting h = 0.5, L = 1, type = LREC yields MSK. - * - Setting h = 0.5, type = GAUSSIAN and beta = 0.3 yields GMSK - * as used in GSM. - * - * The input of this block are symbols from an M-ary alphabet - * +/-1, +/-3, ..., +/-(M-1). Usually, M = 2 and therefore, the - * valid inputs are +/-1. - * The modulator will silently accept any other inputs, though. - * The output is the phase-modulated signal. - */ -class DIGITAL_API digital_cpmmod_bc : public gr_hier_block2 -{ - friend DIGITAL_API digital_cpmmod_bc_sptr - digital_make_cpmmod_bc(int type, float h, - unsigned samples_per_sym, - unsigned L, double beta); - - std::vector<float> d_taps; - gr_char_to_float_sptr d_char_to_float; - gr_interp_fir_filter_fff_sptr d_pulse_shaper; - gr_frequency_modulator_fc_sptr d_fm; - -protected: - digital_cpmmod_bc(gr_cpm::cpm_type type, float h, - unsigned samples_per_sym, - unsigned L, double beta); - -public: - //! Return the phase response FIR taps - std::vector<float> get_taps() { return d_taps; }; -}; - -#endif /* INCLUDED_DIGITAL_CPMMOD_BC_H */ - diff --git a/gr-digital/include/digital_crc32.h b/gr-digital/include/digital_crc32.h deleted file mode 100644 index ec4a0df5b..000000000 --- a/gr-digital/include/digital_crc32.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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 INCLUDED_DIGITAL_CRC32_H -#define INCLUDED_DIGITAL_CRC32_H - -#include <digital_api.h> -#include <string> -#include <gr_types.h> - -/*! - * \brief update running CRC-32 - * \ingroup digital - * - * Update a running CRC with the bytes buf[0..len-1] The CRC should be - * initialized to all 1's, and the transmitted value is the 1's - * complement of the final running CRC. The resulting CRC should be - * transmitted in big endian order. - */ -DIGITAL_API unsigned int -digital_update_crc32(unsigned int crc, const unsigned char *buf, size_t len); - -DIGITAL_API unsigned int -digital_update_crc32(unsigned int crc, const std::string buf); - -DIGITAL_API unsigned int -digital_crc32(const unsigned char *buf, size_t len); - -DIGITAL_API unsigned int -digital_crc32(const std::string buf); - -#endif /* INCLUDED_CRC32_H */ diff --git a/gr-digital/include/digital_descrambler_bb.h b/gr-digital/include/digital_descrambler_bb.h deleted file mode 100644 index d503102a9..000000000 --- a/gr-digital/include/digital_descrambler_bb.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 INCLUDED_GR_DESCRAMBLER_BB_H -#define INCLUDED_GR_DESCRAMBLER_BB_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <analog/lfsr.h> - -class digital_descrambler_bb; -typedef boost::shared_ptr<digital_descrambler_bb> digital_descrambler_bb_sptr; - -DIGITAL_API digital_descrambler_bb_sptr -digital_make_descrambler_bb(int mask, int seed, int len); - -/*! - * Descramble an input stream using an LFSR. This block works on the LSB only - * of the input data stream, i.e., on an "unpacked binary" stream, and - * produces the same format on its output. - * - * \param mask Polynomial mask for LFSR - * \param seed Initial shift register contents - * \param len Shift register length - * - * \ingroup coding_blk - */ - -class DIGITAL_API digital_descrambler_bb : public gr_sync_block -{ - friend DIGITAL_API digital_descrambler_bb_sptr - digital_make_descrambler_bb(int mask, int seed, int len); - - gr::analog::lfsr d_lfsr; - - digital_descrambler_bb(int mask, int seed, int len); - -public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_DESCRAMBLER_BB_H */ diff --git a/gr-digital/include/digital_diff_decoder_bb.h b/gr-digital/include/digital_diff_decoder_bb.h deleted file mode 100644 index 928035d0e..000000000 --- a/gr-digital/include/digital_diff_decoder_bb.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_GR_DIFF_DECODER_BB_H -#define INCLUDED_GR_DIFF_DECODER_BB_H - -#include <digital_api.h> -#include <gr_sync_block.h> - -class digital_diff_decoder_bb; -typedef boost::shared_ptr<digital_diff_decoder_bb> digital_diff_decoder_bb_sptr; - -DIGITAL_API digital_diff_decoder_bb_sptr -digital_make_diff_decoder_bb(unsigned int modulus); - -/*! - * \brief y[0] = (x[0] - x[-1]) % M - * \ingroup coding_blk - * - * Uses current and previous symbols and the alphabet modulus to - * perform differential decoding. - */ -class DIGITAL_API digital_diff_decoder_bb : public gr_sync_block -{ - friend DIGITAL_API digital_diff_decoder_bb_sptr - digital_make_diff_decoder_bb(unsigned int modulus); - digital_diff_decoder_bb(unsigned int modulus); - - unsigned int d_modulus; - - public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-digital/include/digital_diff_encoder_bb.h b/gr-digital/include/digital_diff_encoder_bb.h deleted file mode 100644 index d4be69cad..000000000 --- a/gr-digital/include/digital_diff_encoder_bb.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_GR_DIFF_ENCODER_BB_H -#define INCLUDED_GR_DIFF_ENCODER_BB_H - -#include <digital_api.h> -#include <gr_sync_block.h> - -class digital_diff_encoder_bb; -typedef boost::shared_ptr<digital_diff_encoder_bb> digital_diff_encoder_bb_sptr; - -DIGITAL_API digital_diff_encoder_bb_sptr -digital_make_diff_encoder_bb(unsigned int modulus); - -/*! - * \brief y[0] = (x[0] + y[-1]) % M - * \ingroup coding_blk - * - * Uses current and previous symbols and the alphabet modulus to - * perform differential encoding. - */ -class DIGITAL_API digital_diff_encoder_bb : public gr_sync_block -{ - friend DIGITAL_API digital_diff_encoder_bb_sptr - digital_make_diff_encoder_bb(unsigned int modulus); - digital_diff_encoder_bb(unsigned int modulus); - - unsigned int d_last_out; - unsigned int d_modulus; - - public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-digital/include/digital_diff_phasor_cc.h b/gr-digital/include/digital_diff_phasor_cc.h deleted file mode 100644 index 32a2464b2..000000000 --- a/gr-digital/include/digital_diff_phasor_cc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_GR_DIFF_PHASOR_CC_H -#define INCLUDED_GR_DIFF_PHASOR_CC_H - -#include <digital_api.h> -#include <gr_sync_block.h> - -/*! - * \brief Differential decoding based on phase change. - * \ingroup coding_blk - * - * Uses the phase difference between two symbols to determine the - * output symbol: - * - * out[i] = in[i] * conj(in[i-1]); - */ -class digital_diff_phasor_cc; -typedef boost::shared_ptr<digital_diff_phasor_cc> digital_diff_phasor_cc_sptr; - -DIGITAL_API digital_diff_phasor_cc_sptr digital_make_diff_phasor_cc(); - - -class DIGITAL_API digital_diff_phasor_cc : public gr_sync_block -{ - friend DIGITAL_API digital_diff_phasor_cc_sptr - digital_make_diff_phasor_cc(); - - digital_diff_phasor_cc(); //constructor - - public: - ~digital_diff_phasor_cc(); //destructor - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-digital/include/digital_fll_band_edge_cc.h b/gr-digital/include/digital_fll_band_edge_cc.h deleted file mode 100644 index 68083bbae..000000000 --- a/gr-digital/include/digital_fll_band_edge_cc.h +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2011,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 INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H -#define INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <gri_control_loop.h> -#include <gr_fir_util.h> -#include <gr_fir_ccc.h> - -typedef gr_fir_ccc* (*fir_maker_t)(const std::vector<gr_complex> &taps); -typedef gr_fir_ccc filter_t; - -class digital_fll_band_edge_cc; -typedef boost::shared_ptr<digital_fll_band_edge_cc> digital_fll_band_edge_cc_sptr; -DIGITAL_API digital_fll_band_edge_cc_sptr -digital_make_fll_band_edge_cc(float samps_per_sym, - float rolloff, - int filter_size, - float bandwidth); - -/*! - * \class digital_fll_band_edge_cc - * \brief Frequency Lock Loop using band-edge filters - * - * \ingroup general - * \ingroup digital - * - * The frequency lock loop derives a band-edge filter that covers the - * upper and lower bandwidths of a digitally-modulated signal. The - * bandwidth range is determined by the excess bandwidth (e.g., - * rolloff factor) of the modulated signal. The placement in frequency - * of the band-edges is determined by the oversampling ratio (number - * of samples per symbol) and the excess bandwidth. The size of the - * filters should be fairly large so as to average over a number of - * symbols. - * - * The FLL works by filtering the upper and lower band edges into - * x_u(t) and x_l(t), respectively. These are combined to form cc(t) - * = x_u(t) + x_l(t) and ss(t) = x_u(t) - x_l(t). Combining these to - * form the signal e(t) = Re{cc(t) \\times ss(t)^*} (where ^* is the - * complex conjugate) provides an error signal at the DC term that is - * directly proportional to the carrier frequency. We then make a - * second-order loop using the error signal that is the running - * average of e(t). - * - * In practice, the above equation can be simplified by just comparing - * the absolute value squared of the output of both filters: - * abs(x_l(t))^2 - abs(x_u(t))^2 = norm(x_l(t)) - norm(x_u(t)). - * - * In theory, the band-edge filter is the derivative of the matched - * filter in frequency, (H_be(f) = frac{H(f)}{df}). In practice, - * this comes down to a quarter sine wave at the point of the matched - * filter's rolloff (if it's a raised-cosine, the derivative of a - * cosine is a sine). Extend this sine by another quarter wave to - * make a half wave around the band-edges is equivalent in time to the - * sum of two sinc functions. The baseband filter fot the band edges - * is therefore derived from this sum of sincs. The band edge filters - * are then just the baseband signal modulated to the correct place in - * frequency. All of these calculations are done in the - * 'design_filter' function. - * - * Note: We use FIR filters here because the filters have to have a - * flat phase response over the entire frequency range to allow their - * comparisons to be valid. - * - * It is very important that the band edge filters be the derivatives - * of the pulse shaping filter, and that they be linear - * phase. Otherwise, the variance of the error will be very large. - * - */ - -class DIGITAL_API digital_fll_band_edge_cc : - public gr_sync_block, public gri_control_loop -{ - private: - /*! - * Build the FLL - * \param samps_per_sym (float) Number of samples per symbol of signal - * \param rolloff (float) Rolloff factor of signal - * \param filter_size (int) Size (in taps) of the filter - * \param bandwidth (float) Loop bandwidth - */ - friend DIGITAL_API digital_fll_band_edge_cc_sptr - digital_make_fll_band_edge_cc(float samps_per_sym, - float rolloff, - int filter_size, - float bandwidth); - - float d_sps; - float d_rolloff; - int d_filter_size; - - std::vector<gr_complex> d_taps_lower; - std::vector<gr_complex> d_taps_upper; - bool d_updated; - filter_t* d_filter_lower; - filter_t* d_filter_upper; - std::vector<gr_complex> d_output_hist; - std::vector<gr_complex> d_fllbuffer; - - /*! - * Build the FLL - * \param samps_per_sym (float) number of samples per symbol - * \param rolloff (float) Rolloff (excess bandwidth) of signal filter - * \param filter_size (int) number of filter taps to generate - * \param bandwidth (float) Loop bandwidth - */ - digital_fll_band_edge_cc(float samps_per_sym, float rolloff, - int filter_size, float bandwidth); - - /*! - * Design the band-edge filter based on the number of samples per symbol, - * filter rolloff factor, and the filter size - * - * \param samps_per_sym (float) Number of samples per symbol of signal - * \param rolloff (float) Rolloff factor of signal - * \param filter_size (int) Size (in taps) of the filter - */ - void design_filter(float samps_per_sym, float rolloff, int filter_size); - -public: - ~digital_fll_band_edge_cc(); - - /******************************************************************* - SET FUNCTIONS - *******************************************************************/ - - /*! - * \brief Set the number of samples per symbol - * - * Set's the number of samples per symbol the system should - * use. This value is uesd to calculate the filter taps and will - * force a recalculation. - * - * \param sps (float) new samples per symbol - * - */ - void set_samples_per_symbol(float sps); - - /*! - * \brief Set the rolloff factor of the shaping filter - * - * This sets the rolloff factor that is used in the pulse shaping - * filter and is used to calculate the filter taps. Changing this - * will force a recalculation of the filter taps. - * - * This should be the same value that is used in the transmitter's - * pulse shaping filter. It must be between 0 and 1 and is usually - * between 0.2 and 0.5 (where 0.22 and 0.35 are commonly used - * values). - * - * \param rolloff (float) new shaping filter rolloff factor [0,1] - * - */ - void set_rolloff(float rolloff); - - /*! - * \brief Set the number of taps in the filter - * - * This sets the number of taps in the band-edge filters. Setting - * this will force a recalculation of the filter taps. - * - * This should be about the same number of taps used in the - * transmitter's shaping filter and also not very large. A large - * number of taps will result in a large delay between input and - * frequency estimation, and so will not be as accurate. Between 30 - * and 70 taps is usual. - * - * \param filter_size (float) number of taps in the filters - * - */ - void set_filter_size(int filter_size); - - /******************************************************************* - GET FUNCTIONS - *******************************************************************/ - - /*! - * \brief Returns the number of sampler per symbol used for the filter - */ - float get_samples_per_symbol() const; - - /*! - * \brief Returns the rolloff factor used for the filter - */ - float get_rolloff() const; - - /*! - * \brief Returns the number of taps of the filter - */ - int get_filter_size() const; - - /*! - * Print the taps to screen. - */ - void print_taps(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-digital/include/digital_framer_sink_1.h b/gr-digital/include/digital_framer_sink_1.h deleted file mode 100644 index bb82bf5a7..000000000 --- a/gr-digital/include/digital_framer_sink_1.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_GR_FRAMER_SINK_1_H -#define INCLUDED_GR_FRAMER_SINK_1_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> - -class digital_framer_sink_1; -typedef boost::shared_ptr<digital_framer_sink_1> digital_framer_sink_1_sptr; - -DIGITAL_API digital_framer_sink_1_sptr -digital_make_framer_sink_1(gr_msg_queue_sptr target_queue); - -/*! - * \brief Given a stream of bits and access_code flags, assemble packets. - * \ingroup sink_blk - * - * input: stream of bytes from gr_correlate_access_code_bb - * output: none. Pushes assembled packet into target queue - * - * The framer expects a fixed length header of 2 16-bit shorts - * containing the payload length, followed by the payload. If the - * 2 16-bit shorts are not identical, this packet is ignored. Better - * algs are welcome. - * - * The input data consists of bytes that have two bits used. - * Bit 0, the LSB, contains the data bit. - * Bit 1 if set, indicates that the corresponding bit is the - * the first bit of the packet. That is, this bit is the first - * one after the access code. - */ -class DIGITAL_API digital_framer_sink_1 : public gr_sync_block -{ - friend DIGITAL_API digital_framer_sink_1_sptr - digital_make_framer_sink_1(gr_msg_queue_sptr target_queue); - - private: - enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER}; - - static const int MAX_PKT_LEN = 4096; - static const int HEADERBITLEN = 32; - - gr_msg_queue_sptr d_target_queue; // where to send the packet when received - state_t d_state; - unsigned int d_header; // header bits - int d_headerbitlen_cnt; // how many so far - - unsigned char d_packet[MAX_PKT_LEN]; // assembled payload - unsigned char d_packet_byte; // byte being assembled - int d_packet_byte_index; // which bit of d_packet_byte we're working on - int d_packetlen; // length of packet - int d_packet_whitener_offset; // offset into whitener string to use - int d_packetlen_cnt; // how many so far - - protected: - digital_framer_sink_1(gr_msg_queue_sptr target_queue); - - void enter_search(); - void enter_have_sync(); - void enter_have_header(int payload_len, int whitener_offset); - - bool header_ok() - { - // confirm that two copies of header info are identical - return ((d_header >> 16) ^ (d_header & 0xffff)) == 0; - } - - void header_payload(int *len, int *offset) - { - // header consists of two 16-bit shorts in network byte order - // payload length is lower 12 bits - // whitener offset is upper 4 bits - *len = (d_header >> 16) & 0x0fff; - *offset = (d_header >> 28) & 0x000f; - } - - public: - ~digital_framer_sink_1(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FRAMER_SINK_1_H */ diff --git a/gr-digital/include/digital_glfsr_source_b.h b/gr-digital/include/digital_glfsr_source_b.h deleted file mode 100644 index 92e5e81f5..000000000 --- a/gr-digital/include/digital_glfsr_source_b.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,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 INCLUDED_GR_GLFSR_SOURCE_B_H -#define INCLUDED_GR_GLFSR_SOURCE_B_H - -#include <digital_api.h> -#include <gr_sync_block.h> - -class gri_glfsr; - -class digital_glfsr_source_b; -typedef boost::shared_ptr<digital_glfsr_source_b> digital_glfsr_source_b_sptr; - -DIGITAL_API digital_glfsr_source_b_sptr -digital_make_glfsr_source_b(int degree, bool repeat=true, - int mask=0, int seed=1); - -/*! - * \brief Galois LFSR pseudo-random source - * \ingroup source_blk - * - * \param degree Degree of shift register must be in [1, 32]. If mask - * is 0, the degree determines a default mask (see - * digital_impl_glfsr.cc for the mapping). - * \param repeat Set to repeat sequence. - * \param mask Allows a user-defined bit mask for indexes of the shift - * register to feed back. - * \param seed Initial setting for values in shift register. - */ -class DIGITAL_API digital_glfsr_source_b : public gr_sync_block -{ - private: - friend DIGITAL_API digital_glfsr_source_b_sptr - digital_make_glfsr_source_b(int degree, bool repeat, - int mask, int seed); - - gri_glfsr *d_glfsr; - - bool d_repeat; - unsigned int d_index; - unsigned int d_length; - - digital_glfsr_source_b(int degree, bool repeat, - int mask, int seed); - - public: - - ~digital_glfsr_source_b(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - unsigned int period() const { return d_length; } - int mask() const; -}; - -#endif /* INCLUDED_GR_GLFSR_SOURCE_B_H */ diff --git a/gr-digital/include/digital_glfsr_source_f.h b/gr-digital/include/digital_glfsr_source_f.h deleted file mode 100644 index 77d7b0f74..000000000 --- a/gr-digital/include/digital_glfsr_source_f.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,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 INCLUDED_GR_GLFSR_SOURCE_F_H -#define INCLUDED_GR_GLFSR_SOURCE_F_H - -#include <digital_api.h> -#include <gr_sync_block.h> - -class gri_glfsr; - -class digital_glfsr_source_f; -typedef boost::shared_ptr<digital_glfsr_source_f> digital_glfsr_source_f_sptr; - -DIGITAL_API digital_glfsr_source_f_sptr -digital_make_glfsr_source_f(int degree, bool repeat=true, - int mask=0, int seed=1); - -/*! - * \brief Galois LFSR pseudo-random source generating float outputs -1.0 - 1.0. - * \ingroup source_blk - * - * \param degree Degree of shift register must be in [1, 32]. If mask - * is 0, the degree determines a default mask (see - * digital_impl_glfsr.cc for the mapping). - * \param repeat Set to repeat sequence. - * \param mask Allows a user-defined bit mask for indexes of the shift - * register to feed back. - * \param seed Initial setting for values in shift register. - */ -class DIGITAL_API digital_glfsr_source_f : public gr_sync_block -{ - private: - friend DIGITAL_API digital_glfsr_source_f_sptr - digital_make_glfsr_source_f(int degree, bool repeat, - int mask, int seed); - - gri_glfsr *d_glfsr; - - bool d_repeat; - unsigned int d_index; - unsigned int d_length; - - digital_glfsr_source_f(int degree, bool repeat, - int mask, int seed); - - public: - - ~digital_glfsr_source_f(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - unsigned int period() const { return d_length; } - int mask() const; -}; - -#endif /* INCLUDED_GR_GLFSR_SOURCE_F_H */ diff --git a/gr-digital/include/digital_gmskmod_bc.h b/gr-digital/include/digital_gmskmod_bc.h deleted file mode 100644 index 9f378c8a7..000000000 --- a/gr-digital/include/digital_gmskmod_bc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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 INCLUDED_DIGITAL_GMSKMOD_BC_H -#define INCLUDED_DIGITAL_GMSKMOD_BC_H - -#include <digital_api.h> -#include <digital_cpmmod_bc.h> - -class digital_gmskmod_bc; -typedef boost::shared_ptr<digital_gmskmod_bc> digital_gmskmod_bc_sptr; - - -DIGITAL_API digital_gmskmod_bc_sptr -digital_make_gmskmod_bc(unsigned samples_per_sym=2, - double bt=0.3, unsigned L=4); - -/*! - * \brief GMSK modulator - * - * \ingroup modulation_blk - * \ingroup digital - * - * \param samples_per_sym Samples per symbol. - * \param bt The 3 dB time-bandwidth product. - * \param L The length of the phase duration in symbols. The Gaussian - * pulse is truncated after L symbols. - * - * The input of this block are symbols from an M-ary alphabet - * +/-1, +/-3, ..., +/-(M-1). Usually, M = 2 and therefore, the - * valid inputs are +/-1. - * The modulator will silently accept any other inputs, though. - * The output is the phase-modulated signal. - */ -class DIGITAL_API digital_gmskmod_bc : public digital_cpmmod_bc -{ - friend DIGITAL_API digital_gmskmod_bc_sptr digital_make_gmskmod_bc(unsigned samples_per_sym, - double bt, unsigned L); - digital_gmskmod_bc(unsigned samples_per_sym, - double bt, unsigned L); -}; - -#endif /* INCLUDED_DIGITAL_GMSKMOD_BC_H */ - diff --git a/gr-digital/include/digital_impl_glfsr.h b/gr-digital/include/digital_impl_glfsr.h deleted file mode 100644 index 3aadf7cf2..000000000 --- a/gr-digital/include/digital_impl_glfsr.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,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 INCLUDED_DIGITAL_IMPL_GLFSR_H -#define INCLUDED_DIGITAL_IMPL_GLFSR_H - -#include <digital_api.h> - -/*! - * \brief Galois Linear Feedback Shift Register using specified polynomial mask - * \ingroup misc - * - * Generates a maximal length pseudo-random sequence of length 2^degree-1 - */ - -class DIGITAL_API digital_impl_glfsr -{ - private: - int d_shift_register; - int d_mask; - - public: - - digital_impl_glfsr(int mask, int seed) { d_shift_register = seed; d_mask = mask; } - static int glfsr_mask(int degree); - - unsigned char next_bit() { - unsigned char bit = d_shift_register & 1; - d_shift_register >>= 1; - if (bit) - d_shift_register ^= d_mask; - return bit; - } - - int mask() const { return d_mask; } -}; - -#endif /* INCLUDED_DIGITAL_IMPL_GLFSR_H */ diff --git a/gr-digital/include/digital_impl_mpsk_snr_est.h b/gr-digital/include/digital_impl_mpsk_snr_est.h deleted file mode 100644 index df7dbadec..000000000 --- a/gr-digital/include/digital_impl_mpsk_snr_est.h +++ /dev/null @@ -1,279 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_DIGITAL_IMPL_MPSK_SNR_EST_H -#define INCLUDED_DIGITAL_IMPL_MPSK_SNR_EST_H - -#include <digital_api.h> -#include <gr_sync_block.h> - -//! Enum for the type of SNR estimator to select -/*! \ingroup snr_blk - * \anchor ref_snr_est_types - * - * Below are some ROUGH estimates of what values of SNR each of these - * types of estimators is good for. In general, these offer a - * trade-off between accuracy and performance. - * - * \li SNR_EST_SIMPLE: Simple estimator (>= 7 dB) - * \li SNR_EST_SKEW: Skewness-base est (>= 5 dB) - * \li SNR_EST_M2M4: 2nd & 4th moment est (>= 1 dB) - * \li SNR_EST_SVR: SVR-based est (>= 0dB) -*/ -enum snr_est_type_t { - SNR_EST_SIMPLE = 0, // Simple estimator (>= 7 dB) - SNR_EST_SKEW, // Skewness-base est (>= 5 dB) - SNR_EST_M2M4, // 2nd & 4th moment est (>= 1 dB) - SNR_EST_SVR // SVR-based est (>= 0dB) -}; - -/*! \brief A parent class for SNR estimators, specifically for M-PSK - * signals in AWGN channels. - * \ingroup snr_blk - */ -class DIGITAL_API digital_impl_mpsk_snr_est -{ - protected: - double d_alpha, d_beta; - - public: - /*! Constructor - * - * Parameters: - * \param alpha: the update rate of internal running average - * calculations. - */ - digital_impl_mpsk_snr_est(double alpha); - virtual ~digital_impl_mpsk_snr_est(); - - //! Get the running-average coefficient - double alpha() const; - - //! Set the running-average coefficient - void set_alpha(double alpha); - - //! Update the current registers - virtual int update(int noutput_items, - const gr_complex *in); - - //! Use the register values to compute a new estimate - virtual double snr(); -}; - - -//! \brief SNR Estimator using simple mean/variance estimates. -/*! \ingroup snr_blk - * - * A very simple SNR estimator that just uses mean and variance - * estimates of an M-PSK constellation. This esimator is quick and - * cheap and accurate for high SNR (above 7 dB or so) but quickly - * starts to overestimate the SNR at low SNR. - */ -class DIGITAL_API digital_impl_mpsk_snr_est_simple : - public digital_impl_mpsk_snr_est -{ - private: - double d_y1, d_y2; - - public: - /*! Constructor - * - * Parameters: - * \param alpha: the update rate of internal running average - * calculations. - */ - digital_impl_mpsk_snr_est_simple(double alpha); - ~digital_impl_mpsk_snr_est_simple() {} - - int update(int noutput_items, - const gr_complex *in); - double snr(); -}; - - -//! \brief SNR Estimator using skewness correction. -/*! \ingroup snr_blk - * - * This is an estimator that came from a discussion between Tom - * Rondeau and fred harris with no known paper reference. The idea is - * that at low SNR, the variance estimations will be affected because - * of fold-over around the decision boundaries, which results in a - * skewness to the samples. We estimate the skewness and use this as - * a correcting term. - */ -class DIGITAL_API digital_impl_mpsk_snr_est_skew : - public digital_impl_mpsk_snr_est -{ - private: - double d_y1, d_y2, d_y3; - - public: - /*! Constructor - * - * Parameters: - * \param alpha: the update rate of internal running average - * calculations. - */ - digital_impl_mpsk_snr_est_skew(double alpha); - ~digital_impl_mpsk_snr_est_skew() {} - - int update(int noutput_items, - const gr_complex *in); - double snr(); -}; - - -//! \brief SNR Estimator using 2nd and 4th-order moments. -/*! \ingroup snr_blk - * - * An SNR estimator for M-PSK signals that uses 2nd (M2) and 4th (M4) - * order moments. This estimator uses knowledge of the kurtosis of - * the signal (k_a) and noise (k_w) to make its estimation. We use - * Beaulieu's approximations here to M-PSK signals and AWGN channels - * such that k_a=1 and k_w=2. These approximations significantly - * reduce the complexity of the calculations (and computations) - * required. - * - * Reference: - * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR - * estimation techniques for the AWGN channel," IEEE - * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000. - */ -class DIGITAL_API digital_impl_mpsk_snr_est_m2m4 : - public digital_impl_mpsk_snr_est -{ - private: - double d_y1, d_y2; - - public: - /*! Constructor - * - * Parameters: - * \param alpha: the update rate of internal running average - * calculations. - */ - digital_impl_mpsk_snr_est_m2m4(double alpha); - ~digital_impl_mpsk_snr_est_m2m4() {} - - int update(int noutput_items, - const gr_complex *in); - double snr(); -}; - - -//! \brief SNR Estimator using 2nd and 4th-order moments. -/*! \ingroup snr_blk - * - * An SNR estimator for M-PSK signals that uses 2nd (M2) and 4th (M4) - * order moments. This estimator uses knowledge of the kurtosis of - * the signal (k_a) and noise (k_w) to make its estimation. In this - * case, you can set your own estimations for k_a and k_w, the - * kurtosis of the signal and noise, to fit this estimation better to - * your signal and channel conditions. - * - * A word of warning: this estimator has not been fully tested or - * proved with any amount of rigor. The estimation for M4 in - * particular might be ignoring effectf of when k_a and k_w are - * different. Use this estimator with caution and a copy of the - * reference on hand. - * - * The digital_mpsk_snr_est_m2m4 assumes k_a and k_w to simplify the - * computations for M-PSK and AWGN channels. Use that estimator - * unless you have a way to guess or estimate these values here. - * - * Original paper: - * R. Matzner, "An SNR estimation algorithm for complex baseband - * signal using higher order statistics," Facta Universitatis - * (Nis), no. 6, pp. 41-52, 1993. - * - * Reference used in derivation: - * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR - * estimation techniques for the AWGN channel," IEEE - * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000. - */ -class DIGITAL_API digital_impl_snr_est_m2m4 : - public digital_impl_mpsk_snr_est -{ - private: - double d_y1, d_y2; - double d_ka, d_kw; - - public: - /*! Constructor - * - * Parameters: - * \param alpha: the update rate of internal running average - * calculations. - * \param ka: estimate of the signal kurtosis (1 for PSK) - * \param kw: estimate of the channel noise kurtosis (2 for AWGN) - */ - digital_impl_snr_est_m2m4(double alpha, double ka, double kw); - ~digital_impl_snr_est_m2m4() {} - - int update(int noutput_items, - const gr_complex *in); - double snr(); -}; - - -//! \brief Signal-to-Variation Ratio SNR Estimator. -/*! \ingroup snr_blk - * - * This estimator actually comes from an SNR estimator for M-PSK - * signals in fading channels, but this implementation is - * specifically for AWGN channels. The math was simplified to assume - * a signal and noise kurtosis (k_a and k_w) for M-PSK signals in - * AWGN. These approximations significantly reduce the complexity of - * the calculations (and computations) required. - * - * Original paper: - * A. L. Brandao, L. B. Lopes, and D. C. McLernon, "In-service - * monitoring of multipath delay and cochannel interference for - * indoor mobile communication systems," Proc. IEEE - * Int. Conf. Communications, vol. 3, pp. 1458-1462, May 1994. - * - * Reference: - * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR - * estimation techniques for the AWGN channel," IEEE - * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000. - */ -class DIGITAL_API digital_impl_mpsk_snr_est_svr : - public digital_impl_mpsk_snr_est -{ - private: - double d_y1, d_y2; - - public: - /*! Constructor - * - * Parameters: - * \param alpha: the update rate of internal running average - * calculations. - */ - digital_impl_mpsk_snr_est_svr(double alpha); - ~digital_impl_mpsk_snr_est_svr() {} - - int update(int noutput_items, - const gr_complex *in); - double snr(); -}; - -#endif /* INCLUDED_DIGITAL_IMPL_MPSK_SNR_EST_H */ diff --git a/gr-digital/include/digital_kurtotic_equalizer_cc.h b/gr-digital/include/digital_kurtotic_equalizer_cc.h deleted file mode 100644 index fed88c374..000000000 --- a/gr-digital/include/digital_kurtotic_equalizer_cc.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_H -#define INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_H - -#include <digital_api.h> -#include <gr_adaptive_fir_ccc.h> -#include <gr_math.h> -#include <iostream> - -class digital_kurtotic_equalizer_cc; -typedef boost::shared_ptr<digital_kurtotic_equalizer_cc> digital_kurtotic_equalizer_cc_sptr; - -DIGITAL_API digital_kurtotic_equalizer_cc_sptr -digital_make_kurtotic_equalizer_cc(int num_taps, float mu); - -/*! - * \brief Implements a kurtosis-based adaptive equalizer on complex stream - * \ingroup eq_blk - * \ingroup digital - * - * "Y. Guo, J. Zhao, Y. Sun, "Sign kurtosis maximization based blind - * equalization algorithm," IEEE Conf. on Control, Automation, - * Robotics and Vision, Vol. 3, Dec. 2004, pp. 2052 - 2057." - */ -class DIGITAL_API digital_kurtotic_equalizer_cc : public gr_adaptive_fir_ccc -{ -private: - float d_mu; - float d_p, d_m; - gr_complex d_q, d_u; - float d_alpha_p, d_alpha_q, d_alpha_m; - - friend DIGITAL_API digital_kurtotic_equalizer_cc_sptr digital_make_kurtotic_equalizer_cc(int num_taps, - float mu); - digital_kurtotic_equalizer_cc(int num_taps, float mu); - - gr_complex sign(gr_complex x) - { - float re = (float)(x.real() >= 0.0f); - float im = (float)(x.imag() >= 0.0f); - return gr_complex(re, im); - } - -protected: - - virtual gr_complex error(const gr_complex &out) - { - - // p = E[|z|^2] - // q = E[z^2] - // m = E[|z|^4] - // u = E[kurtosis(z)] - - float nrm = norm(out); - gr_complex cnj = conj(out); - float epsilon_f = 1e-12; - gr_complex epsilon_c = gr_complex(1e-12, 1e-12); - - - d_p = (1-d_alpha_p)*d_p + (d_alpha_p)*nrm + epsilon_f; - d_q = (1-d_alpha_q)*d_q + (d_alpha_q)*out*out + epsilon_c; - d_m = (1-d_alpha_m)*d_m + (d_alpha_m)*nrm*nrm + epsilon_f; - d_u = d_m - 2.0f*(d_p*d_p) - d_q*d_q; - - gr_complex F = (1.0f / (d_p*d_p*d_p)) * - (sign(d_u) * (nrm*cnj - 2.0f*d_p*cnj - conj(d_q)*out) - - abs(d_u)*cnj); - - //std::cout << "out: " << out << " p: " << d_p << " q: " << d_q; - //std::cout << " m: " << d_m << " u: " << d_u << std::endl; - //std::cout << "error: " << F << std::endl; - - float re = gr_clip(F.real(), 1.0); - float im = gr_clip(F.imag(), 1.0); - return gr_complex(re, im); - } - - virtual void update_tap(gr_complex &tap, const gr_complex &in) - { - tap += d_mu*in*d_error; - } - -public: - void set_gain(float mu) - { - if(mu < 0) - throw std::out_of_range("digital_kurtotic_equalizer::set_gain: Gain value must be >= 0"); - d_mu = mu; - } -}; - -#endif diff --git a/gr-digital/include/digital_lms_dd_equalizer_cc.h b/gr-digital/include/digital_lms_dd_equalizer_cc.h deleted file mode 100644 index 56871fa67..000000000 --- a/gr-digital/include/digital_lms_dd_equalizer_cc.h +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H -#define INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H - -#include <digital_api.h> -#include <gr_adaptive_fir_ccc.h> -#include <digital_constellation.h> - -class digital_lms_dd_equalizer_cc; -typedef boost::shared_ptr<digital_lms_dd_equalizer_cc> digital_lms_dd_equalizer_cc_sptr; - -DIGITAL_API digital_lms_dd_equalizer_cc_sptr digital_make_lms_dd_equalizer_cc (int num_taps, - float mu, int sps, - digital_constellation_sptr cnst); - -/*! - * \brief Least-Mean-Square Decision Directed Equalizer (complex in/out) - * \ingroup eq_blk - * \ingroup digital - * - * This block implements an LMS-based decision-directed equalizer. - * It uses a set of weights, w, to correlate against the inputs, u, - * and a decisions is then made from this output. The error - * in the decision is used to update teh weight vector. - * - * y[n] = conj(w[n]) u[n] - * d[n] = decision(y[n]) - * e[n] = d[n] - y[n] - * w[n+1] = w[n] + mu u[n] conj(e[n]) - * - * Where mu is a gain value (between 0 and 1 and usualy small, - * around 0.001 - 0.01. - * - * This block uses the digital_constellation object for making - * the decision from y[n]. Create the constellation object for - * whatever constellation is to be used and pass in the object. - * In Python, you can use something like: - * self.constellation = digital.constellation_qpsk() - * To create a QPSK constellation (see the digital_constellation - * block for more details as to what constellations are available - * or how to create your own). You then pass the object to this - * block as an sptr, or using "self.constellation.base()". - * - * The theory for this algorithm can be found in Chapter 9 of: - * S. Haykin, Adaptive Filter Theory, Upper Saddle River, NJ: - * Prentice Hall, 1996. - * - */ -class DIGITAL_API digital_lms_dd_equalizer_cc : public gr_adaptive_fir_ccc -{ -private: - friend DIGITAL_API digital_lms_dd_equalizer_cc_sptr digital_make_lms_dd_equalizer_cc (int num_taps, - float mu, int sps, - digital_constellation_sptr cnst); - - float d_mu; - std::vector<gr_complex> d_taps; - digital_constellation_sptr d_cnst; - - digital_lms_dd_equalizer_cc (int num_taps, - float mu, int sps, - digital_constellation_sptr cnst); - -protected: - - virtual gr_complex error(const gr_complex &out) - { - gr_complex decision, error; - d_cnst->map_to_points(d_cnst->decision_maker(&out), &decision); - error = decision - out; - return error; - } - - virtual void update_tap(gr_complex &tap, const gr_complex &in) - { - tap += d_mu*conj(in)*d_error; - } - -public: - float get_gain() - { - return d_mu; - } - - void set_gain(float mu) - { - if(mu < 0.0f || mu > 1.0f) { - throw std::out_of_range("digital_lms_dd_equalizer::set_mu: Gain value must in [0, 1]"); - } - else { - d_mu = mu; - } - } - -}; - -#endif diff --git a/gr-digital/include/digital_map_bb.h b/gr-digital/include/digital_map_bb.h deleted file mode 100644 index 4aca66fbe..000000000 --- a/gr-digital/include/digital_map_bb.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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 INCLUDED_GR_MAP_BB_H -#define INCLUDED_GR_MAP_BB_H - -#include <digital_api.h> -#include <gr_sync_block.h> - -class digital_map_bb; -typedef boost::shared_ptr<digital_map_bb> digital_map_bb_sptr; - -DIGITAL_API digital_map_bb_sptr -digital_make_map_bb(const std::vector<int> &map); - -/*! - * \brief output[i] = map[input[i]] - * \ingroup coding_blk - * - * This block maps an incoming signal to the value in the map. - * The block expects that the incoming signal has a maximum - * value of len(map)-1. - * - * -> output[i] = map[input[i]] - * - * \param map a vector of integers. - */ - -class DIGITAL_API digital_map_bb : public gr_sync_block -{ - friend DIGITAL_API digital_map_bb_sptr - digital_make_map_bb(const std::vector<int> &map); - - unsigned char d_map[0x100]; - - digital_map_bb(const std::vector<int> &map); - -public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_MAP_BB_H */ diff --git a/gr-digital/include/digital_metric_type.h b/gr-digital/include/digital_metric_type.h deleted file mode 100644 index 83de166f0..000000000 --- a/gr-digital/include/digital_metric_type.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 INCLUDED_DIGITAL_METRIC_TYPE_H -#define INCLUDED_DIGITAL_METRIC_TYPE_H - -typedef enum { - TRELLIS_EUCLIDEAN = 200, TRELLIS_HARD_SYMBOL, TRELLIS_HARD_BIT -} trellis_metric_type_t; - -#endif - diff --git a/gr-digital/include/digital_mpsk_receiver_cc.h b/gr-digital/include/digital_mpsk_receiver_cc.h deleted file mode 100644 index 1f11a26b6..000000000 --- a/gr-digital/include/digital_mpsk_receiver_cc.h +++ /dev/null @@ -1,320 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007,2011 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 INCLUDED_DIGITAL_MPSK_RECEIVER_CC_H -#define INCLUDED_DIGITAL_MPSK_RECEIVER_CC_H - -#include <digital_api.h> -#include <gruel/attributes.h> -#include <gri_control_loop.h> -#include <gr_block.h> -#include <gr_complex.h> -#include <fstream> - -class gri_mmse_fir_interpolator_cc; - -class digital_mpsk_receiver_cc; -typedef boost::shared_ptr<digital_mpsk_receiver_cc> digital_mpsk_receiver_cc_sptr; - -// public constructor -DIGITAL_API digital_mpsk_receiver_cc_sptr -digital_make_mpsk_receiver_cc (unsigned int M, float theta, - float loop_bw, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel); - -/*! - * \brief This block takes care of receiving M-PSK modulated signals - * through phase, frequency, and symbol synchronization. - * \ingroup sync_blk - * \ingroup demod_blk - * \ingroup digital - * - * This block takes care of receiving M-PSK modulated signals through - * phase, frequency, and symbol synchronization. It performs carrier - * frequency and phase locking as well as symbol timing recovery. It - * works with (D)BPSK, (D)QPSK, and (D)8PSK as tested currently. It - * should also work for OQPSK and PI/4 DQPSK. - * - * The phase and frequency synchronization are based on a Costas loop - * that finds the error of the incoming signal point compared to its - * nearest constellation point. The frequency and phase of the NCO are - * updated according to this error. There are optimized phase error - * detectors for BPSK and QPSK, but 8PSK is done using a brute-force - * computation of the constellation points to find the minimum. - * - * The symbol synchronization is done using a modified Mueller and - * Muller circuit from the paper: - * - * "G. R. Danesfahani, T. G. Jeans, "Optimisation of modified Mueller - * and Muller algorithm," Electronics Letters, Vol. 31, no. 13, 22 - * June 1995, pp. 1032 - 1033." - * - * This circuit interpolates the downconverted sample (using the NCO - * developed by the Costas loop) every mu samples, then it finds the - * sampling error based on this and the past symbols and the decision - * made on the samples. Like the phase error detector, there are - * optimized decision algorithms for BPSK and QPKS, but 8PSK uses - * another brute force computation against all possible symbols. The - * modifications to the M&M used here reduce self-noise. - * - */ - -class DIGITAL_API digital_mpsk_receiver_cc : public gr_block, public gri_control_loop -{ - public: - ~digital_mpsk_receiver_cc (); - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - - //! Returns the modulation order (M) currently set - float modulation_order() const { return d_M; } - - //! Returns current value of theta - float theta() const { return d_theta; } - - //! Returns current value of mu - float mu() const { return d_mu; } - - //! Returns current value of omega - float omega() const { return d_omega; } - - //! Returns mu gain factor - float gain_mu() const { return d_gain_mu; } - - //! Returns omega gain factor - float gain_omega() const { return d_gain_omega; } - - //! Returns the relative omega limit - float gain_omega_rel() const {return d_omega_rel; } - - //! Sets the modulation order (M) currently - void set_modulation_order(unsigned int M); - - //! Sets value of theta - void set_theta(float theta) { d_theta = theta; } - - //! Sets value of mu - void set_mu (float mu) { d_mu = mu; } - - //! Sets value of omega and its min and max values - void set_omega (float omega) { - d_omega = omega; - d_min_omega = omega*(1.0 - d_omega_rel); - d_max_omega = omega*(1.0 + d_omega_rel); - d_omega_mid = 0.5*(d_min_omega+d_max_omega); - } - - //! Sets value for mu gain factor - void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } - - //! Sets value for omega gain factor - void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } - - //! Sets the relative omega limit and resets omega min/max values - void set_gain_omega_rel(float omega_rel); - -protected: - - /*! - * \brief Constructor to synchronize incoming M-PSK symbols - * - * \param M modulation order of the M-PSK modulation - * \param theta any constant phase rotation from the real axis of the constellation - * \param loop_bw Loop bandwidth to set gains of phase/freq tracking loop - * \param fmin minimum normalized frequency value the loop can achieve - * \param fmax maximum normalized frequency value the loop can achieve - * \param mu initial parameter for the interpolator [0,1] - * \param gain_mu gain parameter of the M&M error signal to adjust mu (~0.05) - * \param omega initial value for the number of symbols between samples (~number of samples/symbol) - * \param gain_omega gain parameter to adjust omega based on the error (~omega^2/4) - * \param omega_rel sets the maximum (omega*(1+omega_rel)) and minimum (omega*(1+omega_rel)) omega (~0.005) - * - * The constructor also chooses which phase detector and decision maker to use in the work loop based on the - * value of M. - */ - digital_mpsk_receiver_cc (unsigned int M, float theta, - float loop_bw, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel); - - void make_constellation(); - void mm_sampler(const gr_complex symbol); - void mm_error_tracking(gr_complex sample); - void phase_error_tracking(gr_complex sample); - - - /*! - * \brief Phase error detector for MPSK modulations. - * - * \param sample the I&Q sample from which to determine the phase error - * - * This function determines the phase error for any MPSK signal by - * creating a set of PSK constellation points and doing a - * brute-force search to see which point minimizes the Euclidean - * distance. This point is then used to derotate the sample to the - * real-axis and a atan (using the fast approximation function) to - * determine the phase difference between the incoming sample and - * the real constellation point - * - * This should be cleaned up and made more efficient. - * - * \returns the approximated phase error. - */ - float phase_error_detector_generic(gr_complex sample) const; // generic for M but more costly - - /*! - * \brief Phase error detector for BPSK modulation. - * - * \param sample the I&Q sample from which to determine the phase error - * - * This function determines the phase error using a simple BPSK - * phase error detector by multiplying the real and imaginary (the - * error signal) components together. As the imaginary part goes to - * 0, so does this error. - * - * \returns the approximated phase error. - */ - float phase_error_detector_bpsk(gr_complex sample) const; // optimized for BPSK - - /*! - * \brief Phase error detector for QPSK modulation. - * - * \param sample the I&Q sample from which to determine the phase error - * - * This function determines the phase error using the limiter - * approach in a standard 4th order Costas loop - * - * \returns the approximated phase error. - */ - float phase_error_detector_qpsk(gr_complex sample) const; - - - - /*! - * \brief Decision maker for a generic MPSK constellation. - * - * \param sample the baseband I&Q sample from which to make the decision - * - * This decision maker is a generic implementation that does a - * brute-force search for the constellation point that minimizes the - * error between it and the incoming signal. - * - * \returns the index to d_constellation that minimizes the error/ - */ - unsigned int decision_generic(gr_complex sample) const; - - - /*! - * \brief Decision maker for BPSK constellation. - * - * \param sample the baseband I&Q sample from which to make the decision - * - * This decision maker is a simple slicer function that makes a - * decision on the symbol based on its placement on the real axis of - * greater than 0 or less than 0; the quadrature component is always - * 0. - * - * \returns the index to d_constellation that minimizes the error/ - */ - unsigned int decision_bpsk(gr_complex sample) const; - - - /*! - * \brief Decision maker for QPSK constellation. - * - * \param sample the baseband I&Q sample from which to make the decision - * - * This decision maker is a simple slicer function that makes a - * decision on the symbol based on its placement versus both axes - * and returns which quadrant the symbol is in. - * - * \returns the index to d_constellation that minimizes the error/ - */ - unsigned int decision_qpsk(gr_complex sample) const; - -private: - unsigned int d_M; - float d_theta; - - /*! - * \brief Decision maker function pointer - * - * \param sample the baseband I&Q sample from which to make the decision - * - * This is a function pointer that is set in the constructor to - * point to the proper decision function for the specified - * constellation order. - * - * \return index into d_constellation point that is the closest to the recieved sample - */ - unsigned int (digital_mpsk_receiver_cc::*d_decision)(gr_complex sample) const; // pointer to decision function - - - std::vector<gr_complex> d_constellation; - unsigned int d_current_const_point; - - // Members related to symbol timing - float d_mu, d_gain_mu; - float d_omega, d_gain_omega, d_omega_rel, d_max_omega, d_min_omega, d_omega_mid; - gr_complex d_p_2T, d_p_1T, d_p_0T; - gr_complex d_c_2T, d_c_1T, d_c_0T; - - /*! - * \brief Phase error detector function pointer - * - * \param sample the I&Q sample from which to determine the phase error - * - * This is a function pointer that is set in the constructor to - * point to the proper phase error detector function for the - * specified constellation order. - */ - float (digital_mpsk_receiver_cc::*d_phase_error_detector)(gr_complex sample) const; - - - //! get interpolated value - gri_mmse_fir_interpolator_cc *d_interp; - - //! delay line length. - static const unsigned int DLLEN = 8; - - //! delay line plus some length for overflow protection - __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN]; - - //! index to delay line - unsigned int d_dl_idx; - - friend DIGITAL_API digital_mpsk_receiver_cc_sptr - digital_make_mpsk_receiver_cc (unsigned int M, float theta, - float loop_bw, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel); -}; - -#endif diff --git a/gr-digital/include/digital_mpsk_snr_est_cc.h b/gr-digital/include/digital_mpsk_snr_est_cc.h deleted file mode 100644 index 2cbd98bab..000000000 --- a/gr-digital/include/digital_mpsk_snr_est_cc.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H -#define INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <digital_impl_mpsk_snr_est.h> - -class digital_mpsk_snr_est_cc; -typedef boost::shared_ptr<digital_mpsk_snr_est_cc> digital_mpsk_snr_est_cc_sptr; - -DIGITAL_API digital_mpsk_snr_est_cc_sptr -digital_make_mpsk_snr_est_cc(snr_est_type_t type, - int tag_nsamples=10000, - double alpha=0.001); - -//! \brief A block for computing SNR of a signal. -/*! \ingroup snr_blk - * - * This block can be used to monitor and retrieve estimations of the - * signal SNR. It is designed to work in a flowgraph and passes all - * incoming data along to its output. - * - * The block is designed for use with M-PSK signals especially. The - * type of estimator is specified as the \p type parameter in the - * constructor. The estimators tend to trade off performance for - * accuracy, although experimentation should be done to figure out - * the right approach for a given implementation. Further, the - * current set of estimators are designed and proven theoretically - * under AWGN conditions; some amount of error should be assumed - * and/or estimated for real channel conditions. - */ -class DIGITAL_API digital_mpsk_snr_est_cc : public gr_sync_block -{ - private: - snr_est_type_t d_type; - int d_nsamples, d_count; - double d_alpha; - digital_impl_mpsk_snr_est *d_snr_est; - - //d_key is the tag name, 'snr', d_me is the block name + unique ID - pmt::pmt_t d_key, d_me; - - /*! Factory function returning shared pointer of this class - * - * Parameters: - * - * \param type: the type of estimator to use \ref ref_snr_est_types - * "snr_est_type_t" for details about the available types. - * \param tag_nsamples: after this many samples, a tag containing - * the SNR (key='snr') will be sent - * \param alpha: the update rate of internal running average - * calculations. - */ - friend DIGITAL_API digital_mpsk_snr_est_cc_sptr - digital_make_mpsk_snr_est_cc(snr_est_type_t type, - int tag_nsamples, - double alpha); - - // Private constructor - digital_mpsk_snr_est_cc(snr_est_type_t type, - int tag_nsamples, - double alpha); - -public: - - ~digital_mpsk_snr_est_cc(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - //! Return the estimated signal-to-noise ratio in decibels - double snr(); - - //! Return the type of estimator in use - snr_est_type_t type() const; - - //! Return how many samples between SNR tags - int tag_nsample() const; - - //! Get the running-average coefficient - double alpha() const; - - //! Set type of estimator to use - void set_type(snr_est_type_t t); - - //! Set the number of samples between SNR tags - void set_tag_nsample(int n); - - //! Set the running-average coefficient - void set_alpha(double alpha); -}; - -#endif /* INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H */ diff --git a/gr-digital/include/digital_ofdm_cyclic_prefixer.h b/gr-digital/include/digital_ofdm_cyclic_prefixer.h deleted file mode 100644 index 1b9682bb3..000000000 --- a/gr-digital/include/digital_ofdm_cyclic_prefixer.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004-2006,2011 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 INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H -#define INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H - -#include <digital_api.h> -#include <gr_sync_interpolator.h> -#include <stdio.h> - -class digital_ofdm_cyclic_prefixer; -typedef boost::shared_ptr<digital_ofdm_cyclic_prefixer> digital_ofdm_cyclic_prefixer_sptr; - -DIGITAL_API digital_ofdm_cyclic_prefixer_sptr -digital_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); - - -/*! - * \brief adds a cyclic prefix vector to an input size long ofdm - * symbol(vector) and converts vector to a stream output_size long. - * \ingroup ofdm_blk - */ -class DIGITAL_API digital_ofdm_cyclic_prefixer : public gr_sync_interpolator -{ - friend DIGITAL_API digital_ofdm_cyclic_prefixer_sptr - digital_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); - - protected: - digital_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - private: - size_t d_input_size; - size_t d_output_size; -}; - -#endif /* INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H */ diff --git a/gr-digital/include/digital_ofdm_frame_acquisition.h b/gr-digital/include/digital_ofdm_frame_acquisition.h deleted file mode 100644 index 9c2f60233..000000000 --- a/gr-digital/include/digital_ofdm_frame_acquisition.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2011 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 INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_H -#define INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_H - -#include <digital_api.h> -#include <gr_block.h> -#include <vector> - -class digital_ofdm_frame_acquisition; -typedef boost::shared_ptr<digital_ofdm_frame_acquisition> digital_ofdm_frame_acquisition_sptr; - -digital_ofdm_frame_acquisition_sptr -DIGITAL_API digital_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len=10); - -/*! - * \brief take a vector of complex constellation points in from an FFT - * and performs a correlation and equalization. - * \ingroup demodulation_blk - * \ingroup ofdm_blk - * - * This block takes the output of an FFT of a received OFDM symbol and finds the - * start of a frame based on two known symbols. It also looks at the surrounding - * bins in the FFT output for the correlation in case there is a large frequency - * shift in the data. This block assumes that the fine frequency shift has already - * been corrected and that the samples fall in the middle of one FFT bin. - * - * It then uses one of those known - * symbols to estimate the channel response over all subcarriers and does a simple - * 1-tap equalization on all subcarriers. This corrects for the phase and amplitude - * distortion caused by the channel. - */ - -class DIGITAL_API digital_ofdm_frame_acquisition : public gr_block -{ - /*! - * \brief Build an OFDM correlator and equalizer. - * \param occupied_carriers The number of subcarriers with data in the received symbol - * \param fft_length The size of the FFT vector (occupied_carriers + unused carriers) - * \param cplen The length of the cycle prefix - * \param known_symbol A vector of complex numbers representing a known symbol at the - * start of a frame (usually a BPSK PN sequence) - * \param max_fft_shift_len Set's the maximum distance you can look between bins for correlation - */ - friend DIGITAL_API digital_ofdm_frame_acquisition_sptr - digital_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len); - -protected: - digital_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len); - - private: - unsigned char slicer(gr_complex x); - void correlate(const gr_complex *symbol, int zeros_on_left); - void calculate_equalizer(const gr_complex *symbol, int zeros_on_left); - gr_complex coarse_freq_comp(int freq_delta, int count); - - unsigned int d_occupied_carriers; // !< \brief number of subcarriers with data - unsigned int d_fft_length; // !< \brief length of FFT vector - unsigned int d_cplen; // !< \brief length of cyclic prefix in samples - unsigned int d_freq_shift_len; // !< \brief number of surrounding bins to look at for correlation - std::vector<gr_complex> d_known_symbol; // !< \brief known symbols at start of frame - std::vector<float> d_known_phase_diff; // !< \brief factor used in correlation from known symbol - std::vector<float> d_symbol_phase_diff; // !< \brief factor used in correlation from received symbol - std::vector<gr_complex> d_hestimate; // !< channel estimate - int d_coarse_freq; // !< \brief search distance in number of bins - unsigned int d_phase_count; // !< \brief accumulator for coarse freq correction - float d_snr_est; // !< an estimation of the signal to noise ratio - - gr_complex *d_phase_lut; // !< look-up table for coarse frequency compensation - - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - - public: - /*! - * \brief Return an estimate of the SNR of the channel - */ - float snr() { return d_snr_est; } - - ~digital_ofdm_frame_acquisition(void); - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gr-digital/include/digital_ofdm_frame_sink.h b/gr-digital/include/digital_ofdm_frame_sink.h deleted file mode 100644 index 5785d4be7..000000000 --- a/gr-digital/include/digital_ofdm_frame_sink.h +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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 INCLUDED_DIGITAL_OFDM_FRAME_SINK_H -#define INCLUDED_DIGITAL_OFDM_FRAME_SINK_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> - -class digital_ofdm_frame_sink; -typedef boost::shared_ptr<digital_ofdm_frame_sink> digital_ofdm_frame_sink_sptr; - -DIGITAL_API digital_ofdm_frame_sink_sptr -digital_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain=0.25, float freq_gain=0.25*0.25/4.0); - -/*! - * \brief Takes an OFDM symbol in, demaps it into bits of 0's and 1's, packs - * them into packets, and sends to to a message queue sink. - * \ingroup sink_blk - * \ingroup ofdm_blk - * - * NOTE: The mod input parameter simply chooses a pre-defined demapper/slicer. Eventually, - * we want to be able to pass in a reference to an object to do the demapping and slicing - * for a given modulation type. - */ -class DIGITAL_API digital_ofdm_frame_sink : public gr_sync_block -{ - friend DIGITAL_API digital_ofdm_frame_sink_sptr - digital_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain, float freq_gain); - - private: - enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER}; - - static const int MAX_PKT_LEN = 4096; - static const int HEADERBYTELEN = 4; - - gr_msg_queue_sptr d_target_queue; // where to send the packet when received - state_t d_state; - unsigned int d_header; // header bits - int d_headerbytelen_cnt; // how many so far - - unsigned char *d_bytes_out; // hold the current bytes produced by the demapper - - unsigned int d_occupied_carriers; - unsigned int d_byte_offset; - unsigned int d_partial_byte; - - unsigned char d_packet[MAX_PKT_LEN]; // assembled payload - int d_packetlen; // length of packet - int d_packet_whitener_offset; // offset into whitener string to use - int d_packetlen_cnt; // how many so far - - gr_complex * d_derotated_output; // Pointer to output stream to send deroated symbols out - - std::vector<gr_complex> d_sym_position; - std::vector<unsigned char> d_sym_value_out; - std::vector<gr_complex> d_dfe; - unsigned int d_nbits; - - unsigned char d_resid; - unsigned int d_nresid; - float d_phase; - float d_freq; - float d_phase_gain; - float d_freq_gain; - float d_eq_gain; - - std::vector<int> d_subcarrier_map; - - protected: - digital_ofdm_frame_sink(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain, float freq_gain); - - void enter_search(); - void enter_have_sync(); - void enter_have_header(); - - bool header_ok() - { - // confirm that two copies of header info are identical - return ((d_header >> 16) ^ (d_header & 0xffff)) == 0; - } - - unsigned char slicer(const gr_complex x); - unsigned int demapper(const gr_complex *in, - unsigned char *out); - - bool set_sym_value_out(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out); - - public: - ~digital_ofdm_frame_sink(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_OFDM_FRAME_SINK_H */ diff --git a/gr-digital/include/digital_ofdm_insert_preamble.h b/gr-digital/include/digital_ofdm_insert_preamble.h deleted file mode 100644 index fa44558ad..000000000 --- a/gr-digital/include/digital_ofdm_insert_preamble.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H -#define INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H - -#include <digital_api.h> -#include <gr_block.h> -#include <vector> - -class digital_ofdm_insert_preamble; -typedef boost::shared_ptr<digital_ofdm_insert_preamble> digital_ofdm_insert_preamble_sptr; - -DIGITAL_API digital_ofdm_insert_preamble_sptr -digital_make_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble); - -/*! - * \brief insert "pre-modulated" preamble symbols before each payload. - * \ingroup sync_blk - * \ingroup ofdm_blk - * - * <pre> - * input 1: stream of vectors of gr_complex [fft_length] - * These are the modulated symbols of the payload. - * - * input 2: stream of char. The LSB indicates whether the corresponding - * symbol on input 1 is the first symbol of the payload or not. - * It's a 1 if the corresponding symbol is the first symbol, - * otherwise 0. - * - * N.B., this implies that there must be at least 1 symbol in the payload. - * - * - * output 1: stream of vectors of gr_complex [fft_length] - * These include the preamble symbols and the payload symbols. - * - * output 2: stream of char. The LSB indicates whether the corresponding - * symbol on input 1 is the first symbol of a packet (i.e., the - * first symbol of the preamble.) It's a 1 if the corresponding - * symbol is the first symbol, otherwise 0. - * </pre> - * - * \param fft_length length of each symbol in samples. - * \param preamble vector of symbols that represent the pre-modulated preamble. - */ - -class DIGITAL_API digital_ofdm_insert_preamble : public gr_block -{ - friend DIGITAL_API digital_ofdm_insert_preamble_sptr - digital_make_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble); - -protected: - digital_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble); - -private: - enum state_t { - ST_IDLE, - ST_PREAMBLE, - ST_FIRST_PAYLOAD, - ST_PAYLOAD - }; - - int d_fft_length; - const std::vector<std::vector<gr_complex> > d_preamble; - state_t d_state; - int d_nsymbols_output; - int d_pending_flag; - - void enter_idle(); - void enter_first_payload(); - void enter_payload(); - - -public: - ~digital_ofdm_insert_preamble(); - void enter_preamble(); - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - -}; - -#endif /* INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H */ diff --git a/gr-digital/include/digital_ofdm_mapper_bcv.h b/gr-digital/include/digital_ofdm_mapper_bcv.h deleted file mode 100644 index daed1eab2..000000000 --- a/gr-digital/include/digital_ofdm_mapper_bcv.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2011 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 INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H -#define INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class digital_ofdm_mapper_bcv; -typedef boost::shared_ptr<digital_ofdm_mapper_bcv> digital_ofdm_mapper_bcv_sptr; - -DIGITAL_API digital_ofdm_mapper_bcv_sptr -digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, - unsigned occupied_carriers, unsigned int fft_length); - -/*! - * \brief take a stream of bytes in and map to a vector of complex - * constellation points suitable for IFFT input to be used in an ofdm - * modulator. Abstract class must be subclassed with specific mapping. - * \ingroup modulation_blk - * \ingroup ofdm_blk - */ - -class DIGITAL_API digital_ofdm_mapper_bcv : public gr_sync_block -{ - friend DIGITAL_API digital_ofdm_mapper_bcv_sptr - digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, - unsigned occupied_carriers, unsigned int fft_length); -protected: - digital_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, - unsigned occupied_carriers, unsigned int fft_length); - - private: - std::vector<gr_complex> d_constellation; - gr_msg_queue_sptr d_msgq; - gr_message_sptr d_msg; - unsigned d_msg_offset; - bool d_eof; - - unsigned int d_occupied_carriers; - unsigned int d_fft_length; - unsigned int d_bit_offset; - int d_pending_flag; - - unsigned long d_nbits; - unsigned char d_msgbytes; - - unsigned char d_resid; - unsigned int d_nresid; - - std::vector<int> d_subcarrier_map; - - int randsym(); - - public: - ~digital_ofdm_mapper_bcv(void); - - gr_msg_queue_sptr msgq() const { return d_msgq; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -}; - -#endif diff --git a/gr-digital/include/digital_ofdm_sampler.h b/gr-digital/include/digital_ofdm_sampler.h deleted file mode 100644 index 9c54e4e77..000000000 --- a/gr-digital/include/digital_ofdm_sampler.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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 INCLUDED_DIGITAL_OFDM_SAMPLER_H -#define INCLUDED_DIGITAL_OFDM_SAMPLER_H - -#include <digital_api.h> -#include <gr_sync_block.h> - -class digital_ofdm_sampler; -typedef boost::shared_ptr<digital_ofdm_sampler> digital_ofdm_sampler_sptr; - -DIGITAL_API digital_ofdm_sampler_sptr digital_make_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout=1000); - -/*! - * \brief does the rest of the OFDM stuff - * \ingroup ofdm_blk - */ -class DIGITAL_API digital_ofdm_sampler : public gr_block -{ - friend DIGITAL_API digital_ofdm_sampler_sptr digital_make_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout); - - digital_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout); - - private: - enum state_t {STATE_NO_SIG, STATE_PREAMBLE, STATE_FRAME}; - - state_t d_state; - unsigned int d_timeout_max; - unsigned int d_timeout; - unsigned int d_fft_length; - unsigned int d_symbol_length; - - public: - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-digital/include/digital_packet_sink.h b/gr-digital/include/digital_packet_sink.h deleted file mode 100644 index 7ab41c0ef..000000000 --- a/gr-digital/include/digital_packet_sink.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 INCLUDED_GR_PACKET_SINK_H -#define INCLUDED_GR_PACKET_SINK_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> - -class digital_packet_sink; -typedef boost::shared_ptr<digital_packet_sink> digital_packet_sink_sptr; - -DIGITAL_API digital_packet_sink_sptr -digital_make_packet_sink(const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, - int threshold = -1); // -1 -> use default - -/*! - * \brief process received bits looking for packet sync, header, and process bits into packet - * \ingroup sink_blk - * - * input: stream of symbols to be sliced. - * - * output: none. Pushes assembled packet into target queue - * - * The packet sink takes in a stream of binary symbols that are sliced - * around 0. The bits are then checked for the \p sync_vector to - * determine find and decode the packet. It then expects a fixed - * length header of 2 16-bit shorts containing the payload length, - * followed by the payload. If the 2 16-bit shorts are not identical, - * this packet is ignored. Better algs are welcome. - * - * This block is not very useful anymore as it only works with 2-level - * modulations such as BPSK or GMSK. The block can generally be - * replaced with a correlate access code and frame sink blocks. - * - * \param sync_vector The synchronization vector as a vector of 1's and 0's. - * \param target_queue The message queue that packets are sent to. - * \param threshold Number of bits that can be incorrect in the \p sync_vector. - */ -class DIGITAL_API digital_packet_sink : public gr_sync_block -{ - friend DIGITAL_API digital_packet_sink_sptr - digital_make_packet_sink(const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, - int threshold); - - private: - enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER}; - - static const int MAX_PKT_LEN = 4096; - static const int HEADERBITLEN = 32; - - gr_msg_queue_sptr d_target_queue; // where to send the packet when received - unsigned long long d_sync_vector; // access code to locate start of packet - unsigned int d_threshold; // how many bits may be wrong in sync vector - - state_t d_state; - - unsigned long long d_shift_reg; // used to look for sync_vector - - unsigned int d_header; // header bits - int d_headerbitlen_cnt; // how many so far - - unsigned char d_packet[MAX_PKT_LEN]; // assembled payload - unsigned char d_packet_byte; // byte being assembled - int d_packet_byte_index; // which bit of d_packet_byte we're working on - int d_packetlen; // length of packet - int d_packetlen_cnt; // how many so far - - protected: - digital_packet_sink(const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, - int threshold); - - void enter_search(); - void enter_have_sync(); - void enter_have_header(int payload_len); - - int slice(float x) { return x > 0 ? 1 : 0; } - - bool header_ok() - { - // confirm that two copies of header info are identical - return ((d_header >> 16) ^ (d_header & 0xffff)) == 0; - } - - int header_payload_len() - { - // header consists of two 16-bit shorts in network byte order - int t = (d_header >> 16) & 0xffff; - return t; - } - - public: - ~digital_packet_sink(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - - //! return true if we detect carrier - bool carrier_sensed() const - { - return d_state != STATE_SYNC_SEARCH; - } - -}; - -#endif /* INCLUDED_GR_PACKET_SINK_H */ diff --git a/gr-digital/include/digital_pfb_clock_sync_ccf.h b/gr-digital/include/digital_pfb_clock_sync_ccf.h deleted file mode 100644 index 1b403ab25..000000000 --- a/gr-digital/include/digital_pfb_clock_sync_ccf.h +++ /dev/null @@ -1,376 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010,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 INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_H -#define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_H - -#include <digital_api.h> -#include <gr_block.h> - -class digital_pfb_clock_sync_ccf; -typedef boost::shared_ptr<digital_pfb_clock_sync_ccf> digital_pfb_clock_sync_ccf_sptr; -DIGITAL_API digital_pfb_clock_sync_ccf_sptr -digital_make_pfb_clock_sync_ccf(double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size=32, - float init_phase=0, - float max_rate_deviation=1.5, - int osps=1); - -class gr_fir_ccf; - -/*! - * \class digital_pfb_clock_sync_ccf - * - * \brief Timing synchronizer using polyphase filterbanks - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block performs timing synchronization for PAM signals by - * minimizing the derivative of the filtered signal, which in turn - * maximizes the SNR and minimizes ISI. - * - * This approach works by setting up two filterbanks; one filterbank - * contains the signal's pulse shaping matched filter (such as a root - * raised cosine filter), where each branch of the filterbank contains - * a different phase of the filter. The second filterbank contains - * the derivatives of the filters in the first filterbank. Thinking of - * this in the time domain, the first filterbank contains filters that - * have a sinc shape to them. We want to align the output signal to be - * sampled at exactly the peak of the sinc shape. The derivative of - * the sinc contains a zero at the maximum point of the sinc (sinc(0) - * = 1, sinc(0)' = 0). Furthermore, the region around the zero point - * is relatively linear. We make use of this fact to generate the - * error signal. - * - * If the signal out of the derivative filters is d_i[n] for the ith - * filter, and the output of the matched filter is x_i[n], we - * calculate the error as: e[n] = (Re{x_i[n]} * Re{d_i[n]} + - * Im{x_i[n]} * Im{d_i[n]}) / 2.0 This equation averages the error in - * the real and imaginary parts. There are two reasons we multiply by - * the signal itself. First, if the symbol could be positive or - * negative going, but we want the error term to always tell us to go - * in the same direction depending on which side of the zero point we - * are on. The sign of x_i[n] adjusts the error term to do - * this. Second, the magnitude of x_i[n] scales the error term - * depending on the symbol's amplitude, so larger signals give us a - * stronger error term because we have more confidence in that - * symbol's value. Using the magnitude of x_i[n] instead of just the - * sign is especially good for signals with low SNR. - * - * The error signal, e[n], gives us a value proportional to how far - * away from the zero point we are in the derivative signal. We want - * to drive this value to zero, so we set up a second order loop. We - * have two variables for this loop; d_k is the filter number in the - * filterbank we are on and d_rate is the rate which we travel through - * the filters in the steady state. That is, due to the natural clock - * differences between the transmitter and receiver, d_rate represents - * that difference and would traverse the filter phase paths to keep - * the receiver locked. Thinking of this as a second-order PLL, the - * d_rate is the frequency and d_k is the phase. So we update d_rate - * and d_k using the standard loop equations based on two error - * signals, d_alpha and d_beta. We have these two values set based on - * each other for a critically damped system, so in the block - * constructor, we just ask for "gain," which is d_alpha while d_beta - * is equal to (gain^2)/4. - * - * The block's parameters are: - * - * \li \p sps: The clock sync block needs to know the number of samples per - * symbol, because it defaults to return a single point representing - * the symbol. The sps can be any positive real number and does not - * need to be an integer. - * - * \li \p loop_bw: The loop bandwidth is used to set the gain of the - * inner control loop (see: - * http://gnuradio.squarespace.com/blog/2011/8/13/control-loop-gain-values.html). - * This should be set small (a value of around 2pi/100 is suggested in - * that blog post as the step size for the number of radians around - * the unit circle to move relative to the error). - * - * \li \p taps: One of the most important parameters for this block is - * the taps of the filter. One of the benefits of this algorithm is - * that you can put the matched filter in here as the taps, so you get - * both the matched filter and sample timing correction in one go. So - * create your normal matched filter. For a typical digital - * modulation, this is a root raised cosine filter. The number of taps - * of this filter is based on how long you expect the channel to be; - * that is, how many symbols do you want to combine to get the current - * symbols energy back (there's probably a better way of stating - * that). It's usually 5 to 10 or so. That gives you your filter, but - * now we need to think about it as a filter with different phase - * profiles in each filter. So take this number of taps and multiply - * it by the number of filters. This is the number you would use to - * create your prototype filter. When you use this in the PFB - * filerbank, it segments these taps into the filterbanks in such a - * way that each bank now represents the filter at different phases, - * equally spaced at 2pi/N, where N is the number of filters. - * - * \li \p filter_size (default=32): The number of filters can also be - * set and defaults to 32. With 32 filters, you get a good enough - * resolution in the phase to produce very small, almost unnoticeable, - * ISI. Going to 64 filters can reduce this more, but after that - * there is very little gained for the extra complexity. - * - * \li \p init_phase (default=0): The initial phase is another - * settable parameter and refers to the filter path the algorithm - * initially looks at (i.e., d_k starts at init_phase). This value - * defaults to zero, but it might be useful to start at a different - * phase offset, such as the mid-point of the filters. - * - * \li \p max_rate_deviation (default=1.5): The next parameter is the - * max_rate_devitation, which defaults to 1.5. This is how far we - * allow d_rate to swing, positive or negative, from 0. Constraining - * the rate can help keep the algorithm from walking too far away to - * lock during times when there is no signal. - * - * \li \p osps (default=1): The osps is the number of output samples per symbol. By default, - * the algorithm produces 1 sample per symbol, sampled at the exact - * sample value. This osps value was added to better work with - * equalizers, which do a better job of modeling the channel if they - * have 2 samps/sym. - */ - -class DIGITAL_API digital_pfb_clock_sync_ccf : public gr_block -{ - private: - /*! - * Build the polyphase filterbank timing synchronizer. - * \param sps (double) The number of samples per symbol in the incoming signal - * \param loop_bw (float) The bandwidth of the control loop; set's alpha and beta. - * \param taps (vector<int>) The filter taps. - * \param filter_size (uint) The number of filters in the filterbank (default = 32). - * \param init_phase (float) The initial phase to look at, or which filter to start - * with (default = 0). - * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5). - * \param osps (int) The number of output samples per symbol (default=1). - * - */ - friend DIGITAL_API digital_pfb_clock_sync_ccf_sptr - digital_make_pfb_clock_sync_ccf(double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps); - - bool d_updated; - double d_sps; - double d_sample_num; - float d_loop_bw; - float d_damping; - float d_alpha; - float d_beta; - - int d_nfilters; - int d_taps_per_filter; - std::vector<gr_fir_ccf*> d_filters; - std::vector<gr_fir_ccf*> d_diff_filters; - std::vector< std::vector<float> > d_taps; - std::vector< std::vector<float> > d_dtaps; - - float d_k; - float d_rate; - float d_rate_i; - float d_rate_f; - float d_max_dev; - int d_filtnum; - int d_osps; - float d_error; - int d_out_idx; - - /*! - * Build the polyphase filterbank timing synchronizer. - */ - digital_pfb_clock_sync_ccf(double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps); - - void create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps); - -public: - ~digital_pfb_clock_sync_ccf(); - - /*! \brief update the system gains from omega and eta - * - * This function updates the system gains based on the loop - * bandwidth and damping factor of the system. - * These two factors can be set separately through their own - * set functions. - */ - void update_gains(); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - */ - void set_taps(const std::vector<float> &taps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_ccf*> &ourfilter); - - /*! - * Returns all of the taps of the matched filter - */ - std::vector< std::vector<float> > get_taps(); - - /*! - * Returns all of the taps of the derivative filter - */ - std::vector< std::vector<float> > get_diff_taps(); - - /*! - * Returns the taps of the matched filter for a particular channel - */ - std::vector<float> get_channel_taps(int channel); - - /*! - * Returns the taps in the derivative filter for a particular channel - */ - std::vector<float> get_diff_channel_taps(int channel); - - /*! - * Return the taps as a formatted string for printing - */ - std::string get_taps_as_string(); - - /*! - * Return the derivative filter taps as a formatted string for printing - */ - std::string get_diff_taps_as_string(); - - - /******************************************************************* - SET FUNCTIONS - *******************************************************************/ - - - /*! - * \brief Set the loop bandwidth - * - * Set the loop filter's bandwidth to \p bw. This should be between - * 2*pi/200 and 2*pi/100 (in rads/samp). It must also be a positive - * number. - * - * When a new damping factor is set, the gains, alpha and beta, of the loop - * are recalculated by a call to update_gains(). - * - * \param bw (float) new bandwidth - * - */ - void set_loop_bandwidth(float bw); - - /*! - * \brief Set the loop damping factor - * - * Set the loop filter's damping factor to \p df. The damping factor - * should be sqrt(2)/2.0 for critically damped systems. - * Set it to anything else only if you know what you are doing. It must - * be a number between 0 and 1. - * - * When a new damping factor is set, the gains, alpha and beta, of the loop - * are recalculated by a call to update_gains(). - * - * \param df (float) new damping factor - * - */ - void set_damping_factor(float df); - - /*! - * \brief Set the loop gain alpha - * - * Set's the loop filter's alpha gain parameter. - * - * This value should really only be set by adjusting the loop bandwidth - * and damping factor. - * - * \param alpha (float) new alpha gain - * - */ - void set_alpha(float alpha); - - /*! - * \brief Set the loop gain beta - * - * Set's the loop filter's beta gain parameter. - * - * This value should really only be set by adjusting the loop bandwidth - * and damping factor. - * - * \param beta (float) new beta gain - * - */ - void set_beta(float beta); - - /*! - * Set the maximum deviation from 0 d_rate can have - */ - void set_max_rate_deviation(float m) - { - d_max_dev = m; - } - - /******************************************************************* - GET FUNCTIONS - *******************************************************************/ - - /*! - * \brief Returns the loop bandwidth - */ - float get_loop_bandwidth() const; - - /*! - * \brief Returns the loop damping factor - */ - float get_damping_factor() const; - - /*! - * \brief Returns the loop gain alpha - */ - float get_alpha() const; - - /*! - * \brief Returns the loop gain beta - */ - float get_beta() const; - - /*! - * \brief Returns the current clock rate - */ - float get_clock_rate() const; - - /******************************************************************* - *******************************************************************/ - - bool check_topology(int ninputs, int noutputs); - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-digital/include/digital_pfb_clock_sync_fff.h b/gr-digital/include/digital_pfb_clock_sync_fff.h deleted file mode 100644 index c7e8babd6..000000000 --- a/gr-digital/include/digital_pfb_clock_sync_fff.h +++ /dev/null @@ -1,376 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010,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 INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_H -#define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_H - -#include <digital_api.h> -#include <gr_block.h> - -class digital_pfb_clock_sync_fff; -typedef boost::shared_ptr<digital_pfb_clock_sync_fff> digital_pfb_clock_sync_fff_sptr; -DIGITAL_API digital_pfb_clock_sync_fff_sptr -digital_make_pfb_clock_sync_fff(double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size=32, - float init_phase=0, - float max_rate_deviation=1.5, - int osps=1); - -class gr_fir_fff; - -/*! - * \class digital_pfb_clock_sync_fff - * - * \brief Timing synchronizer using polyphase filterbanks - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block performs timing synchronization for PAM signals by - * minimizing the derivative of the filtered signal, which in turn - * maximizes the SNR and minimizes ISI. - * - * This approach works by setting up two filterbanks; one filterbank - * contains the signal's pulse shaping matched filter (such as a root - * raised cosine filter), where each branch of the filterbank contains - * a different phase of the filter. The second filterbank contains - * the derivatives of the filters in the first filterbank. Thinking of - * this in the time domain, the first filterbank contains filters that - * have a sinc shape to them. We want to align the output signal to be - * sampled at exactly the peak of the sinc shape. The derivative of - * the sinc contains a zero at the maximum point of the sinc (sinc(0) - * = 1, sinc(0)' = 0). Furthermore, the region around the zero point - * is relatively linear. We make use of this fact to generate the - * error signal. - * - * If the signal out of the derivative filters is d_i[n] for the ith - * filter, and the output of the matched filter is x_i[n], we - * calculate the error as: e[n] = (Re{x_i[n]} * Re{d_i[n]} + - * Im{x_i[n]} * Im{d_i[n]}) / 2.0 This equation averages the error in - * the real and imaginary parts. There are two reasons we multiply by - * the signal itself. First, if the symbol could be positive or - * negative going, but we want the error term to always tell us to go - * in the same direction depending on which side of the zero point we - * are on. The sign of x_i[n] adjusts the error term to do - * this. Second, the magnitude of x_i[n] scales the error term - * depending on the symbol's amplitude, so larger signals give us a - * stronger error term because we have more confidence in that - * symbol's value. Using the magnitude of x_i[n] instead of just the - * sign is especially good for signals with low SNR. - * - * The error signal, e[n], gives us a value proportional to how far - * away from the zero point we are in the derivative signal. We want - * to drive this value to zero, so we set up a second order loop. We - * have two variables for this loop; d_k is the filter number in the - * filterbank we are on and d_rate is the rate which we travel through - * the filters in the steady state. That is, due to the natural clock - * differences between the transmitter and receiver, d_rate represents - * that difference and would traverse the filter phase paths to keep - * the receiver locked. Thinking of this as a second-order PLL, the - * d_rate is the frequency and d_k is the phase. So we update d_rate - * and d_k using the standard loop equations based on two error - * signals, d_alpha and d_beta. We have these two values set based on - * each other for a critically damped system, so in the block - * constructor, we just ask for "gain," which is d_alpha while d_beta - * is equal to (gain^2)/4. - * - * The block's parameters are: - * - * \li \p sps: The clock sync block needs to know the number of samples per - * symbol, because it defaults to return a single point representing - * the symbol. The sps can be any positive real number and does not - * need to be an integer. - * - * \li \p loop_bw: The loop bandwidth is used to set the gain of the - * inner control loop (see: - * http://gnuradio.squarespace.com/blog/2011/8/13/control-loop-gain-values.html). - * This should be set small (a value of around 2pi/100 is suggested in - * that blog post as the step size for the number of radians around - * the unit circle to move relative to the error). - * - * \li \p taps: One of the most important parameters for this block is - * the taps of the filter. One of the benefits of this algorithm is - * that you can put the matched filter in here as the taps, so you get - * both the matched filter and sample timing correction in one go. So - * create your normal matched filter. For a typical digital - * modulation, this is a root raised cosine filter. The number of taps - * of this filter is based on how long you expect the channel to be; - * that is, how many symbols do you want to combine to get the current - * symbols energy back (there's probably a better way of stating - * that). It's usually 5 to 10 or so. That gives you your filter, but - * now we need to think about it as a filter with different phase - * profiles in each filter. So take this number of taps and multiply - * it by the number of filters. This is the number you would use to - * create your prototype filter. When you use this in the PFB - * filerbank, it segments these taps into the filterbanks in such a - * way that each bank now represents the filter at different phases, - * equally spaced at 2pi/N, where N is the number of filters. - * - * \li \p filter_size (default=32): The number of filters can also be - * set and defaults to 32. With 32 filters, you get a good enough - * resolution in the phase to produce very small, almost unnoticeable, - * ISI. Going to 64 filters can reduce this more, but after that - * there is very little gained for the extra complexity. - * - * \li \p init_phase (default=0): The initial phase is another - * settable parameter and refers to the filter path the algorithm - * initially looks at (i.e., d_k starts at init_phase). This value - * defaults to zero, but it might be useful to start at a different - * phase offset, such as the mid-point of the filters. - * - * \li \p max_rate_deviation (default=1.5): The next parameter is the - * max_rate_devitation, which defaults to 1.5. This is how far we - * allow d_rate to swing, positive or negative, from 0. Constraining - * the rate can help keep the algorithm from walking too far away to - * lock during times when there is no signal. - * - * \li \p osps (default=1): The osps is the number of output samples - * per symbol. By default, the algorithm produces 1 sample per symbol, - * sampled at the exact sample value. This osps value was added to - * better work with equalizers, which do a better job of modeling the - * channel if they have 2 samps/sym. - */ - -class DIGITAL_API digital_pfb_clock_sync_fff : public gr_block -{ - private: - /*! - * Build the polyphase filterbank timing synchronizer. - * \param sps (double) The number of samples per second in the incoming signal - * \param gain (float) The alpha gain of the control loop; beta = (gain^2)/4 by default. - * \param taps (vector<int>) The filter taps. - * \param filter_size (uint) The number of filters in the filterbank (default = 32). - * \param init_phase (float) The initial phase to look at, or which filter to start - * with (default = 0). - * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5). - * \param osps (int) The number of output samples per symbol (default=1). - * - */ - friend DIGITAL_API digital_pfb_clock_sync_fff_sptr - digital_make_pfb_clock_sync_fff(double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps); - - bool d_updated; - double d_sps; - double d_sample_num; - float d_loop_bw; - float d_damping; - float d_alpha; - float d_beta; - - int d_nfilters; - int d_taps_per_filter; - std::vector<gr_fir_fff*> d_filters; - std::vector<gr_fir_fff*> d_diff_filters; - std::vector< std::vector<float> > d_taps; - std::vector< std::vector<float> > d_dtaps; - - float d_k; - float d_rate; - float d_rate_i; - float d_rate_f; - float d_max_dev; - int d_filtnum; - int d_osps; - float d_error; - int d_out_idx; - - /*! - * Build the polyphase filterbank timing synchronizer. - */ - digital_pfb_clock_sync_fff(double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps); - - void create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps); - -public: - ~digital_pfb_clock_sync_fff (); - - /*! \brief update the system gains from omega and eta - * - * This function updates the system gains based on the loop - * bandwidth and damping factor of the system. - * These two factors can be set separately through their own - * set functions. - */ - void update_gains(); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - */ - void set_taps(const std::vector<float> &taps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_fff*> &ourfilter); - - /*! - * Returns all of the taps of the matched filter - */ - std::vector< std::vector<float> > get_taps(); - - /*! - * Returns all of the taps of the derivative filter - */ - std::vector< std::vector<float> > get_diff_taps(); - - /*! - * Returns the taps of the matched filter for a particular channel - */ - std::vector<float> get_channel_taps(int channel); - - /*! - * Returns the taps in the derivative filter for a particular channel - */ - std::vector<float> get_diff_channel_taps(int channel); - - /*! - * Return the taps as a formatted string for printing - */ - std::string get_taps_as_string(); - - /*! - * Return the derivative filter taps as a formatted string for printing - */ - std::string get_diff_taps_as_string(); - - - /******************************************************************* - SET FUNCTIONS - *******************************************************************/ - - - /*! - * \brief Set the loop bandwidth - * - * Set the loop filter's bandwidth to \p bw. This should be between - * 2*pi/200 and 2*pi/100 (in rads/samp). It must also be a positive - * number. - * - * When a new damping factor is set, the gains, alpha and beta, of the loop - * are recalculated by a call to update_gains(). - * - * \param bw (float) new bandwidth - * - */ - void set_loop_bandwidth(float bw); - - /*! - * \brief Set the loop damping factor - * - * Set the loop filter's damping factor to \p df. The damping factor - * should be sqrt(2)/2.0 for critically damped systems. - * Set it to anything else only if you know what you are doing. It must - * be a number between 0 and 1. - * - * When a new damping factor is set, the gains, alpha and beta, of the loop - * are recalculated by a call to update_gains(). - * - * \param df (float) new damping factor - * - */ - void set_damping_factor(float df); - - /*! - * \brief Set the loop gain alpha - * - * Set's the loop filter's alpha gain parameter. - * - * This value should really only be set by adjusting the loop bandwidth - * and damping factor. - * - * \param alpha (float) new alpha gain - * - */ - void set_alpha(float alpha); - - /*! - * \brief Set the loop gain beta - * - * Set's the loop filter's beta gain parameter. - * - * This value should really only be set by adjusting the loop bandwidth - * and damping factor. - * - * \param beta (float) new beta gain - * - */ - void set_beta(float beta); - - /*! - * Set the maximum deviation from 0 d_rate can have - */ - void set_max_rate_deviation(float m) - { - d_max_dev = m; - } - - /******************************************************************* - GET FUNCTIONS - *******************************************************************/ - - /*! - * \brief Returns the loop bandwidth - */ - float get_loop_bandwidth() const; - - /*! - * \brief Returns the loop damping factor - */ - float get_damping_factor() const; - - /*! - * \brief Returns the loop gain alpha - */ - float get_alpha() const; - - /*! - * \brief Returns the loop gain beta - */ - float get_beta() const; - - /*! - * \brief Returns the current clock rate - */ - float get_clock_rate() const; - - /******************************************************************* - *******************************************************************/ - - bool check_topology(int ninputs, int noutputs); - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-digital/include/digital_pn_correlator_cc.h b/gr-digital/include/digital_pn_correlator_cc.h deleted file mode 100644 index 87cc2ff93..000000000 --- a/gr-digital/include/digital_pn_correlator_cc.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,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 INCLUDED_GR_PN_CORRELATOR_CC_H -#define INCLUDED_GR_PN_CORRELATOR_CC_H - -#include <digital_api.h> -#include <gr_sync_decimator.h> -#include <gri_glfsr.h> - -class digital_pn_correlator_cc; -typedef boost::shared_ptr<digital_pn_correlator_cc> digital_pn_correlator_cc_sptr; - -DIGITAL_API digital_pn_correlator_cc_sptr -digital_make_pn_correlator_cc(int degree, int mask=0, int seed=1); -/*! - * \brief PN code sequential search correlator - * - * \ingroup sync_blk - * - * Receives complex baseband signal, outputs complex correlation - * against reference PN code, one sample per PN code period. The PN - * sequence is generated using a GLFSR. - * - * \param degree Degree of shift register must be in [1, 32]. If mask - * is 0, the degree determines a default mask (see - * digital_impl_glfsr.cc for the mapping). - * \param repeat Set to repeat sequence. - * \param mask Allows a user-defined bit mask for indexes of the shift - * register to feed back. - * \param seed Initial setting for values in shift register. - */ -class DIGITAL_API digital_pn_correlator_cc : public gr_sync_decimator -{ - friend DIGITAL_API digital_pn_correlator_cc_sptr - digital_make_pn_correlator_cc(int degree, int mask, int seed); - - int d_len; - float d_pn; - gri_glfsr *d_reference; - - protected: - digital_pn_correlator_cc(int degree, int mask, int seed); - - public: - virtual int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - ~digital_pn_correlator_cc(); -}; - -#endif /* INCLUDED_GR_PN_CORRELATOR_CC_H */ diff --git a/gr-digital/include/digital_probe_density_b.h b/gr-digital/include/digital_probe_density_b.h deleted file mode 100644 index 271ad2a07..000000000 --- a/gr-digital/include/digital_probe_density_b.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2012 Free Software Foundation, Inc. - * - * 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 INCLUDED_GR_PROBE_DENSITY_B_H -#define INCLUDED_GR_PROBE_DENSITY_B_H - -#include <digital_api.h> -#include <gr_sync_block.h> - -class digital_probe_density_b; - -typedef boost::shared_ptr<digital_probe_density_b> digital_probe_density_b_sptr; - -DIGITAL_API digital_probe_density_b_sptr -digital_make_probe_density_b(double alpha); - -/*! - * This block maintains a running average of the input stream and - * makes it available as an accessor function. The input stream - * is type unsigned char. - * - * If you send this block a stream of unpacked bytes, it will tell - * you what the bit density is. - * - * \param alpha Average filter constant - * - */ - -class DIGITAL_API digital_probe_density_b : public gr_sync_block -{ -private: - friend DIGITAL_API digital_probe_density_b_sptr - digital_make_probe_density_b(double alpha); - - double d_alpha; - double d_beta; - double d_density; - - digital_probe_density_b(double alpha); - -public: - ~digital_probe_density_b(); - - /*! - * \brief Returns the current density value - */ - double density() const { return d_density; } - - /*! - * \brief Set the average filter constant - */ - void set_alpha(double alpha); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_PROBE_DENSITY_B_H */ diff --git a/gr-digital/include/digital_probe_mpsk_snr_est_c.h b/gr-digital/include/digital_probe_mpsk_snr_est_c.h deleted file mode 100644 index a78e90412..000000000 --- a/gr-digital/include/digital_probe_mpsk_snr_est_c.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H -#define INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <digital_impl_mpsk_snr_est.h> - -class digital_probe_mpsk_snr_est_c; -typedef boost::shared_ptr<digital_probe_mpsk_snr_est_c> digital_probe_mpsk_snr_est_c_sptr; - -DIGITAL_API digital_probe_mpsk_snr_est_c_sptr -digital_make_probe_mpsk_snr_est_c(snr_est_type_t type, - int msg_nsamples=10000, - double alpha=0.001); - -//! \brief A probe for computing SNR of a signal. -/*! \ingroup snr_blk - * - * This is a probe block (a sink) that can be used to monitor and - * retrieve estimations of the signal SNR. This probe is designed for - * use with M-PSK signals especially. The type of estimator is - * specified as the \p type parameter in the constructor. The - * estimators tend to trade off performance for accuracy, although - * experimentation should be done to figure out the right approach - * for a given implementation. Further, the current set of estimators - * are designed and proven theoretically under AWGN conditions; some - * amount of error should be assumed and/or estimated for real - * channel conditions. - */ -class DIGITAL_API digital_probe_mpsk_snr_est_c : public gr_sync_block -{ - private: - snr_est_type_t d_type; - int d_nsamples, d_count; - double d_alpha; - digital_impl_mpsk_snr_est *d_snr_est; - - //d_key is the message name, 'snr' - pmt::pmt_t d_key; - - /*! Factory function returning shared pointer of this class - * - * Parameters: - * - * \param type: the type of estimator to use \ref ref_snr_est_types - * "snr_est_type_t" for details about the available types. - * \param msg_nsamples: [not implemented yet] after this many - * samples, a message containing the SNR (key='snr') will be sent - * \param alpha: the update rate of internal running average - * calculations. - */ - friend DIGITAL_API digital_probe_mpsk_snr_est_c_sptr - digital_make_probe_mpsk_snr_est_c(snr_est_type_t type, - int msg_nsamples, - double alpha); - - //! Private constructor - digital_probe_mpsk_snr_est_c(snr_est_type_t type, - int msg_nsamples, - double alpha); - -public: - - ~digital_probe_mpsk_snr_est_c(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - //! Return the estimated signal-to-noise ratio in decibels - double snr(); - - //! Return the type of estimator in use - snr_est_type_t type() const; - - //! Return how many samples between SNR messages - int msg_nsample() const; - - //! Get the running-average coefficient - double alpha() const; - - //! Set type of estimator to use - void set_type(snr_est_type_t t); - - //! Set the number of samples between SNR messages - void set_msg_nsample(int n); - - //! Set the running-average coefficient - void set_alpha(double alpha); -}; - -#endif /* INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H */ diff --git a/gr-digital/include/digital_scrambler_bb.h b/gr-digital/include/digital_scrambler_bb.h deleted file mode 100644 index cafb0e5f2..000000000 --- a/gr-digital/include/digital_scrambler_bb.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 INCLUDED_GR_SCRAMBLER_BB_H -#define INCLUDED_GR_SCRAMBLER_BB_H - -#include <digital_api.h> -#include <gr_sync_block.h> -#include <analog/lfsr.h> - -class digital_scrambler_bb; -typedef boost::shared_ptr<digital_scrambler_bb> digital_scrambler_bb_sptr; - -DIGITAL_API digital_scrambler_bb_sptr -digital_make_scrambler_bb(int mask, int seed, int len); - -/*! - * Scramble an input stream using an LFSR. This block works on the LSB only - * of the input data stream, i.e., on an "unpacked binary" stream, and - * produces the same format on its output. - * - * \param mask Polynomial mask for LFSR - * \param seed Initial shift register contents - * \param len Shift register length - * - * \ingroup coding_blk - */ - -class DIGITAL_API digital_scrambler_bb : public gr_sync_block -{ - friend DIGITAL_API digital_scrambler_bb_sptr - digital_make_scrambler_bb(int mask, int seed, int len); - - gr::analog::lfsr d_lfsr; - - digital_scrambler_bb(int mask, int seed, int len); - -public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_SCRAMBLER_BB_H */ diff --git a/gr-digital/include/digital_simple_correlator.h b/gr-digital/include/digital_simple_correlator.h deleted file mode 100644 index 716c6995c..000000000 --- a/gr-digital/include/digital_simple_correlator.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2013 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 INCLUDED_GR_SIMPLE_CORRELATOR_H -#define INCLUDED_GR_SIMPLE_CORRELATOR_H - -#include <digital_api.h> -#include <gr_block.h> - -class digital_simple_correlator; -typedef boost::shared_ptr<digital_simple_correlator> digital_simple_correlator_sptr; - -DIGITAL_API digital_simple_correlator_sptr digital_make_simple_correlator(int payload_bytesize); - -/*! - * \brief inverse of simple_framer (more or less) - * \ingroup sync_blk - */ -class DIGITAL_API digital_simple_correlator : public gr_block -{ - private: - static const int OVERSAMPLE = 8; - enum state_t { ST_LOOKING, ST_UNDER_THRESHOLD, ST_LOCKED }; - - int d_payload_bytesize; - state_t d_state; - unsigned int d_osi; // over sample index [0,OVERSAMPLE-1] - unsigned int d_transition_osi; // first index where Hamming dist < thresh - unsigned int d_center_osi; // center of bit - unsigned long long int d_shift_reg[OVERSAMPLE]; - int d_bblen; // length of bitbuf - unsigned char *d_bitbuf; // demodulated bits - unsigned char *d_pktbuf; // temp packet buf - int d_bbi; // bitbuf index - - static const int AVG_PERIOD = 512; // must be power of 2 (for freq offset correction) - int d_avbi; - float d_avgbuf[AVG_PERIOD]; - float d_avg; - float d_accum; - -#ifdef DEBUG_SIMPLE_CORRELATOR - FILE *d_debug_fp; // binary log file -#endif - - friend GR_CORE_API digital_simple_correlator_sptr - digital_make_simple_correlator(int payload_bytesize); - digital_simple_correlator(int payload_bytesize); - - inline int slice(float x) - { - return x >= d_avg ? 1 : 0; - } - - void update_avg(float x); - - void enter_locked(); - void enter_under_threshold(); - void enter_looking(); - - static int add_index(int a, int b) - { - int t = a + b; - if(t >= OVERSAMPLE) - t -= OVERSAMPLE; - assert(t >= 0 && t < OVERSAMPLE); - return t; - } - - static int sub_index(int a, int b) - { - int t = a - b; - if(t < 0) - t += OVERSAMPLE; - assert(t >= 0 && t < OVERSAMPLE); - return t; - } - - public: - ~digital_simple_correlator(); - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_SIMPLE_CORRELATOR_H */ diff --git a/gr-digital/include/digital_simple_framer.h b/gr-digital/include/digital_simple_framer.h deleted file mode 100644 index b622ae5dd..000000000 --- a/gr-digital/include/digital_simple_framer.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 INCLUDED_GR_SIMPLE_FRAMER_H -#define INCLUDED_GR_SIMPLE_FRAMER_H - -#include <digital_api.h> -#include <gr_block.h> - -class digital_simple_framer; -typedef boost::shared_ptr<digital_simple_framer> digital_simple_framer_sptr; - -DIGITAL_API digital_simple_framer_sptr digital_make_simple_framer(int payload_bytesize); - -/*! - * \brief add sync field, seq number and command field to payload - * \ingroup sync_blk - * - * Takes in enough samples to create a full output frame. The frame is - * prepended with the GRSF_SYNC (defind in - * digital_simple_framer_sync.h) and an 8-bit sequence number. - * - * \param payload_bytesize The size of the payload in bytes. - */ -class DIGITAL_API digital_simple_framer : public gr_block -{ - int d_seqno; - int d_payload_bytesize; - int d_input_block_size; // bytes - int d_output_block_size; // bytes - - friend DIGITAL_API digital_simple_framer_sptr - digital_make_simple_framer(int payload_bytesize); - digital_simple_framer(int payload_bytesize); - - public: - void forecast(int noutput_items, - gr_vector_int &ninput_items_required); - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_SIMPLE_FRAMER_H */ diff --git a/gr-digital/include/digital_simple_framer_sync.h b/gr-digital/include/digital_simple_framer_sync.h deleted file mode 100644 index 412003582..000000000 --- a/gr-digital/include/digital_simple_framer_sync.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005,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 INCLUDED_GR_SIMPLE_FRAMER_SYNC_H -#define INCLUDED_GR_SIMPLE_FRAMER_SYNC_H - -/*! - * \brief Here are a couple of maximum length sequences (m-sequences) - * that were generated by the the "mseq" matlab/octave code downloaded - * from: <a href="http://www.mathworks.com/matlabcentral/fileexchange/990">http://www.mathworks.com/matlabcentral/fileexchange/990</a> - * - * <pre> - * 31-bit m-sequence: - * 0110100100001010111011000111110 - * 0x690AEC76 (padded on right with a zero) - * - * 63-bit m-sequence: - * 101011001101110110100100111000101111001010001100001000001111110 - * 0xACDDA4E2F28C20FC (padded on right with a zero) - * </pre> - */ - -static const unsigned long long GRSF_SYNC = 0xacdda4e2f28c20fcULL; - -static const int GRSF_BITS_PER_BYTE = 8; -static const int GRSF_SYNC_OVERHEAD = sizeof(GRSF_SYNC); -static const int GRSF_PAYLOAD_OVERHEAD = 1; // 1 byte seqno -static const int GRSF_TAIL_PAD = 1; // one byte trailing padding -static const int GRSF_OVERHEAD = GRSF_SYNC_OVERHEAD + GRSF_PAYLOAD_OVERHEAD + GRSF_TAIL_PAD; - - -#endif /* INCLUDED_GR_SIMPLE_FRAMER_SYNC_H */ diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt deleted file mode 100644 index 7ac16602c..000000000 --- a/gr-digital/lib/CMakeLists.txt +++ /dev/null @@ -1,151 +0,0 @@ -# Copyright 2011,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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../include - ${GR_DIGITAL_INCLUDE_DIRS} - ${GR_ANALOG_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# generate helper scripts to expand templated files -######################################################################## -include(GrPython) - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " -#!${PYTHON_EXECUTABLE} - -import sys, os, re -sys.path.append('${GR_CORE_PYTHONPATH}') -os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.chdir('${CMAKE_CURRENT_BINARY_DIR}') - -if __name__ == '__main__': - import build_utils - root, inp = sys.argv[1:3] - for sig in sys.argv[3:]: - name = re.sub ('X+', sig, root) - d = build_utils.standard_dict(name, sig, 'digital') - build_utils.expand_template(d, inp) - -") - -macro(expand_cc root) - #make a list of all the generated files - unset(expanded_files_cc) - unset(expanded_files_h) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc) - list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/../include/${name}.h) - endforeach(sig) - - #create a command to generate the files - add_custom_command( - OUTPUT ${expanded_files_cc} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.cc.t ${ARGN} - ) - - #make source files depends on headers to force generation - set_source_files_properties(${expanded_files_cc} - PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" - ) - - #install rules for the generated cc files - list(APPEND generated_sources ${expanded_files_cc}) -endmacro(expand_cc) - -######################################################################## -# Invoke macro to generate various sources -######################################################################## -expand_cc(digital_chunks_to_symbols_XX bf bc sf sc if ic) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_digital_sources - ${generated_sources} - digital_impl_glfsr.cc - digital_impl_mpsk_snr_est.cc - digital_additive_scrambler_bb.cc - digital_binary_slicer_fb.cc - digital_bytes_to_syms.cc - digital_clock_recovery_mm_cc.cc - digital_clock_recovery_mm_ff.cc - digital_cma_equalizer_cc.cc - digital_constellation.cc - digital_constellation_receiver_cb.cc - digital_constellation_decoder_cb.cc - digital_correlate_access_code_bb.cc - digital_correlate_access_code_tag_bb.cc - digital_costas_loop_cc.cc - digital_cpmmod_bc.cc - digital_crc32.cc - digital_descrambler_bb.cc - digital_diff_decoder_bb.cc - digital_diff_encoder_bb.cc - digital_diff_phasor_cc.cc - digital_fll_band_edge_cc.cc - digital_framer_sink_1.cc - digital_glfsr_source_b.cc - digital_glfsr_source_f.cc - digital_gmskmod_bc.cc - digital_lms_dd_equalizer_cc.cc - digital_kurtotic_equalizer_cc.cc - digital_map_bb.cc - digital_mpsk_receiver_cc.cc - digital_mpsk_snr_est_cc.cc - digital_ofdm_cyclic_prefixer.cc - digital_ofdm_frame_acquisition.cc - digital_ofdm_frame_sink.cc - digital_ofdm_insert_preamble.cc - digital_ofdm_mapper_bcv.cc - digital_ofdm_sampler.cc - digital_packet_sink.cc - digital_pfb_clock_sync_ccf.cc - digital_pfb_clock_sync_fff.cc - digital_pn_correlator_cc.cc - digital_probe_density_b.cc - digital_probe_mpsk_snr_est_c.cc - digital_scrambler_bb.cc - digital_simple_framer.cc - digital_simple_correlator.cc -) - -list(APPEND digital_libs - gnuradio-core - ${Boost_LIBRARIES} -) - -add_library(gnuradio-digital SHARED ${gr_digital_sources}) -target_link_libraries(gnuradio-digital ${digital_libs}) -GR_LIBRARY_FOO(gnuradio-digital RUNTIME_COMPONENT "digital_runtime" DEVEL_COMPONENT "digital_devel") - -add_dependencies(gnuradio-digital digital_generated_includes digital_generated_swigs gnuradio-analog) diff --git a/gr-digital/lib/digital_additive_scrambler_bb.cc b/gr-digital/lib/digital_additive_scrambler_bb.cc deleted file mode 100644 index a8affaa78..000000000 --- a/gr-digital/lib/digital_additive_scrambler_bb.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,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 <digital_additive_scrambler_bb.h> -#include <gr_io_signature.h> - -digital_additive_scrambler_bb_sptr -digital_make_additive_scrambler_bb(int mask, int seed, int len, int count) -{ - return gnuradio::get_initial_sptr(new digital_additive_scrambler_bb - (mask, seed, len, count)); -} - -digital_additive_scrambler_bb::digital_additive_scrambler_bb(int mask, - int seed, - int len, - int count) - : gr_sync_block("additive_scrambler_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_lfsr(mask, seed, len), - d_count(count), - d_bits(0) -{ -} - -int -digital_additive_scrambler_bb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) { - out[i] = in[i]^d_lfsr.next_bit(); - if (d_count > 0) { - if (++d_bits == d_count) { - d_lfsr.reset(); - d_bits = 0; - } - } - } - - return noutput_items; -} diff --git a/gr-digital/lib/digital_binary_slicer_fb.cc b/gr-digital/lib/digital_binary_slicer_fb.cc deleted file mode 100644 index fcdb4291f..000000000 --- a/gr-digital/lib/digital_binary_slicer_fb.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,2011 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 <digital_binary_slicer_fb.h> -#include <gr_io_signature.h> -#include <gr_math.h> -#include <stdexcept> - -digital_binary_slicer_fb_sptr -digital_make_binary_slicer_fb () -{ - return gnuradio::get_initial_sptr(new digital_binary_slicer_fb ()); -} - -digital_binary_slicer_fb::digital_binary_slicer_fb () - : gr_sync_block ("binary_slicer_fb", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ -} - -int -digital_binary_slicer_fb::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]; - unsigned char *out = (unsigned char *) output_items[0]; - - - for (int i = 0; i < noutput_items; i++){ - out[i] = gr_binary_slicer(in[i]); - } - - return noutput_items; -} diff --git a/gr-digital/lib/digital_bytes_to_syms.cc b/gr-digital/lib/digital_bytes_to_syms.cc deleted file mode 100644 index f8bd82d5b..000000000 --- a/gr-digital/lib/digital_bytes_to_syms.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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 <digital_bytes_to_syms.h> -#include <gr_io_signature.h> -#include <assert.h> - -static const int BITS_PER_BYTE = 8; - -digital_bytes_to_syms_sptr -digital_make_bytes_to_syms () -{ - return gnuradio::get_initial_sptr(new digital_bytes_to_syms ()); -} - -digital_bytes_to_syms::digital_bytes_to_syms () - : gr_sync_interpolator ("bytes_to_syms", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (float)), - BITS_PER_BYTE) -{ -} - -int -digital_bytes_to_syms::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (unsigned char *) input_items[0]; - float *out = (float *) output_items[0]; - - assert (noutput_items % BITS_PER_BYTE == 0); - - for (int i = 0; i < noutput_items / BITS_PER_BYTE; i++) { - int x = in[i]; - - *out++ = (((x >> 7) & 0x1) << 1) - 1; - *out++ = (((x >> 6) & 0x1) << 1) - 1; - *out++ = (((x >> 5) & 0x1) << 1) - 1; - *out++ = (((x >> 4) & 0x1) << 1) - 1; - *out++ = (((x >> 3) & 0x1) << 1) - 1; - *out++ = (((x >> 2) & 0x1) << 1) - 1; - *out++ = (((x >> 1) & 0x1) << 1) - 1; - *out++ = (((x >> 0) & 0x1) << 1) - 1; - } - - return noutput_items; -} - - - diff --git a/gr-digital/lib/digital_chunks_to_symbols_XX.cc.t b/gr-digital/lib/digital_chunks_to_symbols_XX.cc.t deleted file mode 100644 index 399a474a6..000000000 --- a/gr-digital/lib/digital_chunks_to_symbols_XX.cc.t +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> -#include <string.h> - -@SPTR_NAME@ -digital_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D) -{ - return gnuradio::get_initial_sptr (new @NAME@ (symbol_table,D)); -} - -@NAME@::@NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D) - : gr_sync_interpolator ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, -1, sizeof (@O_TYPE@)), - D), - d_D (D), - d_symbol_table (symbol_table) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (noutput_items % d_D == 0); - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - - for (int m=0;m<nstreams;m++) { - const @I_TYPE@ *in = (@I_TYPE@ *) input_items[m]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[m]; - - // per stream processing - for (int i = 0; i < noutput_items / d_D; i++){ - assert (((unsigned int)in[i]*d_D+d_D) <= d_symbol_table.size()); - memcpy(out, &d_symbol_table[(unsigned int)in[i]*d_D], d_D*sizeof(@O_TYPE@)); - out+=d_D; - } - // end of per stream processing - - } - return noutput_items; -} diff --git a/gr-digital/lib/digital_clock_recovery_mm_cc.cc b/gr-digital/lib/digital_clock_recovery_mm_cc.cc deleted file mode 100644 index 198eb4b89..000000000 --- a/gr-digital/lib/digital_clock_recovery_mm_cc.cc +++ /dev/null @@ -1,217 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2010,2011 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 <gr_io_signature.h> -#include <gr_prefs.h> -#include <digital_clock_recovery_mm_cc.h> -#include <gri_mmse_fir_interpolator_cc.h> -#include <stdexcept> -#include <cstdio> - - -// Public constructor -static const int FUDGE = 16; - -digital_clock_recovery_mm_cc_sptr -digital_make_clock_recovery_mm_cc(float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit) -{ - return gnuradio::get_initial_sptr(new digital_clock_recovery_mm_cc (omega, - gain_omega, - mu, - gain_mu, - omega_relative_limit)); -} - -digital_clock_recovery_mm_cc::digital_clock_recovery_mm_cc (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit) - : gr_block ("clock_recovery_mm_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature2 (1, 2, sizeof (gr_complex), sizeof(float))), - d_mu (mu), d_omega(omega), d_gain_omega(gain_omega), - d_omega_relative_limit(omega_relative_limit), - d_gain_mu(gain_mu), d_last_sample(0), d_interp(new gri_mmse_fir_interpolator_cc()), - d_verbose(gr_prefs::singleton()->get_bool("clock_recovery_mm_cc", "verbose", false)), - d_p_2T(0), d_p_1T(0), d_p_0T(0), d_c_2T(0), d_c_1T(0), d_c_0T(0) -{ - if (omega <= 0.0) - throw std::out_of_range ("clock rate must be > 0"); - if (gain_mu < 0 || gain_omega < 0) - throw std::out_of_range ("Gains must be non-negative"); - - set_omega(omega); // also sets min and max omega - set_relative_rate (1.0 / omega); - set_history(3); // ensure 2 extra input sample is available -} - -digital_clock_recovery_mm_cc::~digital_clock_recovery_mm_cc () -{ - delete d_interp; -} - -void -digital_clock_recovery_mm_cc::forecast(int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i=0; i < ninputs; i++) - ninput_items_required[i] = - (int) ceil((noutput_items * d_omega) + d_interp->ntaps()) + FUDGE; -} - -gr_complex -digital_clock_recovery_mm_cc::slicer_0deg (gr_complex sample) -{ - float real=0, imag=0; - - if(sample.real() > 0) - real = 1; - if(sample.imag() > 0) - imag = 1; - return gr_complex(real,imag); -} - -gr_complex -digital_clock_recovery_mm_cc::slicer_45deg (gr_complex sample) -{ - float real= -1, imag = -1; - if(sample.real() > 0) - real=1; - if(sample.imag() > 0) - imag = 1; - return gr_complex(real,imag); -} - -/* - Modified Mueller and Muller clock recovery circuit - Based: - G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller and Muller - algorithm," Electronics Letters, Vol. 31, no. 13, 22 June 1995, pp. 1032 - 1033. -*/ - -int -digital_clock_recovery_mm_cc::general_work (int noutput_items, - gr_vector_int &ninput_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]; - float *foptr = (float *) output_items[1]; - - bool write_foptr = output_items.size() >= 2; - - int ii = 0; // input index - int oo = 0; // output index - int ni = ninput_items[0] - d_interp->ntaps() - FUDGE; // don't use more input than this - - assert(d_mu >= 0.0); - assert(d_mu <= 1.0); - - float mm_val=0; - gr_complex u, x, y; - - // This loop writes the error to the second output, if it exists - if (write_foptr) { - while(oo < noutput_items && ii < ni) { - d_p_2T = d_p_1T; - d_p_1T = d_p_0T; - d_p_0T = d_interp->interpolate (&in[ii], d_mu); - - d_c_2T = d_c_1T; - d_c_1T = d_c_0T; - d_c_0T = slicer_0deg(d_p_0T); - - x = (d_c_0T - d_c_2T) * conj(d_p_1T); - y = (d_p_0T - d_p_2T) * conj(d_c_1T); - u = y - x; - mm_val = u.real(); - out[oo++] = d_p_0T; - - // limit mm_val - mm_val = gr_branchless_clip(mm_val,4.0); - d_omega = d_omega + d_gain_omega * mm_val; - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); // make sure we don't walk away - - d_mu = d_mu + d_omega + d_gain_mu * mm_val; - ii += (int)floor(d_mu); - d_mu -= floor(d_mu); - - // write the error signal to the second output - foptr[oo-1] = mm_val; - - if (ii < 0) // clamp it. This should only happen with bogus input - ii = 0; - } - } - // This loop does not write to the second output (ugly, but faster) - else { - while(oo < noutput_items && ii < ni) { - d_p_2T = d_p_1T; - d_p_1T = d_p_0T; - d_p_0T = d_interp->interpolate (&in[ii], d_mu); - - d_c_2T = d_c_1T; - d_c_1T = d_c_0T; - d_c_0T = slicer_0deg(d_p_0T); - - x = (d_c_0T - d_c_2T) * conj(d_p_1T); - y = (d_p_0T - d_p_2T) * conj(d_c_1T); - u = y - x; - mm_val = u.real(); - out[oo++] = d_p_0T; - - // limit mm_val - mm_val = gr_branchless_clip(mm_val,1.0); - - d_omega = d_omega + d_gain_omega * mm_val; - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); // make sure we don't walk away - - d_mu = d_mu + d_omega + d_gain_mu * mm_val; - ii += (int)floor(d_mu); - d_mu -= floor(d_mu); - - if(d_verbose) { - printf("%f\t%f\n", d_omega, d_mu); - } - - if (ii < 0) // clamp it. This should only happen with bogus input - ii = 0; - } - } - - if (ii > 0){ - if (ii > ninput_items[0]){ - fprintf(stderr, "gr_clock_recovery_mm_cc: ii > ninput_items[0] (%d > %d)\n", - ii, ninput_items[0]); - assert(0); - } - consume_each (ii); - } - - return oo; -} diff --git a/gr-digital/lib/digital_clock_recovery_mm_ff.cc b/gr-digital/lib/digital_clock_recovery_mm_ff.cc deleted file mode 100644 index 04057f0e9..000000000 --- a/gr-digital/lib/digital_clock_recovery_mm_ff.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2011 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 <gr_io_signature.h> -#include <digital_clock_recovery_mm_ff.h> -#include <gri_mmse_fir_interpolator.h> -#include <stdexcept> - -#define DEBUG_CR_MM_FF 0 // must be defined as 0 or 1 - -// Public constructor - -digital_clock_recovery_mm_ff_sptr -digital_make_clock_recovery_mm_ff(float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit) -{ - return gnuradio::get_initial_sptr(new digital_clock_recovery_mm_ff (omega, - gain_omega, - mu, - gain_mu, - omega_relative_limit)); -} - -digital_clock_recovery_mm_ff::digital_clock_recovery_mm_ff (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit) - : gr_block ("clock_recovery_mm_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))), - d_mu (mu), d_gain_omega(gain_omega), d_gain_mu(gain_mu), - d_last_sample(0), d_interp(new gri_mmse_fir_interpolator()), - d_logfile(0), d_omega_relative_limit(omega_relative_limit) -{ - if (omega < 1) - throw std::out_of_range ("clock rate must be > 0"); - if (gain_mu < 0 || gain_omega < 0) - throw std::out_of_range ("Gains must be non-negative"); - - set_omega(omega); // also sets min and max omega - set_relative_rate (1.0 / omega); - - if (DEBUG_CR_MM_FF) - d_logfile = fopen("cr_mm_ff.dat", "wb"); -} - -digital_clock_recovery_mm_ff::~digital_clock_recovery_mm_ff () -{ - delete d_interp; - - if (DEBUG_CR_MM_FF && d_logfile){ - fclose(d_logfile); - d_logfile = 0; - } -} - -void -digital_clock_recovery_mm_ff::forecast(int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i=0; i < ninputs; i++) - ninput_items_required[i] = - (int) ceil((noutput_items * d_omega) + d_interp->ntaps()); -} - -static inline float -slice(float x) -{ - return x < 0 ? -1.0F : 1.0F; -} - -/* - * This implements the Mueller and Müller (M&M) discrete-time error-tracking synchronizer. - * - * See "Digital Communication Receivers: Synchronization, Channel - * Estimation and Signal Processing" by Heinrich Meyr, Marc Moeneclaey, & Stefan Fechtel. - * ISBN 0-471-50275-8. - */ -int -digital_clock_recovery_mm_ff::general_work (int noutput_items, - gr_vector_int &ninput_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]; - - int ii = 0; // input index - int oo = 0; // output index - int ni = ninput_items[0] - d_interp->ntaps(); // don't use more input than this - float mm_val; - - while (oo < noutput_items && ii < ni ){ - - // produce output sample - out[oo] = d_interp->interpolate (&in[ii], d_mu); - mm_val = slice(d_last_sample) * out[oo] - slice(out[oo]) * d_last_sample; - d_last_sample = out[oo]; - - d_omega = d_omega + d_gain_omega * mm_val; - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); // make sure we don't walk away - d_mu = d_mu + d_omega + d_gain_mu * mm_val; - - ii += (int) floor(d_mu); - d_mu = d_mu - floor(d_mu); - oo++; - - if (DEBUG_CR_MM_FF && d_logfile){ - fwrite(&d_omega, sizeof(d_omega), 1, d_logfile); - } - } - - consume_each (ii); - - return oo; -} diff --git a/gr-digital/lib/digital_cma_equalizer_cc.cc b/gr-digital/lib/digital_cma_equalizer_cc.cc deleted file mode 100644 index c6c46c2d8..000000000 --- a/gr-digital/lib/digital_cma_equalizer_cc.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <digital_cma_equalizer_cc.h> -#include <cstdio> - -digital_cma_equalizer_cc_sptr -digital_make_cma_equalizer_cc(int num_taps, float modulus, float mu, int sps) -{ - return gnuradio::get_initial_sptr(new digital_cma_equalizer_cc(num_taps, modulus, - mu, sps)); -} - -digital_cma_equalizer_cc::digital_cma_equalizer_cc(int num_taps, float modulus, - float mu, int sps) - : gr_adaptive_fir_ccc("cma_equalizer_cc", sps, - std::vector<gr_complex>(num_taps, gr_complex(0,0))) -{ - set_modulus(modulus); - set_gain(mu); - if (num_taps > 0) - d_taps[0] = 1.0; -} diff --git a/gr-digital/lib/digital_constellation.cc b/gr-digital/lib/digital_constellation.cc deleted file mode 100644 index 8b34d9e6b..000000000 --- a/gr-digital/lib/digital_constellation.cc +++ /dev/null @@ -1,569 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010, 2011 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 <gr_io_signature.h> -#include <digital_constellation.h> -#include <digital_metric_type.h> -#include <gr_math.h> -#include <gr_complex.h> -#include <math.h> -#include <iostream> -#include <stdlib.h> -#include <float.h> -#include <stdexcept> - -#define M_TWOPI (2*M_PI) -#define SQRT_TWO 0.707107 - -// Base Constellation Class - -digital_constellation::digital_constellation (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality) : - d_constellation(constellation), - d_pre_diff_code(pre_diff_code), - d_rotational_symmetry(rotational_symmetry), - d_dimensionality(dimensionality) -{ - // Scale constellation points so that average magnitude is 1. - float summed_mag = 0; - unsigned int constsize = d_constellation.size(); - for (unsigned int i=0; i<constsize; i++) { - gr_complex c = d_constellation[i]; - summed_mag += sqrt(c.real()*c.real() + c.imag()*c.imag()); - } - d_scalefactor = constsize/summed_mag; - for (unsigned int i=0; i<constsize; i++) { - d_constellation[i] = d_constellation[i]*d_scalefactor; - } - if (pre_diff_code.size() == 0) - d_apply_pre_diff_code = false; - else if (pre_diff_code.size() != constellation.size()) - throw std::runtime_error ("The constellation and pre-diff code must be of the same length."); - else - d_apply_pre_diff_code = true; - calc_arity(); -} - -digital_constellation::digital_constellation () : - d_apply_pre_diff_code(false), - d_rotational_symmetry(0), - d_dimensionality(1) -{ - calc_arity(); -} - -digital_constellation::~digital_constellation() -{ -} - -//! Returns the constellation points for a symbol value -void -digital_constellation::map_to_points(unsigned int value, gr_complex *points) -{ - for (unsigned int i=0; i<d_dimensionality; i++) - points[i] = d_constellation[value*d_dimensionality + i]; -} - -std::vector<gr_complex> -digital_constellation::map_to_points_v(unsigned int value) -{ - std::vector<gr_complex> points_v; - points_v.resize(d_dimensionality); - map_to_points(value, &(points_v[0])); - return points_v; -} - -float -digital_constellation::get_distance(unsigned int index, const gr_complex *sample) -{ - float dist = 0; - for (unsigned int i=0; i<d_dimensionality; i++) { - dist += norm(sample[i] - d_constellation[index*d_dimensionality + i]); - } - return dist; -} - -unsigned int -digital_constellation::get_closest_point(const gr_complex *sample) -{ - unsigned int min_index = 0; - float min_euclid_dist; - float euclid_dist; - - min_euclid_dist = get_distance(0, sample); - min_index = 0; - for (unsigned int j = 1; j < d_arity; j++){ - euclid_dist = get_distance(j, sample); - if (euclid_dist < min_euclid_dist){ - min_euclid_dist = euclid_dist; - min_index = j; - } - } - return min_index; -} - -unsigned int -digital_constellation::decision_maker_pe(const gr_complex *sample, float *phase_error) -{ - unsigned int index = decision_maker(sample); - *phase_error = 0; - for (unsigned int d=0; d<d_dimensionality; d++) - *phase_error += -arg(sample[d]*conj(d_constellation[index+d])); - return index; -} - -/* -unsigned int digital_constellation::decision_maker_e(const gr_complex *sample, float *error) -{ - unsigned int index = decision_maker(sample); - *error = 0; - for (unsigned int d=0; d<d_dimensionality; d++) - *error += sample[d]*conj(d_constellation[index+d]); - return index; -} -*/ - -std::vector<gr_complex> digital_constellation::s_points () { - if (d_dimensionality != 1) - throw std::runtime_error ("s_points only works for dimensionality 1 constellations."); - else - return d_constellation; -} - -std::vector<std::vector<gr_complex> > -digital_constellation::v_points () -{ - std::vector<std::vector<gr_complex> > vv_const; - vv_const.resize(d_arity); - for (unsigned int p=0; p<d_arity; p++) { - std::vector<gr_complex> v_const; - v_const.resize(d_dimensionality); - for (unsigned int d=0; d<d_dimensionality; d++) { - v_const[d] = d_constellation[p*d_dimensionality+d]; - } - vv_const[p] = v_const; - } - return vv_const; -} - -void -digital_constellation::calc_metric(const gr_complex *sample, float *metric, - trellis_metric_type_t type) -{ - switch (type){ - case TRELLIS_EUCLIDEAN: - calc_euclidean_metric(sample, metric); - break; - case TRELLIS_HARD_SYMBOL: - calc_hard_symbol_metric(sample, metric); - break; - case TRELLIS_HARD_BIT: - throw std::runtime_error ("Invalid metric type (not yet implemented)."); - break; - default: - throw std::runtime_error ("Invalid metric type."); - } -} - -void -digital_constellation::calc_euclidean_metric(const gr_complex *sample, float *metric) -{ - for (unsigned int o=0; o<d_arity; o++) { - metric[o] = get_distance(o, sample); - } -} - -void -digital_constellation::calc_hard_symbol_metric(const gr_complex *sample, float *metric) -{ - float minm = FLT_MAX; - unsigned int minmi = 0; - for (unsigned int o=0; o<d_arity; o++) { - float dist = get_distance(o, sample); - if (dist < minm) { - minm = dist; - minmi = o; - } - } - for(unsigned int o=0; o<d_arity; o++) { - metric[o] = (o==minmi?0.0:1.0); - } -} - -void -digital_constellation::calc_arity () -{ - if (d_constellation.size() % d_dimensionality != 0) - throw std::runtime_error ("Constellation vector size must be a multiple of the dimensionality."); - d_arity = d_constellation.size()/d_dimensionality; -} - -unsigned int -digital_constellation::decision_maker_v (std::vector<gr_complex> sample) -{ - assert(sample.size() == d_dimensionality); - return decision_maker (&(sample[0])); -} - -digital_constellation_calcdist_sptr -digital_make_constellation_calcdist(std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality) -{ - return digital_constellation_calcdist_sptr(new digital_constellation_calcdist - (constellation, pre_diff_code, - rotational_symmetry, dimensionality)); -} - -digital_constellation_calcdist::digital_constellation_calcdist(std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality) : - digital_constellation(constellation, pre_diff_code, rotational_symmetry, dimensionality) -{} - -// Chooses points base on shortest distance. -// Inefficient. -unsigned int -digital_constellation_calcdist::decision_maker(const gr_complex *sample) -{ - return get_closest_point(sample); -} - -digital_constellation_sector::digital_constellation_sector (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality, - unsigned int n_sectors) : - digital_constellation(constellation, pre_diff_code, rotational_symmetry, dimensionality), - n_sectors(n_sectors) -{ -} - -unsigned int -digital_constellation_sector::decision_maker (const gr_complex *sample) -{ - unsigned int sector; - sector = get_sector(sample); - return sector_values[sector]; -} - -void -digital_constellation_sector::find_sector_values () -{ - unsigned int i; - sector_values.clear(); - for (i=0; i<n_sectors; i++) { - sector_values.push_back(calc_sector_value(i)); - } -} - -digital_constellation_rect_sptr -digital_make_constellation_rect(std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int real_sectors, unsigned int imag_sectors, - float width_real_sectors, float width_imag_sectors) -{ - return digital_constellation_rect_sptr(new digital_constellation_rect - (constellation, pre_diff_code, - rotational_symmetry, - real_sectors, imag_sectors, - width_real_sectors, - width_imag_sectors)); - } - -digital_constellation_rect::digital_constellation_rect (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int real_sectors, unsigned int imag_sectors, - float width_real_sectors, float width_imag_sectors) : - digital_constellation_sector(constellation, pre_diff_code, rotational_symmetry, 1, real_sectors * imag_sectors), - n_real_sectors(real_sectors), n_imag_sectors(imag_sectors), - d_width_real_sectors(width_real_sectors), d_width_imag_sectors(width_imag_sectors) -{ - d_width_real_sectors *= d_scalefactor; - d_width_imag_sectors *= d_scalefactor; - find_sector_values(); -} - -unsigned int -digital_constellation_rect::get_sector (const gr_complex *sample) -{ - int real_sector, imag_sector; - unsigned int sector; - - real_sector = int(real(*sample)/d_width_real_sectors + n_real_sectors/2.0); - if(real_sector < 0) - real_sector = 0; - if(real_sector >= (int)n_real_sectors) - real_sector = n_real_sectors-1; - - imag_sector = int(imag(*sample)/d_width_imag_sectors + n_imag_sectors/2.0); - if(imag_sector < 0) - imag_sector = 0; - if(imag_sector >= (int)n_imag_sectors) - imag_sector = n_imag_sectors-1; - - sector = real_sector * n_imag_sectors + imag_sector; - return sector; -} - -unsigned int -digital_constellation_rect::calc_sector_value (unsigned int sector) -{ - unsigned int real_sector, imag_sector; - gr_complex sector_center; - unsigned int closest_point; - real_sector = float(sector)/n_imag_sectors; - imag_sector = sector - real_sector * n_imag_sectors; - sector_center = gr_complex((real_sector + 0.5 - n_real_sectors/2.0) * d_width_real_sectors, - (imag_sector + 0.5 - n_imag_sectors/2.0) * d_width_imag_sectors); - closest_point = get_closest_point(§or_center); - return closest_point; -} - - -digital_constellation_psk_sptr -digital_make_constellation_psk(std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int n_sectors) -{ - return digital_constellation_psk_sptr(new digital_constellation_psk - (constellation, pre_diff_code, - n_sectors)); -} - -digital_constellation_psk::digital_constellation_psk (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int n_sectors) : - digital_constellation_sector(constellation, pre_diff_code, constellation.size(), 1, n_sectors) -{ - find_sector_values(); -} - -unsigned int -digital_constellation_psk::get_sector (const gr_complex *sample) -{ - float phase = arg(*sample); - float width = M_TWOPI / n_sectors; - int sector = floor(phase/width + 0.5); - if (sector < 0) - sector += n_sectors; - return sector; -} - -unsigned int -digital_constellation_psk::calc_sector_value (unsigned int sector) -{ - float phase = sector * M_TWOPI / n_sectors; - gr_complex sector_center = gr_complex(cos(phase), sin(phase)); - unsigned int closest_point = get_closest_point(§or_center); - return closest_point; -} - - -digital_constellation_bpsk_sptr -digital_make_constellation_bpsk() -{ - return digital_constellation_bpsk_sptr(new digital_constellation_bpsk ()); -} - -digital_constellation_bpsk::digital_constellation_bpsk () -{ - d_constellation.resize(2); - d_constellation[0] = gr_complex(-1, 0); - d_constellation[1] = gr_complex(1, 0); - d_rotational_symmetry = 2; - d_dimensionality = 1; - calc_arity(); -} - -unsigned int -digital_constellation_bpsk::decision_maker(const gr_complex *sample) -{ - return (real(*sample) > 0); -} - - -digital_constellation_qpsk_sptr -digital_make_constellation_qpsk() -{ - return digital_constellation_qpsk_sptr(new digital_constellation_qpsk ()); -} - -digital_constellation_qpsk::digital_constellation_qpsk () -{ - d_constellation.resize(4); - // Gray-coded - d_constellation[0] = gr_complex(-SQRT_TWO, -SQRT_TWO); - d_constellation[1] = gr_complex(SQRT_TWO, -SQRT_TWO); - d_constellation[2] = gr_complex(-SQRT_TWO, SQRT_TWO); - d_constellation[3] = gr_complex(SQRT_TWO, SQRT_TWO); - - /* - d_constellation[0] = gr_complex(SQRT_TWO, SQRT_TWO); - d_constellation[1] = gr_complex(-SQRT_TWO, SQRT_TWO); - d_constellation[2] = gr_complex(SQRT_TWO, -SQRT_TWO); - d_constellation[3] = gr_complex(SQRT_TWO, -SQRT_TWO); - */ - - d_pre_diff_code.resize(4); - d_pre_diff_code[0] = 0x0; - d_pre_diff_code[1] = 0x2; - d_pre_diff_code[2] = 0x3; - d_pre_diff_code[3] = 0x1; - - d_rotational_symmetry = 4; - d_dimensionality = 1; - calc_arity(); -} - -unsigned int -digital_constellation_qpsk::decision_maker(const gr_complex *sample) -{ - // Real component determines small bit. - // Imag component determines big bit. - return 2*(imag(*sample)>0) + (real(*sample)>0); - - /* - bool a = real(*sample) > 0; - bool b = imag(*sample) > 0; - if(a) { - if(b) - return 0x0; - else - return 0x1; - } - else { - if(b) - return 0x2; - else - return 0x3; - } - */ -} - - -/********************************************************************/ - - -digital_constellation_dqpsk_sptr -digital_make_constellation_dqpsk() -{ - return digital_constellation_dqpsk_sptr(new digital_constellation_dqpsk ()); -} - -digital_constellation_dqpsk::digital_constellation_dqpsk () -{ - // This constellation is not gray coded, which allows - // us to use differential encodings (through gr_diff_encode and - // gr_diff_decode) on the symbols. - d_constellation.resize(4); - d_constellation[0] = gr_complex(+SQRT_TWO, +SQRT_TWO); - d_constellation[1] = gr_complex(-SQRT_TWO, +SQRT_TWO); - d_constellation[2] = gr_complex(-SQRT_TWO, -SQRT_TWO); - d_constellation[3] = gr_complex(+SQRT_TWO, -SQRT_TWO); - - // Use this mapping to convert to gray code before diff enc. - d_pre_diff_code.resize(4); - d_pre_diff_code[0] = 0x0; - d_pre_diff_code[1] = 0x1; - d_pre_diff_code[2] = 0x3; - d_pre_diff_code[3] = 0x2; - d_apply_pre_diff_code = true; - - d_rotational_symmetry = 4; - d_dimensionality = 1; - calc_arity(); -} - -unsigned int -digital_constellation_dqpsk::decision_maker(const gr_complex *sample) -{ - // Slower deicison maker as we can't slice along one axis. - // Maybe there's a better way to do this, still. - - bool a = real(*sample) > 0; - bool b = imag(*sample) > 0; - if(a) { - if(b) - return 0x0; - else - return 0x3; - } - else { - if(b) - return 0x1; - else - return 0x2; - } -} - -digital_constellation_8psk_sptr -digital_make_constellation_8psk() -{ - return digital_constellation_8psk_sptr(new digital_constellation_8psk ()); -} - -digital_constellation_8psk::digital_constellation_8psk () -{ - float angle = M_PI/8.0; - d_constellation.resize(8); - // Gray-coded - d_constellation[0] = gr_complex(cos( 1*angle), sin( 1*angle)); - d_constellation[1] = gr_complex(cos( 7*angle), sin( 7*angle)); - d_constellation[2] = gr_complex(cos(15*angle), sin(15*angle)); - d_constellation[3] = gr_complex(cos( 9*angle), sin( 9*angle)); - d_constellation[4] = gr_complex(cos( 3*angle), sin( 3*angle)); - d_constellation[5] = gr_complex(cos( 5*angle), sin( 5*angle)); - d_constellation[6] = gr_complex(cos(13*angle), sin(13*angle)); - d_constellation[7] = gr_complex(cos(11*angle), sin(11*angle)); - d_rotational_symmetry = 8; - d_dimensionality = 1; - calc_arity(); -} - -unsigned int -digital_constellation_8psk::decision_maker(const gr_complex *sample) -{ - unsigned int ret = 0; - - float re = sample->real(); - float im = sample->imag(); - - if(fabsf(re) <= fabsf(im)) - ret = 4; - if(re <= 0) - ret |= 1; - if(im <= 0) - ret |= 2; - - return ret; -} diff --git a/gr-digital/lib/digital_constellation_decoder_cb.cc b/gr-digital/lib/digital_constellation_decoder_cb.cc deleted file mode 100644 index 4638790f6..000000000 --- a/gr-digital/lib/digital_constellation_decoder_cb.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <digital_constellation_decoder_cb.h> -#include <digital_constellation.h> -#include <gr_io_signature.h> -#include <iostream> - -digital_constellation_decoder_cb_sptr -digital_make_constellation_decoder_cb (digital_constellation_sptr constellation) -{ - return gnuradio::get_initial_sptr - (new digital_constellation_decoder_cb(constellation)); -} - -digital_constellation_decoder_cb:: -digital_constellation_decoder_cb (digital_constellation_sptr constellation) - : gr_block ("constellation_decoder_cb", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_constellation(constellation), - d_dim(constellation->dimensionality()) -{ - set_relative_rate (1.0 / ((double) d_dim)); -} - -void -digital_constellation_decoder_cb::forecast (int noutput_items, - gr_vector_int &ninput_items_required) -{ - unsigned int input_required = noutput_items * d_dim; - - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = input_required; -} - - -int -digital_constellation_decoder_cb::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex const *in = (const gr_complex *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for(int i = 0; i < noutput_items; i++){ - out[i] = d_constellation->decision_maker(&(in[i*d_dim])); - } - - consume_each (noutput_items * d_dim); - return noutput_items; -} diff --git a/gr-digital/lib/digital_constellation_receiver_cb.cc b/gr-digital/lib/digital_constellation_receiver_cb.cc deleted file mode 100644 index faaa760fd..000000000 --- a/gr-digital/lib/digital_constellation_receiver_cb.cc +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <gr_io_signature.h> -#include <gr_prefs.h> -#include <digital_constellation_receiver_cb.h> -#include <stdexcept> -#include <gr_math.h> -#include <gr_expj.h> - - -#define M_TWOPI (2*M_PI) -#define VERBOSE_MM 0 // Used for debugging symbol timing loop -#define VERBOSE_COSTAS 0 // Used for debugging phase and frequency tracking - -// Public constructor - -digital_constellation_receiver_cb_sptr -digital_make_constellation_receiver_cb(digital_constellation_sptr constell, - float loop_bw, float fmin, float fmax) -{ - return gnuradio::get_initial_sptr(new digital_constellation_receiver_cb (constell, - loop_bw, - fmin, fmax)); -} - -static int ios[] = {sizeof(char), sizeof(float), sizeof(float), sizeof(float), sizeof(gr_complex)}; -static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); -digital_constellation_receiver_cb::digital_constellation_receiver_cb (digital_constellation_sptr constellation, - float loop_bw, float fmin, float fmax) - : gr_block ("constellation_receiver_cb", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signaturev (1, 5, iosig)), - gri_control_loop(loop_bw, fmax, fmin), - d_constellation(constellation), - d_current_const_point(0) -{ - if (d_constellation->dimensionality() != 1) - throw std::runtime_error ("This receiver only works with constellations of dimension 1."); -} - -void -digital_constellation_receiver_cb::phase_error_tracking(float phase_error) -{ - advance_loop(phase_error); - phase_wrap(); - frequency_limit(); - -#if VERBOSE_COSTAS - printf("cl: phase_error: %f phase: %f freq: %f sample: %f+j%f constellation: %f+j%f\n", - phase_error, d_phase, d_freq, sample.real(), sample.imag(), - d_constellation->points()[d_current_const_point].real(), - d_constellation->points()[d_current_const_point].imag()); -#endif -} - -int -digital_constellation_receiver_cb::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - int i=0; - - float phase_error; - unsigned int sym_value; - gr_complex sample, nco; - - float *out_err = 0, *out_phase = 0, *out_freq = 0; - gr_complex *out_symbol; - if(output_items.size() == 5) { - out_err = (float *) output_items[1]; - out_phase = (float *) output_items[2]; - out_freq = (float *) output_items[3]; - out_symbol = (gr_complex*)output_items[4]; - } - - while((i < noutput_items) && (i < ninput_items[0])) { - sample = in[i]; - nco = gr_expj(d_phase); // get the NCO value for derotating the current sample - sample = nco*sample; // get the downconverted symbol - - sym_value = d_constellation->decision_maker_pe(&sample, &phase_error); - phase_error_tracking(phase_error); // corrects phase and frequency offsets - - out[i] = sym_value; - - if(output_items.size() == 5) { - out_err[i] = phase_error; - out_phase[i] = d_phase; - out_freq[i] = d_freq; - out_symbol[i] = sample; - } - i++; - } - - consume_each(i); - return i; -} - diff --git a/gr-digital/lib/digital_correlate_access_code_bb.cc b/gr-digital/lib/digital_correlate_access_code_bb.cc deleted file mode 100644 index f21b57d92..000000000 --- a/gr-digital/lib/digital_correlate_access_code_bb.cc +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010,2011 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 <digital_correlate_access_code_bb.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <gr_count_bits.h> -#include <cstdio> - - -#define VERBOSE 0 - - -digital_correlate_access_code_bb_sptr -digital_make_correlate_access_code_bb (const std::string &access_code, int threshold) -{ - return gnuradio::get_initial_sptr(new digital_correlate_access_code_bb - (access_code, threshold)); -} - - -digital_correlate_access_code_bb::digital_correlate_access_code_bb ( - const std::string &access_code, int threshold) - : gr_sync_block ("correlate_access_code_bb", - gr_make_io_signature (1, 1, sizeof(char)), - gr_make_io_signature (1, 1, sizeof(char))), - d_data_reg(0), d_flag_reg(0), d_flag_bit(0), d_mask(0), - d_threshold(threshold) - -{ - if (!set_access_code(access_code)){ - fprintf(stderr, "digital_correlate_access_code_bb: access_code is > 64 bits\n"); - throw std::out_of_range ("access_code is > 64 bits"); - } -} - -digital_correlate_access_code_bb::~digital_correlate_access_code_bb () -{ -} - -bool -digital_correlate_access_code_bb::set_access_code( - const std::string &access_code) -{ - unsigned len = access_code.length(); // # of bytes in string - if (len > 64) - return false; - - // set len top bits to 1. - d_mask = ((~0ULL) >> (64 - len)) << (64 - len); - - d_flag_bit = 1LL << (64 - len); // Where we or-in new flag values. - // new data always goes in 0x0000000000000001 - d_access_code = 0; - for (unsigned i=0; i < 64; i++){ - d_access_code <<= 1; - if (i < len) - d_access_code |= access_code[i] & 1; // look at LSB only - } - - return true; -} - -int -digital_correlate_access_code_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - - // compute output value - unsigned int t = 0; - - t |= ((d_data_reg >> 63) & 0x1) << 0; - t |= ((d_flag_reg >> 63) & 0x1) << 1; // flag bit - out[i] = t; - - // compute hamming distance between desired access code and current data - unsigned long long wrong_bits = 0; - unsigned int nwrong = d_threshold+1; - int new_flag = 0; - - wrong_bits = (d_data_reg ^ d_access_code) & d_mask; - nwrong = gr_count_bits64(wrong_bits); - - // test for access code with up to threshold errors - new_flag = (nwrong <= d_threshold); - -#if VERBOSE - if(new_flag) { - fprintf(stderr, "access code found: %llx\n", d_access_code); - } - else { - fprintf(stderr, "%llx ==> %llx\n", d_access_code, d_data_reg); - } -#endif - - // shift in new data and new flag - d_data_reg = (d_data_reg << 1) | (in[i] & 0x1); - d_flag_reg = (d_flag_reg << 1); - if (new_flag) { - d_flag_reg |= d_flag_bit; - } - } - - return noutput_items; -} - diff --git a/gr-digital/lib/digital_correlate_access_code_tag_bb.cc b/gr-digital/lib/digital_correlate_access_code_tag_bb.cc deleted file mode 100644 index 95f06534e..000000000 --- a/gr-digital/lib/digital_correlate_access_code_tag_bb.cc +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010-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 <digital_correlate_access_code_tag_bb.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <gr_count_bits.h> -#include <cstdio> -#include <iostream> - -#define VERBOSE 0 - - -digital_correlate_access_code_tag_bb_sptr -digital_make_correlate_access_code_tag_bb (const std::string &access_code, - int threshold, - const std::string &tag_name) -{ - return gnuradio::get_initial_sptr(new digital_correlate_access_code_tag_bb - (access_code, threshold, tag_name)); -} - - -digital_correlate_access_code_tag_bb::digital_correlate_access_code_tag_bb ( - const std::string &access_code, int threshold, const std::string &tag_name) - : gr_sync_block ("correlate_access_code_tag_bb", - gr_make_io_signature (1, 1, sizeof(char)), - gr_make_io_signature (1, 1, sizeof(char))), - d_data_reg(0), d_mask(0), - d_threshold(threshold), d_len(0) -{ - if (!set_access_code(access_code)) { - fprintf(stderr, "digital_correlate_access_code_tag_bb: access_code is > 64 bits\n"); - throw std::out_of_range ("access_code is > 64 bits"); - } - - std::stringstream str; - str << name() << unique_id(); - d_me = pmt::pmt_string_to_symbol(str.str()); - d_key = pmt::pmt_string_to_symbol(tag_name); -} - -digital_correlate_access_code_tag_bb::~digital_correlate_access_code_tag_bb () -{ -} - -bool -digital_correlate_access_code_tag_bb::set_access_code( - const std::string &access_code) -{ - d_len = access_code.length(); // # of bytes in string - if (d_len > 64) - return false; - - // set len top bits to 1. - d_mask = ((~0ULL) >> (64 - d_len)) << (64 - d_len); - - d_access_code = 0; - for (unsigned i=0; i < 64; i++){ - d_access_code <<= 1; - if (i < d_len) - d_access_code |= access_code[i] & 1; // look at LSB only - } - - return true; -} - -int -digital_correlate_access_code_tag_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - uint64_t abs_out_sample_cnt = nitems_written(0); - - for (int i = 0; i < noutput_items; i++){ - - out[i] = in[i]; - - // compute hamming distance between desired access code and current data - unsigned long long wrong_bits = 0; - unsigned int nwrong = d_threshold+1; - int new_flag = 0; - - wrong_bits = (d_data_reg ^ d_access_code) & d_mask; - nwrong = gr_count_bits64(wrong_bits); - - // test for access code with up to threshold errors - new_flag = (nwrong <= d_threshold); - - // shift in new data and new flag - d_data_reg = (d_data_reg << 1) | (in[i] & 0x1); - if (new_flag) { - if(VERBOSE) std::cout << "writing tag at sample " << abs_out_sample_cnt + i << std::endl; - add_item_tag(0, //stream ID - abs_out_sample_cnt + i - 64 + d_len, //sample - d_key, //frame info - pmt::pmt_t(), //data (unused) - d_me //block src id - ); - } - } - - return noutput_items; -} - diff --git a/gr-digital/lib/digital_costas_loop_cc.cc b/gr-digital/lib/digital_costas_loop_cc.cc deleted file mode 100644 index 370dc7e5c..000000000 --- a/gr-digital/lib/digital_costas_loop_cc.cc +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,2011 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 <digital_costas_loop_cc.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <gr_sincos.h> -#include <gr_math.h> - -digital_costas_loop_cc_sptr -digital_make_costas_loop_cc (float loop_bw, int order - ) throw (std::invalid_argument) -{ - return gnuradio::get_initial_sptr(new digital_costas_loop_cc - (loop_bw, order)); -} - -digital_costas_loop_cc::digital_costas_loop_cc (float loop_bw, int order - ) throw (std::invalid_argument) - : gr_sync_block ("costas_loop_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature2 (1, 2, sizeof (gr_complex), sizeof(float))), - gri_control_loop(loop_bw, 1.0, -1.0), - d_order(order), d_phase_detector(NULL) -{ - // Set up the phase detector to use based on the constellation order - switch(d_order) { - case 2: - d_phase_detector = &digital_costas_loop_cc::phase_detector_2; - break; - - case 4: - d_phase_detector = &digital_costas_loop_cc::phase_detector_4; - break; - - case 8: - d_phase_detector = &digital_costas_loop_cc::phase_detector_8; - break; - - default: - throw std::invalid_argument("order must be 2, 4, or 8"); - break; - } -} - -float -digital_costas_loop_cc::phase_detector_8(gr_complex sample) const -{ - /* This technique splits the 8PSK constellation into 2 squashed - QPSK constellations, one when I is larger than Q and one where - Q is larger than I. The error is then calculated proportionally - to these squashed constellations by the const K = sqrt(2)-1. - - The signal magnitude must be > 1 or K will incorrectly bias - the error value. - - Ref: Z. Huang, Z. Yi, M. Zhang, K. Wang, "8PSK demodulation for - new generation DVB-S2", IEEE Proc. Int. Conf. Communications, - Circuits and Systems, Vol. 2, pp. 1447 - 1450, 2004. - */ - - float K = (sqrt(2.0) - 1); - if(fabsf(sample.real()) >= fabsf(sample.imag())) { - return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() - - (sample.imag()>0 ? 1.0 : -1.0) * sample.real() * K); - } - else { - return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() * K - - (sample.imag()>0 ? 1.0 : -1.0) * sample.real()); - } -} - -float -digital_costas_loop_cc::phase_detector_4(gr_complex sample) const -{ - - return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() - - (sample.imag()>0 ? 1.0 : -1.0) * sample.real()); -} - -float -digital_costas_loop_cc::phase_detector_2(gr_complex sample) const -{ - return (sample.real()*sample.imag()); -} - -int -digital_costas_loop_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *iptr = (gr_complex *) input_items[0]; - gr_complex *optr = (gr_complex *) output_items[0]; - float *foptr = (float *) output_items[1]; - - bool write_foptr = output_items.size() >= 2; - - float error; - gr_complex nco_out; - - if (write_foptr) { - - for (int i = 0; i < noutput_items; i++){ - nco_out = gr_expj(-d_phase); - optr[i] = iptr[i] * nco_out; - - error = (*this.*d_phase_detector)(optr[i]); - error = gr_branchless_clip(error, 1.0); - - advance_loop(error); - phase_wrap(); - frequency_limit(); - - foptr[i] = d_freq; - } - } else { - for (int i = 0; i < noutput_items; i++){ - nco_out = gr_expj(-d_phase); - optr[i] = iptr[i] * nco_out; - - error = (*this.*d_phase_detector)(optr[i]); - error = gr_branchless_clip(error, 1.0); - - advance_loop(error); - phase_wrap(); - frequency_limit(); - } - } - return noutput_items; -} diff --git a/gr-digital/lib/digital_cpmmod_bc.cc b/gr-digital/lib/digital_cpmmod_bc.cc deleted file mode 100644 index a95b604d1..000000000 --- a/gr-digital/lib/digital_cpmmod_bc.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * 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 <digital_cpmmod_bc.h> -#include <gr_io_signature.h> - - -// Shared pointer constructor -digital_cpmmod_bc_sptr -digital_make_cpmmod_bc(int type, float h, - unsigned samples_per_sym, - unsigned L, double beta) -{ - return gnuradio::get_initial_sptr(new digital_cpmmod_bc((gr_cpm::cpm_type)type, - h, samples_per_sym, - L, beta)); -} - - -digital_cpmmod_bc::digital_cpmmod_bc(gr_cpm::cpm_type type, float h, - unsigned samples_per_sym, - unsigned L, double beta) - : gr_hier_block2("digital_cpmmod_bc", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature2(1, 1, sizeof(gr_complex), sizeof(float))), - d_taps(gr_cpm::phase_response(type, samples_per_sym, L, beta)), - d_char_to_float(gr_make_char_to_float()), - d_pulse_shaper(gr_make_interp_fir_filter_fff(samples_per_sym, d_taps)), - d_fm(gr_make_frequency_modulator_fc(M_PI * h)) -{ - switch (type) { - case gr_cpm::LRC: - case gr_cpm::LSRC: - case gr_cpm::LREC: - case gr_cpm::TFM: - case gr_cpm::GAUSSIAN: - break; - - default: - throw std::invalid_argument("invalid CPM type"); - } - - connect(self(), 0, d_char_to_float, 0); - connect(d_char_to_float, 0, d_pulse_shaper, 0); - connect(d_pulse_shaper, 0, d_fm, 0); - connect(d_fm, 0, self(), 0); -} - diff --git a/gr-digital/lib/digital_crc32.cc b/gr-digital/lib/digital_crc32.cc deleted file mode 100644 index 8806d6e9c..000000000 --- a/gr-digital/lib/digital_crc32.cc +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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. - */ - -/* - * See also ISO 3309 [ISO-3309] or ITU-T V.42 [ITU-V42] for a formal specification. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <digital_crc32.h> - - -// Automatically generated CRC function -// polynomial: 0x104C11DB7 -unsigned int -digital_update_crc32(unsigned int crc, const unsigned char *data, size_t len) -{ - static const unsigned int table[256] = { - 0x00000000U,0x04C11DB7U,0x09823B6EU,0x0D4326D9U, - 0x130476DCU,0x17C56B6BU,0x1A864DB2U,0x1E475005U, - 0x2608EDB8U,0x22C9F00FU,0x2F8AD6D6U,0x2B4BCB61U, - 0x350C9B64U,0x31CD86D3U,0x3C8EA00AU,0x384FBDBDU, - 0x4C11DB70U,0x48D0C6C7U,0x4593E01EU,0x4152FDA9U, - 0x5F15ADACU,0x5BD4B01BU,0x569796C2U,0x52568B75U, - 0x6A1936C8U,0x6ED82B7FU,0x639B0DA6U,0x675A1011U, - 0x791D4014U,0x7DDC5DA3U,0x709F7B7AU,0x745E66CDU, - 0x9823B6E0U,0x9CE2AB57U,0x91A18D8EU,0x95609039U, - 0x8B27C03CU,0x8FE6DD8BU,0x82A5FB52U,0x8664E6E5U, - 0xBE2B5B58U,0xBAEA46EFU,0xB7A96036U,0xB3687D81U, - 0xAD2F2D84U,0xA9EE3033U,0xA4AD16EAU,0xA06C0B5DU, - 0xD4326D90U,0xD0F37027U,0xDDB056FEU,0xD9714B49U, - 0xC7361B4CU,0xC3F706FBU,0xCEB42022U,0xCA753D95U, - 0xF23A8028U,0xF6FB9D9FU,0xFBB8BB46U,0xFF79A6F1U, - 0xE13EF6F4U,0xE5FFEB43U,0xE8BCCD9AU,0xEC7DD02DU, - 0x34867077U,0x30476DC0U,0x3D044B19U,0x39C556AEU, - 0x278206ABU,0x23431B1CU,0x2E003DC5U,0x2AC12072U, - 0x128E9DCFU,0x164F8078U,0x1B0CA6A1U,0x1FCDBB16U, - 0x018AEB13U,0x054BF6A4U,0x0808D07DU,0x0CC9CDCAU, - 0x7897AB07U,0x7C56B6B0U,0x71159069U,0x75D48DDEU, - 0x6B93DDDBU,0x6F52C06CU,0x6211E6B5U,0x66D0FB02U, - 0x5E9F46BFU,0x5A5E5B08U,0x571D7DD1U,0x53DC6066U, - 0x4D9B3063U,0x495A2DD4U,0x44190B0DU,0x40D816BAU, - 0xACA5C697U,0xA864DB20U,0xA527FDF9U,0xA1E6E04EU, - 0xBFA1B04BU,0xBB60ADFCU,0xB6238B25U,0xB2E29692U, - 0x8AAD2B2FU,0x8E6C3698U,0x832F1041U,0x87EE0DF6U, - 0x99A95DF3U,0x9D684044U,0x902B669DU,0x94EA7B2AU, - 0xE0B41DE7U,0xE4750050U,0xE9362689U,0xEDF73B3EU, - 0xF3B06B3BU,0xF771768CU,0xFA325055U,0xFEF34DE2U, - 0xC6BCF05FU,0xC27DEDE8U,0xCF3ECB31U,0xCBFFD686U, - 0xD5B88683U,0xD1799B34U,0xDC3ABDEDU,0xD8FBA05AU, - 0x690CE0EEU,0x6DCDFD59U,0x608EDB80U,0x644FC637U, - 0x7A089632U,0x7EC98B85U,0x738AAD5CU,0x774BB0EBU, - 0x4F040D56U,0x4BC510E1U,0x46863638U,0x42472B8FU, - 0x5C007B8AU,0x58C1663DU,0x558240E4U,0x51435D53U, - 0x251D3B9EU,0x21DC2629U,0x2C9F00F0U,0x285E1D47U, - 0x36194D42U,0x32D850F5U,0x3F9B762CU,0x3B5A6B9BU, - 0x0315D626U,0x07D4CB91U,0x0A97ED48U,0x0E56F0FFU, - 0x1011A0FAU,0x14D0BD4DU,0x19939B94U,0x1D528623U, - 0xF12F560EU,0xF5EE4BB9U,0xF8AD6D60U,0xFC6C70D7U, - 0xE22B20D2U,0xE6EA3D65U,0xEBA91BBCU,0xEF68060BU, - 0xD727BBB6U,0xD3E6A601U,0xDEA580D8U,0xDA649D6FU, - 0xC423CD6AU,0xC0E2D0DDU,0xCDA1F604U,0xC960EBB3U, - 0xBD3E8D7EU,0xB9FF90C9U,0xB4BCB610U,0xB07DABA7U, - 0xAE3AFBA2U,0xAAFBE615U,0xA7B8C0CCU,0xA379DD7BU, - 0x9B3660C6U,0x9FF77D71U,0x92B45BA8U,0x9675461FU, - 0x8832161AU,0x8CF30BADU,0x81B02D74U,0x857130C3U, - 0x5D8A9099U,0x594B8D2EU,0x5408ABF7U,0x50C9B640U, - 0x4E8EE645U,0x4A4FFBF2U,0x470CDD2BU,0x43CDC09CU, - 0x7B827D21U,0x7F436096U,0x7200464FU,0x76C15BF8U, - 0x68860BFDU,0x6C47164AU,0x61043093U,0x65C52D24U, - 0x119B4BE9U,0x155A565EU,0x18197087U,0x1CD86D30U, - 0x029F3D35U,0x065E2082U,0x0B1D065BU,0x0FDC1BECU, - 0x3793A651U,0x3352BBE6U,0x3E119D3FU,0x3AD08088U, - 0x2497D08DU,0x2056CD3AU,0x2D15EBE3U,0x29D4F654U, - 0xC5A92679U,0xC1683BCEU,0xCC2B1D17U,0xC8EA00A0U, - 0xD6AD50A5U,0xD26C4D12U,0xDF2F6BCBU,0xDBEE767CU, - 0xE3A1CBC1U,0xE760D676U,0xEA23F0AFU,0xEEE2ED18U, - 0xF0A5BD1DU,0xF464A0AAU,0xF9278673U,0xFDE69BC4U, - 0x89B8FD09U,0x8D79E0BEU,0x803AC667U,0x84FBDBD0U, - 0x9ABC8BD5U,0x9E7D9662U,0x933EB0BBU,0x97FFAD0CU, - 0xAFB010B1U,0xAB710D06U,0xA6322BDFU,0xA2F33668U, - 0xBCB4666DU,0xB8757BDAU,0xB5365D03U,0xB1F740B4U, - }; - - while (len > 0) - { - crc = table[*data ^ ((crc >> 24) & 0xff)] ^ (crc << 8); - data++; - len--; - } - return crc; -} - -unsigned int -digital_update_crc32(unsigned int crc, const std::string s) -{ - return digital_update_crc32(crc, (const unsigned char *) s.data(), s.size()); -} - -unsigned int -digital_crc32(const unsigned char *buf, size_t len) -{ - return digital_update_crc32(0xffffffff, buf, len) ^ 0xffffffff; -} - -unsigned int -digital_crc32(const std::string s) -{ - return digital_crc32((const unsigned char *) s.data(), s.size()); -} diff --git a/gr-digital/lib/digital_descrambler_bb.cc b/gr-digital/lib/digital_descrambler_bb.cc deleted file mode 100644 index 68cba7145..000000000 --- a/gr-digital/lib/digital_descrambler_bb.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,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 <digital_descrambler_bb.h> -#include <gr_io_signature.h> - -digital_descrambler_bb_sptr -digital_make_descrambler_bb(int mask, int seed, int len) -{ - return gnuradio::get_initial_sptr(new digital_descrambler_bb(mask, seed, len)); -} - -digital_descrambler_bb::digital_descrambler_bb(int mask, int seed, int len) - : gr_sync_block("descrambler_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_lfsr(mask, seed, len) -{ -} - -int -digital_descrambler_bb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) - out[i] = d_lfsr.next_bit_descramble(in[i]); - - return noutput_items; -} diff --git a/gr-digital/lib/digital_diff_decoder_bb.cc b/gr-digital/lib/digital_diff_decoder_bb.cc deleted file mode 100644 index 7b8e8726a..000000000 --- a/gr-digital/lib/digital_diff_decoder_bb.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,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 <digital_diff_decoder_bb.h> -#include <gr_io_signature.h> - -digital_diff_decoder_bb_sptr -digital_make_diff_decoder_bb (unsigned int modulus) -{ - return gnuradio::get_initial_sptr(new digital_diff_decoder_bb(modulus)); -} - -digital_diff_decoder_bb::digital_diff_decoder_bb (unsigned int modulus) - : gr_sync_block ("diff_decoder_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_modulus(modulus) -{ - set_history(2); // need to look at two inputs -} - -int -digital_diff_decoder_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - in += 1; // ensure that in[-1] is valid - - unsigned modulus = d_modulus; - - for (int i = 0; i < noutput_items; i++) { - out[i] = (in[i] - in[i-1]) % modulus; - } - - return noutput_items; -} diff --git a/gr-digital/lib/digital_diff_encoder_bb.cc b/gr-digital/lib/digital_diff_encoder_bb.cc deleted file mode 100644 index bfbaba98f..000000000 --- a/gr-digital/lib/digital_diff_encoder_bb.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,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 <digital_diff_encoder_bb.h> -#include <gr_io_signature.h> - -digital_diff_encoder_bb_sptr -digital_make_diff_encoder_bb (unsigned int modulus) -{ - return gnuradio::get_initial_sptr(new digital_diff_encoder_bb(modulus)); -} - -digital_diff_encoder_bb::digital_diff_encoder_bb (unsigned int modulus) - : gr_sync_block ("diff_encoder_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_last_out(0), d_modulus(modulus) -{ -} - -int -digital_diff_encoder_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - unsigned last_out = d_last_out; - unsigned modulus = d_modulus; - - for (int i = 0; i < noutput_items; i++) { - out[i] = (in[i] + last_out) % modulus; - last_out = out[i]; - } - - d_last_out = last_out; - return noutput_items; -} diff --git a/gr-digital/lib/digital_diff_phasor_cc.cc b/gr-digital/lib/digital_diff_phasor_cc.cc deleted file mode 100644 index 8313a4de8..000000000 --- a/gr-digital/lib/digital_diff_phasor_cc.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,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 <digital_diff_phasor_cc.h> -#include <gr_io_signature.h> - -digital_diff_phasor_cc_sptr -digital_make_diff_phasor_cc () -{ - return gnuradio::get_initial_sptr(new digital_diff_phasor_cc()); -} - -digital_diff_phasor_cc::digital_diff_phasor_cc () - : gr_sync_block ("diff_phasor_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))) -{ - set_history(2); -} - - -digital_diff_phasor_cc::~digital_diff_phasor_cc(){} - -int -digital_diff_phasor_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex const *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - in += 1; // ensure that i - 1 is valid. - - for(int i = 0; i < noutput_items; i++) { - out[i] = in[i] * conj(in[i-1]); - } - - return noutput_items; -} diff --git a/gr-digital/lib/digital_fll_band_edge_cc.cc b/gr-digital/lib/digital_fll_band_edge_cc.cc deleted file mode 100644 index f2cfb1020..000000000 --- a/gr-digital/lib/digital_fll_band_edge_cc.cc +++ /dev/null @@ -1,271 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009-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 <digital_fll_band_edge_cc.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <cstdio> - -#define M_TWOPI (2*M_PI) - -float sinc(float x) -{ - if(x == 0) - return 1; - else - return sin(M_PI*x)/(M_PI*x); -} - -digital_fll_band_edge_cc_sptr -digital_make_fll_band_edge_cc (float samps_per_sym, float rolloff, - int filter_size, float bandwidth) -{ - return gnuradio::get_initial_sptr(new digital_fll_band_edge_cc (samps_per_sym, rolloff, - filter_size, bandwidth)); -} - - -static int ios[] = {sizeof(gr_complex), sizeof(float), sizeof(float), sizeof(float)}; -static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); -digital_fll_band_edge_cc::digital_fll_band_edge_cc(float samps_per_sym, float rolloff, - int filter_size, float bandwidth) - : gr_sync_block("fll_band_edge_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signaturev(1, 4, iosig)), - gri_control_loop(bandwidth, M_TWOPI*(2.0/samps_per_sym), -M_TWOPI*(2.0/samps_per_sym)), - d_updated(false) -{ - // Initialize samples per symbol - if(samps_per_sym <= 0) { - throw std::out_of_range("digital_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("digital_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("digital_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); -} - -digital_fll_band_edge_cc::~digital_fll_band_edge_cc() -{ -} - - -/******************************************************************* - SET FUNCTIONS -*******************************************************************/ - -void -digital_fll_band_edge_cc::set_samples_per_symbol(float sps) -{ - if(sps <= 0) { - throw std::out_of_range("digital_fll_band_edge_cc: invalid number of sps. Must be > 0."); - } - d_sps = sps; - design_filter(d_sps, d_rolloff, d_filter_size); -} - -void -digital_fll_band_edge_cc::set_rolloff(float rolloff) -{ - if(rolloff < 0 || rolloff > 1.0) { - throw std::out_of_range("digital_fll_band_edge_cc: invalid rolloff factor. Must be in [0,1]."); - } - d_rolloff = rolloff; - design_filter(d_sps, d_rolloff, d_filter_size); -} - -void -digital_fll_band_edge_cc::set_filter_size(int filter_size) -{ - if(filter_size <= 0) { - throw std::out_of_range("digital_fll_band_edge_cc: invalid filter size. Must be > 0."); - } - d_filter_size = filter_size; - design_filter(d_sps, d_rolloff, d_filter_size); -} - -/******************************************************************* - GET FUNCTIONS -*******************************************************************/ - -float -digital_fll_band_edge_cc::get_samples_per_symbol() const -{ - return d_sps; -} - -float -digital_fll_band_edge_cc::get_rolloff() const -{ - return d_rolloff; -} - -int -digital_fll_band_edge_cc:: get_filter_size() const -{ - return d_filter_size; -} - - -/******************************************************************* -*******************************************************************/ - -void -digital_fll_band_edge_cc::design_filter(float samps_per_sym, - float rolloff, int filter_size) -{ - int M = rint(filter_size / samps_per_sym); - float power = 0; - - // Create the baseband filter by adding two sincs together - std::vector<float> bb_taps; - for(int i = 0; i < filter_size; i++) { - 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); - } - - d_taps_lower.resize(filter_size); - d_taps_upper.resize(filter_size); - - // Create the band edge filters by spinning the baseband - // filter up and down to the right places in frequency. - // Also, normalize the power in the filters - int N = (bb_taps.size() - 1.0)/2.0; - for(int i = 0; i < filter_size; i++) { - float tap = bb_taps[i] / power; - - float k = (-N + (int)i)/(2.0*samps_per_sym); - - gr_complex t1 = tap * gr_expj(-M_TWOPI*(1+rolloff)*k); - gr_complex t2 = tap * gr_expj(M_TWOPI*(1+rolloff)*k); - - 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 = gr_fir_util::create_gr_fir_ccc(d_taps_upper); - d_filter_lower = gr_fir_util::create_gr_fir_ccc(d_taps_lower); -} - -void -digital_fll_band_edge_cc::print_taps() -{ - unsigned int i; - - printf("Upper Band-edge: ["); - for(i = 0; i < d_taps_upper.size(); i++) { - printf(" %.4e + %.4ej,", d_taps_upper[i].real(), d_taps_upper[i].imag()); - } - printf("]\n\n"); - - printf("Lower Band-edge: ["); - for(i = 0; i < d_taps_lower.size(); i++) { - printf(" %.4e + %.4ej,", d_taps_lower[i].real(), d_taps_lower[i].imag()); - } - printf("]\n\n"); -} - -int -digital_fll_band_edge_cc::work(int noutput_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]; - - d_fllbuffer.reserve(d_filter_size+noutput_items); - - float *frq = NULL; - float *phs = NULL; - float *err = NULL; - if(output_items.size() == 4) { - frq = (float*)output_items[1]; - phs = (float*)output_items[2]; - err = (float*)output_items[3]; - } - - if(d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - int i; - float error; - 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; - // Perform the dot product of the output with the filters - out_upper = 0; - out_lower = 0; - - 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); - phase_wrap(); - frequency_limit(); - - if(output_items.size() == 4) { - frq[i] = d_freq; - phs[i] = d_phase; - err[i] = error; - } - } - - 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/digital_framer_sink_1.cc b/gr-digital/lib/digital_framer_sink_1.cc deleted file mode 100644 index ba1c5bd50..000000000 --- a/gr-digital/lib/digital_framer_sink_1.cc +++ /dev/null @@ -1,192 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010,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 <digital_framer_sink_1.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <stdexcept> -#include <string.h> - -#define VERBOSE 0 - -inline void -digital_framer_sink_1::enter_search() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_search\n"); - - d_state = STATE_SYNC_SEARCH; -} - -inline void -digital_framer_sink_1::enter_have_sync() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_have_sync\n"); - - d_state = STATE_HAVE_SYNC; - d_header = 0; - d_headerbitlen_cnt = 0; -} - -inline void -digital_framer_sink_1::enter_have_header(int payload_len, - int whitener_offset) -{ - if (VERBOSE) - fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n", - payload_len, whitener_offset); - - d_state = STATE_HAVE_HEADER; - d_packetlen = payload_len; - d_packet_whitener_offset = whitener_offset; - d_packetlen_cnt = 0; - d_packet_byte = 0; - d_packet_byte_index = 0; -} - -digital_framer_sink_1_sptr -digital_make_framer_sink_1(gr_msg_queue_sptr target_queue) -{ - return gnuradio::get_initial_sptr(new digital_framer_sink_1(target_queue)); -} - - -digital_framer_sink_1::digital_framer_sink_1(gr_msg_queue_sptr target_queue) - : gr_sync_block ("framer_sink_1", - gr_make_io_signature (1, 1, sizeof(unsigned char)), - gr_make_io_signature (0, 0, 0)), - d_target_queue(target_queue) -{ - enter_search(); -} - -digital_framer_sink_1::~digital_framer_sink_1 () -{ -} - -int -digital_framer_sink_1::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - int count=0; - - if (VERBOSE) - fprintf(stderr,">>> Entering state machine\n"); - - while (count < noutput_items){ - switch(d_state) { - - case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt - if (VERBOSE) - fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items); - - while (count < noutput_items) { - if (in[count] & 0x2){ // Found it, set up for header decode - enter_have_sync(); - break; - } - count++; - } - break; - - case STATE_HAVE_SYNC: - if (VERBOSE) - fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n", - d_headerbitlen_cnt, d_header); - - while (count < noutput_items) { // Shift bits one at a time into header - d_header = (d_header << 1) | (in[count++] & 0x1); - if (++d_headerbitlen_cnt == HEADERBITLEN) { - - if (VERBOSE) - fprintf(stderr, "got header: 0x%08x\n", d_header); - - // we have a full header, check to see if it has been received properly - if (header_ok()){ - int payload_len; - int whitener_offset; - header_payload(&payload_len, &whitener_offset); - enter_have_header(payload_len, whitener_offset); - - if (d_packetlen == 0){ // check for zero-length payload - // build a zero-length message - // NOTE: passing header field as arg1 is not scalable - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, 0); - - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - } - } - else - enter_search(); // bad header - break; // we're in a new state - } - } - break; - - case STATE_HAVE_HEADER: - if (VERBOSE) - fprintf(stderr,"Packet Build\n"); - - while (count < noutput_items) { // shift bits into bytes of packet one at a time - d_packet_byte = (d_packet_byte << 1) | (in[count++] & 0x1); - if (d_packet_byte_index++ == 7) { // byte is full so move to next byte - d_packet[d_packetlen_cnt++] = d_packet_byte; - d_packet_byte_index = 0; - - if (d_packetlen_cnt == d_packetlen){ // packet is filled - - // build a message - // NOTE: passing header field as arg1 is not scalable - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt); - memcpy(msg->msg(), d_packet, d_packetlen_cnt); - - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - break; - } - } - } - break; - - default: - assert(0); - - } // switch - - } // while - - return noutput_items; -} diff --git a/gr-digital/lib/digital_glfsr_source_b.cc b/gr-digital/lib/digital_glfsr_source_b.cc deleted file mode 100644 index e557e475a..000000000 --- a/gr-digital/lib/digital_glfsr_source_b.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010,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 <digital_glfsr_source_b.h> -#include <gri_glfsr.h> -#include <gr_io_signature.h> -#include <stdexcept> - -digital_glfsr_source_b_sptr -digital_make_glfsr_source_b(int degree, bool repeat, int mask, int seed) -{ - return gnuradio::get_initial_sptr(new digital_glfsr_source_b - (degree, repeat, mask, seed)); -} - -digital_glfsr_source_b::digital_glfsr_source_b(int degree, bool repeat, - int mask, int seed) - : gr_sync_block ("glfsr_source_b", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, sizeof(unsigned char))), - d_repeat(repeat), - d_index(0) -{ - if (degree < 1 || degree > 32) - throw std::runtime_error("digital_glfsr_source_b: degree must be between 1 and 32 inclusive"); - d_length = (unsigned int)((1ULL << degree)-1); - - if (mask == 0) - mask = gri_glfsr::glfsr_mask(degree); - d_glfsr = new gri_glfsr(mask, seed); -} - -digital_glfsr_source_b::~digital_glfsr_source_b() -{ - delete d_glfsr; -} - -int -digital_glfsr_source_b::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *out = (char *) output_items[0]; - if ((d_index > d_length) && d_repeat == false) - return -1; /* once through the sequence */ - - int i; - for (i = 0; i < noutput_items; i++) { - out[i] = d_glfsr->next_bit(); - d_index++; - if (d_index > d_length && d_repeat == false) - break; - } - - return i; -} - -int -digital_glfsr_source_b::mask() const -{ - return d_glfsr->mask(); -} diff --git a/gr-digital/lib/digital_glfsr_source_f.cc b/gr-digital/lib/digital_glfsr_source_f.cc deleted file mode 100644 index 5a7736ef8..000000000 --- a/gr-digital/lib/digital_glfsr_source_f.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010,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 <digital_glfsr_source_f.h> -#include <gri_glfsr.h> -#include <gr_io_signature.h> -#include <stdexcept> - -digital_glfsr_source_f_sptr -digital_make_glfsr_source_f(int degree, bool repeat, int mask, int seed) -{ - return gnuradio::get_initial_sptr(new digital_glfsr_source_f - (degree, repeat, mask, seed)); -} - -digital_glfsr_source_f::digital_glfsr_source_f(int degree, bool repeat, - int mask, int seed) - : gr_sync_block ("glfsr_source_f", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, sizeof(float))), - d_repeat(repeat), - d_index(0) -{ - if (degree < 1 || degree > 32) - throw std::runtime_error("digital_glfsr_source_f: degree must be between 1 and 32 inclusive"); - d_length = (unsigned int)((1ULL << degree)-1); - - if (mask == 0) - mask = gri_glfsr::glfsr_mask(degree); - d_glfsr = new gri_glfsr(mask, seed); -} - -digital_glfsr_source_f::~digital_glfsr_source_f() -{ - delete d_glfsr; -} - -int -digital_glfsr_source_f::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *out = (float *) output_items[0]; - if ((d_index > d_length) && d_repeat == false) - return -1; /* once through the sequence */ - - int i; - for (i = 0; i < noutput_items; i++) { - out[i] = (float)d_glfsr->next_bit()*2.0-1.0; - d_index++; - if (d_index > d_length && d_repeat == false) - break; - } - - return i; -} - -int -digital_glfsr_source_f::mask() const -{ - return d_glfsr->mask(); -} diff --git a/gr-digital/lib/digital_gmskmod_bc.cc b/gr-digital/lib/digital_gmskmod_bc.cc deleted file mode 100644 index e53e90037..000000000 --- a/gr-digital/lib/digital_gmskmod_bc.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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 <digital_gmskmod_bc.h> -#include <gr_io_signature.h> - -// Shared pointer constructor -digital_gmskmod_bc_sptr -digital_make_gmskmod_bc(unsigned samples_per_sym, - double bt, unsigned L) -{ - return gnuradio::get_initial_sptr(new digital_gmskmod_bc(samples_per_sym, bt, L)); -} - - -digital_gmskmod_bc::digital_gmskmod_bc(unsigned samples_per_sym, - double bt, unsigned L) - : digital_cpmmod_bc(gr_cpm::GAUSSIAN, 0.5, samples_per_sym, L, bt) -{ -} - diff --git a/gr-digital/lib/digital_impl_glfsr.cc b/gr-digital/lib/digital_impl_glfsr.cc deleted file mode 100644 index 342980e53..000000000 --- a/gr-digital/lib/digital_impl_glfsr.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,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. - */ - -#include <digital_impl_glfsr.h> -#include <stdexcept> - -static int s_polynomial_masks[] = { - 0x00000000, - 0x00000001, // x^1 + 1 - 0x00000003, // x^2 + x^1 + 1 - 0x00000005, // x^3 + x^1 + 1 - 0x00000009, // x^4 + x^1 + 1 - 0x00000012, // x^5 + x^2 + 1 - 0x00000021, // x^6 + x^1 + 1 - 0x00000041, // x^7 + x^1 + 1 - 0x0000008E, // x^8 + x^4 + x^3 + x^2 + 1 - 0x00000108, // x^9 + x^4 + 1 - 0x00000204, // x^10 + x^4 + 1 - 0x00000402, // x^11 + x^2 + 1 - 0x00000829, // x^12 + x^6 + x^4 + x^1 + 1 - 0x0000100D, // x^13 + x^4 + x^3 + x^1 + 1 - 0x00002015, // x^14 + x^5 + x^3 + x^1 + 1 - 0x00004001, // x^15 + x^1 + 1 - 0x00008016, // x^16 + x^5 + x^3 + x^2 + 1 - 0x00010004, // x^17 + x^3 + 1 - 0x00020013, // x^18 + x^5 + x^2 + x^1 + 1 - 0x00040013, // x^19 + x^5 + x^2 + x^1 + 1 - 0x00080004, // x^20 + x^3 + 1 - 0x00100002, // x^21 + x^2 + 1 - 0x00200001, // x^22 + x^1 + 1 - 0x00400010, // x^23 + x^5 + 1 - 0x0080000D, // x^24 + x^4 + x^3 + x^1 + 1 - 0x01000004, // x^25 + x^3 + 1 - 0x02000023, // x^26 + x^6 + x^2 + x^1 + 1 - 0x04000013, // x^27 + x^5 + x^2 + x^1 + 1 - 0x08000004, // x^28 + x^3 + 1 - 0x10000002, // x^29 + x^2 + 1 - 0x20000029, // x^30 + x^4 + x^1 + 1 - 0x40000004, // x^31 + x^3 + 1 - 0x80000057 // x^32 + x^7 + x^5 + x^3 + x^2 + x^1 + 1 -}; - -int digital_impl_glfsr::glfsr_mask(int degree) -{ - if (degree < 1 || degree > 32) - throw std::runtime_error("digital_impl_glfsr::glfsr_mask(): degree must be between 1 and 32 inclusive"); - return s_polynomial_masks[degree]; -} diff --git a/gr-digital/lib/digital_impl_mpsk_snr_est.cc b/gr-digital/lib/digital_impl_mpsk_snr_est.cc deleted file mode 100644 index b2ad0369f..000000000 --- a/gr-digital/lib/digital_impl_mpsk_snr_est.cc +++ /dev/null @@ -1,256 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <digital_impl_mpsk_snr_est.h> -#include <cstdio> - -digital_impl_mpsk_snr_est::digital_impl_mpsk_snr_est(double alpha) -{ - set_alpha(alpha); -} - -digital_impl_mpsk_snr_est::~digital_impl_mpsk_snr_est() -{} - -void -digital_impl_mpsk_snr_est::set_alpha(double alpha) -{ - d_alpha = alpha; - d_beta = 1.0-alpha; -} - -double -digital_impl_mpsk_snr_est::alpha() const -{ - return d_alpha; -} - -int -digital_impl_mpsk_snr_est::update(int noutput_items, - const gr_complex *in) -{ - throw std::runtime_error("digital_impl_mpsk_snr_est: Unimplemented"); -} - -double -digital_impl_mpsk_snr_est::snr() -{ - throw std::runtime_error("digital_impl_mpsk_snr_est: Unimplemented"); -} - - -/********************************************************************/ - - -digital_impl_mpsk_snr_est_simple::digital_impl_mpsk_snr_est_simple( - double alpha) : - digital_impl_mpsk_snr_est(alpha) -{ - d_y1 = 0; - d_y2 = 0; -} - -int -digital_impl_mpsk_snr_est_simple::update( - int noutput_items, - const gr_complex *in) -{ - for (int i = 0; i < noutput_items; i++){ - double y1 = abs(in[i]); - d_y1 = d_alpha*y1 + d_beta*d_y1; - - double y2 = real(in[i]*in[i]); - d_y2 = d_alpha*y2 + d_beta*d_y2; - } - return noutput_items; -} - -double -digital_impl_mpsk_snr_est_simple::snr() -{ - double y1_2 = d_y1*d_y1; - double y3 = y1_2 - d_y2 + 1e-20; - return 10.0*log10(y1_2/y3); -} - - -/********************************************************************/ - - -digital_impl_mpsk_snr_est_skew::digital_impl_mpsk_snr_est_skew( - double alpha) : - digital_impl_mpsk_snr_est(alpha) -{ - d_y1 = 0; - d_y2 = 0; - d_y3 = 0; -} - - -int -digital_impl_mpsk_snr_est_skew::update( - int noutput_items, - const gr_complex *in) -{ - for (int i = 0; i < noutput_items; i++){ - double y1 = abs(in[i]); - d_y1 = d_alpha*y1 + d_beta*d_y1; - - double y2 = real(in[i]*in[i]); - d_y2 = d_alpha*y2 + d_beta*d_y2; - - // online algorithm for calculating skewness - // See: - // http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Higher-order_statistics - double d = abs(in[i]) - d_y1; - double d_i = d / (i+1); - double y3 = (d*d_i*i)*d_i*(i-1) - 3.0*d_i*d_y2; - d_y3 = d_alpha*y3 + d_beta*d_y3; - } - return noutput_items; -} - -double -digital_impl_mpsk_snr_est_skew::snr() -{ - double y3 = d_y3*d_y3 / (d_y2*d_y2*d_y2); - double y1_2 = d_y1*d_y1; - double x = y1_2 - d_y2; - return 10.0*log10(y1_2 / (x + y3*y1_2)); -} - - -/********************************************************************/ - - -digital_impl_mpsk_snr_est_m2m4::digital_impl_mpsk_snr_est_m2m4( - double alpha) : - digital_impl_mpsk_snr_est(alpha) -{ - d_y1 = 0; - d_y2 = 0; -} - -int -digital_impl_mpsk_snr_est_m2m4::update( - int noutput_items, - const gr_complex *in) -{ - for (int i = 0; i < noutput_items; i++){ - double y1 = abs(in[i])*abs(in[i]); - d_y1 = d_alpha*y1 + d_beta*d_y1; - - double y2 = abs(in[i])*abs(in[i])*abs(in[i])*abs(in[i]); - d_y2 = d_alpha*y2 + d_beta*d_y2; - } - return noutput_items; -} - -double -digital_impl_mpsk_snr_est_m2m4::snr() -{ - double y1_2 = d_y1*d_y1; - return 10.0*log10(2.0*sqrt(2*y1_2 - d_y2) / - (d_y1 - sqrt(2*y1_2 - d_y2))); -} - - -/********************************************************************/ - - -digital_impl_snr_est_m2m4::digital_impl_snr_est_m2m4( - double alpha, double ka, double kw) : - digital_impl_mpsk_snr_est(alpha) -{ - d_y1 = 0; - d_y2 = 0; - d_ka = ka; - d_kw = kw; -} - -int -digital_impl_snr_est_m2m4::update( - int noutput_items, - const gr_complex *in) -{ - for (int i = 0; i < noutput_items; i++) { - double y1 = abs(in[i])*abs(in[i]); - d_y1 = d_alpha*y1 + d_beta*d_y1; - - double y2 = abs(in[i])*abs(in[i])*abs(in[i])*abs(in[i]); - d_y2 = d_alpha*y2 + d_beta*d_y2; - } - return noutput_items; -} - -double -digital_impl_snr_est_m2m4::snr() -{ - double M2 = d_y1; - double M4 = d_y2; - double s = M2*(d_kw - 2) + - sqrt((4.0-d_ka*d_kw)*M2*M2 + M4*(d_ka+d_kw-4.0)) / - (d_ka + d_kw - 4.0); - double n = M2 - s; - - return 10.0*log10(s / n); -} - - -/********************************************************************/ - - -digital_impl_mpsk_snr_est_svr::digital_impl_mpsk_snr_est_svr( - double alpha) : - digital_impl_mpsk_snr_est(alpha) -{ - d_y1 = 0; - d_y2 = 0; -} - -int -digital_impl_mpsk_snr_est_svr::update( - int noutput_items, - const gr_complex *in) -{ - for(int i = 0; i < noutput_items; i++) { - double x = abs(in[i+1]); - double x1 = abs(in[i]); - double y1 = (x*x)*(x1*x1); - d_y1 = d_alpha*y1 + d_beta*d_y1; - - double y2 = x*x*x*x; - d_y2 = d_alpha*y2 + d_beta*d_y2; - } - return noutput_items; -} - -double -digital_impl_mpsk_snr_est_svr::snr() -{ - double x = d_y1 / (d_y2 - d_y1); - return 10.0*log10(2.*((x-1) + sqrt(x*(x-1)))); -} diff --git a/gr-digital/lib/digital_kurtotic_equalizer_cc.cc b/gr-digital/lib/digital_kurtotic_equalizer_cc.cc deleted file mode 100644 index c95b56021..000000000 --- a/gr-digital/lib/digital_kurtotic_equalizer_cc.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <digital_kurtotic_equalizer_cc.h> - -digital_kurtotic_equalizer_cc_sptr -digital_make_kurtotic_equalizer_cc(int num_taps, float mu) -{ - return gnuradio::get_initial_sptr(new digital_kurtotic_equalizer_cc(num_taps, mu)); -} - -digital_kurtotic_equalizer_cc::digital_kurtotic_equalizer_cc(int num_taps, float mu) - : gr_adaptive_fir_ccc("kurtotic_equalizer_cc", 1, std::vector<gr_complex>(num_taps)) -{ - set_gain(mu); - if (num_taps > 0) - d_taps[0] = 1.0; - - d_alpha_p = 0.01; - d_alpha_q = 0.01; - d_alpha_m = 0.01; - - d_p = 0.0f; - d_m = 0.0f; - d_q = gr_complex(0,0); - d_u = gr_complex(0,0); -} - diff --git a/gr-digital/lib/digital_lms_dd_equalizer_cc.cc b/gr-digital/lib/digital_lms_dd_equalizer_cc.cc deleted file mode 100644 index e2c2f16f2..000000000 --- a/gr-digital/lib/digital_lms_dd_equalizer_cc.cc +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <digital_lms_dd_equalizer_cc.h> -#include <gr_io_signature.h> -#include <gr_misc.h> -#include <iostream> - -digital_lms_dd_equalizer_cc_sptr -digital_make_lms_dd_equalizer_cc(int num_taps, float mu, int sps, - digital_constellation_sptr cnst) -{ - return gnuradio::get_initial_sptr(new digital_lms_dd_equalizer_cc(num_taps, mu, - sps, cnst)); -} - -digital_lms_dd_equalizer_cc::digital_lms_dd_equalizer_cc(int num_taps, float mu, - int sps, - digital_constellation_sptr cnst) - : gr_adaptive_fir_ccc("lms_dd_equalizer_cc", sps, - std::vector<gr_complex>(num_taps, gr_complex(0,0))), - d_taps(num_taps), d_cnst(cnst) -{ - set_gain(mu); - if (num_taps > 0) - d_taps[num_taps/2] = 1.0; -} - - - - -/* -int -digital_lms_dd_equalizer_cc::work (int noutput_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]; - - gr_complex acc, decision, error; - - for(int i = 0; i < noutput_items; i++) { - acc = 0; - - // Compute output - for (size_t j=0; j < d_taps.size(); j++) - acc += in[i+j] * conj(d_taps[j]); - - d_cnst->map_to_points(d_cnst->decision_maker(&acc), &decision); - error = decision - acc; - - // Update taps - for (size_t j=0; j < d_taps.size(); j++) - d_taps[j] += d_mu * conj(error) * in[i+j]; - - out[i] = acc; - } - - return noutput_items; -} -*/ diff --git a/gr-digital/lib/digital_map_bb.cc b/gr-digital/lib/digital_map_bb.cc deleted file mode 100644 index 1d8444a40..000000000 --- a/gr-digital/lib/digital_map_bb.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2010,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 <digital_map_bb.h> -#include <gr_io_signature.h> - -digital_map_bb_sptr -digital_make_map_bb (const std::vector<int> &map) -{ - return gnuradio::get_initial_sptr(new digital_map_bb (map)); -} - -digital_map_bb::digital_map_bb (const std::vector<int> &map) - : gr_sync_block ("map_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ - for (int i = 0; i < 0x100; i++) - d_map[i] = i; - - unsigned int size = std::min((size_t) 0x100, map.size()); - for (unsigned int i = 0; i < size; i++) - d_map[i] = map[i]; -} - -int -digital_map_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) - out[i] = d_map[in[i]]; - - return noutput_items; -} diff --git a/gr-digital/lib/digital_mpsk_receiver_cc.cc b/gr-digital/lib/digital_mpsk_receiver_cc.cc deleted file mode 100644 index 6d2bab8a4..000000000 --- a/gr-digital/lib/digital_mpsk_receiver_cc.cc +++ /dev/null @@ -1,329 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2007,2010,2011 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 <gr_io_signature.h> -#include <gr_prefs.h> -#include <digital_mpsk_receiver_cc.h> -#include <stdexcept> -#include <gr_math.h> -#include <gr_expj.h> -#include <gri_mmse_fir_interpolator_cc.h> - - -#define M_TWOPI (2*M_PI) -#define VERBOSE_MM 0 // Used for debugging symbol timing loop -#define VERBOSE_COSTAS 0 // Used for debugging phase and frequency tracking - -// Public constructor - -digital_mpsk_receiver_cc_sptr -digital_make_mpsk_receiver_cc(unsigned int M, float theta, - float loop_bw, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel) -{ - return gnuradio::get_initial_sptr(new digital_mpsk_receiver_cc (M, theta, - loop_bw, - fmin, fmax, - mu, gain_mu, - omega, gain_omega, - omega_rel)); -} - -digital_mpsk_receiver_cc::digital_mpsk_receiver_cc (unsigned int M, float theta, - float loop_bw, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, - float omega_rel) - : gr_block ("mpsk_receiver_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - gri_control_loop(loop_bw, fmax, fmin), - d_M(M), d_theta(theta), - d_current_const_point(0), - d_mu(mu), d_gain_mu(gain_mu), d_gain_omega(gain_omega), - d_omega_rel(omega_rel), d_max_omega(0), d_min_omega(0), - d_p_2T(0), d_p_1T(0), d_p_0T(0), d_c_2T(0), d_c_1T(0), d_c_0T(0) -{ - d_interp = new gri_mmse_fir_interpolator_cc(); - d_dl_idx = 0; - - set_omega(omega); - - if (omega <= 0.0) - throw std::out_of_range ("clock rate must be > 0"); - if (gain_mu < 0 || gain_omega < 0) - throw std::out_of_range ("Gains must be non-negative"); - - assert(d_interp->ntaps() <= DLLEN); - - // zero double length delay line. - for (unsigned int i = 0; i < 2 * DLLEN; i++) - d_dl[i] = gr_complex(0.0,0.0); - - set_modulation_order(d_M); -} - -digital_mpsk_receiver_cc::~digital_mpsk_receiver_cc () -{ - delete d_interp; -} - -void -digital_mpsk_receiver_cc::set_modulation_order(unsigned int M) -{ - // build the constellation vector from M - make_constellation(); - - // Select a phase detector and a decision maker for the modulation order - switch(d_M) { - case 2: // optimized algorithms for BPSK - d_phase_error_detector = &digital_mpsk_receiver_cc::phase_error_detector_bpsk; //bpsk; - d_decision = &digital_mpsk_receiver_cc::decision_bpsk; - break; - - case 4: // optimized algorithms for QPSK - d_phase_error_detector = &digital_mpsk_receiver_cc::phase_error_detector_qpsk; //qpsk; - d_decision = &digital_mpsk_receiver_cc::decision_qpsk; - break; - - default: // generic algorithms for any M (power of 2?) but not pretty - d_phase_error_detector = &digital_mpsk_receiver_cc::phase_error_detector_generic; - d_decision = &digital_mpsk_receiver_cc::decision_generic; - break; - } -} - -void -digital_mpsk_receiver_cc::set_gain_omega_rel(float omega_rel) -{ - d_omega_rel = omega_rel; - set_omega(d_omega); -} - -void -digital_mpsk_receiver_cc::forecast(int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i=0; i < ninputs; i++) - ninput_items_required[i] = (int) ceil((noutput_items * d_omega) + d_interp->ntaps()); -} - -// FIXME add these back in an test difference in performance -float -digital_mpsk_receiver_cc::phase_error_detector_qpsk(gr_complex sample) const -{ - float phase_error = 0; - if(fabsf(sample.real()) > fabsf(sample.imag())) { - if(sample.real() > 0) - phase_error = -sample.imag(); - else - phase_error = sample.imag(); - } - else { - if(sample.imag() > 0) - phase_error = sample.real(); - else - phase_error = -sample.real(); - } - - return phase_error; -} - -float -digital_mpsk_receiver_cc::phase_error_detector_bpsk(gr_complex sample) const -{ - return -(sample.real()*sample.imag()); -} - -float digital_mpsk_receiver_cc::phase_error_detector_generic(gr_complex sample) const -{ - //return gr_fast_atan2f(sample*conj(d_constellation[d_current_const_point])); - return -arg(sample*conj(d_constellation[d_current_const_point])); -} - -unsigned int -digital_mpsk_receiver_cc::decision_bpsk(gr_complex sample) const -{ - return (gr_branchless_binary_slicer(sample.real()) ^ 1); - //return gr_binary_slicer(sample.real()) ^ 1; -} - -unsigned int -digital_mpsk_receiver_cc::decision_qpsk(gr_complex sample) const -{ - unsigned int index; - - //index = gr_branchless_quad_0deg_slicer(sample); - index = gr_quad_0deg_slicer(sample); - return index; -} - -unsigned int -digital_mpsk_receiver_cc::decision_generic(gr_complex sample) const -{ - unsigned int min_m = 0; - float min_s = 65535; - - // Develop all possible constellation points and find the one that minimizes - // the Euclidean distance (error) with the sample - for(unsigned int m=0; m < d_M; m++) { - gr_complex diff = norm(d_constellation[m] - sample); - - if(fabs(diff.real()) < min_s) { - min_s = fabs(diff.real()); - min_m = m; - } - } - // Return the index of the constellation point that minimizes the error - return min_m; -} - - -void -digital_mpsk_receiver_cc::make_constellation() -{ - for(unsigned int m=0; m < d_M; m++) { - d_constellation.push_back(gr_expj((M_TWOPI/d_M)*m)); - } -} - -void -digital_mpsk_receiver_cc::mm_sampler(const gr_complex symbol) -{ - gr_complex sample, nco; - - d_mu--; // skip a number of symbols between sampling - d_phase += d_freq; // increment the phase based on the frequency of the rotation - - // Keep phase clamped and not walk to infinity - while(d_phase > M_TWOPI) - d_phase -= M_TWOPI; - while(d_phase < -M_TWOPI) - d_phase += M_TWOPI; - - nco = gr_expj(d_phase+d_theta); // get the NCO value for derotating the current sample - sample = nco*symbol; // get the downconverted symbol - - // Fill up the delay line for the interpolator - d_dl[d_dl_idx] = sample; - d_dl[(d_dl_idx + DLLEN)] = sample; // put this in the second half of the buffer for overflows - d_dl_idx = (d_dl_idx+1) % DLLEN; // Keep the delay line index in bounds -} - -void -digital_mpsk_receiver_cc::mm_error_tracking(gr_complex sample) -{ - gr_complex u, x, y; - float mm_error = 0; - - // Make sample timing corrections - - // set the delayed samples - d_p_2T = d_p_1T; - d_p_1T = d_p_0T; - d_p_0T = sample; - d_c_2T = d_c_1T; - d_c_1T = d_c_0T; - - d_current_const_point = (*this.*d_decision)(d_p_0T); // make a decision on the sample value - d_c_0T = d_constellation[d_current_const_point]; - - x = (d_c_0T - d_c_2T) * conj(d_p_1T); - y = (d_p_0T - d_p_2T) * conj(d_c_1T); - u = y - x; - mm_error = u.real(); // the error signal is in the real part - mm_error = gr_branchless_clip(mm_error, 1.0); // limit mm_val - - d_omega = d_omega + d_gain_omega * mm_error; // update omega based on loop error - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_rel); // make sure we don't walk away - - d_mu += d_omega + d_gain_mu * mm_error; // update mu based on loop error - -#if VERBOSE_MM - printf("mm: mu: %f omega: %f mm_error: %f sample: %f+j%f constellation: %f+j%f\n", - d_mu, d_omega, mm_error, sample.real(), sample.imag(), - d_constellation[d_current_const_point].real(), d_constellation[d_current_const_point].imag()); -#endif -} - - -void -digital_mpsk_receiver_cc::phase_error_tracking(gr_complex sample) -{ - float phase_error = 0; - - // Make phase and frequency corrections based on sampled value - phase_error = (*this.*d_phase_error_detector)(sample); - - advance_loop(phase_error); - phase_wrap(); - frequency_limit(); - -#if VERBOSE_COSTAS - printf("cl: phase_error: %f phase: %f freq: %f sample: %f+j%f constellation: %f+j%f\n", - phase_error, d_phase, d_freq, sample.real(), sample.imag(), - d_constellation[d_current_const_point].real(), d_constellation[d_current_const_point].imag()); -#endif -} - -int -digital_mpsk_receiver_cc::general_work (int noutput_items, - gr_vector_int &ninput_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]; - - int i=0, o=0; - - while((o < noutput_items) && (i < ninput_items[0])) { - while((d_mu > 1) && (i < ninput_items[0])) { - mm_sampler(in[i]); // puts symbols into a buffer and adjusts d_mu - i++; - } - - if(i < ninput_items[0]) { - gr_complex interp_sample = d_interp->interpolate(&d_dl[d_dl_idx], d_mu); - - mm_error_tracking(interp_sample); // corrects M&M sample time - phase_error_tracking(interp_sample); // corrects phase and frequency offsets - - out[o++] = interp_sample; - } - } - - #if 0 - printf("ninput_items: %d noutput_items: %d consuming: %d returning: %d\n", - ninput_items[0], noutput_items, i, o); - #endif - - consume_each(i); - return o; -} diff --git a/gr-digital/lib/digital_mpsk_snr_est_cc.cc b/gr-digital/lib/digital_mpsk_snr_est_cc.cc deleted file mode 100644 index 38a452ac2..000000000 --- a/gr-digital/lib/digital_mpsk_snr_est_cc.cc +++ /dev/null @@ -1,186 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <digital_mpsk_snr_est_cc.h> -#include <gr_io_signature.h> -#include <cstdio> - -digital_mpsk_snr_est_cc_sptr -digital_make_mpsk_snr_est_cc(snr_est_type_t type, - int tag_nsamples, - double alpha) -{ - return gnuradio::get_initial_sptr(new digital_mpsk_snr_est_cc( - type, tag_nsamples, alpha)); -} - -digital_mpsk_snr_est_cc::digital_mpsk_snr_est_cc(snr_est_type_t type, - int tag_nsamples, - double alpha) - : gr_sync_block ("mpsk_snr_est_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))) -{ - d_snr_est = NULL; - - d_type = type; - d_nsamples = tag_nsamples; - d_count = 0; - set_alpha(alpha); - - set_type(type); - - // at least 1 estimator has to look back - set_history(2); - - std::stringstream str; - str << name() << unique_id(); - d_me = pmt::pmt_string_to_symbol(str.str()); - d_key = pmt::pmt_string_to_symbol("snr"); -} - -digital_mpsk_snr_est_cc::~digital_mpsk_snr_est_cc() -{ - if(d_snr_est) - delete d_snr_est; -} - -int -digital_mpsk_snr_est_cc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - // This is a pass-through block; copy input to output - memcpy(output_items[0], input_items[0], - noutput_items * sizeof(gr_complex)); - - const gr_complex *in = (const gr_complex*)input_items[0]; - - // Update, calculate, and issue an SNR tag every d_nsamples - int index = 0, x = 0; - int64_t nwritten = nitems_written(0); - while(index + (d_nsamples-d_count) < noutput_items) { - x = d_nsamples - d_count; - nwritten += x; - - // Update the SNR estimate registers from the current input - d_snr_est->update(x, &in[index]); - - // Issue a tag with the SNR data - pmt::pmt_t pmt_snr = pmt::pmt_from_double(d_snr_est->snr()); - add_item_tag(0, // stream ID - nwritten, // tag's sample number - d_key, // snr key - pmt_snr, // SNR - d_me); // block src id - - index += x; - d_count = 0; - } - - // Keep track of remaining items and update estimators - x = noutput_items - index; - d_count += x; - d_snr_est->update(x, &in[index]); - - return noutput_items; -} - -double -digital_mpsk_snr_est_cc::snr() -{ - if(d_snr_est) - return d_snr_est->snr(); - else - throw std::runtime_error("digital_mpsk_snr_est_cc:: No SNR estimator defined.\n"); -} - -snr_est_type_t -digital_mpsk_snr_est_cc::type() const -{ - return d_type; -} - -int -digital_mpsk_snr_est_cc::tag_nsample() const -{ - return d_nsamples; -} - -double -digital_mpsk_snr_est_cc::alpha() const -{ - return d_alpha; -} - -void -digital_mpsk_snr_est_cc::set_type(snr_est_type_t t) -{ - d_type = t; - - if(d_snr_est) - delete d_snr_est; - - switch (d_type) { - case(SNR_EST_SIMPLE): - d_snr_est = new digital_impl_mpsk_snr_est_simple(d_alpha); - break; - case(SNR_EST_SKEW): - d_snr_est = new digital_impl_mpsk_snr_est_skew(d_alpha); - break; - case(SNR_EST_M2M4): - d_snr_est = new digital_impl_mpsk_snr_est_m2m4(d_alpha); - break; - case(SNR_EST_SVR): - d_snr_est = new digital_impl_mpsk_snr_est_svr(d_alpha); - break; - default: - throw std::invalid_argument("digital_mpsk_snr_est_cc: unknown type specified.\n"); - } -} - -void -digital_mpsk_snr_est_cc::set_tag_nsample(int n) -{ - if(n > 0) { - d_nsamples = n; - d_count = 0; // reset state - } - else - throw std::invalid_argument("digital_mpsk_snr_est_cc: tag_nsamples can't be <= 0\n"); -} - -void -digital_mpsk_snr_est_cc::set_alpha(double alpha) -{ - if((alpha >= 0) && (alpha <= 1.0)) { - d_alpha = alpha; - if(d_snr_est) - d_snr_est->set_alpha(d_alpha); - } - else - throw std::invalid_argument("digital_mpsk_snr_est_cc: alpha must be in [0,1]\n"); -} diff --git a/gr-digital/lib/digital_ofdm_cyclic_prefixer.cc b/gr-digital/lib/digital_ofdm_cyclic_prefixer.cc deleted file mode 100644 index 192af2591..000000000 --- a/gr-digital/lib/digital_ofdm_cyclic_prefixer.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010,2011 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 <digital_ofdm_cyclic_prefixer.h> -#include <gr_io_signature.h> - -digital_ofdm_cyclic_prefixer_sptr -digital_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size) -{ - return gnuradio::get_initial_sptr(new digital_ofdm_cyclic_prefixer (input_size, - output_size)); -} - -digital_ofdm_cyclic_prefixer::digital_ofdm_cyclic_prefixer (size_t input_size, - size_t output_size) - : gr_sync_interpolator ("ofdm_cyclic_prefixer", - gr_make_io_signature (1, 1, input_size*sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - output_size), - d_input_size(input_size), - d_output_size(output_size) - -{ -} - -int -digital_ofdm_cyclic_prefixer::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in = (gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - size_t cp_size = d_output_size - d_input_size; - unsigned int i=0, j=0; - - j = cp_size; - for(i=0; i < d_input_size; i++,j++) { - out[j] = in[i]; - } - - j = d_input_size - cp_size; - for(i=0; i < cp_size; i++, j++) { - out[i] = in[j]; - } - - return d_output_size; -} diff --git a/gr-digital/lib/digital_ofdm_frame_acquisition.cc b/gr-digital/lib/digital_ofdm_frame_acquisition.cc deleted file mode 100644 index 93b58aeca..000000000 --- a/gr-digital/lib/digital_ofdm_frame_acquisition.cc +++ /dev/null @@ -1,210 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006-2008,2010,2011 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 <digital_ofdm_frame_acquisition.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <gr_math.h> -#include <cstdio> - -#define VERBOSE 0 -#define M_TWOPI (2*M_PI) -#define MAX_NUM_SYMBOLS 1000 - -digital_ofdm_frame_acquisition_sptr -digital_make_ofdm_frame_acquisition (unsigned int occupied_carriers, - unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len) -{ - return gnuradio::get_initial_sptr(new digital_ofdm_frame_acquisition (occupied_carriers, fft_length, cplen, - known_symbol, max_fft_shift_len)); -} - -digital_ofdm_frame_acquisition::digital_ofdm_frame_acquisition (unsigned occupied_carriers, - unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len) - : gr_block ("ofdm_frame_acquisition", - gr_make_io_signature2 (2, 2, sizeof(gr_complex)*fft_length, sizeof(char)*fft_length), - gr_make_io_signature2 (2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char))), - d_occupied_carriers(occupied_carriers), - d_fft_length(fft_length), - d_cplen(cplen), - d_freq_shift_len(max_fft_shift_len), - d_known_symbol(known_symbol), - d_coarse_freq(0), - d_phase_count(0) -{ - d_symbol_phase_diff.resize(d_fft_length); - d_known_phase_diff.resize(d_occupied_carriers); - d_hestimate.resize(d_occupied_carriers); - - unsigned int i = 0, j = 0; - - std::fill(d_known_phase_diff.begin(), d_known_phase_diff.end(), 0); - for(i = 0; i < d_known_symbol.size()-2; i+=2) { - d_known_phase_diff[i] = norm(d_known_symbol[i] - d_known_symbol[i+2]); - } - - d_phase_lut = new gr_complex[(2*d_freq_shift_len+1) * MAX_NUM_SYMBOLS]; - for(i = 0; i <= 2*d_freq_shift_len; i++) { - for(j = 0; j < MAX_NUM_SYMBOLS; j++) { - d_phase_lut[j + i*MAX_NUM_SYMBOLS] = gr_expj(-M_TWOPI*d_cplen/d_fft_length*(i-d_freq_shift_len)*j); - } - } -} - -digital_ofdm_frame_acquisition::~digital_ofdm_frame_acquisition(void) -{ - delete [] d_phase_lut; -} - -void -digital_ofdm_frame_acquisition::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = 1; -} - -gr_complex -digital_ofdm_frame_acquisition::coarse_freq_comp(int freq_delta, int symbol_count) -{ - // return gr_complex(cos(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count), - // sin(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count)); - - return gr_expj(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count); - - //return d_phase_lut[MAX_NUM_SYMBOLS * (d_freq_shift_len + freq_delta) + symbol_count]; -} - -void -digital_ofdm_frame_acquisition::correlate(const gr_complex *symbol, int zeros_on_left) -{ - unsigned int i,j; - - std::fill(d_symbol_phase_diff.begin(), d_symbol_phase_diff.end(), 0); - for(i = 0; i < d_fft_length-2; i++) { - d_symbol_phase_diff[i] = norm(symbol[i] - symbol[i+2]); - } - - // sweep through all possible/allowed frequency offsets and select the best - int index = 0; - float max = 0, sum=0; - for(i = zeros_on_left - d_freq_shift_len; i < zeros_on_left + d_freq_shift_len; i++) { - sum = 0; - for(j = 0; j < d_occupied_carriers; j++) { - sum += (d_known_phase_diff[j] * d_symbol_phase_diff[i+j]); - } - if(sum > max) { - max = sum; - index = i; - } - } - - // set the coarse frequency offset relative to the edge of the occupied tones - d_coarse_freq = index - zeros_on_left; -} - -void -digital_ofdm_frame_acquisition::calculate_equalizer(const gr_complex *symbol, int zeros_on_left) -{ - unsigned int i=0; - - // Set first tap of equalizer - d_hestimate[0] = d_known_symbol[0] / - (coarse_freq_comp(d_coarse_freq,1)*symbol[zeros_on_left+d_coarse_freq]); - - // set every even tap based on known symbol - // linearly interpolate between set carriers to set zero-filled carriers - // FIXME: is this the best way to set this? - for(i = 2; i < d_occupied_carriers; i+=2) { - d_hestimate[i] = d_known_symbol[i] / - (coarse_freq_comp(d_coarse_freq,1)*(symbol[i+zeros_on_left+d_coarse_freq])); - d_hestimate[i-1] = (d_hestimate[i] + d_hestimate[i-2]) / gr_complex(2.0, 0.0); - } - - // with even number of carriers; last equalizer tap is wrong - if(!(d_occupied_carriers & 1)) { - d_hestimate[d_occupied_carriers-1] = d_hestimate[d_occupied_carriers-2]; - } - - if(VERBOSE) { - fprintf(stderr, "Equalizer setting:\n"); - for(i = 0; i < d_occupied_carriers; i++) { - gr_complex sym = coarse_freq_comp(d_coarse_freq,1)*symbol[i+zeros_on_left+d_coarse_freq]; - gr_complex output = sym * d_hestimate[i]; - fprintf(stderr, "sym: %+.4f + j%+.4f ks: %+.4f + j%+.4f eq: %+.4f + j%+.4f ==> %+.4f + j%+.4f\n", - sym .real(), sym.imag(), - d_known_symbol[i].real(), d_known_symbol[i].imag(), - d_hestimate[i].real(), d_hestimate[i].imag(), - output.real(), output.imag()); - } - fprintf(stderr, "\n"); - } -} - -int -digital_ofdm_frame_acquisition::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *symbol = (const gr_complex *)input_items[0]; - const char *signal_in = (const char *)input_items[1]; - - gr_complex *out = (gr_complex *) output_items[0]; - char *signal_out = (char *) output_items[1]; - - int unoccupied_carriers = d_fft_length - d_occupied_carriers; - int zeros_on_left = (int)ceil(unoccupied_carriers/2.0); - - if(signal_in[0]) { - d_phase_count = 1; - correlate(symbol, zeros_on_left); - calculate_equalizer(symbol, zeros_on_left); - signal_out[0] = 1; - } - else { - signal_out[0] = 0; - } - - for(unsigned int i = 0; i < d_occupied_carriers; i++) { - out[i] = d_hestimate[i]*coarse_freq_comp(d_coarse_freq,d_phase_count) - *symbol[i+zeros_on_left+d_coarse_freq]; - } - - d_phase_count++; - if(d_phase_count == MAX_NUM_SYMBOLS) { - d_phase_count = 1; - } - - consume_each(1); - return 1; -} diff --git a/gr-digital/lib/digital_ofdm_frame_sink.cc b/gr-digital/lib/digital_ofdm_frame_sink.cc deleted file mode 100644 index f8fb1bbb1..000000000 --- a/gr-digital/lib/digital_ofdm_frame_sink.cc +++ /dev/null @@ -1,405 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008,2010,2011 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 <digital_ofdm_frame_sink.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <gr_math.h> -#include <math.h> -#include <cstdio> -#include <stdexcept> -#include <iostream> -#include <string.h> - -#define VERBOSE 0 - -inline void -digital_ofdm_frame_sink::enter_search() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_search\n"); - - d_state = STATE_SYNC_SEARCH; - -} - -inline void -digital_ofdm_frame_sink::enter_have_sync() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_have_sync\n"); - - d_state = STATE_HAVE_SYNC; - - // clear state of demapper - d_byte_offset = 0; - d_partial_byte = 0; - - d_header = 0; - d_headerbytelen_cnt = 0; - - // Resetting PLL - d_freq = 0.0; - d_phase = 0.0; - fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0)); -} - -inline void -digital_ofdm_frame_sink::enter_have_header() -{ - d_state = STATE_HAVE_HEADER; - - // header consists of two 16-bit shorts in network byte order - // payload length is lower 12 bits - // whitener offset is upper 4 bits - d_packetlen = (d_header >> 16) & 0x0fff; - d_packet_whitener_offset = (d_header >> 28) & 0x000f; - d_packetlen_cnt = 0; - - if (VERBOSE) - fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n", - d_packetlen, d_packet_whitener_offset); -} - - -unsigned char digital_ofdm_frame_sink::slicer(const gr_complex x) -{ - unsigned int table_size = d_sym_value_out.size(); - unsigned int min_index = 0; - float min_euclid_dist = norm(x - d_sym_position[0]); - float euclid_dist = 0; - - for (unsigned int j = 1; j < table_size; j++){ - euclid_dist = norm(x - d_sym_position[j]); - if (euclid_dist < min_euclid_dist){ - min_euclid_dist = euclid_dist; - min_index = j; - } - } - return d_sym_value_out[min_index]; -} - -unsigned int digital_ofdm_frame_sink::demapper(const gr_complex *in, - unsigned char *out) -{ - unsigned int i=0, bytes_produced=0; - gr_complex carrier; - - carrier=gr_expj(d_phase); - - gr_complex accum_error = 0.0; - //while(i < d_occupied_carriers) { - while(i < d_subcarrier_map.size()) { - if(d_nresid > 0) { - d_partial_byte |= d_resid; - d_byte_offset += d_nresid; - d_nresid = 0; - d_resid = 0; - } - - //while((d_byte_offset < 8) && (i < d_occupied_carriers)) { - while((d_byte_offset < 8) && (i < d_subcarrier_map.size())) { - //gr_complex sigrot = in[i]*carrier*d_dfe[i]; - gr_complex sigrot = in[d_subcarrier_map[i]]*carrier*d_dfe[i]; - - if(d_derotated_output != NULL){ - d_derotated_output[i] = sigrot; - } - - unsigned char bits = slicer(sigrot); - - gr_complex closest_sym = d_sym_position[bits]; - - accum_error += sigrot * conj(closest_sym); - - // FIX THE FOLLOWING STATEMENT - if (norm(sigrot)> 0.001) d_dfe[i] += d_eq_gain*(closest_sym/sigrot-d_dfe[i]); - - i++; - - if((8 - d_byte_offset) >= d_nbits) { - d_partial_byte |= bits << (d_byte_offset); - d_byte_offset += d_nbits; - } - else { - d_nresid = d_nbits-(8-d_byte_offset); - int mask = ((1<<(8-d_byte_offset))-1); - d_partial_byte |= (bits & mask) << d_byte_offset; - d_resid = bits >> (8-d_byte_offset); - d_byte_offset += (d_nbits - d_nresid); - } - //printf("demod symbol: %.4f + j%.4f bits: %x partial_byte: %x byte_offset: %d resid: %x nresid: %d\n", - // in[i-1].real(), in[i-1].imag(), bits, d_partial_byte, d_byte_offset, d_resid, d_nresid); - } - - if(d_byte_offset == 8) { - //printf("demod byte: %x \n\n", d_partial_byte); - out[bytes_produced++] = d_partial_byte; - d_byte_offset = 0; - d_partial_byte = 0; - } - } - //std::cerr << "accum_error " << accum_error << std::endl; - - float angle = arg(accum_error); - - d_freq = d_freq - d_freq_gain*angle; - d_phase = d_phase + d_freq - d_phase_gain*angle; - if (d_phase >= 2*M_PI) d_phase -= 2*M_PI; - if (d_phase <0) d_phase += 2*M_PI; - - //if(VERBOSE) - // std::cerr << angle << "\t" << d_freq << "\t" << d_phase << "\t" << std::endl; - - return bytes_produced; -} - - -digital_ofdm_frame_sink_sptr -digital_make_ofdm_frame_sink(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, - gr_msg_queue_sptr target_queue, unsigned int occupied_carriers, - float phase_gain, float freq_gain) -{ - return gnuradio::get_initial_sptr(new digital_ofdm_frame_sink(sym_position, sym_value_out, - target_queue, occupied_carriers, - phase_gain, freq_gain)); -} - - -digital_ofdm_frame_sink::digital_ofdm_frame_sink(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, - gr_msg_queue_sptr target_queue, unsigned int occupied_carriers, - float phase_gain, float freq_gain) - : gr_sync_block ("ofdm_frame_sink", - gr_make_io_signature2 (2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char)), - gr_make_io_signature (1, 1, sizeof(gr_complex)*occupied_carriers)), - d_target_queue(target_queue), d_occupied_carriers(occupied_carriers), - d_byte_offset(0), d_partial_byte(0), - d_resid(0), d_nresid(0),d_phase(0),d_freq(0),d_phase_gain(phase_gain),d_freq_gain(freq_gain), - d_eq_gain(0.05) -{ - std::string carriers = "FE7F"; - - // A bit hacky to fill out carriers to occupied_carriers length - int diff = (d_occupied_carriers - 4*carriers.length()); - while(diff > 7) { - carriers.insert(0, "f"); - carriers.insert(carriers.length(), "f"); - diff -= 8; - } - - // if there's extras left to be processed - // divide remaining to put on either side of current map - // all of this is done to stick with the concept of a carrier map string that - // can be later passed by the user, even though it'd be cleaner to just do this - // on the carrier map itself - int diff_left=0; - int diff_right=0; - - // dictionary to convert from integers to ascii hex representation - char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - if(diff > 0) { - char c[2] = {0,0}; - - diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side - c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer - carriers.insert(0, c); - - diff_right = diff - diff_left; // number of carriers to put on the right side - c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer - carriers.insert(carriers.length(), c); - } - - // It seemed like such a good idea at the time... - // because we are only dealing with the occupied_carriers - // at this point, the diff_left in the following compensates - // for any offset from the 0th carrier introduced - unsigned int i,j,k; - for(i = 0; i < (d_occupied_carriers/4)+diff_left; i++) { - char c = carriers[i]; - for(j = 0; j < 4; j++) { - k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1; - if(k) { - d_subcarrier_map.push_back(4*i + j - diff_left); - } - } - } - - // make sure we stay in the limit currently imposed by the occupied_carriers - if(d_subcarrier_map.size() > d_occupied_carriers) { - throw std::invalid_argument("digital_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers"); - } - - d_bytes_out = new unsigned char[d_occupied_carriers]; - d_dfe.resize(occupied_carriers); - fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0)); - - set_sym_value_out(sym_position, sym_value_out); - - enter_search(); -} - -digital_ofdm_frame_sink::~digital_ofdm_frame_sink () -{ - delete [] d_bytes_out; -} - -bool -digital_ofdm_frame_sink::set_sym_value_out(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out) -{ - if (sym_position.size() != sym_value_out.size()) - return false; - - if (sym_position.size()<1) - return false; - - d_sym_position = sym_position; - d_sym_value_out = sym_value_out; - d_nbits = (unsigned long)ceil(log10(float(d_sym_value_out.size())) / log10(2.0)); - - return true; -} - - -int -digital_ofdm_frame_sink::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - const char *sig = (const char *) input_items[1]; - unsigned int j = 0; - unsigned int bytes=0; - - // If the output is connected, send it the derotated symbols - if(output_items.size() >= 1) - d_derotated_output = (gr_complex *)output_items[0]; - else - d_derotated_output = NULL; - - if (VERBOSE) - fprintf(stderr,">>> Entering state machine\n"); - - switch(d_state) { - - case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt - if (VERBOSE) - fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items); - - if (sig[0]) { // Found it, set up for header decode - enter_have_sync(); - } - break; - - case STATE_HAVE_SYNC: - // only demod after getting the preamble signal; otherwise, the - // equalizer taps will screw with the PLL performance - bytes = demapper(&in[0], d_bytes_out); - - if (VERBOSE) { - if(sig[0]) - printf("ERROR -- Found SYNC in HAVE_SYNC\n"); - fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n", - d_headerbytelen_cnt, d_header); - } - - j = 0; - while(j < bytes) { - d_header = (d_header << 8) | (d_bytes_out[j] & 0xFF); - j++; - - if (++d_headerbytelen_cnt == HEADERBYTELEN) { - - if (VERBOSE) - fprintf(stderr, "got header: 0x%08x\n", d_header); - - // we have a full header, check to see if it has been received properly - if (header_ok()){ - enter_have_header(); - - if (VERBOSE) - printf("\nPacket Length: %d\n", d_packetlen); - - while((j < bytes) && (d_packetlen_cnt < d_packetlen)) { - d_packet[d_packetlen_cnt++] = d_bytes_out[j++]; - } - - if(d_packetlen_cnt == d_packetlen) { - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen); - memcpy(msg->msg(), d_packet, d_packetlen_cnt); - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - } - } - else { - enter_search(); // bad header - } - } - } - break; - - case STATE_HAVE_HEADER: - bytes = demapper(&in[0], d_bytes_out); - - if (VERBOSE) { - if(sig[0]) - printf("ERROR -- Found SYNC in HAVE_HEADER at %d, length of %d\n", d_packetlen_cnt, d_packetlen); - fprintf(stderr,"Packet Build\n"); - } - - j = 0; - while(j < bytes) { - d_packet[d_packetlen_cnt++] = d_bytes_out[j++]; - - if (d_packetlen_cnt == d_packetlen){ // packet is filled - // build a message - // NOTE: passing header field as arg1 is not scalable - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt); - memcpy(msg->msg(), d_packet, d_packetlen_cnt); - - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - break; - } - } - break; - - default: - assert(0); - - } // switch - - return 1; -} diff --git a/gr-digital/lib/digital_ofdm_insert_preamble.cc b/gr-digital/lib/digital_ofdm_insert_preamble.cc deleted file mode 100644 index 72b9e82a8..000000000 --- a/gr-digital/lib/digital_ofdm_insert_preamble.cc +++ /dev/null @@ -1,194 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010-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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <digital_ofdm_insert_preamble.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> -#include <string.h> - -digital_ofdm_insert_preamble_sptr -digital_make_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble) -{ - return gnuradio::get_initial_sptr(new digital_ofdm_insert_preamble(fft_length, - preamble)); -} - -digital_ofdm_insert_preamble::digital_ofdm_insert_preamble - (int fft_length, - const std::vector<std::vector<gr_complex> > &preamble) - : gr_block("ofdm_insert_preamble", - gr_make_io_signature2(1, 2, - sizeof(gr_complex)*fft_length, - sizeof(char)), - gr_make_io_signature2(1, 2, - sizeof(gr_complex)*fft_length, - sizeof(char))), - d_fft_length(fft_length), - d_preamble(preamble), - d_state(ST_IDLE), - d_nsymbols_output(0), - d_pending_flag(0) -{ - // sanity check preamble symbols - for(size_t i = 0; i < d_preamble.size(); i++) { - if(d_preamble[i].size() != (size_t) d_fft_length) - throw std::invalid_argument("digital_ofdm_insert_preamble: invalid length for preamble symbol"); - } - - enter_idle(); -} - - -digital_ofdm_insert_preamble::~digital_ofdm_insert_preamble() -{ -} - -void digital_ofdm_insert_preamble::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - ninput_items_required[0] = noutput_items; -} - -int -digital_ofdm_insert_preamble::general_work(int noutput_items, - gr_vector_int &ninput_items_v, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ninput_items = ninput_items_v.size()==2?std::min(ninput_items_v[0], ninput_items_v[1]):ninput_items_v[0]; - const gr_complex *in_sym = (const gr_complex *) input_items[0]; - const unsigned char *in_flag = 0; - if (input_items.size() == 2) - in_flag = (const unsigned char *) input_items[1]; - - gr_complex *out_sym = (gr_complex *) output_items[0]; - unsigned char *out_flag = 0; - if (output_items.size() == 2) - out_flag = (unsigned char *) output_items[1]; - - - int no = 0; // number items output - int ni = 0; // number items read from input - - -#define write_out_flag() \ - do { if (out_flag) \ - out_flag[no] = d_pending_flag; \ - d_pending_flag = 0; \ - } while(0) - - - while (no < noutput_items && ni < ninput_items){ - switch(d_state){ - case ST_IDLE: - if (in_flag && in_flag[ni] & 0x1) // this is first symbol of new payload - enter_preamble(); - else - ni++; // eat one input symbol - break; - - case ST_PREAMBLE: - assert(!in_flag || in_flag[ni] & 0x1); - if (d_nsymbols_output >= (int) d_preamble.size()){ - // we've output all the preamble - enter_first_payload(); - } - else { - memcpy(&out_sym[no * d_fft_length], - &d_preamble[d_nsymbols_output][0], - d_fft_length*sizeof(gr_complex)); - - write_out_flag(); - no++; - d_nsymbols_output++; - } - break; - - case ST_FIRST_PAYLOAD: - // copy first payload symbol from input to output - memcpy(&out_sym[no * d_fft_length], - &in_sym[ni * d_fft_length], - d_fft_length * sizeof(gr_complex)); - - write_out_flag(); - no++; - ni++; - enter_payload(); - break; - - case ST_PAYLOAD: - if (in_flag && in_flag[ni] & 0x1){ // this is first symbol of a new payload - enter_preamble(); - break; - } - - // copy a symbol from input to output - memcpy(&out_sym[no * d_fft_length], - &in_sym[ni * d_fft_length], - d_fft_length * sizeof(gr_complex)); - - write_out_flag(); - no++; - ni++; - break; - - default: - std::cerr << "digital_ofdm_insert_preamble: (can't happen) invalid state, resetting\n"; - enter_idle(); - } - } - - consume_each(ni); - return no; -} - -void -digital_ofdm_insert_preamble::enter_idle() -{ - d_state = ST_IDLE; - d_nsymbols_output = 0; - d_pending_flag = 0; -} - -void -digital_ofdm_insert_preamble::enter_preamble() -{ - d_state = ST_PREAMBLE; - d_nsymbols_output = 0; - d_pending_flag = 1; -} - -void -digital_ofdm_insert_preamble::enter_first_payload() -{ - d_state = ST_FIRST_PAYLOAD; -} - -void -digital_ofdm_insert_preamble::enter_payload() -{ - d_state = ST_PAYLOAD; -} diff --git a/gr-digital/lib/digital_ofdm_mapper_bcv.cc b/gr-digital/lib/digital_ofdm_mapper_bcv.cc deleted file mode 100644 index cf3d08703..000000000 --- a/gr-digital/lib/digital_ofdm_mapper_bcv.cc +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006-2008,2010,2011 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 <digital_ofdm_mapper_bcv.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <string.h> - -digital_ofdm_mapper_bcv_sptr -digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned int msgq_limit, - unsigned int occupied_carriers, unsigned int fft_length) -{ - return gnuradio::get_initial_sptr(new digital_ofdm_mapper_bcv (constellation, msgq_limit, - occupied_carriers, fft_length)); -} - -// Consumes 1 packet and produces as many OFDM symbols of fft_length to hold the full packet -digital_ofdm_mapper_bcv::digital_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned int msgq_limit, - unsigned int occupied_carriers, unsigned int fft_length) - : gr_sync_block ("ofdm_mapper_bcv", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature2 (1, 2, sizeof(gr_complex)*fft_length, sizeof(char))), - d_constellation(constellation), - d_msgq(gr_make_msg_queue(msgq_limit)), d_msg_offset(0), d_eof(false), - d_occupied_carriers(occupied_carriers), - d_fft_length(fft_length), - d_bit_offset(0), - d_pending_flag(0), - d_resid(0), - d_nresid(0) -{ - if (!(d_occupied_carriers <= d_fft_length)) - throw std::invalid_argument("digital_ofdm_mapper_bcv: occupied carriers must be <= fft_length"); - - // this is not the final form of this solution since we still use the occupied_tones concept, - // which would get us into trouble if the number of carriers we seek is greater than the occupied carriers. - // Eventually, we will get rid of the occupied_carriers concept. - std::string carriers = "FE7F"; - - // A bit hacky to fill out carriers to occupied_carriers length - int diff = (d_occupied_carriers - 4*carriers.length()); - while(diff > 7) { - carriers.insert(0, "f"); - carriers.insert(carriers.length(), "f"); - diff -= 8; - } - - // if there's extras left to be processed - // divide remaining to put on either side of current map - // all of this is done to stick with the concept of a carrier map string that - // can be later passed by the user, even though it'd be cleaner to just do this - // on the carrier map itself - int diff_left=0; - int diff_right=0; - - // dictionary to convert from integers to ascii hex representation - char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - if(diff > 0) { - char c[2] = {0,0}; - - diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side - c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer - carriers.insert(0, c); - - diff_right = diff - diff_left; // number of carriers to put on the right side - c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer - carriers.insert(carriers.length(), c); - } - - // find out how many zeros to pad on the sides; the difference between the fft length and the subcarrier - // mapping size in chunks of four. This is the number to pack on the left and this number plus any - // residual nulls (if odd) will be packed on the right. - diff = (d_fft_length/4 - carriers.length())/2; - - unsigned int i,j,k; - for(i = 0; i < carriers.length(); i++) { - char c = carriers[i]; // get the current hex character from the string - for(j = 0; j < 4; j++) { // walk through all four bits - k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1; // convert to int and extract next bit - if(k) { // if bit is a 1, - d_subcarrier_map.push_back(4*(i+diff) + j); // use this subcarrier - } - } - } - - // make sure we stay in the limit currently imposed by the occupied_carriers - if(d_subcarrier_map.size() > d_occupied_carriers) { - throw std::invalid_argument("digital_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers"); - } - - d_nbits = (unsigned long)ceil(log10(float(d_constellation.size())) / log10(2.0)); -} - -digital_ofdm_mapper_bcv::~digital_ofdm_mapper_bcv(void) -{ -} - -int digital_ofdm_mapper_bcv::randsym() -{ - return (rand() % d_constellation.size()); -} - -int -digital_ofdm_mapper_bcv::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *out = (gr_complex *)output_items[0]; - - unsigned int i=0; - - //printf("OFDM BPSK Mapper: ninput_items: %d noutput_items: %d\n", ninput_items[0], noutput_items); - - if(d_eof) { - return -1; - } - - if(!d_msg) { - d_msg = d_msgq->delete_head(); // block, waiting for a message - d_msg_offset = 0; - d_bit_offset = 0; - d_pending_flag = 1; // new packet, write start of packet flag - - if((d_msg->length() == 0) && (d_msg->type() == 1)) { - d_msg.reset(); - return -1; // We're done; no more messages coming. - } - } - - char *out_flag = 0; - if(output_items.size() == 2) - out_flag = (char *) output_items[1]; - - - // Build a single symbol: - // Initialize all bins to 0 to set unused carriers - memset(out, 0, d_fft_length*sizeof(gr_complex)); - - i = 0; - unsigned char bits = 0; - //while((d_msg_offset < d_msg->length()) && (i < d_occupied_carriers)) { - while((d_msg_offset < d_msg->length()) && (i < d_subcarrier_map.size())) { - - // need new data to process - if(d_bit_offset == 0) { - d_msgbytes = d_msg->msg()[d_msg_offset]; - //printf("mod message byte: %x\n", d_msgbytes); - } - - if(d_nresid > 0) { - // take the residual bits, fill out nbits with info from the new byte, and put them in the symbol - d_resid |= (((1 << d_nresid)-1) & d_msgbytes) << (d_nbits - d_nresid); - bits = d_resid; - - out[d_subcarrier_map[i]] = d_constellation[bits]; - i++; - - d_bit_offset += d_nresid; - d_nresid = 0; - d_resid = 0; - //printf("mod bit(r): %x resid: %x nresid: %d bit_offset: %d\n", - // bits, d_resid, d_nresid, d_bit_offset); - } - else { - if((8 - d_bit_offset) >= d_nbits) { // test to make sure we can fit nbits - // take the nbits number of bits at a time from the byte to add to the symbol - bits = ((1 << d_nbits)-1) & (d_msgbytes >> d_bit_offset); - d_bit_offset += d_nbits; - - out[d_subcarrier_map[i]] = d_constellation[bits]; - i++; - } - else { // if we can't fit nbits, store them for the next - // saves d_nresid bits of this message where d_nresid < d_nbits - unsigned int extra = 8-d_bit_offset; - d_resid = ((1 << extra)-1) & (d_msgbytes >> d_bit_offset); - d_bit_offset += extra; - d_nresid = d_nbits - extra; - } - - } - - if(d_bit_offset == 8) { - d_bit_offset = 0; - d_msg_offset++; - } - } - - // Ran out of data to put in symbol - if (d_msg_offset == d_msg->length()) { - if(d_nresid > 0) { - d_resid |= 0x00; - bits = d_resid; - d_nresid = 0; - d_resid = 0; - } - - //while(i < d_occupied_carriers) { // finish filling out the symbol - while(i < d_subcarrier_map.size()) { // finish filling out the symbol - out[d_subcarrier_map[i]] = d_constellation[randsym()]; - - i++; - } - - if (d_msg->type() == 1) // type == 1 sets EOF - d_eof = true; - d_msg.reset(); // finished packet, free message - assert(d_bit_offset == 0); - } - - if (out_flag) - out_flag[0] = d_pending_flag; - d_pending_flag = 0; - - return 1; // produced symbol -} diff --git a/gr-digital/lib/digital_ofdm_sampler.cc b/gr-digital/lib/digital_ofdm_sampler.cc deleted file mode 100644 index cab8c2ba9..000000000 --- a/gr-digital/lib/digital_ofdm_sampler.cc +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008,2010,2011 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 <digital_ofdm_sampler.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <cstdio> - -digital_ofdm_sampler_sptr -digital_make_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout) -{ - return gnuradio::get_initial_sptr(new digital_ofdm_sampler (fft_length, symbol_length, timeout)); -} - -digital_ofdm_sampler::digital_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout) - : gr_block ("ofdm_sampler", - gr_make_io_signature2 (2, 2, sizeof (gr_complex), sizeof(char)), - gr_make_io_signature2 (2, 2, sizeof (gr_complex)*fft_length, sizeof(char)*fft_length)), - d_state(STATE_NO_SIG), d_timeout_max(timeout), d_fft_length(fft_length), d_symbol_length(symbol_length) -{ - set_relative_rate(1.0/(double) fft_length); // buffer allocator hint -} - -void -digital_ofdm_sampler::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - // FIXME do we need more - //int nreqd = (noutput_items-1) * d_symbol_length + d_fft_length; - int nreqd = d_symbol_length + d_fft_length; - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = nreqd; -} - - -int -digital_ofdm_sampler::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *iptr = (const gr_complex *) input_items[0]; - const char *trigger = (const char *) input_items[1]; - - gr_complex *optr = (gr_complex *) output_items[0]; - char *outsig = (char *) output_items[1]; - - //FIXME: we only process a single OFDM symbol at a time; after the preamble, we can - // process a few at a time as long as we always look out for the next preamble. - - unsigned int index=d_fft_length; // start one fft length into the input so we can always look back this far - - outsig[0] = 0; // set output to no signal by default - - // Search for a preamble trigger signal during the next symbol length - while((d_state != STATE_PREAMBLE) && (index <= (d_symbol_length+d_fft_length))) { - if(trigger[index]) { - outsig[0] = 1; // tell the next block there is a preamble coming - d_state = STATE_PREAMBLE; - } - else - index++; - } - - unsigned int i, pos, ret; - switch(d_state) { - case(STATE_PREAMBLE): - // When we found a preamble trigger, get it and set the symbol boundary here - for(i = (index - d_fft_length + 1); i <= index; i++) { - *optr++ = iptr[i]; - } - - d_timeout = d_timeout_max; // tell the system to expect at least this many symbols for a frame - d_state = STATE_FRAME; - consume_each(index - d_fft_length + 1); // consume up to one fft_length away to keep the history - ret = 1; - break; - - case(STATE_FRAME): - // use this state when we have processed a preamble and are getting the rest of the frames - //FIXME: we could also have a power squelch system here to enter STATE_NO_SIG if no power is received - - // skip over fft length history and cyclic prefix - pos = d_symbol_length; // keeps track of where we are in the input buffer - while(pos < d_symbol_length + d_fft_length) { - *optr++ = iptr[pos++]; - } - - if(d_timeout-- == 0) { - printf("TIMEOUT\n"); - d_state = STATE_NO_SIG; - } - - consume_each(d_symbol_length); // jump up by 1 fft length and the cyclic prefix length - ret = 1; - break; - - case(STATE_NO_SIG): - default: - consume_each(index-d_fft_length); // consume everything we've gone through so far leaving the fft length history - ret = 0; - break; - } - - return ret; -} diff --git a/gr-digital/lib/digital_packet_sink.cc b/gr-digital/lib/digital_packet_sink.cc deleted file mode 100644 index 92521376f..000000000 --- a/gr-digital/lib/digital_packet_sink.cc +++ /dev/null @@ -1,207 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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 <digital_packet_sink.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <gr_count_bits.h> -#include <string.h> - -#define VERBOSE 0 - -static const int DEFAULT_THRESHOLD = 12; // detect access code with up to DEFAULT_THRESHOLD bits wrong - -inline void -digital_packet_sink::enter_search() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_search\n"); - - d_state = STATE_SYNC_SEARCH; - d_shift_reg = 0; -} - -inline void -digital_packet_sink::enter_have_sync() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_have_sync\n"); - - d_state = STATE_HAVE_SYNC; - d_header = 0; - d_headerbitlen_cnt = 0; -} - -inline void -digital_packet_sink::enter_have_header(int payload_len) -{ - if (VERBOSE) - fprintf(stderr, "@ enter_have_header (payload_len = %d)\n", payload_len); - - d_state = STATE_HAVE_HEADER; - d_packetlen = payload_len; - d_packetlen_cnt = 0; - d_packet_byte = 0; - d_packet_byte_index = 0; -} - -digital_packet_sink_sptr -digital_make_packet_sink (const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, int threshold) -{ - return gnuradio::get_initial_sptr(new digital_packet_sink (sync_vector, target_queue, threshold)); -} - - -digital_packet_sink::digital_packet_sink (const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, int threshold) - : gr_sync_block ("packet_sink", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (0, 0, 0)), - d_target_queue(target_queue), d_threshold(threshold == -1 ? DEFAULT_THRESHOLD : threshold) -{ - d_sync_vector = 0; - for(int i=0;i<8;i++){ - d_sync_vector <<= 8; - d_sync_vector |= sync_vector[i]; - } - - enter_search(); -} - -digital_packet_sink::~digital_packet_sink () -{ -} - -int -digital_packet_sink::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *inbuf = (float *) input_items[0]; - int count=0; - - if (VERBOSE) - fprintf(stderr,">>> Entering state machine\n"),fflush(stderr); - - while (count<noutput_items) { - switch(d_state) { - - case STATE_SYNC_SEARCH: // Look for sync vector - if (VERBOSE) - fprintf(stderr,"SYNC Search, noutput=%d\n",noutput_items),fflush(stderr); - - while (count < noutput_items) { - if(slice(inbuf[count++])) - d_shift_reg = (d_shift_reg << 1) | 1; - else - d_shift_reg = d_shift_reg << 1; - - // Compute popcnt of putative sync vector - if(gr_count_bits64 (d_shift_reg ^ d_sync_vector) <= d_threshold) { - // Found it, set up for header decode - enter_have_sync(); - break; - } - } - break; - - case STATE_HAVE_SYNC: - if (VERBOSE) - fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n", d_headerbitlen_cnt, d_header), - fflush(stderr); - - while (count < noutput_items) { // Shift bits one at a time into header - if(slice(inbuf[count++])) - d_header = (d_header << 1) | 1; - else - d_header = d_header << 1; - - if (++d_headerbitlen_cnt == HEADERBITLEN) { - - if (VERBOSE) - fprintf(stderr, "got header: 0x%08x\n", d_header); - - // we have a full header, check to see if it has been received properly - if (header_ok()){ - int payload_len = header_payload_len(); - if (payload_len <= MAX_PKT_LEN) // reasonable? - enter_have_header(payload_len); // yes. - else - enter_search(); // no. - } - else - enter_search(); // no. - break; // we're in a new state - } - } - break; - - case STATE_HAVE_HEADER: - if (VERBOSE) - fprintf(stderr,"Packet Build\n"),fflush(stderr); - - while (count < noutput_items) { // shift bits into bytes of packet one at a time - if(slice(inbuf[count++])) - d_packet_byte = (d_packet_byte << 1) | 1; - else - d_packet_byte = d_packet_byte << 1; - - if (d_packet_byte_index++ == 7) { // byte is full so move to next byte - d_packet[d_packetlen_cnt++] = d_packet_byte; - d_packet_byte_index = 0; - - if (d_packetlen_cnt == d_packetlen){ // packet is filled - - // build a message - gr_message_sptr msg = gr_make_message(0, 0, 0, d_packetlen_cnt); - memcpy(msg->msg(), d_packet, d_packetlen_cnt); - - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - break; - } - } - } - break; - - default: - assert(0); - - } // switch - - } // while - - return noutput_items; -} - diff --git a/gr-digital/lib/digital_pfb_clock_sync_ccf.cc b/gr-digital/lib/digital_pfb_clock_sync_ccf.cc deleted file mode 100644 index 1a2d5970b..000000000 --- a/gr-digital/lib/digital_pfb_clock_sync_ccf.cc +++ /dev/null @@ -1,440 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009-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 <cstdio> -#include <cmath> - -#include <digital_pfb_clock_sync_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <gr_math.h> - -digital_pfb_clock_sync_ccf_sptr -digital_make_pfb_clock_sync_ccf(double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps) -{ - return gnuradio::get_initial_sptr(new digital_pfb_clock_sync_ccf - (sps, loop_bw, taps, - filter_size, - init_phase, - max_rate_deviation, - osps)); -} - -static int ios[] = {sizeof(gr_complex), sizeof(float), sizeof(float), sizeof(float)}; -static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); -digital_pfb_clock_sync_ccf::digital_pfb_clock_sync_ccf (double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps) - : gr_block ("pfb_clock_sync_ccf", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signaturev (1, 4, iosig)), - d_updated (false), d_nfilters(filter_size), - d_max_dev(max_rate_deviation), - d_osps(osps), d_error(0), d_out_idx(0) -{ - d_nfilters = filter_size; - d_sps = floor(sps); - - // Set the damping factor for a critically damped system - d_damping = sqrtf(2.0f)/2.0f; - - // Set the bandwidth, which will then call update_gains() - set_loop_bandwidth(loop_bw); - - // Store the last filter between calls to work - // The accumulator keeps track of overflow to increment the stride correctly. - // set it here to the fractional difference based on the initial phaes - d_k = init_phase; - d_rate = (sps-floor(sps))*(double)d_nfilters; - d_rate_i = (int)floor(d_rate); - d_rate_f = d_rate - (float)d_rate_i; - d_filtnum = (int)floor(d_k); - - d_filters = std::vector<gr_fir_ccf*>(d_nfilters); - d_diff_filters = std::vector<gr_fir_ccf*>(d_nfilters); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_nfilters); - for(int i = 0; i < d_nfilters; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - } - - // Now, actually set the filters' taps - std::vector<float> dtaps; - create_diff_taps(taps, dtaps); - set_taps(taps, d_taps, d_filters); - set_taps(dtaps, d_dtaps, d_diff_filters); -} - -digital_pfb_clock_sync_ccf::~digital_pfb_clock_sync_ccf () -{ - for(int i = 0; i < d_nfilters; i++) { - delete d_filters[i]; - delete d_diff_filters[i]; - } -} - -bool -digital_pfb_clock_sync_ccf::check_topology(int ninputs, int noutputs) -{ - return noutputs == 1 || noutputs == 4; -} - - - -/******************************************************************* - SET FUNCTIONS -*******************************************************************/ - - -void -digital_pfb_clock_sync_ccf::set_loop_bandwidth(float bw) -{ - if(bw < 0) { - throw std::out_of_range ("digital_pfb_clock_sync_cc: invalid bandwidth. Must be >= 0."); - } - - d_loop_bw = bw; - update_gains(); -} - -void -digital_pfb_clock_sync_ccf::set_damping_factor(float df) -{ - if(df < 0 || df > 1.0) { - throw std::out_of_range ("digital_pfb_clock_sync_cc: invalid damping factor. Must be in [0,1]."); - } - - d_damping = df; - update_gains(); -} - -void -digital_pfb_clock_sync_ccf::set_alpha(float alpha) -{ - if(alpha < 0 || alpha > 1.0) { - throw std::out_of_range ("digital_pfb_clock_sync_cc: invalid alpha. Must be in [0,1]."); - } - d_alpha = alpha; -} - -void -digital_pfb_clock_sync_ccf::set_beta(float beta) -{ - if(beta < 0 || beta > 1.0) { - throw std::out_of_range ("digital_pfb_clock_sync_cc: invalid beta. Must be in [0,1]."); - } - d_beta = beta; -} - -/******************************************************************* - GET FUNCTIONS -*******************************************************************/ - - -float -digital_pfb_clock_sync_ccf::get_loop_bandwidth() const -{ - return d_loop_bw; -} - -float -digital_pfb_clock_sync_ccf::get_damping_factor() const -{ - return d_damping; -} - -float -digital_pfb_clock_sync_ccf::get_alpha() const -{ - return d_alpha; -} - -float -digital_pfb_clock_sync_ccf::get_beta() const -{ - return d_beta; -} - -float -digital_pfb_clock_sync_ccf::get_clock_rate() const -{ - return d_rate_f; -} - -/******************************************************************* -*******************************************************************/ - -void -digital_pfb_clock_sync_ccf::update_gains() -{ - float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw); - d_alpha = (4*d_damping*d_loop_bw) / denom; - d_beta = (4*d_loop_bw*d_loop_bw) / denom; -} - - -void -digital_pfb_clock_sync_ccf::set_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_ccf*> &ourfilter) -{ - int i,j; - - unsigned int ntaps = newtaps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilters); - - // Create d_numchan vectors to store each channel's taps - ourtaps.resize(d_nfilters); - - // Make a vector of the taps plus fill it out with 0's to fill - // each polyphase filter with exactly d_taps_per_filter - std::vector<float> tmp_taps; - tmp_taps = newtaps; - while((float)(tmp_taps.size()) < d_nfilters*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_nfilters; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - ourtaps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - ourtaps[i][j] = tmp_taps[i + j*d_nfilters]; - } - - // Build a filter for each channel and add it's taps to it - ourfilter[i]->set_taps(ourtaps[i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter + d_sps); - - // Make sure there is enough output space for d_osps outputs/input. - set_output_multiple(d_osps); - - d_updated = true; -} - -void -digital_pfb_clock_sync_ccf::create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps) -{ - std::vector<float> diff_filter(3); - diff_filter[0] = -1; - diff_filter[1] = 0; - diff_filter[2] = 1; - - float pwr = 0; - difftaps.push_back(0); - for(unsigned int i = 0; i < newtaps.size()-2; i++) { - float tap = 0; - for(int j = 0; j < 3; j++) { - tap += diff_filter[j]*newtaps[i+j]; - pwr += fabsf(tap); - } - difftaps.push_back(tap); - } - difftaps.push_back(0); - - for(unsigned int i = 0; i < difftaps.size(); i++) { - difftaps[i] *= pwr; - } -} - -std::string -digital_pfb_clock_sync_ccf::get_taps_as_string() -{ - int i, j; - std::stringstream str; - str.precision(4); - str.setf(std::ios::scientific); - - str << "[ "; - for(i = 0; i < d_nfilters; i++) { - str << "[" << d_taps[i][0] << ", "; - for(j = 1; j < d_taps_per_filter-1; j++) { - str << d_taps[i][j] << ", "; - } - str << d_taps[i][j] << "],"; - } - str << " ]" << std::endl; - - return str.str(); -} - -std::string -digital_pfb_clock_sync_ccf::get_diff_taps_as_string() -{ - int i, j; - std::stringstream str; - str.precision(4); - str.setf(std::ios::scientific); - - str << "[ "; - for(i = 0; i < d_nfilters; i++) { - str << "[" << d_dtaps[i][0] << ", "; - for(j = 1; j < d_taps_per_filter-1; j++) { - str << d_dtaps[i][j] << ", "; - } - str << d_dtaps[i][j] << "],"; - } - str << " ]" << std::endl; - - return str.str(); -} - -std::vector< std::vector<float> > -digital_pfb_clock_sync_ccf::get_taps() -{ - return d_taps; -} - -std::vector< std::vector<float> > -digital_pfb_clock_sync_ccf::get_diff_taps() -{ - return d_dtaps; -} - -std::vector<float> -digital_pfb_clock_sync_ccf::get_channel_taps(int channel) -{ - std::vector<float> taps; - for(int i = 0; i < d_taps_per_filter; i++) { - taps.push_back(d_taps[channel][i]); - } - return taps; -} - -std::vector<float> -digital_pfb_clock_sync_ccf::get_diff_channel_taps(int channel) -{ - std::vector<float> taps; - for(int i = 0; i < d_taps_per_filter; i++) { - taps.push_back(d_dtaps[channel][i]); - } - return taps; -} - - -int -digital_pfb_clock_sync_ccf::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in = (gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - float *err = NULL, *outrate = NULL, *outk = NULL; - if(output_items.size() == 4) { - err = (float *) output_items[1]; - outrate = (float*)output_items[2]; - outk = (float*)output_items[3]; - } - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - // We need this many to process one output - int nrequired = ninput_items[0] - d_taps_per_filter - d_osps; - - int i = 0, count = 0; - float error_r, error_i; - - // produce output as long as we can and there are enough input samples - while((i < noutput_items) && (count < nrequired)) { - while(d_out_idx < d_osps) { - d_filtnum = (int)floor(d_k); - - // Keep the current filter number in [0, d_nfilters] - // If we've run beyond the last filter, wrap around and go to next sample - // If we've go below 0, wrap around and go to previous sample - while(d_filtnum >= d_nfilters) { - d_k -= d_nfilters; - d_filtnum -= d_nfilters; - count += 1; - } - while(d_filtnum < 0) { - d_k += d_nfilters; - d_filtnum += d_nfilters; - count -= 1; - } - - out[i+d_out_idx] = d_filters[d_filtnum]->filter(&in[count+d_out_idx]); - d_k = d_k + d_rate_i + d_rate_f; // update phase - d_out_idx++; - - if(output_items.size() == 4) { - err[i] = d_error; - outrate[i] = d_rate_f; - outk[i] = d_k; - } - - // We've run out of output items we can create; return now. - if(i+d_out_idx >= noutput_items) { - consume_each(count); - return i; - } - } - - // reset here; if we didn't complete a full osps samples last time, - // the early return would take care of it. - d_out_idx = 0; - - // Update the phase and rate estimates for this symbol - gr_complex diff = d_diff_filters[d_filtnum]->filter(&in[count]); - error_r = out[i].real() * diff.real(); - error_i = out[i].imag() * diff.imag(); - d_error = (error_i + error_r) / 2.0; // average error from I&Q channel - - // Run the control loop to update the current phase (k) and - // tracking rate estimates based on the error value - d_rate_f = d_rate_f + d_beta*d_error; - d_k = d_k + d_alpha*d_error; - - // Keep our rate within a good range - d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev); - - i+=d_osps; - count += (int)floor(d_sps); - } - - consume_each(count); - return i; -} diff --git a/gr-digital/lib/digital_pfb_clock_sync_fff.cc b/gr-digital/lib/digital_pfb_clock_sync_fff.cc deleted file mode 100644 index 0e7d2a52d..000000000 --- a/gr-digital/lib/digital_pfb_clock_sync_fff.cc +++ /dev/null @@ -1,434 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010,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 <cstdio> -#include <cmath> - -#include <digital_pfb_clock_sync_fff.h> -#include <gr_fir_fff.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <gr_math.h> - -digital_pfb_clock_sync_fff_sptr -digital_make_pfb_clock_sync_fff(double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps) -{ - return gnuradio::get_initial_sptr(new digital_pfb_clock_sync_fff - (sps, gain, taps, - filter_size, - init_phase, - max_rate_deviation, - osps)); -} - -static int ios[] = {sizeof(float), sizeof(float), sizeof(float), sizeof(float)}; -static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); -digital_pfb_clock_sync_fff::digital_pfb_clock_sync_fff (double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps) - : gr_block ("pfb_clock_sync_fff", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signaturev (1, 4, iosig)), - d_updated (false), d_nfilters(filter_size), - d_max_dev(max_rate_deviation), - d_osps(osps), d_error(0), d_out_idx(0) -{ - d_nfilters = filter_size; - d_sps = floor(sps); - - // Set the damping factor for a critically damped system - d_damping = sqrtf(2.0f)/2.0f; - - // Set the bandwidth, which will then call update_gains() - set_loop_bandwidth(loop_bw); - - // Store the last filter between calls to work - // The accumulator keeps track of overflow to increment the stride correctly. - // set it here to the fractional difference based on the initial phaes - d_k = init_phase; - d_rate = (sps-floor(sps))*(double)d_nfilters; - d_rate_i = (int)floor(d_rate); - d_rate_f = d_rate - (float)d_rate_i; - d_filtnum = (int)floor(d_k); - - d_filters = std::vector<gr_fir_fff*>(d_nfilters); - d_diff_filters = std::vector<gr_fir_fff*>(d_nfilters); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_nfilters); - for(int i = 0; i < d_nfilters; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps); - d_diff_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps); - } - - // Now, actually set the filters' taps - std::vector<float> dtaps; - create_diff_taps(taps, dtaps); - set_taps(taps, d_taps, d_filters); - set_taps(dtaps, d_dtaps, d_diff_filters); -} - -digital_pfb_clock_sync_fff::~digital_pfb_clock_sync_fff () -{ - for(int i = 0; i < d_nfilters; i++) { - delete d_filters[i]; - delete d_diff_filters[i]; - } -} - -bool -digital_pfb_clock_sync_fff::check_topology(int ninputs, int noutputs) -{ - return noutputs == 1 || noutputs == 4; -} - -/******************************************************************* - SET FUNCTIONS -*******************************************************************/ - - -void -digital_pfb_clock_sync_fff::set_loop_bandwidth(float bw) -{ - if(bw < 0) { - throw std::out_of_range ("digital_pfb_clock_sync_fff: invalid bandwidth. Must be >= 0."); - } - - d_loop_bw = bw; - update_gains(); -} - -void -digital_pfb_clock_sync_fff::set_damping_factor(float df) -{ - if(df < 0 || df > 1.0) { - throw std::out_of_range ("digital_pfb_clock_sync_fff: invalid damping factor. Must be in [0,1]."); - } - - d_damping = df; - update_gains(); -} - -void -digital_pfb_clock_sync_fff::set_alpha(float alpha) -{ - if(alpha < 0 || alpha > 1.0) { - throw std::out_of_range ("digital_pfb_clock_sync_fff: invalid alpha. Must be in [0,1]."); - } - d_alpha = alpha; -} - -void -digital_pfb_clock_sync_fff::set_beta(float beta) -{ - if(beta < 0 || beta > 1.0) { - throw std::out_of_range ("digital_pfb_clock_sync_fff: invalid beta. Must be in [0,1]."); - } - d_beta = beta; -} - -/******************************************************************* - GET FUNCTIONS -*******************************************************************/ - - -float -digital_pfb_clock_sync_fff::get_loop_bandwidth() const -{ - return d_loop_bw; -} - -float -digital_pfb_clock_sync_fff::get_damping_factor() const -{ - return d_damping; -} - -float -digital_pfb_clock_sync_fff::get_alpha() const -{ - return d_alpha; -} - -float -digital_pfb_clock_sync_fff::get_beta() const -{ - return d_beta; -} - -float -digital_pfb_clock_sync_fff::get_clock_rate() const -{ - return d_rate_f; -} - -/******************************************************************* -*******************************************************************/ - -void -digital_pfb_clock_sync_fff::update_gains() -{ - float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw); - d_alpha = (4*d_damping*d_loop_bw) / denom; - d_beta = (4*d_loop_bw*d_loop_bw) / denom; -} - - -void -digital_pfb_clock_sync_fff::set_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_fff*> &ourfilter) -{ - int i,j; - - unsigned int ntaps = newtaps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilters); - - // Create d_numchan vectors to store each channel's taps - ourtaps.resize(d_nfilters); - - // Make a vector of the taps plus fill it out with 0's to fill - // each polyphase filter with exactly d_taps_per_filter - std::vector<float> tmp_taps; - tmp_taps = newtaps; - while((float)(tmp_taps.size()) < d_nfilters*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_nfilters; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - ourtaps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - ourtaps[i][j] = tmp_taps[i + j*d_nfilters]; - } - - // Build a filter for each channel and add it's taps to it - ourfilter[i]->set_taps(ourtaps[i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter + d_sps); - - // Make sure there is enough output space for d_osps outputs/input. - set_output_multiple(d_osps); - - d_updated = true; -} - -void -digital_pfb_clock_sync_fff::create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps) -{ - std::vector<float> diff_filter(3); - diff_filter[0] = -1; - diff_filter[1] = 0; - diff_filter[2] = 1; - - float pwr = 0; - difftaps.push_back(0); - for(unsigned int i = 0; i < newtaps.size()-2; i++) { - float tap = 0; - for(int j = 0; j < 3; j++) { - tap += diff_filter[j]*newtaps[i+j]; - pwr += fabsf(tap); - } - difftaps.push_back(tap); - } - difftaps.push_back(0); - - for(unsigned int i = 0; i < difftaps.size(); i++) { - difftaps[i] *= pwr; - } -} - -std::string -digital_pfb_clock_sync_fff::get_taps_as_string() -{ - int i, j; - std::stringstream str; - str.precision(4); - str.setf(std::ios::scientific); - - str << "[ "; - for(i = 0; i < d_nfilters; i++) { - str << "[" << d_taps[i][0] << ", "; - for(j = 1; j < d_taps_per_filter-1; j++) { - str << d_taps[i][j] << ", "; - } - str << d_taps[i][j] << "],"; - } - str << " ]" << std::endl; - - return str.str(); -} - -std::string -digital_pfb_clock_sync_fff::get_diff_taps_as_string() -{ - int i, j; - std::stringstream str; - str.precision(4); - str.setf(std::ios::scientific); - - str << "[ "; - for(i = 0; i < d_nfilters; i++) { - str << "[" << d_dtaps[i][0] << ", "; - for(j = 1; j < d_taps_per_filter-1; j++) { - str << d_dtaps[i][j] << ", "; - } - str << d_dtaps[i][j] << "],"; - } - str << " ]" << std::endl; - - return str.str(); -} - -std::vector< std::vector<float> > -digital_pfb_clock_sync_fff::get_taps() -{ - return d_taps; -} - -std::vector< std::vector<float> > -digital_pfb_clock_sync_fff::get_diff_taps() -{ - return d_dtaps; -} - -std::vector<float> -digital_pfb_clock_sync_fff::get_channel_taps(int channel) -{ - std::vector<float> taps; - for(int i = 0; i < d_taps_per_filter; i++) { - taps.push_back(d_taps[channel][i]); - } - return taps; -} - -std::vector<float> -digital_pfb_clock_sync_fff::get_diff_channel_taps(int channel) -{ - std::vector<float> taps; - for(int i = 0; i < d_taps_per_filter; i++) { - taps.push_back(d_dtaps[channel][i]); - } - return taps; -} - -int -digital_pfb_clock_sync_fff::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *in = (float *) input_items[0]; - float *out = (float *) output_items[0]; - - float *err = NULL, *outrate = NULL, *outk = NULL; - if(output_items.size() == 4) { - err = (float *) output_items[1]; - outrate = (float*)output_items[2]; - outk = (float*)output_items[3]; - } - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - // We need this many to process one output - int nrequired = ninput_items[0] - d_taps_per_filter - d_osps; - - int i = 0, count = 0; - - // produce output as long as we can and there are enough input samples - while((i < noutput_items) && (count < nrequired)) { - while(d_out_idx < d_osps) { - d_filtnum = (int)floor(d_k); - - // Keep the current filter number in [0, d_nfilters] - // If we've run beyond the last filter, wrap around and go to next sample - // If we've go below 0, wrap around and go to previous sample - while(d_filtnum >= d_nfilters) { - d_k -= d_nfilters; - d_filtnum -= d_nfilters; - count += 1; - } - while(d_filtnum < 0) { - d_k += d_nfilters; - d_filtnum += d_nfilters; - count -= 1; - } - - out[i+d_out_idx] = d_filters[d_filtnum]->filter(&in[count+d_out_idx]); - d_k = d_k + d_rate_i + d_rate_f; // update phase - d_out_idx++; - - if(output_items.size() == 4) { - err[i] = d_error; - outrate[i] = d_rate_f; - outk[i] = d_k; - } - - // We've run out of output items we can create; return now. - if(i+d_out_idx >= noutput_items) { - consume_each(count); - return i; - } - } - - // reset here; if we didn't complete a full osps samples last time, - // the early return would take care of it. - d_out_idx = 0; - - // Update the phase and rate estimates for this symbol - float diff = d_diff_filters[d_filtnum]->filter(&in[count]); - d_error = out[i] * diff; - - // Run the control loop to update the current phase (k) and - // tracking rate estimates based on the error value - d_rate_f = d_rate_f + d_beta*d_error; - d_k = d_k + d_alpha*d_error; - - // Keep our rate within a good range - d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev); - - i+=d_osps; - count += (int)floor(d_sps); - } - - consume_each(count); - return i; -} diff --git a/gr-digital/lib/digital_pn_correlator_cc.cc b/gr-digital/lib/digital_pn_correlator_cc.cc deleted file mode 100644 index 43a3ddbd1..000000000 --- a/gr-digital/lib/digital_pn_correlator_cc.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010,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 <digital_pn_correlator_cc.h> -#include <gr_io_signature.h> - -digital_pn_correlator_cc_sptr -digital_make_pn_correlator_cc(int degree, int mask, int seed) -{ - return gnuradio::get_initial_sptr(new digital_pn_correlator_cc - (degree, mask, seed)); -} - -digital_pn_correlator_cc::digital_pn_correlator_cc(int degree, - int mask, - int seed) - : gr_sync_decimator ("pn_correlator_cc", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - (unsigned int)((1ULL << degree)-1)) // PN code length -{ - d_len = (unsigned int)((1ULL << degree)-1); - if (mask == 0) - mask = gri_glfsr::glfsr_mask(degree); - d_reference = new gri_glfsr(mask, seed); - for (int i = 0; i < d_len; i++) // initialize to last value in sequence - d_pn = 2.0*d_reference->next_bit()-1.0; -} - -digital_pn_correlator_cc::~digital_pn_correlator_cc() -{ - delete d_reference; -} - -int -digital_pn_correlator_cc::work(int noutput_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]; - gr_complex sum; - - for (int i = 0; i < noutput_items; i++) { - sum = 0.0; - - for (int j = 0; j < d_len; j++) { - if (j != 0) // retard PN generator one sample per period - d_pn = 2.0*d_reference->next_bit()-1.0; // no conditionals - sum += *in++ * d_pn; - } - - *out++ = sum*gr_complex(1.0/d_len, 0.0); - } - - return noutput_items; -} diff --git a/gr-digital/lib/digital_probe_density_b.cc b/gr-digital/lib/digital_probe_density_b.cc deleted file mode 100644 index 6b83d2ddb..000000000 --- a/gr-digital/lib/digital_probe_density_b.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,2012 Free Software Foundation, Inc. - * - * 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 <digital_probe_density_b.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -digital_probe_density_b_sptr -digital_make_probe_density_b(double alpha) -{ - return gnuradio::get_initial_sptr(new digital_probe_density_b(alpha)); -} - -digital_probe_density_b::digital_probe_density_b(double alpha) - : gr_sync_block("density_b", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(0, 0, 0)) -{ - set_alpha(alpha); - d_density = 1.0; -} - -digital_probe_density_b::~digital_probe_density_b() -{ -} - -int -digital_probe_density_b::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *)input_items[0]; - - for (int i = 0; i < noutput_items; i++) - d_density = d_alpha*(double)in[i] + d_beta*d_density; - - return noutput_items; -} - -void -digital_probe_density_b::set_alpha(double alpha) -{ - d_alpha = alpha; - d_beta = 1.0-d_alpha; -} - diff --git a/gr-digital/lib/digital_probe_mpsk_snr_est_c.cc b/gr-digital/lib/digital_probe_mpsk_snr_est_c.cc deleted file mode 100644 index 5cdfea96d..000000000 --- a/gr-digital/lib/digital_probe_mpsk_snr_est_c.cc +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <digital_probe_mpsk_snr_est_c.h> -#include <gr_io_signature.h> -#include <cstdio> - -digital_probe_mpsk_snr_est_c_sptr -digital_make_probe_mpsk_snr_est_c(snr_est_type_t type, - int msg_nsamples, - double alpha) -{ - return gnuradio::get_initial_sptr( - new digital_probe_mpsk_snr_est_c(type, msg_nsamples, alpha)); -} - -digital_probe_mpsk_snr_est_c::digital_probe_mpsk_snr_est_c( - snr_est_type_t type, - int msg_nsamples, - double alpha) - : gr_sync_block ("probe_mpsk_snr_est_c", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)) -{ - d_snr_est = NULL; - - d_type = type; - d_nsamples = msg_nsamples; - d_count = 0; - set_alpha(alpha); - - set_type(type); - - // at least 1 estimator has to look back - set_history(2); - - d_key = pmt::pmt_string_to_symbol("snr"); -} - -digital_probe_mpsk_snr_est_c::~digital_probe_mpsk_snr_est_c() -{ - if(d_snr_est) - delete d_snr_est; -} - -int -digital_probe_mpsk_snr_est_c::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex*)input_items[0]; - return d_snr_est->update(noutput_items, in); -} - -double -digital_probe_mpsk_snr_est_c::snr() -{ - if(d_snr_est) - return d_snr_est->snr(); - else - throw std::runtime_error("digital_probe_mpsk_snr_est_c:: No SNR estimator defined.\n"); -} - -snr_est_type_t -digital_probe_mpsk_snr_est_c::type() const -{ - return d_type; -} - -int -digital_probe_mpsk_snr_est_c::msg_nsample() const -{ - return d_nsamples; -} - -double -digital_probe_mpsk_snr_est_c::alpha() const -{ - return d_alpha; -} - -void -digital_probe_mpsk_snr_est_c::set_type(snr_est_type_t t) -{ - d_type = t; - - if(d_snr_est) - delete d_snr_est; - - switch (d_type) { - case(SNR_EST_SIMPLE): - d_snr_est = new digital_impl_mpsk_snr_est_simple(d_alpha); - break; - case(SNR_EST_SKEW): - d_snr_est = new digital_impl_mpsk_snr_est_skew(d_alpha); - break; - case(SNR_EST_M2M4): - d_snr_est = new digital_impl_mpsk_snr_est_m2m4(d_alpha); - break; - case(SNR_EST_SVR): - d_snr_est = new digital_impl_mpsk_snr_est_svr(d_alpha); - break; - default: - throw std::invalid_argument("digital_probe_mpsk_snr_est_c: unknown type specified.\n"); - } -} - -void -digital_probe_mpsk_snr_est_c::set_msg_nsample(int n) -{ - if(n > 0) { - d_nsamples = n; - d_count = 0; // reset state - } - else - throw std::invalid_argument("digital_probe_mpsk_snr_est_c: msg_nsamples can't be <= 0\n"); -} - -void -digital_probe_mpsk_snr_est_c::set_alpha(double alpha) -{ - if((alpha >= 0) && (alpha <= 1.0)) { - d_alpha = alpha; - if(d_snr_est) - d_snr_est->set_alpha(d_alpha); - } - else - throw std::invalid_argument("digital_probe_mpsk_snr_est_c: alpha must be in [0,1]\n"); -} diff --git a/gr-digital/lib/digital_scrambler_bb.cc b/gr-digital/lib/digital_scrambler_bb.cc deleted file mode 100644 index c81b09d8c..000000000 --- a/gr-digital/lib/digital_scrambler_bb.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,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 <digital_scrambler_bb.h> -#include <gr_io_signature.h> - -digital_scrambler_bb_sptr -digital_make_scrambler_bb(int mask, int seed, int len) -{ - return gnuradio::get_initial_sptr(new digital_scrambler_bb - (mask, seed, len)); -} - -digital_scrambler_bb::digital_scrambler_bb(int mask, int seed, int len) - : gr_sync_block("scrambler_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_lfsr(mask, seed, len) -{ -} - -int -digital_scrambler_bb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) - out[i] = d_lfsr.next_bit_scramble(in[i]); - - return noutput_items; -} diff --git a/gr-digital/lib/digital_simple_correlator.cc b/gr-digital/lib/digital_simple_correlator.cc deleted file mode 100644 index 37ef2f1e5..000000000 --- a/gr-digital/lib/digital_simple_correlator.cc +++ /dev/null @@ -1,231 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2013 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 <digital_simple_correlator.h> -#include <digital_simple_framer_sync.h> -#include <gr_io_signature.h> -#include <gr_count_bits.h> -#include <assert.h> -#include <stdexcept> -#include <string.h> -#include <cstdio> - -static const int THRESHOLD = 3; - -digital_simple_correlator_sptr -digital_make_simple_correlator(int payload_bytesize) -{ - return gnuradio::get_initial_sptr - (new digital_simple_correlator(payload_bytesize)); -} - -digital_simple_correlator::digital_simple_correlator(int payload_bytesize) - : gr_block("simple_correlator", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(unsigned char))), - d_payload_bytesize(payload_bytesize), - d_state(ST_LOOKING), d_osi(0), - d_bblen((payload_bytesize + GRSF_PAYLOAD_OVERHEAD) * GRSF_BITS_PER_BYTE), - d_bitbuf(new unsigned char[d_bblen]), - d_pktbuf(new unsigned char[d_bblen/GRSF_BITS_PER_BYTE]), - d_bbi(0) -{ - d_avbi = 0; - d_accum = 0.0; - d_avg = 0.0; - for(int i = 0; i < AVG_PERIOD; i++) - d_avgbuf[i] = 0.0; - -#ifdef DEBUG_SIMPLE_CORRELATOR - d_debug_fp = fopen("corr.log", "w"); -#endif - enter_looking(); -} - -digital_simple_correlator::~digital_simple_correlator() -{ -#ifdef DEBUG_SIMPLE_CORRELATOR - fclose(d_debug_fp); -#endif - delete [] d_bitbuf; - delete [] d_pktbuf; -} - -void -digital_simple_correlator::enter_looking() -{ - fflush(stdout); - // fprintf(stderr, ">>> enter_looking\n"); - d_state = ST_LOOKING; - for(int i = 0; i < OVERSAMPLE; i++) - d_shift_reg[i] = 0; - d_osi = 0; - - d_avbi = 0; - d_avg = d_avg * 0.5; - d_accum = 0; - for(int i = 0; i < AVG_PERIOD; i++) - d_avgbuf[i] = 0.0; -} - -void -digital_simple_correlator::enter_under_threshold() -{ - fflush(stdout); - // fprintf(stderr, ">>> enter_under_threshold\n"); - d_state = ST_UNDER_THRESHOLD; - d_transition_osi = d_osi; -} - -void -digital_simple_correlator::enter_locked() -{ - d_state = ST_LOCKED; - int delta = sub_index(d_osi, d_transition_osi); - d_center_osi = add_index(d_transition_osi, delta/2); - //d_center_osi = add_index(d_center_osi, 3); // FIXME - d_bbi = 0; - fflush(stdout); - // fprintf(stderr, ">>> enter_locked d_center_osi = %d\n", d_center_osi); - - d_avg = std::max(-1.0, std::min(1.0, d_accum * (1.0/AVG_PERIOD))); - // fprintf(stderr, ">>> enter_locked d_avg = %g\n", d_avg); -} - -static void -packit(unsigned char *pktbuf, const unsigned char *bitbuf, int bitcount) -{ - for(int i = 0; i < bitcount; i += 8) { - int t = bitbuf[i+0] & 0x1; - t = (t << 1) | (bitbuf[i+1] & 0x1); - t = (t << 1) | (bitbuf[i+2] & 0x1); - t = (t << 1) | (bitbuf[i+3] & 0x1); - t = (t << 1) | (bitbuf[i+4] & 0x1); - t = (t << 1) | (bitbuf[i+5] & 0x1); - t = (t << 1) | (bitbuf[i+6] & 0x1); - t = (t << 1) | (bitbuf[i+7] & 0x1); - *pktbuf++ = t; - } -} - -void -digital_simple_correlator::update_avg(float x) -{ - d_accum -= d_avgbuf[d_avbi]; - d_avgbuf[d_avbi] = x; - d_accum += x; - d_avbi = (d_avbi + 1) & (AVG_PERIOD-1); -} - -int -digital_simple_correlator::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float*)input_items[0]; - unsigned char *out = (unsigned char*)output_items[0]; - - int n = 0; - int nin = ninput_items[0]; - int decision; - int hamming_dist; - -#ifdef DEBUG_SIMPLE_CORRELATOR - struct debug_data { - float raw_data; - float sampled; - float enter_locked; - } debug_data; -#endif - - while(n < nin) { - -#ifdef DEBUG_SIMPLE_CORRELATOR - debug_data.raw_data = in[n]; - debug_data.sampled = 0.0; - debug_data.enter_locked = 0.0; -#endif - - switch(d_state) { - case ST_LOCKED: - if(d_osi == d_center_osi) { - -#ifdef DEBUG_SIMPLE_CORRELATOR - debug_data.sampled = 1.0; -#endif - decision = slice(in[n]); - - d_bitbuf[d_bbi] = decision; - d_bbi++; - if(d_bbi >= d_bblen) { - // printf("got whole packet\n"); - packit(d_pktbuf, d_bitbuf, d_bbi); - //printf("seqno %3d\n", d_pktbuf[0]); - memcpy(out, &d_pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize); - enter_looking(); - consume_each(n + 1); - return d_payload_bytesize; - } - } - break; - - case ST_LOOKING: - case ST_UNDER_THRESHOLD: - update_avg(in[n]); - decision = slice(in[n]); - - d_shift_reg[d_osi] = (d_shift_reg[d_osi] << 1) | decision; - hamming_dist = gr_count_bits64(d_shift_reg[d_osi] ^ GRSF_SYNC); - //fprintf(stderr, "%2d %d\n", hamming_dist, d_osi); - - if(d_state == ST_LOOKING && hamming_dist <= THRESHOLD) { - // We're seeing a good PN code, remember location - enter_under_threshold(); - } - else if(d_state == ST_UNDER_THRESHOLD && hamming_dist > THRESHOLD) { - // no longer seeing good PN code, compute center of goodness - enter_locked(); -#ifdef DEBUG_SIMPLE_CORRELATOR - debug_data.enter_locked = 1.0; -#endif - } - break; - default: - assert(0); - } - -#ifdef DEBUG_SIMPLE_CORRELATOR - fwrite(&debug_data, sizeof(debug_data), 1, d_debug_fp); -#endif - - d_osi = add_index(d_osi, 1); - n++; - } - - consume_each(n); - return 0; -} diff --git a/gr-digital/lib/digital_simple_framer.cc b/gr-digital/lib/digital_simple_framer.cc deleted file mode 100644 index 5c194543c..000000000 --- a/gr-digital/lib/digital_simple_framer.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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 <digital_simple_framer.h> -#include <digital_simple_framer_sync.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <string.h> - - -digital_simple_framer_sptr -digital_make_simple_framer (int payload_bytesize) -{ - return gnuradio::get_initial_sptr(new digital_simple_framer - (payload_bytesize)); -} - -digital_simple_framer::digital_simple_framer (int payload_bytesize) - : gr_block ("simple_framer", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_seqno (0), d_payload_bytesize (payload_bytesize), - d_input_block_size (payload_bytesize), - d_output_block_size (payload_bytesize + GRSF_OVERHEAD) -{ - set_output_multiple (d_output_block_size); -} - -void -digital_simple_framer::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_output_block_size == 0); - - int nblocks = noutput_items / d_output_block_size; - int input_required = nblocks * d_input_block_size; - - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = input_required; -} - -int -digital_simple_framer::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - int n = 0; - int nblocks = 0; - - memset (out, 0x55, noutput_items); - - while (n < noutput_items) { - out[0] = (GRSF_SYNC >> 56) & 0xff; - out[1] = (GRSF_SYNC >> 48) & 0xff; - out[2] = (GRSF_SYNC >> 40) & 0xff; - out[3] = (GRSF_SYNC >> 32) & 0xff; - out[4] = (GRSF_SYNC >> 24) & 0xff; - out[5] = (GRSF_SYNC >> 16) & 0xff; - out[6] = (GRSF_SYNC >> 8) & 0xff; - out[7] = (GRSF_SYNC >> 0) & 0xff; - out[8] = d_seqno++; - - memcpy (&out[9], in, d_input_block_size); - in += d_input_block_size; - out += d_output_block_size; - n += d_output_block_size; - nblocks++; - } - - assert (n == noutput_items); - - consume_each (nblocks * d_input_block_size); - return n; -} diff --git a/gr-digital/python/CMakeLists.txt b/gr-digital/python/CMakeLists.txt deleted file mode 100644 index 8f2af0664..000000000 --- a/gr-digital/python/CMakeLists.txt +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 2011-212 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. - -######################################################################## -# Setup python install -######################################################################## -include(GrPython) - -GR_PYTHON_INSTALL( - FILES - __init__.py - bpsk.py - cpm.py - crc.py - generic_mod_demod.py - gmsk.py - gfsk.py - modulation_utils.py - ofdm.py - ofdm_packet_utils.py - ofdm_receiver.py - ofdm_sync_fixed.py - ofdm_sync_ml.py - ofdm_sync_pnac.py - ofdm_sync_pn.py - packet_utils.py - pkt.py - psk.py - qam.py - qpsk.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/digital - COMPONENT "digital_python" -) - -GR_PYTHON_INSTALL( - FILES - utils/__init__.py - utils/gray_code.py - utils/mod_codes.py - utils/alignment.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/digital/utils - COMPONENT "digital_python" -) - -######################################################################## -# Handle the unit tests -######################################################################## -if(ENABLE_TESTING) - -list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-digital/python - ${CMAKE_BINARY_DIR}/gr-digital/swig -) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-digital gnuradio-filter gnuradio-fft) - -include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) -endif(ENABLE_TESTING) diff --git a/gr-digital/python/__init__.py b/gr-digital/python/__init__.py deleted file mode 100644 index 3fdbca769..000000000 --- a/gr-digital/python/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2011 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 is the gr-digital package. It contains all of the blocks, -utilities, and examples for doing digital modulation and demodulation. -''' - -# The presence of this file turns this directory into a Python package - -from digital_swig import * -from psk import * -from qam import * -from bpsk import * -from qpsk import * -from gmsk import * -from gfsk import * -from cpm import * -from pkt import * -from crc import * -from modulation_utils import * -from ofdm import * -from ofdm_receiver import * -from ofdm_sync_fixed import * -from ofdm_sync_ml import * -from ofdm_sync_pnac import * -from ofdm_sync_pn import * - -import packet_utils -import ofdm_packet_utils diff --git a/gr-digital/python/bpsk.py b/gr-digital/python/bpsk.py deleted file mode 100644 index 0d8f05c4c..000000000 --- a/gr-digital/python/bpsk.py +++ /dev/null @@ -1,171 +0,0 @@ -# -# Copyright 2005,2006,2011 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. -# - -""" -BPSK modulation and demodulation. -""" - -from math import pi, log -from cmath import exp - -from gnuradio import gr -from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod -import digital_swig -import modulation_utils - -# Default number of points in constellation. -_def_constellation_points = 2 -# Whether differential coding is used. -_def_differential = False - -# ///////////////////////////////////////////////////////////////////////////// -# BPSK constellation -# ///////////////////////////////////////////////////////////////////////////// - -def bpsk_constellation(m=_def_constellation_points): - if m != _def_constellation_points: - raise ValueError("BPSK can only have 2 constellation points.") - return digital_swig.constellation_bpsk() - -# ///////////////////////////////////////////////////////////////////////////// -# BPSK modulator -# ///////////////////////////////////////////////////////////////////////////// - -class bpsk_mod(generic_mod): - - def __init__(self, constellation_points=_def_constellation_points, - differential=False, *args, **kwargs): - - """ - Hierarchical block for RRC-filtered BPSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_mod block for list of parameters. - """ - - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_bpsk() - if constellation_points != 2: - raise ValueError('Number of constellation points must be 2 for BPSK.') - super(bpsk_mod, self).__init__(constellation=constellation, - differential=differential, *args, **kwargs) - -# ///////////////////////////////////////////////////////////////////////////// -# BPSK demodulator -# -# ///////////////////////////////////////////////////////////////////////////// - -class bpsk_demod(generic_demod): - - def __init__(self, constellation_points=_def_constellation_points, - differential=False, *args, **kwargs): - - """ - Hierarchical block for RRC-filtered BPSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_demod block for list of parameters. - """ - - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_bpsk() - if constellation_points != 2: - raise ValueError('Number of constellation points must be 2 for BPSK.') - super(bpsk_demod, self).__init__(constellation=constellation, - differential=differential, *args, **kwargs) - - - -# ///////////////////////////////////////////////////////////////////////////// -# DBPSK constellation -# ///////////////////////////////////////////////////////////////////////////// - -def dbpsk_constellation(m=_def_constellation_points): - if m != _def_constellation_points: - raise ValueError("DBPSK can only have 2 constellation points.") - return digital_swig.constellation_dbpsk() - -# ///////////////////////////////////////////////////////////////////////////// -# DBPSK modulator -# ///////////////////////////////////////////////////////////////////////////// - -class dbpsk_mod(generic_mod): - - def __init__(self, constellation_points=_def_constellation_points, - differential=True, *args, **kwargs): - - """ - Hierarchical block for RRC-filtered DBPSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_mod block for list of parameters. - """ - - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_bpsk() - if constellation_points != 2: - raise ValueError('Number of constellation points must be 2 for DBPSK.') - super(dbpsk_mod, self).__init__(constellation=constellation, - differential=True, - *args, **kwargs) - -# ///////////////////////////////////////////////////////////////////////////// -# DBPSK demodulator -# -# ///////////////////////////////////////////////////////////////////////////// - -class dbpsk_demod(generic_demod): - - def __init__(self, constellation_points=_def_constellation_points, - differential=True, *args, **kwargs): - - """ - Hierarchical block for RRC-filtered DBPSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_demod block for list of parameters. - """ - - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_bpsk() - if constellation_points != 2: - raise ValueError('Number of constellation points must be 2 for DBPSK.') - super(dbpsk_demod, self).__init__(constellation=constellation, - differential=True, - *args, **kwargs) - -# -# Add these to the mod/demod registry -# -modulation_utils.add_type_1_mod('bpsk', bpsk_mod) -modulation_utils.add_type_1_demod('bpsk', bpsk_demod) -modulation_utils.add_type_1_constellation('bpsk', bpsk_constellation) -modulation_utils.add_type_1_mod('dbpsk', dbpsk_mod) -modulation_utils.add_type_1_demod('dbpsk', dbpsk_demod) -modulation_utils.add_type_1_constellation('dbpsk', dbpsk_constellation) diff --git a/gr-digital/python/cpm.py b/gr-digital/python/cpm.py deleted file mode 100644 index 05032336d..000000000 --- a/gr-digital/python/cpm.py +++ /dev/null @@ -1,247 +0,0 @@ -# -# CPM modulation and demodulation. -# -# -# Copyright 2005-2007,2011 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. -# - -# See gnuradio-examples/python/digital for examples - -from gnuradio import gr, blks2 -from math import pi -import numpy - -import digital_swig -import modulation_utils - -# default values (used in __init__ and add_options) -_def_samples_per_symbol = 2 -_def_bits_per_symbol = 1 -_def_h_numerator = 1 -_def_h_denominator = 2 -_def_cpm_type = 0 # 0=CPFSK, 1=GMSK, 2=RC, 3=GENERAL -_def_bt = 0.35 -_def_symbols_per_pulse = 1 -_def_generic_taps = numpy.empty(1) -_def_verbose = False -_def_log = False - - -# ///////////////////////////////////////////////////////////////////////////// -# CPM modulator -# ///////////////////////////////////////////////////////////////////////////// - -class cpm_mod(gr.hier_block2): - def __init__(self, - samples_per_symbol=_def_samples_per_symbol, - bits_per_symbol=_def_bits_per_symbol, - h_numerator=_def_h_numerator, - h_denominator=_def_h_denominator, - cpm_type=_def_cpm_type, - bt=_def_bt, - symbols_per_pulse=_def_symbols_per_pulse, - generic_taps=_def_generic_taps, - verbose=_def_verbose, - log=_def_log): - """ - Hierarchical block for Continuous Phase - modulation. - - The input is a byte stream (unsigned char) - representing packed bits and the - output is the complex modulated signal at baseband. - - See Proakis for definition of generic CPM signals: - s(t)=exp(j phi(t)) - phi(t)= 2 pi h int_0^t f(t') dt' - f(t)=sum_k a_k g(t-kT) - (normalizing assumption: int_0^infty g(t) dt = 1/2) - - @param samples_per_symbol: samples per baud >= 2 - @type samples_per_symbol: integer - @param bits_per_symbol: bits per symbol - @type bits_per_symbol: integer - @param h_numerator: numerator of modulation index - @type h_numerator: integer - @param h_denominator: denominator of modulation index (numerator and denominator must be relative primes) - @type h_denominator: integer - @param cpm_type: supported types are: 0=CPFSK, 1=GMSK, 2=RC, 3=GENERAL - @type cpm_type: integer - @param bt: bandwidth symbol time product for GMSK - @type bt: float - @param symbols_per_pulse: shaping pulse duration in symbols - @type symbols_per_pulse: integer - @param generic_taps: define a generic CPM pulse shape (sum = samples_per_symbol/2) - @type generic_taps: array of floats - - @param verbose: Print information about modulator? - @type verbose: bool - @param debug: Print modulation data to files? - @type debug: bool - """ - - gr.hier_block2.__init__(self, "cpm_mod", - gr.io_signature(1, 1, gr.sizeof_char), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - self._samples_per_symbol = samples_per_symbol - self._bits_per_symbol = bits_per_symbol - self._h_numerator = h_numerator - self._h_denominator = h_denominator - self._cpm_type = cpm_type - self._bt=bt - if cpm_type == 0 or cpm_type == 2 or cpm_type == 3: # CPFSK, RC, Generic - self._symbols_per_pulse = symbols_per_pulse - elif cpm_type == 1: # GMSK - self._symbols_per_pulse = 4 - else: - raise TypeError, ("cpm_type must be an integer in {0,1,2,3}, is %r" % (cpm_type,)) - - self._generic_taps=numpy.array(generic_taps) - - if samples_per_symbol < 2: - raise TypeError, ("samples_per_symbol must be >= 2, is %r" % (samples_per_symbol,)) - - self.nsymbols = 2**bits_per_symbol - self.sym_alphabet = numpy.arange(-(self.nsymbols-1),self.nsymbols,2).tolist() - - - self.ntaps = int(self._symbols_per_pulse * samples_per_symbol) - sensitivity = 2 * pi * h_numerator / h_denominator / samples_per_symbol - - # Unpack Bytes into bits_per_symbol groups - self.B2s = gr.packed_to_unpacked_bb(bits_per_symbol,gr.GR_MSB_FIRST) - - - # Turn it into symmetric PAM data. - self.pam = gr.chunks_to_symbols_bf(self.sym_alphabet,1) - - # Generate pulse (sum of taps = samples_per_symbol/2) - if cpm_type == 0: # CPFSK - self.taps= (1.0/self._symbols_per_pulse/2,) * self.ntaps - elif cpm_type == 1: # GMSK - gaussian_taps = gr.firdes.gaussian( - 1.0/2, # gain - samples_per_symbol, # symbol_rate - bt, # bandwidth * symbol time - self.ntaps # number of taps - ) - sqwave = (1,) * samples_per_symbol # rectangular window - self.taps = numpy.convolve(numpy.array(gaussian_taps),numpy.array(sqwave)) - elif cpm_type == 2: # Raised Cosine - # generalize it for arbitrary roll-off factor - self.taps = (1-numpy.cos(2*pi*numpy.arange(0,self.ntaps)/samples_per_symbol/self._symbols_per_pulse))/(2*self._symbols_per_pulse) - elif cpm_type == 3: # Generic CPM - self.taps = generic_taps - else: - raise TypeError, ("cpm_type must be an integer in {0,1,2,3}, is %r" % (cpm_type,)) - - self.filter = blks2.pfb_arb_resampler_fff(samples_per_symbol, self.taps) - - # FM modulation - self.fmmod = gr.frequency_modulator_fc(sensitivity) - - if verbose: - self._print_verbage() - - if log: - self._setup_logging() - - # Connect - self.connect(self, self.B2s, self.pam, self.filter, self.fmmod, self) - - def samples_per_symbol(self): - return self._samples_per_symbol - - def bits_per_symbol(self): - return self._bits_per_symbol - - def h_numerator(self): - return self._h_numerator - - def h_denominator(self): - return self._h_denominator - - def cpm_type(self): - return self._cpm_type - - def bt(self): - return self._bt - - def symbols_per_pulse(self): - return self._symbols_per_pulse - - - def _print_verbage(self): - print "Samples per symbol = %d" % self._samples_per_symbol - print "Bits per symbol = %d" % self._bits_per_symbol - print "h = " , self._h_numerator , " / " , self._h_denominator - print "Symbol alphabet = " , self.sym_alphabet - print "Symbols per pulse = %d" % self._symbols_per_pulse - print "taps = " , self.taps - - print "CPM type = %d" % self._cpm_type - if self._cpm_type == 1: - print "Gaussian filter BT = %.2f" % self._bt - - - def _setup_logging(self): - print "Modulation logging turned on." - self.connect(self.B2s, - gr.file_sink(gr.sizeof_float, "symbols.dat")) - self.connect(self.pam, - gr.file_sink(gr.sizeof_float, "pam.dat")) - self.connect(self.filter, - gr.file_sink(gr.sizeof_float, "filter.dat")) - self.connect(self.fmmod, - gr.file_sink(gr.sizeof_gr_complex, "fmmod.dat")) - - - def add_options(parser): - """ - Adds CPM modulation-specific options to the standard parser - """ - parser.add_option("", "--bt", type="float", default=_def_bt, - help="set bandwidth-time product [default=%default] (GMSK)") - add_options=staticmethod(add_options) - - - def extract_kwargs_from_options(options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - return modulation_utils.extract_kwargs_from_options(cpm_mod.__init__, - ('self',), options) - extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) - - - -# ///////////////////////////////////////////////////////////////////////////// -# CPM demodulator -# ///////////////////////////////////////////////////////////////////////////// -# -# Not yet implemented -# - -# -# Add these to the mod/demod registry -# -modulation_utils.add_type_1_mod('cpm', cpm_mod) -#modulation_utils.add_type_1_demod('cpm', cpm_demod) diff --git a/gr-digital/python/crc.py b/gr-digital/python/crc.py deleted file mode 100644 index 198ab059f..000000000 --- a/gr-digital/python/crc.py +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright 2005,2007,2011 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. -# - -from gnuradio import gru -import digital_swig -import struct - -def gen_and_append_crc32(s): - crc = digital_swig.crc32(s) - return s + struct.pack(">I", gru.hexint(crc) & 0xFFFFFFFF) - -def check_crc32(s): - if len(s) < 4: - return (False, '') - msg = s[:-4] - #print "msg = '%s'" % (msg,) - actual = digital_swig.crc32(msg) - (expected,) = struct.unpack(">I", s[-4:]) - # print "actual =", hex(actual), "expected =", hex(expected) - return (actual == expected, msg) diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py deleted file mode 100644 index a6c4f3445..000000000 --- a/gr-digital/python/generic_mod_demod.py +++ /dev/null @@ -1,387 +0,0 @@ -# -# Copyright 2005,2006,2007,2009,2011 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. -# - -# See gnuradio-examples/python/digital for examples - -""" -Generic modulation and demodulation. -""" - -from gnuradio import gr -from modulation_utils import extract_kwargs_from_options_for_class -from utils import mod_codes -import digital_swig as digital -import math - -# default values (used in __init__ and add_options) -_def_samples_per_symbol = 2 -_def_excess_bw = 0.35 -_def_verbose = False -_def_log = False - -# Frequency correction -_def_freq_bw = 2*math.pi/100.0 -# Symbol timing recovery -_def_timing_bw = 2*math.pi/100.0 -_def_timing_max_dev = 1.5 -# Fine frequency / Phase correction -_def_phase_bw = 2*math.pi/100.0 -# Number of points in constellation -_def_constellation_points = 16 -# Whether differential coding is used. -_def_differential = False - -def add_common_options(parser): - """ - Sets options common to both modulator and demodulator. - """ - parser.add_option("-p", "--constellation-points", type="int", default=_def_constellation_points, - help="set the number of constellation points (must be a power of 2 for psk, power of 4 for QAM) [default=%default]") - parser.add_option("", "--non-differential", action="store_false", - dest="differential", - help="do not use differential encoding [default=False]") - parser.add_option("", "--differential", action="store_true", - dest="differential", default=True, - help="use differential encoding [default=%default]") - parser.add_option("", "--mod-code", type="choice", choices=mod_codes.codes, - default=mod_codes.NO_CODE, - help="Select modulation code from: %s [default=%%default]" - % (', '.join(mod_codes.codes),)) - parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, - help="set RRC excess bandwith factor [default=%default]") - - -# ///////////////////////////////////////////////////////////////////////////// -# Generic modulator -# ///////////////////////////////////////////////////////////////////////////// - -class generic_mod(gr.hier_block2): - - def __init__(self, constellation, - samples_per_symbol=_def_samples_per_symbol, - differential=_def_differential, - excess_bw=_def_excess_bw, - gray_coded=True, - verbose=_def_verbose, - log=_def_log): - """ - Hierarchical block for RRC-filtered differential generic modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - @param constellation: determines the modulation type - @type constellation: gnuradio.digital.gr_constellation - @param samples_per_symbol: samples per baud >= 2 - @type samples_per_symbol: float - @param excess_bw: Root-raised cosine filter excess bandwidth - @type excess_bw: float - @param gray_coded: turn gray coding on/off - @type gray_coded: bool - @param verbose: Print information about modulator? - @type verbose: bool - @param log: Log modulation data to files? - @type log: bool - """ - - gr.hier_block2.__init__(self, "generic_mod", - gr.io_signature(1, 1, gr.sizeof_char), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - self._constellation = constellation.base() - self._samples_per_symbol = samples_per_symbol - self._excess_bw = excess_bw - self._differential = differential - - if self._samples_per_symbol < 2: - raise TypeError, ("sbp must be >= 2, is %f" % self._samples_per_symbol) - - arity = pow(2,self.bits_per_symbol()) - - # turn bytes into k-bit vectors - self.bytes2chunks = \ - gr.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST) - - if gray_coded == True: - self.symbol_mapper = digital.map_bb(self._constellation.pre_diff_code()) - - if differential: - self.diffenc = digital.diff_encoder_bb(arity) - - self.chunks2symbols = digital.chunks_to_symbols_bc(self._constellation.points()) - - # pulse shaping filter - nfilts = 32 - ntaps = nfilts * 11 * int(self._samples_per_symbol) # make nfilts filters of ntaps each - self.rrc_taps = gr.firdes.root_raised_cosine( - nfilts, # gain - nfilts, # sampling rate based on 32 filters in resampler - 1.0, # symbol rate - self._excess_bw, # excess bandwidth (roll-off factor) - ntaps) - self.rrc_filter = gr.pfb_arb_resampler_ccf(self._samples_per_symbol, - self.rrc_taps) - - # Connect - blocks = [self, self.bytes2chunks] - if gray_coded == True: - blocks.append(self.symbol_mapper) - if differential: - blocks.append(self.diffenc) - blocks += [self.chunks2symbols, self.rrc_filter, self] - self.connect(*blocks) - - if verbose: - self._print_verbage() - - if log: - self._setup_logging() - - - def samples_per_symbol(self): - return self._samples_per_symbol - - def bits_per_symbol(self): # static method that's also callable on an instance - return self._constellation.bits_per_symbol() - - def add_options(parser): - """ - Adds generic modulation options to the standard parser - """ - add_common_options(parser) - add_options=staticmethod(add_options) - - def extract_kwargs_from_options(cls, options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - return extract_kwargs_from_options_for_class(cls, options) - extract_kwargs_from_options=classmethod(extract_kwargs_from_options) - - - def _print_verbage(self): - print "\nModulator:" - print "bits per symbol: %d" % self.bits_per_symbol() - print "RRC roll-off factor: %.2f" % self._excess_bw - - def _setup_logging(self): - print "Modulation logging turned on." - self.connect(self.bytes2chunks, - gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.8b")) - if self._constellation.apply_pre_diff_code(): - self.connect(self.symbol_mapper, - gr.file_sink(gr.sizeof_char, "tx_symbol_mapper.8b")) - if self._differential: - self.connect(self.diffenc, - gr.file_sink(gr.sizeof_char, "tx_diffenc.8b")) - self.connect(self.chunks2symbols, - gr.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.32fc")) - self.connect(self.rrc_filter, - gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.32fc")) - - -# ///////////////////////////////////////////////////////////////////////////// -# Generic demodulator -# -# Differentially coherent detection of differentially encoded generically -# modulated signal. -# ///////////////////////////////////////////////////////////////////////////// - -class generic_demod(gr.hier_block2): - - def __init__(self, constellation, - samples_per_symbol=_def_samples_per_symbol, - differential=_def_differential, - excess_bw=_def_excess_bw, - gray_coded=True, - freq_bw=_def_freq_bw, - timing_bw=_def_timing_bw, - phase_bw=_def_phase_bw, - verbose=_def_verbose, - log=_def_log): - """ - Hierarchical block for RRC-filtered differential generic demodulation. - - The input is the complex modulated signal at baseband. - The output is a stream of bits packed 1 bit per byte (LSB) - - @param constellation: determines the modulation type - @type constellation: gnuradio.digital.gr_constellation - @param samples_per_symbol: samples per symbol >= 2 - @type samples_per_symbol: float - @param excess_bw: Root-raised cosine filter excess bandwidth - @type excess_bw: float - @param gray_coded: turn gray coding on/off - @type gray_coded: bool - @param freq_bw: loop filter lock-in bandwidth - @type freq_bw: float - @param timing_bw: timing recovery loop lock-in bandwidth - @type timing_bw: float - @param phase_bw: phase recovery loop bandwidth - @type phase_bw: float - @param verbose: Print information about modulator? - @type verbose: bool - @param debug: Print modualtion data to files? - @type debug: bool - """ - - gr.hier_block2.__init__(self, "generic_demod", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_char)) # Output signature - - self._constellation = constellation.base() - self._samples_per_symbol = samples_per_symbol - self._excess_bw = excess_bw - self._phase_bw = phase_bw - self._freq_bw = freq_bw - self._timing_bw = timing_bw - self._timing_max_dev= _def_timing_max_dev - self._differential = differential - - if self._samples_per_symbol < 2: - raise TypeError, ("sbp must be >= 2, is %d" % self._samples_per_symbol) - - arity = pow(2,self.bits_per_symbol()) - - nfilts = 32 - ntaps = 11 * int(self._samples_per_symbol*nfilts) - - # Automatic gain control - self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100) - - # Frequency correction - fll_ntaps = 55 - self.freq_recov = digital.fll_band_edge_cc(self._samples_per_symbol, self._excess_bw, - fll_ntaps, self._freq_bw) - - # symbol timing recovery with RRC data filter - taps = gr.firdes.root_raised_cosine(nfilts, nfilts*self._samples_per_symbol, - 1.0, self._excess_bw, ntaps) - self.time_recov = digital.pfb_clock_sync_ccf(self._samples_per_symbol, - self._timing_bw, taps, - nfilts, nfilts//2, self._timing_max_dev) - - fmin = -0.25 - fmax = 0.25 - self.receiver = digital.constellation_receiver_cb( - self._constellation, self._phase_bw, - fmin, fmax) - - # Do differential decoding based on phase change of symbols - if differential: - self.diffdec = digital.diff_decoder_bb(arity) - - if gray_coded: - self.symbol_mapper = digital.map_bb( - mod_codes.invert_code(self._constellation.pre_diff_code())) - - # unpack the k bit vector into a stream of bits - self.unpack = gr.unpack_k_bits_bb(self.bits_per_symbol()) - - if verbose: - self._print_verbage() - - if log: - self._setup_logging() - - # Connect and Initialize base class - blocks = [self, self.agc, self.freq_recov, - self.time_recov, self.receiver] - if differential: - blocks.append(self.diffdec) - if self._constellation.apply_pre_diff_code(): - blocks.append(self.symbol_mapper) - blocks += [self.unpack, self] - self.connect(*blocks) - - def samples_per_symbol(self): - return self._samples_per_symbol - - def bits_per_symbol(self): # staticmethod that's also callable on an instance - return self._constellation.bits_per_symbol() - - def _print_verbage(self): - print "\nDemodulator:" - print "bits per symbol: %d" % self.bits_per_symbol() - print "RRC roll-off factor: %.2f" % self._excess_bw - print "FLL bandwidth: %.2e" % self._freq_bw - print "Timing bandwidth: %.2e" % self._timing_bw - print "Phase bandwidth: %.2e" % self._phase_bw - - def _setup_logging(self): - print "Modulation logging turned on." - self.connect(self.agc, - gr.file_sink(gr.sizeof_gr_complex, "rx_agc.32fc")) - self.connect((self.freq_recov, 0), - gr.file_sink(gr.sizeof_gr_complex, "rx_freq_recov.32fc")) - self.connect((self.freq_recov, 1), - gr.file_sink(gr.sizeof_float, "rx_freq_recov_freq.32f")) - self.connect((self.freq_recov, 2), - gr.file_sink(gr.sizeof_float, "rx_freq_recov_phase.32f")) - self.connect((self.freq_recov, 3), - gr.file_sink(gr.sizeof_float, "rx_freq_recov_error.32f")) - self.connect((self.time_recov, 0), - gr.file_sink(gr.sizeof_gr_complex, "rx_time_recov.32fc")) - self.connect((self.time_recov, 1), - gr.file_sink(gr.sizeof_float, "rx_time_recov_error.32f")) - self.connect((self.time_recov, 2), - gr.file_sink(gr.sizeof_float, "rx_time_recov_rate.32f")) - self.connect((self.time_recov, 3), - gr.file_sink(gr.sizeof_float, "rx_time_recov_phase.32f")) - self.connect((self.receiver, 0), - gr.file_sink(gr.sizeof_char, "rx_receiver.8b")) - self.connect((self.receiver, 1), - gr.file_sink(gr.sizeof_float, "rx_receiver_error.32f")) - self.connect((self.receiver, 2), - gr.file_sink(gr.sizeof_float, "rx_receiver_phase.32f")) - self.connect((self.receiver, 3), - gr.file_sink(gr.sizeof_float, "rx_receiver_freq.32f")) - if self._differential: - self.connect(self.diffdec, - gr.file_sink(gr.sizeof_char, "rx_diffdec.8b")) - if self._constellation.apply_pre_diff_code(): - self.connect(self.symbol_mapper, - gr.file_sink(gr.sizeof_char, "rx_symbol_mapper.8b")) - self.connect(self.unpack, - gr.file_sink(gr.sizeof_char, "rx_unpack.8b")) - - def add_options(parser): - """ - Adds generic demodulation options to the standard parser - """ - # Add options shared with modulator. - add_common_options(parser) - # Add options specific to demodulator. - parser.add_option("", "--freq-bw", type="float", default=_def_freq_bw, - help="set frequency lock loop lock-in bandwidth [default=%default]") - parser.add_option("", "--phase-bw", type="float", default=_def_phase_bw, - help="set phase tracking loop lock-in bandwidth [default=%default]") - parser.add_option("", "--timing-bw", type="float", default=_def_timing_bw, - help="set timing symbol sync loop gain lock-in bandwidth [default=%default]") - add_options=staticmethod(add_options) - - def extract_kwargs_from_options(cls, options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - return extract_kwargs_from_options_for_class(cls, options) - extract_kwargs_from_options=classmethod(extract_kwargs_from_options) - diff --git a/gr-digital/python/gfsk.py b/gr-digital/python/gfsk.py deleted file mode 100644 index c85fdf0e0..000000000 --- a/gr-digital/python/gfsk.py +++ /dev/null @@ -1,306 +0,0 @@ -# -# GFSK modulation and demodulation. -# -# -# Copyright 2005,2006,2007 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. -# - -# See gnuradio-examples/python/digital for examples - -from gnuradio import gr -import modulation_utils -import digital_swig as digital -from math import pi -import numpy -from pprint import pprint -import inspect - -# default values (used in __init__ and add_options) -_def_samples_per_symbol = 2 -_def_sensitivity = 1 -_def_bt = 0.35 -_def_verbose = False -_def_log = False - -_def_gain_mu = None -_def_mu = 0.5 -_def_freq_error = 0.0 -_def_omega_relative_limit = 0.005 - - -# FIXME: Figure out how to make GFSK work with pfb_arb_resampler_fff for both -# transmit and receive so we don't require integer samples per symbol. - - -# ///////////////////////////////////////////////////////////////////////////// -# GFSK modulator -# ///////////////////////////////////////////////////////////////////////////// - -class gfsk_mod(gr.hier_block2): - - def __init__(self, - samples_per_symbol=_def_samples_per_symbol, - sensitivity=_def_sensitivity, - bt=_def_bt, - verbose=_def_verbose, - log=_def_log): - """ - Hierarchical block for Gaussian Frequency Shift Key (GFSK) - modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - @param samples_per_symbol: samples per baud >= 2 - @type samples_per_symbol: integer - @param bt: Gaussian filter bandwidth * symbol time - @type bt: float - @param verbose: Print information about modulator? - @type verbose: bool - @param debug: Print modualtion data to files? - @type debug: bool - """ - - gr.hier_block2.__init__(self, "gfsk_mod", - gr.io_signature(1, 1, gr.sizeof_char), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - samples_per_symbol = int(samples_per_symbol) - self._samples_per_symbol = samples_per_symbol - self._bt = bt - self._differential = False - - if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2: - raise TypeError, ("samples_per_symbol must be an integer >= 2, is %r" % (samples_per_symbol,)) - - ntaps = 4 * samples_per_symbol # up to 3 bits in filter at once - #sensitivity = (pi / 2) / samples_per_symbol # phase change per bit = pi / 2 - - # Turn it into NRZ data. - self.nrz = gr.bytes_to_syms() - - # Form Gaussian filter - # Generate Gaussian response (Needs to be convolved with window below). - self.gaussian_taps = gr.firdes.gaussian( - 1.0, # gain - samples_per_symbol, # symbol_rate - bt, # bandwidth * symbol time - ntaps # number of taps - ) - - self.sqwave = (1,) * samples_per_symbol # rectangular window - self.taps = numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave)) - self.gaussian_filter = gr.interp_fir_filter_fff(samples_per_symbol, self.taps) - - # FM modulation - self.fmmod = gr.frequency_modulator_fc(sensitivity) - - # small amount of output attenuation to prevent clipping USRP sink - self.amp = gr.multiply_const_cc(0.999) - - if verbose: - self._print_verbage() - - if log: - self._setup_logging() - - # Connect & Initialize base class - self.connect(self, self.nrz, self.gaussian_filter, self.fmmod, self.amp, self) - - def samples_per_symbol(self): - return self._samples_per_symbol - - def bits_per_symbol(self=None): # staticmethod that's also callable on an instance - return 1 - bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. - - - def _print_verbage(self): - print "bits per symbol = %d" % self.bits_per_symbol() - print "Gaussian filter bt = %.2f" % self._bt - - - def _setup_logging(self): - print "Modulation logging turned on." - self.connect(self.nrz, - gr.file_sink(gr.sizeof_float, "nrz.dat")) - self.connect(self.gaussian_filter, - gr.file_sink(gr.sizeof_float, "gaussian_filter.dat")) - self.connect(self.fmmod, - gr.file_sink(gr.sizeof_gr_complex, "fmmod.dat")) - - - def add_options(parser): - """ - Adds GFSK modulation-specific options to the standard parser - """ - parser.add_option("", "--bt", type="float", default=_def_bt, - help="set bandwidth-time product [default=%default] (GFSK)") - add_options=staticmethod(add_options) - - - def extract_kwargs_from_options(options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - return modulation_utils.extract_kwargs_from_options(gfsk_mod.__init__, - ('self',), options) - extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) - - - -# ///////////////////////////////////////////////////////////////////////////// -# GFSK demodulator -# ///////////////////////////////////////////////////////////////////////////// - -class gfsk_demod(gr.hier_block2): - - def __init__(self, - samples_per_symbol=_def_samples_per_symbol, - sensitivity=_def_sensitivity, - gain_mu=_def_gain_mu, - mu=_def_mu, - omega_relative_limit=_def_omega_relative_limit, - freq_error=_def_freq_error, - verbose=_def_verbose, - log=_def_log): - """ - Hierarchical block for Gaussian Minimum Shift Key (GFSK) - demodulation. - - The input is the complex modulated signal at baseband. - The output is a stream of bits packed 1 bit per byte (the LSB) - - @param samples_per_symbol: samples per baud - @type samples_per_symbol: integer - @param verbose: Print information about modulator? - @type verbose: bool - @param log: Print modualtion data to files? - @type log: bool - - Clock recovery parameters. These all have reasonble defaults. - - @param gain_mu: controls rate of mu adjustment - @type gain_mu: float - @param mu: fractional delay [0.0, 1.0] - @type mu: float - @param omega_relative_limit: sets max variation in omega - @type omega_relative_limit: float, typically 0.000200 (200 ppm) - @param freq_error: bit rate error as a fraction - @param float - """ - - gr.hier_block2.__init__(self, "gfsk_demod", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_char)) # Output signature - - self._samples_per_symbol = samples_per_symbol - self._gain_mu = gain_mu - self._mu = mu - self._omega_relative_limit = omega_relative_limit - self._freq_error = freq_error - self._differential = False - - if samples_per_symbol < 2: - raise TypeError, "samples_per_symbol >= 2, is %f" % samples_per_symbol - - self._omega = samples_per_symbol*(1+self._freq_error) - - if not self._gain_mu: - self._gain_mu = 0.175 - - self._gain_omega = .25 * self._gain_mu * self._gain_mu # critically damped - - # Demodulate FM - #sensitivity = (pi / 2) / samples_per_symbol - self.fmdemod = gr.quadrature_demod_cf(1.0 / sensitivity) - - # the clock recovery block tracks the symbol clock and resamples as needed. - # the output of the block is a stream of soft symbols (float) - self.clock_recovery = digital.clock_recovery_mm_ff(self._omega, self._gain_omega, - self._mu, self._gain_mu, - self._omega_relative_limit) - - # slice the floats at 0, outputting 1 bit (the LSB of the output byte) per sample - self.slicer = digital.binary_slicer_fb() - - if verbose: - self._print_verbage() - - if log: - self._setup_logging() - - # Connect & Initialize base class - self.connect(self, self.fmdemod, self.clock_recovery, self.slicer, self) - - def samples_per_symbol(self): - return self._samples_per_symbol - - def bits_per_symbol(self=None): # staticmethod that's also callable on an instance - return 1 - bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. - - - def _print_verbage(self): - print "bits per symbol = %d" % self.bits_per_symbol() - print "M&M clock recovery omega = %f" % self._omega - print "M&M clock recovery gain mu = %f" % self._gain_mu - print "M&M clock recovery mu = %f" % self._mu - print "M&M clock recovery omega rel. limit = %f" % self._omega_relative_limit - print "frequency error = %f" % self._freq_error - - - def _setup_logging(self): - print "Demodulation logging turned on." - self.connect(self.fmdemod, - gr.file_sink(gr.sizeof_float, "fmdemod.dat")) - self.connect(self.clock_recovery, - gr.file_sink(gr.sizeof_float, "clock_recovery.dat")) - self.connect(self.slicer, - gr.file_sink(gr.sizeof_char, "slicer.dat")) - - def add_options(parser): - """ - Adds GFSK demodulation-specific options to the standard parser - """ - parser.add_option("", "--gain-mu", type="float", default=_def_gain_mu, - help="M&M clock recovery gain mu [default=%default] (GFSK/PSK)") - parser.add_option("", "--mu", type="float", default=_def_mu, - help="M&M clock recovery mu [default=%default] (GFSK/PSK)") - parser.add_option("", "--omega-relative-limit", type="float", default=_def_omega_relative_limit, - help="M&M clock recovery omega relative limit [default=%default] (GFSK/PSK)") - parser.add_option("", "--freq-error", type="float", default=_def_freq_error, - help="M&M clock recovery frequency error [default=%default] (GFSK)") - add_options=staticmethod(add_options) - - def extract_kwargs_from_options(options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - return modulation_utils.extract_kwargs_from_options(gfsk_demod.__init__, - ('self',), options) - extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) - - -# -# Add these to the mod/demod registry -# -modulation_utils.add_type_1_mod('gfsk', gfsk_mod) -modulation_utils.add_type_1_demod('gfsk', gfsk_demod) diff --git a/gr-digital/python/gmsk.py b/gr-digital/python/gmsk.py deleted file mode 100644 index 2c9be056c..000000000 --- a/gr-digital/python/gmsk.py +++ /dev/null @@ -1,300 +0,0 @@ -# -# GMSK modulation and demodulation. -# -# -# Copyright 2005,2006,2007 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. -# - -# See gnuradio-examples/python/digital for examples - -from gnuradio import gr -import modulation_utils -import digital_swig as digital -from math import pi -import numpy -from pprint import pprint -import inspect - -# default values (used in __init__ and add_options) -_def_samples_per_symbol = 2 -_def_bt = 0.35 -_def_verbose = False -_def_log = False - -_def_gain_mu = None -_def_mu = 0.5 -_def_freq_error = 0.0 -_def_omega_relative_limit = 0.005 - - -# FIXME: Figure out how to make GMSK work with pfb_arb_resampler_fff for both -# transmit and receive so we don't require integer samples per symbol. - - -# ///////////////////////////////////////////////////////////////////////////// -# GMSK modulator -# ///////////////////////////////////////////////////////////////////////////// - -class gmsk_mod(gr.hier_block2): - - def __init__(self, - samples_per_symbol=_def_samples_per_symbol, - bt=_def_bt, - verbose=_def_verbose, - log=_def_log): - """ - Hierarchical block for Gaussian Minimum Shift Key (GMSK) - modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - @param samples_per_symbol: samples per baud >= 2 - @type samples_per_symbol: integer - @param bt: Gaussian filter bandwidth * symbol time - @type bt: float - @param verbose: Print information about modulator? - @type verbose: bool - @param debug: Print modualtion data to files? - @type debug: bool - """ - - gr.hier_block2.__init__(self, "gmsk_mod", - gr.io_signature(1, 1, gr.sizeof_char), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - samples_per_symbol = int(samples_per_symbol) - self._samples_per_symbol = samples_per_symbol - self._bt = bt - self._differential = False - - if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2: - raise TypeError, ("samples_per_symbol must be an integer >= 2, is %r" % (samples_per_symbol,)) - - ntaps = 4 * samples_per_symbol # up to 3 bits in filter at once - sensitivity = (pi / 2) / samples_per_symbol # phase change per bit = pi / 2 - - # Turn it into NRZ data. - self.nrz = gr.bytes_to_syms() - - # Form Gaussian filter - # Generate Gaussian response (Needs to be convolved with window below). - self.gaussian_taps = gr.firdes.gaussian( - 1, # gain - samples_per_symbol, # symbol_rate - bt, # bandwidth * symbol time - ntaps # number of taps - ) - - self.sqwave = (1,) * samples_per_symbol # rectangular window - self.taps = numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave)) - self.gaussian_filter = gr.interp_fir_filter_fff(samples_per_symbol, self.taps) - - # FM modulation - self.fmmod = gr.frequency_modulator_fc(sensitivity) - - if verbose: - self._print_verbage() - - if log: - self._setup_logging() - - # Connect & Initialize base class - self.connect(self, self.nrz, self.gaussian_filter, self.fmmod, self) - - def samples_per_symbol(self): - return self._samples_per_symbol - - def bits_per_symbol(self=None): # staticmethod that's also callable on an instance - return 1 - bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. - - - def _print_verbage(self): - print "bits per symbol = %d" % self.bits_per_symbol() - print "Gaussian filter bt = %.2f" % self._bt - - - def _setup_logging(self): - print "Modulation logging turned on." - self.connect(self.nrz, - gr.file_sink(gr.sizeof_float, "nrz.dat")) - self.connect(self.gaussian_filter, - gr.file_sink(gr.sizeof_float, "gaussian_filter.dat")) - self.connect(self.fmmod, - gr.file_sink(gr.sizeof_gr_complex, "fmmod.dat")) - - - def add_options(parser): - """ - Adds GMSK modulation-specific options to the standard parser - """ - parser.add_option("", "--bt", type="float", default=_def_bt, - help="set bandwidth-time product [default=%default] (GMSK)") - add_options=staticmethod(add_options) - - - def extract_kwargs_from_options(options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - return modulation_utils.extract_kwargs_from_options(gmsk_mod.__init__, - ('self',), options) - extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) - - - -# ///////////////////////////////////////////////////////////////////////////// -# GMSK demodulator -# ///////////////////////////////////////////////////////////////////////////// - -class gmsk_demod(gr.hier_block2): - - def __init__(self, - samples_per_symbol=_def_samples_per_symbol, - gain_mu=_def_gain_mu, - mu=_def_mu, - omega_relative_limit=_def_omega_relative_limit, - freq_error=_def_freq_error, - verbose=_def_verbose, - log=_def_log): - """ - Hierarchical block for Gaussian Minimum Shift Key (GMSK) - demodulation. - - The input is the complex modulated signal at baseband. - The output is a stream of bits packed 1 bit per byte (the LSB) - - @param samples_per_symbol: samples per baud - @type samples_per_symbol: integer - @param verbose: Print information about modulator? - @type verbose: bool - @param log: Print modualtion data to files? - @type log: bool - - Clock recovery parameters. These all have reasonble defaults. - - @param gain_mu: controls rate of mu adjustment - @type gain_mu: float - @param mu: fractional delay [0.0, 1.0] - @type mu: float - @param omega_relative_limit: sets max variation in omega - @type omega_relative_limit: float, typically 0.000200 (200 ppm) - @param freq_error: bit rate error as a fraction - @param float - """ - - gr.hier_block2.__init__(self, "gmsk_demod", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_char)) # Output signature - - self._samples_per_symbol = samples_per_symbol - self._gain_mu = gain_mu - self._mu = mu - self._omega_relative_limit = omega_relative_limit - self._freq_error = freq_error - self._differential = False - - if samples_per_symbol < 2: - raise TypeError, "samples_per_symbol >= 2, is %f" % samples_per_symbol - - self._omega = samples_per_symbol*(1+self._freq_error) - - if not self._gain_mu: - self._gain_mu = 0.175 - - self._gain_omega = .25 * self._gain_mu * self._gain_mu # critically damped - - # Demodulate FM - sensitivity = (pi / 2) / samples_per_symbol - self.fmdemod = gr.quadrature_demod_cf(1.0 / sensitivity) - - # the clock recovery block tracks the symbol clock and resamples as needed. - # the output of the block is a stream of soft symbols (float) - self.clock_recovery = digital.clock_recovery_mm_ff(self._omega, self._gain_omega, - self._mu, self._gain_mu, - self._omega_relative_limit) - - # slice the floats at 0, outputting 1 bit (the LSB of the output byte) per sample - self.slicer = digital.binary_slicer_fb() - - if verbose: - self._print_verbage() - - if log: - self._setup_logging() - - # Connect & Initialize base class - self.connect(self, self.fmdemod, self.clock_recovery, self.slicer, self) - - def samples_per_symbol(self): - return self._samples_per_symbol - - def bits_per_symbol(self=None): # staticmethod that's also callable on an instance - return 1 - bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. - - - def _print_verbage(self): - print "bits per symbol = %d" % self.bits_per_symbol() - print "M&M clock recovery omega = %f" % self._omega - print "M&M clock recovery gain mu = %f" % self._gain_mu - print "M&M clock recovery mu = %f" % self._mu - print "M&M clock recovery omega rel. limit = %f" % self._omega_relative_limit - print "frequency error = %f" % self._freq_error - - - def _setup_logging(self): - print "Demodulation logging turned on." - self.connect(self.fmdemod, - gr.file_sink(gr.sizeof_float, "fmdemod.dat")) - self.connect(self.clock_recovery, - gr.file_sink(gr.sizeof_float, "clock_recovery.dat")) - self.connect(self.slicer, - gr.file_sink(gr.sizeof_char, "slicer.dat")) - - def add_options(parser): - """ - Adds GMSK demodulation-specific options to the standard parser - """ - parser.add_option("", "--gain-mu", type="float", default=_def_gain_mu, - help="M&M clock recovery gain mu [default=%default] (GMSK/PSK)") - parser.add_option("", "--mu", type="float", default=_def_mu, - help="M&M clock recovery mu [default=%default] (GMSK/PSK)") - parser.add_option("", "--omega-relative-limit", type="float", default=_def_omega_relative_limit, - help="M&M clock recovery omega relative limit [default=%default] (GMSK/PSK)") - parser.add_option("", "--freq-error", type="float", default=_def_freq_error, - help="M&M clock recovery frequency error [default=%default] (GMSK)") - add_options=staticmethod(add_options) - - def extract_kwargs_from_options(options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - return modulation_utils.extract_kwargs_from_options(gmsk_demod.__init__, - ('self',), options) - extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) - - -# -# Add these to the mod/demod registry -# -modulation_utils.add_type_1_mod('gmsk', gmsk_mod) -modulation_utils.add_type_1_demod('gmsk', gmsk_demod) diff --git a/gr-digital/python/modulation_utils.py b/gr-digital/python/modulation_utils.py deleted file mode 100644 index cb3a9812d..000000000 --- a/gr-digital/python/modulation_utils.py +++ /dev/null @@ -1,102 +0,0 @@ -# -# Copyright 2010 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 this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -""" -Miscellaneous utilities for managing mods and demods, as well as other items -useful in dealing with generalized handling of different modulations and demods. -""" - -import inspect - - -# Type 1 modulators accept a stream of bytes on their input and produce complex baseband output -_type_1_modulators = {} - -def type_1_mods(): - return _type_1_modulators - -def add_type_1_mod(name, mod_class): - _type_1_modulators[name] = mod_class - - -# Type 1 demodulators accept complex baseband input and produce a stream of bits, packed -# 1 bit / byte as their output. Their output is completely unambiguous. There is no need -# to resolve phase or polarity ambiguities. -_type_1_demodulators = {} - -def type_1_demods(): - return _type_1_demodulators - -def add_type_1_demod(name, demod_class): - _type_1_demodulators[name] = demod_class - -# Also record the constellation making functions of the modulations -_type_1_constellations = {} - -def type_1_constellations(): - return _type_1_constellations - -def add_type_1_constellation(name, constellation): - _type_1_constellations[name] = constellation - - -def extract_kwargs_from_options(function, excluded_args, options): - """ - Given a function, a list of excluded arguments and the result of - parsing command line options, create a dictionary of key word - arguments suitable for passing to the function. The dictionary - will be populated with key/value pairs where the keys are those - that are common to the function's argument list (minus the - excluded_args) and the attributes in options. The values are the - corresponding values from options unless that value is None. - In that case, the corresponding dictionary entry is not populated. - - (This allows different modulations that have the same parameter - names, but different default values to coexist. The downside is - that --help in the option parser will list the default as None, - but in that case the default provided in the __init__ argument - list will be used since there is no kwargs entry.) - - @param function: the function whose parameter list will be examined - @param excluded_args: function arguments that are NOT to be added to the dictionary - @type excluded_args: sequence of strings - @param options: result of command argument parsing - @type options: optparse.Values - """ - - # Try this in C++ ;) - args, varargs, varkw, defaults = inspect.getargspec(function) - d = {} - for kw in [a for a in args if a not in excluded_args]: - if hasattr(options, kw): - if getattr(options, kw) is not None: - d[kw] = getattr(options, kw) - return d - -def extract_kwargs_from_options_for_class(cls, options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - d = extract_kwargs_from_options( - cls.__init__, ('self',), options) - for base in cls.__bases__: - if hasattr(base, 'extract_kwargs_from_options'): - d.update(base.extract_kwargs_from_options(options)) - return d diff --git a/gr-digital/python/ofdm.py b/gr-digital/python/ofdm.py deleted file mode 100644 index 9f57920ef..000000000 --- a/gr-digital/python/ofdm.py +++ /dev/null @@ -1,318 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2008 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. -# - -import math -from gnuradio import gr -import digital_swig -import ofdm_packet_utils -from ofdm_receiver import ofdm_receiver -import gnuradio.gr.gr_threading as _threading -import psk, qam - -# ///////////////////////////////////////////////////////////////////////////// -# mod/demod with packets as i/o -# ///////////////////////////////////////////////////////////////////////////// - -class ofdm_mod(gr.hier_block2): - """ - Modulates an OFDM stream. Based on the options fft_length, occupied_tones, and - cp_length, this block creates OFDM symbols using a specified modulation option. - - Send packets by calling send_pkt - """ - def __init__(self, options, msgq_limit=2, pad_for_usrp=True): - """ - Hierarchical block for sending packets - - Packets to be sent are enqueued by calling send_pkt. - The output is the complex modulated signal at baseband. - - @param options: pass modulation options from higher layers (fft length, occupied tones, etc.) - @param msgq_limit: maximum number of messages in message queue - @type msgq_limit: int - @param pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples - """ - - gr.hier_block2.__init__(self, "ofdm_mod", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - self._pad_for_usrp = pad_for_usrp - self._modulation = options.modulation - self._fft_length = options.fft_length - self._occupied_tones = options.occupied_tones - self._cp_length = options.cp_length - - win = [] #[1 for i in range(self._fft_length)] - - # Use freq domain to get doubled-up known symbol for correlation in time domain - zeros_on_left = int(math.ceil((self._fft_length - self._occupied_tones)/2.0)) - ksfreq = known_symbols_4512_3[0:self._occupied_tones] - for i in range(len(ksfreq)): - if((zeros_on_left + i) & 1): - ksfreq[i] = 0 - - # hard-coded known symbols - preambles = (ksfreq,) - - padded_preambles = list() - for pre in preambles: - padded = self._fft_length*[0,] - padded[zeros_on_left : zeros_on_left + self._occupied_tones] = pre - padded_preambles.append(padded) - - symbol_length = options.fft_length + options.cp_length - - mods = {"bpsk": 2, "qpsk": 4, "8psk": 8, "qam8": 8, "qam16": 16, "qam64": 64, "qam256": 256} - arity = mods[self._modulation] - - rot = 1 - if self._modulation == "qpsk": - rot = (0.707+0.707j) - - # FIXME: pass the constellation objects instead of just the points - if(self._modulation.find("psk") >= 0): - constel = psk.psk_constellation(arity) - rotated_const = map(lambda pt: pt * rot, constel.points()) - elif(self._modulation.find("qam") >= 0): - constel = qam.qam_constellation(arity) - rotated_const = map(lambda pt: pt * rot, constel.points()) - #print rotated_const - self._pkt_input = digital_swig.ofdm_mapper_bcv(rotated_const, - msgq_limit, - options.occupied_tones, - options.fft_length) - - self.preambles = digital_swig.ofdm_insert_preamble(self._fft_length, - padded_preambles) - self.ifft = gr.fft_vcc(self._fft_length, False, win, True) - self.cp_adder = digital_swig.ofdm_cyclic_prefixer(self._fft_length, - symbol_length) - self.scale = gr.multiply_const_cc(1.0 / math.sqrt(self._fft_length)) - - self.connect((self._pkt_input, 0), (self.preambles, 0)) - self.connect((self._pkt_input, 1), (self.preambles, 1)) - self.connect(self.preambles, self.ifft, self.cp_adder, self.scale, self) - - if options.verbose: - self._print_verbage() - - if options.log: - self.connect(self._pkt_input, gr.file_sink(gr.sizeof_gr_complex*options.fft_length, - "ofdm_mapper_c.dat")) - self.connect(self.preambles, gr.file_sink(gr.sizeof_gr_complex*options.fft_length, - "ofdm_preambles.dat")) - self.connect(self.ifft, gr.file_sink(gr.sizeof_gr_complex*options.fft_length, - "ofdm_ifft_c.dat")) - self.connect(self.cp_adder, gr.file_sink(gr.sizeof_gr_complex, - "ofdm_cp_adder_c.dat")) - - def send_pkt(self, payload='', eof=False): - """ - Send the payload. - - @param payload: data to send - @type payload: string - """ - if eof: - msg = gr.message(1) # tell self._pkt_input we're not sending any more packets - else: - # print "original_payload =", string_to_hex_list(payload) - pkt = ofdm_packet_utils.make_packet(payload, 1, 1, - self._pad_for_usrp, - whitening=True) - - #print "pkt =", string_to_hex_list(pkt) - msg = gr.message_from_string(pkt) - self._pkt_input.msgq().insert_tail(msg) - - def add_options(normal, expert): - """ - Adds OFDM-specific options to the Options Parser - """ - normal.add_option("-m", "--modulation", type="string", default="bpsk", - help="set modulation type (bpsk, qpsk, 8psk, qam{16,64}) [default=%default]") - expert.add_option("", "--fft-length", type="intx", default=512, - help="set the number of FFT bins [default=%default]") - expert.add_option("", "--occupied-tones", type="intx", default=200, - help="set the number of occupied FFT bins [default=%default]") - expert.add_option("", "--cp-length", type="intx", default=128, - help="set the number of bits in the cyclic prefix [default=%default]") - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the OFDM modulator - """ - print "\nOFDM Modulator:" - print "Modulation Type: %s" % (self._modulation) - print "FFT length: %3d" % (self._fft_length) - print "Occupied Tones: %3d" % (self._occupied_tones) - print "CP length: %3d" % (self._cp_length) - - -class ofdm_demod(gr.hier_block2): - """ - Demodulates a received OFDM stream. Based on the options fft_length, occupied_tones, and - cp_length, this block performs synchronization, FFT, and demodulation of incoming OFDM - symbols and passes packets up the a higher layer. - - The input is complex baseband. When packets are demodulated, they are passed to the - app via the callback. - """ - - def __init__(self, options, callback=None): - """ - Hierarchical block for demodulating and deframing packets. - - The input is the complex modulated signal at baseband. - Demodulated packets are sent to the handler. - - @param options: pass modulation options from higher layers (fft length, occupied tones, etc.) - @param callback: function of two args: ok, payload - @type callback: ok: bool; payload: string - """ - gr.hier_block2.__init__(self, "ofdm_demod", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - - self._rcvd_pktq = gr.msg_queue() # holds packets from the PHY - - self._modulation = options.modulation - self._fft_length = options.fft_length - self._occupied_tones = options.occupied_tones - self._cp_length = options.cp_length - self._snr = options.snr - - # Use freq domain to get doubled-up known symbol for correlation in time domain - zeros_on_left = int(math.ceil((self._fft_length - self._occupied_tones)/2.0)) - ksfreq = known_symbols_4512_3[0:self._occupied_tones] - for i in range(len(ksfreq)): - if((zeros_on_left + i) & 1): - ksfreq[i] = 0 - - # hard-coded known symbols - preambles = (ksfreq,) - - symbol_length = self._fft_length + self._cp_length - self.ofdm_recv = ofdm_receiver(self._fft_length, - self._cp_length, - self._occupied_tones, - self._snr, preambles, - options.log) - - mods = {"bpsk": 2, "qpsk": 4, "8psk": 8, "qam8": 8, "qam16": 16, "qam64": 64, "qam256": 256} - arity = mods[self._modulation] - - rot = 1 - if self._modulation == "qpsk": - rot = (0.707+0.707j) - - # FIXME: pass the constellation objects instead of just the points - if(self._modulation.find("psk") >= 0): - constel = psk.psk_constellation(arity) - rotated_const = map(lambda pt: pt * rot, constel.points()) - elif(self._modulation.find("qam") >= 0): - constel = qam.qam_constellation(arity) - rotated_const = map(lambda pt: pt * rot, constel.points()) - #print rotated_const - - phgain = 0.25 - frgain = phgain*phgain / 4.0 - self.ofdm_demod = digital_swig.ofdm_frame_sink(rotated_const, range(arity), - self._rcvd_pktq, - self._occupied_tones, - phgain, frgain) - - self.connect(self, self.ofdm_recv) - self.connect((self.ofdm_recv, 0), (self.ofdm_demod, 0)) - self.connect((self.ofdm_recv, 1), (self.ofdm_demod, 1)) - - # added output signature to work around bug, though it might not be a bad - # thing to export, anyway - self.connect(self.ofdm_recv.chan_filt, self) - - if options.log: - self.connect(self.ofdm_demod, - gr.file_sink(gr.sizeof_gr_complex*self._occupied_tones, - "ofdm_frame_sink_c.dat")) - else: - self.connect(self.ofdm_demod, - gr.null_sink(gr.sizeof_gr_complex*self._occupied_tones)) - - if options.verbose: - self._print_verbage() - - self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback) - - def add_options(normal, expert): - """ - Adds OFDM-specific options to the Options Parser - """ - normal.add_option("-m", "--modulation", type="string", default="bpsk", - help="set modulation type (bpsk or qpsk) [default=%default]") - expert.add_option("", "--fft-length", type="intx", default=512, - help="set the number of FFT bins [default=%default]") - expert.add_option("", "--occupied-tones", type="intx", default=200, - help="set the number of occupied FFT bins [default=%default]") - expert.add_option("", "--cp-length", type="intx", default=128, - help="set the number of bits in the cyclic prefix [default=%default]") - expert.add_option("", "--snr", type="float", default=30.0, - help="SNR estimate [default=%default]") - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the OFDM demodulator - """ - print "\nOFDM Demodulator:" - print "Modulation Type: %s" % (self._modulation) - print "FFT length: %3d" % (self._fft_length) - print "Occupied Tones: %3d" % (self._occupied_tones) - print "CP length: %3d" % (self._cp_length) - - - -class _queue_watcher_thread(_threading.Thread): - def __init__(self, rcvd_pktq, callback): - _threading.Thread.__init__(self) - self.setDaemon(1) - self.rcvd_pktq = rcvd_pktq - self.callback = callback - self.keep_running = True - self.start() - - - def run(self): - while self.keep_running: - msg = self.rcvd_pktq.delete_head() - ok, payload = ofdm_packet_utils.unmake_packet(msg.to_string()) - if self.callback: - self.callback(ok, payload) - -# Generating known symbols with: -# i = [2*random.randint(0,1)-1 for i in range(4512)] - -known_symbols_4512_3 = [-1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1] diff --git a/gr-digital/python/ofdm_packet_utils.py b/gr-digital/python/ofdm_packet_utils.py deleted file mode 100644 index d0000e6db..000000000 --- a/gr-digital/python/ofdm_packet_utils.py +++ /dev/null @@ -1,454 +0,0 @@ -# -# Copyright 2007 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. -# - -import struct -import numpy -from gnuradio import gru -import crc - -def conv_packed_binary_string_to_1_0_string(s): - """ - '\xAF' --> '10101111' - """ - r = [] - for ch in s: - x = ord(ch) - for i in range(7,-1,-1): - t = (x >> i) & 0x1 - r.append(t) - - return ''.join(map(lambda x: chr(x + ord('0')), r)) - -def conv_1_0_string_to_packed_binary_string(s): - """ - '10101111' -> ('\xAF', False) - - Basically the inverse of conv_packed_binary_string_to_1_0_string, - but also returns a flag indicating if we had to pad with leading zeros - to get to a multiple of 8. - """ - if not is_1_0_string(s): - raise ValueError, "Input must be a string containing only 0's and 1's" - - # pad to multiple of 8 - padded = False - rem = len(s) % 8 - if rem != 0: - npad = 8 - rem - s = '0' * npad + s - padded = True - - assert len(s) % 8 == 0 - - r = [] - i = 0 - while i < len(s): - t = 0 - for j in range(8): - t = (t << 1) | (ord(s[i + j]) - ord('0')) - r.append(chr(t)) - i += 8 - return (''.join(r), padded) - - -def is_1_0_string(s): - if not isinstance(s, str): - return False - for ch in s: - if not ch in ('0', '1'): - return False - return True - -def string_to_hex_list(s): - return map(lambda x: hex(ord(x)), s) - - -def whiten(s, o): - sa = numpy.fromstring(s, numpy.uint8) - z = sa ^ random_mask_vec8[o:len(sa)+o] - return z.tostring() - -def dewhiten(s, o): - return whiten(s, o) # self inverse - - -def make_header(payload_len, whitener_offset=0): - # Upper nibble is offset, lower 12 bits is len - val = ((whitener_offset & 0xf) << 12) | (payload_len & 0x0fff) - #print "offset =", whitener_offset, " len =", payload_len, " val=", val - return struct.pack('!HH', val, val) - -def make_packet(payload, samples_per_symbol, bits_per_symbol, - pad_for_usrp=True, whitener_offset=0, whitening=True): - """ - Build a packet, given access code, payload, and whitener offset - - @param payload: packet payload, len [0, 4096] - @param samples_per_symbol: samples per symbol (needed for padding calculation) - @type samples_per_symbol: int - @param bits_per_symbol: (needed for padding calculation) - @type bits_per_symbol: int - @param whitener_offset offset into whitener string to use [0-16) - @param whitening: Turn whitener on or off - @type whitening: bool - - Packet will have access code at the beginning, followed by length, payload - and finally CRC-32. - """ - - if not whitener_offset >=0 and whitener_offset < 16: - raise ValueError, "whitener_offset must be between 0 and 15, inclusive (%i)" % (whitener_offset,) - - payload_with_crc = crc.gen_and_append_crc32(payload) - #print "outbound crc =", string_to_hex_list(payload_with_crc[-4:]) - - L = len(payload_with_crc) - MAXLEN = len(random_mask_tuple) - if L > MAXLEN: - raise ValueError, "len(payload) must be in [0, %d]" % (MAXLEN,) - - pkt_hd = make_header(L, whitener_offset) - pkt_dt = ''.join((payload_with_crc, '\x55')) - packet_length = len(pkt_hd) + len(pkt_dt) - - if pad_for_usrp: - usrp_packing = _npadding_bytes(packet_length, samples_per_symbol, bits_per_symbol) * '\x55' - pkt_dt = pkt_dt + usrp_packing - - if(whitening): - pkt = pkt_hd + whiten(pkt_dt, whitener_offset) - else: - pkt = pkt_hd + pkt_dt - - #print "make_packet: len(pkt) =", len(pkt) - - return pkt - -def _npadding_bytes(pkt_byte_len, samples_per_symbol, bits_per_symbol): - """ - Generate sufficient padding such that each packet ultimately ends - up being a multiple of 512 bytes when sent across the USB. We - send 4-byte samples across the USB (16-bit I and 16-bit Q), thus - we want to pad so that after modulation the resulting packet - is a multiple of 128 samples. - - @param ptk_byte_len: len in bytes of packet, not including padding. - @param samples_per_symbol: samples per bit (1 bit / symbolwidth GMSK) - @type samples_per_symbol: int - @param bits_per_symbol: bits per symbol (log2(modulation order)) - @type bits_per_symbol: int - - @returns number of bytes of padding to append. - """ - modulus = 128 - byte_modulus = gru.lcm(modulus/8, samples_per_symbol) * bits_per_symbol / samples_per_symbol - r = pkt_byte_len % byte_modulus - if r == 0: - return 0 - return byte_modulus - r - - -def unmake_packet(whitened_payload_with_crc, whitener_offset=0, dewhitening=1): - """ - Return (ok, payload) - - @param whitened_payload_with_crc: string - @param whitener_offset offset into whitener string to use [0-16) - @param dewhitening: Turn whitener on or off - @type dewhitening: bool - """ - - if dewhitening: - payload_with_crc = dewhiten(whitened_payload_with_crc, whitener_offset) - else: - payload_with_crc = whitened_payload_with_crc - - ok, payload = crc.check_crc32(payload_with_crc) - - if 0: - print "payload_with_crc =", string_to_hex_list(payload_with_crc) - print "ok = %r, len(payload) = %d" % (ok, len(payload)) - print "payload =", string_to_hex_list(payload) - - return ok, payload - - -# FYI, this PN code is the output of a 15-bit LFSR -random_mask_tuple = ( - 255, 63, 0, 16, 0, 12, 0, 5, 192, 3, 16, 1, 204, 0, 85, 192, - 63, 16, 16, 12, 12, 5, 197, 195, 19, 17, 205, 204, 85, 149, 255, 47, - 0, 28, 0, 9, 192, 6, 208, 2, 220, 1, 153, 192, 106, 208, 47, 28, - 28, 9, 201, 198, 214, 210, 222, 221, 152, 89, 170, 186, 255, 51, 0, 21, - 192, 15, 16, 4, 12, 3, 69, 193, 243, 16, 69, 204, 51, 21, 213, 207, - 31, 20, 8, 15, 70, 132, 50, 227, 85, 137, 255, 38, 192, 26, 208, 11, - 28, 7, 73, 194, 182, 209, 182, 220, 118, 217, 230, 218, 202, 219, 23, 27, - 78, 139, 116, 103, 103, 106, 170, 175, 63, 60, 16, 17, 204, 12, 85, 197, - 255, 19, 0, 13, 192, 5, 144, 3, 44, 1, 221, 192, 89, 144, 58, 236, - 19, 13, 205, 197, 149, 147, 47, 45, 220, 29, 153, 201, 170, 214, 255, 30, - 192, 8, 80, 6, 188, 2, 241, 193, 132, 80, 99, 124, 41, 225, 222, 200, - 88, 86, 186, 190, 243, 48, 69, 212, 51, 31, 85, 200, 63, 22, 144, 14, - 236, 4, 77, 195, 117, 145, 231, 44, 74, 157, 247, 41, 134, 158, 226, 232, - 73, 142, 182, 228, 118, 203, 102, 215, 106, 222, 175, 24, 124, 10, 161, 199, - 56, 82, 146, 189, 173, 177, 189, 180, 113, 183, 100, 118, 171, 102, 255, 106, - 192, 47, 16, 28, 12, 9, 197, 198, 211, 18, 221, 205, 153, 149, 170, 239, - 63, 12, 16, 5, 204, 3, 21, 193, 207, 16, 84, 12, 63, 69, 208, 51, - 28, 21, 201, 207, 22, 212, 14, 223, 68, 88, 51, 122, 149, 227, 47, 9, - 220, 6, 217, 194, 218, 209, 155, 28, 107, 73, 239, 118, 204, 38, 213, 218, - 223, 27, 24, 11, 74, 135, 119, 34, 166, 153, 186, 234, 243, 15, 5, 196, - 3, 19, 65, 205, 240, 85, 132, 63, 35, 80, 25, 252, 10, 193, 199, 16, - 82, 140, 61, 165, 209, 187, 28, 115, 73, 229, 246, 203, 6, 215, 66, 222, - 177, 152, 116, 106, 167, 111, 58, 172, 19, 61, 205, 209, 149, 156, 111, 41, - 236, 30, 205, 200, 85, 150, 191, 46, 240, 28, 68, 9, 243, 70, 197, 242, - 211, 5, 157, 195, 41, 145, 222, 236, 88, 77, 250, 181, 131, 55, 33, 214, - 152, 94, 234, 184, 79, 50, 180, 21, 183, 79, 54, 180, 22, 247, 78, 198, - 180, 82, 247, 125, 134, 161, 162, 248, 121, 130, 162, 225, 185, 136, 114, 230, - 165, 138, 251, 39, 3, 90, 129, 251, 32, 67, 88, 49, 250, 148, 67, 47, - 113, 220, 36, 89, 219, 122, 219, 99, 27, 105, 203, 110, 215, 108, 94, 173, - 248, 125, 130, 161, 161, 184, 120, 114, 162, 165, 185, 187, 50, 243, 85, 133, - 255, 35, 0, 25, 192, 10, 208, 7, 28, 2, 137, 193, 166, 208, 122, 220, - 35, 25, 217, 202, 218, 215, 27, 30, 139, 72, 103, 118, 170, 166, 255, 58, - 192, 19, 16, 13, 204, 5, 149, 195, 47, 17, 220, 12, 89, 197, 250, 211, - 3, 29, 193, 201, 144, 86, 236, 62, 205, 208, 85, 156, 63, 41, 208, 30, - 220, 8, 89, 198, 186, 210, 243, 29, 133, 201, 163, 22, 249, 206, 194, 212, - 81, 159, 124, 104, 33, 238, 152, 76, 106, 181, 239, 55, 12, 22, 133, 206, - 227, 20, 73, 207, 118, 212, 38, 223, 90, 216, 59, 26, 147, 75, 45, 247, - 93, 134, 185, 162, 242, 249, 133, 130, 227, 33, 137, 216, 102, 218, 170, 219, - 63, 27, 80, 11, 124, 7, 97, 194, 168, 81, 190, 188, 112, 113, 228, 36, - 75, 91, 119, 123, 102, 163, 106, 249, 239, 2, 204, 1, 149, 192, 111, 16, - 44, 12, 29, 197, 201, 147, 22, 237, 206, 205, 148, 85, 175, 127, 60, 32, - 17, 216, 12, 90, 133, 251, 35, 3, 89, 193, 250, 208, 67, 28, 49, 201, - 212, 86, 223, 126, 216, 32, 90, 152, 59, 42, 147, 95, 45, 248, 29, 130, - 137, 161, 166, 248, 122, 194, 163, 17, 185, 204, 114, 213, 229, 159, 11, 40, - 7, 94, 130, 184, 97, 178, 168, 117, 190, 167, 48, 122, 148, 35, 47, 89, - 220, 58, 217, 211, 26, 221, 203, 25, 151, 74, 238, 183, 12, 118, 133, 230, - 227, 10, 201, 199, 22, 210, 142, 221, 164, 89, 187, 122, 243, 99, 5, 233, - 195, 14, 209, 196, 92, 83, 121, 253, 226, 193, 137, 144, 102, 236, 42, 205, - 223, 21, 152, 15, 42, 132, 31, 35, 72, 25, 246, 138, 198, 231, 18, 202, - 141, 151, 37, 174, 155, 60, 107, 81, 239, 124, 76, 33, 245, 216, 71, 26, - 178, 139, 53, 167, 87, 58, 190, 147, 48, 109, 212, 45, 159, 93, 168, 57, - 190, 146, 240, 109, 132, 45, 163, 93, 185, 249, 178, 194, 245, 145, 135, 44, - 98, 157, 233, 169, 142, 254, 228, 64, 75, 112, 55, 100, 22, 171, 78, 255, - 116, 64, 39, 112, 26, 164, 11, 59, 71, 83, 114, 189, 229, 177, 139, 52, - 103, 87, 106, 190, 175, 48, 124, 20, 33, 207, 88, 84, 58, 191, 83, 48, - 61, 212, 17, 159, 76, 104, 53, 238, 151, 12, 110, 133, 236, 99, 13, 233, - 197, 142, 211, 36, 93, 219, 121, 155, 98, 235, 105, 143, 110, 228, 44, 75, - 93, 247, 121, 134, 162, 226, 249, 137, 130, 230, 225, 138, 200, 103, 22, 170, - 142, 255, 36, 64, 27, 112, 11, 100, 7, 107, 66, 175, 113, 188, 36, 113, - 219, 100, 91, 107, 123, 111, 99, 108, 41, 237, 222, 205, 152, 85, 170, 191, - 63, 48, 16, 20, 12, 15, 69, 196, 51, 19, 85, 205, 255, 21, 128, 15, - 32, 4, 24, 3, 74, 129, 247, 32, 70, 152, 50, 234, 149, 143, 47, 36, - 28, 27, 73, 203, 118, 215, 102, 222, 170, 216, 127, 26, 160, 11, 56, 7, - 82, 130, 189, 161, 177, 184, 116, 114, 167, 101, 186, 171, 51, 63, 85, 208, - 63, 28, 16, 9, 204, 6, 213, 194, 223, 17, 152, 12, 106, 133, 239, 35, - 12, 25, 197, 202, 211, 23, 29, 206, 137, 148, 102, 239, 106, 204, 47, 21, - 220, 15, 25, 196, 10, 211, 71, 29, 242, 137, 133, 166, 227, 58, 201, 211, - 22, 221, 206, 217, 148, 90, 239, 123, 12, 35, 69, 217, 243, 26, 197, 203, - 19, 23, 77, 206, 181, 148, 119, 47, 102, 156, 42, 233, 223, 14, 216, 4, - 90, 131, 123, 33, 227, 88, 73, 250, 182, 195, 54, 209, 214, 220, 94, 217, - 248, 90, 194, 187, 17, 179, 76, 117, 245, 231, 7, 10, 130, 135, 33, 162, - 152, 121, 170, 162, 255, 57, 128, 18, 224, 13, 136, 5, 166, 131, 58, 225, - 211, 8, 93, 198, 185, 146, 242, 237, 133, 141, 163, 37, 185, 219, 50, 219, - 85, 155, 127, 43, 96, 31, 104, 8, 46, 134, 156, 98, 233, 233, 142, 206, - 228, 84, 75, 127, 119, 96, 38, 168, 26, 254, 139, 0, 103, 64, 42, 176, - 31, 52, 8, 23, 70, 142, 178, 228, 117, 139, 103, 39, 106, 154, 175, 43, - 60, 31, 81, 200, 60, 86, 145, 254, 236, 64, 77, 240, 53, 132, 23, 35, - 78, 153, 244, 106, 199, 111, 18, 172, 13, 189, 197, 177, 147, 52, 109, 215, - 109, 158, 173, 168, 125, 190, 161, 176, 120, 116, 34, 167, 89, 186, 186, 243, - 51, 5, 213, 195, 31, 17, 200, 12, 86, 133, 254, 227, 0, 73, 192, 54, - 208, 22, 220, 14, 217, 196, 90, 211, 123, 29, 227, 73, 137, 246, 230, 198, - 202, 210, 215, 29, 158, 137, 168, 102, 254, 170, 192, 127, 16, 32, 12, 24, - 5, 202, 131, 23, 33, 206, 152, 84, 106, 191, 111, 48, 44, 20, 29, 207, - 73, 148, 54, 239, 86, 204, 62, 213, 208, 95, 28, 56, 9, 210, 134, 221, - 162, 217, 185, 154, 242, 235, 5, 143, 67, 36, 49, 219, 84, 91, 127, 123, - 96, 35, 104, 25, 238, 138, 204, 103, 21, 234, 143, 15, 36, 4, 27, 67, - 75, 113, 247, 100, 70, 171, 114, 255, 101, 128, 43, 32, 31, 88, 8, 58, - 134, 147, 34, 237, 217, 141, 154, 229, 171, 11, 63, 71, 80, 50, 188, 21, - 177, 207, 52, 84, 23, 127, 78, 160, 52, 120, 23, 98, 142, 169, 164, 126, - 251, 96, 67, 104, 49, 238, 148, 76, 111, 117, 236, 39, 13, 218, 133, 155, - 35, 43, 89, 223, 122, 216, 35, 26, 153, 203, 42, 215, 95, 30, 184, 8, - 114, 134, 165, 162, 251, 57, 131, 82, 225, 253, 136, 65, 166, 176, 122, 244, - 35, 7, 89, 194, 186, 209, 179, 28, 117, 201, 231, 22, 202, 142, 215, 36, - 94, 155, 120, 107, 98, 175, 105, 188, 46, 241, 220, 68, 89, 243, 122, 197, - 227, 19, 9, 205, 198, 213, 146, 223, 45, 152, 29, 170, 137, 191, 38, 240, - 26, 196, 11, 19, 71, 77, 242, 181, 133, 183, 35, 54, 153, 214, 234, 222, - 207, 24, 84, 10, 191, 71, 48, 50, 148, 21, 175, 79, 60, 52, 17, 215, - 76, 94, 181, 248, 119, 2, 166, 129, 186, 224, 115, 8, 37, 198, 155, 18, - 235, 77, 143, 117, 164, 39, 59, 90, 147, 123, 45, 227, 93, 137, 249, 166, - 194, 250, 209, 131, 28, 97, 201, 232, 86, 206, 190, 212, 112, 95, 100, 56, - 43, 82, 159, 125, 168, 33, 190, 152, 112, 106, 164, 47, 59, 92, 19, 121, - 205, 226, 213, 137, 159, 38, 232, 26, 206, 139, 20, 103, 79, 106, 180, 47, - 55, 92, 22, 185, 206, 242, 212, 69, 159, 115, 40, 37, 222, 155, 24, 107, - 74, 175, 119, 60, 38, 145, 218, 236, 91, 13, 251, 69, 131, 115, 33, 229, - 216, 75, 26, 183, 75, 54, 183, 86, 246, 190, 198, 240, 82, 196, 61, 147, - 81, 173, 252, 125, 129, 225, 160, 72, 120, 54, 162, 150, 249, 174, 194, 252, - 81, 129, 252, 96, 65, 232, 48, 78, 148, 52, 111, 87, 108, 62, 173, 208, - 125, 156, 33, 169, 216, 126, 218, 160, 91, 56, 59, 82, 147, 125, 173, 225, - 189, 136, 113, 166, 164, 122, 251, 99, 3, 105, 193, 238, 208, 76, 92, 53, - 249, 215, 2, 222, 129, 152, 96, 106, 168, 47, 62, 156, 16, 105, 204, 46, - 213, 220, 95, 25, 248, 10, 194, 135, 17, 162, 140, 121, 165, 226, 251, 9, - 131, 70, 225, 242, 200, 69, 150, 179, 46, 245, 220, 71, 25, 242, 138, 197, - 167, 19, 58, 141, 211, 37, 157, 219, 41, 155, 94, 235, 120, 79, 98, 180, - 41, 183, 94, 246, 184, 70, 242, 178, 197, 181, 147, 55, 45, 214, 157, 158, - 233, 168, 78, 254, 180, 64, 119, 112, 38, 164, 26, 251, 75, 3, 119, 65, - 230, 176, 74, 244, 55, 7, 86, 130, 190, 225, 176, 72, 116, 54, 167, 86, - 250, 190, 195, 48, 81, 212, 60, 95, 81, 248, 60, 66, 145, 241, 172, 68, - 125, 243, 97, 133, 232, 99, 14, 169, 196, 126, 211, 96, 93, 232, 57, 142, - 146, 228, 109, 139, 109, 167, 109, 186, 173, 179, 61, 181, 209, 183, 28, 118, - 137, 230, 230, 202, 202, 215, 23, 30, 142, 136, 100, 102, 171, 106, 255, 111, - 0, 44, 0, 29, 192, 9, 144, 6, 236, 2, 205, 193, 149, 144, 111, 44, - 44, 29, 221, 201, 153, 150, 234, 238, 207, 12, 84, 5, 255, 67, 0, 49, - 192, 20, 80, 15, 124, 4, 33, 195, 88, 81, 250, 188, 67, 49, 241, 212, - 68, 95, 115, 120, 37, 226, 155, 9, 171, 70, 255, 114, 192, 37, 144, 27, - 44, 11, 93, 199, 121, 146, 162, 237, 185, 141, 178, 229, 181, 139, 55, 39, - 86, 154, 190, 235, 48, 79, 84, 52, 63, 87, 80, 62, 188, 16, 113, 204, - 36, 85, 219, 127, 27, 96, 11, 104, 7, 110, 130, 172, 97, 189, 232, 113, - 142, 164, 100, 123, 107, 99, 111, 105, 236, 46, 205, 220, 85, 153, 255, 42, - 192, 31, 16, 8, 12, 6, 133, 194, 227, 17, 137, 204, 102, 213, 234, 223, - 15, 24, 4, 10, 131, 71, 33, 242, 152, 69, 170, 179, 63, 53, 208, 23, - 28, 14, 137, 196, 102, 211, 106, 221, 239, 25, 140, 10, 229, 199, 11, 18, - 135, 77, 162, 181, 185, 183, 50, 246, 149, 134, 239, 34, 204, 25, 149, 202, - 239, 23, 12, 14, 133, 196, 99, 19, 105, 205, 238, 213, 140, 95, 37, 248, - 27, 2, 139, 65, 167, 112, 122, 164, 35, 59, 89, 211, 122, 221, 227, 25, - 137, 202, 230, 215, 10, 222, 135, 24, 98, 138, 169, 167, 62, 250, 144, 67, - 44, 49, 221, 212, 89, 159, 122, 232, 35, 14, 153, 196, 106, 211, 111, 29, - 236, 9, 141, 198, 229, 146, 203, 45, 151, 93, 174, 185, 188, 114, 241, 229, - 132, 75, 35, 119, 89, 230, 186, 202, 243, 23, 5, 206, 131, 20, 97, 207, - 104, 84, 46, 191, 92, 112, 57, 228, 18, 203, 77, 151, 117, 174, 167, 60, - 122, 145, 227, 44, 73, 221, 246, 217, 134, 218, 226, 219, 9, 155, 70, 235, - 114, 207, 101, 148, 43, 47, 95, 92, 56, 57, 210, 146, 221, 173, 153, 189, - 170, 241, 191, 4, 112, 3, 100, 1, 235, 64, 79, 112, 52, 36, 23, 91, - 78, 187, 116, 115, 103, 101, 234, 171, 15, 63, 68, 16, 51, 76, 21, 245, - 207, 7, 20, 2, 143, 65, 164, 48, 123, 84, 35, 127, 89, 224, 58, 200, - 19, 22, 141, 206, 229, 148, 75, 47, 119, 92, 38, 185, 218, 242, 219, 5, - 155, 67, 43, 113, 223, 100, 88, 43, 122, 159, 99, 40, 41, 222, 158, 216, - 104, 90, 174, 187, 60, 115, 81, 229, 252, 75, 1, 247, 64, 70, 176, 50, - 244, 21, 135, 79, 34, 180, 25, 183, 74, 246, 183, 6, 246, 130, 198, 225, - 146, 200, 109, 150, 173, 174, 253, 188, 65, 177, 240, 116, 68, 39, 115, 90, - 165, 251, 59, 3, 83, 65, 253, 240, 65, 132, 48, 99, 84, 41, 255, 94, - 192, 56, 80, 18, 188, 13, 177, 197, 180, 83, 55, 125, 214, 161, 158, 248, - 104, 66, 174, 177, 188, 116, 113, 231, 100, 74, 171, 119, 63, 102, 144, 42, - 236, 31, 13, 200, 5, 150, 131, 46, 225, 220, 72, 89, 246, 186, 198, 243, - 18, 197, 205, 147, 21, 173, 207, 61, 148, 17, 175, 76, 124, 53, 225, 215, - 8, 94, 134, 184, 98, 242, 169, 133, 190, 227, 48, 73, 212, 54, 223, 86, - 216, 62, 218, 144, 91, 44, 59, 93, 211, 121, 157, 226, 233, 137, 142, 230, - 228, 74, 203, 119, 23, 102, 142, 170, 228, 127, 11, 96, 7, 104, 2, 174, - 129, 188, 96, 113, 232, 36, 78, 155, 116, 107, 103, 111, 106, 172, 47, 61, - 220, 17, 153, 204, 106, 213, 239, 31, 12, 8, 5, 198, 131, 18, 225, 205, - 136, 85, 166, 191, 58, 240, 19, 4, 13, 195, 69, 145, 243, 44, 69, 221, - 243, 25, 133, 202, 227, 23, 9, 206, 134, 212, 98, 223, 105, 152, 46, 234, - 156, 79, 41, 244, 30, 199, 72, 82, 182, 189, 182, 241, 182, 196, 118, 211, - 102, 221, 234, 217, 143, 26, 228, 11, 11, 71, 71, 114, 178, 165, 181, 187, - 55, 51, 86, 149, 254, 239, 0, 76, 0, 53, 192, 23, 16, 14, 140, 4, - 101, 195, 107, 17, 239, 76, 76, 53, 245, 215, 7, 30, 130, 136, 97, 166, - 168, 122, 254, 163, 0, 121, 192, 34, 208, 25, 156, 10, 233, 199, 14, 210, - 132, 93, 163, 121, 185, 226, 242, 201, 133, 150, 227, 46, 201, 220, 86, 217, - 254, 218, 192, 91, 16, 59, 76, 19, 117, 205, 231, 21, 138, 143, 39, 36, - 26, 155, 75, 43, 119, 95, 102, 184, 42, 242, 159, 5, 168, 3, 62, 129, - 208, 96, 92, 40, 57, 222, 146, 216, 109, 154, 173, 171, 61, 191, 81, 176, - 60, 116, 17, 231, 76, 74, 181, 247, 55, 6, 150, 130, 238, 225, 140, 72, - 101, 246, 171, 6, 255, 66, 192, 49, 144, 20, 108, 15, 109, 196, 45, 147, - 93, 173, 249, 189, 130, 241, 161, 132, 120, 99, 98, 169, 233, 190, 206, 240, - 84, 68, 63, 115, 80, 37, 252, 27, 1, 203, 64, 87, 112, 62, 164, 16, - 123, 76, 35, 117, 217, 231, 26, 202, 139, 23, 39, 78, 154, 180, 107, 55, - 111, 86, 172, 62, 253, 208, 65, 156, 48, 105, 212, 46, 223, 92, 88, 57, - 250, 146, 195, 45, 145, 221, 172, 89, 189, 250, 241, 131, 4, 97, 195, 104, - 81, 238, 188, 76, 113, 245, 228, 71, 11, 114, 135, 101, 162, 171, 57, 191, - 82, 240, 61, 132, 17, 163, 76, 121, 245, 226, 199, 9, 146, 134, 237, 162, - 205, 185, 149, 178, 239, 53, 140, 23, 37, 206, 155, 20, 107, 79, 111, 116, - 44, 39, 93, 218, 185, 155, 50, 235, 85, 143, 127, 36, 32, 27, 88, 11, - 122, 135, 99, 34, 169, 217, 190, 218, 240, 91, 4, 59, 67, 83, 113, 253, - 228, 65, 139, 112, 103, 100, 42, 171, 95, 63, 120, 16, 34, 140, 25, 165, - 202, 251, 23, 3, 78, 129, 244, 96, 71, 104, 50, 174, 149, 188, 111, 49, - 236, 20, 77, 207, 117, 148, 39, 47, 90, 156, 59, 41, 211, 94, 221, 248, - 89, 130, 186, 225, 179, 8, 117, 198, 167, 18, 250, 141, 131, 37, 161, 219, - 56, 91, 82, 187, 125, 179, 97, 181, 232, 119, 14, 166, 132, 122, 227, 99, - 9, 233, 198, 206, 210, 212, 93, 159, 121, 168, 34, 254, 153, 128, 106, 224, - 47, 8, 28, 6, 137, 194, 230, 209, 138, 220, 103, 25, 234, 138, 207, 39, - 20, 26, 143, 75, 36, 55, 91, 86, 187, 126, 243, 96, 69, 232, 51, 14, - 149, 196, 111, 19, 108, 13, 237, 197, 141, 147, 37, 173, 219, 61, 155, 81, - 171, 124, 127, 97, 224, 40, 72, 30, 182, 136, 118, 230, 166, 202, 250, 215, - 3, 30, 129, 200, 96, 86, 168, 62, 254, 144, 64, 108, 48, 45, 212, 29, - 159, 73, 168, 54, 254, 150, 192, 110, 208, 44, 92, 29, 249, 201, 130, 214, - 225, 158, 200, 104, 86, 174, 190, 252, 112, 65, 228, 48, 75, 84, 55, 127, - 86, 160, 62, 248, 16, 66, 140, 49, 165, 212, 123, 31, 99, 72, 41, 246, - 158, 198, 232, 82, 206, 189, 148, 113, 175, 100, 124, 43, 97, 223, 104, 88, - 46, 186, 156, 115, 41, 229, 222, 203, 24, 87, 74, 190, 183, 48, 118, 148, - 38, 239, 90, 204, 59, 21, 211, 79, 29, 244, 9, 135, 70, 226, 178, 201, - 181, 150, 247, 46, 198, 156, 82, 233, 253, 142, 193, 164, 80, 123, 124, 35, - 97, 217, 232, 90, 206, 187, 20, 115, 79, 101, 244, 43, 7, 95, 66, 184, - 49, 178, 148, 117, 175, 103, 60, 42, 145, 223, 44, 88, 29, 250, 137, 131, - 38, 225, 218, 200, 91, 22, 187, 78, 243, 116, 69, 231, 115, 10, 165, 199, - 59, 18, 147, 77, 173, 245, 189, 135, 49, 162, 148, 121, 175, 98, 252, 41, - 129, 222, 224, 88, 72, 58, 182, 147, 54, 237, 214, 205, 158, 213, 168, 95, - 62, 184, 16, 114, 140, 37, 165, 219, 59, 27, 83, 75, 125, 247, 97, 134, - 168, 98, 254, 169, 128, 126, 224, 32, 72, 24, 54, 138, 150, 231, 46, 202, - 156, 87, 41, 254, 158, 192, 104, 80, 46, 188, 28, 113, 201, 228, 86, 203, - 126, 215, 96, 94, 168, 56, 126, 146, 160, 109, 184, 45, 178, 157, 181, 169, - 183, 62, 246, 144, 70, 236, 50, 205, 213, 149, 159, 47, 40, 28, 30, 137, - 200, 102, 214, 170, 222, 255, 24, 64, 10, 176, 7, 52, 2, 151, 65, 174, - 176, 124, 116, 33, 231, 88, 74, 186, 183, 51, 54, 149, 214, 239, 30, 204, - 8, 85, 198, 191, 18, 240, 13, 132, 5, 163, 67, 57, 241, 210, 196, 93, - 147, 121, 173, 226, 253, 137, 129, 166, 224, 122, 200, 35, 22, 153, 206, 234, - 212, 79, 31, 116, 8, 39, 70, 154, 178, 235, 53, 143, 87, 36, 62, 155, - 80, 107, 124, 47, 97, 220, 40, 89, 222, 186, 216, 115, 26, 165, 203, 59, - 23, 83, 78, 189, 244, 113, 135, 100, 98, 171, 105, 191, 110, 240, 44, 68, - 29, 243, 73, 133, 246, 227, 6, 201, 194, 214, 209, 158, 220, 104, 89, 238, - 186, 204, 115, 21, 229, 207, 11, 20, 7, 79, 66, 180, 49, 183, 84, 118, - 191, 102, 240, 42, 196, 31, 19, 72, 13, 246, 133, 134, 227, 34, 201, 217, - 150, 218, 238, 219, 12, 91, 69, 251, 115, 3, 101, 193, 235, 16, 79, 76, - 52, 53, 215, 87, 30, 190, 136, 112, 102, 164, 42, 251, 95, 3, 120, 1, - 226, 128, 73, 160, 54, 248, 22, 194, 142, 209, 164, 92, 123, 121, 227, 98, - 201, 233, 150, 206, 238, 212, 76, 95, 117, 248, 39, 2, 154, 129, 171, 32, - 127, 88, 32, 58, 152, 19, 42, 141, 223, 37, 152, 27, 42, 139, 95, 39, - 120, 26, 162, 139, 57, 167, 82, 250, 189, 131, 49, 161, 212, 120, 95, 98, - 184, 41, 178, 158, 245, 168, 71, 62, 178, 144, 117, 172, 39, 61, 218, 145, - 155, 44, 107, 93, 239, 121, 140, 34, 229, 217, 139, 26, 231, 75, 10, 183, - 71, 54, 178, 150, 245, 174, 199, 60, 82, 145, 253, 172, 65, 189, 240, 113, - 132, 36, 99, 91, 105, 251, 110, 195, 108, 81, 237, 252, 77, 129, 245, 160, - 71, 56, 50, 146, 149, 173, 175, 61, 188, 17, 177, 204, 116, 85, 231, 127, - 10, 160, 7, 56, 2, 146, 129, 173, 160, 125, 184, 33, 178, 152, 117, 170, - 167, 63, 58, 144, 19, 44, 13, 221, 197, 153, 147, 42, 237, 223, 13, 152, - 5, 170, 131, 63, 33, 208, 24, 92, 10, 185, 199, 50, 210, 149, 157, 175, - 41, 188, 30, 241, 200, 68, 86, 179, 126, 245, 224, 71, 8, 50, 134, 149, - 162, 239, 57, 140, 18, 229, 205, 139, 21, 167, 79, 58, 180, 19, 55, 77, - 214, 181, 158, 247, 40, 70, 158, 178, 232, 117, 142, 167, 36, 122, 155, 99, - 43, 105, 223, 110, 216, 44, 90, 157, 251, 41, 131, 94, 225, 248, 72, 66, - 182, 177, 182, 244, 118, 199, 102, 210, 170, 221, 191, 25, 176, 10, 244, 7, - 7, 66, 130, 177, 161, 180, 120, 119, 98, 166, 169, 186, 254, 243, 0, 69, - 192, 51, 16, 21, 204, 15, 21, 196, 15, 19, 68, 13, 243, 69, 133, 243, - 35, 5, 217, 195, 26, 209, 203, 28, 87, 73, 254, 182, 192, 118, 208, 38, - 220, 26, 217, 203, 26, 215, 75, 30, 183, 72, 118, 182, 166, 246, 250, 198, - 195, 18, 209, 205, 156, 85, 169, 255, 62, 192, 16, 80, 12, 60, 5, 209, - 195, 28, 81, 201, 252, 86, 193, 254, 208, 64, 92, 48, 57, 212, 18, 223, - 77, 152, 53, 170, 151, 63, 46, 144, 28, 108, 9, 237, 198, 205, 146, 213, - 173, 159, 61, 168, 17, 190, 140, 112, 101, 228, 43, 11, 95, 71, 120, 50, - 162, 149, 185, 175, 50, 252, 21, 129, 207, 32, 84, 24, 63, 74, 144, 55, - 44, 22, 157, 206, 233, 148, 78, 239, 116, 76, 39, 117, 218, 167, 27, 58, - 139, 83, 39, 125, 218, 161, 155, 56, 107, 82, 175, 125, 188, 33, 177, 216, - 116, 90, 167, 123, 58, 163, 83, 57, 253, 210, 193, 157, 144, 105, 172, 46, - 253, 220, 65, 153, 240, 106, 196, 47, 19, 92, 13, 249, 197, 130, 211, 33, - 157, 216, 105, 154, 174, 235, 60, 79, 81, 244, 60, 71, 81, 242, 188, 69, - 177, 243, 52, 69, 215, 115, 30, 165, 200, 123, 22, 163, 78, 249, 244, 66, - 199, 113, 146, 164, 109, 187, 109, 179, 109, 181, 237, 183, 13, 182, 133, 182, - 227, 54, 201, 214, 214, 222, 222, 216, 88, 90, 186, 187, 51, 51, 255, 63 ) - -random_mask_vec8 = numpy.array(random_mask_tuple, numpy.uint8) - diff --git a/gr-digital/python/ofdm_receiver.py b/gr-digital/python/ofdm_receiver.py deleted file mode 100644 index 9d4d6e559..000000000 --- a/gr-digital/python/ofdm_receiver.py +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006, 2007, 2008 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. -# - -import math -from numpy import fft -from gnuradio import gr - -import digital_swig -from ofdm_sync_pn import ofdm_sync_pn -from ofdm_sync_fixed import ofdm_sync_fixed -from ofdm_sync_pnac import ofdm_sync_pnac -from ofdm_sync_ml import ofdm_sync_ml - -class ofdm_receiver(gr.hier_block2): - """ - Performs receiver synchronization on OFDM symbols. - - The receiver performs channel filtering as well as symbol, frequency, and phase synchronization. - The synchronization routines are available in three flavors: preamble correlator (Schmidl and Cox), - modifid preamble correlator with autocorrelation (not yet working), and cyclic prefix correlator - (Van de Beeks). - """ - - def __init__(self, fft_length, cp_length, occupied_tones, snr, ks, logging=False): - """ - Hierarchical block for receiving OFDM symbols. - - The input is the complex modulated signal at baseband. - Synchronized packets are sent back to the demodulator. - - @param fft_length: total number of subcarriers - @type fft_length: int - @param cp_length: length of cyclic prefix as specified in subcarriers (<= fft_length) - @type cp_length: int - @param occupied_tones: number of subcarriers used for data - @type occupied_tones: int - @param snr: estimated signal to noise ratio used to guide cyclic prefix synchronizer - @type snr: float - @param ks: known symbols used as preambles to each packet - @type ks: list of lists - @param logging: turn file logging on or off - @type logging: bool - """ - - gr.hier_block2.__init__(self, "ofdm_receiver", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature2(2, 2, gr.sizeof_gr_complex*occupied_tones, gr.sizeof_char)) # Output signature - - bw = (float(occupied_tones) / float(fft_length)) / 2.0 - tb = bw*0.08 - chan_coeffs = gr.firdes.low_pass (1.0, # gain - 1.0, # sampling rate - bw+tb, # midpoint of trans. band - tb, # width of trans. band - gr.firdes.WIN_HAMMING) # filter type - self.chan_filt = gr.fft_filter_ccc(1, chan_coeffs) - - win = [1 for i in range(fft_length)] - - zeros_on_left = int(math.ceil((fft_length - occupied_tones)/2.0)) - ks0 = fft_length*[0,] - ks0[zeros_on_left : zeros_on_left + occupied_tones] = ks[0] - - ks0 = fft.ifftshift(ks0) - ks0time = fft.ifft(ks0) - # ADD SCALING FACTOR - ks0time = ks0time.tolist() - - SYNC = "pn" - if SYNC == "ml": - nco_sensitivity = -1.0/fft_length # correct for fine frequency - self.ofdm_sync = ofdm_sync_ml(fft_length, - cp_length, - snr, - ks0time, - logging) - elif SYNC == "pn": - nco_sensitivity = -2.0/fft_length # correct for fine frequency - self.ofdm_sync = ofdm_sync_pn(fft_length, - cp_length, - logging) - elif SYNC == "pnac": - nco_sensitivity = -2.0/fft_length # correct for fine frequency - self.ofdm_sync = ofdm_sync_pnac(fft_length, - cp_length, - ks0time, - logging) - # for testing only; do not user over the air - # remove filter and filter delay for this - elif SYNC == "fixed": - self.chan_filt = gr.multiply_const_cc(1.0) - nsymbols = 18 # enter the number of symbols per packet - freq_offset = 0.0 # if you use a frequency offset, enter it here - nco_sensitivity = -2.0/fft_length # correct for fine frequency - self.ofdm_sync = ofdm_sync_fixed(fft_length, - cp_length, - nsymbols, - freq_offset, - logging) - - # Set up blocks - - self.nco = gr.frequency_modulator_fc(nco_sensitivity) # generate a signal proportional to frequency error of sync block - self.sigmix = gr.multiply_cc() - self.sampler = digital_swig.ofdm_sampler(fft_length, fft_length+cp_length) - self.fft_demod = gr.fft_vcc(fft_length, True, win, True) - self.ofdm_frame_acq = digital_swig.ofdm_frame_acquisition(occupied_tones, - fft_length, - cp_length, ks[0]) - - self.connect(self, self.chan_filt) # filter the input channel - self.connect(self.chan_filt, self.ofdm_sync) # into the synchronization alg. - self.connect((self.ofdm_sync,0), self.nco, (self.sigmix,1)) # use sync freq. offset output to derotate input signal - self.connect(self.chan_filt, (self.sigmix,0)) # signal to be derotated - self.connect(self.sigmix, (self.sampler,0)) # sample off timing signal detected in sync alg - self.connect((self.ofdm_sync,1), (self.sampler,1)) # timing signal to sample at - - self.connect((self.sampler,0), self.fft_demod) # send derotated sampled signal to FFT - self.connect(self.fft_demod, (self.ofdm_frame_acq,0)) # find frame start and equalize signal - self.connect((self.sampler,1), (self.ofdm_frame_acq,1)) # send timing signal to signal frame start - self.connect((self.ofdm_frame_acq,0), (self,0)) # finished with fine/coarse freq correction, - self.connect((self.ofdm_frame_acq,1), (self,1)) # frame and symbol timing, and equalization - - if logging: - self.connect(self.chan_filt, gr.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-chan_filt_c.dat")) - self.connect(self.fft_demod, gr.file_sink(gr.sizeof_gr_complex*fft_length, "ofdm_receiver-fft_out_c.dat")) - self.connect(self.ofdm_frame_acq, - gr.file_sink(gr.sizeof_gr_complex*occupied_tones, "ofdm_receiver-frame_acq_c.dat")) - self.connect((self.ofdm_frame_acq,1), gr.file_sink(1, "ofdm_receiver-found_corr_b.dat")) - self.connect(self.sampler, gr.file_sink(gr.sizeof_gr_complex*fft_length, "ofdm_receiver-sampler_c.dat")) - self.connect(self.sigmix, gr.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-sigmix_c.dat")) - self.connect(self.nco, gr.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-nco_c.dat")) diff --git a/gr-digital/python/ofdm_sync_fixed.py b/gr-digital/python/ofdm_sync_fixed.py deleted file mode 100644 index 9bac789bf..000000000 --- a/gr-digital/python/ofdm_sync_fixed.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007 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. -# - -import math -from gnuradio import gr - -class ofdm_sync_fixed(gr.hier_block2): - def __init__(self, fft_length, cp_length, nsymbols, freq_offset, logging=False): - - gr.hier_block2.__init__(self, "ofdm_sync_fixed", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature - - # Use a fixed trigger point instead of sync block - symbol_length = fft_length + cp_length - pkt_length = nsymbols*symbol_length - data = (pkt_length)*[0,] - data[(symbol_length)-1] = 1 - self.peak_trigger = gr.vector_source_b(data, True) - - # Use a pre-defined frequency offset - foffset = (pkt_length)*[math.pi*freq_offset,] - self.frequency_offset = gr.vector_source_f(foffset, True) - - self.connect(self, gr.null_sink(gr.sizeof_gr_complex)) - self.connect(self.frequency_offset, (self,0)) - self.connect(self.peak_trigger, (self,1)) - - if logging: - self.connect(self.peak_trigger, gr.file_sink(gr.sizeof_char, "ofdm_sync_fixed-peaks_b.dat")) - diff --git a/gr-digital/python/ofdm_sync_ml.py b/gr-digital/python/ofdm_sync_ml.py deleted file mode 100644 index 7c75d7f1d..000000000 --- a/gr-digital/python/ofdm_sync_ml.py +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2008 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. -# - -import math -from gnuradio import gr - -class ofdm_sync_ml(gr.hier_block2): - def __init__(self, fft_length, cp_length, snr, kstime, logging): - ''' Maximum Likelihood OFDM synchronizer: - J. van de Beek, M. Sandell, and P. O. Borjesson, "ML Estimation - of Time and Frequency Offset in OFDM Systems," IEEE Trans. - Signal Processing, vol. 45, no. 7, pp. 1800-1805, 1997. - ''' - - gr.hier_block2.__init__(self, "ofdm_sync_ml", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature - - self.input = gr.add_const_cc(0) - - SNR = 10.0**(snr/10.0) - rho = SNR / (SNR + 1.0) - symbol_length = fft_length + cp_length - - # ML Sync - - # Energy Detection from ML Sync - - self.connect(self, self.input) - - # Create a delay line - self.delay = gr.delay(gr.sizeof_gr_complex, fft_length) - self.connect(self.input, self.delay) - - # magnitude squared blocks - self.magsqrd1 = gr.complex_to_mag_squared() - self.magsqrd2 = gr.complex_to_mag_squared() - self.adder = gr.add_ff() - - moving_sum_taps = [rho/2 for i in range(cp_length)] - self.moving_sum_filter = gr.fir_filter_fff(1,moving_sum_taps) - - self.connect(self.input,self.magsqrd1) - self.connect(self.delay,self.magsqrd2) - self.connect(self.magsqrd1,(self.adder,0)) - self.connect(self.magsqrd2,(self.adder,1)) - self.connect(self.adder,self.moving_sum_filter) - - - # Correlation from ML Sync - self.conjg = gr.conjugate_cc(); - self.mixer = gr.multiply_cc(); - - movingsum2_taps = [1.0 for i in range(cp_length)] - self.movingsum2 = gr.fir_filter_ccf(1,movingsum2_taps) - - # Correlator data handler - self.c2mag = gr.complex_to_mag() - self.angle = gr.complex_to_arg() - self.connect(self.input,(self.mixer,1)) - self.connect(self.delay,self.conjg,(self.mixer,0)) - self.connect(self.mixer,self.movingsum2,self.c2mag) - self.connect(self.movingsum2,self.angle) - - # ML Sync output arg, need to find maximum point of this - self.diff = gr.sub_ff() - self.connect(self.c2mag,(self.diff,0)) - self.connect(self.moving_sum_filter,(self.diff,1)) - - #ML measurements input to sampler block and detect - self.f2c = gr.float_to_complex() - self.pk_detect = gr.peak_detector_fb(0.2, 0.25, 30, 0.0005) - self.sample_and_hold = gr.sample_and_hold_ff() - - # use the sync loop values to set the sampler and the NCO - # self.diff = theta - # self.angle = epsilon - - self.connect(self.diff, self.pk_detect) - - # The DPLL corrects for timing differences between CP correlations - use_dpll = 0 - if use_dpll: - self.dpll = gr.dpll_bb(float(symbol_length),0.01) - self.connect(self.pk_detect, self.dpll) - self.connect(self.dpll, (self.sample_and_hold,1)) - else: - self.connect(self.pk_detect, (self.sample_and_hold,1)) - - self.connect(self.angle, (self.sample_and_hold,0)) - - ################################ - # correlate against known symbol - # This gives us the same timing signal as the PN sync block only on the preamble - # we don't use the signal generated from the CP correlation because we don't want - # to readjust the timing in the middle of the packet or we ruin the equalizer settings. - kstime = [k.conjugate() for k in kstime] - kstime.reverse() - self.kscorr = gr.fir_filter_ccc(1, kstime) - self.corrmag = gr.complex_to_mag_squared() - self.div = gr.divide_ff() - - # The output signature of the correlation has a few spikes because the rest of the - # system uses the repeated preamble symbol. It needs to work that generically if - # anyone wants to use this against a WiMAX-like signal since it, too, repeats. - # The output theta of the correlator above is multiplied with this correlation to - # identify the proper peak and remove other products in this cross-correlation - self.threshold_factor = 0.1 - self.slice = gr.threshold_ff(self.threshold_factor, self.threshold_factor, 0) - self.f2b = gr.float_to_char() - self.b2f = gr.char_to_float() - self.mul = gr.multiply_ff() - - # Normalize the power of the corr output by the energy. This is not really needed - # and could be removed for performance, but it makes for a cleaner signal. - # if this is removed, the threshold value needs adjustment. - self.connect(self.input, self.kscorr, self.corrmag, (self.div,0)) - self.connect(self.moving_sum_filter, (self.div,1)) - - self.connect(self.div, (self.mul,0)) - self.connect(self.pk_detect, self.b2f, (self.mul,1)) - self.connect(self.mul, self.slice) - - # Set output signals - # Output 0: fine frequency correction value - # Output 1: timing signal - self.connect(self.sample_and_hold, (self,0)) - self.connect(self.slice, self.f2b, (self,1)) - - - if logging: - self.connect(self.moving_sum_filter, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-energy_f.dat")) - self.connect(self.diff, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-theta_f.dat")) - self.connect(self.angle, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-epsilon_f.dat")) - self.connect(self.corrmag, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-corrmag_f.dat")) - self.connect(self.kscorr, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_ml-kscorr_c.dat")) - self.connect(self.div, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-div_f.dat")) - self.connect(self.mul, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-mul_f.dat")) - self.connect(self.slice, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-slice_f.dat")) - self.connect(self.pk_detect, gr.file_sink(gr.sizeof_char, "ofdm_sync_ml-peaks_b.dat")) - if use_dpll: - self.connect(self.dpll, gr.file_sink(gr.sizeof_char, "ofdm_sync_ml-dpll_b.dat")) - - self.connect(self.sample_and_hold, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-sample_and_hold_f.dat")) - self.connect(self.input, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_ml-input_c.dat")) - diff --git a/gr-digital/python/ofdm_sync_pn.py b/gr-digital/python/ofdm_sync_pn.py deleted file mode 100644 index 05b1de2e1..000000000 --- a/gr-digital/python/ofdm_sync_pn.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2008 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. -# - -import math -from numpy import fft -from gnuradio import gr - -class ofdm_sync_pn(gr.hier_block2): - def __init__(self, fft_length, cp_length, logging=False): - """ - OFDM synchronization using PN Correlation: - T. M. Schmidl and D. C. Cox, "Robust Frequency and Timing - Synchonization for OFDM," IEEE Trans. Communications, vol. 45, - no. 12, 1997. - """ - - gr.hier_block2.__init__(self, "ofdm_sync_pn", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature - - self.input = gr.add_const_cc(0) - - # PN Sync - - # Create a delay line - self.delay = gr.delay(gr.sizeof_gr_complex, fft_length/2) - - # Correlation from ML Sync - self.conjg = gr.conjugate_cc(); - self.corr = gr.multiply_cc(); - - # Create a moving sum filter for the corr output - if 1: - moving_sum_taps = [1.0 for i in range(fft_length//2)] - self.moving_sum_filter = gr.fir_filter_ccf(1,moving_sum_taps) - else: - moving_sum_taps = [complex(1.0,0.0) for i in range(fft_length//2)] - self.moving_sum_filter = gr.fft_filter_ccc(1,moving_sum_taps) - - # Create a moving sum filter for the input - self.inputmag2 = gr.complex_to_mag_squared() - movingsum2_taps = [1.0 for i in range(fft_length//2)] - - if 1: - self.inputmovingsum = gr.fir_filter_fff(1,movingsum2_taps) - else: - self.inputmovingsum = gr.fft_filter_fff(1,movingsum2_taps) - - self.square = gr.multiply_ff() - self.normalize = gr.divide_ff() - - # Get magnitude (peaks) and angle (phase/freq error) - self.c2mag = gr.complex_to_mag_squared() - self.angle = gr.complex_to_arg() - - self.sample_and_hold = gr.sample_and_hold_ff() - - #ML measurements input to sampler block and detect - self.sub1 = gr.add_const_ff(-1) - self.pk_detect = gr.peak_detector_fb(0.20, 0.20, 30, 0.001) - #self.pk_detect = gr.peak_detector2_fb(9) - - self.connect(self, self.input) - - # Calculate the frequency offset from the correlation of the preamble - self.connect(self.input, self.delay) - self.connect(self.input, (self.corr,0)) - self.connect(self.delay, self.conjg) - self.connect(self.conjg, (self.corr,1)) - self.connect(self.corr, self.moving_sum_filter) - self.connect(self.moving_sum_filter, self.c2mag) - self.connect(self.moving_sum_filter, self.angle) - self.connect(self.angle, (self.sample_and_hold,0)) - - # Get the power of the input signal to normalize the output of the correlation - self.connect(self.input, self.inputmag2, self.inputmovingsum) - self.connect(self.inputmovingsum, (self.square,0)) - self.connect(self.inputmovingsum, (self.square,1)) - self.connect(self.square, (self.normalize,1)) - self.connect(self.c2mag, (self.normalize,0)) - - # Create a moving sum filter for the corr output - matched_filter_taps = [1.0/cp_length for i in range(cp_length)] - self.matched_filter = gr.fir_filter_fff(1,matched_filter_taps) - self.connect(self.normalize, self.matched_filter) - - self.connect(self.matched_filter, self.sub1, self.pk_detect) - #self.connect(self.matched_filter, self.pk_detect) - self.connect(self.pk_detect, (self.sample_and_hold,1)) - - # Set output signals - # Output 0: fine frequency correction value - # Output 1: timing signal - self.connect(self.sample_and_hold, (self,0)) - self.connect(self.pk_detect, (self,1)) - - if logging: - self.connect(self.matched_filter, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-mf_f.dat")) - self.connect(self.normalize, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-theta_f.dat")) - self.connect(self.angle, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-epsilon_f.dat")) - self.connect(self.pk_detect, gr.file_sink(gr.sizeof_char, "ofdm_sync_pn-peaks_b.dat")) - self.connect(self.sample_and_hold, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-sample_and_hold_f.dat")) - self.connect(self.input, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_pn-input_c.dat")) - diff --git a/gr-digital/python/ofdm_sync_pnac.py b/gr-digital/python/ofdm_sync_pnac.py deleted file mode 100644 index 10a125964..000000000 --- a/gr-digital/python/ofdm_sync_pnac.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007 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. -# - -import math -from numpy import fft -from gnuradio import gr - -class ofdm_sync_pnac(gr.hier_block2): - def __init__(self, fft_length, cp_length, kstime, logging=False): - """ - OFDM synchronization using PN Correlation and initial cross-correlation: - F. Tufvesson, O. Edfors, and M. Faulkner, "Time and Frequency Synchronization for OFDM using - PN-Sequency Preambles," IEEE Proc. VTC, 1999, pp. 2203-2207. - - This implementation is meant to be a more robust version of the Schmidl and Cox receiver design. - By correlating against the preamble and using that as the input to the time-delayed correlation, - this circuit produces a very clean timing signal at the end of the preamble. The timing is - more accurate and does not have the problem associated with determining the timing from the - plateau structure in the Schmidl and Cox. - - This implementation appears to require that the signal is received with a normalized power or signal - scalling factor to reduce ambiguities intorduced from partial correlation of the cyclic prefix and - the peak detection. A better peak detection block might fix this. - - Also, the cross-correlation falls apart as the frequency offset gets larger and completely fails - when an integer offset is introduced. Another thing to look at. - """ - - gr.hier_block2.__init__(self, "ofdm_sync_pnac", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature - - - self.input = gr.add_const_cc(0) - - symbol_length = fft_length + cp_length - - # PN Sync with cross-correlation input - - # cross-correlate with the known symbol - kstime = [k.conjugate() for k in kstime[0:fft_length//2]] - kstime.reverse() - self.crosscorr_filter = gr.fir_filter_ccc(1, kstime) - - # Create a delay line - self.delay = gr.delay(gr.sizeof_gr_complex, fft_length/2) - - # Correlation from ML Sync - self.conjg = gr.conjugate_cc(); - self.corr = gr.multiply_cc(); - - # Create a moving sum filter for the input - self.mag = gr.complex_to_mag_squared() - movingsum_taps = (fft_length//1)*[1.0,] - self.power = gr.fir_filter_fff(1,movingsum_taps) - - # Get magnitude (peaks) and angle (phase/freq error) - self.c2mag = gr.complex_to_mag_squared() - self.angle = gr.complex_to_arg() - self.compare = gr.sub_ff() - - self.sample_and_hold = gr.sample_and_hold_ff() - - #ML measurements input to sampler block and detect - self.threshold = gr.threshold_ff(0,0,0) # threshold detection might need to be tweaked - self.peaks = gr.float_to_char() - - self.connect(self, self.input) - - # Cross-correlate input signal with known preamble - self.connect(self.input, self.crosscorr_filter) - - # use the output of the cross-correlation as input time-shifted correlation - self.connect(self.crosscorr_filter, self.delay) - self.connect(self.crosscorr_filter, (self.corr,0)) - self.connect(self.delay, self.conjg) - self.connect(self.conjg, (self.corr,1)) - self.connect(self.corr, self.c2mag) - self.connect(self.corr, self.angle) - self.connect(self.angle, (self.sample_and_hold,0)) - - # Get the power of the input signal to compare against the correlation - self.connect(self.crosscorr_filter, self.mag, self.power) - - # Compare the power to the correlator output to determine timing peak - # When the peak occurs, it peaks above zero, so the thresholder detects this - self.connect(self.c2mag, (self.compare,0)) - self.connect(self.power, (self.compare,1)) - self.connect(self.compare, self.threshold) - self.connect(self.threshold, self.peaks, (self.sample_and_hold,1)) - - # Set output signals - # Output 0: fine frequency correction value - # Output 1: timing signal - self.connect(self.sample_and_hold, (self,0)) - self.connect(self.peaks, (self,1)) - - if logging: - self.connect(self.compare, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-compare_f.dat")) - self.connect(self.c2mag, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-theta_f.dat")) - self.connect(self.power, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-inputpower_f.dat")) - self.connect(self.angle, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-epsilon_f.dat")) - self.connect(self.threshold, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-threshold_f.dat")) - self.connect(self.peaks, gr.file_sink(gr.sizeof_char, "ofdm_sync_pnac-peaks_b.dat")) - self.connect(self.sample_and_hold, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-sample_and_hold_f.dat")) - self.connect(self.input, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_pnac-input_c.dat")) diff --git a/gr-digital/python/packet_utils.py b/gr-digital/python/packet_utils.py deleted file mode 100644 index 2e216ff50..000000000 --- a/gr-digital/python/packet_utils.py +++ /dev/null @@ -1,457 +0,0 @@ -# -# Copyright 2005,2006,2007 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. -# - -import struct -import numpy -from gnuradio import gru -import crc - -def conv_packed_binary_string_to_1_0_string(s): - """ - '\xAF' --> '10101111' - """ - r = [] - for ch in s: - x = ord(ch) - for i in range(7,-1,-1): - t = (x >> i) & 0x1 - r.append(t) - - return ''.join(map(lambda x: chr(x + ord('0')), r)) - -def conv_1_0_string_to_packed_binary_string(s): - """ - '10101111' -> ('\xAF', False) - - Basically the inverse of conv_packed_binary_string_to_1_0_string, - but also returns a flag indicating if we had to pad with leading zeros - to get to a multiple of 8. - """ - if not is_1_0_string(s): - raise ValueError, "Input must be a string containing only 0's and 1's" - - # pad to multiple of 8 - padded = False - rem = len(s) % 8 - if rem != 0: - npad = 8 - rem - s = '0' * npad + s - padded = True - - assert len(s) % 8 == 0 - - r = [] - i = 0 - while i < len(s): - t = 0 - for j in range(8): - t = (t << 1) | (ord(s[i + j]) - ord('0')) - r.append(chr(t)) - i += 8 - return (''.join(r), padded) - - -default_access_code = \ - conv_packed_binary_string_to_1_0_string('\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC') -preamble = \ - conv_packed_binary_string_to_1_0_string('\xA4\xF2') - -def is_1_0_string(s): - if not isinstance(s, str): - return False - for ch in s: - if not ch in ('0', '1'): - return False - return True - -def string_to_hex_list(s): - return map(lambda x: hex(ord(x)), s) - - -def whiten(s, o): - sa = numpy.fromstring(s, numpy.uint8) - z = sa ^ random_mask_vec8[o:len(sa)+o] - return z.tostring() - -def dewhiten(s, o): - return whiten(s, o) # self inverse - - -def make_header(payload_len, whitener_offset=0): - # Upper nibble is offset, lower 12 bits is len - val = ((whitener_offset & 0xf) << 12) | (payload_len & 0x0fff) - #print "offset =", whitener_offset, " len =", payload_len, " val=", val - return struct.pack('!HH', val, val) - -def make_packet(payload, samples_per_symbol, bits_per_symbol, - access_code=default_access_code, pad_for_usrp=True, - whitener_offset=0, whitening=True): - """ - Build a packet, given access code, payload, and whitener offset - - @param payload: packet payload, len [0, 4096] - @param samples_per_symbol: samples per symbol (needed for padding calculation) - @type samples_per_symbol: int - @param bits_per_symbol: (needed for padding calculation) - @type bits_per_symbol: int - @param access_code: string of ascii 0's and 1's - @param whitener_offset offset into whitener string to use [0-16) - - Packet will have access code at the beginning, followed by length, payload - and finally CRC-32. - """ - if not is_1_0_string(access_code): - raise ValueError, "access_code must be a string containing only 0's and 1's (%r)" % (access_code,) - - if not whitener_offset >=0 and whitener_offset < 16: - raise ValueError, "whitener_offset must be between 0 and 15, inclusive (%i)" % (whitener_offset,) - - (packed_access_code, padded) = conv_1_0_string_to_packed_binary_string(access_code) - (packed_preamble, ignore) = conv_1_0_string_to_packed_binary_string(preamble) - - payload_with_crc = crc.gen_and_append_crc32(payload) - #print "outbound crc =", string_to_hex_list(payload_with_crc[-4:]) - - L = len(payload_with_crc) - MAXLEN = len(random_mask_tuple) - if L > MAXLEN: - raise ValueError, "len(payload) must be in [0, %d]" % (MAXLEN,) - - if whitening: - pkt = ''.join((packed_preamble, packed_access_code, make_header(L, whitener_offset), - whiten(payload_with_crc, whitener_offset), '\x55')) - else: - pkt = ''.join((packed_preamble, packed_access_code, make_header(L, whitener_offset), - (payload_with_crc), '\x55')) - - if pad_for_usrp: - pkt = pkt + (_npadding_bytes(len(pkt), int(samples_per_symbol), bits_per_symbol) * '\x55') - - #print "make_packet: len(pkt) =", len(pkt) - return pkt - -def _npadding_bytes(pkt_byte_len, samples_per_symbol, bits_per_symbol): - """ - Generate sufficient padding such that each packet ultimately ends - up being a multiple of 512 bytes when sent across the USB. We - send 4-byte samples across the USB (16-bit I and 16-bit Q), thus - we want to pad so that after modulation the resulting packet - is a multiple of 128 samples. - - @param ptk_byte_len: len in bytes of packet, not including padding. - @param samples_per_symbol: samples per bit (1 bit / symbolwidth GMSK) - @type samples_per_symbol: int - @param bits_per_symbol: bits per symbol (log2(modulation order)) - @type bits_per_symbol: int - - @returns number of bytes of padding to append. - """ - modulus = 128 - byte_modulus = gru.lcm(modulus/8, samples_per_symbol) * bits_per_symbol / samples_per_symbol - r = pkt_byte_len % byte_modulus - if r == 0: - return 0 - return byte_modulus - r - - -def unmake_packet(whitened_payload_with_crc, whitener_offset=0, dewhitening=True): - """ - Return (ok, payload) - - @param whitened_payload_with_crc: string - """ - - if dewhitening: - payload_with_crc = dewhiten(whitened_payload_with_crc, whitener_offset) - else: - payload_with_crc = (whitened_payload_with_crc) - - ok, payload = crc.check_crc32(payload_with_crc) - - if 0: - print "payload_with_crc =", string_to_hex_list(payload_with_crc) - print "ok = %r, len(payload) = %d" % (ok, len(payload)) - print "payload =", string_to_hex_list(payload) - - return ok, payload - - -# FYI, this PN code is the output of a 15-bit LFSR -random_mask_tuple = ( - 255, 63, 0, 16, 0, 12, 0, 5, 192, 3, 16, 1, 204, 0, 85, 192, - 63, 16, 16, 12, 12, 5, 197, 195, 19, 17, 205, 204, 85, 149, 255, 47, - 0, 28, 0, 9, 192, 6, 208, 2, 220, 1, 153, 192, 106, 208, 47, 28, - 28, 9, 201, 198, 214, 210, 222, 221, 152, 89, 170, 186, 255, 51, 0, 21, - 192, 15, 16, 4, 12, 3, 69, 193, 243, 16, 69, 204, 51, 21, 213, 207, - 31, 20, 8, 15, 70, 132, 50, 227, 85, 137, 255, 38, 192, 26, 208, 11, - 28, 7, 73, 194, 182, 209, 182, 220, 118, 217, 230, 218, 202, 219, 23, 27, - 78, 139, 116, 103, 103, 106, 170, 175, 63, 60, 16, 17, 204, 12, 85, 197, - 255, 19, 0, 13, 192, 5, 144, 3, 44, 1, 221, 192, 89, 144, 58, 236, - 19, 13, 205, 197, 149, 147, 47, 45, 220, 29, 153, 201, 170, 214, 255, 30, - 192, 8, 80, 6, 188, 2, 241, 193, 132, 80, 99, 124, 41, 225, 222, 200, - 88, 86, 186, 190, 243, 48, 69, 212, 51, 31, 85, 200, 63, 22, 144, 14, - 236, 4, 77, 195, 117, 145, 231, 44, 74, 157, 247, 41, 134, 158, 226, 232, - 73, 142, 182, 228, 118, 203, 102, 215, 106, 222, 175, 24, 124, 10, 161, 199, - 56, 82, 146, 189, 173, 177, 189, 180, 113, 183, 100, 118, 171, 102, 255, 106, - 192, 47, 16, 28, 12, 9, 197, 198, 211, 18, 221, 205, 153, 149, 170, 239, - 63, 12, 16, 5, 204, 3, 21, 193, 207, 16, 84, 12, 63, 69, 208, 51, - 28, 21, 201, 207, 22, 212, 14, 223, 68, 88, 51, 122, 149, 227, 47, 9, - 220, 6, 217, 194, 218, 209, 155, 28, 107, 73, 239, 118, 204, 38, 213, 218, - 223, 27, 24, 11, 74, 135, 119, 34, 166, 153, 186, 234, 243, 15, 5, 196, - 3, 19, 65, 205, 240, 85, 132, 63, 35, 80, 25, 252, 10, 193, 199, 16, - 82, 140, 61, 165, 209, 187, 28, 115, 73, 229, 246, 203, 6, 215, 66, 222, - 177, 152, 116, 106, 167, 111, 58, 172, 19, 61, 205, 209, 149, 156, 111, 41, - 236, 30, 205, 200, 85, 150, 191, 46, 240, 28, 68, 9, 243, 70, 197, 242, - 211, 5, 157, 195, 41, 145, 222, 236, 88, 77, 250, 181, 131, 55, 33, 214, - 152, 94, 234, 184, 79, 50, 180, 21, 183, 79, 54, 180, 22, 247, 78, 198, - 180, 82, 247, 125, 134, 161, 162, 248, 121, 130, 162, 225, 185, 136, 114, 230, - 165, 138, 251, 39, 3, 90, 129, 251, 32, 67, 88, 49, 250, 148, 67, 47, - 113, 220, 36, 89, 219, 122, 219, 99, 27, 105, 203, 110, 215, 108, 94, 173, - 248, 125, 130, 161, 161, 184, 120, 114, 162, 165, 185, 187, 50, 243, 85, 133, - 255, 35, 0, 25, 192, 10, 208, 7, 28, 2, 137, 193, 166, 208, 122, 220, - 35, 25, 217, 202, 218, 215, 27, 30, 139, 72, 103, 118, 170, 166, 255, 58, - 192, 19, 16, 13, 204, 5, 149, 195, 47, 17, 220, 12, 89, 197, 250, 211, - 3, 29, 193, 201, 144, 86, 236, 62, 205, 208, 85, 156, 63, 41, 208, 30, - 220, 8, 89, 198, 186, 210, 243, 29, 133, 201, 163, 22, 249, 206, 194, 212, - 81, 159, 124, 104, 33, 238, 152, 76, 106, 181, 239, 55, 12, 22, 133, 206, - 227, 20, 73, 207, 118, 212, 38, 223, 90, 216, 59, 26, 147, 75, 45, 247, - 93, 134, 185, 162, 242, 249, 133, 130, 227, 33, 137, 216, 102, 218, 170, 219, - 63, 27, 80, 11, 124, 7, 97, 194, 168, 81, 190, 188, 112, 113, 228, 36, - 75, 91, 119, 123, 102, 163, 106, 249, 239, 2, 204, 1, 149, 192, 111, 16, - 44, 12, 29, 197, 201, 147, 22, 237, 206, 205, 148, 85, 175, 127, 60, 32, - 17, 216, 12, 90, 133, 251, 35, 3, 89, 193, 250, 208, 67, 28, 49, 201, - 212, 86, 223, 126, 216, 32, 90, 152, 59, 42, 147, 95, 45, 248, 29, 130, - 137, 161, 166, 248, 122, 194, 163, 17, 185, 204, 114, 213, 229, 159, 11, 40, - 7, 94, 130, 184, 97, 178, 168, 117, 190, 167, 48, 122, 148, 35, 47, 89, - 220, 58, 217, 211, 26, 221, 203, 25, 151, 74, 238, 183, 12, 118, 133, 230, - 227, 10, 201, 199, 22, 210, 142, 221, 164, 89, 187, 122, 243, 99, 5, 233, - 195, 14, 209, 196, 92, 83, 121, 253, 226, 193, 137, 144, 102, 236, 42, 205, - 223, 21, 152, 15, 42, 132, 31, 35, 72, 25, 246, 138, 198, 231, 18, 202, - 141, 151, 37, 174, 155, 60, 107, 81, 239, 124, 76, 33, 245, 216, 71, 26, - 178, 139, 53, 167, 87, 58, 190, 147, 48, 109, 212, 45, 159, 93, 168, 57, - 190, 146, 240, 109, 132, 45, 163, 93, 185, 249, 178, 194, 245, 145, 135, 44, - 98, 157, 233, 169, 142, 254, 228, 64, 75, 112, 55, 100, 22, 171, 78, 255, - 116, 64, 39, 112, 26, 164, 11, 59, 71, 83, 114, 189, 229, 177, 139, 52, - 103, 87, 106, 190, 175, 48, 124, 20, 33, 207, 88, 84, 58, 191, 83, 48, - 61, 212, 17, 159, 76, 104, 53, 238, 151, 12, 110, 133, 236, 99, 13, 233, - 197, 142, 211, 36, 93, 219, 121, 155, 98, 235, 105, 143, 110, 228, 44, 75, - 93, 247, 121, 134, 162, 226, 249, 137, 130, 230, 225, 138, 200, 103, 22, 170, - 142, 255, 36, 64, 27, 112, 11, 100, 7, 107, 66, 175, 113, 188, 36, 113, - 219, 100, 91, 107, 123, 111, 99, 108, 41, 237, 222, 205, 152, 85, 170, 191, - 63, 48, 16, 20, 12, 15, 69, 196, 51, 19, 85, 205, 255, 21, 128, 15, - 32, 4, 24, 3, 74, 129, 247, 32, 70, 152, 50, 234, 149, 143, 47, 36, - 28, 27, 73, 203, 118, 215, 102, 222, 170, 216, 127, 26, 160, 11, 56, 7, - 82, 130, 189, 161, 177, 184, 116, 114, 167, 101, 186, 171, 51, 63, 85, 208, - 63, 28, 16, 9, 204, 6, 213, 194, 223, 17, 152, 12, 106, 133, 239, 35, - 12, 25, 197, 202, 211, 23, 29, 206, 137, 148, 102, 239, 106, 204, 47, 21, - 220, 15, 25, 196, 10, 211, 71, 29, 242, 137, 133, 166, 227, 58, 201, 211, - 22, 221, 206, 217, 148, 90, 239, 123, 12, 35, 69, 217, 243, 26, 197, 203, - 19, 23, 77, 206, 181, 148, 119, 47, 102, 156, 42, 233, 223, 14, 216, 4, - 90, 131, 123, 33, 227, 88, 73, 250, 182, 195, 54, 209, 214, 220, 94, 217, - 248, 90, 194, 187, 17, 179, 76, 117, 245, 231, 7, 10, 130, 135, 33, 162, - 152, 121, 170, 162, 255, 57, 128, 18, 224, 13, 136, 5, 166, 131, 58, 225, - 211, 8, 93, 198, 185, 146, 242, 237, 133, 141, 163, 37, 185, 219, 50, 219, - 85, 155, 127, 43, 96, 31, 104, 8, 46, 134, 156, 98, 233, 233, 142, 206, - 228, 84, 75, 127, 119, 96, 38, 168, 26, 254, 139, 0, 103, 64, 42, 176, - 31, 52, 8, 23, 70, 142, 178, 228, 117, 139, 103, 39, 106, 154, 175, 43, - 60, 31, 81, 200, 60, 86, 145, 254, 236, 64, 77, 240, 53, 132, 23, 35, - 78, 153, 244, 106, 199, 111, 18, 172, 13, 189, 197, 177, 147, 52, 109, 215, - 109, 158, 173, 168, 125, 190, 161, 176, 120, 116, 34, 167, 89, 186, 186, 243, - 51, 5, 213, 195, 31, 17, 200, 12, 86, 133, 254, 227, 0, 73, 192, 54, - 208, 22, 220, 14, 217, 196, 90, 211, 123, 29, 227, 73, 137, 246, 230, 198, - 202, 210, 215, 29, 158, 137, 168, 102, 254, 170, 192, 127, 16, 32, 12, 24, - 5, 202, 131, 23, 33, 206, 152, 84, 106, 191, 111, 48, 44, 20, 29, 207, - 73, 148, 54, 239, 86, 204, 62, 213, 208, 95, 28, 56, 9, 210, 134, 221, - 162, 217, 185, 154, 242, 235, 5, 143, 67, 36, 49, 219, 84, 91, 127, 123, - 96, 35, 104, 25, 238, 138, 204, 103, 21, 234, 143, 15, 36, 4, 27, 67, - 75, 113, 247, 100, 70, 171, 114, 255, 101, 128, 43, 32, 31, 88, 8, 58, - 134, 147, 34, 237, 217, 141, 154, 229, 171, 11, 63, 71, 80, 50, 188, 21, - 177, 207, 52, 84, 23, 127, 78, 160, 52, 120, 23, 98, 142, 169, 164, 126, - 251, 96, 67, 104, 49, 238, 148, 76, 111, 117, 236, 39, 13, 218, 133, 155, - 35, 43, 89, 223, 122, 216, 35, 26, 153, 203, 42, 215, 95, 30, 184, 8, - 114, 134, 165, 162, 251, 57, 131, 82, 225, 253, 136, 65, 166, 176, 122, 244, - 35, 7, 89, 194, 186, 209, 179, 28, 117, 201, 231, 22, 202, 142, 215, 36, - 94, 155, 120, 107, 98, 175, 105, 188, 46, 241, 220, 68, 89, 243, 122, 197, - 227, 19, 9, 205, 198, 213, 146, 223, 45, 152, 29, 170, 137, 191, 38, 240, - 26, 196, 11, 19, 71, 77, 242, 181, 133, 183, 35, 54, 153, 214, 234, 222, - 207, 24, 84, 10, 191, 71, 48, 50, 148, 21, 175, 79, 60, 52, 17, 215, - 76, 94, 181, 248, 119, 2, 166, 129, 186, 224, 115, 8, 37, 198, 155, 18, - 235, 77, 143, 117, 164, 39, 59, 90, 147, 123, 45, 227, 93, 137, 249, 166, - 194, 250, 209, 131, 28, 97, 201, 232, 86, 206, 190, 212, 112, 95, 100, 56, - 43, 82, 159, 125, 168, 33, 190, 152, 112, 106, 164, 47, 59, 92, 19, 121, - 205, 226, 213, 137, 159, 38, 232, 26, 206, 139, 20, 103, 79, 106, 180, 47, - 55, 92, 22, 185, 206, 242, 212, 69, 159, 115, 40, 37, 222, 155, 24, 107, - 74, 175, 119, 60, 38, 145, 218, 236, 91, 13, 251, 69, 131, 115, 33, 229, - 216, 75, 26, 183, 75, 54, 183, 86, 246, 190, 198, 240, 82, 196, 61, 147, - 81, 173, 252, 125, 129, 225, 160, 72, 120, 54, 162, 150, 249, 174, 194, 252, - 81, 129, 252, 96, 65, 232, 48, 78, 148, 52, 111, 87, 108, 62, 173, 208, - 125, 156, 33, 169, 216, 126, 218, 160, 91, 56, 59, 82, 147, 125, 173, 225, - 189, 136, 113, 166, 164, 122, 251, 99, 3, 105, 193, 238, 208, 76, 92, 53, - 249, 215, 2, 222, 129, 152, 96, 106, 168, 47, 62, 156, 16, 105, 204, 46, - 213, 220, 95, 25, 248, 10, 194, 135, 17, 162, 140, 121, 165, 226, 251, 9, - 131, 70, 225, 242, 200, 69, 150, 179, 46, 245, 220, 71, 25, 242, 138, 197, - 167, 19, 58, 141, 211, 37, 157, 219, 41, 155, 94, 235, 120, 79, 98, 180, - 41, 183, 94, 246, 184, 70, 242, 178, 197, 181, 147, 55, 45, 214, 157, 158, - 233, 168, 78, 254, 180, 64, 119, 112, 38, 164, 26, 251, 75, 3, 119, 65, - 230, 176, 74, 244, 55, 7, 86, 130, 190, 225, 176, 72, 116, 54, 167, 86, - 250, 190, 195, 48, 81, 212, 60, 95, 81, 248, 60, 66, 145, 241, 172, 68, - 125, 243, 97, 133, 232, 99, 14, 169, 196, 126, 211, 96, 93, 232, 57, 142, - 146, 228, 109, 139, 109, 167, 109, 186, 173, 179, 61, 181, 209, 183, 28, 118, - 137, 230, 230, 202, 202, 215, 23, 30, 142, 136, 100, 102, 171, 106, 255, 111, - 0, 44, 0, 29, 192, 9, 144, 6, 236, 2, 205, 193, 149, 144, 111, 44, - 44, 29, 221, 201, 153, 150, 234, 238, 207, 12, 84, 5, 255, 67, 0, 49, - 192, 20, 80, 15, 124, 4, 33, 195, 88, 81, 250, 188, 67, 49, 241, 212, - 68, 95, 115, 120, 37, 226, 155, 9, 171, 70, 255, 114, 192, 37, 144, 27, - 44, 11, 93, 199, 121, 146, 162, 237, 185, 141, 178, 229, 181, 139, 55, 39, - 86, 154, 190, 235, 48, 79, 84, 52, 63, 87, 80, 62, 188, 16, 113, 204, - 36, 85, 219, 127, 27, 96, 11, 104, 7, 110, 130, 172, 97, 189, 232, 113, - 142, 164, 100, 123, 107, 99, 111, 105, 236, 46, 205, 220, 85, 153, 255, 42, - 192, 31, 16, 8, 12, 6, 133, 194, 227, 17, 137, 204, 102, 213, 234, 223, - 15, 24, 4, 10, 131, 71, 33, 242, 152, 69, 170, 179, 63, 53, 208, 23, - 28, 14, 137, 196, 102, 211, 106, 221, 239, 25, 140, 10, 229, 199, 11, 18, - 135, 77, 162, 181, 185, 183, 50, 246, 149, 134, 239, 34, 204, 25, 149, 202, - 239, 23, 12, 14, 133, 196, 99, 19, 105, 205, 238, 213, 140, 95, 37, 248, - 27, 2, 139, 65, 167, 112, 122, 164, 35, 59, 89, 211, 122, 221, 227, 25, - 137, 202, 230, 215, 10, 222, 135, 24, 98, 138, 169, 167, 62, 250, 144, 67, - 44, 49, 221, 212, 89, 159, 122, 232, 35, 14, 153, 196, 106, 211, 111, 29, - 236, 9, 141, 198, 229, 146, 203, 45, 151, 93, 174, 185, 188, 114, 241, 229, - 132, 75, 35, 119, 89, 230, 186, 202, 243, 23, 5, 206, 131, 20, 97, 207, - 104, 84, 46, 191, 92, 112, 57, 228, 18, 203, 77, 151, 117, 174, 167, 60, - 122, 145, 227, 44, 73, 221, 246, 217, 134, 218, 226, 219, 9, 155, 70, 235, - 114, 207, 101, 148, 43, 47, 95, 92, 56, 57, 210, 146, 221, 173, 153, 189, - 170, 241, 191, 4, 112, 3, 100, 1, 235, 64, 79, 112, 52, 36, 23, 91, - 78, 187, 116, 115, 103, 101, 234, 171, 15, 63, 68, 16, 51, 76, 21, 245, - 207, 7, 20, 2, 143, 65, 164, 48, 123, 84, 35, 127, 89, 224, 58, 200, - 19, 22, 141, 206, 229, 148, 75, 47, 119, 92, 38, 185, 218, 242, 219, 5, - 155, 67, 43, 113, 223, 100, 88, 43, 122, 159, 99, 40, 41, 222, 158, 216, - 104, 90, 174, 187, 60, 115, 81, 229, 252, 75, 1, 247, 64, 70, 176, 50, - 244, 21, 135, 79, 34, 180, 25, 183, 74, 246, 183, 6, 246, 130, 198, 225, - 146, 200, 109, 150, 173, 174, 253, 188, 65, 177, 240, 116, 68, 39, 115, 90, - 165, 251, 59, 3, 83, 65, 253, 240, 65, 132, 48, 99, 84, 41, 255, 94, - 192, 56, 80, 18, 188, 13, 177, 197, 180, 83, 55, 125, 214, 161, 158, 248, - 104, 66, 174, 177, 188, 116, 113, 231, 100, 74, 171, 119, 63, 102, 144, 42, - 236, 31, 13, 200, 5, 150, 131, 46, 225, 220, 72, 89, 246, 186, 198, 243, - 18, 197, 205, 147, 21, 173, 207, 61, 148, 17, 175, 76, 124, 53, 225, 215, - 8, 94, 134, 184, 98, 242, 169, 133, 190, 227, 48, 73, 212, 54, 223, 86, - 216, 62, 218, 144, 91, 44, 59, 93, 211, 121, 157, 226, 233, 137, 142, 230, - 228, 74, 203, 119, 23, 102, 142, 170, 228, 127, 11, 96, 7, 104, 2, 174, - 129, 188, 96, 113, 232, 36, 78, 155, 116, 107, 103, 111, 106, 172, 47, 61, - 220, 17, 153, 204, 106, 213, 239, 31, 12, 8, 5, 198, 131, 18, 225, 205, - 136, 85, 166, 191, 58, 240, 19, 4, 13, 195, 69, 145, 243, 44, 69, 221, - 243, 25, 133, 202, 227, 23, 9, 206, 134, 212, 98, 223, 105, 152, 46, 234, - 156, 79, 41, 244, 30, 199, 72, 82, 182, 189, 182, 241, 182, 196, 118, 211, - 102, 221, 234, 217, 143, 26, 228, 11, 11, 71, 71, 114, 178, 165, 181, 187, - 55, 51, 86, 149, 254, 239, 0, 76, 0, 53, 192, 23, 16, 14, 140, 4, - 101, 195, 107, 17, 239, 76, 76, 53, 245, 215, 7, 30, 130, 136, 97, 166, - 168, 122, 254, 163, 0, 121, 192, 34, 208, 25, 156, 10, 233, 199, 14, 210, - 132, 93, 163, 121, 185, 226, 242, 201, 133, 150, 227, 46, 201, 220, 86, 217, - 254, 218, 192, 91, 16, 59, 76, 19, 117, 205, 231, 21, 138, 143, 39, 36, - 26, 155, 75, 43, 119, 95, 102, 184, 42, 242, 159, 5, 168, 3, 62, 129, - 208, 96, 92, 40, 57, 222, 146, 216, 109, 154, 173, 171, 61, 191, 81, 176, - 60, 116, 17, 231, 76, 74, 181, 247, 55, 6, 150, 130, 238, 225, 140, 72, - 101, 246, 171, 6, 255, 66, 192, 49, 144, 20, 108, 15, 109, 196, 45, 147, - 93, 173, 249, 189, 130, 241, 161, 132, 120, 99, 98, 169, 233, 190, 206, 240, - 84, 68, 63, 115, 80, 37, 252, 27, 1, 203, 64, 87, 112, 62, 164, 16, - 123, 76, 35, 117, 217, 231, 26, 202, 139, 23, 39, 78, 154, 180, 107, 55, - 111, 86, 172, 62, 253, 208, 65, 156, 48, 105, 212, 46, 223, 92, 88, 57, - 250, 146, 195, 45, 145, 221, 172, 89, 189, 250, 241, 131, 4, 97, 195, 104, - 81, 238, 188, 76, 113, 245, 228, 71, 11, 114, 135, 101, 162, 171, 57, 191, - 82, 240, 61, 132, 17, 163, 76, 121, 245, 226, 199, 9, 146, 134, 237, 162, - 205, 185, 149, 178, 239, 53, 140, 23, 37, 206, 155, 20, 107, 79, 111, 116, - 44, 39, 93, 218, 185, 155, 50, 235, 85, 143, 127, 36, 32, 27, 88, 11, - 122, 135, 99, 34, 169, 217, 190, 218, 240, 91, 4, 59, 67, 83, 113, 253, - 228, 65, 139, 112, 103, 100, 42, 171, 95, 63, 120, 16, 34, 140, 25, 165, - 202, 251, 23, 3, 78, 129, 244, 96, 71, 104, 50, 174, 149, 188, 111, 49, - 236, 20, 77, 207, 117, 148, 39, 47, 90, 156, 59, 41, 211, 94, 221, 248, - 89, 130, 186, 225, 179, 8, 117, 198, 167, 18, 250, 141, 131, 37, 161, 219, - 56, 91, 82, 187, 125, 179, 97, 181, 232, 119, 14, 166, 132, 122, 227, 99, - 9, 233, 198, 206, 210, 212, 93, 159, 121, 168, 34, 254, 153, 128, 106, 224, - 47, 8, 28, 6, 137, 194, 230, 209, 138, 220, 103, 25, 234, 138, 207, 39, - 20, 26, 143, 75, 36, 55, 91, 86, 187, 126, 243, 96, 69, 232, 51, 14, - 149, 196, 111, 19, 108, 13, 237, 197, 141, 147, 37, 173, 219, 61, 155, 81, - 171, 124, 127, 97, 224, 40, 72, 30, 182, 136, 118, 230, 166, 202, 250, 215, - 3, 30, 129, 200, 96, 86, 168, 62, 254, 144, 64, 108, 48, 45, 212, 29, - 159, 73, 168, 54, 254, 150, 192, 110, 208, 44, 92, 29, 249, 201, 130, 214, - 225, 158, 200, 104, 86, 174, 190, 252, 112, 65, 228, 48, 75, 84, 55, 127, - 86, 160, 62, 248, 16, 66, 140, 49, 165, 212, 123, 31, 99, 72, 41, 246, - 158, 198, 232, 82, 206, 189, 148, 113, 175, 100, 124, 43, 97, 223, 104, 88, - 46, 186, 156, 115, 41, 229, 222, 203, 24, 87, 74, 190, 183, 48, 118, 148, - 38, 239, 90, 204, 59, 21, 211, 79, 29, 244, 9, 135, 70, 226, 178, 201, - 181, 150, 247, 46, 198, 156, 82, 233, 253, 142, 193, 164, 80, 123, 124, 35, - 97, 217, 232, 90, 206, 187, 20, 115, 79, 101, 244, 43, 7, 95, 66, 184, - 49, 178, 148, 117, 175, 103, 60, 42, 145, 223, 44, 88, 29, 250, 137, 131, - 38, 225, 218, 200, 91, 22, 187, 78, 243, 116, 69, 231, 115, 10, 165, 199, - 59, 18, 147, 77, 173, 245, 189, 135, 49, 162, 148, 121, 175, 98, 252, 41, - 129, 222, 224, 88, 72, 58, 182, 147, 54, 237, 214, 205, 158, 213, 168, 95, - 62, 184, 16, 114, 140, 37, 165, 219, 59, 27, 83, 75, 125, 247, 97, 134, - 168, 98, 254, 169, 128, 126, 224, 32, 72, 24, 54, 138, 150, 231, 46, 202, - 156, 87, 41, 254, 158, 192, 104, 80, 46, 188, 28, 113, 201, 228, 86, 203, - 126, 215, 96, 94, 168, 56, 126, 146, 160, 109, 184, 45, 178, 157, 181, 169, - 183, 62, 246, 144, 70, 236, 50, 205, 213, 149, 159, 47, 40, 28, 30, 137, - 200, 102, 214, 170, 222, 255, 24, 64, 10, 176, 7, 52, 2, 151, 65, 174, - 176, 124, 116, 33, 231, 88, 74, 186, 183, 51, 54, 149, 214, 239, 30, 204, - 8, 85, 198, 191, 18, 240, 13, 132, 5, 163, 67, 57, 241, 210, 196, 93, - 147, 121, 173, 226, 253, 137, 129, 166, 224, 122, 200, 35, 22, 153, 206, 234, - 212, 79, 31, 116, 8, 39, 70, 154, 178, 235, 53, 143, 87, 36, 62, 155, - 80, 107, 124, 47, 97, 220, 40, 89, 222, 186, 216, 115, 26, 165, 203, 59, - 23, 83, 78, 189, 244, 113, 135, 100, 98, 171, 105, 191, 110, 240, 44, 68, - 29, 243, 73, 133, 246, 227, 6, 201, 194, 214, 209, 158, 220, 104, 89, 238, - 186, 204, 115, 21, 229, 207, 11, 20, 7, 79, 66, 180, 49, 183, 84, 118, - 191, 102, 240, 42, 196, 31, 19, 72, 13, 246, 133, 134, 227, 34, 201, 217, - 150, 218, 238, 219, 12, 91, 69, 251, 115, 3, 101, 193, 235, 16, 79, 76, - 52, 53, 215, 87, 30, 190, 136, 112, 102, 164, 42, 251, 95, 3, 120, 1, - 226, 128, 73, 160, 54, 248, 22, 194, 142, 209, 164, 92, 123, 121, 227, 98, - 201, 233, 150, 206, 238, 212, 76, 95, 117, 248, 39, 2, 154, 129, 171, 32, - 127, 88, 32, 58, 152, 19, 42, 141, 223, 37, 152, 27, 42, 139, 95, 39, - 120, 26, 162, 139, 57, 167, 82, 250, 189, 131, 49, 161, 212, 120, 95, 98, - 184, 41, 178, 158, 245, 168, 71, 62, 178, 144, 117, 172, 39, 61, 218, 145, - 155, 44, 107, 93, 239, 121, 140, 34, 229, 217, 139, 26, 231, 75, 10, 183, - 71, 54, 178, 150, 245, 174, 199, 60, 82, 145, 253, 172, 65, 189, 240, 113, - 132, 36, 99, 91, 105, 251, 110, 195, 108, 81, 237, 252, 77, 129, 245, 160, - 71, 56, 50, 146, 149, 173, 175, 61, 188, 17, 177, 204, 116, 85, 231, 127, - 10, 160, 7, 56, 2, 146, 129, 173, 160, 125, 184, 33, 178, 152, 117, 170, - 167, 63, 58, 144, 19, 44, 13, 221, 197, 153, 147, 42, 237, 223, 13, 152, - 5, 170, 131, 63, 33, 208, 24, 92, 10, 185, 199, 50, 210, 149, 157, 175, - 41, 188, 30, 241, 200, 68, 86, 179, 126, 245, 224, 71, 8, 50, 134, 149, - 162, 239, 57, 140, 18, 229, 205, 139, 21, 167, 79, 58, 180, 19, 55, 77, - 214, 181, 158, 247, 40, 70, 158, 178, 232, 117, 142, 167, 36, 122, 155, 99, - 43, 105, 223, 110, 216, 44, 90, 157, 251, 41, 131, 94, 225, 248, 72, 66, - 182, 177, 182, 244, 118, 199, 102, 210, 170, 221, 191, 25, 176, 10, 244, 7, - 7, 66, 130, 177, 161, 180, 120, 119, 98, 166, 169, 186, 254, 243, 0, 69, - 192, 51, 16, 21, 204, 15, 21, 196, 15, 19, 68, 13, 243, 69, 133, 243, - 35, 5, 217, 195, 26, 209, 203, 28, 87, 73, 254, 182, 192, 118, 208, 38, - 220, 26, 217, 203, 26, 215, 75, 30, 183, 72, 118, 182, 166, 246, 250, 198, - 195, 18, 209, 205, 156, 85, 169, 255, 62, 192, 16, 80, 12, 60, 5, 209, - 195, 28, 81, 201, 252, 86, 193, 254, 208, 64, 92, 48, 57, 212, 18, 223, - 77, 152, 53, 170, 151, 63, 46, 144, 28, 108, 9, 237, 198, 205, 146, 213, - 173, 159, 61, 168, 17, 190, 140, 112, 101, 228, 43, 11, 95, 71, 120, 50, - 162, 149, 185, 175, 50, 252, 21, 129, 207, 32, 84, 24, 63, 74, 144, 55, - 44, 22, 157, 206, 233, 148, 78, 239, 116, 76, 39, 117, 218, 167, 27, 58, - 139, 83, 39, 125, 218, 161, 155, 56, 107, 82, 175, 125, 188, 33, 177, 216, - 116, 90, 167, 123, 58, 163, 83, 57, 253, 210, 193, 157, 144, 105, 172, 46, - 253, 220, 65, 153, 240, 106, 196, 47, 19, 92, 13, 249, 197, 130, 211, 33, - 157, 216, 105, 154, 174, 235, 60, 79, 81, 244, 60, 71, 81, 242, 188, 69, - 177, 243, 52, 69, 215, 115, 30, 165, 200, 123, 22, 163, 78, 249, 244, 66, - 199, 113, 146, 164, 109, 187, 109, 179, 109, 181, 237, 183, 13, 182, 133, 182, - 227, 54, 201, 214, 214, 222, 222, 216, 88, 90, 186, 187, 51, 51, 255, 63 ) - -random_mask_vec8 = numpy.array(random_mask_tuple, numpy.uint8) - diff --git a/gr-digital/python/pkt.py b/gr-digital/python/pkt.py deleted file mode 100644 index 8650bdbb0..000000000 --- a/gr-digital/python/pkt.py +++ /dev/null @@ -1,167 +0,0 @@ -# -# Copyright 2005, 2006, 2007 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. -# - -from math import pi -from gnuradio import gr -import gnuradio.gr.gr_threading as _threading -import packet_utils -import digital_swig - - -# ///////////////////////////////////////////////////////////////////////////// -# mod/demod with packets as i/o -# ///////////////////////////////////////////////////////////////////////////// - -class mod_pkts(gr.hier_block2): - """ - Wrap an arbitrary digital modulator in our packet handling framework. - - Send packets by calling send_pkt - """ - def __init__(self, modulator, access_code=None, msgq_limit=2, pad_for_usrp=True, - use_whitener_offset=False, modulate=True): - """ - Hierarchical block for sending packets - - Packets to be sent are enqueued by calling send_pkt. - The output is the complex modulated signal at baseband. - - @param modulator: instance of modulator class (gr_block or hier_block2) - @type modulator: complex baseband out - @param access_code: AKA sync vector - @type access_code: string of 1's and 0's between 1 and 64 long - @param msgq_limit: maximum number of messages in message queue - @type msgq_limit: int - @param pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples - @param use_whitener_offset: If true, start of whitener XOR string is incremented each packet - - See gmsk_mod for remaining parameters - """ - - gr.hier_block2.__init__(self, "mod_pkts", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - self._modulator = modulator - self._pad_for_usrp = pad_for_usrp - self._use_whitener_offset = use_whitener_offset - self._whitener_offset = 0 - - if access_code is None: - access_code = packet_utils.default_access_code - if not packet_utils.is_1_0_string(access_code): - raise ValueError, "Invalid access_code %r. Must be string of 1's and 0's" % (access_code,) - self._access_code = access_code - - # accepts messages from the outside world - self._pkt_input = gr.message_source(gr.sizeof_char, msgq_limit) - self.connect(self._pkt_input, self._modulator, self) - - def send_pkt(self, payload='', eof=False): - """ - Send the payload. - - @param payload: data to send - @type payload: string - """ - if eof: - msg = gr.message(1) # tell self._pkt_input we're not sending any more packets - else: - # print "original_payload =", string_to_hex_list(payload) - pkt = packet_utils.make_packet(payload, - self._modulator.samples_per_symbol(), - self._modulator.bits_per_symbol(), - self._access_code, - self._pad_for_usrp, - self._whitener_offset) - #print "pkt =", string_to_hex_list(pkt) - msg = gr.message_from_string(pkt) - if self._use_whitener_offset is True: - self._whitener_offset = (self._whitener_offset + 1) % 16 - - self._pkt_input.msgq().insert_tail(msg) - - - -class demod_pkts(gr.hier_block2): - """ - Wrap an arbitrary digital demodulator in our packet handling framework. - - The input is complex baseband. When packets are demodulated, they are passed to the - app via the callback. - """ - - def __init__(self, demodulator, access_code=None, callback=None, threshold=-1): - """ - Hierarchical block for demodulating and deframing packets. - - The input is the complex modulated signal at baseband. - Demodulated packets are sent to the handler. - - @param demodulator: instance of demodulator class (gr_block or hier_block2) - @type demodulator: complex baseband in - @param access_code: AKA sync vector - @type access_code: string of 1's and 0's - @param callback: function of two args: ok, payload - @type callback: ok: bool; payload: string - @param threshold: detect access_code with up to threshold bits wrong (-1 -> use default) - @type threshold: int - """ - - gr.hier_block2.__init__(self, "demod_pkts", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - - self._demodulator = demodulator - if access_code is None: - access_code = packet_utils.default_access_code - if not packet_utils.is_1_0_string(access_code): - raise ValueError, "Invalid access_code %r. Must be string of 1's and 0's" % (access_code,) - self._access_code = access_code - - if threshold == -1: - threshold = 12 # FIXME raise exception - - self._rcvd_pktq = gr.msg_queue() # holds packets from the PHY - self.correlator = digital_swig.correlate_access_code_bb(access_code, threshold) - - self.framer_sink = gr.framer_sink_1(self._rcvd_pktq) - self.connect(self, self._demodulator, self.correlator, self.framer_sink) - - self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback) - - -class _queue_watcher_thread(_threading.Thread): - def __init__(self, rcvd_pktq, callback): - _threading.Thread.__init__(self) - self.setDaemon(1) - self.rcvd_pktq = rcvd_pktq - self.callback = callback - self.keep_running = True - self.start() - - - def run(self): - while self.keep_running: - msg = self.rcvd_pktq.delete_head() - ok, payload = packet_utils.unmake_packet(msg.to_string(), int(msg.arg1())) - if self.callback: - self.callback(ok, payload) diff --git a/gr-digital/python/psk.py b/gr-digital/python/psk.py deleted file mode 100644 index 58f6787f0..000000000 --- a/gr-digital/python/psk.py +++ /dev/null @@ -1,122 +0,0 @@ -# -# Copyright 2005,2006,2011 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. -# - -""" -PSK modulation and demodulation. -""" - -from math import pi, log -from cmath import exp - -import digital_swig -import modulation_utils -from utils import mod_codes, gray_code -from generic_mod_demod import generic_mod, generic_demod - -# Default number of points in constellation. -_def_constellation_points = 4 -# The default encoding (e.g. gray-code, set-partition) -_def_mod_code = mod_codes.GRAY_CODE - -def create_encodings(mod_code, arity): - post_diff_code = None - if mod_code not in mod_codes.codes: - raise ValueError('That modulation code does not exist.') - if mod_code == mod_codes.GRAY_CODE: - pre_diff_code = gray_code.gray_code(arity) - elif mod_code == mod_codes.SET_PARTITION_CODE: - pre_diff_code = set_partition_code.set_partition_code(arity) - elif mod_code == mod_codes.NO_CODE: - pre_diff_code = [] - else: - raise ValueError('That modulation code is not implemented for this constellation.') - return (pre_diff_code, post_diff_code) - -# ///////////////////////////////////////////////////////////////////////////// -# PSK constellation -# ///////////////////////////////////////////////////////////////////////////// - -def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code): - """ - Creates a PSK constellation object. - """ - k = log(m) / log(2.0) - if (k != int(k)): - raise StandardError('Number of constellation points must be a power of two.') - points = [exp(2*pi*(0+1j)*i/m) for i in range(0,m)] - pre_diff_code, post_diff_code = create_encodings(mod_code, m) - if post_diff_code is not None: - inverse_post_diff_code = mod_codes.invert_code(post_diff_code) - points = [points[x] for x in inverse_post_diff_code] - constellation = digital_swig.constellation_psk(points, pre_diff_code, m) - return constellation - -# ///////////////////////////////////////////////////////////////////////////// -# PSK modulator -# ///////////////////////////////////////////////////////////////////////////// - -class psk_mod(generic_mod): - - def __init__(self, constellation_points=_def_constellation_points, - mod_code=_def_mod_code, - *args, **kwargs): - - """ - Hierarchical block for RRC-filtered PSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_mod block for list of parameters. - """ - - constellation = psk_constellation(constellation_points, mod_code) - super(psk_mod, self).__init__(constellation, *args, **kwargs) - -# ///////////////////////////////////////////////////////////////////////////// -# PSK demodulator -# -# ///////////////////////////////////////////////////////////////////////////// - -class psk_demod(generic_demod): - - def __init__(self, constellation_points=_def_constellation_points, - mod_code=_def_mod_code, - *args, **kwargs): - - """ - Hierarchical block for RRC-filtered PSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_demod block for list of parameters. - """ - - constellation = psk_constellation(constellation_points, mod_code) - super(psk_demod, self).__init__(constellation, *args, **kwargs) - -# -# Add these to the mod/demod registry -# -modulation_utils.add_type_1_mod('psk', psk_mod) -modulation_utils.add_type_1_demod('psk', psk_demod) -modulation_utils.add_type_1_constellation('psk', psk_constellation) diff --git a/gr-digital/python/qa_binary_slicer_fb.py b/gr-digital/python/qa_binary_slicer_fb.py deleted file mode 100755 index 60d92c5d1..000000000 --- a/gr-digital/python/qa_binary_slicer_fb.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig -import math, random - -class test_binary_slicer_fb (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_binary_slicer_fb (self): - expected_result = ( 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1) - src_data = (-1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1) - src_data = [s + (1 - random.random()) for s in src_data] # add some noise - src = gr.vector_source_f (src_data) - op = digital_swig.binary_slicer_fb () - dst = gr.vector_sink_b () - - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () # run the graph and wait for it to finish - - actual_result = dst.data () # fetch the contents of the sink - #print "actual result", actual_result - #print "expected result", expected_result - self.assertFloatTuplesAlmostEqual (expected_result, actual_result) - - -if __name__ == '__main__': - gr_unittest.run(test_binary_slicer_fb, "test_binary_slicer_fb.xml") - diff --git a/gr-digital/python/qa_bytes_to_syms.py b/gr-digital/python/qa_bytes_to_syms.py deleted file mode 100755 index 75475a95b..000000000 --- a/gr-digital/python/qa_bytes_to_syms.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010,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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital -import math - -class test_bytes_to_syms (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_bytes_to_syms_001 (self): - src_data = (0x01, 0x80, 0x03) - expected_result = (-1, -1, -1, -1, -1, -1, -1, +1, - +1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, +1, +1) - src = gr.vector_source_b (src_data) - op = digital.bytes_to_syms () - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_bytes_to_syms, "test_bytes_to_syms.xml") - diff --git a/gr-digital/python/qa_chunks_to_symbols.py b/gr-digital/python/qa_chunks_to_symbols.py deleted file mode 100755 index 63af10d8f..000000000 --- a/gr-digital/python/qa_chunks_to_symbols.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital - -class test_chunks_to_symbols(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_bc_001(self): - const = [ 1+0j, 0+1j, - -1+0j, 0-1j] - src_data = (0, 1, 2, 3, 3, 2, 1, 0) - expected_result = (1+0j, 0+1j, -1+0j, 0-1j, - 0-1j, -1+0j, 0+1j, 1+0j) - - src = gr.vector_source_b(src_data) - op = digital.chunks_to_symbols_bc(const) - - dst = gr.vector_sink_c() - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - actual_result = dst.data() - self.assertEqual(expected_result, actual_result) - - def test_bf_002(self): - const = [-3, -1, 1, 3] - src_data = (0, 1, 2, 3, 3, 2, 1, 0) - expected_result = (-3, -1, 1, 3, - 3, 1, -1, -3) - - src = gr.vector_source_b(src_data) - op = digital.chunks_to_symbols_bf(const) - - dst = gr.vector_sink_f() - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - actual_result = dst.data() - self.assertEqual(expected_result, actual_result) - - def test_ic_003(self): - const = [ 1+0j, 0+1j, - -1+0j, 0-1j] - src_data = (0, 1, 2, 3, 3, 2, 1, 0) - expected_result = (1+0j, 0+1j, -1+0j, 0-1j, - 0-1j, -1+0j, 0+1j, 1+0j) - - src = gr.vector_source_i(src_data) - op = digital.chunks_to_symbols_ic(const) - - dst = gr.vector_sink_c() - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - actual_result = dst.data() - self.assertEqual(expected_result, actual_result) - - def test_if_004(self): - const = [-3, -1, 1, 3] - src_data = (0, 1, 2, 3, 3, 2, 1, 0) - expected_result = (-3, -1, 1, 3, - 3, 1, -1, -3) - - src = gr.vector_source_i(src_data) - op = digital.chunks_to_symbols_if(const) - - dst = gr.vector_sink_f() - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - actual_result = dst.data() - self.assertEqual(expected_result, actual_result) - - def test_sc_005(self): - const = [ 1+0j, 0+1j, - -1+0j, 0-1j] - src_data = (0, 1, 2, 3, 3, 2, 1, 0) - expected_result = (1+0j, 0+1j, -1+0j, 0-1j, - 0-1j, -1+0j, 0+1j, 1+0j) - - src = gr.vector_source_s(src_data) - op = digital.chunks_to_symbols_sc(const) - - dst = gr.vector_sink_c() - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - actual_result = dst.data() - self.assertEqual(expected_result, actual_result) - - def test_sf_006(self): - const = [-3, -1, 1, 3] - src_data = (0, 1, 2, 3, 3, 2, 1, 0) - expected_result = (-3, -1, 1, 3, - 3, 1, -1, -3) - - src = gr.vector_source_s(src_data) - op = digital.chunks_to_symbols_sf(const) - - dst = gr.vector_sink_f() - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - - actual_result = dst.data() - self.assertEqual(expected_result, actual_result) - -if __name__ == '__main__': - gr_unittest.run(test_chunks_to_symbols, "test_chunks_to_symbols.xml") diff --git a/gr-digital/python/qa_clock_recovery_mm.py b/gr-digital/python/qa_clock_recovery_mm.py deleted file mode 100755 index f4c345b03..000000000 --- a/gr-digital/python/qa_clock_recovery_mm.py +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig -import random, cmath - -class test_clock_recovery_mm(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test01 (self): - # Test complex/complex version - omega = 2 - gain_omega = 0.001 - mu = 0.5 - gain_mu = 0.01 - omega_rel_lim = 0.001 - - self.test = digital_swig.clock_recovery_mm_cc(omega, gain_omega, - mu, gain_mu, - omega_rel_lim) - - data = 100*[complex(1, 1),] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() - - self.tb.connect(self.src, self.test, self.snk) - self.tb.run() - - expected_result = 100*[complex(0.99972, 0.99972)] # doesn't quite get to 1.0 - dst_data = self.snk.data() - - # Only compare last Ncmp samples - Ncmp = 30 - len_e = len(expected_result) - len_d = len(dst_data) - expected_result = expected_result[len_e - Ncmp:] - dst_data = dst_data[len_d - Ncmp:] - - #print expected_result - #print dst_data - - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) - - - def test02 (self): - # Test float/float version - omega = 2 - gain_omega = 0.01 - mu = 0.5 - gain_mu = 0.01 - omega_rel_lim = 0.001 - - self.test = digital_swig.clock_recovery_mm_ff(omega, gain_omega, - mu, gain_mu, - omega_rel_lim) - - data = 100*[1,] - self.src = gr.vector_source_f(data, False) - self.snk = gr.vector_sink_f() - - self.tb.connect(self.src, self.test, self.snk) - self.tb.run() - - expected_result = 100*[0.99972, ] # doesn't quite get to 1.0 - dst_data = self.snk.data() - - # Only compare last Ncmp samples - Ncmp = 30 - len_e = len(expected_result) - len_d = len(dst_data) - expected_result = expected_result[len_e - Ncmp:] - dst_data = dst_data[len_d - Ncmp:] - - #print expected_result - #print dst_data - - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5) - - - def test03 (self): - # Test complex/complex version with varying input - omega = 2 - gain_omega = 0.01 - mu = 0.25 - gain_mu = 0.1 - omega_rel_lim = 0.0001 - - self.test = digital_swig.clock_recovery_mm_cc(omega, gain_omega, - mu, gain_mu, - omega_rel_lim) - - data = 1000*[complex(1, 1), complex(1, 1), complex(-1, -1), complex(-1, -1)] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() - - self.tb.connect(self.src, self.test, self.snk) - self.tb.run() - - expected_result = 1000*[complex(-1.2, -1.2), complex(1.2, 1.2)] - dst_data = self.snk.data() - - # Only compare last Ncmp samples - Ncmp = 100 - len_e = len(expected_result) - len_d = len(dst_data) - expected_result = expected_result[len_e - Ncmp:] - dst_data = dst_data[len_d - Ncmp:] - - #print expected_result - #print dst_data - - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1) - - - def test04 (self): - # Test float/float version - omega = 2 - gain_omega = 0.01 - mu = 0.25 - gain_mu = 0.1 - omega_rel_lim = 0.001 - - self.test = digital_swig.clock_recovery_mm_ff(omega, gain_omega, - mu, gain_mu, - omega_rel_lim) - - data = 1000*[1, 1, -1, -1] - self.src = gr.vector_source_f(data, False) - self.snk = gr.vector_sink_f() - - self.tb.connect(self.src, self.test, self.snk) - self.tb.run() - - expected_result = 1000*[-1.31, 1.31] - dst_data = self.snk.data() - - # Only compare last Ncmp samples - Ncmp = 100 - len_e = len(expected_result) - len_d = len(dst_data) - expected_result = expected_result[len_e - Ncmp:] - dst_data = dst_data[len_d - Ncmp:] - - #print expected_result - #print dst_data - - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 1) - - -if __name__ == '__main__': - gr_unittest.run(test_clock_recovery_mm, "test_clock_recovery_mm.xml") diff --git a/gr-digital/python/qa_cma_equalizer.py b/gr-digital/python/qa_cma_equalizer.py deleted file mode 100755 index 75fb0f05e..000000000 --- a/gr-digital/python/qa_cma_equalizer.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2010,2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig - -class test_cma_equalizer_fir(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def transform(self, src_data): - SRC = gr.vector_source_c(src_data, False) - EQU = digital_swig.cma_equalizer_cc(4, 1.0, .001, 1) - DST = gr.vector_sink_c() - self.tb.connect(SRC, EQU, DST) - self.tb.run() - return DST.data() - - def test_001_identity(self): - # Constant modulus signal so no adjustments - src_data = (1+0j, 0+1j, -1+0j, 0-1j)*1000 - expected_data = src_data - result = self.transform(src_data) - self.assertComplexTuplesAlmostEqual(expected_data, result) - -if __name__ == "__main__": - gr_unittest.run(test_cma_equalizer_fir, "test_cma_equalizer_fir.xml") diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py deleted file mode 100644 index 95942933a..000000000 --- a/gr-digital/python/qa_constellation.py +++ /dev/null @@ -1,209 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -import random -from cmath import exp, pi, log - -from gnuradio import gr, gr_unittest, blks2 -from utils import mod_codes -import digital_swig - -# import from local folder -import psk -import qam - -tested_mod_codes = (mod_codes.NO_CODE, mod_codes.GRAY_CODE) - -# A list of the constellations to test. -# Each constellation is given by a 3-tuple. -# First item is a function to generate the constellation -# Second item is a dictionary of arguments for function with lists of -# possible values. -# Third item is whether differential encoding should be tested. -# Fourth item is the name of the argument to constructor that specifices -# whether differential encoding is used. - -def twod_constell(): - """ - - """ - points = ((1+0j), (0+1j), - (-1+0j), (0-1j)) - rot_sym = 2 - dim = 2 - return digital_swig.constellation_calcdist(points, [], rot_sym, dim) - -def threed_constell(): - oned_points = ((1+0j), (0+1j), (-1+0j), (0-1j)) - points = [] - r4 = range(0, 4) - for ia in r4: - for ib in r4: - for ic in r4: - points += [oned_points[ia], oned_points[ib], oned_points[ic]] - rot_sym = 4 - dim = 3 - return digital_swig.constellation_calcdist(points, [], rot_sym, dim) - -tested_constellation_info = ( - (psk.psk_constellation, - {'m': (2, 4, 8, 16, 32, 64), - 'mod_code': tested_mod_codes, }, - True, None), - (qam.qam_constellation, - {'constellation_points': (4, 16, 64), - 'mod_code': tested_mod_codes, }, - True, None), - (digital_swig.constellation_bpsk, {}, True, None), - (digital_swig.constellation_qpsk, {}, False, None), - (digital_swig.constellation_dqpsk, {}, True, None), - (digital_swig.constellation_8psk, {}, False, None), - (twod_constell, {}, True, None), - (threed_constell, {}, True, None), - ) - -def tested_constellations(): - """ - Generator to produce (constellation, differential) tuples for testing purposes. - """ - for constructor, poss_args, differential, diff_argname in tested_constellation_info: - if differential: - diff_poss = (True, False) - else: - diff_poss = (False,) - poss_args = [[argname, argvalues, 0] for argname, argvalues in poss_args.items()] - for current_diff in diff_poss: - # Add an index into args to keep track of current position in argvalues - while True: - current_args = dict([(argname, argvalues[argindex]) - for argname, argvalues, argindex in poss_args]) - if diff_argname is not None: - current_args[diff_argname] = current_diff - constellation = constructor(**current_args) - yield (constellation, current_diff) - for this_poss_arg in poss_args: - argname, argvalues, argindex = this_poss_arg - if argindex < len(argvalues) - 1: - this_poss_arg[2] += 1 - break - else: - this_poss_arg[2] = 0 - if sum([argindex for argname, argvalues, argindex in poss_args]) == 0: - break - - -class test_constellation (gr_unittest.TestCase): - - src_length = 256 - - def setUp(self): - # Generate a list of random bits. - self.src_data = tuple([random.randint(0,1) for i in range(0, self.src_length)]) - - def tearDown(self): - pass - - def test_hard_decision(self): - for constellation, differential in tested_constellations(): - if differential: - rs = constellation.rotational_symmetry() - rotations = [exp(i*2*pi*(0+1j)/rs) for i in range(0, rs)] - else: - rotations = [None] - for rotation in rotations: - src = gr.vector_source_b(self.src_data) - content = mod_demod(constellation, differential, rotation) - dst = gr.vector_sink_b() - self.tb = gr.top_block() - self.tb.connect(src, content, dst) - self.tb.run() - data = dst.data() - # Don't worry about cut off data for now. - first = constellation.bits_per_symbol() - self.assertEqual (self.src_data[first:len(data)], data[first:]) - - -class mod_demod(gr.hier_block2): - def __init__(self, constellation, differential, rotation): - if constellation.arity() > 256: - # If this becomes limiting some of the blocks should be generalised so - # that they can work with shorts and ints as well as chars. - raise ValueError("Constellation cannot contain more than 256 points.") - - gr.hier_block2.__init__(self, "mod_demod", - gr.io_signature(1, 1, gr.sizeof_char), # Input signature - gr.io_signature(1, 1, gr.sizeof_char)) # Output signature - - arity = constellation.arity() - - # TX - self.constellation = constellation - self.differential = differential - import weakref - self.blocks = [weakref.proxy(self)] - # We expect a stream of unpacked bits. - # First step is to pack them. - self.blocks.append( - gr.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)) - # Second step we unpack them such that we have k bits in each byte where - # each constellation symbol hold k bits. - self.blocks.append( - gr.packed_to_unpacked_bb(self.constellation.bits_per_symbol(), - gr.GR_MSB_FIRST)) - # Apply any pre-differential coding - # Gray-coding is done here if we're also using differential coding. - if self.constellation.apply_pre_diff_code(): - self.blocks.append(gr.map_bb(self.constellation.pre_diff_code())) - # Differential encoding. - if self.differential: - self.blocks.append(gr.diff_encoder_bb(arity)) - # Convert to constellation symbols. - self.blocks.append(gr.chunks_to_symbols_bc(self.constellation.points(), - self.constellation.dimensionality())) - # CHANNEL - # Channel just consists of a rotation to check differential coding. - if rotation is not None: - self.blocks.append(gr.multiply_const_cc(rotation)) - - # RX - # Convert the constellation symbols back to binary values. - self.blocks.append(digital_swig.constellation_decoder_cb(self.constellation.base())) - # Differential decoding. - if self.differential: - self.blocks.append(gr.diff_decoder_bb(arity)) - # Decode any pre-differential coding. - if self.constellation.apply_pre_diff_code(): - self.blocks.append(gr.map_bb( - mod_codes.invert_code(self.constellation.pre_diff_code()))) - # unpack the k bit vector into a stream of bits - self.blocks.append(gr.unpack_k_bits_bb( - self.constellation.bits_per_symbol())) - # connect to block output - check_index = len(self.blocks) - self.blocks = self.blocks[:check_index] - self.blocks.append(weakref.proxy(self)) - - self.connect(*self.blocks) - - -if __name__ == '__main__': - gr_unittest.run(test_constellation, "test_constellation.xml") diff --git a/gr-digital/python/qa_constellation_decoder_cb.py b/gr-digital/python/qa_constellation_decoder_cb.py deleted file mode 100755 index 5401a07fc..000000000 --- a/gr-digital/python/qa_constellation_decoder_cb.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010,2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig -import math - -class test_constellation_decoder (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_constellation_decoder_cb_bpsk (self): - cnst = digital_swig.constellation_bpsk() - src_data = (0.5 + 0.5j, 0.1 - 1.2j, -0.8 - 0.1j, -0.45 + 0.8j, - 0.8 + 1.0j, -0.5 + 0.1j, 0.1 - 1.2j) - expected_result = ( 1, 1, 0, 0, - 1, 0, 1) - src = gr.vector_source_c (src_data) - op = digital_swig.constellation_decoder_cb (cnst.base()) - dst = gr.vector_sink_b () - - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () # run the graph and wait for it to finish - - actual_result = dst.data () # fetch the contents of the sink - #print "actual result", actual_result - #print "expected result", expected_result - self.assertFloatTuplesAlmostEqual (expected_result, actual_result) - - def test_constellation_decoder_cb_qpsk (self): - cnst = digital_swig.constellation_qpsk() - src_data = (0.5 + 0.5j, 0.1 - 1.2j, -0.8 - 0.1j, -0.45 + 0.8j, - 0.8 + 1.0j, -0.5 + 0.1j, 0.1 - 1.2j) - expected_result = ( 3, 1, 0, 2, - 3, 2, 1) - src = gr.vector_source_c (src_data) - op = digital_swig.constellation_decoder_cb (cnst.base()) - dst = gr.vector_sink_b () - - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () # run the graph and wait for it to finish - - actual_result = dst.data () # fetch the contents of the sink - #print "actual result", actual_result - #print "expected result", expected_result - self.assertFloatTuplesAlmostEqual (expected_result, actual_result) - - -if __name__ == '__main__': - gr_unittest.run(test_constellation_decoder, "test_constellation_decoder.xml") - diff --git a/gr-digital/python/qa_constellation_receiver.py b/gr-digital/python/qa_constellation_receiver.py deleted file mode 100755 index 2d25433b9..000000000 --- a/gr-digital/python/qa_constellation_receiver.py +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -import random - -from gnuradio import gr, blks2, gr_unittest -from utils import mod_codes, alignment -import digital_swig, packet_utils -from generic_mod_demod import generic_mod, generic_demod - -from qa_constellation import tested_constellations, twod_constell - -import math - -# Set a seed so that if errors turn up they are reproducible. -SEED = 1239 - -# TESTING PARAMETERS -# The number of symbols to test with. -# We need this many to let the frequency recovery block converge. -DATA_LENGTH = 2000 -# Test fails if fraction of output that is correct is less than this. -REQ_CORRECT = 0.7 - -# CHANNEL PARAMETERS -NOISE_VOLTAGE = 0.01 -FREQUENCY_OFFSET = 0.01 -TIMING_OFFSET = 1.0 - -# RECEIVER PARAMETERS -FREQ_BW = 2*math.pi/100.0 -PHASE_BW = 2*math.pi/100.0 - - -class test_constellation_receiver (gr_unittest.TestCase): - - # We ignore the first half of the output data since often it takes - # a while for the receiver to lock on. - ignore_fraction = 0.8 - max_data_length = DATA_LENGTH * 6 - max_num_samples = 1000 - - def test_basic(self): - """ - Tests a bunch of different constellations by using generic - modulation, a channel, and generic demodulation. The generic - demodulation uses constellation_receiver which is what - we're really trying to test. - """ - - rndm = random.Random() - rndm.seed(SEED) - # Assumes not more than 64 points in a constellation - # Generates some random input data to use. - self.src_data = tuple( - [rndm.randint(0,1) for i in range(0, self.max_data_length)]) - # Generates some random indices to use for comparing input and - # output data (a full comparison is too slow in python). - self.indices = alignment.random_sample( - self.max_data_length, self.max_num_samples, SEED) - - for constellation, differential in tested_constellations(): - # The constellation_receiver doesn't work for constellations - # of multple dimensions (i.e. multiple complex numbers to a - # single symbol). - # That is not implemented since the receiver has no way of - # knowing where the beginning of a symbol is. - # It also doesn't work for non-differential modulation. - if constellation.dimensionality() != 1 or not differential: - continue - data_length = DATA_LENGTH * constellation.bits_per_symbol() - tb = rec_test_tb(constellation, differential, - src_data=self.src_data[:data_length]) - tb.run() - data = tb.dst.data() - d1 = tb.src_data[:int(len(tb.src_data)*self.ignore_fraction)] - d2 = data[:int(len(data)*self.ignore_fraction)] - correct, overlap, offset, indices = alignment.align_sequences( - d1, d2, indices=self.indices) - self.assertTrue(correct > REQ_CORRECT) - - -class rec_test_tb (gr.top_block): - """ - Takes a constellation an runs a generic modulation, channel, - and generic demodulation. - """ - def __init__(self, constellation, differential, - data_length=None, src_data=None): - """ - constellation -- a constellation object - differential -- whether differential encoding is used - data_length -- the number of bits of data to use - src_data -- a list of the bits to use - """ - super(rec_test_tb, self).__init__() - # Transmission Blocks - if src_data is None: - self.src_data = tuple([rndm.randint(0,1) for i in range(0, data_length)]) - else: - self.src_data = src_data - packer = gr.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) - src = gr.vector_source_b(self.src_data) - mod = generic_mod(constellation, differential=differential) - # Channel - channel = gr.channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET) - # Receiver Blocks - demod = generic_demod(constellation, differential=differential, - freq_bw=FREQ_BW, - phase_bw=PHASE_BW) - self.dst = gr.vector_sink_b() - self.connect(src, packer, mod, channel, demod, self.dst) - -if __name__ == '__main__': - gr_unittest.run(test_constellation_receiver, "test_constellation_receiver.xml") diff --git a/gr-digital/python/qa_correlate_access_code.py b/gr-digital/python/qa_correlate_access_code.py deleted file mode 100755 index 96246dcfb..000000000 --- a/gr-digital/python/qa_correlate_access_code.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2010,2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital -import math - -default_access_code = '\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC' - -def string_to_1_0_list(s): - r = [] - for ch in s: - x = ord(ch) - for i in range(8): - t = (x >> i) & 0x1 - r.append(t) - - return r - -def to_1_0_string(L): - return ''.join(map(lambda x: chr(x + ord('0')), L)) - -class test_correlate_access_code(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_001(self): - pad = (0,) * 64 - # 0 0 0 1 0 0 0 1 - src_data = (1, 0, 1, 1, 1, 1, 0, 1, 1) + pad + (0,) * 7 - expected_result = pad + (1, 0, 1, 1, 3, 1, 0, 1, 1, 2) + (0,) * 6 - src = gr.vector_source_b (src_data) - op = digital.correlate_access_code_bb("1011", 0) - dst = gr.vector_sink_b () - self.tb.connect (src, op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (expected_result, result_data) - - - def test_002(self): - code = tuple(string_to_1_0_list(default_access_code)) - access_code = to_1_0_string(code) - pad = (0,) * 64 - #print code - #print access_code - src_data = code + (1, 0, 1, 1) + pad - expected_result = pad + code + (3, 0, 1, 1) - src = gr.vector_source_b (src_data) - op = digital.correlate_access_code_bb(access_code, 0) - dst = gr.vector_sink_b () - self.tb.connect (src, op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (expected_result, result_data) - - def test_003(self): - code = tuple(string_to_1_0_list(default_access_code)) - access_code = to_1_0_string(code) - pad = (0,) * 64 - #print code - #print access_code - src_data = code + (1, 0, 1, 1) + pad - expected_result = code + (1, 0, 1, 1) + pad - src = gr.vector_source_b (src_data) - op = digital.correlate_access_code_tag_bb(access_code, 0, "test") - dst = gr.vector_sink_b () - self.tb.connect (src, op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (expected_result, result_data) - - -if __name__ == '__main__': - gr_unittest.run(test_correlate_access_code, "test_correlate_access_code.xml") - diff --git a/gr-digital/python/qa_costas_loop_cc.py b/gr-digital/python/qa_costas_loop_cc.py deleted file mode 100755 index 75fdbc2f8..000000000 --- a/gr-digital/python/qa_costas_loop_cc.py +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig, psk -import random, cmath - -class test_costas_loop_cc(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test01 (self): - # test basic functionality by setting all gains to 0 - natfreq = 0.0 - order = 2 - self.test = digital_swig.costas_loop_cc(natfreq, order) - - data = 100*[complex(1,0),] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() - - self.tb.connect(self.src, self.test, self.snk) - self.tb.run() - - expected_result = data - dst_data = self.snk.data() - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) - - def test02 (self): - # Make sure it doesn't diverge given perfect data - natfreq = 0.25 - order = 2 - self.test = digital_swig.costas_loop_cc(natfreq, order) - - data = [complex(2*random.randint(0,1)-1, 0) for i in xrange(100)] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() - - self.tb.connect(self.src, self.test, self.snk) - self.tb.run() - - expected_result = data - dst_data = self.snk.data() - - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) - - def test03 (self): - # BPSK Convergence test with static rotation - natfreq = 0.25 - order = 2 - self.test = digital_swig.costas_loop_cc(natfreq, order) - - rot = cmath.exp(0.2j) # some small rotation - data = [complex(2*random.randint(0,1)-1, 0) for i in xrange(100)] - - N = 40 # settling time - expected_result = data[N:] - data = [rot*d for d in data] - - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() - - self.tb.connect(self.src, self.test, self.snk) - self.tb.run() - - dst_data = self.snk.data()[N:] - - # generously compare results; the loop will converge near to, but - # not exactly on, the target data - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 2) - - def test04 (self): - # QPSK Convergence test with static rotation - natfreq = 0.25 - order = 4 - self.test = digital_swig.costas_loop_cc(natfreq, order) - - rot = cmath.exp(0.2j) # some small rotation - data = [complex(2*random.randint(0,1)-1, 2*random.randint(0,1)-1) - for i in xrange(100)] - - N = 40 # settling time - expected_result = data[N:] - data = [rot*d for d in data] - - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() - - self.tb.connect(self.src, self.test, self.snk) - self.tb.run() - - dst_data = self.snk.data()[N:] - - # generously compare results; the loop will converge near to, but - # not exactly on, the target data - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 2) - - def test05 (self): - # 8PSK Convergence test with static rotation - natfreq = 0.25 - order = 8 - self.test = digital_swig.costas_loop_cc(natfreq, order) - - rot = cmath.exp(-cmath.pi/8.0j) # rotate to match Costas rotation - const = psk.psk_constellation(order) - data = [random.randint(0,7) for i in xrange(100)] - data = [2*rot*const.points()[d] for d in data] - - N = 40 # settling time - expected_result = data[N:] - - rot = cmath.exp(0.1j) # some small rotation - data = [rot*d for d in data] - - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() - - self.tb.connect(self.src, self.test, self.snk) - self.tb.run() - - dst_data = self.snk.data()[N:] - - # generously compare results; the loop will converge near to, but - # not exactly on, the target data - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 2) - -if __name__ == '__main__': - gr_unittest.run(test_costas_loop_cc, "test_costas_loop_cc.xml") diff --git a/gr-digital/python/qa_cpm.py b/gr-digital/python/qa_cpm.py deleted file mode 100755 index 12a84c76c..000000000 --- a/gr-digital/python/qa_cpm.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig -import numpy - -class test_cpm(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def do_check_phase_shift(self, type, name): - sps = 2 - L = 1 - in_bits = (1,) * 20 - src = gr.vector_source_b(in_bits, False) - cpm = digital_swig.cpmmod_bc(type, 0.5, sps, L) - arg = gr.complex_to_arg() - sink = gr.vector_sink_f() - - self.tb.connect(src, cpm, arg, sink) - self.tb.run() - - symbol_phases = numpy.array(sink.data()[sps*L-1::sps]) - phase_diff = numpy.mod(numpy.subtract(symbol_phases[1:], symbol_phases[:-1]), - (2*numpy.pi,) * (len(symbol_phases)-1)) - self.assertFloatTuplesAlmostEqual(tuple(phase_diff), (0.5 * numpy.pi,) * len(phase_diff), 5, - msg="Phase shift was not correct for CPM method " + name) - - def test_001_lrec(self): - self.do_check_phase_shift(gr.cpm.LRC, 'LREC') - - def test_001_lrc(self): - self.do_check_phase_shift(gr.cpm.LRC, 'LRC') - - def test_001_lsrc(self): - self.do_check_phase_shift(gr.cpm.LSRC, 'LSRC') - - def test_001_ltfm(self): - self.do_check_phase_shift(gr.cpm.TFM, 'TFM') - - def test_001_lgmsk(self): - sps = 2 - L = 5 - bt = 0.3 - in_bits = (1,) * 20 - src = gr.vector_source_b(in_bits, False) - gmsk = digital_swig.gmskmod_bc(sps, bt, L) - arg = gr.complex_to_arg() - sink = gr.vector_sink_f() - - self.tb.connect(src, gmsk, arg, sink) - self.tb.run() - - symbol_phases = numpy.array(sink.data()[sps*L-1::sps]) - phase_diff = numpy.mod(numpy.subtract(symbol_phases[1:], symbol_phases[:-1]), - (2*numpy.pi,) * (len(symbol_phases)-1)) - self.assertFloatTuplesAlmostEqual(tuple(phase_diff), (0.5 * numpy.pi,) * len(phase_diff), 5, - msg="Phase shift was not correct for GMSK") - - def test_phase_response(self): - phase_response = gr.cpm.phase_response(gr.cpm.LREC, 2, 4) - self.assertAlmostEqual(numpy.sum(phase_response), 1) - - -if __name__ == '__main__': - gr_unittest.run(test_cpm, "test_cpm.xml") - diff --git a/gr-digital/python/qa_crc32.py b/gr-digital/python/qa_crc32.py deleted file mode 100755 index f86813f3f..000000000 --- a/gr-digital/python/qa_crc32.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig -import random, cmath - -class test_crc32(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test01 (self): - data = 100*"0" - expected_result = 2943744955 - result = digital_swig.crc32(data) - #print hex(result) - - self.assertEqual (expected_result, result) - - def test02 (self): - data = 100*"1" - expected_result = 2326594156 - result = digital_swig.crc32(data) - #print hex(result) - - self.assertEqual (expected_result, result) - - def test03 (self): - data = 10*"0123456789" - expected_result = 3774345973 - result = digital_swig.crc32(data) - #print hex(result) - - self.assertEqual (expected_result, result) - -if __name__ == '__main__': - gr_unittest.run(test_crc32, "test_crc32.xml") diff --git a/gr-digital/python/qa_diff_encoder.py b/gr-digital/python/qa_diff_encoder.py deleted file mode 100755 index e4f5470af..000000000 --- a/gr-digital/python/qa_diff_encoder.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2010,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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital -import math -import random - -def make_random_int_tuple(L, min, max): - result = [] - for x in range(L): - result.append(random.randint(min, max)) - return tuple(result) - - -class test_diff_encoder (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_diff_encdec_000(self): - random.seed(0) - modulus = 2 - src_data = make_random_int_tuple(1000, 0, modulus-1) - expected_result = src_data - src = gr.vector_source_b(src_data) - enc = digital.diff_encoder_bb(modulus) - dec = digital.diff_decoder_bb(modulus) - dst = gr.vector_sink_b() - self.tb.connect(src, enc, dec, dst) - self.tb.run() # run the graph and wait for it to finish - actual_result = dst.data() # fetch the contents of the sink - self.assertEqual(expected_result, actual_result) - - def test_diff_encdec_001(self): - random.seed(0) - modulus = 4 - src_data = make_random_int_tuple(1000, 0, modulus-1) - expected_result = src_data - src = gr.vector_source_b(src_data) - enc = digital.diff_encoder_bb(modulus) - dec = digital.diff_decoder_bb(modulus) - dst = gr.vector_sink_b() - self.tb.connect(src, enc, dec, dst) - self.tb.run() # run the graph and wait for it to finish - actual_result = dst.data() # fetch the contents of the sink - self.assertEqual(expected_result, actual_result) - - def test_diff_encdec_002(self): - random.seed(0) - modulus = 8 - src_data = make_random_int_tuple(40000, 0, modulus-1) - expected_result = src_data - src = gr.vector_source_b(src_data) - enc = digital.diff_encoder_bb(modulus) - dec = digital.diff_decoder_bb(modulus) - dst = gr.vector_sink_b() - self.tb.connect(src, enc, dec, dst) - self.tb.run() # run the graph and wait for it to finish - actual_result = dst.data() # fetch the contents of the sink - self.assertEqual(expected_result, actual_result) - -if __name__ == '__main__': - gr_unittest.run(test_diff_encoder, "test_diff_encoder.xml") - diff --git a/gr-digital/python/qa_diff_phasor_cc.py b/gr-digital/python/qa_diff_phasor_cc.py deleted file mode 100755 index 3e7617fe4..000000000 --- a/gr-digital/python/qa_diff_phasor_cc.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital -import math - -class test_diff_phasor (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_diff_phasor_cc (self): - src_data = (0+0j, 1+0j, -1+0j, 3+4j, -3-4j, -3+4j) - expected_result = (0+0j, 0+0j, -1+0j, -3-4j, -25+0j, -7-24j) - src = gr.vector_source_c (src_data) - op = digital.diff_phasor_cc () - dst = gr.vector_sink_c () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () # run the graph and wait for it to finish - actual_result = dst.data () # fetch the contents of the sink - self.assertComplexTuplesAlmostEqual (expected_result, actual_result) - -if __name__ == '__main__': - gr_unittest.run(test_diff_phasor, "test_diff_phasor.xml") - diff --git a/gr-digital/python/qa_digital.py b/gr-digital/python/qa_digital.py deleted file mode 100755 index 97e35da56..000000000 --- a/gr-digital/python/qa_digital.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig - -class test_digital(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - -if __name__ == '__main__': - gr_unittest.run(test_digital, "test_digital.xml") diff --git a/gr-digital/python/qa_fll_band_edge.py b/gr-digital/python/qa_fll_band_edge.py deleted file mode 100755 index 9e4ca079b..000000000 --- a/gr-digital/python/qa_fll_band_edge.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig -import random, math - -class test_fll_band_edge_cc(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test01 (self): - sps = 4 - rolloff = 0.35 - bw = 2*math.pi/100.0 - ntaps = 45 - - # Create pulse shape filter - rrc_taps = gr.firdes.root_raised_cosine( - sps, sps, 1.0, rolloff, ntaps) - - # The frequency offset to correct - foffset = 0.2 / (2.0*math.pi) - - # Create a set of 1's and -1's, pulse shape and interpolate to sps - random.seed(0) - data = [2.0*random.randint(0, 2) - 1.0 for i in xrange(200)] - self.src = gr.vector_source_c(data, False) - self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps) - - # Mix symbols with a complex sinusoid to spin them - self.nco = gr.sig_source_c(1, gr.GR_SIN_WAVE, foffset, 1) - self.mix = gr.multiply_cc() - - # FLL will despin the symbols to an arbitrary phase - self.fll = digital_swig.fll_band_edge_cc(sps, rolloff, ntaps, bw) - - # Create sinks for all outputs of the FLL - # we will only care about the freq and error outputs - self.vsnk_frq = gr.vector_sink_f() - self.nsnk_fll = gr.null_sink(gr.sizeof_gr_complex) - self.nsnk_phs = gr.null_sink(gr.sizeof_float) - self.nsnk_err = gr.null_sink(gr.sizeof_float) - - # Connect the blocks - self.tb.connect(self.nco, (self.mix,1)) - self.tb.connect(self.src, self.rrc, (self.mix,0)) - self.tb.connect(self.mix, self.fll, self.nsnk_fll) - self.tb.connect((self.fll,1), self.vsnk_frq) - self.tb.connect((self.fll,2), self.nsnk_phs) - self.tb.connect((self.fll,3), self.nsnk_err) - self.tb.run() - - N = 700 - dst_data = self.vsnk_frq.data()[N:] - - expected_result = len(dst_data)* [-0.20,] - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4) - -if __name__ == '__main__': - gr_unittest.run(test_fll_band_edge_cc, "test_fll_band_edge_cc.xml") diff --git a/gr-digital/python/qa_framer_sink.py b/gr-digital/python/qa_framer_sink.py deleted file mode 100755 index bccc86dc7..000000000 --- a/gr-digital/python/qa_framer_sink.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital - -default_access_code = '\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC' - -def string_to_1_0_list(s): - r = [] - for ch in s: - x = ord(ch) - for i in range(8): - t = (x >> i) & 0x1 - r.append(t) - return r - -def to_1_0_string(L): - return ''.join(map(lambda x: chr(x + ord('0')), L)) - -class test_framker_sink(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_001(self): - - code = (1, 1, 0, 1) - access_code = to_1_0_string(code) - header = tuple(2*[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]) # len=1 - pad = (0,) * 100 - src_data = code + header + (0,1,0,0,0,0,0,1) + pad - expected_data = 'A' - - rcvd_pktq = gr.msg_queue() - - src = gr.vector_source_b(src_data) - correlator = digital.correlate_access_code_bb(access_code, 0) - framer_sink = digital.framer_sink_1(rcvd_pktq) - vsnk = gr.vector_sink_b() - - self.tb.connect(src, correlator, framer_sink) - self.tb.connect(correlator, vsnk) - self.tb.run () - - result_data = rcvd_pktq.delete_head() - result_data = result_data.to_string() - self.assertEqual (expected_data, result_data) - - def test_002(self): - - code = tuple(string_to_1_0_list(default_access_code)) - access_code = to_1_0_string(code) - header = tuple(2*[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0]) # len=2 - pad = (0,) * 100 - src_data = code + header + (0,1,0,0,1,0,0,0) + (0,1,0,0,1,0,0,1) + pad - expected_data = 'HI' - - rcvd_pktq = gr.msg_queue() - - src = gr.vector_source_b(src_data) - correlator = digital.correlate_access_code_bb(access_code, 0) - framer_sink = digital.framer_sink_1(rcvd_pktq) - vsnk = gr.vector_sink_b() - - self.tb.connect(src, correlator, framer_sink) - self.tb.connect(correlator, vsnk) - self.tb.run () - - result_data = rcvd_pktq.delete_head() - result_data = result_data.to_string() - self.assertEqual (expected_data, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_framker_sink, "test_framker_sink.xml") - diff --git a/gr-digital/python/qa_glfsr_source.py b/gr-digital/python/qa_glfsr_source.py deleted file mode 100755 index 157520d7f..000000000 --- a/gr-digital/python/qa_glfsr_source.py +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2010,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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital - -class test_glfsr_source(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_000_make_b(self): - src = digital.glfsr_source_b(16) - self.assertEquals(src.mask(), 0x8016) - self.assertEquals(src.period(), 2**16-1) - - def test_001_degree_b(self): - self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_b(0)) - self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_b(33)) - - def test_002_correlation_b(self): - for degree in range(1,11): # Higher degrees take too long to correlate - src = digital.glfsr_source_b(degree, False) - b2f = digital.chunks_to_symbols_bf((-1.0,1.0), 1) - dst = gr.vector_sink_f() - del self.tb # Discard existing top block - self.tb = gr.top_block() - self.tb.connect(src, b2f, dst) - self.tb.run() - self.tb.disconnect_all() - actual_result = dst.data() - R = auto_correlate(actual_result) - self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at origin - for i in range(len(R)-1): - self.assertEqual(R[i+1], -1.0) # Auto-correlation minimum everywhere else - - def test_003_make_f(self): - src = digital.glfsr_source_f(16) - self.assertEquals(src.mask(), 0x8016) - self.assertEquals(src.period(), 2**16-1) - - def test_004_degree_f(self): - self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_f(0)) - self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_f(33)) - def test_005_correlation_f(self): - for degree in range(1,11): # Higher degrees take too long to correlate - src = digital.glfsr_source_f(degree, False) - dst = gr.vector_sink_f() - del self.tb # Discard existing top block - self.tb = gr.top_block() - self.tb.connect(src, dst) - self.tb.run() - - actual_result = dst.data() - R = auto_correlate(actual_result) - self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at origin - for i in range(len(R)-1): - self.assertEqual(R[i+1], -1.0) # Auto-correlation minimum everywhere else - -def auto_correlate(data): - l = len(data) - R = [0,]*l - for lag in range(l): - for i in range(l): - R[lag] += data[i]*data[i-lag] - return R - -if __name__ == '__main__': - gr_unittest.run(test_glfsr_source, "test_glfsr_source.xml") diff --git a/gr-digital/python/qa_lms_equalizer.py b/gr-digital/python/qa_lms_equalizer.py deleted file mode 100755 index 025c785aa..000000000 --- a/gr-digital/python/qa_lms_equalizer.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2010,2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig - -class test_lms_dd_equalizer(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def transform(self, src_data, gain, const): - SRC = gr.vector_source_c(src_data, False) - EQU = digital_swig.lms_dd_equalizer_cc(4, gain, 1, const.base()) - DST = gr.vector_sink_c() - self.tb.connect(SRC, EQU, DST) - self.tb.run() - return DST.data() - - def test_001_identity(self): - # Constant modulus signal so no adjustments - const = digital_swig.constellation_qpsk() - src_data = const.points()*1000 - - N = 100 # settling time - expected_data = src_data[N:] - result = self.transform(src_data, 0.1, const)[N:] - self.assertComplexTuplesAlmostEqual(expected_data, result, 5) - -if __name__ == "__main__": - gr_unittest.run(test_lms_dd_equalizer, "test_lms_dd_equalizer.xml") diff --git a/gr-digital/python/qa_map.py b/gr-digital/python/qa_map.py deleted file mode 100755 index 3ad99a2c1..000000000 --- a/gr-digital/python/qa_map.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital - -class test_map(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def helper(self, symbols): - src_data = [0, 1, 2, 3, 0, 1, 2, 3] - expected_data = map(lambda x: symbols[x], src_data) - src = gr.vector_source_b (src_data) - op = digital.map_bb(symbols) - dst = gr.vector_sink_b () - self.tb.connect (src, op, dst) - self.tb.run () - - result_data = list(dst.data()) - self.assertEqual (expected_data, result_data) - - def test_001(self): - symbols = [0, 0, 0, 0] - self.helper(symbols) - - def test_002(self): - symbols = [3, 2, 1, 0] - self.helper(symbols) - - def test_003(self): - symbols = [8-1, 32-1, 128, 256-1] - self.helper(symbols) - -if __name__ == '__main__': - gr_unittest.run(test_map, "test_map.xml") - diff --git a/gr-digital/python/qa_mpsk_receiver.py b/gr-digital/python/qa_mpsk_receiver.py deleted file mode 100755 index e1f16ee67..000000000 --- a/gr-digital/python/qa_mpsk_receiver.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig -import random, cmath - -class test_mpsk_receiver(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test01 (self): - # Test BPSK sync - M = 2 - theta = 0 - loop_bw = cmath.pi/100.0 - fmin = -0.5 - fmax = 0.5 - mu = 0.25 - gain_mu = 0.01 - omega = 2 - gain_omega = 0.001 - omega_rel = 0.001 - - self.test = digital_swig.mpsk_receiver_cc(M, theta, loop_bw, - fmin, fmax, mu, gain_mu, - omega, gain_omega, - omega_rel) - - data = 1000*[complex(1,0), complex(1,0), complex(-1,0), complex(-1,0)] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() - - self.tb.connect(self.src, self.test, self.snk) - self.tb.run() - - expected_result = 1000*[complex(-0.5,0), complex(0.5,0)] - dst_data = self.snk.data() - - # Only compare last Ncmp samples - Ncmp = 100 - len_e = len(expected_result) - len_d = len(dst_data) - expected_result = expected_result[len_e - Ncmp:] - dst_data = dst_data[len_d - Ncmp:] - - #for e,d in zip(expected_result, dst_data): - # print e, d - - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1) - - - def test02 (self): - # Test QPSK sync - M = 4 - theta = 0 - loop_bw = 2*cmath.pi/100.0 - fmin = -0.5 - fmax = 0.5 - mu = 0.25 - gain_mu = 0.01 - omega = 2 - gain_omega = 0.001 - omega_rel = 0.001 - - self.test = digital_swig.mpsk_receiver_cc(M, theta, loop_bw, - fmin, fmax, mu, gain_mu, - omega, gain_omega, - omega_rel) - - data = 1000*[complex( 0.707, 0.707), complex( 0.707, 0.707), - complex(-0.707, 0.707), complex(-0.707, 0.707), - complex(-0.707, -0.707), complex(-0.707, -0.707), - complex( 0.707, -0.707), complex( 0.707, -0.707)] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() - - self.tb.connect(self.src, self.test, self.snk) - self.tb.run() - - expected_result = 1000*[complex(0, -1.0), complex(1.0, 0), - complex(0, 1.0), complex(-1.0, 0)] - dst_data = self.snk.data() - - # Only compare last Ncmp samples - Ncmp = 100 - len_e = len(expected_result) - len_d = len(dst_data) - expected_result = expected_result[len_e - Ncmp:] - dst_data = dst_data[len_d - Ncmp:] - - #for e,d in zip(expected_result, dst_data): - # print e, d - - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1) - -if __name__ == '__main__': - gr_unittest.run(test_mpsk_receiver, "test_mpsk_receiver.xml") diff --git a/gr-digital/python/qa_mpsk_snr_est.py b/gr-digital/python/qa_mpsk_snr_est.py deleted file mode 100755 index e21bad831..000000000 --- a/gr-digital/python/qa_mpsk_snr_est.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital -import math, random - -def get_cplx(): - return complex(2*random.randint(0,1) - 1, 0) -def get_n_cplx(): - return complex(random.random()-0.5, random.random()-0.5) - -class test_mpsk_snr_est (gr_unittest.TestCase): - def setUp (self): - self.tb = gr.top_block () - - random.seed(0) # make repeatable - N = 10000 - self._noise = [get_n_cplx() for i in xrange(N)] - self._bits = [get_cplx() for i in xrange(N)] - - def tearDown (self): - self.tb = None - - def mpsk_snr_est_setup (self, op): - result = [] - for i in xrange(1,6): - src_data = [b+(i*n) for b,n in zip(self._bits, self._noise)] - - src = gr.vector_source_c (src_data) - dst = gr.null_sink (gr.sizeof_gr_complex) - - tb = gr.top_block () - tb.connect (src, op) - tb.connect (op, dst) - tb.run () # run the graph and wait for it to finish - - result.append(op.snr()) - return result - - def test_mpsk_snr_est_simple (self): - expected_result = [11.48, 5.91, 3.30, 2.08, 1.46] - - N = 10000 - alpha = 0.001 - op = digital.mpsk_snr_est_cc (digital.SNR_EST_SIMPLE, N, alpha) - - actual_result = self.mpsk_snr_est_setup(op) - self.assertFloatTuplesAlmostEqual (expected_result, actual_result, 2) - - def test_mpsk_snr_est_skew (self): - expected_result = [11.48, 5.91, 3.30, 2.08, 1.46] - - N = 10000 - alpha = 0.001 - op = digital.mpsk_snr_est_cc (digital.SNR_EST_SKEW, N, alpha) - - actual_result = self.mpsk_snr_est_setup(op) - self.assertFloatTuplesAlmostEqual (expected_result, actual_result, 2) - - def test_mpsk_snr_est_m2m4 (self): - expected_result = [11.02, 6.20, 4.98, 5.16, 5.66] - - N = 10000 - alpha = 0.001 - op = digital.mpsk_snr_est_cc (digital.SNR_EST_M2M4, N, alpha) - - actual_result = self.mpsk_snr_est_setup(op) - self.assertFloatTuplesAlmostEqual (expected_result, actual_result, 2) - - def test_mpsk_snr_est_svn (self): - expected_result = [10.92, 6.02, 4.78, 4.98, 5.51] - - N = 10000 - alpha = 0.001 - op = digital.mpsk_snr_est_cc (digital.SNR_EST_SVR, N, alpha) - - actual_result = self.mpsk_snr_est_setup(op) - self.assertFloatTuplesAlmostEqual (expected_result, actual_result, 2) - - def test_probe_mpsk_snr_est_m2m4 (self): - expected_result = [11.02, 6.20, 4.98, 5.16, 5.66] - - actual_result = [] - for i in xrange(1,6): - src_data = [b+(i*n) for b,n in zip(self._bits, self._noise)] - - src = gr.vector_source_c (src_data) - - N = 10000 - alpha = 0.001 - op = digital.probe_mpsk_snr_est_c (digital.SNR_EST_M2M4, N, alpha) - - tb = gr.top_block () - tb.connect (src, op) - tb.run () # run the graph and wait for it to finish - - actual_result.append(op.snr()) - self.assertFloatTuplesAlmostEqual (expected_result, actual_result, 2) - - -if __name__ == '__main__': - # Test various SNR estimators; we're not using a Gaussian - # noise source, so these estimates have no real meaning; - # just a sanity check. - gr_unittest.run(test_mpsk_snr_est, "test_mpsk_snr_est.xml") - diff --git a/gr-digital/python/qa_ofdm_insert_preamble.py b/gr-digital/python/qa_ofdm_insert_preamble.py deleted file mode 100755 index c45893fa3..000000000 --- a/gr-digital/python/qa_ofdm_insert_preamble.py +++ /dev/null @@ -1,180 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2010,2011 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. -# - -from gnuradio import gr, gr_unittest -from pprint import pprint -import digital_swig - -class test_ofdm_insert_preamble (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def helper(self, v0, v1, fft_length, preamble): - tb = self.tb - src0 = gr.vector_source_c(v0) - src1 = gr.vector_source_b(v1) - - s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_length) - - # print "len(v) = %d" % (len(v)) - - op = digital_swig.ofdm_insert_preamble(fft_length, preamble) - - v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_length) - dst0 = gr.vector_sink_c() - dst1 = gr.vector_sink_b() - - tb.connect(src0, s2v, (op, 0)) - tb.connect(src1, (op, 1)) - tb.connect((op, 0), v2s, dst0) - tb.connect((op, 1), dst1) - - tb.run() - r0 = dst0.data() - r0v = [] - for i in range(len(r0)//fft_length): - r0v.append(r0[i*fft_length:(i+1)*fft_length]) - - r1 = dst1.data() - self.assertEqual(len(r0v), len(r1)) - return (r1, r0v) - - def check_match(self, actual, expected_list): - lst = [] - map(lambda x: lst.append(x), expected_list) - self.assertEqual(actual, lst) - - - # ---------------------------------------------------------------- - - def test_000(self): - # no preamble, 1 symbol payloads - - preamble = () - fft_length = 8 - npayloads = 8 - v = [] - p = [] - for i in range(npayloads): - t = fft_length*[(i + i*1j)] - p.append(tuple(t)) - v += t - - p = tuple(p) - - r = self.helper(v, npayloads*[1], fft_length, preamble) - # pprint(r) - - self.assertEqual(r[0], tuple(npayloads*[1])) - self.check_match(r[1], (p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7])) - - - def test_001(self): - # 1 symbol preamble, 1 symbol payloads - preamble = ((100, 101, 102, 103, 104, 105, 106, 107),) - p0 = preamble[0] - fft_length = 8 - npayloads = 8 - v = [] - p = [] - for i in range(npayloads): - t = fft_length*[(i + i*1j)] - p.append(tuple(t)) - v += t - - - r = self.helper(v, npayloads*[1], fft_length, preamble) - - self.assertEqual(r[0], tuple(npayloads*[1, 0])) - self.check_match(r[1], (p0, p[0], - p0, p[1], - p0, p[2], - p0, p[3], - p0, p[4], - p0, p[5], - p0, p[6], - p0, p[7])) - - def test_002(self): - # 2 symbol preamble, 1 symbol payloads - preamble = ((100, 101, 102, 103, 104, 105, 106, 107), - (200, 201, 202, 203, 204, 205, 206, 207)) - p0 = preamble[0] - p1 = preamble[1] - - fft_length = 8 - npayloads = 8 - v = [] - p = [] - for i in range(npayloads): - t = fft_length*[(i + i*1j)] - p.append(tuple(t)) - v += t - - r = self.helper(v, npayloads*[1], fft_length, preamble) - - self.assertEqual(r[0], tuple(npayloads*[1, 0, 0])) - self.check_match(r[1], (p0, p1, p[0], - p0, p1, p[1], - p0, p1, p[2], - p0, p1, p[3], - p0, p1, p[4], - p0, p1, p[5], - p0, p1, p[6], - p0, p1, p[7])) - - - def xtest_003_preamble(self): - # 2 symbol preamble, 2 symbol payloads - preamble = ((100, 101, 102, 103, 104, 105, 106, 107), - (200, 201, 202, 203, 204, 205, 206, 207)) - p0 = preamble[0] - p1 = preamble[1] - - fft_length = 8 - npayloads = 8 - v = [] - p = [] - for i in range(npayloads * 2): - t = fft_length*[(i + i*1j)] - p.append(tuple(t)) - v += t - - r = self.helper(v, npayloads*[1, 0], fft_length, preamble) - - self.assertEqual(r[0], tuple(npayloads*[1, 0, 0, 0])) - self.check_match(r[1], (p0, p1, p[0], p[1], - p0, p1, p[2], p[3], - p0, p1, p[4], p[5], - p0, p1, p[6], p[7], - p0, p1, p[8], p[9], - p0, p1, p[10], p[11], - p0, p1, p[12], p[13], - p0, p1, p[14], p[15])) - - -if __name__ == '__main__': - gr_unittest.run(test_ofdm_insert_preamble, "test_ofdm_insert_preamble.xml") diff --git a/gr-digital/python/qa_pfb_clock_sync.py b/gr-digital/python/qa_pfb_clock_sync.py deleted file mode 100755 index 06c8a60ba..000000000 --- a/gr-digital/python/qa_pfb_clock_sync.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital -import random, cmath - -class test_pfb_clock_sync(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test01 (self): - # Test BPSK sync - excess_bw = 0.35 - - sps = 4 - loop_bw = cmath.pi/100.0 - nfilts = 32 - init_phase = nfilts/2 - max_rate_deviation = 1.5 - osps = 1 - - ntaps = 11 * int(sps*nfilts) - taps = gr.firdes.root_raised_cosine(nfilts, nfilts*sps, - 1.0, excess_bw, ntaps) - - self.test = digital.pfb_clock_sync_ccf(sps, loop_bw, taps, - nfilts, init_phase, - max_rate_deviation, - osps) - - data = 1000*[complex(1,0), complex(-1,0)] - self.src = gr.vector_source_c(data, False) - - # pulse shaping interpolation filter - rrc_taps = gr.firdes.root_raised_cosine( - nfilts, # gain - nfilts, # sampling rate based on 32 filters in resampler - 1.0, # symbol rate - excess_bw, # excess bandwidth (roll-off factor) - ntaps) - self.rrc_filter = gr.pfb_arb_resampler_ccf(sps, rrc_taps) - - self.snk = gr.vector_sink_c() - - self.tb.connect(self.src, self.rrc_filter, self.test, self.snk) - self.tb.run() - - expected_result = 1000*[complex(-1,0), complex(1,0)] - dst_data = self.snk.data() - - # Only compare last Ncmp samples - Ncmp = 100 - len_e = len(expected_result) - len_d = len(dst_data) - expected_result = expected_result[len_e - Ncmp:] - dst_data = dst_data[len_d - Ncmp:] - - #for e,d in zip(expected_result, dst_data): - # print e, d - - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1) - - - def test02 (self): - # Test real BPSK sync - excess_bw = 0.35 - - sps = 4 - loop_bw = cmath.pi/100.0 - nfilts = 32 - init_phase = nfilts/2 - max_rate_deviation = 1.5 - osps = 1 - - ntaps = 11 * int(sps*nfilts) - taps = gr.firdes.root_raised_cosine(nfilts, nfilts*sps, - 1.0, excess_bw, ntaps) - - self.test = digital.pfb_clock_sync_fff(sps, loop_bw, taps, - nfilts, init_phase, - max_rate_deviation, - osps) - - data = 1000*[1, -1] - self.src = gr.vector_source_f(data, False) - - # pulse shaping interpolation filter - rrc_taps = gr.firdes.root_raised_cosine( - nfilts, # gain - nfilts, # sampling rate based on 32 filters in resampler - 1.0, # symbol rate - excess_bw, # excess bandwidth (roll-off factor) - ntaps) - self.rrc_filter = gr.pfb_arb_resampler_fff(sps, rrc_taps) - - self.snk = gr.vector_sink_f() - - self.tb.connect(self.src, self.rrc_filter, self.test, self.snk) - self.tb.run() - - expected_result = 1000*[-1, 1] - dst_data = self.snk.data() - - # Only compare last Ncmp samples - Ncmp = 100 - len_e = len(expected_result) - len_d = len(dst_data) - expected_result = expected_result[len_e - Ncmp:] - dst_data = dst_data[len_d - Ncmp:] - - #for e,d in zip(expected_result, dst_data): - # print e, d - - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1) - - -if __name__ == '__main__': - gr_unittest.run(test_pfb_clock_sync, "test_pfb_clock_sync.xml") diff --git a/gr-digital/python/qa_pn_correlator_cc.py b/gr-digital/python/qa_pn_correlator_cc.py deleted file mode 100755 index 377bef5fe..000000000 --- a/gr-digital/python/qa_pn_correlator_cc.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2010,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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital - -class test_pn_correlator_cc(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block () - - def tearDown(self): - self.tb = None - - def test_000_make(self): - c = digital.pn_correlator_cc(10) - - def test_001_correlate(self): - degree = 10 - length = 2**degree-1 - src = digital.glfsr_source_f(degree) - head = gr.head(gr.sizeof_float, length*length) - f2c = gr.float_to_complex() - corr = digital.pn_correlator_cc(degree) - dst = gr.vector_sink_c() - self.tb.connect(src, head, f2c, corr, dst) - self.tb.run() - data = dst.data() - self.assertEqual(data[-1], (1.0+0j)) - -if __name__ == '__main__': - gr_unittest.run(test_pn_correlator_cc, "test_pn_correlator_cc.xml") diff --git a/gr-digital/python/qa_probe_density.py b/gr-digital/python/qa_probe_density.py deleted file mode 100755 index c5b7e0e7c..000000000 --- a/gr-digital/python/qa_probe_density.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital - -class test_probe_density(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_001(self): - src_data = [0, 1, 0, 1] - expected_data = 1 - src = gr.vector_source_b (src_data) - op = digital.probe_density_b(1) - self.tb.connect (src, op) - self.tb.run () - - result_data = op.density() - self.assertEqual (expected_data, result_data) - - - def test_002(self): - src_data = [1, 1, 1, 1] - expected_data = 1 - src = gr.vector_source_b (src_data) - op = digital.probe_density_b(0.01) - self.tb.connect (src, op) - self.tb.run () - - result_data = op.density() - self.assertEqual (expected_data, result_data) - - def test_003(self): - src_data = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1] - expected_data = 0.95243 - src = gr.vector_source_b (src_data) - op = digital.probe_density_b(0.01) - self.tb.connect (src, op) - self.tb.run () - - result_data = op.density() - print result_data - self.assertAlmostEqual (expected_data, result_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_probe_density, "test_probe_density.xml") - diff --git a/gr-digital/python/qa_scrambler.py b/gr-digital/python/qa_scrambler.py deleted file mode 100755 index f5bd61242..000000000 --- a/gr-digital/python/qa_scrambler.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008,2010,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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital - -class test_scrambler(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_scrambler_descrambler(self): - src_data = (1,)*1000 - src = gr.vector_source_b(src_data, False) - scrambler = digital.scrambler_bb(0x8a, 0x7F, 7) # CCSDS 7-bit scrambler - descrambler = digital.descrambler_bb(0x8a, 0x7F, 7) - dst = gr.vector_sink_b() - self.tb.connect(src, scrambler, descrambler, dst) - self.tb.run() - self.assertEqual(tuple(src_data[:-8]), dst.data()[8:]) # skip garbage during synchronization - - def test_additive_scrambler(self): - src_data = (1,)*1000 - src = gr.vector_source_b(src_data, False) - scrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7) - descrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7) - dst = gr.vector_sink_b() - self.tb.connect(src, scrambler, descrambler, dst) - self.tb.run() - self.assertEqual(src_data, dst.data()) - - def test_additive_scrambler_reset(self): - src_data = (1,)*1000 - src = gr.vector_source_b(src_data, False) - scrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7, 100) - descrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7, 100) - dst = gr.vector_sink_b() - self.tb.connect(src, scrambler, descrambler, dst) - self.tb.run() - self.assertEqual(src_data, dst.data()) - -if __name__ == '__main__': - gr_unittest.run(test_scrambler, "test_scrambler.xml") diff --git a/gr-digital/python/qa_simple_correlator.py b/gr-digital/python/qa_simple_correlator.py deleted file mode 100755 index 124201a55..000000000 --- a/gr-digital/python/qa_simple_correlator.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital - -class test_simple_correlator(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_00(self): - expected_result = ( - 0x00, 0x11, 0x22, 0x33, - 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, - 0xcc, 0xdd, 0xee, 0xff) - - # Filter taps to expand the data to oversample by 8 - # Just using a RRC for some basic filter shape - taps = gr.firdes.root_raised_cosine(8, 8, 1.0, 0.5, 21) - - src = gr.vector_source_b(expected_result) - frame = digital.simple_framer(4) - unpack = gr.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST) - expand = gr.interp_fir_filter_fff(8, taps) - b2f = gr.char_to_float() - mult2 = gr.multiply_const_ff(2) - sub1 = gr.add_const_ff(-1) - op = digital.simple_correlator(4) - dst = gr.vector_sink_b() - self.tb.connect(src, frame, unpack, b2f, mult2, sub1, expand) - self.tb.connect(expand, op, dst) - self.tb.run() - result_data = dst.data() - - self.assertEqual(expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_simple_correlator, "test_simple_correlator.xml") diff --git a/gr-digital/python/qa_simple_framer.py b/gr-digital/python/qa_simple_framer.py deleted file mode 100755 index 09b2d329b..000000000 --- a/gr-digital/python/qa_simple_framer.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010,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. -# - -from gnuradio import gr, gr_unittest -import digital_swig as digital -import math - -class test_simple_framer (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_simple_framer_001 (self): - src_data = (0x00, 0x11, 0x22, 0x33, - 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, - 0xcc, 0xdd, 0xee, 0xff) - - expected_result = ( - 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x00, 0x00, 0x11, 0x22, 0x33, 0x55, - 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x01, 0x44, 0x55, 0x66, 0x77, 0x55, - 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x02, 0x88, 0x99, 0xaa, 0xbb, 0x55, - 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x03, 0xcc, 0xdd, 0xee, 0xff, 0x55) - - src = gr.vector_source_b (src_data) - op = digital.simple_framer (4) - dst = gr.vector_sink_b () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (expected_result, result_data) - - -if __name__ == '__main__': - gr_unittest.run(test_simple_framer, "test_simple_framer.xml") - diff --git a/gr-digital/python/qam.py b/gr-digital/python/qam.py deleted file mode 100644 index 5b1f7683b..000000000 --- a/gr-digital/python/qam.py +++ /dev/null @@ -1,229 +0,0 @@ -# -# Copyright 2005,2006,2011 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. -# - -""" -QAM modulation and demodulation. -""" - -from math import pi, sqrt, log - -from gnuradio import gr -from generic_mod_demod import generic_mod, generic_demod -from utils.gray_code import gray_code -from utils import mod_codes -import modulation_utils -import digital_swig - -# Default number of points in constellation. -_def_constellation_points = 16 -# Whether the quadrant bits are coded differentially. -_def_differential = True -# Whether gray coding is used. If differential is True then gray -# coding is used within but not between each quadrant. -_def_mod_code = mod_codes.NO_CODE - -def is_power_of_four(x): - v = log(x)/log(4) - return int(v) == v - -def get_bit(x, n): - """ Get the n'th bit of integer x (from little end).""" - return (x&(0x01 << n)) >> n - -def get_bits(x, n, k): - """ Get the k bits of integer x starting at bit n(from little end).""" - # Remove the n smallest bits - v = x >> n - # Remove all bits bigger than n+k-1 - return v % pow(2, k) - -def make_differential_constellation(m, gray_coded): - """ - Create a constellation with m possible symbols where m must be - a power of 4. - - Points are laid out in a square grid. - - Bits referring to the quadrant are differentilly encoded, - remaining bits are gray coded. - - """ - sqrtm = pow(m, 0.5) - if (not isinstance(m, int) or m < 4 or not is_power_of_four(m)): - raise ValueError("m must be a power of 4 integer.") - # Each symbol holds k bits. - k = int(log(m) / log(2.0)) - # First create a constellation for one quadrant containing m/4 points. - # The quadrant has 'side' points along each side of a quadrant. - side = int(sqrtm/2) - if gray_coded: - # Number rows and columns using gray codes. - gcs = gray_code(side) - # Get inverse gray codes. - i_gcs = dict([(v, key) for key, v in enumerate(gcs)]) - else: - i_gcs = dict([(i, i) for i in range(0, side)]) - # The distance between points is found. - step = 1/(side-0.5) - - gc_to_x = [(i_gcs[gc]+0.5)*step for gc in range(0, side)] - - # Takes the (x, y) location of the point with the quadrant along - # with the quadrant number. (x, y) are integers referring to which - # point within the quadrant it is. - # A complex number representing this location of this point is returned. - def get_c(gc_x, gc_y, quad): - if quad == 0: - return complex(gc_to_x[gc_x], gc_to_x[gc_y]) - if quad == 1: - return complex(-gc_to_x[gc_y], gc_to_x[gc_x]) - if quad == 2: - return complex(-gc_to_x[gc_x], -gc_to_x[gc_y]) - if quad == 3: - return complex(gc_to_x[gc_y], -gc_to_x[gc_x]) - raise StandardError("Impossible!") - - # First two bits determine quadrant. - # Next (k-2)/2 bits determine x position. - # Following (k-2)/2 bits determine y position. - # How x and y relate to real and imag depends on quadrant (see get_c function). - const_map = [] - for i in range(m): - y = get_bits(i, 0, (k-2)/2) - x = get_bits(i, (k-2)/2, (k-2)/2) - quad = get_bits(i, k-2, 2) - const_map.append(get_c(x, y, quad)) - - return const_map - -def make_non_differential_constellation(m, gray_coded): - side = int(pow(m, 0.5)) - if (not isinstance(m, int) or m < 4 or not is_power_of_four(m)): - raise ValueError("m must be a power of 4 integer.") - # Each symbol holds k bits. - k = int(log(m) / log(2.0)) - if gray_coded: - # Number rows and columns using gray codes. - gcs = gray_code(side) - # Get inverse gray codes. - i_gcs = mod_codes.invert_code(gcs) - else: - i_gcs = range(0, side) - # The distance between points is found. - step = 2.0/(side-1) - - gc_to_x = [-1 + i_gcs[gc]*step for gc in range(0, side)] - # First k/2 bits determine x position. - # Following k/2 bits determine y position. - const_map = [] - for i in range(m): - y = gc_to_x[get_bits(i, 0, k/2)] - x = gc_to_x[get_bits(i, k/2, k/2)] - const_map.append(complex(x,y)) - return const_map - -# ///////////////////////////////////////////////////////////////////////////// -# QAM constellation -# ///////////////////////////////////////////////////////////////////////////// - -def qam_constellation(constellation_points=_def_constellation_points, - differential=_def_differential, - mod_code=_def_mod_code): - """ - Creates a QAM constellation object. - """ - if mod_code == mod_codes.GRAY_CODE: - gray_coded = True - elif mod_code == mod_codes.NO_CODE: - gray_coded = False - else: - raise ValueError("Mod code is not implemented for QAM") - if differential: - points = make_differential_constellation(constellation_points, gray_coded) - else: - points = make_non_differential_constellation(constellation_points, gray_coded) - side = int(sqrt(constellation_points)) - width = 2.0/(side-1) - # No pre-diff code - # Should add one so that we can gray-code the quadrant bits too. - pre_diff_code = [] - constellation = digital_swig.constellation_rect(points, pre_diff_code, 4, - side, side, width, width) - return constellation - -# ///////////////////////////////////////////////////////////////////////////// -# QAM modulator -# ///////////////////////////////////////////////////////////////////////////// - -class qam_mod(generic_mod): - - def __init__(self, constellation_points=_def_constellation_points, - differential=_def_differential, - mod_code=_def_mod_code, - *args, **kwargs): - - """ - Hierarchical block for RRC-filtered QAM modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_mod block for list of parameters. - """ - - constellation = qam_constellation(constellation_points, differential, mod_code) - # We take care of the gray coding in the constellation generation so it doesn't - # need to be done in the block. - super(qam_mod, self).__init__(constellation, differential=differential, - *args, **kwargs) - -# ///////////////////////////////////////////////////////////////////////////// -# QAM demodulator -# -# ///////////////////////////////////////////////////////////////////////////// - -class qam_demod(generic_demod): - - def __init__(self, constellation_points=_def_constellation_points, - differential=_def_differential, - mod_code=_def_mod_code, - *args, **kwargs): - - """ - Hierarchical block for RRC-filtered QAM modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_demod block for list of parameters. - """ - constellation = qam_constellation(constellation_points, differential, mod_code) - # We take care of the gray coding in the constellation generation so it doesn't - # need to be done in the block. - super(qam_demod, self).__init__(constellation, differential=differential, - *args, **kwargs) - -# -# Add these to the mod/demod registry -# -modulation_utils.add_type_1_mod('qam', qam_mod) -modulation_utils.add_type_1_demod('qam', qam_demod) -modulation_utils.add_type_1_constellation('qam', qam_constellation) diff --git a/gr-digital/python/qpsk.py b/gr-digital/python/qpsk.py deleted file mode 100644 index be21fd76f..000000000 --- a/gr-digital/python/qpsk.py +++ /dev/null @@ -1,176 +0,0 @@ -# -# Copyright 2005,2006,2011 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. -# - -""" -QPSK modulation. - -Demodulation is not included since the generic_mod_demod -""" - -from gnuradio import gr -from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod -import digital_swig -import modulation_utils - -# Default number of points in constellation. -_def_constellation_points = 4 -# Whether gray coding is used. -_def_gray_coded = True - -# ///////////////////////////////////////////////////////////////////////////// -# QPSK constellation -# ///////////////////////////////////////////////////////////////////////////// - -def qpsk_constellation(m=_def_constellation_points): - if m != _def_constellation_points: - raise ValueError("QPSK can only have 4 constellation points.") - return digital_swig.constellation_qpsk() - -# ///////////////////////////////////////////////////////////////////////////// -# QPSK modulator -# ///////////////////////////////////////////////////////////////////////////// - -class qpsk_mod(generic_mod): - - def __init__(self, constellation_points=_def_constellation_points, - gray_coded=_def_gray_coded, - *args, **kwargs): - - """ - Hierarchical block for RRC-filtered QPSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_mod block for list of parameters. - """ - - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_qpsk() - if constellation_points != 4: - raise ValueError("QPSK can only have 4 constellation points.") - if not gray_coded: - raise ValueError("This QPSK mod/demod works only for gray-coded constellations.") - super(qpsk_mod, self).__init__(constellation=constellation, - gray_coded=gray_coded, - *args, **kwargs) - - -# ///////////////////////////////////////////////////////////////////////////// -# QPSK demodulator -# -# ///////////////////////////////////////////////////////////////////////////// - -class qpsk_demod(generic_demod): - - def __init__(self, constellation_points=_def_constellation_points, - *args, **kwargs): - - """ - Hierarchical block for RRC-filtered QPSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_demod block for list of parameters. - """ - - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_qpsk() - if constellation_points != 4: - raise ValueError('Number of constellation points must be 4 for QPSK.') - super(qpsk_demod, self).__init__(constellation=constellation, - *args, **kwargs) - - - -# ///////////////////////////////////////////////////////////////////////////// -# DQPSK constellation -# ///////////////////////////////////////////////////////////////////////////// - -def dqpsk_constellation(m=_def_constellation_points): - if m != _def_constellation_points: - raise ValueError("DQPSK can only have 4 constellation points.") - return digital_swig.constellation_dqpsk() - -# ///////////////////////////////////////////////////////////////////////////// -# DQPSK modulator -# ///////////////////////////////////////////////////////////////////////////// - -class dqpsk_mod(generic_mod): - - def __init__(self, constellation_points=_def_constellation_points, - gray_coded=_def_gray_coded, - differential=True, *args, **kwargs): - """ - Hierarchical block for RRC-filtered DQPSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_mod block for list of parameters. - """ - - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_dqpsk() - if constellation_points != 4: - raise ValueError('Number of constellation points must be 4 for DQPSK.') - super(dqpsk_mod, self).__init__(constellation=constellation, - gray_coded=gray_coded, - differential=True, - *args, **kwargs) - -# ///////////////////////////////////////////////////////////////////////////// -# DQPSK demodulator -# -# ///////////////////////////////////////////////////////////////////////////// - -class dqpsk_demod(generic_demod): - - def __init__(self, constellation_points=_def_constellation_points, - differential=True, *args, **kwargs): - - """ - Hierarchical block for RRC-filtered DQPSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - See generic_demod block for list of parameters. - """ - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_dqpsk() - if constellation_points != 4: - raise ValueError('Number of constellation points must be 4 for DQPSK.') - super(dqpsk_demod, self).__init__(constellation=constellation, - differential=True, - *args, **kwargs) - -# -# Add these to the mod/demod registry -# -modulation_utils.add_type_1_mod('qpsk', qpsk_mod) -modulation_utils.add_type_1_demod('qpsk', qpsk_demod) -modulation_utils.add_type_1_constellation('qpsk', qpsk_constellation) -modulation_utils.add_type_1_mod('dqpsk', dqpsk_mod) -modulation_utils.add_type_1_demod('dqpsk', dqpsk_demod) -modulation_utils.add_type_1_constellation('dqpsk', dqpsk_constellation) - diff --git a/gr-digital/python/utils/__init__.py b/gr-digital/python/utils/__init__.py deleted file mode 100644 index b3e997f9f..000000000 --- a/gr-digital/python/utils/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# diff --git a/gr-digital/python/utils/alignment.py b/gr-digital/python/utils/alignment.py deleted file mode 100644 index f3ad3781e..000000000 --- a/gr-digital/python/utils/alignment.py +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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 module contains functions for aligning sequences. - ->>> import random ->>> rndm = random.Random() ->>> rndm.seed(1234) ->>> ran_seq = [rndm.randint(0,1) for i in range(0, 100)] ->>> offset_seq = [0] * 20 + ran_seq ->>> correct, overlap, offset = align_sequences(ran_seq, offset_seq) ->>> print(correct, overlap, offset) -(1.0, 100, -20) ->>> offset_err_seq = [] ->>> for bit in offset_seq: -... if rndm.randint(0,4) == 4: -... offset_err_seq.append(rndm.randint(0,1)) -... else: -... offset_err_seq.append(bit) ->>> correct, overlap, offset = align_sequences(ran_seq, offset_err_seq) ->>> print(overlap, offset) -(100, -20) - -""" - -import random - -# DEFAULT PARAMETERS -# If the fraction of matching bits between two sequences is greater than -# this the sequences are assumed to be aligned. -def_correct_cutoff = 0.9 -# The maximum offset to test during sequence alignment. -def_max_offset = 500 -# The maximum number of samples to take from two sequences to check alignment. -def_num_samples = 1000 - -def compare_sequences(d1, d2, offset, sample_indices=None): - """ - Takes two binary sequences and an offset and returns the number of - matching entries and the number of compared entries. - d1 & d2 -- sequences - offset -- offset of d2 relative to d1 - sample_indices -- a list of indices to use for the comparison - """ - max_index = min(len(d1), len(d2)+offset) - if sample_indices is None: - sample_indices = range(0, max_index) - correct = 0 - total = 0 - for i in sample_indices: - if i >= max_index: - break - if d1[i] == d2[i-offset]: - correct += 1 - total += 1 - return (correct, total) - -def random_sample(size, num_samples=def_num_samples, seed=None): - """ - Returns a set of random integers between 0 and (size-1). - The set contains no more than num_samples integers. - """ - rndm = random.Random() - rndm.seed(seed) - if num_samples > size: - indices = set(range(0, size)) - else: - if num_samples > size/2: - num_samples = num_samples/2 - indices = set([]) - while len(indices) < num_samples: - index = rndm.randint(0, size-1) - indices.add(index) - indices = list(indices) - indices.sort() - return indices - -def align_sequences(d1, d2, - num_samples=def_num_samples, - max_offset=def_max_offset, - correct_cutoff=def_correct_cutoff, - seed=None, - indices=None): - """ - Takes two sequences and finds the offset and which the two sequences best - match. It returns the fraction correct, the number of entries compared, - the offset. - d1 & d2 -- sequences to compare - num_samples -- the maximum number of entries to compare - max_offset -- the maximum offset between the sequences that is checked - correct_cutoff -- If the fraction of bits correct is greater than this then - the offset is assumed to optimum. - seed -- a random number seed - indices -- an explicit list of the indices used to compare the two sequences - """ - max_overlap = max(len(d1), len(d2)) - if indices is None: - indices = random_sample(max_overlap, num_samples, seed) - max_frac_correct = 0 - best_offset = None - best_compared = None - best_correct = None - pos_range = range(0, min(len(d1), max_offset)) - neg_range = range(-1, -min(len(d2), max_offset), -1) - # Interleave the positive and negative offsets. - int_range = [item for items in zip(pos_range, neg_range) for item in items] - for offset in int_range: - correct, compared = compare_sequences(d1, d2, offset, indices) - frac_correct = 1.0*correct/compared - if frac_correct > max_frac_correct: - max_frac_correct = frac_correct - best_offset = offset - best_compared = compared - best_correct = correct - if frac_correct > correct_cutoff: - break - return max_frac_correct, best_compared, best_offset, indices - -if __name__ == "__main__": - import doctest - doctest.testmod() - diff --git a/gr-digital/python/utils/gray_code.py b/gr-digital/python/utils/gray_code.py deleted file mode 100644 index 926a1ded1..000000000 --- a/gr-digital/python/utils/gray_code.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -class GrayCodeGenerator(object): - """ - Generates and caches gray codes. - """ - - def __init__(self): - self.gcs = [0, 1] - # The last power of two passed through. - self.lp2 = 2 - # The next power of two that will be passed through. - self.np2 = 4 - # Curent index - self.i = 2 - - def get_gray_code(self, length): - """ - Returns a list of gray code of given length. - """ - if len(self.gcs) < length: - self.generate_new_gray_code(length) - return self.gcs[:length] - - def generate_new_gray_code(self, length): - """ - Generates new gray code and places into cache. - """ - while len(self.gcs) < length: - if self.i == self.lp2: - # if i is a power of two then gray number is of form 1100000... - result = self.i + self.i/2 - else: - # if not we take advantage of the symmetry of all but the last bit - # around a power of two. - result = self.gcs[2*self.lp2-1-self.i] + self.lp2 - self.gcs.append(result) - self.i += 1 - if self.i == self.np2: - self.lp2 = self.i - self.np2 = self.i*2 - -_gray_code_generator = GrayCodeGenerator() - -gray_code = _gray_code_generator.get_gray_code - diff --git a/gr-digital/python/utils/mod_codes.py b/gr-digital/python/utils/mod_codes.py deleted file mode 100644 index caacda5cc..000000000 --- a/gr-digital/python/utils/mod_codes.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -GRAY_CODE = 'gray' -SET_PARTITION_CODE = 'set-partition' -NO_CODE = 'none' - -codes = (GRAY_CODE, SET_PARTITION_CODE, NO_CODE) - -def invert_code(code): - c = enumerate(code) - ic = [(b, a) for (a, b) in c] - ic.sort() - return [a for (b, a) in ic] diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt deleted file mode 100644 index 4107116bc..000000000 --- a/gr-digital/swig/CMakeLists.txt +++ /dev/null @@ -1,182 +0,0 @@ -# Copyright 2011,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. - -######################################################################## -# generate helper scripts to expand templated files -######################################################################## -include(GrPython) -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " -#!${PYTHON_EXECUTABLE} - -import sys, os, re -sys.path.append('${GR_CORE_PYTHONPATH}') -os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.chdir('${CMAKE_CURRENT_BINARY_DIR}') - -if __name__ == '__main__': - import build_utils - root, inp = sys.argv[1:3] - for sig in sys.argv[3:]: - name = re.sub ('X+', sig, root) - d = build_utils.standard_dict(name, sig, 'digital') - build_utils.expand_template(d, inp) - -") - -macro(expand_i root) - # make a list of the .i generated files - unset(expanded_files_i) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_i ${CMAKE_CURRENT_BINARY_DIR}/${name}.i) - endforeach(sig) - - #create a command to generate the .i files - add_custom_command( - OUTPUT ${expanded_files_i} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.i.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.i.t ${ARGN} - ) - - # Lists of generated i files - list(APPEND generated_swigs ${expanded_files_i}) -endmacro(expand_i) - - -######################################################################## -# Invoke macro to generate various sources -######################################################################## -expand_i(digital_chunks_to_symbols_XX bf bc sf sc if ic) - -add_custom_target(digital_generated_swigs DEPENDS - ${generated_swigs} -) - -######################################################################## -# Setup swig generation -######################################################################## -include(GrSwig) - -######################################################################## -# Create the master gengen swig include files -######################################################################## -set(generated_index ${CMAKE_CURRENT_BINARY_DIR}/digital_generated.i.in) -file(WRITE ${generated_index} " -// -// This file is machine generated. All edits will be overwritten -// -") - -file(APPEND ${generated_index} "%include \"gnuradio.i\"\n\n") -file(APPEND ${generated_index} "%{\n") - -foreach(swig_file ${generated_swigs}) - get_filename_component(name ${swig_file} NAME_WE) - file(APPEND ${generated_index} "#include<${name}.h>\n") -endforeach(swig_file) -file(APPEND ${generated_index} "%}\n") - -foreach(swig_file ${generated_swigs}) - get_filename_component(name ${swig_file} NAME) - file(APPEND ${generated_index} "%include<${name}>\n") -endforeach(swig_file) - -execute_process( - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${generated_index} ${CMAKE_CURRENT_BINARY_DIR}/digital_generated.i -) - -set(GR_SWIG_INCLUDE_DIRS - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/../include - ${GR_DIGITAL_INCLUDE_DIRS} - ${GR_ANALOG_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -# Setup swig docs to depend on includes and pull in from build directory -set(GR_SWIG_LIBRARIES gnuradio-digital) -set(GR_SWIG_TARGET_DEPS digital_generated_includes) -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i) -set(GR_SWIG_DOC_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/../include - ${CMAKE_CURRENT_BINARY_DIR}/../include) -GR_SWIG_MAKE(digital_swig digital_swig.i) -GR_SWIG_INSTALL( - TARGETS digital_swig - DESTINATION ${GR_PYTHON_DIR}/gnuradio/digital - COMPONENT "digital_python" -) - -install( - FILES - digital_swig.i - ${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i - ${CMAKE_CURRENT_BINARY_DIR}/digital_generated.i - ${generated_swigs} - digital_additive_scrambler_bb.i - digital_binary_slicer_fb.i - digital_bytes_to_syms.i - digital_clock_recovery_mm_cc.i - digital_clock_recovery_mm_ff.i - digital_cma_equalizer_cc.i - digital_constellation.i - digital_constellation_receiver_cb.i - digital_constellation_decoder_cb.i - digital_correlate_access_code_bb.i - digital_correlate_access_code_tag_bb.i - digital_costas_loop_cc.i - digital_cpmmod_bc.i - digital_crc32.i - digital_descrambler_bb.i - digital_diff_decoder_bb.i - digital_diff_encoder_bb.i - digital_diff_phasor_cc.i - digital_fll_band_edge_cc.i - digital_framer_sink_1.i - digital_glfsr_source_b.i - digital_glfsr_source_f.i - digital_gmskmod_bc.i - digital_lms_dd_equalizer_cc.i - digital_kurtotic_equalizer_cc.i - digital_map_bb.i - digital_mpsk_receiver_cc.i - digital_mpsk_snr_est_cc.i - digital_ofdm_cyclic_prefixer.i - digital_ofdm_frame_acquisition.i - digital_ofdm_frame_sink.i - digital_ofdm_insert_preamble.i - digital_ofdm_mapper_bcv.i - digital_ofdm_sampler.i - digital_packet_sink.i - digital_pfb_clock_sync_ccf.i - digital_pfb_clock_sync_fff.i - digital_pn_correlator_cc.i - digital_probe_density_b.i - digital_probe_mpsk_snr_est_c.i - digital_scrambler_bb.i - digital_simple_framer.i - digital_simple_correlator.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "digital_swig" -) diff --git a/gr-digital/swig/_digital_hier.i b/gr-digital/swig/_digital_hier.i deleted file mode 100644 index 022e38644..000000000 --- a/gr-digital/swig/_digital_hier.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <digital_cpmmod_bc.h> -#include <digital_gmskmod_bc.h> -%} - -%include "digital_cpmmod_bc.i" -%include "digital_gmskmod_bc.i" diff --git a/gr-digital/swig/digital_additive_scrambler_bb.i b/gr-digital/swig/digital_additive_scrambler_bb.i deleted file mode 100644 index b063f0672..000000000 --- a/gr-digital/swig/digital_additive_scrambler_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,additive_scrambler_bb); - -digital_additive_scrambler_bb_sptr -digital_make_additive_scrambler_bb(int mask, int seed, - int len, int count=0); - -class digital_additive_scrambler_bb : public gr_sync_block -{ -}; diff --git a/gr-digital/swig/digital_binary_slicer_fb.i b/gr-digital/swig/digital_binary_slicer_fb.i deleted file mode 100644 index 30603748b..000000000 --- a/gr-digital/swig/digital_binary_slicer_fb.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,binary_slicer_fb); - -digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb (); - -class digital_binary_slicer_fb : public gr_sync_block -{ - private: - digital_binary_slicer_fb (); - - public: -}; diff --git a/gr-digital/swig/digital_bytes_to_syms.i b/gr-digital/swig/digital_bytes_to_syms.i deleted file mode 100644 index cf23f035c..000000000 --- a/gr-digital/swig/digital_bytes_to_syms.i +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,bytes_to_syms); - -digital_bytes_to_syms_sptr digital_make_bytes_to_syms(); - -class digital_bytes_to_syms : public gr_sync_interpolator -{ -}; diff --git a/gr-digital/swig/digital_chunks_to_symbols_XX.i.t b/gr-digital/swig/digital_chunks_to_symbols_XX.i.t deleted file mode 100644 index a80ba2af1..000000000 --- a/gr-digital/swig/digital_chunks_to_symbols_XX.i.t +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(digital,@BASE_NAME@); - -@SPTR_NAME@ digital_make_@BASE_NAME@ -(const std::vector<@O_TYPE@> &symbol_table, const int D = 1); - -class @NAME@ : public gr_sync_interpolator -{ -private: - @NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1); - -public: - int D () const { return d_D; } - std::vector<@O_TYPE@> symbol_table () const { return d_symbol_table; } -}; diff --git a/gr-digital/swig/digital_clock_recovery_mm_cc.i b/gr-digital/swig/digital_clock_recovery_mm_cc.i deleted file mode 100644 index 4ce9a9725..000000000 --- a/gr-digital/swig/digital_clock_recovery_mm_cc.i +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,clock_recovery_mm_cc); - -digital_clock_recovery_mm_cc_sptr -digital_make_clock_recovery_mm_cc (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit) throw(std::exception); - -class digital_clock_recovery_mm_cc : public gr_sync_block -{ - private: - digital_clock_recovery_mm_cc (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit); - -public: - float mu() const { return d_mu;} - float omega() const { return d_omega;} - float gain_mu() const { return d_gain_mu;} - float gain_omega() const { return d_gain_omega;} - - void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } - void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } - void set_mu (float omega) { d_mu = mu; } - void set_omega (float omega) { d_omega = omega; - d_min_omega = omega*(1.0 - d_omega_relative_limit); - d_max_omega = omega*(1.0 + d_omega_relative_limit); - } - void set_verbose (bool verbose) { d_verbose = verbose; } -}; diff --git a/gr-digital/swig/digital_clock_recovery_mm_ff.i b/gr-digital/swig/digital_clock_recovery_mm_ff.i deleted file mode 100644 index 054ef9ebf..000000000 --- a/gr-digital/swig/digital_clock_recovery_mm_ff.i +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,clock_recovery_mm_ff); - -digital_clock_recovery_mm_ff_sptr -digital_make_clock_recovery_mm_ff (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit=0.001) throw(std::exception); - -class digital_clock_recovery_mm_ff : public gr_sync_block -{ - private: - digital_clock_recovery_mm_ff (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit); - -public: - float mu() const; - float omega() const; - float gain_mu() const; - float gain_omega() const; - - void set_gain_mu (float gain_mu); - void set_gain_omega (float gain_omega); - void set_mu (float omega); - void set_omega (float omega); -}; diff --git a/gr-digital/swig/digital_cma_equalizer_cc.i b/gr-digital/swig/digital_cma_equalizer_cc.i deleted file mode 100644 index 183e43ef9..000000000 --- a/gr-digital/swig/digital_cma_equalizer_cc.i +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,cma_equalizer_cc) - -// retrieve info on the base class, without generating wrappers since -// the base class has a pure virual method. -%import "gr_adaptive_fir_ccc.i" - -digital_cma_equalizer_cc_sptr -digital_make_cma_equalizer_cc(int num_taps, float modulus, - float mu, int sps); - -class digital_cma_equalizer_cc : public gr_adaptive_fir_ccc -{ -private: - digital_cma_equalizer_cc(int num_taps, float modulus, - float mu, int sps); - -public: - float get_gain(); - void set_gain(float mu); - float get_modulus(); - void set_modulus(float mod); -}; diff --git a/gr-digital/swig/digital_constellation.i b/gr-digital/swig/digital_constellation.i deleted file mode 100644 index 248f90014..000000000 --- a/gr-digital/swig/digital_constellation.i +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010,2011,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. - */ - -%template(gr_complex_vector) std::vector<gr_complex>; -%template(unsigned_int_vector) std::vector<unsigned int>; - -// Make sure metric types get SWIGed. -%include "digital_metric_type.h" - -class digital_constellation; -typedef boost::shared_ptr<digital_constellation> digital_constellation_sptr; -%template(digital_constellation_sptr) boost::shared_ptr<digital_constellation>; - -class digital_constellation -{ -public: - digital_constellation (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality); - std::vector<gr_complex> points(); - std::vector<gr_complex> s_points(); - std::vector<std::vector<gr_complex> > v_points(); - virtual unsigned int decision_maker (gr_complex *sample) = 0; - unsigned int decision_maker_v (std::vector<gr_complex> sample); - // void calc_metric(gr_complex *sample, float *metric, trellis_metric_type_t type); - // void calc_euclidean_metric(gr_complex *sample, float *metric); - // void calc_hard_symbol_metric(gr_complex *sample, float *metric); - std::vector<gr_complex> map_to_points_v(unsigned int value); - unsigned int bits_per_symbol (); - unsigned int arity (); - digital_constellation_sptr base (); - bool apply_pre_diff_code(); - void set_pre_diff_code(bool a); - std::vector<unsigned int> pre_diff_code(); - unsigned int rotational_symmetry(); - unsigned int dimensionality(); -}; - -class digital_constellation_calcdist; -typedef boost::shared_ptr<digital_constellation_calcdist> digital_constellation_calcdist_sptr; -%template(digital_constellation_calcdist_sptr) boost::shared_ptr<digital_constellation_calcdist>; -%rename(constellation_calcdist) digital_make_constellation_calcdist; -digital_constellation_calcdist_sptr -digital_make_constellation_calcdist(std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality); -%ignore digital_constellation_calcdist; - -class digital_constellation_calcdist: public digital_constellation -{ - public: - digital_constellation_calcdist (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality); - unsigned int decision_maker (const gr_complex *sample); -}; - -class digital_constellation_sector: public digital_constellation -{ -}; - -class digital_constellation_rect; -typedef boost::shared_ptr<digital_constellation_rect> digital_constellation_rect_sptr; -%template(digital_constellation_rect_sptr) boost::shared_ptr<digital_constellation_rect>; -%rename(constellation_rect) digital_make_constellation_rect; -digital_constellation_rect_sptr digital_make_constellation_rect(std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int real_sectors, unsigned int imag_sectors, - float width_real_sectors, float width_imag_sectors); -%ignore digital_constellation_rect; - -class digital_constellation_rect : public digital_constellation_sector -{ -public: - digital_constellation_rect (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int real_sectors, unsigned int imag_sectors, - float width_real_sectors, float width_imag_sectors); -}; - -class digital_constellation_psk; -typedef boost::shared_ptr<digital_constellation_psk> digital_constellation_psk_sptr; -%template(digital_constellation_psk_sptr) boost::shared_ptr<digital_constellation_psk>; -%rename(constellation_psk) digital_make_constellation_psk; -digital_constellation_psk_sptr digital_make_constellation_psk(std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int n_sectors); -%ignore digital_constellation_psk; - -class digital_constellation_psk : public digital_constellation_sector -{ -public: - digital_constellation_psk (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int n_sectors); -}; - -/* - BPSK Constellation -*/ - -class digital_constellation_bpsk; -typedef boost::shared_ptr<digital_constellation_bpsk> digital_constellation_bpsk_sptr; -%template(digital_constellation_bpsk_sptr) boost::shared_ptr<digital_constellation_bpsk>; -%rename(constellation_bpsk) digital_make_constellation_bpsk; -digital_constellation_bpsk_sptr digital_make_constellation_bpsk(); -%ignore digital_constellation_bpsk; - -class digital_constellation_bpsk : public digital_constellation -{ -public: - digital_constellation_bpsk (); -}; - -/* - QPSK Constellation -*/ - -class digital_constellation_qpsk; -typedef boost::shared_ptr<digital_constellation_qpsk> digital_constellation_qpsk_sptr; -%template(digital_constellation_qpsk_sptr) boost::shared_ptr<digital_constellation_qpsk>; -%rename(constellation_qpsk) digital_make_constellation_qpsk; -digital_constellation_qpsk_sptr digital_make_constellation_qpsk(); -%ignore digital_constellation_qpsk; - -class digital_constellation_qpsk : public digital_constellation -{ -public: - digital_constellation_qpsk (); -}; - -/* - DQPSK Constellation -*/ - -class digital_constellation_dqpsk; -typedef boost::shared_ptr<digital_constellation_dqpsk> digital_constellation_dqpsk_sptr; -%template(digital_constellation_dqpsk_sptr) boost::shared_ptr<digital_constellation_dqpsk>; -%rename(constellation_dqpsk) digital_make_constellation_dqpsk; -digital_constellation_dqpsk_sptr digital_make_constellation_dqpsk(); -%ignore digital_constellation_dqpsk; - -class digital_constellation_dqpsk : public digital_constellation -{ -public: - digital_constellation_dqpsk (); -}; - - -/* - 8PSK Constellation -*/ - -class digital_constellation_8psk; -typedef boost::shared_ptr<digital_constellation_8psk> digital_constellation_8psk_sptr; -%template(digital_constellation_8psk_sptr) boost::shared_ptr<digital_constellation_8psk>; -%rename(constellation_8psk) digital_make_constellation_8psk; -digital_constellation_8psk_sptr digital_make_constellation_8psk(); -%ignore digital_constellation_8psk; - -class digital_constellation_8psk : public digital_constellation -{ -public: - digital_constellation_8psk (); -}; - -#if SWIGPYTHON -/* - We want print(constellation) in python to produce nice useful output so - we include code at the end of the generated python file that overrides - the SWIG-generated __repr__ method. - */ -%pythoncode %{ - -digital_constellation_calcdist_sptr.__repr__ = lambda self: '<constellation calcdist (m=%s)>' % str(len(self.points())) -digital_constellation_rect_sptr.__repr__ = lambda self: '<constellation rect (m=%s)>' % str(len(self.points())) -digital_constellation_psk_sptr.__repr__ = lambda self: '<constellation psk (m=%s)>' % str(len(self.points())) -digital_constellation_bpsk_sptr.__repr__ = lambda self: '<constellation bpsk>' -digital_constellation_qpsk_sptr.__repr__ = lambda self: '<constellation qpsk>' -digital_constellation_dqpsk_sptr.__repr__ = lambda self: '<constellation dqpsk>' -digital_constellation_8psk_sptr.__repr__ = lambda self: '<constellation 8psk>' - -%} -#endif diff --git a/gr-digital/swig/digital_constellation_decoder_cb.i b/gr-digital/swig/digital_constellation_decoder_cb.i deleted file mode 100644 index 547f57ee6..000000000 --- a/gr-digital/swig/digital_constellation_decoder_cb.i +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006, 2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,constellation_decoder_cb) - -digital_constellation_decoder_cb_sptr -digital_make_constellation_decoder_cb (digital_constellation_sptr constellation); - -class digital_constellation_decoder_cb : public gr_sync_block -{ - private: - digital_constellation_decoder_cb (digital_constellation_sptr constellation); - - friend digital_constellation_decoder_cb_sptr - digital_make_constellation_decoder_cb (digital_constellation_sptr constellation); - - public: - ~digital_constellation_decoder_cb(); -}; diff --git a/gr-digital/swig/digital_constellation_receiver_cb.i b/gr-digital/swig/digital_constellation_receiver_cb.i deleted file mode 100644 index 9c4ba645e..000000000 --- a/gr-digital/swig/digital_constellation_receiver_cb.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,constellation_receiver_cb); - -%include "digital_constellation.i" - -digital_constellation_receiver_cb_sptr -digital_make_constellation_receiver_cb (digital_constellation_sptr constellation, - float loop_bw, float fmin, float fmax); - -class digital_constellation_receiver_cb : public gr_block, public gri_control_loop -{ - private: - digital_constellation_receiver_cb (digital_contellation_sptr constellation, - float loop_bw, float fmin, float fmax); -}; diff --git a/gr-digital/swig/digital_correlate_access_code_bb.i b/gr-digital/swig/digital_correlate_access_code_bb.i deleted file mode 100644 index 01087b8e9..000000000 --- a/gr-digital/swig/digital_correlate_access_code_bb.i +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,correlate_access_code_bb); - -/*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - * \param threshold maximum number of bits that may be wrong - */ -digital_correlate_access_code_bb_sptr -digital_make_correlate_access_code_bb (const std::string &access_code, int threshold) - throw(std::out_of_range); - -/*! - * \brief Examine input for specified access code, one bit at a time. - * \ingroup block - * - * input: stream of bits, 1 bit per input byte (data in LSB) - * output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit) - * - * Each output byte contains two valid bits, the data bit, and the - * flag bit. The LSB (bit 0) is the data bit, and is the original - * input data, delayed 64 bits. Bit 1 is the - * flag bit and is 1 if the corresponding data bit is the first data - * bit following the access code. Otherwise the flag bit is 0. - */ -class digital_correlate_access_code_bb : public gr_sync_block -{ - friend digital_correlate_access_code_bb_sptr - digital_make_correlate_access_code_bb (const std::string &access_code, int threshold); - protected: - digital_correlate_access_code_bb(const std::string &access_code, int threshold); - - public: - ~digital_correlate_access_code_bb(); - - /*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - */ - bool set_access_code (const std::string &access_code); -}; diff --git a/gr-digital/swig/digital_correlate_access_code_tag_bb.i b/gr-digital/swig/digital_correlate_access_code_tag_bb.i deleted file mode 100644 index 03f20148a..000000000 --- a/gr-digital/swig/digital_correlate_access_code_tag_bb.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,correlate_access_code_tag_bb); - -digital_correlate_access_code_tag_bb_sptr -digital_make_correlate_access_code_tag_bb(const std::string &access_code, - int threshold, - const std::string &tag_name) - throw(std::out_of_range); - -class digital_correlate_access_code_tag_bb : public gr_sync_block -{ - public: - bool set_access_code(const std::string &access_code); -}; diff --git a/gr-digital/swig/digital_costas_loop_cc.i b/gr-digital/swig/digital_costas_loop_cc.i deleted file mode 100644 index ab09200a0..000000000 --- a/gr-digital/swig/digital_costas_loop_cc.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,costas_loop_cc); - -digital_costas_loop_cc_sptr -digital_make_costas_loop_cc (float loop_bw, int order - ) throw (std::invalid_argument); - -class digital_costas_loop_cc : public gr_sync_block, public gri_control_loop -{ - private: - digital_costas_loop_cc (float loop_bw, int order); -}; diff --git a/gr-digital/swig/digital_cpmmod_bc.i b/gr-digital/swig/digital_cpmmod_bc.i deleted file mode 100644 index fa7c50da7..000000000 --- a/gr-digital/swig/digital_cpmmod_bc.i +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital, cpmmod_bc) - -digital_cpmmod_bc_sptr -digital_make_cpmmod_bc(int type, float h, - unsigned samples_per_sym, - unsigned L, double beta=0.3); - -class digital_cpmmod_bc : public gr_hier_block2 -{ - private: - digital_cpmmod_bc(int type, float h, - unsigned samples_per_sym, - unsigned L, double beta); - - public: - std::vector<float> get_taps(); -}; - diff --git a/gr-digital/swig/digital_crc32.i b/gr-digital/swig/digital_crc32.i deleted file mode 100644 index 806bfad6a..000000000 --- a/gr-digital/swig/digital_crc32.i +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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. - */ - -%rename(update_crc32) digital_update_crc32; -%rename(crc32) digital_crc32; - -unsigned int digital_update_crc32(unsigned int crc, const std::string buf); -unsigned int digital_crc32(const std::string buf); diff --git a/gr-digital/swig/digital_descrambler_bb.i b/gr-digital/swig/digital_descrambler_bb.i deleted file mode 100644 index 59de806fb..000000000 --- a/gr-digital/swig/digital_descrambler_bb.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,descrambler_bb); - -digital_descrambler_bb_sptr -digital_make_descrambler_bb(int mask, int seed, int len); - -class digital_descrambler_bb : public gr_sync_block -{ -}; diff --git a/gr-digital/swig/digital_diff_decoder_bb.i b/gr-digital/swig/digital_diff_decoder_bb.i deleted file mode 100644 index f9741c771..000000000 --- a/gr-digital/swig/digital_diff_decoder_bb.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,diff_decoder_bb) - -digital_diff_decoder_bb_sptr -digital_make_diff_decoder_bb(unsigned int modulus); - -class digital_diff_decoder_bb : public gr_sync_block -{ -}; diff --git a/gr-digital/swig/digital_diff_encoder_bb.i b/gr-digital/swig/digital_diff_encoder_bb.i deleted file mode 100644 index 45a4589bf..000000000 --- a/gr-digital/swig/digital_diff_encoder_bb.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,diff_encoder_bb) - -digital_diff_encoder_bb_sptr -digital_make_diff_encoder_bb(unsigned int modulus); - -class digital_diff_encoder_bb : public gr_sync_block -{ -}; diff --git a/gr-digital/swig/digital_diff_phasor_cc.i b/gr-digital/swig/digital_diff_phasor_cc.i deleted file mode 100644 index b1e20eb99..000000000 --- a/gr-digital/swig/digital_diff_phasor_cc.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,diff_phasor_cc) - -digital_diff_phasor_cc_sptr -digital_make_diff_phasor_cc(); - -class digital_diff_phasor_cc : public gr_sync_block -{ -}; diff --git a/gr-digital/swig/digital_fll_band_edge_cc.i b/gr-digital/swig/digital_fll_band_edge_cc.i deleted file mode 100644 index 3efcb89ed..000000000 --- a/gr-digital/swig/digital_fll_band_edge_cc.i +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,fll_band_edge_cc); - -digital_fll_band_edge_cc_sptr digital_make_fll_band_edge_cc (float samps_per_sym, - float rolloff, - int filter_size, - float bandwidth); - -class digital_fll_band_edge_cc : public gr_sync_block, public gri_control_loop -{ - private: - digital_fll_band_edge_cc (float samps_per_sym, float rolloff, - int filter_size, float bandwidth); - - public: - ~digital_fll_band_edge_cc (); - - void set_loop_bandwidth(float bw); - void set_damping_factor(float df); - void set_alpha(float alpha); - void set_beta(float beta); - void set_samples_per_symbol(float sps); - void set_rolloff(float rolloff); - void set_filter_size(int filter_size); - void set_frequency(float freq); - void set_phase(float phase); - - float get_loop_bandwidth() const; - float get_damping_factor() const; - float get_alpha() const; - float get_beta() const; - float get_samples_per_symbol() const; - float get_rolloff() const; - int get_filter_size() const; - float get_frequency() const; - float get_phase() const; - - void print_taps(); -}; diff --git a/gr-digital/swig/digital_framer_sink_1.i b/gr-digital/swig/digital_framer_sink_1.i deleted file mode 100644 index a5c56560d..000000000 --- a/gr-digital/swig/digital_framer_sink_1.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,framer_sink_1); - -digital_framer_sink_1_sptr -digital_make_framer_sink_1(gr_msg_queue_sptr target_queue); - -class digital_framer_sink_1 : public gr_sync_block -{ -}; diff --git a/gr-digital/swig/digital_glfsr_source_b.i b/gr-digital/swig/digital_glfsr_source_b.i deleted file mode 100644 index b1c487209..000000000 --- a/gr-digital/swig/digital_glfsr_source_b.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,glfsr_source_b); - -digital_glfsr_source_b_sptr -digital_make_glfsr_source_b(int degree, bool repeat=true, - int mask=0, int seed=1) - throw (std::runtime_error); - -class digital_glfsr_source_b : public gr_sync_block -{ -public: - unsigned int period() const; - int mask() const; -}; diff --git a/gr-digital/swig/digital_glfsr_source_f.i b/gr-digital/swig/digital_glfsr_source_f.i deleted file mode 100644 index 4d94d8cd4..000000000 --- a/gr-digital/swig/digital_glfsr_source_f.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,glfsr_source_f); - -digital_glfsr_source_f_sptr -digital_make_glfsr_source_f(int degree, bool repeat=true, - int mask=0, int seed=1) - throw (std::runtime_error); - -class digital_glfsr_source_f : public gr_sync_block -{ -public: - unsigned int period() const; - int mask() const; -}; diff --git a/gr-digital/swig/digital_gmskmod_bc.i b/gr-digital/swig/digital_gmskmod_bc.i deleted file mode 100644 index ad7b82237..000000000 --- a/gr-digital/swig/digital_gmskmod_bc.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital, gmskmod_bc) - -digital_gmskmod_bc_sptr -digital_make_gmskmod_bc(unsigned samples_per_sym=2, - double bt=0.3, unsigned L=4); - -class digital_gmskmod_bc : public gr_hier_block2 -{ - private: - digital_cpmmod_bc(int type, float h, - unsigned samples_per_sym, - double beta, unsigned L); - - public: - std::vector<float> get_taps(); -}; - diff --git a/gr-digital/swig/digital_kurtotic_equalizer_cc.i b/gr-digital/swig/digital_kurtotic_equalizer_cc.i deleted file mode 100644 index 67a9dc6fd..000000000 --- a/gr-digital/swig/digital_kurtotic_equalizer_cc.i +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,kurtotic_equalizer_cc) - -// retrieve info on the base class, without generating wrappers since -// the base class has a pure virual method. -%import "gr_adaptive_fir_ccc.i" - -digital_kurtotic_equalizer_cc_sptr -digital_make_kurtotic_equalizer_cc(int num_taps, - float mu); - -class digital_kurtotic_equalizer_cc : public gr_adaptive_fir_ccc -{ -private: - digital_kurtotic_equalizer_cc(int num_taps, float mu); - -public: - void set_gain(float mu); -}; diff --git a/gr-digital/swig/digital_lms_dd_equalizer_cc.i b/gr-digital/swig/digital_lms_dd_equalizer_cc.i deleted file mode 100644 index bd5c6ae29..000000000 --- a/gr-digital/swig/digital_lms_dd_equalizer_cc.i +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - - -GR_SWIG_BLOCK_MAGIC(digital,lms_dd_equalizer_cc) - -// retrieve info on the base class, without generating wrappers since -// the base class has a pure virual method. -%import "gr_adaptive_fir_ccc.i" - - -digital_lms_dd_equalizer_cc_sptr -digital_make_lms_dd_equalizer_cc (int num_taps, - float mu, int sps, - digital_constellation_sptr cnst); - -class digital_lms_dd_equalizer_cc : public gr_sync_block -{ -private: - digital_lms_dd_equalizer_cc (int num_taps, - float mu, int sps, - digital_constellation_sptr cnst); - -public: - float get_gain(); - void set_gain(float mu); -}; diff --git a/gr-digital/swig/digital_map_bb.i b/gr-digital/swig/digital_map_bb.i deleted file mode 100644 index 50117d4f5..000000000 --- a/gr-digital/swig/digital_map_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,map_bb); - -digital_map_bb_sptr -digital_make_map_bb(const std::vector<int> &map); - -class digital_map_bb : public gr_sync_block -{ -}; - diff --git a/gr-digital/swig/digital_mpsk_receiver_cc.i b/gr-digital/swig/digital_mpsk_receiver_cc.i deleted file mode 100644 index 2338a1854..000000000 --- a/gr-digital/swig/digital_mpsk_receiver_cc.i +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,mpsk_receiver_cc); - -digital_mpsk_receiver_cc_sptr digital_make_mpsk_receiver_cc (unsigned int M, float theta, - float loop_bw, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, - float omega_rel); -class digital_mpsk_receiver_cc : public gr_block, public gri_control_loop -{ - private: - digital_mpsk_receiver_cc (unsigned int M,float theta, - float loop_bw, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel); -public: - float modulation_order() const { return d_M; } - float mu() const { return d_mu;} - float omega() const { return d_omega;} - float gain_mu() const { return d_gain_mu;} - float gain_omega() const { return d_gain_omega;} - float gain_omega_rel() const {return d_omega_rel; } - void set_modulation_order(unsigned int M); - void set_mu (float mu) { d_mu = mu; } - void set_omega (float omega) { - d_omega = omega; - d_min_omega = omega*(1.0 - d_omega_rel); - d_max_omega = omega*(1.0 + d_omega_rel); - } - void set_theta(float theta) { d_theta = theta; } - void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } - void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } - void set_gain_omega_rel(float omega_rel); -}; diff --git a/gr-digital/swig/digital_mpsk_snr_est_cc.i b/gr-digital/swig/digital_mpsk_snr_est_cc.i deleted file mode 100644 index f0ca13f87..000000000 --- a/gr-digital/swig/digital_mpsk_snr_est_cc.i +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,mpsk_snr_est_cc); - -digital_mpsk_snr_est_cc_sptr -digital_make_mpsk_snr_est_cc(snr_est_type_t type, - int tag_nsamples=10000, - double alpha=0.001); - -class digital_mpsk_snr_est_cc : public gr_sync_block -{ -private: - void digital_mpsk_snr_est_cc(snr_est_type_t type, - int tag_nsamples, - double alpha); - -public: - double snr(); - snr_est_type_t type() const; - int tag_nsample() const; - double alpha() const; - void set_type(snr_est_type_t t); - void set_tag_nsample(int n); - void set_alpha(double alpha); -}; diff --git a/gr-digital/swig/digital_ofdm_cyclic_prefixer.i b/gr-digital/swig/digital_ofdm_cyclic_prefixer.i deleted file mode 100644 index 56d1629a8..000000000 --- a/gr-digital/swig/digital_ofdm_cyclic_prefixer.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,ofdm_cyclic_prefixer) - -digital_ofdm_cyclic_prefixer_sptr -digital_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); - -class digital_ofdm_cyclic_prefixer : public gr_sync_interpolator -{ - protected: - digital_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); - - public: -}; diff --git a/gr-digital/swig/digital_ofdm_frame_acquisition.i b/gr-digital/swig/digital_ofdm_frame_acquisition.i deleted file mode 100644 index b61297bde..000000000 --- a/gr-digital/swig/digital_ofdm_frame_acquisition.i +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2011 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. - */ - -#include <vector> - -GR_SWIG_BLOCK_MAGIC(digital,ofdm_frame_acquisition); - -digital_ofdm_frame_acquisition_sptr -digital_make_ofdm_frame_acquisition (unsigned int occupied_carriers, - unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len=4); - -class digital_ofdm_frame_acquisition : public gr_sync_decimator -{ - protected: - digital_ofdm_frame_acquisition (unsigned int occupied_carriers, - unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len); - - public: - float snr() { return d_snr_est; } - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; diff --git a/gr-digital/swig/digital_ofdm_frame_sink.i b/gr-digital/swig/digital_ofdm_frame_sink.i deleted file mode 100644 index cd3fa1422..000000000 --- a/gr-digital/swig/digital_ofdm_frame_sink.i +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,ofdm_frame_sink); - -digital_ofdm_frame_sink_sptr -digital_make_ofdm_frame_sink(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain=0.25, float freq_gain=0.25*0.25/4); - -class digital_ofdm_frame_sink : public gr_sync_block -{ - protected: - digital_ofdm_frame_sink(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain, float freq_gain); - - public: - ~digital_ofdm_frame_sink(); -}; diff --git a/gr-digital/swig/digital_ofdm_insert_preamble.i b/gr-digital/swig/digital_ofdm_insert_preamble.i deleted file mode 100644 index 0273c7fa7..000000000 --- a/gr-digital/swig/digital_ofdm_insert_preamble.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,ofdm_insert_preamble); - -digital_ofdm_insert_preamble_sptr -digital_make_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble); - - -class digital_ofdm_insert_preamble : public gr_block -{ - protected: - digital_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble); - public: - void enter_preamble(); -}; diff --git a/gr-digital/swig/digital_ofdm_mapper_bcv.i b/gr-digital/swig/digital_ofdm_mapper_bcv.i deleted file mode 100644 index 4e9aaba7d..000000000 --- a/gr-digital/swig/digital_ofdm_mapper_bcv.i +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,ofdm_mapper_bcv); - -digital_ofdm_mapper_bcv_sptr -digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, - unsigned int msgq_limit, - unsigned int bits_per_symbol, - unsigned int fft_length) throw(std::exception); - - -class digital_ofdm_mapper_bcv : public gr_sync_block -{ - protected: - digital_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, - unsigned int msgq_limit, - unsigned int bits_per_symbol, - unsigned int fft_length); - - public: - gr_msg_queue_sptr msgq(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; diff --git a/gr-digital/swig/digital_ofdm_sampler.i b/gr-digital/swig/digital_ofdm_sampler.i deleted file mode 100644 index 91056c320..000000000 --- a/gr-digital/swig/digital_ofdm_sampler.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,ofdm_sampler) - - digital_ofdm_sampler_sptr digital_make_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout=1000); - -class digital_ofdm_sampler : public gr_sync_block -{ - private: - digital_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout); -}; diff --git a/gr-digital/swig/digital_packet_sink.i b/gr-digital/swig/digital_packet_sink.i deleted file mode 100644 index 84f81f75c..000000000 --- a/gr-digital/swig/digital_packet_sink.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,packet_sink) - -digital_packet_sink_sptr -digital_make_packet_sink(const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, - int threshold = -1); // -1 -> use default - -class digital_packet_sink : public gr_sync_block -{ - public: - bool carrier_sensed() const; -}; diff --git a/gr-digital/swig/digital_pfb_clock_sync_ccf.i b/gr-digital/swig/digital_pfb_clock_sync_ccf.i deleted file mode 100644 index dbba614cc..000000000 --- a/gr-digital/swig/digital_pfb_clock_sync_ccf.i +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,pfb_clock_sync_ccf); - -digital_pfb_clock_sync_ccf_sptr -digital_make_pfb_clock_sync_ccf(double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size=32, - float init_phase=0, - float max_rate_deviation=1.5, - int osps=1); - -class digital_pfb_clock_sync_ccf : public gr_block -{ - public: - void set_taps(const std::vector<float> &taps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_ccf*> &ourfilter); - - std::vector< std::vector<float> > get_taps(); - std::vector< std::vector<float> > get_diff_taps(); - std::vector<float> get_channel_taps(int channel); - std::vector<float> get_diff_channel_taps(int channel); - std::string get_taps_as_string(); - std::string get_diff_taps_as_string(); - - void set_loop_bandwidth(float bw); - void set_damping_factor(float df); - void set_alpha(float alpha); - void set_beta(float beta); - void set_max_rate_deviation(float m); - - float get_loop_bandwidth() const; - float get_damping_factor() const; - float get_alpha() const; - float get_beta() const; - float get_clock_rate() const; -}; diff --git a/gr-digital/swig/digital_pfb_clock_sync_fff.i b/gr-digital/swig/digital_pfb_clock_sync_fff.i deleted file mode 100644 index 956495e5d..000000000 --- a/gr-digital/swig/digital_pfb_clock_sync_fff.i +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,pfb_clock_sync_fff); - -digital_pfb_clock_sync_fff_sptr -digital_make_pfb_clock_sync_fff(double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size=32, - float init_phase=0, - float max_rate_deviation=1.5, - int osps=1); - -class digital_pfb_clock_sync_fff : public gr_block -{ - public: - void set_taps (const std::vector<float> &taps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_fff*> &ourfilter); - - std::vector< std::vector<float> > get_taps(); - std::vector< std::vector<float> > get_diff_taps(); - std::vector<float> get_channel_taps(int channel); - std::vector<float> get_diff_channel_taps(int channel); - std::string get_taps_as_string(); - std::string get_diff_taps_as_string(); - - void set_loop_bandwidth(float bw); - void set_damping_factor(float df); - void set_alpha(float alpha); - void set_beta(float beta); - void set_max_rate_deviation(float m); - - float get_loop_bandwidth() const; - float get_damping_factor() const; - float get_alpha() const; - float get_beta() const; - float get_clock_rate() const; -}; diff --git a/gr-digital/swig/digital_pn_correlator_cc.i b/gr-digital/swig/digital_pn_correlator_cc.i deleted file mode 100644 index 11ccf12c2..000000000 --- a/gr-digital/swig/digital_pn_correlator_cc.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,pn_correlator_cc) - -digital_pn_correlator_cc_sptr -digital_make_pn_correlator_cc(int degree, int mask=0, int seed=1); - -class digital_pn_correlator_cc : public gr_sync_decimator -{ - protected: - digital_pn_correlator_cc(); -}; diff --git a/gr-digital/swig/digital_probe_density_b.i b/gr-digital/swig/digital_probe_density_b.i deleted file mode 100644 index b0c8a119a..000000000 --- a/gr-digital/swig/digital_probe_density_b.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,probe_density_b); - -digital_probe_density_b_sptr -digital_make_probe_density_b(double alpha); - -class digital_probe_density_b : public gr_sync_block -{ -public: - double density() const; - void set_alpha(double alpha); -}; diff --git a/gr-digital/swig/digital_probe_mpsk_snr_est_c.i b/gr-digital/swig/digital_probe_mpsk_snr_est_c.i deleted file mode 100644 index 93db4127a..000000000 --- a/gr-digital/swig/digital_probe_mpsk_snr_est_c.i +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,probe_mpsk_snr_est_c); - -digital_probe_mpsk_snr_est_c_sptr -digital_make_probe_mpsk_snr_est_c(snr_est_type_t type, - int msg_nsamples=10000, - double alpha=0.001); - -class digital_probe_mpsk_snr_est_c : public gr_sync_block -{ -private: - void digital_probe_mpsk_snr_est_c(snr_est_type_t type, - int msg_nsamples, - double alpha); - -public: - double snr(); - snr_est_type_t type() const; - int msg_nsample() const; - double alpha() const; - void set_type(snr_est_type_t t); - void set_msg_nsample(int n); - void set_alpha(double alpha); -}; diff --git a/gr-digital/swig/digital_scrambler_bb.i b/gr-digital/swig/digital_scrambler_bb.i deleted file mode 100644 index ac9abef92..000000000 --- a/gr-digital/swig/digital_scrambler_bb.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,scrambler_bb); - -digital_scrambler_bb_sptr -digital_make_scrambler_bb(int mask, int seed, int len); - -class digital_scrambler_bb : public gr_sync_block -{ -}; diff --git a/gr-digital/swig/digital_simple_correlator.i b/gr-digital/swig/digital_simple_correlator.i deleted file mode 100644 index 5ad5ca26c..000000000 --- a/gr-digital/swig/digital_simple_correlator.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2013 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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,simple_correlator); - -digital_simple_correlator_sptr digital_make_simple_correlator(int payload_bytesize); - -class digital_simple_correlator : public gr_block -{ - private: - digital_simple_correlator(int payload_bytesize); -}; diff --git a/gr-digital/swig/digital_simple_framer.i b/gr-digital/swig/digital_simple_framer.i deleted file mode 100644 index a376317c5..000000000 --- a/gr-digital/swig/digital_simple_framer.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -GR_SWIG_BLOCK_MAGIC(digital,simple_framer); - -digital_simple_framer_sptr -digital_make_simple_framer(int payload_bytesize); - -class digital_simple_framer : public gr_block -{ -}; diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i deleted file mode 100644 index 2b8881872..000000000 --- a/gr-digital/swig/digital_swig.i +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2011 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. - */ - -%module digital_swig - -%include "gnuradio.i" - -//load generated python docstrings -%include "digital_swig_doc.i" - -#if SWIGPYTHON -enum snr_est_type_t { - SNR_EST_SIMPLE = 0, // Simple estimator (>= 7 dB) - SNR_EST_SKEW, // Skewness-base est (>= 5 dB) - SNR_EST_M2M4, // 2nd & 4th moment est (>= 1 dB) - SNR_EST_SVR // SVR-based est (>= 0dB) -}; -#endif - -%include <gri_control_loop.i> - -// Bring in generated blocks -%include "digital_generated.i" - -%{ -#include "digital_additive_scrambler_bb.h" -#include "digital_binary_slicer_fb.h" -#include "digital_bytes_to_syms.h" -#include "digital_clock_recovery_mm_cc.h" -#include "digital_clock_recovery_mm_ff.h" -#include "digital_cma_equalizer_cc.h" -#include "digital_constellation.h" -#include "digital_constellation_decoder_cb.h" -#include "digital_constellation_receiver_cb.h" -#include "digital_correlate_access_code_bb.h" -#include "digital_correlate_access_code_tag_bb.h" -#include "digital_costas_loop_cc.h" -#include "digital_cpmmod_bc.h" -#include "digital_crc32.h" -#include "digital_descrambler_bb.h" -#include "digital_diff_decoder_bb.h" -#include "digital_diff_encoder_bb.h" -#include "digital_diff_phasor_cc.h" -#include "digital_fll_band_edge_cc.h" -#include "digital_framer_sink_1.h" -#include "digital_glfsr_source_b.h" -#include "digital_glfsr_source_f.h" -#include "digital_gmskmod_bc.h" -#include "digital_kurtotic_equalizer_cc.h" -#include "digital_lms_dd_equalizer_cc.h" -#include "digital_map_bb.h" -#include "digital_mpsk_receiver_cc.h" -#include "digital_mpsk_snr_est_cc.h" -#include "digital_ofdm_cyclic_prefixer.h" -#include "digital_ofdm_frame_acquisition.h" -#include "digital_ofdm_frame_sink.h" -#include "digital_ofdm_insert_preamble.h" -#include "digital_ofdm_mapper_bcv.h" -#include "digital_ofdm_sampler.h" -#include "digital_packet_sink.h" -#include "digital_pfb_clock_sync_ccf.h" -#include "digital_pfb_clock_sync_fff.h" -#include "digital_pn_correlator_cc.h" -#include "digital_probe_density_b.h" -#include "digital_probe_mpsk_snr_est_c.h" -#include "digital_scrambler_bb.h" -#include "digital_simple_framer.h" -#include "digital_simple_correlator.h" -%} - -%include "digital_additive_scrambler_bb.i" -%include "digital_bytes_to_syms.i" -%include "digital_binary_slicer_fb.i" -%include "digital_clock_recovery_mm_cc.i" -%include "digital_clock_recovery_mm_ff.i" -%include "digital_cma_equalizer_cc.i" -%include "digital_constellation.i" -%include "digital_constellation_decoder_cb.i" -%include "digital_constellation_receiver_cb.i" -%include "digital_correlate_access_code_bb.i" -%include "digital_correlate_access_code_tag_bb.i" -%include "digital_costas_loop_cc.i" -%include "digital_cpmmod_bc.i" -%include "digital_crc32.i" -%include "digital_descrambler_bb.i" -%include "digital_diff_decoder_bb.i" -%include "digital_diff_encoder_bb.i" -%include "digital_diff_phasor_cc.i" -%include "digital_fll_band_edge_cc.i" -%include "digital_framer_sink_1.i" -%include "digital_glfsr_source_b.i" -%include "digital_glfsr_source_f.i" -%include "digital_gmskmod_bc.i" -%include "digital_kurtotic_equalizer_cc.i" -%include "digital_lms_dd_equalizer_cc.i" -%include "digital_map_bb.i" -%include "digital_mpsk_receiver_cc.i" -%include "digital_mpsk_snr_est_cc.i" -%include "digital_ofdm_cyclic_prefixer.i" -%include "digital_ofdm_frame_acquisition.i" -%include "digital_ofdm_frame_sink.i" -%include "digital_ofdm_insert_preamble.i" -%include "digital_ofdm_mapper_bcv.i" -%include "digital_ofdm_sampler.i" -%include "digital_packet_sink.i" -%include "digital_pfb_clock_sync_ccf.i" -%include "digital_pfb_clock_sync_fff.i" -%include "digital_pn_correlator_cc.i" -%include "digital_probe_density_b.i" -%include "digital_probe_mpsk_snr_est_c.i" -%include "digital_scrambler_bb.i" -%include "digital_simple_framer.i" -%include "digital_simple_correlator.i" diff --git a/gr-digital/swig/gnuradio/digital.scm b/gr-digital/swig/gnuradio/digital.scm deleted file mode 100644 index 834bc8d6d..000000000 --- a/gr-digital/swig/gnuradio/digital.scm +++ /dev/null @@ -1,28 +0,0 @@ -;;; -;;; Copyright 2011 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 this program. If not, see <http://www.gnu.org/licenses/>. -;;; - -;;; Module that just re-exports the digital_swig module - -(define-module (gnuradio digital) - #:use-module (gnuradio export-safely) - #:use-module (gnuradio digital_swig) - #:duplicates (merge-generics replace check)) - -(re-export-all '(gnuradio digital_swig)) - diff --git a/gr-fcd/AUTHORS b/gr-fcd/AUTHORS deleted file mode 100644 index 6673ab17d..000000000 --- a/gr-fcd/AUTHORS +++ /dev/null @@ -1,9 +0,0 @@ -This component was originally authored by: - -Alexandryu Csete <oz9aec@gmail.com> - -For convenience, it also includes the hidapi by signal11: -http://www.signal11.us/oss/hidapi/ - -as well as the FCD API code from Qthid by Howard Long, -Alexandru Csete and Mario Lorenz: http://qthid.sf.net/ diff --git a/gr-fcd/CMakeLists.txt b/gr-fcd/CMakeLists.txt deleted file mode 100644 index 1185b3a32..000000000 --- a/gr-fcd/CMakeLists.txt +++ /dev/null @@ -1,130 +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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) -if(NOT WIN32 AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - include(FindUSB) -endif() - -######################################################################## -# Register component -######################################################################## -include(GrComponent) - -# FIXME make better conditionalization -if (LINUX) - GR_REGISTER_COMPONENT("gr-fcd" ENABLE_GR_FCD - Boost_FOUND - ENABLE_GR_CORE - ENABLE_GR_AUDIO - LIBUSB_FOUND - ) -else() - GR_REGISTER_COMPONENT("gr-fcd" ENABLE_GR_FCD - Boost_FOUND - ENABLE_GR_CORE - ENABLE_GR_AUDIO - ) -endif() - -GR_SET_GLOBAL(GR_FCD_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/lib - ${CMAKE_CURRENT_SOURCE_DIR}/include/fcd -) - -SET(GR_PKG_FCD_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/fcd) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_FCD) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_FCD_DESCRIPTION "GNU Radio FCD Blocks") - -CPACK_COMPONENT("fcd_runtime" - GROUP "FCD" - DISPLAY_NAME "Runtime" - DESCRIPTION "Runtime" - DEPENDS "core_runtime;audio_runtime" -) - -CPACK_COMPONENT("fcd_devel" - GROUP "FCD" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel;audio_devel" -) - -CPACK_COMPONENT("fcd_python" - GROUP "FCD" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime; GRC xml files" - DEPENDS "core_python;fcd_runtime" -) - -CPACK_COMPONENT("fcd_examples" - GROUP "FCD" - DISPLAY_NAME "Examples" - DESCRIPTION "Example programs" - DEPENDS "fcd_runtime" -) - -CPACK_COMPONENT("fcd_swig" - GROUP "FCD" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;fcd_python;fcd_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(include/fcd) -add_subdirectory(lib) -if(ENABLE_PYTHON) - add_subdirectory(swig) - add_subdirectory(python) - add_subdirectory(grc) - add_subdirectory(examples/grc) -endif(ENABLE_PYTHON) -add_subdirectory(examples/c++) -add_subdirectory(doc) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-fcd.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-fcd.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-fcd.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "fcd_devel" -) - -endif(ENABLE_GR_FCD) diff --git a/gr-fcd/doc/CMakeLists.txt b/gr-fcd/doc/CMakeLists.txt deleted file mode 100644 index 6a4b7962d..000000000 --- a/gr-fcd/doc/CMakeLists.txt +++ /dev/null @@ -1,23 +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. - -install( - FILES README.fcd - DESTINATION ${GR_PKG_DOC_DIR} -) diff --git a/gr-fcd/doc/README.fcd b/gr-fcd/doc/README.fcd deleted file mode 100644 index c6ee02fff..000000000 --- a/gr-fcd/doc/README.fcd +++ /dev/null @@ -1,13 +0,0 @@ -This is the gr-fcd package. It contains a source block for the -FunCube Dongle hardware. - -The Python namespace is in gnuradio.fcd, which would be normally -imported as: - - from gnuradio import fcd - -See the Doxygen documentation for details about the blocks available -in this package. A quick listing of the details can be found in Python -after importing by using: - - help(fcd) diff --git a/gr-fcd/doc/fcd.dox b/gr-fcd/doc/fcd.dox deleted file mode 100644 index aca4dadaa..000000000 --- a/gr-fcd/doc/fcd.dox +++ /dev/null @@ -1,29 +0,0 @@ -/*! \page page_fcd FunCube Dongle Source - -\section Introduction - -This is the gr-fcd package. It contains a source block for the -FunCube Dongle hardware. - -The Python namespace is in gnuradio.fcd, which would be normally -imported as: - -\code - from gnuradio import fcd -\endcode - -See the Doxygen documentation for details about the blocks available -in this package. A quick listing of the details can be found in Python -after importing by using: - -\code - help(fcd) -\endcode - -\section Dependencies - -The FCD blocks require the following dependencies. - -\li libusb-1.0 (version >= 1.0) - -*/ diff --git a/gr-fcd/examples/c++/CMakeLists.txt b/gr-fcd/examples/c++/CMakeLists.txt deleted file mode 100644 index 7ff69777d..000000000 --- a/gr-fcd/examples/c++/CMakeLists.txt +++ /dev/null @@ -1,35 +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. - -include_directories( - ${GR_FCD_INCLUDE_DIRS} - ${GR_AUDIO_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -add_executable(fcd_nfm_rx fcd_nfm_rx.cc) -target_link_libraries(fcd_nfm_rx gnuradio-fcd) - -INSTALL(TARGETS - fcd_nfm_rx - DESTINATION ${GR_PKG_FCD_EXAMPLES_DIR} - COMPONENT "fcd_examples" -) diff --git a/gr-fcd/examples/c++/fcd_nfm_rx.cc b/gr-fcd/examples/c++/fcd_nfm_rx.cc deleted file mode 100644 index 0ebc5d288..000000000 --- a/gr-fcd/examples/c++/fcd_nfm_rx.cc +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * 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. - */ - -/* - * Simple GNU Radio C++ example for using the Funcube Dongle. - * - * Construct a simple narrow band FM receiver using the gr-fcd - * block as source. - * - * This example uses "hw:1" as FCD source device and the default - * audio device for output. - * - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -// Include header files for each block used in flowgraph -#include <gr_top_block.h> -#include <gr_firdes.h> -#include <gr_fir_filter_ccf.h> -#include <gr_quadrature_demod_cf.h> -#include <gr_audio_sink.h> -#include <fcd_source_c.h> - -// other includes -#include <iostream> -#include <boost/program_options.hpp> - - -namespace po = boost::program_options; - -int main(int argc, char **argv) -{ - int rate = 48000; // Audio card sample rate - float pi = 3.141592654; - - - //variables to be set by po - std::string device; - int freq; - float gain; - - //setup the program options - po::options_description desc("Command line options"); - desc.add_options() - ("help", "This help message") - ("device", po::value<std::string>(&device)->default_value("hw:1"), "Audio input device") - ("freq", po::value<int>(&freq)->default_value(145500), "RF frequency in kHz") - ("gain", po::value<float>(&gain)->default_value(20.0), "LNA gain in dB") - ; - po::variables_map vm; - po::store(po::parse_command_line(argc, argv, desc), vm); - po::notify(vm); - - //print the help message - if (vm.count("help")){ - std::cout << "Narrow band FM receiver example" << std::endl << desc << std::endl; - return ~0; - } - - - // Construct a top block that will contain flowgraph blocks. - gr_top_block_sptr tb = gr_make_top_block("fcd_nfm_rx"); - - // FCD source - fcd_source_c_sptr fcd = fcd_make_source_c(device); - fcd->set_freq_khz(freq); - fcd->set_lna_gain(gain); - - // Low pass filter - std::vector<float> taps = gr_firdes::low_pass(1.0, 96000, 5000.0, 1000.0); - gr_fir_filter_ccf_sptr filter = gr_make_fir_filter_ccf (2, taps); - - // FM demodulator - // gain = sample_rate / (2*pi*max_dev) - gr_quadrature_demod_cf_sptr demod = gr_make_quadrature_demod_cf (rate/(2.0*pi*5000.0)); - - // Audio sink - audio_sink::sptr sink = audio_make_sink(rate); - - // Connect blocks - tb->connect(fcd, 0, filter, 0); - tb->connect(filter, 0, demod, 0); - tb->connect(demod, 0, sink, 0); - - // Tell GNU Radio runtime to start flowgraph threads; the foreground thread - // will block until either flowgraph exits (this example doesn't) or the - // application receives SIGINT (e.g., user hits CTRL-C). - // - // Real applications may use tb->start() which returns, allowing the foreground - // thread to proceed, then later use tb->stop(), followed by tb->wait(), to cleanup - // GNU Radio before exiting. - tb->run(); - - // Exit normally. - return 0; -} diff --git a/gr-fcd/examples/grc/CMakeLists.txt b/gr-fcd/examples/grc/CMakeLists.txt deleted file mode 100644 index e33fdf182..000000000 --- a/gr-fcd/examples/grc/CMakeLists.txt +++ /dev/null @@ -1,26 +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. - -INSTALL(FILES - fcd_apt_rx.grc - fcd_fft_wx.grc - fcd_nfm_rx.grc - DESTINATION ${GR_PKG_FCD_EXAMPLES_DIR} - COMPONENT "fcd_examples" -)
\ No newline at end of file diff --git a/gr-fcd/examples/grc/fcd_apt_rx.grc b/gr-fcd/examples/grc/fcd_apt_rx.grc deleted file mode 100644 index c4d3e64d1..000000000 --- a/gr-fcd/examples/grc/fcd_apt_rx.grc +++ /dev/null @@ -1,704 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sun May 8 18:01:53 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>fcd_apt_rx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>NOAA APT Receiver</value> - </param> - <param> - <key>author</key> - <value>Alexandru Csete OZ9AEC</value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>96000</value> - </param> - <param> - <key>_coordinate</key> - <value>(200, 9)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>audio_sink</key> - <param> - <key>id</key> - <value>audio_sink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>samp_rate</key> - <value>48000</value> - </param> - <param> - <key>device_name</key> - <value></value> - </param> - <param> - <key>ok_to_block</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(794, 355)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_fm_demod_cf</key> - <param> - <key>id</key> - <value>blks2_fm_demod_cf</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>chan_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>audio_decim</key> - <value>2</value> - </param> - <param> - <key>deviation</key> - <value>max_dev</value> - </param> - <param> - <key>audio_pass</key> - <value>5000</value> - </param> - <param> - <key>audio_stop</key> - <value>7000</value> - </param> - <param> - <key>gain</key> - <value>1.0</value> - </param> - <param> - <key>tau</key> - <value>75e-6</value> - </param> - <param> - <key>_coordinate</key> - <value>(568, 307)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_rational_resampler_xxx</key> - <param> - <key>id</key> - <value>blks2_rational_resampler_xxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>fff</value> - </param> - <param> - <key>decim</key> - <value>48000</value> - </param> - <param> - <key>interp</key> - <value>11025</value> - </param> - <param> - <key>taps</key> - <value>[]</value> - </param> - <param> - <key>fractional_bw</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(516, 522)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>wav_file</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>prefix + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".wav"</value> - </param> - <param> - <key>_coordinate</key> - <value>(762, 652)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>prefix</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>"FCD_APT_REC-"</value> - </param> - <param> - <key>_coordinate</key> - <value>(625, 653)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>from datetime import datetime</value> - </param> - <param> - <key>_coordinate</key> - <value>(508, 653)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_wavfile_sink</key> - <param> - <key>id</key> - <value>wavfile_sink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>file</key> - <value>wav_file</value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>11025</value> - </param> - <param> - <key>bits_per_sample</key> - <value>16</value> - </param> - <param> - <key>_coordinate</key> - <value>(805, 530)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_chooser</key> - <param> - <key>id</key> - <value>sat_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Satellite</value> - </param> - <param> - <key>value</key> - <value>137500000</value> - </param> - <param> - <key>choices</key> - <value>[137500000,137620000,137912500,137100000]</value> - </param> - <param> - <key>labels</key> - <value>["NOAA-15","NOAA-17","NOAA-18","NOAA-19"]</value> - </param> - <param> - <key>type</key> - <value>drop_down</value> - </param> - <param> - <key>style</key> - <value>wx.RA_HORIZONTAL</value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(18, 479)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>max_dev</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>17000</value> - </param> - <param> - <key>_coordinate</key> - <value>(299, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_chooser</key> - <param> - <key>id</key> - <value>fcd_lna_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>LNA gain [dB]</value> - </param> - <param> - <key>value</key> - <value>20.0</value> - </param> - <param> - <key>choices</key> - <value>[30.0, 25.0, 20.0, 17.5, 15.0, 12.5, 10.0, 7.5, 5.0, 2.5, 0.0, -2.5, -5.0]</value> - </param> - <param> - <key>labels</key> - <value>[]</value> - </param> - <param> - <key>type</key> - <value>drop_down</value> - </param> - <param> - <key>style</key> - <value>wx.RA_HORIZONTAL</value> - </param> - <param> - <key>grid_pos</key> - <value>2,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(207, 481)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>rec_info</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Recording to</value> - </param> - <param> - <key>value</key> - <value>wav_file</value> - </param> - <param> - <key>converver</key> - <value>str_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>1,1,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(641, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>low_pass_filter</key> - <param> - <key>id</key> - <value>low_pass_filter</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>fir_filter_ccf</value> - </param> - <param> - <key>decim</key> - <value>1</value> - </param> - <param> - <key>interp</key> - <value>1</value> - </param> - <param> - <key>gain</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>cutoff_freq</key> - <value>25000</value> - </param> - <param> - <key>width</key> - <value>5000</value> - </param> - <param> - <key>win</key> - <value>firdes.WIN_HAMMING</value> - </param> - <param> - <key>beta</key> - <value>6.76</value> - </param> - <param> - <key>_coordinate</key> - <value>(334, 307)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>fcd_source_c</key> - <param> - <key>id</key> - <value>fcd_source_c_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>device_name</key> - <value>hw:1</value> - </param> - <param> - <key>freq</key> - <value>sat_freq</value> - </param> - <param> - <key>lna</key> - <value>fcd_lna_gain</value> - </param> - <param> - <key>ppm</key> - <value>-120</value> - </param> - <param> - <key>dci</key> - <value>0.0</value> - </param> - <param> - <key>dcq</key> - <value>0.0</value> - </param> - <param> - <key>iq_phase</key> - <value>0.0</value> - </param> - <param> - <key>iq_gain</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(25, 299)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>fftsink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>FCD Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>sat_freq</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>0.0</value> - </param> - <param> - <key>ref_scale</key> - <value>1.0</value> - </param> - <param> - <key>fft_size</key> - <value>512</value> - </param> - <param> - <key>fft_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>0,0,1,2</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(335, 103)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>low_pass_filter</source_block_id> - <sink_block_id>blks2_fm_demod_cf</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_fm_demod_cf</source_block_id> - <sink_block_id>audio_sink</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_rational_resampler_xxx_0</source_block_id> - <sink_block_id>wavfile_sink</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_fm_demod_cf</source_block_id> - <sink_block_id>blks2_rational_resampler_xxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>fcd_source_c_0</source_block_id> - <sink_block_id>low_pass_filter</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>fcd_source_c_0</source_block_id> - <sink_block_id>fftsink</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-fcd/examples/grc/fcd_fft_wx.grc b/gr-fcd/examples/grc/fcd_fft_wx.grc deleted file mode 100644 index c045bbfa2..000000000 --- a/gr-fcd/examples/grc/fcd_fft_wx.grc +++ /dev/null @@ -1,320 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sun May 8 18:02:35 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>fcd_fft_wx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Funcube Dongle FFT scope</value> - </param> - <param> - <key>author</key> - <value>Alexandru Csete OZ9AEC</value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>96000</value> - </param> - <param> - <key>_coordinate</key> - <value>(201, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_text_box</key> - <param> - <key>id</key> - <value>fcd_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>FCD freq</value> - </param> - <param> - <key>value</key> - <value>145500000</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(300, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_chooser</key> - <param> - <key>id</key> - <value>fcd_lna_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>LNA gain [dB]</value> - </param> - <param> - <key>value</key> - <value>20.0</value> - </param> - <param> - <key>choices</key> - <value>[30.0, 25.0, 20.0, 17.5, 15.0, 12.5, 10.0, 7.5, 5.0, 2.5, 0.0, -2.5, -5.0]</value> - </param> - <param> - <key>labels</key> - <value>[]</value> - </param> - <param> - <key>type</key> - <value>drop_down</value> - </param> - <param> - <key>style</key> - <value>wx.RA_HORIZONTAL</value> - </param> - <param> - <key>grid_pos</key> - <value>2,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(446, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>FCD Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>fcd_freq</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>ref_scale</key> - <value>1.0</value> - </param> - <param> - <key>fft_size</key> - <value>512</value> - </param> - <param> - <key>fft_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>0,0,1,2</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(442, 176)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>fcd_source_c</key> - <param> - <key>id</key> - <value>fcd_source_c_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>device_name</key> - <value>hw:1</value> - </param> - <param> - <key>freq</key> - <value>fcd_freq</value> - </param> - <param> - <key>lna</key> - <value>fcd_lna_gain</value> - </param> - <param> - <key>ppm</key> - <value>-120</value> - </param> - <param> - <key>dci</key> - <value>0.0</value> - </param> - <param> - <key>dcq</key> - <value>0.0</value> - </param> - <param> - <key>iq_phase</key> - <value>0.0</value> - </param> - <param> - <key>iq_gain</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(95, 192)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>fcd_source_c_1</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-fcd/examples/grc/fcd_nfm_rx.grc b/gr-fcd/examples/grc/fcd_nfm_rx.grc deleted file mode 100644 index 9dac3fcb8..000000000 --- a/gr-fcd/examples/grc/fcd_nfm_rx.grc +++ /dev/null @@ -1,1035 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sun May 8 18:05:32 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>fcd_nfm_rx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>FCD FM Receiver</value> - </param> - <param> - <key>author</key> - <value>OZ9AEC</value> - </param> - <param> - <key>description</key> - <value>Simple FM receiver using the Funcube Dongle</value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>rx_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Receive</value> - </param> - <param> - <key>value</key> - <value>freq+(offset_coarse+offset_fine)</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>5,3,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(491, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>offset_fine</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Fine tune</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>-1000</value> - </param> - <param> - <key>max</key> - <value>1000</value> - </param> - <param> - <key>num_steps</key> - <value>400</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>6,0,1,2</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(9, 279)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>offset_coarse</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Coarse tune</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>-48000</value> - </param> - <param> - <key>max</key> - <value>48000</value> - </param> - <param> - <key>num_steps</key> - <value>960</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>6,2,1,2</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 130)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>width</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Filter</value> - </param> - <param> - <key>value</key> - <value>10000</value> - </param> - <param> - <key>min</key> - <value>2000</value> - </param> - <param> - <key>max</key> - <value>40000</value> - </param> - <param> - <key>num_steps</key> - <value>760</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>7,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(9, 431)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>trans</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Trans</value> - </param> - <param> - <key>value</key> - <value>1500</value> - </param> - <param> - <key>min</key> - <value>500</value> - </param> - <param> - <key>max</key> - <value>5000</value> - </param> - <param> - <key>num_steps</key> - <value>900</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>8,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 577)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>af_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>VOL</value> - </param> - <param> - <key>value</key> - <value>1</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>5</value> - </param> - <param> - <key>num_steps</key> - <value>50</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>8,1,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(168, 726)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>low_pass_filter</key> - <param> - <key>id</key> - <value>low_pass_filter</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>fir_filter_ccf</value> - </param> - <param> - <key>decim</key> - <value>1</value> - </param> - <param> - <key>interp</key> - <value>1</value> - </param> - <param> - <key>gain</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>cutoff_freq</key> - <value>width/2</value> - </param> - <param> - <key>width</key> - <value>trans</value> - </param> - <param> - <key>win</key> - <value>firdes.WIN_HAMMING</value> - </param> - <param> - <key>beta</key> - <value>6.76</value> - </param> - <param> - <key>_coordinate</key> - <value>(742, 258)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_simple_squelch_cc</key> - <param> - <key>id</key> - <value>gr_simple_squelch_cc_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>threshold</key> - <value>sql_lev</value> - </param> - <param> - <key>alpha</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(226, 499)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_nbfm_rx</key> - <param> - <key>id</key> - <value>nbfm_normal</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>audio_rate</key> - <value>48000</value> - </param> - <param> - <key>quad_rate</key> - <value>96000</value> - </param> - <param> - <key>tau</key> - <value>75e-6</value> - </param> - <param> - <key>max_dev</key> - <value>5e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(441, 483)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>const</key> - <value>af_gain</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(674, 507)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>audio_sink</key> - <param> - <key>id</key> - <value>audio_sink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>samp_rate</key> - <value>48000</value> - </param> - <param> - <key>device_name</key> - <value></value> - </param> - <param> - <key>ok_to_block</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(882, 511)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>96000</value> - </param> - <param> - <key>_coordinate</key> - <value>(210, 12)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>fftsink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>rx_freq*display_selector</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>ref_scale</key> - <value>1.0</value> - </param> - <param> - <key>fft_size</key> - <value>512</value> - </param> - <param> - <key>fft_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.5</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value>800,300</value> - </param> - <param> - <key>grid_pos</key> - <value>0,0,5,4</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(742, 24)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>sql_lev</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>SQL</value> - </param> - <param> - <key>value</key> - <value>-100</value> - </param> - <param> - <key>min</key> - <value>-100</value> - </param> - <param> - <key>max</key> - <value>0</value> - </param> - <param> - <key>num_steps</key> - <value>500</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>7,2,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(328, 728)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>xlate_filter_taps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>firdes.low_pass(1, samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76)</value> - </param> - <param> - <key>_coordinate</key> - <value>(428, 294)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_chooser</key> - <param> - <key>id</key> - <value>display_selector</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Spectrum</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>choices</key> - <value>[0, 1]</value> - </param> - <param> - <key>labels</key> - <value>['Baseband','RF']</value> - </param> - <param> - <key>type</key> - <value>drop_down</value> - </param> - <param> - <key>style</key> - <value>wx.RA_HORIZONTAL</value> - </param> - <param> - <key>grid_pos</key> - <value>5,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(481, 728)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_text_box</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>FCD Freq</value> - </param> - <param> - <key>value</key> - <value>144470000</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>5,1,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(339, 9)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_freq_xlating_fir_filter_xxx</key> - <param> - <key>id</key> - <value>xlating_fir_filter</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ccc</value> - </param> - <param> - <key>decim</key> - <value>1</value> - </param> - <param> - <key>taps</key> - <value>xlate_filter_taps</value> - </param> - <param> - <key>center_freq</key> - <value>-(offset_coarse+offset_fine)</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(433, 189)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>rf_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>RF</value> - </param> - <param> - <key>value</key> - <value>20</value> - </param> - <param> - <key>min</key> - <value>-5</value> - </param> - <param> - <key>max</key> - <value>30</value> - </param> - <param> - <key>num_steps</key> - <value>35</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>7,1,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(11, 725)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>fcd_source_c</key> - <param> - <key>id</key> - <value>fcd_source_c_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>device_name</key> - <value>hw:1</value> - </param> - <param> - <key>freq</key> - <value>freq</value> - </param> - <param> - <key>lna</key> - <value>rf_gain</value> - </param> - <param> - <key>ppm</key> - <value>-120</value> - </param> - <param> - <key>dci</key> - <value>0.0</value> - </param> - <param> - <key>dcq</key> - <value>0.0</value> - </param> - <param> - <key>iq_phase</key> - <value>0.0</value> - </param> - <param> - <key>iq_gain</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(165, 157)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>xlating_fir_filter</source_block_id> - <sink_block_id>fftsink</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>xlating_fir_filter</source_block_id> - <sink_block_id>low_pass_filter</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>low_pass_filter</source_block_id> - <sink_block_id>gr_simple_squelch_cc_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_1</source_block_id> - <sink_block_id>audio_sink</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_1</source_block_id> - <sink_block_id>audio_sink</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_simple_squelch_cc_0</source_block_id> - <sink_block_id>nbfm_normal</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>nbfm_normal</source_block_id> - <sink_block_id>gr_multiply_const_vxx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>fcd_source_c_1</source_block_id> - <sink_block_id>xlating_fir_filter</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-fcd/gnuradio-fcd.pc.in b/gr-fcd/gnuradio-fcd.pc.in deleted file mode 100644 index 6b8ce134e..000000000 --- a/gr-fcd/gnuradio-fcd.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-fcd -Description: Funcube Dongle source block for GNU Radio -Requires: gnuradio-core gnuradio-audio -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-fcd -Cflags: -I${includedir} diff --git a/gr-fcd/grc/CMakeLists.txt b/gr-fcd/grc/CMakeLists.txt deleted file mode 100644 index d1eb00e32..000000000 --- a/gr-fcd/grc/CMakeLists.txt +++ /dev/null @@ -1,24 +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. - -install(FILES - fcd_source_c.xml - DESTINATION ${GRC_BLOCKS_DIR} - COMPONENT "fcd_python" -) diff --git a/gr-fcd/grc/fcd_source_c.xml b/gr-fcd/grc/fcd_source_c.xml deleted file mode 100644 index f1726f88f..000000000 --- a/gr-fcd/grc/fcd_source_c.xml +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0"?> -<block> - <name>Funcube Dongle Source</name> - <key>fcd_source_c</key> - <category>Sources</category> - <throttle>1</throttle> - <import>from gnuradio import fcd</import> - <make>fcd.source_c($device_name) -#if $lna() != 20.0 -self.$(id).set_lna_gain($lna) -#end if -#if $mixer() != +12.0 -self.$(id).set_mixer_gain($mixer) -#end if -#if $ppm() != -120 -self.$(id).set_freq_corr($ppm) -#end if -#if ($dci() != 0.0) or ($dcq() != 0.0) -self.$(id).set_dc_corr($dci,$dcq) -#end if -#if ($iq_phase() != 0.0) or ($iq_gain() != 1.0) -self.$(id).set_iq_corr($iq_gain,$iq_phase) -#end if -self.$(id).set_freq($freq) - </make> - <callback>set_freq($freq)</callback> - <callback>set_lna_gain($lna)</callback> - <callback>set_mixer_gain($mixer)</callback> - <callback>set_freq_corr($ppm)</callback> - <callback>set_dc_corr($dci,$dcq)</callback> - <callback>set_iq_corr($iq_gain,$iq_phase)</callback> - <param> - <name>Device Name</name> - <key>device_name</key> - <value>hw:1</value> - <type>string</type> - <hide>#if $device_name() then 'none' else 'part'#</hide> - </param> - <param> - <name>Frequency (Hz)</name> - <key>freq</key> - <value>145500000</value> - <type>real</type> - </param> - <param> - <name>LNA Gain (dB)</name> - <key>lna</key> - <value>20.0</value> - <type>real</type> - </param> - <param> - <name>Mixer Gain (dB)</name> - <key>mixer</key> - <value>+12</value> - <type>real</type> - </param> - <param> - <name>Frequency corr. (ppm)</name> - <key>ppm</key> - <value>-120</value> - <type>int</type> - </param> - <param> - <name>DC I offset</name> - <key>dci</key> - <value>0.0</value> - <type>real</type> - </param> - <param> - <name>DC Q offset</name> - <key>dcq</key> - <value>0.0</value> - <type>real</type> - </param> - <param> - <name>IQ phase balance</name> - <key>iq_phase</key> - <value>0.0</value> - <type>real</type> - </param> - <param> - <name>IQ gain balance</name> - <key>iq_gain</key> - <value>1.0</value> - <type>real</type> - </param> - <check>($freq >= 50e6) and ($freq <= 2e9)</check> - <check>($dci >= -1.0) and ($dci <= 1.0)</check> - <check>($dcq >= -1.0) and ($dcq <= 1.0)</check> - <check>($iq_phase >= -1.0) and ($iq_phase <= 1.0)</check> - <check>($iq_gain >= -1.0) and ($iq_gain <= 1.0)</check> - <source> - <name>out</name> - <type>complex</type> - </source> - <doc> -This block wraps the Funcube Dongle USB audio input and the USB HID control interface \ -into one convenient GNU Radio source block. - -The sample rate is fixed at 96 ksps. - -To find the device name on Linux type: - cat /proc/asound/cards - -The LNA gain is a set of discrete values between -5 to 30 dB with 2.5 dB step, but you can \ -use any float value and it will be rounded to the nearest valid value. - -The Mixer gain can be set either to +4 or +12 dB, but you can use any float value \ -and it will be rounded to the nearest valid value. - -The FCD block can autmatically apply frequency correction: - - For FCD v1.0 you can leave at -120 ppm - - For FCD v1.1 with serial number 810 or greater use -12 ppm - -The DC offset and IQ balance parameters can have range -1.0 to 1.0. - </doc> -</block> diff --git a/gr-fcd/include/fcd/CMakeLists.txt b/gr-fcd/include/fcd/CMakeLists.txt deleted file mode 100644 index 3ca70c2a1..000000000 --- a/gr-fcd/include/fcd/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Install header files -######################################################################## -install(FILES - fcd_api.h - fcd_source_c.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "fcd_devel" -) diff --git a/gr-fcd/include/fcd/fcd_api.h b/gr-fcd/include/fcd/fcd_api.h deleted file mode 100644 index e1452b8af..000000000 --- a/gr-fcd/include/fcd/fcd_api.h +++ /dev/null @@ -1,33 +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. - */ - -#ifndef INCLUDED_FCD_API_H -#define INCLUDED_FCD_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_fcd_EXPORTS -# define FCD_API __GR_ATTR_EXPORT -#else -# define FCD_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_FCD_API_H */ diff --git a/gr-fcd/include/fcd/fcd_source_c.h b/gr-fcd/include/fcd/fcd_source_c.h deleted file mode 100644 index 19c589023..000000000 --- a/gr-fcd/include/fcd/fcd_source_c.h +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011-2012 Free Software Foundation, Inc. - * - * 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 INCLUDED_FCD_SOURCE_C_H -#define INCLUDED_FCD_SOURCE_C_H - -#include <fcd_api.h> -#include <gr_hier_block2.h> - -class fcd_source_c; - -typedef boost::shared_ptr<fcd_source_c> fcd_source_c_sptr; - -/*! - * \brief Return a shared_ptr to a new instance of fcd_source_c. - * - * This is effectively the public constructor. To avoid accidental use - * of raw pointers, fcd_source_c's constructor is private. - * fcd_make_source_c is the public interface for creating new instances. - */ -FCD_API fcd_source_c_sptr fcd_make_source_c(const std::string device_name = ""); - -/*! \brief Funcube Dongle source block. - * - * This class provides a Funcube Dongle soure block by wrapping the - * USB audio interface and the USB HID control interface of the Funcube - * Dongle into one convenient source block. - * - * The Funcube Dongle needs to have firmware 18f or later for the control - * interface to work properly. As of early 2011, FCDs still come with firmware - * 18b. You can use qthid 2.2 (not 3) to upgrade the firmware: http://qthid.sf.net - */ -class FCD_API fcd_source_c : virtual public gr_hier_block2 -{ -public: - /*! \brief Set frequency with Hz resolution. - * \param freq The frequency in Hz - * - * Set the frequency of the Funcube Dongle with 1 Hz resolution applying - * the frequency correction set by set_freq_corr(). - * - * \see set_freq_khz() - */ - virtual void set_freq(int freq) = 0; - - /*! \brief Set frequency with Hz resolution. - * \param freq The frequency in Hz - * - * This is a convenience function that uses float parameter in order to allow - * using engineering notation in GRC. - * - * \see set_freq_khz() - */ - virtual void set_freq(float freq) = 0; - - /*! \brief Set frequency with kHz resolution. - * \param freq The frequency in kHz - * - * Sets the frequency of the Funcube Dongle with 1 kHz resolution - * applying the frequency correction set by set_freq_corr(). - * - * \see set_freq() - */ - virtual void set_freq_khz(int freq) = 0; - - /*! \brief Set LNA gain. - * \param gain The new gain in dB. - * - * Set the LNA gain in the FCD. Valid range is -5 to 30. Although - * the LNA gain in the FCD takes enumerated values corresponding to - * 2.5 dB steps, you can can call this method with any float value - * and it will be rounded to the nearest valid value. - * - * By default the LNA gain is set to 20 dB and this is a good value for - * most cases. In noisy areas you may try to reduce the gain. - */ - virtual void set_lna_gain(float gain) = 0; - - /*! \brief Set mixer gain. - * \param gain The new gain in dB. - * - * Set the mixer gain in the FCD. Valid values are +4 and +12 dB. - * - * By default the mixer gain is set to +12 dB and this is a good value for - * most cases. In noisy areas you may try to reduce the gain. - */ - virtual void set_mixer_gain(float gain) = 0; - - /*! \brief Set new frequency correction. - * \param ppm The new frequency correction in parts per million - * - * Version 1.1 FCDs (S/N 810 or later) need a correction of -12 ppm. - * Earlier FCDs need roughly -120 ppm (default for gr-fcd). - * - * Ref: http://www.funcubedongle.com/?p=617 - */ - virtual void set_freq_corr(int ppm) = 0; - - /*! \brief Set DC offset correction. - * \param _dci DC correction for I component (-1.0 to 1.0) - * \param _dcq DC correction for Q component (-1.0 to 1.0) - * - * Set DC offset correction in the device. Default is 0.0. - */ - virtual void set_dc_corr(double _dci, double _dcq) = 0; - - /*! \brief Set IQ phase and gain balance. - * \param _gain The gain correction (-1.0 to 1.0) - * \param _phase The phase correction (-1.0 to 1.0) - * - * Set IQ phase and gain balance in the device. The default values - * are 0.0 for phase and 1.0 for gain. - */ - virtual void set_iq_corr(double _gain, double _phase) = 0; -}; - -#endif /* INCLUDED_FCD_SOURCE_C_H */ diff --git a/gr-fcd/lib/CMakeLists.txt b/gr-fcd/lib/CMakeLists.txt deleted file mode 100644 index a5c95ceb7..000000000 --- a/gr-fcd/lib/CMakeLists.txt +++ /dev/null @@ -1,73 +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. - -GR_INCLUDE_SUBDIRECTORY(hid) -GR_INCLUDE_SUBDIRECTORY(fcd) - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/hid - ${CMAKE_CURRENT_SOURCE_DIR}/fcd - ${GR_FCD_INCLUDE_DIRS} - ${GR_AUDIO_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${LIBUSB_INCLUDE_DIR} -) - -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_fcd_sources - fcd_source_c_impl.cc -) - -list(APPEND fcd_libs - gnuradio-core - gnuradio-audio - ${Boost_LIBRARIES} -) - -if (WIN32) - list(APPEND fcd_libs setupapi) -endif() - -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - FIND_LIBRARY(IOKIT_LIBRARY IOKit) - list(APPEND fcd_libs ${IOKIT_LIBRARY}) -elseif (NOT WIN32) - list(APPEND fcd_libs - ${LIBUSB_LIBRARIES} - ) -endif() - - -add_library(gnuradio-fcd SHARED ${gr_fcd_sources}) -if (LINUX) - list(APPEND fcd_libs rt) -endif() -target_link_libraries(gnuradio-fcd ${fcd_libs}) - - -GR_LIBRARY_FOO(gnuradio-fcd RUNTIME_COMPONENT "fcd_runtime" DEVEL_COMPONENT "fcd_devel") diff --git a/gr-fcd/lib/fcd/CMakeLists.txt b/gr-fcd/lib/fcd/CMakeLists.txt deleted file mode 100644 index 416a7507e..000000000 --- a/gr-fcd/lib/fcd/CMakeLists.txt +++ /dev/null @@ -1,32 +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 file included, use CMake directory variables -######################################################################## - -include_directories(APPEND ${USB_INCLUDES}) - -set(fcd_sources ${CMAKE_CURRENT_SOURCE_DIR}/fcd.c) - - -######################################################################## -# Append gnuradio-fcd library sources -######################################################################## -list(APPEND gr_fcd_sources ${fcd_sources}) diff --git a/gr-fcd/lib/fcd/COPYRIGHT b/gr-fcd/lib/fcd/COPYRIGHT deleted file mode 100644 index f176590e9..000000000 --- a/gr-fcd/lib/fcd/COPYRIGHT +++ /dev/null @@ -1,23 +0,0 @@ -For convenience, GNU Radio includes the contents of this directory -in its distribution, but they are not considered part of GNU Radio. - -These files are licensed and redistributed using the terms of the -GPLv3. -------------------------------------------------------------------- -Copyright (C) 2010 Howard Long, G6LVB -CopyRight (C) 2011 Alexandru Csete, OZ9AEC - Mario Lorenz, DL5MLO - -Qthid 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. - -Qthid 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 Qthid. If not, see <http://www.gnu.org/licenses/>. - diff --git a/gr-fcd/lib/fcd/fcd.c b/gr-fcd/lib/fcd/fcd.c deleted file mode 100644 index 011d77be9..000000000 --- a/gr-fcd/lib/fcd/fcd.c +++ /dev/null @@ -1,904 +0,0 @@ -/*************************************************************************** - * This file is part of Qthid. - * - * Copyright (C) 2010 Howard Long, G6LVB - * CopyRight (C) 2011 Alexandru Csete, OZ9AEC - * Mario Lorenz, DL5MLO - * - * Qthid 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. - * - * Qthid 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 Qthid. If not, see <http://www.gnu.org/licenses/>. - * - ***************************************************************************/ - -#define FCD -#include <string.h> -#ifdef WIN32 - #include <malloc.h> -#else - #include <stdlib.h> -#endif -#include "hidapi.h" -#include "fcd.h" -#include "fcdhidcmd.h" -#include <stdio.h> - - -#define FALSE 0 -#define TRUE 1 -typedef int BOOL; - - -const unsigned short _usVID=0x04D8; /*!< USB vendor ID. */ -const unsigned short _usPID=0xFB56; /*!< USB product ID. */ - - - -/** \brief Open FCD device. - * \return Pointer to the FCD HID device or NULL if none found - * - * This function looks for FCD devices connected to the computer and - * opens the first one found. - */ -static hid_device *fcdOpen(void) -{ - struct hid_device_info *phdi=NULL; - hid_device *phd=NULL; - char *pszPath=NULL; - - phdi=hid_enumerate(_usVID,_usPID); - if (phdi==NULL) - { - return NULL; // No FCD device found - } - - pszPath=strdup(phdi->path); - if (pszPath==NULL) - { - return NULL; - } - - hid_free_enumeration(phdi); - phdi=NULL; - - if ((phd=hid_open_path(pszPath)) == NULL) - { - free(pszPath); - pszPath=NULL; - - return NULL; - } - - free(pszPath); - pszPath=NULL; - - return phd; -} - - -/** \brief Close FCD HID device. */ -static void fcdClose(hid_device *phd) -{ - hid_close(phd); -} - - -/** \brief Get FCD mode. - * \return The current FCD mode. - * \sa FCD_MODE_ENUM - */ -EXTERN FCD_MODE_ENUM fcdGetMode(void) -{ - hid_device *phd=NULL; - unsigned char aucBufIn[65]; - unsigned char aucBufOut[65]; - FCD_MODE_ENUM fcd_mode = FCD_MODE_NONE; - - - phd = fcdOpen(); - - if (phd == NULL) - { - return FCD_MODE_NONE; - } - - /* Send a BL Query Command */ - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_QUERY; - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - fcdClose(phd); - phd = NULL; - - /* first check status bytes then check which mode */ - if (aucBufIn[0]==FCD_CMD_BL_QUERY && aucBufIn[1]==1) { - - /* In bootloader mode we have the string "FCDBL" starting at acBufIn[2] **/ - if (strncmp((char *)(aucBufIn+2), "FCDBL", 5) == 0) { - fcd_mode = FCD_MODE_BL; - } - /* In application mode we have "FCDAPP_18.06" where the number is the FW version */ - else if (strncmp((char *)(aucBufIn+2), "FCDAPP", 6) == 0) { - fcd_mode = FCD_MODE_APP; - } - /* either no FCD or firmware less than 18f */ - else { - fcd_mode = FCD_MODE_NONE; - } - } - - return fcd_mode; -} - - -/** \brief Get FCD firmware version as string. - * \param str The returned vesion number as a 0 terminated string (must be pre-allocated) - * \return The current FCD mode. - * \sa FCD_MODE_ENUM - */ -EXTERN FCD_MODE_ENUM fcdGetFwVerStr(char *str) -{ - hid_device *phd=NULL; - unsigned char aucBufIn[65]; - unsigned char aucBufOut[65]; - FCD_MODE_ENUM fcd_mode = FCD_MODE_NONE; - - - phd = fcdOpen(); - - if (phd == NULL) - { - return FCD_MODE_NONE; - } - - /* Send a BL Query Command */ - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_QUERY; - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - fcdClose(phd); - phd = NULL; - - /* first check status bytes then check which mode */ - if (aucBufIn[0]==FCD_CMD_BL_QUERY && aucBufIn[1]==1) { - - /* In bootloader mode we have the string "FCDBL" starting at acBufIn[2] **/ - if (strncmp((char *)(aucBufIn+2), "FCDBL", 5) == 0) { - fcd_mode = FCD_MODE_BL; - } - /* In application mode we have "FCDAPP_18.06" where the number is the FW version */ - else if (strncmp((char *)(aucBufIn+2), "FCDAPP", 6) == 0) { - strncpy(str, (char *)(aucBufIn+9), 5); - str[5] = 0; - fcd_mode = FCD_MODE_APP; - } - /* either no FCD or firmware less than 18f */ - else { - fcd_mode = FCD_MODE_NONE; - } - } - - return fcd_mode; -} - - -/** \brief Get hardware and firmware dependent FCD capabilities. - * \param fcd_caps Pointer to an FCD_CAPS_STRUCT - * \return The current FCD mode. - * - * This function queries the FCD and extracts the hardware and firmware dependent - * capabilities. Currently these capabilities are: - * - Bias T (available since S/N TBD) - * - Cellular block (the certified version of the FCD) - * When the FCD is in application mode, the string returned by the query command is - * (starting at index 2): - * FCDAPP 18.08 Brd 1.0 No blk - * 1.0 means no bias tee, 1.1 means there is a bias tee - * 'No blk' means it is not cellular blocked. - * - * Ref: http://uk.groups.yahoo.com/group/FCDevelopment/message/303 - */ -EXTERN FCD_MODE_ENUM fcdGetCaps(FCD_CAPS_STRUCT *fcd_caps) -{ - hid_device *phd=NULL; - unsigned char aucBufIn[65]; - unsigned char aucBufOut[65]; - FCD_MODE_ENUM fcd_mode = FCD_MODE_NONE; - - /* clear output buffer */ - fcd_caps->hasBiasT = 0; - fcd_caps->hasCellBlock = 0; - - phd = fcdOpen(); - - if (phd == NULL) - { - return FCD_MODE_NONE; - } - - /* Send a BL Query Command */ - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_QUERY; - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - fcdClose(phd); - phd = NULL; - - /* first check status bytes then check which mode */ - if (aucBufIn[0]==FCD_CMD_BL_QUERY && aucBufIn[1]==1) { - - /* In bootloader mode we have the string "FCDBL" starting at acBufIn[2] **/ - if (strncmp((char *)(aucBufIn+2), "FCDBL", 5) == 0) { - fcd_mode = FCD_MODE_BL; - } - /* In application mode we have "FCDAPP 18.08 Brd 1.0 No blk" (see API doc) */ - else if (strncmp((char *)(aucBufIn+2), "FCDAPP", 6) == 0) { - - /* Bias T */ - fcd_caps->hasBiasT = (aucBufIn[21] == '1') ? 1 : 0; - - /* cellular block */ - if (strncmp((char *)(aucBufIn+23), "No blk", 6) == 0) { - fcd_caps->hasCellBlock = 0; - } else { - fcd_caps->hasCellBlock = 1; - } - - fcd_mode = FCD_MODE_APP; - } - /* either no FCD or firmware less than 18f */ - else { - fcd_mode = FCD_MODE_NONE; - } - } - - return fcd_mode; -} - - -/** \brief Get hardware and firmware dependent FCD capabilities as string. - * \param caps_str Pointer to a pre-allocated string buffer where the info will be copied. - * \return The current FCD mode. - * - * This function queries the FCD and copies the returned string into the caps_str parameter. - * THe return buffer must be at least 28 characters. - * When the FCD is in application mode, the string returned by the query command is - * (starting at index 2): - * FCDAPP 18.08 Brd 1.0 No blk - * 1.0 means no bias tee, 1.1 means there is a bias tee - * 'No blk' means it is not cellular blocked. - * - * Ref: http://uk.groups.yahoo.com/group/FCDevelopment/message/303 - */ -EXTERN FCD_MODE_ENUM fcdGetCapsStr(char *caps_str) -{ - hid_device *phd=NULL; - unsigned char aucBufIn[65]; - unsigned char aucBufOut[65]; - FCD_MODE_ENUM fcd_mode = FCD_MODE_NONE; - - - phd = fcdOpen(); - - if (phd == NULL) - { - return FCD_MODE_NONE; - } - - /* Send a BL Query Command */ - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_QUERY; - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - fcdClose(phd); - phd = NULL; - - /* first check status bytes then check which mode */ - if (aucBufIn[0]==FCD_CMD_BL_QUERY && aucBufIn[1]==1) { - - /* In bootloader mode we have the string "FCDBL" starting at acBufIn[2] **/ - if (strncmp((char *)(aucBufIn+2), "FCDBL", 5) == 0) { - fcd_mode = FCD_MODE_BL; - } - /* In application mode we have "FCDAPP 18.08 Brd 1.0 No blk" (see API doc) */ - else if (strncmp((char *)(aucBufIn+2), "FCDAPP", 6) == 0) { - - strncpy(caps_str, (char *)(aucBufIn+2), 27); - caps_str[27] = 0; - - fcd_mode = FCD_MODE_APP; - } - /* either no FCD or firmware less than 18f */ - else { - fcd_mode = FCD_MODE_NONE; - } - } - - return fcd_mode; -} - - - -/** \brief Reset FCD to bootloader mode. - * \return FCD_MODE_NONE - * - * This function is used to switch the FCD into bootloader mode in which - * various firmware operations can be performed. - */ -EXTERN FCD_MODE_ENUM fcdAppReset(void) -{ - hid_device *phd=NULL; - //unsigned char aucBufIn[65]; - unsigned char aucBufOut[65]; - - phd = fcdOpen(); - - if (phd == NULL) - { - return FCD_MODE_NONE; - } - - // Send an App reset command - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_APP_RESET; - hid_write(phd, aucBufOut, 65); - - /** FIXME: hid_read() will occasionally hang due to a pthread_cond_wait() never returning. - It seems that the read_callback() in hid-libusb.c will never receive any - data during the reconfiguration. Since the same logic works in the native - windows application, it could be a libusb thing. Anyhow, since the value - returned by this function is not used, we may as well just skip the hid_read() - and return FME_NONE. - Correct switch from APP to BL mode can be observed in /var/log/messages (linux) - (when in bootloader mode the device version includes 'BL') - */ - /* - memset(aucBufIn,0xCC,65); // Clear out the response buffer - hid_read(phd,aucBufIn,65); - - if (aucBufIn[0]==FCDCMDAPPRESET && aucBufIn[1]==1) - { - FCDClose(phd); - phd=NULL; - return FME_APP; - } - FCDClose(phd); - phd=NULL; - return FME_BL; - */ - - fcdClose(phd); - phd = NULL; - - return FCD_MODE_NONE; - -} - - -/** \brief Set FCD frequency with kHz resolution. - * \param nFreq The new frequency in kHz. - * \return The FCD mode. - * - * This function sets the frequency of the FCD with 1 kHz resolution. The parameter - * nFreq must already contain any necessary frequency correction. - * - * \sa fcdAppSetFreq - */ -EXTERN FCD_MODE_ENUM fcdAppSetFreqkHz(int nFreq) -{ - hid_device *phd=NULL; - unsigned char aucBufIn[65]; - unsigned char aucBufOut[65]; - - phd = fcdOpen(); - - if (phd == NULL) - { - return FCD_MODE_NONE; - } - - // Send an App reset command - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_APP_SET_FREQ_KHZ; - aucBufOut[2] = (unsigned char)nFreq; - aucBufOut[3] = (unsigned char)(nFreq>>8); - aucBufOut[4] = (unsigned char)(nFreq>>16); - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - if (aucBufIn[0]==FCD_CMD_APP_SET_FREQ_KHZ && aucBufIn[1]==1) - { - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; - } - - fcdClose(phd); - phd = NULL; - - return FCD_MODE_BL; -} - - -/** \brief Set FCD frequency with Hz resolution. - * \param nFreq The new frequency in Hz. - * \return The FCD mode. - * - * This function sets the frequency of the FCD with 1 Hz resolution. The parameter - * nFreq must already contain any necessary frequency correction. - * - * \sa fcdAppSetFreq - */ -EXTERN FCD_MODE_ENUM fcdAppSetFreq(int nFreq) -{ - hid_device *phd=NULL; - unsigned char aucBufIn[65]; - unsigned char aucBufOut[65]; - - phd = fcdOpen(); - - if (phd == NULL) - { - return FCD_MODE_NONE; - } - - // Send an App reset command - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_APP_SET_FREQ_HZ; - aucBufOut[2] = (unsigned char)nFreq; - aucBufOut[3] = (unsigned char)(nFreq>>8); - aucBufOut[4] = (unsigned char)(nFreq>>16); - aucBufOut[5] = (unsigned char)(nFreq>>24); - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - if (aucBufIn[0]==FCD_CMD_APP_SET_FREQ_HZ && aucBufIn[1]==1) - { - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; - } - - fcdClose(phd); - phd = NULL; - - return FCD_MODE_BL; -} - - - -/** \brief Reset FCD to application mode. - * \return FCD_MODE_NONE - * - * This function is used to switch the FCD from bootloader mode - * into application mode. - */ -EXTERN FCD_MODE_ENUM fcdBlReset(void) -{ - hid_device *phd=NULL; -// unsigned char aucBufIn[65]; - unsigned char aucBufOut[65]; - - phd = fcdOpen(); - - if (phd == NULL) - { - return FCD_MODE_NONE; - } - - // Send an BL reset command - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_RESET; - hid_write(phd, aucBufOut, 65); - - /** FIXME: hid_read() will hang due to a pthread_cond_wait() never returning. - It seems that the read_callback() in hid-libusb.c will never receive any - data during the reconfiguration. Since the same logic works in the native - windows application, it could be a libusb thing. Anyhow, since the value - returned by this function is not used, we may as well jsut skip the hid_read() - and return FME_NONE. - Correct switch from BL to APP mode can be observed in /var/log/messages (linux) - (when in bootloader mode the device version includes 'BL') - */ - /* - memset(aucBufIn,0xCC,65); // Clear out the response buffer - hid_read(phd,aucBufIn,65); - - if (aucBufIn[0]==FCDCMDBLRESET && aucBufIn[1]==1) - { - FCDClose(phd); - phd=NULL; - return FME_BL; - } - FCDClose(phd); - phd=NULL; - return FME_APP; - */ - - fcdClose(phd); - phd = NULL; - - return FCD_MODE_NONE; - -} - - -/** \brief Erase firmware from FCD. - * \return The FCD mode - * - * This function deletes the firmware from the FCD. This is required - * before writing new firmware into the FCD. - * - * \sa fcdBlWriteFirmware - */ -EXTERN FCD_MODE_ENUM fcdBlErase(void) -{ - hid_device *phd=NULL; - unsigned char aucBufIn[65]; - unsigned char aucBufOut[65]; - - phd = fcdOpen(); - - if (phd == NULL) - { - return FCD_MODE_NONE; - } - - // Send an App reset command - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_ERASE; - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - if (aucBufIn[0]==FCD_CMD_BL_ERASE && aucBufIn[1]==1) - { - fcdClose(phd); - phd = NULL; - - return FCD_MODE_BL; - } - - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; -} - - -/** \brief Write new firmware into the FCD. - * \param pc Pointer to the new firmware data - * \param n64size The number of bytes in the data - * \return The FCD mode - * - * This function is used to upload new firmware into the FCD flash. - * - * \sa fcdBlErase - */ -EXTERN FCD_MODE_ENUM fcdBlWriteFirmware(char *pc, int64_t n64Size) -{ - hid_device *phd=NULL; - unsigned char aucBufIn[65]; - unsigned char aucBufOut[65]; - uint32_t u32AddrStart; - uint32_t u32AddrEnd; - uint32_t u32Addr; - BOOL bFinished=FALSE; - - phd = fcdOpen(); - - if (phd==NULL) - { - return FCD_MODE_NONE; - } - - // Get the valid flash address range - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_GET_BYTE_ADDR_RANGE; - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - if (aucBufIn[0]!=FCD_CMD_BL_GET_BYTE_ADDR_RANGE || aucBufIn[1]!=1) - { - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; - } - - u32AddrStart= - aucBufIn[2]+ - (((uint32_t)aucBufIn[3])<<8)+ - (((uint32_t)aucBufIn[4])<<16)+ - (((uint32_t)aucBufIn[5])<<24); - u32AddrEnd= - aucBufIn[6]+ - (((uint32_t)aucBufIn[7])<<8)+ - (((uint32_t)aucBufIn[8])<<16)+ - (((uint32_t)aucBufIn[9])<<24); - - // Set start address for flash - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_SET_BYTE_ADDR; - aucBufOut[2] = ((unsigned char)u32AddrStart); - aucBufOut[3] = ((unsigned char)(u32AddrStart>>8)); - aucBufOut[4] = ((unsigned char)(u32AddrStart>>16)); - aucBufOut[5] = ((unsigned char)(u32AddrStart>>24)); - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - if (aucBufIn[0]!=FCD_CMD_BL_SET_BYTE_ADDR || aucBufIn[1]!=1) - { - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; - } - - // Write blocks - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_WRITE_FLASH_BLOCK; - for (u32Addr=u32AddrStart; u32Addr+47<u32AddrEnd && u32Addr+47<n64Size && !bFinished; u32Addr+=48) - { - memcpy(&aucBufOut[3], &pc[u32Addr], 48); - - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - if (aucBufIn[0]!=FCD_CMD_BL_WRITE_FLASH_BLOCK || aucBufIn[1]!=1) - { - bFinished = TRUE; - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; - } - } - - fcdClose(phd); - phd = NULL; - - return FCD_MODE_BL; -} - - -/** \brief Verify firmware in FCd flash. - * \param pc Pointer to firmware data to verify against. - * \param n64Size Size of the data in pc. - * \return The FCD_MODE_BL if verification was succesful. - * - * This function verifies the firmware currently in the FCd flash against the firmware - * image pointed to by pc. The function return FCD_MODE_BL if the verification is OK and - * FCD_MODE_APP otherwise. - */ -EXTERN FCD_MODE_ENUM fcdBlVerifyFirmware(char *pc, int64_t n64Size) -{ - hid_device *phd=NULL; - unsigned char aucBufIn[65]; - unsigned char aucBufOut[65]; - uint32_t u32AddrStart; - uint32_t u32AddrEnd; - uint32_t u32Addr; - BOOL bFinished=FALSE; - - phd = fcdOpen(); - - if (phd==NULL) - { - return FCD_MODE_NONE; - } - - // Get the valid flash address range - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_GET_BYTE_ADDR_RANGE; - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - if (aucBufIn[0]!=FCD_CMD_BL_GET_BYTE_ADDR_RANGE || aucBufIn[1]!=1) - { - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; - } - - u32AddrStart= - aucBufIn[2]+ - (((uint32_t)aucBufIn[3])<<8)+ - (((uint32_t)aucBufIn[4])<<16)+ - (((uint32_t)aucBufIn[5])<<24); - - u32AddrEnd= - aucBufIn[6]+ - (((uint32_t)aucBufIn[7])<<8)+ - (((uint32_t)aucBufIn[8])<<16)+ - (((uint32_t)aucBufIn[9])<<24); - - // Set start address for flash - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_SET_BYTE_ADDR; - aucBufOut[2] = ((unsigned char)u32AddrStart); - aucBufOut[3] = ((unsigned char)(u32AddrStart>>8)); - aucBufOut[4] = ((unsigned char)(u32AddrStart>>16)); - aucBufOut[5] = ((unsigned char)(u32AddrStart>>24)); - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - if (aucBufIn[0]!=FCD_CMD_BL_SET_BYTE_ADDR || aucBufIn[1]!=1) - { - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; - } - - // Read blocks - aucBufOut[0] = 0; // Report ID, ignored - aucBufOut[1] = FCD_CMD_BL_READ_FLASH_BLOCK; - for (u32Addr=u32AddrStart; u32Addr+47<u32AddrEnd && u32Addr+47<n64Size && !bFinished; u32Addr+=48) - { - hid_write(phd, aucBufOut, 65); - memset(aucBufIn, 0xCC, 65); // Clear out the response buffer - hid_read(phd, aucBufIn, 65); - - if (aucBufIn[0]!=FCD_CMD_BL_READ_FLASH_BLOCK || aucBufIn[1]!=1) - { - bFinished = TRUE; - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; - } - - if (memcmp(&aucBufIn[2],&pc[u32Addr],48)!=0) - { - bFinished = TRUE; - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; - } - } - - fcdClose(phd); - phd = NULL; - - return FCD_MODE_BL; -} - - - -/** \brief Write FCD parameter (e.g. gain or filter) - * \param u8Cmd The command byte / parameter ID, see FCD_CMD_APP_SET_* - * \param pu8Data The parameter value to be written - * \param u8len Length of pu8Data in bytes - * \return One of FCD_MODE_NONE, FCD_MODE_APP or FCD_MODE_BL (see description) - * - * This function can be used to set the value of a parameter in the FCD for which there is no - * high level API call. It gives access to the low level API of the FCD and the caller is expected - * to be aware of the various FCD commands, since they are required to be supplied as parameter - * to this function. - * - * The return value can be used to determine the success or failure of the command execution: - * - FCD_MODE_APP : Reply from FCD was as expected (nominal case). - * - FCD_MODE_BL : Reply from FCD was not as expected. - * - FCD_MODE_NONE : No FCD was found - */ -EXTERN FCD_MODE_ENUM fcdAppSetParam(uint8_t u8Cmd, uint8_t *pu8Data, uint8_t u8len) -{ - hid_device *phd=NULL; - unsigned char aucBufOut[65]; - unsigned char aucBufIn[65]; - - - phd = fcdOpen(); - - if (phd == NULL) - { - return FCD_MODE_NONE; - } - - aucBufOut[0]=0; // Report ID, ignored - aucBufOut[1]=u8Cmd; - memcpy(aucBufOut+2, pu8Data,u8len); - hid_write(phd,aucBufOut,65); - - /* we must read after each write in order to empty FCD/HID buffer */ - memset(aucBufIn,0xCC,65); // Clear out the response buffer - hid_read(phd,aucBufIn,65); - - /* Check the response, if OK return FCD_MODE_APP */ - if (aucBufIn[0]==u8Cmd && aucBufIn[1]==1) { - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; - } - - /* Response did not contain the expected bytes */ - fcdClose(phd); - phd = NULL; - - return FCD_MODE_BL; - -} - - -/** \brief Read FCD parameter (e.g. gain or filter) - * \param u8Cmd The command byte / parameter ID, see FCD_CMD_APP_GET_* - * \param pu8Data TPointer to buffer where the parameter value(s) will be written - * \param u8len Length of pu8Data in bytes - * \return One of FCD_MODE_NONE, FCD_MODE_APP or FCD_MODE_BL (see description) - * - * This function can be used to read the value of a parameter in the FCD for which there is no - * high level API call. It gives access to the low level API of the FCD and the caller is expected - * to be aware of the various FCD commands, since they are required to be supplied as parameter - * to this function. - * - * The return value can be used to determine the success or failure of the command execution: - * - FCD_MODE_APP : Reply from FCD was as expected (nominal case). - * - FCD_MODE_BL : Reply from FCD was not as expected. - * - FCD_MODE_NONE : No FCD was found - */ -EXTERN FCD_MODE_ENUM fcdAppGetParam(uint8_t u8Cmd, uint8_t *pu8Data, uint8_t u8len) -{ - hid_device *phd=NULL; - unsigned char aucBufOut[65]; - unsigned char aucBufIn[65]; - - phd = fcdOpen(); - if (phd == NULL) - { - return FCD_MODE_NONE; - } - - aucBufOut[0]=0; // Report ID, ignored - aucBufOut[1]=u8Cmd; - hid_write(phd,aucBufOut,65); - - memset(aucBufIn,0xCC,65); // Clear out the response buffer - hid_read(phd,aucBufIn,65); - /* Copy return data to output buffer (even if cmd exec failed) */ - memcpy(pu8Data,aucBufIn+2,u8len); - - /* Check status bytes in returned data */ - if (aucBufIn[0]==u8Cmd && aucBufIn[1]==1) { - fcdClose(phd); - phd = NULL; - - return FCD_MODE_APP; - } - - /* Response did not contain the expected bytes */ - fcdClose(phd); - phd = NULL; - - return FCD_MODE_BL; -} - diff --git a/gr-fcd/lib/fcd/fcd.h b/gr-fcd/lib/fcd/fcd.h deleted file mode 100644 index 7cfe9b7ed..000000000 --- a/gr-fcd/lib/fcd/fcd.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - * This file is part of Qthid. - * - * Copyright (C) 2010 Howard Long, G6LVB - * CopyRight (C) 2011 Alexandru Csete, OZ9AEC - * Mario Lorenz, DL5MLO - * - * Qthid 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. - * - * Qthid 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 Qthid. If not, see <http://www.gnu.org/licenses/>. - * - ***************************************************************************/ - -#ifndef FCD_H -#define FCD_H 1 - -#include <fcd_api.h> - -#ifdef FCD -#define EXTERN -#define ASSIGN (x) =x -#else -#define EXTERN extern -#define ASSIGN(x) -#endif - -#include <inttypes.h> - -/** \brief FCD mode enumeration. */ -typedef enum { - FCD_MODE_NONE, /*!< No FCD detected. */ - FCD_MODE_BL, /*!< FCD present in bootloader mode. */ - FCD_MODE_APP /*!< FCD present in aplpication mode. */ -} FCD_MODE_ENUM; // The current mode of the FCD: none inserted, in bootloader mode or in normal application mode - -/** \brief FCD capabilities that depend on both hardware and firmware. */ -typedef struct { - unsigned char hasBiasT; /*!< Whether FCD has hardware bias tee (1=yes, 0=no) */ - unsigned char hasCellBlock; /*!< Whether FCD has cellular blocking. */ -} FCD_CAPS_STRUCT; - -#ifdef __cplusplus -extern "C" { -#endif - -/* Application functions */ -EXTERN FCD_API FCD_MODE_ENUM fcdGetMode(void); -EXTERN FCD_API FCD_MODE_ENUM fcdGetFwVerStr(char *str); -EXTERN FCD_API FCD_MODE_ENUM fcdGetCaps(FCD_CAPS_STRUCT *fcd_caps); -EXTERN FCD_API FCD_MODE_ENUM fcdGetCapsStr(char *caps_str); -EXTERN FCD_API FCD_MODE_ENUM fcdAppReset(void); -EXTERN FCD_API FCD_MODE_ENUM fcdAppSetFreqkHz(int nFreq); -EXTERN FCD_API FCD_MODE_ENUM fcdAppSetFreq(int nFreq); - -EXTERN FCD_API FCD_MODE_ENUM fcdAppSetParam(uint8_t u8Cmd, uint8_t *pu8Data, uint8_t u8len); -EXTERN FCD_API FCD_MODE_ENUM fcdAppGetParam(uint8_t u8Cmd, uint8_t *pu8Data, uint8_t u8len); - - -/* Bootloader functions */ -EXTERN FCD_API FCD_MODE_ENUM fcdBlReset(void); -EXTERN FCD_API FCD_MODE_ENUM fcdBlErase(void); -EXTERN FCD_API FCD_MODE_ENUM fcdBlWriteFirmware(char *pc, int64_t n64Size); -EXTERN FCD_API FCD_MODE_ENUM fcdBlVerifyFirmware(char *pc, int64_t n64Size); - - -#ifdef __cplusplus -} -#endif - -#endif // FCD_H diff --git a/gr-fcd/lib/fcd/fcdhidcmd.h b/gr-fcd/lib/fcd/fcdhidcmd.h deleted file mode 100644 index 1741ede30..000000000 --- a/gr-fcd/lib/fcd/fcdhidcmd.h +++ /dev/null @@ -1,305 +0,0 @@ -/*************************************************************************** - * This file is part of Qthid. - * - * Copyright (C) 2010 Howard Long, G6LVB - * CopyRight (C) 2011 Alexandru Csete, OZ9AEC - * Mario Lorenz, DL5MLO - * - * Qthid 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. - * - * Qthid 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 Qthid. If not, see <http://www.gnu.org/licenses/>. - * - ***************************************************************************/ -#ifndef FCDHIDCMD_H -#define FCD_HID_CMD_H 1 - - -/* Commands applicable in bootloader mode */ -#define FCD_CMD_BL_QUERY 1 /*!< Returns string with "FCDAPP version". */ -#define FCD_CMD_BL_RESET 8 /*!< Reset to application mode. */ -#define FCD_CMD_BL_ERASE 24 /*!< Erase firmware from FCD flash. */ -#define FCD_CMD_BL_SET_BYTE_ADDR 25 /*!< TBD */ -#define FCD_CMD_BL_GET_BYTE_ADDR_RANGE 26 /*!< Get address range. */ -#define FCD_CMD_BL_WRITE_FLASH_BLOCK 27 /*!< Write flash block. */ -#define FCD_CMD_BL_READ_FLASH_BLOCK 28 /*!< Read flash block. */ - -/* Commands applicable in application mode */ -#define FCD_CMD_APP_SET_FREQ_KHZ 100 /*!< Send with 3 byte unsigned little endian frequency in kHz. */ -#define FCD_CMD_APP_SET_FREQ_HZ 101 /*!< Send with 4 byte unsigned little endian frequency in Hz, returns with actual frequency set in Hz */ -#define FCD_CMD_APP_GET_FREQ_HZ 102 /*!< Returns 4 byte unsigned little endian frequency in Hz. */ - -#define FCD_CMD_APP_GET_IF_RSSI 104 /*!< Supposed to return 1 byte unsigned IF RSSI (-35dBm=0, -10dBm=70) but it is not functional. */ -#define FCD_CMD_APP_GET_PLL_LOCK 105 /*!< Returns 1 bit, true if locked. */ - -#define FCD_CMD_APP_SET_DC_CORR 106 /*!< Send with 2 byte unsigned I DC correction followed by 2 byte unsigned Q DC correction. 32768 is the default centre value. */ -#define FCD_CMD_APP_GET_DC_CORR 107 /*!< Returns 2 byte unsigned I DC correction followed by 2 byte unsigned Q DC correction. 32768 is the default centre value. */ -#define FCD_CMD_APP_SET_IQ_CORR 108 /*!< Send with 2 byte signed phase correction followed by 2 byte unsigned gain correction. 0 is the default centre value for phase correction, 32768 is the default centre value for gain. */ -#define FCD_CMD_APP_GET_IQ_CORR 109 /*!< Returns 2 byte signed phase correction followed by 2 byte unsigned gain correction. 0 is the default centre value for phase correction, 32768 is the default centre value for gain. */ - -#define FCD_CMD_APP_SET_LNA_GAIN 110 /*!< Send a 1 byte value, see enums for reference. */ -#define FCD_CMD_APP_SET_LNA_ENHANCE 111 -#define FCD_CMD_APP_SET_BAND 112 -#define FCD_CMD_APP_SET_RF_FILTER 113 -#define FCD_CMD_APP_SET_MIXER_GAIN 114 -#define FCD_CMD_APP_SET_BIAS_CURRENT 115 -#define FCD_CMD_APP_SET_MIXER_FILTER 116 -#define FCD_CMD_APP_SET_IF_GAIN1 117 -#define FCD_CMD_APP_SET_IF_GAIN_MODE 118 -#define FCD_CMD_APP_SET_IF_RC_FILTER 119 -#define FCD_CMD_APP_SET_IF_GAIN2 120 -#define FCD_CMD_APP_SET_IF_GAIN3 121 -#define FCD_CMD_APP_SET_IF_FILTER 122 -#define FCD_CMD_APP_SET_IF_GAIN4 123 -#define FCD_CMD_APP_SET_IF_GAIN5 124 -#define FCD_CMD_APP_SET_IF_GAIN6 125 -#define FCD_CMD_APP_SET_BIAS_TEE 126 /*!< Bias T for ext LNA. Send with one byte: 1=ON, 0=OFF. */ - -#define FCD_CMD_APP_GET_LNA_GAIN 150 // Retrieve a 1 byte value, see enums for reference -#define FCD_CMD_APP_GET_LNA_ENHANCE 151 -#define FCD_CMD_APP_GET_BAND 152 -#define FCD_CMD_APP_GET_RF_FILTER 153 -#define FCD_CMD_APP_GET_MIXER_GAIN 154 -#define FCD_CMD_APP_GET_BIAS_CURRENT 155 -#define FCD_CMD_APP_GET_MIXER_FILTER 156 -#define FCD_CMD_APP_GET_IF_GAIN1 157 -#define FCD_CMD_APP_GET_IF_GAIN_MODE 158 -#define FCD_CMD_APP_GET_IF_RC_FILTER 159 -#define FCD_CMD_APP_GET_IF_GAIN2 160 -#define FCD_CMD_APP_GET_IF_GAIN3 161 -#define FCD_CMD_APP_GET_IF_FILTER 162 -#define FCD_CMD_APP_GET_IF_GAIN4 163 -#define FCD_CMD_APP_GET_IF_GAIN5 164 -#define FCD_CMD_APP_GET_IF_GAIN6 165 -#define FCD_CMD_APP_GET_BIAS_TEE 166 /*!< Bias T. 1=ON, 0=OFF. */ - -#define FCD_CMD_APP_SEND_I2C_BYTE 200 -#define FCD_CMD_APP_RECV_I2C_BYTE 201 - -#define FCD_CMD_APP_RESET 255 // Reset to bootloader - - -typedef enum -{ - TLGE_N5_0DB=0, - TLGE_N2_5DB=1, - TLGE_P0_0DB=4, - TLGE_P2_5DB=5, - TLGE_P5_0DB=6, - TLGE_P7_5DB=7, - TLGE_P10_0DB=8, - TLGE_P12_5DB=9, - TLGE_P15_0DB=10, - TLGE_P17_5DB=11, - TLGE_P20_0DB=12, - TLGE_P25_0DB=13, - TLGE_P30_0DB=14 -} TUNER_LNA_GAIN_ENUM; - -typedef enum -{ - TLEE_OFF=0, - TLEE_0=1, - TLEE_1=3, - TLEE_2=5, - TLEE_3=7 -} TUNER_LNA_ENHANCE_ENUM; - -typedef enum -{ - TBE_VHF2, - TBE_VHF3, - TBE_UHF, - TBE_LBAND -} TUNER_BAND_ENUM; - -typedef enum -{ - // Band 0, VHF II - TRFE_LPF268MHZ=0, - TRFE_LPF299MHZ=8, - // Band 1, VHF III - TRFE_LPF509MHZ=0, - TRFE_LPF656MHZ=8, - // Band 2, UHF - TRFE_BPF360MHZ=0, - TRFE_BPF380MHZ=1, - TRFE_BPF405MHZ=2, - TRFE_BPF425MHZ=3, - TRFE_BPF450MHZ=4, - TRFE_BPF475MHZ=5, - TRFE_BPF505MHZ=6, - TRFE_BPF540MHZ=7, - TRFE_BPF575MHZ=8, - TRFE_BPF615MHZ=9, - TRFE_BPF670MHZ=10, - TRFE_BPF720MHZ=11, - TRFE_BPF760MHZ=12, - TRFE_BPF840MHZ=13, - TRFE_BPF890MHZ=14, - TRFE_BPF970MHZ=15, - // Band 2, L band - TRFE_BPF1300MHZ=0, - TRFE_BPF1320MHZ=1, - TRFE_BPF1360MHZ=2, - TRFE_BPF1410MHZ=3, - TRFE_BPF1445MHZ=4, - TRFE_BPF1460MHZ=5, - TRFE_BPF1490MHZ=6, - TRFE_BPF1530MHZ=7, - TRFE_BPF1560MHZ=8, - TRFE_BPF1590MHZ=9, - TRFE_BPF1640MHZ=10, - TRFE_BPF1660MHZ=11, - TRFE_BPF1680MHZ=12, - TRFE_BPF1700MHZ=13, - TRFE_BPF1720MHZ=14, - TRFE_BPF1750MHZ=15 -} TUNER_RF_FILTER_ENUM; - -typedef enum -{ - TMGE_P4_0DB=0, - TMGE_P12_0DB=1 -} TUNER_MIXER_GAIN_ENUM; - -typedef enum -{ - TBCE_LBAND=0, - TBCE_1=1, - TBCE_2=2, - TBCE_VUBAND=3 -} TUNER_BIAS_CURRENT_ENUM; - -typedef enum -{ - TMFE_27_0MHZ=0, - TMFE_4_6MHZ=8, - TMFE_4_2MHZ=9, - TMFE_3_8MHZ=10, - TMFE_3_4MHZ=11, - TMFE_3_0MHZ=12, - TMFE_2_7MHZ=13, - TMFE_2_3MHZ=14, - TMFE_1_9MHZ=15 -} TUNER_MIXER_FILTER_ENUM; - -typedef enum -{ - TIG1E_N3_0DB=0, - TIG1E_P6_0DB=1 -} TUNER_IF_GAIN1_ENUM; - -typedef enum -{ - TIGME_LINEARITY=0, - TIGME_SENSITIVITY=1 -} TUNER_IF_GAIN_MODE_ENUM; - -typedef enum -{ - TIRFE_21_4MHZ=0, - TIRFE_21_0MHZ=1, - TIRFE_17_6MHZ=2, - TIRFE_14_7MHZ=3, - TIRFE_12_4MHZ=4, - TIRFE_10_6MHZ=5, - TIRFE_9_0MHZ=6, - TIRFE_7_7MHZ=7, - TIRFE_6_4MHZ=8, - TIRFE_5_3MHZ=9, - TIRFE_4_4MHZ=10, - TIRFE_3_4MHZ=11, - TIRFE_2_6MHZ=12, - TIRFE_1_8MHZ=13, - TIRFE_1_2MHZ=14, - TIRFE_1_0MHZ=15 -} TUNER_IF_RC_FILTER_ENUM; - -typedef enum -{ - TIG2E_P0_0DB=0, - TIG2E_P3_0DB=1, - TIG2E_P6_0DB=2, - TIG2E_P9_0DB=3 -} TUNER_IF_GAIN2_ENUM; - -typedef enum -{ - TIG3E_P0_0DB=0, - TIG3E_P3_0DB=1, - TIG3E_P6_0DB=2, - TIG3E_P9_0DB=3 -} TUNER_IF_GAIN3_ENUM; - -typedef enum -{ - TIG4E_P0_0DB=0, - TIG4E_P1_0DB=1, - TIG4E_P2_0DB=2 -} TUNER_IF_GAIN4_ENUM; - -typedef enum -{ - TIFE_5_50MHZ=0, - TIFE_5_30MHZ=1, - TIFE_5_00MHZ=2, - TIFE_4_80MHZ=3, - TIFE_4_60MHZ=4, - TIFE_4_40MHZ=5, - TIFE_4_30MHZ=6, - TIFE_4_10MHZ=7, - TIFE_3_90MHZ=8, - TIFE_3_80MHZ=9, - TIFE_3_70MHZ=10, - TIFE_3_60MHZ=11, - TIFE_3_40MHZ=12, - TIFE_3_30MHZ=13, - TIFE_3_20MHZ=14, - TIFE_3_10MHZ=15, - TIFE_3_00MHZ=16, - TIFE_2_95MHZ=17, - TIFE_2_90MHZ=18, - TIFE_2_80MHZ=19, - TIFE_2_75MHZ=20, - TIFE_2_70MHZ=21, - TIFE_2_60MHZ=22, - TIFE_2_55MHZ=23, - TIFE_2_50MHZ=24, - TIFE_2_45MHZ=25, - TIFE_2_40MHZ=26, - TIFE_2_30MHZ=27, - TIFE_2_28MHZ=28, - TIFE_2_24MHZ=29, - TIFE_2_20MHZ=30, - TIFE_2_15MHZ=31 -} TUNER_IF_FILTER_ENUM; - -typedef enum -{ - TIG5E_P3_0DB=0, - TIG5E_P6_0DB=1, - TIG5E_P9_0DB=2, - TIG5E_P12_0DB=3, - TIG5E_P15_0DB=4 -} TUNER_IF_GAIN5_ENUM; - -typedef enum -{ - TIG6E_P3_0DB=0, - TIG6E_P6_0DB=1, - TIG6E_P9_0DB=2, - TIG6E_P12_0DB=3, - TIG6E_P15_0DB=4 -} TUNER_IF_GAIN6_ENUM; - - -#endif // FCDHIDCMD_H diff --git a/gr-fcd/lib/fcd_source_c_impl.cc b/gr-fcd/lib/fcd_source_c_impl.cc deleted file mode 100644 index 81ccee092..000000000 --- a/gr-fcd/lib/fcd_source_c_impl.cc +++ /dev/null @@ -1,238 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011-2012 Free Software Foundation, Inc. - * - * 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 <fcd_source_c_impl.h> -#include <fcd.h> -#include <fcdhidcmd.h> // needed for extended API -#include <gr_io_signature.h> -#include <gr_float_to_complex.h> -#include <gruel/attributes.h> - -//#include <iostream> -//using namespace std; - -/* - * Create a new instance of fcd_source_c_impl and return - * an upcasted boost shared_ptr. This is effectively the public constructor. - */ -fcd_source_c_sptr fcd_make_source_c(const std::string device_name) -{ - return gnuradio::get_initial_sptr(new fcd_source_c_impl(device_name)); -} - -static const int MIN_IN = 0; /*!< Mininum number of input streams. */ -static const int MAX_IN = 0; /*!< Maximum number of input streams. */ -static const int MIN_OUT = 1; /*!< Minimum number of output streams. */ -static const int MAX_OUT = 1; /*!< Maximum number of output streams. */ - -fcd_source_c_impl::fcd_source_c_impl(const std::string device_name) - : gr_hier_block2 ("fcd_source_c", - gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)), - gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (gr_complex))), - d_freq_corr(-120), - d_freq_req(0) -{ - gr_float_to_complex_sptr f2c; - - /* Audio source; sample rate fixed at 96kHz */ - fcd = audio_make_source(96000, device_name, true); - - /* block to convert stereo audio to a complex stream */ - f2c = gr_make_float_to_complex(1); - - connect(fcd, 0, f2c, 0); - connect(fcd, 1, f2c, 1); - connect(f2c, 0, self(), 0); -} - -// Set frequency with Hz resolution -void fcd_source_c_impl::set_freq(int freq) -{ - FCD_MODE_ENUM __GR_ATTR_UNUSED fme; - double f = (double)freq; - - /* valid range 50 MHz - 2.0 GHz */ - if ((freq < 50000000) || (freq > 2000000000)) { - return; - } - - d_freq_req = freq; - f *= 1.0 + d_freq_corr/1000000.0; - - fme = fcdAppSetFreq((int)f); - /* TODO: check fme */ -} - -// Set frequency with Hz resolution (type float) -void fcd_source_c_impl::set_freq(float freq) -{ - FCD_MODE_ENUM __GR_ATTR_UNUSED fme; - double f = (double)freq; - - /* valid range 50 MHz - 2.0 GHz */ - if ((freq < 50.0e6) || (freq > 2.0e9)) { - return; - } - - d_freq_req = (int)freq; - f *= 1.0 + d_freq_corr/1000000.0; - - fme = fcdAppSetFreq((int)f); - /* TODO: check fme */ -} - - -// Set frequency with kHz resolution. -void fcd_source_c_impl::set_freq_khz(int freq) -{ - FCD_MODE_ENUM __GR_ATTR_UNUSED fme; - double f = freq*1000.0; - - /* valid range 50 MHz - 2.0 GHz */ - if ((freq < 50000) || (freq > 2000000)) { - return; - } - - d_freq_req = freq*1000; - f *= 1.0 + d_freq_corr/1000000.0; - - fme = fcdAppSetFreqkHz((int)(f/1000.0)); - /* TODO: check fme */ -} - - -// Set LNA gain -void fcd_source_c_impl::set_lna_gain(float gain) -{ - FCD_MODE_ENUM __GR_ATTR_UNUSED fme; - unsigned char g; - - /* convert to nearest discrete value */ - if (gain > 27.5) { - g = 14; // 30.0 dB - } - else if (gain > 22.5) { - g = 13; // 25.0 dB - } - else if (gain > 18.75) { - g = 12; // 20.0 dB - } - else if (gain > 16.25) { - g = 11; // 17.5 dB - } - else if (gain > 13.75) { - g = 10; // 15.0 dB - } - else if (gain > 11.25) { - g = 9; // 12.5 dB - } - else if (gain > 8.75) { - g = 8; // 10.0 dB - } - else if (gain > 6.25) { - g = 7; // 7.5 dB - } - else if (gain > 3.75) { - g = 6; // 5.0 dB - } - else if (gain > 1.25) { - g = 5; // 2.5 dB - } - else if (gain > -1.25) { - g = 4; // 0.0 dB - } - else if (gain > -3.75) { - g = 1; // -2.5 dB - } - else { - g = 0; // -5.0 dB - } - - fme = fcdAppSetParam(FCD_CMD_APP_SET_LNA_GAIN, &g, 1); - /* TODO: check fme */ -} - -// Set mixer gain -void fcd_source_c_impl::set_mixer_gain(float gain) -{ - __GR_ATTR_UNUSED FCD_MODE_ENUM fme; - unsigned char g; - - if ( gain > 4.0 ) { - g = TMGE_P12_0DB; - } else { - g = TMGE_P4_0DB; - } - - fme = fcdAppSetParam(FCD_CMD_APP_SET_MIXER_GAIN, &g, 1); - /* TODO: check fme */ -} - -// Set new frequency correction -void fcd_source_c_impl::set_freq_corr(int ppm) -{ - d_freq_corr = ppm; - // re-tune with new correction value - set_freq(d_freq_req); -} - -// Set DC offset correction. -void fcd_source_c_impl::set_dc_corr(double _dci, double _dcq) -{ - union { - unsigned char auc[4]; - struct { - signed short dci; // equivalent of qint16 which should be 16 bit everywhere - signed short dcq; - }; - } dcinfo; - - if ((_dci < -1.0) || (_dci > 1.0) || (_dcq < -1.0) || (_dcq > 1.0)) - return; - - dcinfo.dci = static_cast<signed short>(_dci*32768.0); - dcinfo.dcq = static_cast<signed short>(_dcq*32768.0); - - fcdAppSetParam(FCD_CMD_APP_SET_DC_CORR, dcinfo.auc, 4); -} - -// Set IQ phase and gain balance. -void fcd_source_c_impl::set_iq_corr(double _gain, double _phase) -{ - union { - unsigned char auc[4]; - struct { - signed short phase; - signed short gain; - }; - } iqinfo; - - if ((_gain < -1.0) || (_gain > 1.0) || (_phase < -1.0) || (_phase > 1.0)) - return; - - iqinfo.phase = static_cast<signed short>(_phase*32768.0); - iqinfo.gain = static_cast<signed short>(_gain*32768.0); - - fcdAppSetParam(FCD_CMD_APP_SET_IQ_CORR, iqinfo.auc, 4); -} diff --git a/gr-fcd/lib/fcd_source_c_impl.h b/gr-fcd/lib/fcd_source_c_impl.h deleted file mode 100644 index d4ac40417..000000000 --- a/gr-fcd/lib/fcd_source_c_impl.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011-2012 Free Software Foundation, Inc. - * - * 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 INCLUDED_FCD_SOURCE_C_IMPL_H -#define INCLUDED_FCD_SOURCE_C_IMPL_H - -#include <fcd_source_c.h> -#include <gr_audio_source.h> - -class FCD_API fcd_source_c_impl : public fcd_source_c -{ -public: - /* Public API functions documented in include/fcd_source_c.h */ - void set_freq(int freq); - void set_freq(float freq); - void set_freq_khz(int freq); - void set_lna_gain(float gain); - void set_mixer_gain(float gain); - void set_freq_corr(int ppm); - void set_dc_corr(double _dci, double _dcq); - void set_iq_corr(double _gain, double _phase); - -private: - fcd_source_c_impl(const std::string device_name = ""); - friend FCD_API fcd_source_c_sptr - fcd_make_source_c(const std::string device_name); - - audio_source::sptr fcd; /*!< The audio input source */ - int d_freq_corr; /*!< The frequency correction in ppm */ - int d_freq_req; /*!< The latest requested frequency in Hz */ -}; - -#endif /* INCLUDED_FCD_SOURCE_C_IMPL_H */ diff --git a/gr-fcd/lib/hid/CMakeLists.txt b/gr-fcd/lib/hid/CMakeLists.txt deleted file mode 100644 index db335cc93..000000000 --- a/gr-fcd/lib/hid/CMakeLists.txt +++ /dev/null @@ -1,39 +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 file included, use CMake directory variables -######################################################################## - -include_directories(APPEND ${USB_INCLUDES}) - -set(hid_sources) - -if(WIN32) - list(APPEND hid_sources ${CMAKE_CURRENT_SOURCE_DIR}/hidwin.c) -elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - list(APPEND hid_sources ${CMAKE_CURRENT_SOURCE_DIR}/hidmac.c) -else() - list(APPEND hid_sources ${CMAKE_CURRENT_SOURCE_DIR}/hid-libusb.c) -endif() - -######################################################################## -# Append gnuradio-fcd library sources -######################################################################## -list(APPEND gr_fcd_sources ${hid_sources}) diff --git a/gr-fcd/lib/hid/COPYRIGHT b/gr-fcd/lib/hid/COPYRIGHT deleted file mode 100644 index e50305d7c..000000000 --- a/gr-fcd/lib/hid/COPYRIGHT +++ /dev/null @@ -1,25 +0,0 @@ -For convenience, GNU Radio includes the contents of this directory -in its distribution, but they are not considered part of GNU Radio. - -These files are licensed and redistributed using the terms of the -GPLv3. -------------------------------------------------------------------- -HIDAPI - Multi-Platform library for -communication with HID devices. - -Alan Ott -Signal 11 Software - -8/22/2009 - -Copyright 2009, All Rights Reserved. - -At the discretion of the user of this library, -this software may be licensed under the terms of the -GNU Public License v3, a BSD-Style license, or the -original HIDAPI license as outlined in the LICENSE.txt, -LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt -files located at the root of the source distribution. -These files may also be found in the public source -code repository located at: - http://github.com/signal11/hidapi . diff --git a/gr-fcd/lib/hid/hid-libusb.c b/gr-fcd/lib/hid/hid-libusb.c deleted file mode 100644 index 82cbc9151..000000000 --- a/gr-fcd/lib/hid/hid-libusb.c +++ /dev/null @@ -1,1386 +0,0 @@ -/******************************************************* - HIDAPI - Multi-Platform library for - communication with HID devices. - - Alan Ott - Signal 11 Software - - 8/22/2009 - Linux Version - 6/2/2010 - Libusb Version - 8/13/2010 - - Copyright 2009, All Rights Reserved. - - At the discretion of the user of this library, - this software may be licensed under the terms of the - GNU Public License v3, a BSD-Style license, or the - original HIDAPI license as outlined in the LICENSE.txt, - LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt - files located at the root of the source distribution. - These files may also be found in the public source - code repository located at: - http://github.com/signal11/hidapi . -********************************************************/ - -#define _GNU_SOURCE // needed for wcsdup() before glibc 2.10 - -/* C */ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> -#include <locale.h> -#include <errno.h> - -/* Unix */ -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/utsname.h> -#include <fcntl.h> -#include <pthread.h> -#include <wchar.h> - -/* GNU / LibUSB */ -#include "libusb.h" -#include "iconv.h" - -#include "hidapi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef DEBUG_PRINTF -#define LOG(...) fprintf(stderr, __VA_ARGS__) -#else -#define LOG(...) do {} while (0) -#endif - - -/* Uncomment to enable the retrieval of Usage and Usage Page in -hid_enumerate(). Warning, this is very invasive as it requires the detach -and re-attach of the kernel driver. See comments inside hid_enumerate(). -Linux/libusb HIDAPI programs are encouraged to use the interface number -instead to differentiate between interfaces on a composite HID device. */ -/*#define INVASIVE_GET_USAGE*/ - -/* Linked List of input reports received from the device. */ -struct input_report { - uint8_t *data; - size_t len; - struct input_report *next; -}; - - -struct hid_device_ { - /* Handle to the actual device. */ - libusb_device_handle *device_handle; - - /* Endpoint information */ - int input_endpoint; - int output_endpoint; - int input_ep_max_packet_size; - - /* The interface number of the HID */ - int interface; - - /* Indexes of Strings */ - int manufacturer_index; - int product_index; - int serial_index; - - /* Whether blocking reads are used */ - int blocking; /* boolean */ - - /* Read thread objects */ - pthread_t thread; - pthread_mutex_t mutex; /* Protects input_reports */ - pthread_cond_t condition; - pthread_barrier_t barrier; /* Ensures correct startup sequence */ - int shutdown_thread; - struct libusb_transfer *transfer; - - /* List of received input reports. */ - struct input_report *input_reports; -}; - -static int initialized = 0; - -uint16_t get_usb_code_for_current_locale(void); -static int return_data(hid_device *dev, unsigned char *data, size_t length); - -static hid_device *new_hid_device(void) -{ - hid_device *dev = calloc(1, sizeof(hid_device)); - dev->device_handle = NULL; - dev->input_endpoint = 0; - dev->output_endpoint = 0; - dev->input_ep_max_packet_size = 0; - dev->interface = 0; - dev->manufacturer_index = 0; - dev->product_index = 0; - dev->serial_index = 0; - dev->blocking = 1; - dev->shutdown_thread = 0; - dev->transfer = NULL; - dev->input_reports = NULL; - - pthread_mutex_init(&dev->mutex, NULL); - pthread_cond_init(&dev->condition, NULL); - pthread_barrier_init(&dev->barrier, NULL, 2); - - return dev; -} - -static void free_hid_device(hid_device *dev) -{ - /* Clean up the thread objects */ - pthread_barrier_destroy(&dev->barrier); - pthread_cond_destroy(&dev->condition); - pthread_mutex_destroy(&dev->mutex); - - /* Free the device itself */ - free(dev); -} - -#if 0 -//TODO: Implement this funciton on Linux. -static void register_error(hid_device *device, const char *op) -{ - -} -#endif - -#ifdef INVASIVE_GET_USAGE -/* Get bytes from a HID Report Descriptor. - Only call with a num_bytes of 0, 1, 2, or 4. */ -static uint32_t get_bytes(uint8_t *rpt, size_t len, size_t num_bytes, size_t cur) -{ - /* Return if there aren't enough bytes. */ - if (cur + num_bytes >= len) - return 0; - - if (num_bytes == 0) - return 0; - else if (num_bytes == 1) { - return rpt[cur+1]; - } - else if (num_bytes == 2) { - return (rpt[cur+2] * 256 + rpt[cur+1]); - } - else if (num_bytes == 4) { - return (rpt[cur+4] * 0x01000000 + - rpt[cur+3] * 0x00010000 + - rpt[cur+2] * 0x00000100 + - rpt[cur+1] * 0x00000001); - } - else - return 0; -} - -/* Retrieves the device's Usage Page and Usage from the report - descriptor. The algorithm is simple, as it just returns the first - Usage and Usage Page that it finds in the descriptor. - The return value is 0 on success and -1 on failure. */ -static int get_usage(uint8_t *report_descriptor, size_t size, - unsigned short *usage_page, unsigned short *usage) -{ - int i = 0; - int size_code; - int data_len, key_size; - int usage_found = 0, usage_page_found = 0; - - while (i < size) { - int key = report_descriptor[i]; - int key_cmd = key & 0xfc; - - //printf("key: %02hhx\n", key); - - if ((key & 0xf0) == 0xf0) { - /* This is a Long Item. The next byte contains the - length of the data section (value) for this key. - See the HID specification, version 1.11, section - 6.2.2.3, titled "Long Items." */ - if (i+1 < size) - data_len = report_descriptor[i+1]; - else - data_len = 0; /* malformed report */ - key_size = 3; - } - else { - /* This is a Short Item. The bottom two bits of the - key contain the size code for the data section - (value) for this key. Refer to the HID - specification, version 1.11, section 6.2.2.2, - titled "Short Items." */ - size_code = key & 0x3; - switch (size_code) { - case 0: - case 1: - case 2: - data_len = size_code; - break; - case 3: - data_len = 4; - break; - default: - /* Can't ever happen since size_code is & 0x3 */ - data_len = 0; - break; - }; - key_size = 1; - } - - if (key_cmd == 0x4) { - *usage_page = get_bytes(report_descriptor, size, data_len, i); - usage_page_found = 1; - //printf("Usage Page: %x\n", (uint32_t)*usage_page); - } - if (key_cmd == 0x8) { - *usage = get_bytes(report_descriptor, size, data_len, i); - usage_found = 1; - //printf("Usage: %x\n", (uint32_t)*usage); - } - - if (usage_page_found && usage_found) - return 0; /* success */ - - /* Skip over this key and it's associated data */ - i += data_len + key_size; - } - - return -1; /* failure */ -} -#endif // INVASIVE_GET_USAGE - - -/* Get the first language the device says it reports. This comes from - USB string #0. */ -static uint16_t get_first_language(libusb_device_handle *dev) -{ - uint16_t buf[32]; - int len; - - /* Get the string from libusb. */ - len = libusb_get_string_descriptor(dev, - 0x0, /* String ID */ - 0x0, /* Language */ - (unsigned char*)buf, - sizeof(buf)); - if (len < 4) - return 0x0; - - return buf[1]; // First two bytes are len and descriptor type. -} - -static int is_language_supported(libusb_device_handle *dev, uint16_t lang) -{ - uint16_t buf[32]; - int len; - int i; - - /* Get the string from libusb. */ - len = libusb_get_string_descriptor(dev, - 0x0, /* String ID */ - 0x0, /* Language */ - (unsigned char*)buf, - sizeof(buf)); - if (len < 4) - return 0x0; - - - len /= 2; /* language IDs are two-bytes each. */ - /* Start at index 1 because there are two bytes of protocol data. */ - for (i = 1; i < len; i++) { - if (buf[i] == lang) - return 1; - } - - return 0; -} - - -/* This function returns a newly allocated wide string containing the USB - device string numbered by the index. The returned string must be freed - by using free(). */ -static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx) -{ - char buf[512]; - unsigned int len; - wchar_t *str = NULL; - wchar_t wbuf[256]; - - /* iconv variables */ - iconv_t ic; - size_t inbytes; - size_t outbytes; - size_t res; - char *inptr; - char *outptr; - - /* Determine which language to use. */ - uint16_t lang; - lang = get_usb_code_for_current_locale(); - if (!is_language_supported(dev, lang)) - lang = get_first_language(dev); - - /* Get the string from libusb. */ - len = libusb_get_string_descriptor(dev, - idx, - lang, - (unsigned char*)buf, - sizeof(buf)); - if (len < 0) - return NULL; - - buf[sizeof(buf)-1] = '\0'; - - if (len+1 < sizeof(buf)) - buf[len+1] = '\0'; - - /* Initialize iconv. */ - ic = iconv_open("UTF-32", "UTF-16"); - if (ic == (iconv_t)-1) - return NULL; - - /* Convert to UTF-32 (wchar_t on glibc systems). - Skip the first character (2-bytes). */ - inptr = buf+2; - inbytes = len-2; - outptr = (char*) wbuf; - outbytes = sizeof(wbuf); - res = iconv(ic, &inptr, &inbytes, &outptr, &outbytes); - if (res == (size_t)-1) - goto err; - - /* Write the terminating NULL. */ - wbuf[sizeof(wbuf)/sizeof(wbuf[0])-1] = 0x00000000; - if (outbytes >= sizeof(wbuf[0])) - *((wchar_t*)outptr) = 0x00000000; - - /* Allocate and copy the string. */ - str = wcsdup(wbuf+1); - -err: - iconv_close(ic); - - return str; -} - -static char *make_path(libusb_device *dev, int interface_number) -{ - char str[64]; - snprintf(str, sizeof(str), "%04x:%04x:%02x", - libusb_get_bus_number(dev), - libusb_get_device_address(dev), - interface_number); - str[sizeof(str)-1] = '\0'; - - return strdup(str); -} - - -int HID_API_EXPORT hid_init(void) -{ - if (!initialized) { - if (libusb_init(NULL)) - return -1; - initialized = 1; - } - - return 0; -} - -int HID_API_EXPORT hid_exit(void) -{ - if (initialized) { - libusb_exit(NULL); - initialized = 0; - } - - return 0; -} - -struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short product_id) -{ - libusb_device **devs; - libusb_device *dev; - libusb_device_handle *handle; - ssize_t num_devs; - int i = 0; - - struct hid_device_info *root = NULL; // return object - struct hid_device_info *cur_dev = NULL; - - setlocale(LC_ALL,""); - - if (!initialized) - hid_init(); - - num_devs = libusb_get_device_list(NULL, &devs); - if (num_devs < 0) - return NULL; - while ((dev = devs[i++]) != NULL) { - struct libusb_device_descriptor desc; - struct libusb_config_descriptor *conf_desc = NULL; - int j, k; - int interface_num = 0; - - int res = libusb_get_device_descriptor(dev, &desc); - unsigned short dev_vid = desc.idVendor; - unsigned short dev_pid = desc.idProduct; - - /* HID's are defined at the interface level. */ - if (desc.bDeviceClass != LIBUSB_CLASS_PER_INTERFACE) - continue; - - res = libusb_get_active_config_descriptor(dev, &conf_desc); - if (res < 0) - libusb_get_config_descriptor(dev, 0, &conf_desc); - if (conf_desc) { - for (j = 0; j < conf_desc->bNumInterfaces; j++) { - const struct libusb_interface *intf = &conf_desc->interface[j]; - for (k = 0; k < intf->num_altsetting; k++) { - const struct libusb_interface_descriptor *intf_desc; - intf_desc = &intf->altsetting[k]; - if (intf_desc->bInterfaceClass == LIBUSB_CLASS_HID) { - interface_num = intf_desc->bInterfaceNumber; - - /* Check the VID/PID against the arguments */ - if ((vendor_id == 0x0 && product_id == 0x0) || - (vendor_id == dev_vid && product_id == dev_pid)) { - struct hid_device_info *tmp; - - /* VID/PID match. Create the record. */ - tmp = calloc(1, sizeof(struct hid_device_info)); - if (cur_dev) { - cur_dev->next = tmp; - } - else { - root = tmp; - } - cur_dev = tmp; - - /* Fill out the record */ - cur_dev->next = NULL; - cur_dev->path = make_path(dev, interface_num); - - res = libusb_open(dev, &handle); - - if (res >= 0) { - /* Serial Number */ - if (desc.iSerialNumber > 0) - cur_dev->serial_number = - get_usb_string(handle, desc.iSerialNumber); - - /* Manufacturer and Product strings */ - if (desc.iManufacturer > 0) - cur_dev->manufacturer_string = - get_usb_string(handle, desc.iManufacturer); - if (desc.iProduct > 0) - cur_dev->product_string = - get_usb_string(handle, desc.iProduct); - -#ifdef INVASIVE_GET_USAGE - /* - This section is removed because it is too - invasive on the system. Getting a Usage Page - and Usage requires parsing the HID Report - descriptor. Getting a HID Report descriptor - involves claiming the interface. Claiming the - interface involves detaching the kernel driver. - Detaching the kernel driver is hard on the system - because it will unclaim interfaces (if another - app has them claimed) and the re-attachment of - the driver will sometimes change /dev entry names. - It is for these reasons that this section is - #if 0. For composite devices, use the interface - field in the hid_device_info struct to distinguish - between interfaces. */ - int detached = 0; - unsigned char data[256]; - - /* Usage Page and Usage */ - res = libusb_kernel_driver_active(handle, interface_num); - if (res == 1) { - res = libusb_detach_kernel_driver(handle, interface_num); - if (res < 0) - LOG("Couldn't detach kernel driver, even though a kernel driver was attached."); - else - detached = 1; - } - res = libusb_claim_interface(handle, interface_num); - if (res >= 0) { - /* Get the HID Report Descriptor. */ - res = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_REPORT << 8)|interface_num, 0, data, sizeof(data), 5000); - if (res >= 0) { - unsigned short page=0, usage=0; - /* Parse the usage and usage page - out of the report descriptor. */ - get_usage(data, res, &page, &usage); - cur_dev->usage_page = page; - cur_dev->usage = usage; - } - else - LOG("libusb_control_transfer() for getting the HID report failed with %d\n", res); - - /* Release the interface */ - res = libusb_release_interface(handle, interface_num); - if (res < 0) - LOG("Can't release the interface.\n"); - } - else - LOG("Can't claim interface %d\n", res); - - /* Re-attach kernel driver if necessary. */ - if (detached) { - res = libusb_attach_kernel_driver(handle, interface_num); - if (res < 0) - LOG("Couldn't re-attach kernel driver.\n"); - } -#endif /*******************/ - - libusb_close(handle); - } - /* VID/PID */ - cur_dev->vendor_id = dev_vid; - cur_dev->product_id = dev_pid; - - /* Release Number */ - cur_dev->release_number = desc.bcdDevice; - - /* Interface Number */ - cur_dev->interface_number = interface_num; - } - } - } /* altsettings */ - } /* interfaces */ - libusb_free_config_descriptor(conf_desc); - } - } - - libusb_free_device_list(devs, 1); - - return root; -} - -void HID_API_EXPORT hid_free_enumeration(struct hid_device_info *devs) -{ - struct hid_device_info *d = devs; - while (d) { - struct hid_device_info *next = d->next; - free(d->path); - free(d->serial_number); - free(d->manufacturer_string); - free(d->product_string); - free(d); - d = next; - } -} - -hid_device * hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number) -{ - struct hid_device_info *devs, *cur_dev; - const char *path_to_open = NULL; - hid_device *handle = NULL; - - devs = hid_enumerate(vendor_id, product_id); - cur_dev = devs; - while (cur_dev) { - if (cur_dev->vendor_id == vendor_id && - cur_dev->product_id == product_id) { - if (serial_number) { - if (wcscmp(serial_number, cur_dev->serial_number) == 0) { - path_to_open = cur_dev->path; - break; - } - } - else { - path_to_open = cur_dev->path; - break; - } - } - cur_dev = cur_dev->next; - } - - if (path_to_open) { - /* Open the device */ - handle = hid_open_path(path_to_open); - } - - hid_free_enumeration(devs); - - return handle; -} - -static void read_callback(struct libusb_transfer *transfer) -{ - hid_device *dev = transfer->user_data; - - if (transfer->status == LIBUSB_TRANSFER_COMPLETED) { - - struct input_report *rpt = malloc(sizeof(*rpt)); - rpt->data = malloc(transfer->actual_length); - memcpy(rpt->data, transfer->buffer, transfer->actual_length); - rpt->len = transfer->actual_length; - rpt->next = NULL; - - pthread_mutex_lock(&dev->mutex); - - /* Attach the new report object to the end of the list. */ - if (dev->input_reports == NULL) { - /* The list is empty. Put it at the root. */ - dev->input_reports = rpt; - pthread_cond_signal(&dev->condition); - } - else { - /* Find the end of the list and attach. */ - struct input_report *cur = dev->input_reports; - int num_queued = 0; - while (cur->next != NULL) { - cur = cur->next; - num_queued++; - } - cur->next = rpt; - - /* Pop one off if we've reached 30 in the queue. This - way we don't grow forever if the user never reads - anything from the device. */ - if (num_queued > 30) { - return_data(dev, NULL, 0); - } - } - pthread_mutex_unlock(&dev->mutex); - } - else if (transfer->status == LIBUSB_TRANSFER_CANCELLED) { - dev->shutdown_thread = 1; - return; - } - else if (transfer->status == LIBUSB_TRANSFER_NO_DEVICE) { - dev->shutdown_thread = 1; - return; - } - else if (transfer->status == LIBUSB_TRANSFER_TIMED_OUT) { - //LOG("Timeout (normal)\n"); - } - else { - LOG("Unknown transfer code: %d\n", transfer->status); - } - - /* Re-submit the transfer object. */ - libusb_submit_transfer(transfer); -} - - -static void *read_thread(void *param) -{ - hid_device *dev = param; - unsigned char *buf; - const size_t length = dev->input_ep_max_packet_size; - - /* Set up the transfer object. */ - buf = malloc(length); - dev->transfer = libusb_alloc_transfer(0); - libusb_fill_interrupt_transfer(dev->transfer, - dev->device_handle, - dev->input_endpoint, - buf, - length, - read_callback, - dev, - 5000/*timeout*/); - - /* Make the first submission. Further submissions are made - from inside read_callback() */ - libusb_submit_transfer(dev->transfer); - - // Notify the main thread that the read thread is up and running. - pthread_barrier_wait(&dev->barrier); - - /* Handle all the events. */ - while (!dev->shutdown_thread) { - int res; - res = libusb_handle_events(NULL); - if (res < 0) { - /* There was an error. Break out of this loop. */ - break; - } - } - - /* Cancel any transfer that may be pending. This call will fail - if no transfers are pending, but that's OK. */ - if (libusb_cancel_transfer(dev->transfer) == 0) { - /* The transfer was cancelled, so wait for its completion. */ - libusb_handle_events(NULL); - } - - /* Now that the read thread is stopping, Wake any threads which are - waiting on data (in hid_read_timeout()). Do this under a mutex to - make sure that a thread which is about to go to sleep waiting on - the condition acutally will go to sleep before the condition is - signaled. */ - pthread_mutex_lock(&dev->mutex); - pthread_cond_broadcast(&dev->condition); - pthread_mutex_unlock(&dev->mutex); - - /* The dev->transfer->buffer and dev->transfer objects are cleaned up - in hid_close(). They are not cleaned up here because this thread - could end either due to a disconnect or due to a user - call to hid_close(). In both cases the objects can be safely - cleaned up after the call to pthread_join() (in hid_close()), but - since hid_close() calls libusb_cancel_transfer(), on these objects, - they can not be cleaned up here. */ - - return NULL; -} - - -hid_device * HID_API_EXPORT hid_open_path(const char *path) -{ - hid_device *dev = NULL; - - dev = new_hid_device(); - - libusb_device **devs; - libusb_device *usb_dev; - ssize_t num_devs; - int res; - int d = 0; - int good_open = 0; - - setlocale(LC_ALL,""); - - if (!initialized) - hid_init(); - - num_devs = libusb_get_device_list(NULL, &devs); - while ((usb_dev = devs[d++]) != NULL) { - struct libusb_device_descriptor desc; - struct libusb_config_descriptor *conf_desc = NULL; - int i,j,k; - libusb_get_device_descriptor(usb_dev, &desc); - - if (libusb_get_active_config_descriptor(usb_dev, &conf_desc) < 0) - continue; - for (j = 0; j < conf_desc->bNumInterfaces; j++) { - const struct libusb_interface *intf = &conf_desc->interface[j]; - for (k = 0; k < intf->num_altsetting; k++) { - const struct libusb_interface_descriptor *intf_desc; - intf_desc = &intf->altsetting[k]; - if (intf_desc->bInterfaceClass == LIBUSB_CLASS_HID) { - char *dev_path = make_path(usb_dev, intf_desc->bInterfaceNumber); - if (!strcmp(dev_path, path)) { - /* Matched Paths. Open this device */ - - // OPEN HERE // - res = libusb_open(usb_dev, &dev->device_handle); - if (res < 0) { - LOG("can't open device\n"); - free(dev_path); - break; - } - good_open = 1; - - /* Detach the kernel driver, but only if the - device is managed by the kernel */ - if (libusb_kernel_driver_active(dev->device_handle, intf_desc->bInterfaceNumber) == 1) { - res = libusb_detach_kernel_driver(dev->device_handle, intf_desc->bInterfaceNumber); - if (res < 0) { - libusb_close(dev->device_handle); - LOG("Unable to detach Kernel Driver\n"); - free(dev_path); - good_open = 0; - break; - } - } - - res = libusb_claim_interface(dev->device_handle, intf_desc->bInterfaceNumber); - if (res < 0) { - LOG("can't claim interface %d: %d\n", intf_desc->bInterfaceNumber, res); - free(dev_path); - libusb_close(dev->device_handle); - good_open = 0; - break; - } - - /* Store off the string descriptor indexes */ - dev->manufacturer_index = desc.iManufacturer; - dev->product_index = desc.iProduct; - dev->serial_index = desc.iSerialNumber; - - /* Store off the interface number */ - dev->interface = intf_desc->bInterfaceNumber; - - /* Find the INPUT and OUTPUT endpoints. An - OUTPUT endpoint is not required. */ - for (i = 0; i < intf_desc->bNumEndpoints; i++) { - const struct libusb_endpoint_descriptor *ep - = &intf_desc->endpoint[i]; - - /* Determine the type and direction of this - endpoint. */ - int is_interrupt = - (ep->bmAttributes & LIBUSB_TRANSFER_TYPE_MASK) - == LIBUSB_TRANSFER_TYPE_INTERRUPT; - int is_output = - (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) - == LIBUSB_ENDPOINT_OUT; - int is_input = - (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) - == LIBUSB_ENDPOINT_IN; - - /* Decide whether to use it for intput or output. */ - if (dev->input_endpoint == 0 && - is_interrupt && is_input) { - /* Use this endpoint for INPUT */ - dev->input_endpoint = ep->bEndpointAddress; - dev->input_ep_max_packet_size = ep->wMaxPacketSize; - } - if (dev->output_endpoint == 0 && - is_interrupt && is_output) { - /* Use this endpoint for OUTPUT */ - dev->output_endpoint = ep->bEndpointAddress; - } - } - - pthread_create(&dev->thread, NULL, read_thread, dev); - - // Wait here for the read thread to be initialized. - pthread_barrier_wait(&dev->barrier); - - } - free(dev_path); - } - } - } - libusb_free_config_descriptor(conf_desc); - - } - - libusb_free_device_list(devs, 1); - - // If we have a good handle, return it. - if (good_open) { - return dev; - } - else { - // Unable to open any devices. - free_hid_device(dev); - return NULL; - } -} - - -int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length) -{ - int res; - int report_number = data[0]; - int skipped_report_id = 0; - - if (report_number == 0x0) { - data++; - length--; - skipped_report_id = 1; - } - - - if (dev->output_endpoint <= 0) { - /* No interrput out endpoint. Use the Control Endpoint */ - res = libusb_control_transfer(dev->device_handle, - LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT, - 0x09/*HID Set_Report*/, - (2/*HID output*/ << 8) | report_number, - dev->interface, - (unsigned char *)data, length, - 1000/*timeout millis*/); - - if (res < 0) - return -1; - - if (skipped_report_id) - length++; - - return length; - } - else { - /* Use the interrupt out endpoint */ - int actual_length; - res = libusb_interrupt_transfer(dev->device_handle, - dev->output_endpoint, - (unsigned char*)data, - length, - &actual_length, 1000); - - if (res < 0) - return -1; - - if (skipped_report_id) - actual_length++; - - return actual_length; - } -} - -/* Helper function, to simplify hid_read(). - This should be called with dev->mutex locked. */ -static int return_data(hid_device *dev, unsigned char *data, size_t length) -{ - /* Copy the data out of the linked list item (rpt) into the - return buffer (data), and delete the liked list item. */ - struct input_report *rpt = dev->input_reports; - size_t len = (length < rpt->len)? length: rpt->len; - if (len > 0) - memcpy(data, rpt->data, len); - dev->input_reports = rpt->next; - free(rpt->data); - free(rpt); - return len; -} - -static void cleanup_mutex(void *param) -{ - hid_device *dev = param; - pthread_mutex_unlock(&dev->mutex); -} - - -int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds) -{ - int bytes_read = -1; - -#if 0 - int transferred; - int res = libusb_interrupt_transfer(dev->device_handle, dev->input_endpoint, data, length, &transferred, 5000); - LOG("transferred: %d\n", transferred); - return transferred; -#endif - - pthread_mutex_lock(&dev->mutex); - pthread_cleanup_push(&cleanup_mutex, dev); - - /* There's an input report queued up. Return it. */ - if (dev->input_reports) { - /* Return the first one */ - bytes_read = return_data(dev, data, length); - goto ret; - } - - if (dev->shutdown_thread) { - /* This means the device has been disconnected. - An error code of -1 should be returned. */ - bytes_read = -1; - goto ret; - } - - if (milliseconds == -1) { - /* Blocking */ - while (!dev->input_reports && !dev->shutdown_thread) { - pthread_cond_wait(&dev->condition, &dev->mutex); - } - if (dev->input_reports) { - bytes_read = return_data(dev, data, length); - } - } - else if (milliseconds > 0) { - /* Non-blocking, but called with timeout. */ - int res; - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += milliseconds / 1000; - ts.tv_nsec += (milliseconds % 1000) * 1000000; - if (ts.tv_nsec >= 1000000000L) { - ts.tv_sec++; - ts.tv_nsec -= 1000000000L; - } - - while (!dev->input_reports && !dev->shutdown_thread) { - res = pthread_cond_timedwait(&dev->condition, &dev->mutex, &ts); - if (res == 0) { - if (dev->input_reports) { - bytes_read = return_data(dev, data, length); - break; - } - - /* If we're here, there was a spurious wake up - or the read thread was shutdown. Run the - loop again (ie: don't break). */ - } - else if (res == ETIMEDOUT) { - /* Timed out. */ - bytes_read = 0; - break; - } - else { - /* Error. */ - bytes_read = -1; - break; - } - } - } - else { - /* Purely non-blocking */ - bytes_read = 0; - } - -ret: - pthread_mutex_unlock(&dev->mutex); - pthread_cleanup_pop(0); - - return bytes_read; -} - -int HID_API_EXPORT hid_read(hid_device *dev, unsigned char *data, size_t length) -{ - return hid_read_timeout(dev, data, length, dev->blocking ? -1 : 0); -} - -int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock) -{ - dev->blocking = !nonblock; - - return 0; -} - - -int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length) -{ - int res = -1; - int skipped_report_id = 0; - int report_number = data[0]; - - if (report_number == 0x0) { - data++; - length--; - skipped_report_id = 1; - } - - res = libusb_control_transfer(dev->device_handle, - LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT, - 0x09/*HID set_report*/, - (3/*HID feature*/ << 8) | report_number, - dev->interface, - (unsigned char *)data, length, - 1000/*timeout millis*/); - - if (res < 0) - return -1; - - /* Account for the report ID */ - if (skipped_report_id) - length++; - - return length; -} - -int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length) -{ - int res = -1; - int skipped_report_id = 0; - int report_number = data[0]; - - if (report_number == 0x0) { - /* Offset the return buffer by 1, so that the report ID - will remain in byte 0. */ - data++; - length--; - skipped_report_id = 1; - } - res = libusb_control_transfer(dev->device_handle, - LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_IN, - 0x01/*HID get_report*/, - (3/*HID feature*/ << 8) | report_number, - dev->interface, - (unsigned char *)data, length, - 1000/*timeout millis*/); - - if (res < 0) - return -1; - - if (skipped_report_id) - res++; - - return res; -} - - -void HID_API_EXPORT hid_close(hid_device *dev) -{ - if (!dev) - return; - - /* Cause read_thread() to stop. */ - dev->shutdown_thread = 1; - libusb_cancel_transfer(dev->transfer); - - /* Wait for read_thread() to end. */ - pthread_join(dev->thread, NULL); - - /* Clean up the Transfer objects allocated in read_thread(). */ - free(dev->transfer->buffer); - libusb_free_transfer(dev->transfer); - - /* release the interface */ - libusb_release_interface(dev->device_handle, dev->interface); - - /* Close the handle */ - libusb_close(dev->device_handle); - - /* Clear out the queue of received reports. */ - pthread_mutex_lock(&dev->mutex); - while (dev->input_reports) { - return_data(dev, NULL, 0); - } - pthread_mutex_unlock(&dev->mutex); - - free_hid_device(dev); -} - - -int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen) -{ - return hid_get_indexed_string(dev, dev->manufacturer_index, string, maxlen); -} - -int HID_API_EXPORT_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen) -{ - return hid_get_indexed_string(dev, dev->product_index, string, maxlen); -} - -int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen) -{ - return hid_get_indexed_string(dev, dev->serial_index, string, maxlen); -} - -int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen) -{ - wchar_t *str; - - str = get_usb_string(dev->device_handle, string_index); - if (str) { - wcsncpy(string, str, maxlen); - string[maxlen-1] = L'\0'; - free(str); - return 0; - } - else - return -1; -} - - -HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev) -{ - return NULL; -} - - -struct lang_map_entry { - const char *name; - const char *string_code; - uint16_t usb_code; -}; - -#define LANG(name,code,usb_code) { name, code, usb_code } -static struct lang_map_entry lang_map[] = { - LANG("Afrikaans", "af", 0x0436), - LANG("Albanian", "sq", 0x041C), - LANG("Arabic - United Arab Emirates", "ar_ae", 0x3801), - LANG("Arabic - Bahrain", "ar_bh", 0x3C01), - LANG("Arabic - Algeria", "ar_dz", 0x1401), - LANG("Arabic - Egypt", "ar_eg", 0x0C01), - LANG("Arabic - Iraq", "ar_iq", 0x0801), - LANG("Arabic - Jordan", "ar_jo", 0x2C01), - LANG("Arabic - Kuwait", "ar_kw", 0x3401), - LANG("Arabic - Lebanon", "ar_lb", 0x3001), - LANG("Arabic - Libya", "ar_ly", 0x1001), - LANG("Arabic - Morocco", "ar_ma", 0x1801), - LANG("Arabic - Oman", "ar_om", 0x2001), - LANG("Arabic - Qatar", "ar_qa", 0x4001), - LANG("Arabic - Saudi Arabia", "ar_sa", 0x0401), - LANG("Arabic - Syria", "ar_sy", 0x2801), - LANG("Arabic - Tunisia", "ar_tn", 0x1C01), - LANG("Arabic - Yemen", "ar_ye", 0x2401), - LANG("Armenian", "hy", 0x042B), - LANG("Azeri - Latin", "az_az", 0x042C), - LANG("Azeri - Cyrillic", "az_az", 0x082C), - LANG("Basque", "eu", 0x042D), - LANG("Belarusian", "be", 0x0423), - LANG("Bulgarian", "bg", 0x0402), - LANG("Catalan", "ca", 0x0403), - LANG("Chinese - China", "zh_cn", 0x0804), - LANG("Chinese - Hong Kong SAR", "zh_hk", 0x0C04), - LANG("Chinese - Macau SAR", "zh_mo", 0x1404), - LANG("Chinese - Singapore", "zh_sg", 0x1004), - LANG("Chinese - Taiwan", "zh_tw", 0x0404), - LANG("Croatian", "hr", 0x041A), - LANG("Czech", "cs", 0x0405), - LANG("Danish", "da", 0x0406), - LANG("Dutch - Netherlands", "nl_nl", 0x0413), - LANG("Dutch - Belgium", "nl_be", 0x0813), - LANG("English - Australia", "en_au", 0x0C09), - LANG("English - Belize", "en_bz", 0x2809), - LANG("English - Canada", "en_ca", 0x1009), - LANG("English - Caribbean", "en_cb", 0x2409), - LANG("English - Ireland", "en_ie", 0x1809), - LANG("English - Jamaica", "en_jm", 0x2009), - LANG("English - New Zealand", "en_nz", 0x1409), - LANG("English - Phillippines", "en_ph", 0x3409), - LANG("English - Southern Africa", "en_za", 0x1C09), - LANG("English - Trinidad", "en_tt", 0x2C09), - LANG("English - Great Britain", "en_gb", 0x0809), - LANG("English - United States", "en_us", 0x0409), - LANG("Estonian", "et", 0x0425), - LANG("Farsi", "fa", 0x0429), - LANG("Finnish", "fi", 0x040B), - LANG("Faroese", "fo", 0x0438), - LANG("French - France", "fr_fr", 0x040C), - LANG("French - Belgium", "fr_be", 0x080C), - LANG("French - Canada", "fr_ca", 0x0C0C), - LANG("French - Luxembourg", "fr_lu", 0x140C), - LANG("French - Switzerland", "fr_ch", 0x100C), - LANG("Gaelic - Ireland", "gd_ie", 0x083C), - LANG("Gaelic - Scotland", "gd", 0x043C), - LANG("German - Germany", "de_de", 0x0407), - LANG("German - Austria", "de_at", 0x0C07), - LANG("German - Liechtenstein", "de_li", 0x1407), - LANG("German - Luxembourg", "de_lu", 0x1007), - LANG("German - Switzerland", "de_ch", 0x0807), - LANG("Greek", "el", 0x0408), - LANG("Hebrew", "he", 0x040D), - LANG("Hindi", "hi", 0x0439), - LANG("Hungarian", "hu", 0x040E), - LANG("Icelandic", "is", 0x040F), - LANG("Indonesian", "id", 0x0421), - LANG("Italian - Italy", "it_it", 0x0410), - LANG("Italian - Switzerland", "it_ch", 0x0810), - LANG("Japanese", "ja", 0x0411), - LANG("Korean", "ko", 0x0412), - LANG("Latvian", "lv", 0x0426), - LANG("Lithuanian", "lt", 0x0427), - LANG("F.Y.R.O. Macedonia", "mk", 0x042F), - LANG("Malay - Malaysia", "ms_my", 0x043E), - LANG("Malay – Brunei", "ms_bn", 0x083E), - LANG("Maltese", "mt", 0x043A), - LANG("Marathi", "mr", 0x044E), - LANG("Norwegian - Bokml", "no_no", 0x0414), - LANG("Norwegian - Nynorsk", "no_no", 0x0814), - LANG("Polish", "pl", 0x0415), - LANG("Portuguese - Portugal", "pt_pt", 0x0816), - LANG("Portuguese - Brazil", "pt_br", 0x0416), - LANG("Raeto-Romance", "rm", 0x0417), - LANG("Romanian - Romania", "ro", 0x0418), - LANG("Romanian - Republic of Moldova", "ro_mo", 0x0818), - LANG("Russian", "ru", 0x0419), - LANG("Russian - Republic of Moldova", "ru_mo", 0x0819), - LANG("Sanskrit", "sa", 0x044F), - LANG("Serbian - Cyrillic", "sr_sp", 0x0C1A), - LANG("Serbian - Latin", "sr_sp", 0x081A), - LANG("Setsuana", "tn", 0x0432), - LANG("Slovenian", "sl", 0x0424), - LANG("Slovak", "sk", 0x041B), - LANG("Sorbian", "sb", 0x042E), - LANG("Spanish - Spain (Traditional)", "es_es", 0x040A), - LANG("Spanish - Argentina", "es_ar", 0x2C0A), - LANG("Spanish - Bolivia", "es_bo", 0x400A), - LANG("Spanish - Chile", "es_cl", 0x340A), - LANG("Spanish - Colombia", "es_co", 0x240A), - LANG("Spanish - Costa Rica", "es_cr", 0x140A), - LANG("Spanish - Dominican Republic", "es_do", 0x1C0A), - LANG("Spanish - Ecuador", "es_ec", 0x300A), - LANG("Spanish - Guatemala", "es_gt", 0x100A), - LANG("Spanish - Honduras", "es_hn", 0x480A), - LANG("Spanish - Mexico", "es_mx", 0x080A), - LANG("Spanish - Nicaragua", "es_ni", 0x4C0A), - LANG("Spanish - Panama", "es_pa", 0x180A), - LANG("Spanish - Peru", "es_pe", 0x280A), - LANG("Spanish - Puerto Rico", "es_pr", 0x500A), - LANG("Spanish - Paraguay", "es_py", 0x3C0A), - LANG("Spanish - El Salvador", "es_sv", 0x440A), - LANG("Spanish - Uruguay", "es_uy", 0x380A), - LANG("Spanish - Venezuela", "es_ve", 0x200A), - LANG("Southern Sotho", "st", 0x0430), - LANG("Swahili", "sw", 0x0441), - LANG("Swedish - Sweden", "sv_se", 0x041D), - LANG("Swedish - Finland", "sv_fi", 0x081D), - LANG("Tamil", "ta", 0x0449), - LANG("Tatar", "tt", 0X0444), - LANG("Thai", "th", 0x041E), - LANG("Turkish", "tr", 0x041F), - LANG("Tsonga", "ts", 0x0431), - LANG("Ukrainian", "uk", 0x0422), - LANG("Urdu", "ur", 0x0420), - LANG("Uzbek - Cyrillic", "uz_uz", 0x0843), - LANG("Uzbek – Latin", "uz_uz", 0x0443), - LANG("Vietnamese", "vi", 0x042A), - LANG("Xhosa", "xh", 0x0434), - LANG("Yiddish", "yi", 0x043D), - LANG("Zulu", "zu", 0x0435), - LANG(NULL, NULL, 0x0), -}; - -uint16_t get_usb_code_for_current_locale(void) -{ - char *locale; - char search_string[64]; - char *ptr; - - /* Get the current locale. */ - locale = setlocale(0, NULL); - if (!locale) - return 0x0; - - /* Make a copy of the current locale string. */ - strncpy(search_string, locale, sizeof(search_string)); - search_string[sizeof(search_string)-1] = '\0'; - - /* Chop off the encoding part, and make it lower case. */ - ptr = search_string; - while (*ptr) { - *ptr = tolower(*ptr); - if (*ptr == '.') { - *ptr = '\0'; - break; - } - ptr++; - } - - /* Find the entry which matches the string code of our locale. */ - struct lang_map_entry *lang = lang_map; - while (lang->string_code) { - if (!strcmp(lang->string_code, search_string)) { - return lang->usb_code; - } - lang++; - } - - /* There was no match. Find with just the language only. */ - /* Chop off the variant. Chop it off at the '_'. */ - ptr = search_string; - while (*ptr) { - *ptr = tolower(*ptr); - if (*ptr == '_') { - *ptr = '\0'; - break; - } - ptr++; - } - -#if 0 // TODO: Do we need this? - /* Find the entry which matches the string code of our language. */ - lang = lang_map; - while (lang->string_code) { - if (!strcmp(lang->string_code, search_string)) { - return lang->usb_code; - } - lang++; - } -#endif - - /* Found nothing. */ - return 0x0; -} - -#ifdef __cplusplus -} -#endif diff --git a/gr-fcd/lib/hid/hidapi.h b/gr-fcd/lib/hid/hidapi.h deleted file mode 100644 index 8e55c8474..000000000 --- a/gr-fcd/lib/hid/hidapi.h +++ /dev/null @@ -1,383 +0,0 @@ -/******************************************************* - HIDAPI - Multi-Platform library for - communication with HID devices. - - Alan Ott - Signal 11 Software - - 8/22/2009 - - Copyright 2009, All Rights Reserved. - - At the discretion of the user of this library, - this software may be licensed under the terms of the - GNU Public License v3, a BSD-Style license, or the - original HIDAPI license as outlined in the LICENSE.txt, - LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt - files located at the root of the source distribution. - These files may also be found in the public source - code repository located at: - http://github.com/signal11/hidapi . -********************************************************/ - -/** @file - * @defgroup API hidapi API - */ - -#ifndef HIDAPI_H__ -#define HIDAPI_H__ - -#include <wchar.h> - -#ifdef _WIN32 - #define HID_API_EXPORT __declspec(dllexport) - #define HID_API_CALL -#else - #define HID_API_EXPORT /**< API export macro */ - #define HID_API_CALL /**< API call macro */ -#endif - -#define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL /**< API export and call macro*/ - -#ifdef __cplusplus -extern "C" { -#endif - struct hid_device_; - typedef struct hid_device_ hid_device; /**< opaque hidapi structure */ - - /** hidapi info structure */ - struct hid_device_info { - /** Platform-specific device path */ - char *path; - /** Device Vendor ID */ - unsigned short vendor_id; - /** Device Product ID */ - unsigned short product_id; - /** Serial Number */ - wchar_t *serial_number; - /** Device Release Number in binary-coded decimal, - also known as Device Version Number */ - unsigned short release_number; - /** Manufacturer String */ - wchar_t *manufacturer_string; - /** Product string */ - wchar_t *product_string; - /** Usage Page for this Device/Interface - (Windows/Mac only). */ - unsigned short usage_page; - /** Usage for this Device/Interface - (Windows/Mac only).*/ - unsigned short usage; - /** The USB interface which this logical device - represents. Valid on both Linux implementations - in all cases, and valid on the Windows implementation - only if the device contains more than one interface. */ - int interface_number; - - /** Pointer to the next device */ - struct hid_device_info *next; - }; - - - /** @brief Initialize the HIDAPI library. - - This function initializes the HIDAPI library. Calling it is not - strictly necessary, as it will be called automatically by - hid_enumerate() and any of the hid_open_*() functions if it is - needed. This function should be called at the beginning of - execution however, if there is a chance of HIDAPI handles - being opened by different threads simultaneously. - - @ingroup API - - @returns - This function returns 0 on success and -1 on error. - */ - int HID_API_EXPORT HID_API_CALL hid_init(void); - - /** @brief Finalize the HIDAPI library. - - This function frees all of the static data associated with - HIDAPI. It should be called at the end of execution to avoid - memory leaks. - - @ingroup API - - @returns - This function returns 0 on success and -1 on error. - */ - int HID_API_EXPORT HID_API_CALL hid_exit(void); - - /** @brief Enumerate the HID Devices. - - This function returns a linked list of all the HID devices - attached to the system which match vendor_id and product_id. - If @p vendor_id and @p product_id are both set to 0, then - all HID devices will be returned. - - @ingroup API - @param vendor_id The Vendor ID (VID) of the types of device - to open. - @param product_id The Product ID (PID) of the types of - device to open. - - @returns - This function returns a pointer to a linked list of type - struct #hid_device, containing information about the HID devices - attached to the system, or NULL in the case of failure. Free - this linked list by calling hid_free_enumeration(). - */ - struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id); - - /** @brief Free an enumeration Linked List - - This function frees a linked list created by hid_enumerate(). - - @ingroup API - @param devs Pointer to a list of struct_device returned from - hid_enumerate(). - */ - void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs); - - /** @brief Open a HID device using a Vendor ID (VID), Product ID - (PID) and optionally a serial number. - - If @p serial_number is NULL, the first device with the - specified VID and PID is opened. - - @ingroup API - @param vendor_id The Vendor ID (VID) of the device to open. - @param product_id The Product ID (PID) of the device to open. - @param serial_number The Serial Number of the device to open - (Optionally NULL). - - @returns - This function returns a pointer to a #hid_device object on - success or NULL on failure. - */ - HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number); - - /** @brief Open a HID device by its path name. - - The path name be determined by calling hid_enumerate(), or a - platform-specific path name can be used (eg: /dev/hidraw0 on - Linux). - - @ingroup API - @param path The path name of the device to open - - @returns - This function returns a pointer to a #hid_device object on - success or NULL on failure. - */ - HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path); - - /** @brief Write an Output report to a HID device. - - The first byte of @p data[] must contain the Report ID. For - devices which only support a single report, this must be set - to 0x0. The remaining bytes contain the report data. Since - the Report ID is mandatory, calls to hid_write() will always - contain one more byte than the report contains. For example, - if a hid report is 16 bytes long, 17 bytes must be passed to - hid_write(), the Report ID (or 0x0, for devices with a - single report), followed by the report data (16 bytes). In - this example, the length passed in would be 17. - - hid_write() will send the data on the first OUT endpoint, if - one exists. If it does not, it will send the data through - the Control Endpoint (Endpoint 0). - - @ingroup API - @param device A device handle returned from hid_open(). - @param data The data to send, including the report number as - the first byte. - @param length The length in bytes of the data to send. - - @returns - This function returns the actual number of bytes written and - -1 on error. - */ - int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length); - - /** @brief Read an Input report from a HID device with timeout. - - Input reports are returned - to the host through the INTERRUPT IN endpoint. The first byte will - contain the Report number if the device uses numbered reports. - - @ingroup API - @param dev A device handle returned from hid_open(). - @param data A buffer to put the read data into. - @param length The number of bytes to read. For devices with - multiple reports, make sure to read an extra byte for - the report number. - @param milliseconds timeout in milliseconds or -1 for blocking wait. - - @returns - This function returns the actual number of bytes read and - -1 on error. - */ - int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds); - - /** @brief Read an Input report from a HID device. - - Input reports are returned - to the host through the INTERRUPT IN endpoint. The first byte will - contain the Report number if the device uses numbered reports. - - @ingroup API - @param device A device handle returned from hid_open(). - @param data A buffer to put the read data into. - @param length The number of bytes to read. For devices with - multiple reports, make sure to read an extra byte for - the report number. - - @returns - This function returns the actual number of bytes read and - -1 on error. - */ - int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length); - - /** @brief Set the device handle to be non-blocking. - - In non-blocking mode calls to hid_read() will return - immediately with a value of 0 if there is no data to be - read. In blocking mode, hid_read() will wait (block) until - there is data to read before returning. - - Nonblocking can be turned on and off at any time. - - @ingroup API - @param device A device handle returned from hid_open(). - @param nonblock enable or not the nonblocking reads - - 1 to enable nonblocking - - 0 to disable nonblocking. - - @returns - This function returns 0 on success and -1 on error. - */ - int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock); - - /** @brief Send a Feature report to the device. - - Feature reports are sent over the Control endpoint as a - Set_Report transfer. The first byte of @p data[] must - contain the Report ID. For devices which only support a - single report, this must be set to 0x0. The remaining bytes - contain the report data. Since the Report ID is mandatory, - calls to hid_send_feature_report() will always contain one - more byte than the report contains. For example, if a hid - report is 16 bytes long, 17 bytes must be passed to - hid_send_feature_report(): the Report ID (or 0x0, for - devices which do not use numbered reports), followed by the - report data (16 bytes). In this example, the length passed - in would be 17. - - @ingroup API - @param device A device handle returned from hid_open(). - @param data The data to send, including the report number as - the first byte. - @param length The length in bytes of the data to send, including - the report number. - - @returns - This function returns the actual number of bytes written and - -1 on error. - */ - int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length); - - /** @brief Get a feature report from a HID device. - - Make sure to set the first byte of @p data[] to the Report - ID of the report to be read. Make sure to allow space for - this extra byte in @p data[]. - - @ingroup API - @param device A device handle returned from hid_open(). - @param data A buffer to put the read data into, including - the Report ID. Set the first byte of @p data[] to the - Report ID of the report to be read. - @param length The number of bytes to read, including an - extra byte for the report ID. The buffer can be longer - than the actual report. - - @returns - This function returns the number of bytes read and - -1 on error. - */ - int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length); - - /** @brief Close a HID device. - - @ingroup API - @param device A device handle returned from hid_open(). - */ - void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device); - - /** @brief Get The Manufacturer String from a HID device. - - @ingroup API - @param device A device handle returned from hid_open(). - @param string A wide string buffer to put the data into. - @param maxlen The length of the buffer in multiples of wchar_t. - - @returns - This function returns 0 on success and -1 on error. - */ - int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen); - - /** @brief Get The Product String from a HID device. - - @ingroup API - @param device A device handle returned from hid_open(). - @param string A wide string buffer to put the data into. - @param maxlen The length of the buffer in multiples of wchar_t. - - @returns - This function returns 0 on success and -1 on error. - */ - int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen); - - /** @brief Get The Serial Number String from a HID device. - - @ingroup API - @param device A device handle returned from hid_open(). - @param string A wide string buffer to put the data into. - @param maxlen The length of the buffer in multiples of wchar_t. - - @returns - This function returns 0 on success and -1 on error. - */ - int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen); - - /** @brief Get a string from a HID device, based on its string index. - - @ingroup API - @param device A device handle returned from hid_open(). - @param string_index The index of the string to get. - @param string A wide string buffer to put the data into. - @param maxlen The length of the buffer in multiples of wchar_t. - - @returns - This function returns 0 on success and -1 on error. - */ - int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen); - - /** @brief Get a string describing the last error which occurred. - - @ingroup API - @param device A device handle returned from hid_open(). - - @returns - This function returns a string containing the last error - which occurred or NULL if none has occurred. - */ - HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/gr-fcd/lib/hid/hidmac.c b/gr-fcd/lib/hid/hidmac.c deleted file mode 100644 index d8c69a8e5..000000000 --- a/gr-fcd/lib/hid/hidmac.c +++ /dev/null @@ -1,1122 +0,0 @@ -/******************************************************* - HIDAPI - Multi-Platform library for - communication with HID devices. - - Alan Ott - Signal 11 Software - - 2010-07-03 - - Copyright 2010, All Rights Reserved. - - At the discretion of the user of this library, - this software may be licensed under the terms of the - GNU Public License v3, a BSD-Style license, or the - original HIDAPI license as outlined in the LICENSE.txt, - LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt - files located at the root of the source distribution. - These files may also be found in the public source - code repository located at: - http://github.com/signal11/hidapi . -********************************************************/ - -/* See Apple Technical Note TN2187 for details on IOHidManager. */ - -#include <IOKit/hid/IOHIDManager.h> -#include <IOKit/hid/IOHIDKeys.h> -#include <CoreFoundation/CoreFoundation.h> -#include <wchar.h> -#include <locale.h> -#include <pthread.h> -#include <sys/time.h> -#include <unistd.h> - -#include "hidapi.h" - -/* Barrier implementation because Mac OSX doesn't have pthread_barrier. - It also doesn't have clock_gettime(). So much for POSIX and SUSv2. - This implementation came from Brent Priddy and was posted on - StackOverflow. It is used with his permission. */ -typedef int pthread_barrierattr_t; -typedef struct pthread_barrier { - pthread_mutex_t mutex; - pthread_cond_t cond; - int count; - int trip_count; -} pthread_barrier_t; - -static int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count) -{ - if(count == 0) { - errno = EINVAL; - return -1; - } - - if(pthread_mutex_init(&barrier->mutex, 0) < 0) { - return -1; - } - if(pthread_cond_init(&barrier->cond, 0) < 0) { - pthread_mutex_destroy(&barrier->mutex); - return -1; - } - barrier->trip_count = count; - barrier->count = 0; - - return 0; -} - -static int pthread_barrier_destroy(pthread_barrier_t *barrier) -{ - pthread_cond_destroy(&barrier->cond); - pthread_mutex_destroy(&barrier->mutex); - return 0; -} - -static int pthread_barrier_wait(pthread_barrier_t *barrier) -{ - pthread_mutex_lock(&barrier->mutex); - ++(barrier->count); - if(barrier->count >= barrier->trip_count) - { - barrier->count = 0; - pthread_cond_broadcast(&barrier->cond); - pthread_mutex_unlock(&barrier->mutex); - return 1; - } - else - { - pthread_cond_wait(&barrier->cond, &(barrier->mutex)); - pthread_mutex_unlock(&barrier->mutex); - return 0; - } -} - -static int return_data(hid_device *dev, unsigned char *data, size_t length); - -/* Linked List of input reports received from the device. */ -struct input_report { - uint8_t *data; - size_t len; - struct input_report *next; -}; - -struct hid_device_ { - IOHIDDeviceRef device_handle; - int blocking; - int uses_numbered_reports; - int disconnected; - CFStringRef run_loop_mode; - CFRunLoopRef run_loop; - CFRunLoopSourceRef source; - uint8_t *input_report_buf; - CFIndex max_input_report_len; - struct input_report *input_reports; - - pthread_t thread; - pthread_mutex_t mutex; /* Protects input_reports */ - pthread_cond_t condition; - pthread_barrier_t barrier; /* Ensures correct startup sequence */ - pthread_barrier_t shutdown_barrier; /* Ensures correct shutdown sequence */ - int shutdown_thread; - - hid_device *next; -}; - -/* Static list of all the devices open. This way when a device gets - disconnected, its hid_device structure can be marked as disconnected - from hid_device_removal_callback(). */ -static hid_device *device_list = NULL; -static pthread_mutex_t device_list_mutex = PTHREAD_MUTEX_INITIALIZER; - -static hid_device *new_hid_device(void) -{ - hid_device *dev = calloc(1, sizeof(hid_device)); - dev->device_handle = NULL; - dev->blocking = 1; - dev->uses_numbered_reports = 0; - dev->disconnected = 0; - dev->run_loop_mode = NULL; - dev->run_loop = NULL; - dev->source = NULL; - dev->input_report_buf = NULL; - dev->input_reports = NULL; - dev->shutdown_thread = 0; - dev->next = NULL; - - /* Thread objects */ - pthread_mutex_init(&dev->mutex, NULL); - pthread_cond_init(&dev->condition, NULL); - pthread_barrier_init(&dev->barrier, NULL, 2); - pthread_barrier_init(&dev->shutdown_barrier, NULL, 2); - - /* Add the new record to the device_list. */ - pthread_mutex_lock(&device_list_mutex); - if (!device_list) - device_list = dev; - else { - hid_device *d = device_list; - while (d) { - if (!d->next) { - d->next = dev; - break; - } - d = d->next; - } - } - pthread_mutex_unlock(&device_list_mutex); - - return dev; -} - -static void free_hid_device(hid_device *dev) -{ - if (!dev) - return; - - /* Delete any input reports still left over. */ - struct input_report *rpt = dev->input_reports; - while (rpt) { - struct input_report *next = rpt->next; - free(rpt->data); - free(rpt); - rpt = next; - } - - /* Free the string and the report buffer. The check for NULL - is necessary here as CFRelease() doesn't handle NULL like - free() and others do. */ - if (dev->run_loop_mode) - CFRelease(dev->run_loop_mode); - if (dev->source) - CFRelease(dev->source); - free(dev->input_report_buf); - - /* Clean up the thread objects */ - pthread_barrier_destroy(&dev->shutdown_barrier); - pthread_barrier_destroy(&dev->barrier); - pthread_cond_destroy(&dev->condition); - pthread_mutex_destroy(&dev->mutex); - - /* Remove it from the device list. */ - pthread_mutex_lock(&device_list_mutex); - hid_device *d = device_list; - if (d == dev) { - device_list = d->next; - } - else { - while (d) { - if (d->next == dev) { - d->next = d->next->next; - break; - } - - d = d->next; - } - } - pthread_mutex_unlock(&device_list_mutex); - - /* Free the structure itself. */ - free(dev); -} - -static IOHIDManagerRef hid_mgr = 0x0; - - -#if 0 -static void register_error(hid_device *device, const char *op) -{ - -} -#endif - - -static int32_t get_int_property(IOHIDDeviceRef device, CFStringRef key) -{ - CFTypeRef ref; - int32_t value; - - ref = IOHIDDeviceGetProperty(device, key); - if (ref) { - if (CFGetTypeID(ref) == CFNumberGetTypeID()) { - CFNumberGetValue((CFNumberRef) ref, kCFNumberSInt32Type, &value); - return value; - } - } - return 0; -} - -static unsigned short get_vendor_id(IOHIDDeviceRef device) -{ - return get_int_property(device, CFSTR(kIOHIDVendorIDKey)); -} - -static unsigned short get_product_id(IOHIDDeviceRef device) -{ - return get_int_property(device, CFSTR(kIOHIDProductIDKey)); -} - - -static int32_t get_max_report_length(IOHIDDeviceRef device) -{ - return get_int_property(device, CFSTR(kIOHIDMaxInputReportSizeKey)); -} - -static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t *buf, size_t len) -{ - CFStringRef str = IOHIDDeviceGetProperty(device, prop); - - buf[0] = 0x0000; - - if (str) { - CFRange range; - range.location = 0; - range.length = len; - CFIndex used_buf_len; - CFStringGetBytes(str, - range, - kCFStringEncodingUTF32LE, - (char)'?', - FALSE, - (UInt8*)buf, - len, - &used_buf_len); - buf[len-1] = 0x00000000; - return used_buf_len; - } - else - return 0; - -} - -static int get_string_property_utf8(IOHIDDeviceRef device, CFStringRef prop, char *buf, size_t len) -{ - CFStringRef str = IOHIDDeviceGetProperty(device, prop); - - buf[0] = 0x0000; - - if (str) { - CFRange range; - range.location = 0; - range.length = len; - CFIndex used_buf_len; - CFStringGetBytes(str, - range, - kCFStringEncodingUTF8, - (char)'?', - FALSE, - (UInt8*)buf, - len, - &used_buf_len); - buf[len-1] = 0x00000000; - return used_buf_len; - } - else - return 0; - -} - - -static int get_serial_number(IOHIDDeviceRef device, wchar_t *buf, size_t len) -{ - return get_string_property(device, CFSTR(kIOHIDSerialNumberKey), buf, len); -} - -static int get_manufacturer_string(IOHIDDeviceRef device, wchar_t *buf, size_t len) -{ - return get_string_property(device, CFSTR(kIOHIDManufacturerKey), buf, len); -} - -static int get_product_string(IOHIDDeviceRef device, wchar_t *buf, size_t len) -{ - return get_string_property(device, CFSTR(kIOHIDProductKey), buf, len); -} - - -/* Implementation of wcsdup() for Mac. */ -static wchar_t *dup_wcs(const wchar_t *s) -{ - size_t len = wcslen(s); - wchar_t *ret = malloc((len+1)*sizeof(wchar_t)); - wcscpy(ret, s); - - return ret; -} - - -static int make_path(IOHIDDeviceRef device, char *buf, size_t len) -{ - int res; - unsigned short vid, pid; - char transport[32]; - - buf[0] = '\0'; - - res = get_string_property_utf8( - device, CFSTR(kIOHIDTransportKey), - transport, sizeof(transport)); - - if (!res) - return -1; - - vid = get_vendor_id(device); - pid = get_product_id(device); - - res = snprintf(buf, len, "%s_%04hx_%04hx_%p", - transport, vid, pid, device); - - - buf[len-1] = '\0'; - return res+1; -} - -static int init_hid_manager(void) -{ - IOReturn res; - - /* Initialize all the HID Manager Objects */ - hid_mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); - IOHIDManagerSetDeviceMatching(hid_mgr, NULL); - IOHIDManagerScheduleWithRunLoop(hid_mgr, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); - res = IOHIDManagerOpen(hid_mgr, kIOHIDOptionsTypeNone); - return (res == kIOReturnSuccess)? 0: -1; -} - -int HID_API_EXPORT hid_init(void) -{ - if (!hid_mgr) { - if (init_hid_manager() < 0) { - hid_exit(); - return -1; - } - } - return 0; -} - -int HID_API_EXPORT hid_exit(void) -{ - if (hid_mgr) { - /* Close the HID manager. */ - IOHIDManagerClose(hid_mgr, kIOHIDOptionsTypeNone); - CFRelease(hid_mgr); - hid_mgr = NULL; - } - - return 0; -} - -struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short product_id) -{ - struct hid_device_info *root = NULL; // return object - struct hid_device_info *cur_dev = NULL; - CFIndex num_devices; - int i; - - setlocale(LC_ALL,""); - - /* Set up the HID Manager if it hasn't been done */ - hid_init(); - - /* Get a list of the Devices */ - CFSetRef device_set = IOHIDManagerCopyDevices(hid_mgr); - - /* Convert the list into a C array so we can iterate easily. */ - num_devices = CFSetGetCount(device_set); - IOHIDDeviceRef *device_array = calloc(num_devices, sizeof(IOHIDDeviceRef)); - CFSetGetValues(device_set, (const void **) device_array); - - /* Iterate over each device, making an entry for it. */ - for (i = 0; i < num_devices; i++) { - unsigned short dev_vid; - unsigned short dev_pid; - #define BUF_LEN 256 - wchar_t buf[BUF_LEN]; - char cbuf[BUF_LEN]; - - IOHIDDeviceRef dev = device_array[i]; - - if (!dev) { - continue; - } - dev_vid = get_vendor_id(dev); - dev_pid = get_product_id(dev); - - /* Check the VID/PID against the arguments */ - if ((vendor_id == 0x0 && product_id == 0x0) || - (vendor_id == dev_vid && product_id == dev_pid)) { - struct hid_device_info *tmp; - size_t len; - - /* VID/PID match. Create the record. */ - tmp = malloc(sizeof(struct hid_device_info)); - if (cur_dev) { - cur_dev->next = tmp; - } - else { - root = tmp; - } - cur_dev = tmp; - - // Get the Usage Page and Usage for this device. - cur_dev->usage_page = get_int_property(dev, CFSTR(kIOHIDPrimaryUsagePageKey)); - cur_dev->usage = get_int_property(dev, CFSTR(kIOHIDPrimaryUsageKey)); - - /* Fill out the record */ - cur_dev->next = NULL; - len = make_path(dev, cbuf, sizeof(cbuf)); - cur_dev->path = strdup(cbuf); - - /* Serial Number */ - get_serial_number(dev, buf, BUF_LEN); - cur_dev->serial_number = dup_wcs(buf); - - /* Manufacturer and Product strings */ - get_manufacturer_string(dev, buf, BUF_LEN); - cur_dev->manufacturer_string = dup_wcs(buf); - get_product_string(dev, buf, BUF_LEN); - cur_dev->product_string = dup_wcs(buf); - - /* VID/PID */ - cur_dev->vendor_id = dev_vid; - cur_dev->product_id = dev_pid; - - /* Release Number */ - cur_dev->release_number = get_int_property(dev, CFSTR(kIOHIDVersionNumberKey)); - - /* Interface Number (Unsupported on Mac)*/ - cur_dev->interface_number = -1; - } - } - - free(device_array); - CFRelease(device_set); - - return root; -} - -void HID_API_EXPORT hid_free_enumeration(struct hid_device_info *devs) -{ - /* This function is identical to the Linux version. Platform independent. */ - struct hid_device_info *d = devs; - while (d) { - struct hid_device_info *next = d->next; - free(d->path); - free(d->serial_number); - free(d->manufacturer_string); - free(d->product_string); - free(d); - d = next; - } -} - -hid_device * HID_API_EXPORT hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number) -{ - /* This function is identical to the Linux version. Platform independent. */ - struct hid_device_info *devs, *cur_dev; - const char *path_to_open = NULL; - hid_device * handle = NULL; - - devs = hid_enumerate(vendor_id, product_id); - cur_dev = devs; - while (cur_dev) { - if (cur_dev->vendor_id == vendor_id && - cur_dev->product_id == product_id) { - if (serial_number) { - if (wcscmp(serial_number, cur_dev->serial_number) == 0) { - path_to_open = cur_dev->path; - break; - } - } - else { - path_to_open = cur_dev->path; - break; - } - } - cur_dev = cur_dev->next; - } - - if (path_to_open) { - /* Open the device */ - handle = hid_open_path(path_to_open); - } - - hid_free_enumeration(devs); - - return handle; -} - -static void hid_device_removal_callback(void *context, IOReturn result, - void *sender, IOHIDDeviceRef dev_ref) -{ - /* Stop the Run Loop for this device. */ - pthread_mutex_lock(&device_list_mutex); - hid_device *d = device_list; - while (d) { - if (d->device_handle == dev_ref) { - d->disconnected = 1; - CFRunLoopStop(d->run_loop); - } - - d = d->next; - } - pthread_mutex_unlock(&device_list_mutex); -} - -/* The Run Loop calls this function for each input report received. - This function puts the data into a linked list to be picked up by - hid_read(). */ -static void hid_report_callback(void *context, IOReturn result, void *sender, - IOHIDReportType report_type, uint32_t report_id, - uint8_t *report, CFIndex report_length) -{ - struct input_report *rpt; - hid_device *dev = context; - - /* Make a new Input Report object */ - rpt = calloc(1, sizeof(struct input_report)); - rpt->data = calloc(1, report_length); - memcpy(rpt->data, report, report_length); - rpt->len = report_length; - rpt->next = NULL; - - /* Lock this section */ - pthread_mutex_lock(&dev->mutex); - - /* Attach the new report object to the end of the list. */ - if (dev->input_reports == NULL) { - /* The list is empty. Put it at the root. */ - dev->input_reports = rpt; - } - else { - /* Find the end of the list and attach. */ - struct input_report *cur = dev->input_reports; - int num_queued = 0; - while (cur->next != NULL) { - cur = cur->next; - num_queued++; - } - cur->next = rpt; - - /* Pop one off if we've reached 30 in the queue. This - way we don't grow forever if the user never reads - anything from the device. */ - if (num_queued > 30) { - return_data(dev, NULL, 0); - } - } - - /* Signal a waiting thread that there is data. */ - pthread_cond_signal(&dev->condition); - - /* Unlock */ - pthread_mutex_unlock(&dev->mutex); - -} - -/* This gets called when the read_thred's run loop gets signaled by - hid_close(), and serves to stop the read_thread's run loop. */ -static void perform_signal_callback(void *context) -{ - hid_device *dev = context; - CFRunLoopStop(dev->run_loop); //TODO: CFRunLoopGetCurrent() -} - -static void *read_thread(void *param) -{ - hid_device *dev = param; - - /* Move the device's run loop to this thread. */ - IOHIDDeviceScheduleWithRunLoop(dev->device_handle, CFRunLoopGetCurrent(), dev->run_loop_mode); - - /* Create the RunLoopSource which is used to signal the - event loop to stop when hid_close() is called. */ - CFRunLoopSourceContext ctx; - memset(&ctx, 0, sizeof(ctx)); - ctx.version = 0; - ctx.info = dev; - ctx.perform = &perform_signal_callback; - dev->source = CFRunLoopSourceCreate(kCFAllocatorDefault, 0/*order*/, &ctx); - CFRunLoopAddSource(CFRunLoopGetCurrent(), dev->source, dev->run_loop_mode); - - /* Store off the Run Loop so it can be stopped from hid_close() - and on device disconnection. */ - dev->run_loop = CFRunLoopGetCurrent(); - - /* Notify the main thread that the read thread is up and running. */ - pthread_barrier_wait(&dev->barrier); - - /* Run the Event Loop. CFRunLoopRunInMode() will dispatch HID input - reports into the hid_report_callback(). */ - SInt32 code; - while (!dev->shutdown_thread && !dev->disconnected) { - code = CFRunLoopRunInMode(dev->run_loop_mode, 1000/*sec*/, FALSE); - /* Return if the device has been disconnected */ - if (code == kCFRunLoopRunFinished) { - dev->disconnected = 1; - break; - } - - - /* Break if The Run Loop returns Finished or Stopped. */ - if (code != kCFRunLoopRunTimedOut && - code != kCFRunLoopRunHandledSource) { - /* There was some kind of error. Setting - shutdown seems to make sense, but - there may be something else more appropriate */ - dev->shutdown_thread = 1; - break; - } - } - - /* Now that the read thread is stopping, Wake any threads which are - waiting on data (in hid_read_timeout()). Do this under a mutex to - make sure that a thread which is about to go to sleep waiting on - the condition acutally will go to sleep before the condition is - signaled. */ - pthread_mutex_lock(&dev->mutex); - pthread_cond_broadcast(&dev->condition); - pthread_mutex_unlock(&dev->mutex); - - /* Close the OS handle to the device, but only if it's not - been unplugged. If it's been unplugged, then calling - IOHIDDeviceClose() will crash. */ - if (!dev->disconnected) { - IOHIDDeviceClose(dev->device_handle, kIOHIDOptionsTypeNone); - } - - /* Wait here until hid_close() is called and makes it past - the call to CFRunLoopWakeUp(). This thread still needs to - be valid when that function is called on the other thread. */ - pthread_barrier_wait(&dev->shutdown_barrier); - - return NULL; -} - -hid_device * HID_API_EXPORT hid_open_path(const char *path) -{ - int i; - hid_device *dev = NULL; - CFIndex num_devices; - - dev = new_hid_device(); - - /* Set up the HID Manager if it hasn't been done */ - hid_init(); - - CFSetRef device_set = IOHIDManagerCopyDevices(hid_mgr); - - num_devices = CFSetGetCount(device_set); - IOHIDDeviceRef *device_array = calloc(num_devices, sizeof(IOHIDDeviceRef)); - CFSetGetValues(device_set, (const void **) device_array); - for (i = 0; i < num_devices; i++) { - char cbuf[BUF_LEN]; - size_t len; - IOHIDDeviceRef os_dev = device_array[i]; - - len = make_path(os_dev, cbuf, sizeof(cbuf)); - if (!strcmp(cbuf, path)) { - // Matched Paths. Open this Device. - IOReturn ret = IOHIDDeviceOpen(os_dev, kIOHIDOptionsTypeNone); - if (ret == kIOReturnSuccess) { - char str[32]; - - free(device_array); - CFRelease(device_set); - dev->device_handle = os_dev; - - /* Create the buffers for receiving data */ - dev->max_input_report_len = (CFIndex) get_max_report_length(os_dev); - dev->input_report_buf = calloc(dev->max_input_report_len, sizeof(uint8_t)); - - /* Create the Run Loop Mode for this device. - printing the reference seems to work. */ - sprintf(str, "HIDAPI_%p", os_dev); - dev->run_loop_mode = - CFStringCreateWithCString(NULL, str, kCFStringEncodingASCII); - - /* Attach the device to a Run Loop */ - IOHIDDeviceRegisterInputReportCallback( - os_dev, dev->input_report_buf, dev->max_input_report_len, - &hid_report_callback, dev); - IOHIDManagerRegisterDeviceRemovalCallback(hid_mgr, hid_device_removal_callback, NULL); - - /* Start the read thread */ - pthread_create(&dev->thread, NULL, read_thread, dev); - - /* Wait here for the read thread to be initialized. */ - pthread_barrier_wait(&dev->barrier); - - return dev; - } - else { - goto return_error; - } - } - } - -return_error: - free(device_array); - CFRelease(device_set); - free_hid_device(dev); - return NULL; -} - -static int set_report(hid_device *dev, IOHIDReportType type, const unsigned char *data, size_t length) -{ - const unsigned char *data_to_send; - size_t length_to_send; - IOReturn res; - - /* Return if the device has been disconnected. */ - if (dev->disconnected) - return -1; - - if (data[0] == 0x0) { - /* Not using numbered Reports. - Don't send the report number. */ - data_to_send = data+1; - length_to_send = length-1; - } - else { - /* Using numbered Reports. - Send the Report Number */ - data_to_send = data; - length_to_send = length; - } - - if (!dev->disconnected) { - res = IOHIDDeviceSetReport(dev->device_handle, - type, - data[0], /* Report ID*/ - data_to_send, length_to_send); - - if (res == kIOReturnSuccess) { - return length; - } - else - return -1; - } - - return -1; -} - -int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length) -{ - return set_report(dev, kIOHIDReportTypeOutput, data, length); -} - -/* Helper function, so that this isn't duplicated in hid_read(). */ -static int return_data(hid_device *dev, unsigned char *data, size_t length) -{ - /* Copy the data out of the linked list item (rpt) into the - return buffer (data), and delete the liked list item. */ - struct input_report *rpt = dev->input_reports; - size_t len = (length < rpt->len)? length: rpt->len; - memcpy(data, rpt->data, len); - dev->input_reports = rpt->next; - free(rpt->data); - free(rpt); - return len; -} - -static int cond_wait(const hid_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex) -{ - while (!dev->input_reports) { - int res = pthread_cond_wait(cond, mutex); - if (res != 0) - return res; - - /* A res of 0 means we may have been signaled or it may - be a spurious wakeup. Check to see that there's acutally - data in the queue before returning, and if not, go back - to sleep. See the pthread_cond_timedwait() man page for - details. */ - - if (dev->shutdown_thread || dev->disconnected) - return -1; - } - - return 0; -} - -static int cond_timedwait(const hid_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime) -{ - while (!dev->input_reports) { - int res = pthread_cond_timedwait(cond, mutex, abstime); - if (res != 0) - return res; - - /* A res of 0 means we may have been signaled or it may - be a spurious wakeup. Check to see that there's acutally - data in the queue before returning, and if not, go back - to sleep. See the pthread_cond_timedwait() man page for - details. */ - - if (dev->shutdown_thread || dev->disconnected) - return -1; - } - - return 0; - -} - -int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds) -{ - int bytes_read = -1; - - /* Lock the access to the report list. */ - pthread_mutex_lock(&dev->mutex); - - /* There's an input report queued up. Return it. */ - if (dev->input_reports) { - /* Return the first one */ - bytes_read = return_data(dev, data, length); - goto ret; - } - - /* Return if the device has been disconnected. */ - if (dev->disconnected) { - bytes_read = -1; - goto ret; - } - - if (dev->shutdown_thread) { - /* This means the device has been closed (or there - has been an error. An error code of -1 should - be returned. */ - bytes_read = -1; - goto ret; - } - - /* There is no data. Go to sleep and wait for data. */ - - if (milliseconds == -1) { - /* Blocking */ - int res; - res = cond_wait(dev, &dev->condition, &dev->mutex); - if (res == 0) - bytes_read = return_data(dev, data, length); - else { - /* There was an error, or a device disconnection. */ - bytes_read = -1; - } - } - else if (milliseconds > 0) { - /* Non-blocking, but called with timeout. */ - int res; - struct timespec ts; - struct timeval tv; - gettimeofday(&tv, NULL); - TIMEVAL_TO_TIMESPEC(&tv, &ts); - ts.tv_sec += milliseconds / 1000; - ts.tv_nsec += (milliseconds % 1000) * 1000000; - if (ts.tv_nsec >= 1000000000L) { - ts.tv_sec++; - ts.tv_nsec -= 1000000000L; - } - - res = cond_timedwait(dev, &dev->condition, &dev->mutex, &ts); - if (res == 0) - bytes_read = return_data(dev, data, length); - else if (res == ETIMEDOUT) - bytes_read = 0; - else - bytes_read = -1; - } - else { - /* Purely non-blocking */ - bytes_read = 0; - } - -ret: - /* Unlock */ - pthread_mutex_unlock(&dev->mutex); - return bytes_read; -} - -int HID_API_EXPORT hid_read(hid_device *dev, unsigned char *data, size_t length) -{ - return hid_read_timeout(dev, data, length, (dev->blocking)? -1: 0); -} - -int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock) -{ - /* All Nonblocking operation is handled by the library. */ - dev->blocking = !nonblock; - - return 0; -} - -int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length) -{ - return set_report(dev, kIOHIDReportTypeFeature, data, length); -} - -int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length) -{ - CFIndex len = length; - IOReturn res; - - /* Return if the device has been unplugged. */ - if (dev->disconnected) - return -1; - - res = IOHIDDeviceGetReport(dev->device_handle, - kIOHIDReportTypeFeature, - data[0], /* Report ID */ - data, &len); - if (res == kIOReturnSuccess) - return len; - else - return -1; -} - - -void HID_API_EXPORT hid_close(hid_device *dev) -{ - if (!dev) - return; - - /* Disconnect the report callback before close. */ - if (!dev->disconnected) { - IOHIDDeviceRegisterInputReportCallback( - dev->device_handle, dev->input_report_buf, dev->max_input_report_len, - NULL, dev); - IOHIDManagerRegisterDeviceRemovalCallback(hid_mgr, NULL, dev); - IOHIDDeviceUnscheduleFromRunLoop(dev->device_handle, dev->run_loop, dev->run_loop_mode); - IOHIDDeviceScheduleWithRunLoop(dev->device_handle, CFRunLoopGetMain(), kCFRunLoopDefaultMode); - } - - /* Cause read_thread() to stop. */ - dev->shutdown_thread = 1; - - /* Wake up the run thread's event loop so that the thread can exit. */ - CFRunLoopSourceSignal(dev->source); - CFRunLoopWakeUp(dev->run_loop); - - /* Notify the read thread that it can shut down now. */ - pthread_barrier_wait(&dev->shutdown_barrier); - - /* Wait for read_thread() to end. */ - pthread_join(dev->thread, NULL); - - /* Close the OS handle to the device, but only if it's not - been unplugged. If it's been unplugged, then calling - IOHIDDeviceClose() will crash. */ - if (!dev->disconnected) { - IOHIDDeviceClose(dev->device_handle, kIOHIDOptionsTypeNone); - } - - /* Clear out the queue of received reports. */ - pthread_mutex_lock(&dev->mutex); - while (dev->input_reports) { - return_data(dev, NULL, 0); - } - pthread_mutex_unlock(&dev->mutex); - - free_hid_device(dev); -} - -int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen) -{ - return get_manufacturer_string(dev->device_handle, string, maxlen); -} - -int HID_API_EXPORT_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen) -{ - return get_product_string(dev->device_handle, string, maxlen); -} - -int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen) -{ - return get_serial_number(dev->device_handle, string, maxlen); -} - -int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen) -{ - // TODO: - - return 0; -} - - -HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev) -{ - // TODO: - - return NULL; -} - - - - - - -#if 0 -static int32_t get_location_id(IOHIDDeviceRef device) -{ - return get_int_property(device, CFSTR(kIOHIDLocationIDKey)); -} - -static int32_t get_usage(IOHIDDeviceRef device) -{ - int32_t res; - res = get_int_property(device, CFSTR(kIOHIDDeviceUsageKey)); - if (!res) - res = get_int_property(device, CFSTR(kIOHIDPrimaryUsageKey)); - return res; -} - -static int32_t get_usage_page(IOHIDDeviceRef device) -{ - int32_t res; - res = get_int_property(device, CFSTR(kIOHIDDeviceUsagePageKey)); - if (!res) - res = get_int_property(device, CFSTR(kIOHIDPrimaryUsagePageKey)); - return res; -} - -static int get_transport(IOHIDDeviceRef device, wchar_t *buf, size_t len) -{ - return get_string_property(device, CFSTR(kIOHIDTransportKey), buf, len); -} - - -int main(void) -{ - IOHIDManagerRef mgr; - int i; - - mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); - IOHIDManagerSetDeviceMatching(mgr, NULL); - IOHIDManagerOpen(mgr, kIOHIDOptionsTypeNone); - - CFSetRef device_set = IOHIDManagerCopyDevices(mgr); - - CFIndex num_devices = CFSetGetCount(device_set); - IOHIDDeviceRef *device_array = calloc(num_devices, sizeof(IOHIDDeviceRef)); - CFSetGetValues(device_set, (const void **) device_array); - - setlocale(LC_ALL, ""); - - for (i = 0; i < num_devices; i++) { - IOHIDDeviceRef dev = device_array[i]; - printf("Device: %p\n", dev); - printf(" %04hx %04hx\n", get_vendor_id(dev), get_product_id(dev)); - - wchar_t serial[256], buf[256]; - char cbuf[256]; - get_serial_number(dev, serial, 256); - - - printf(" Serial: %ls\n", serial); - printf(" Loc: %ld\n", get_location_id(dev)); - get_transport(dev, buf, 256); - printf(" Trans: %ls\n", buf); - make_path(dev, cbuf, 256); - printf(" Path: %s\n", cbuf); - - } - - return 0; -} -#endif diff --git a/gr-fcd/lib/hid/hidwin.c b/gr-fcd/lib/hid/hidwin.c deleted file mode 100644 index 5d34aadf4..000000000 --- a/gr-fcd/lib/hid/hidwin.c +++ /dev/null @@ -1,873 +0,0 @@ -/******************************************************* - HIDAPI - Multi-Platform library for - communication with HID devices. - - Alan Ott - Signal 11 Software - - 8/22/2009 - - Copyright 2009, All Rights Reserved. - - At the discretion of the user of this library, - this software may be licensed under the terms of the - GNU Public License v3, a BSD-Style license, or the - original HIDAPI license as outlined in the LICENSE.txt, - LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt - files located at the root of the source distribution. - These files may also be found in the public source - code repository located at: - http://github.com/signal11/hidapi . -********************************************************/ - -#include <windows.h> - -#ifndef _NTDEF_ -typedef LONG NTSTATUS; -#endif - -#ifdef __MINGW32__ -#include <ntdef.h> -#include <winbase.h> -#endif - -#ifdef __CYGWIN__ -#include <ntdef.h> -#define _wcsdup wcsdup -#endif - -//#define HIDAPI_USE_DDK - -#ifdef __cplusplus -extern "C" { -#endif - #include <setupapi.h> - #include <winioctl.h> - #ifdef HIDAPI_USE_DDK - #include <hidsdi.h> - #endif - - // Copied from inc/ddk/hidclass.h, part of the Windows DDK. - #define HID_OUT_CTL_CODE(id) \ - CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS) - #define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100) - -#ifdef __cplusplus -} // extern "C" -#endif - -#include <stdio.h> -#include <stdlib.h> - - -#include "hidapi.h" - -#ifdef _MSC_VER - // Thanks Microsoft, but I know how to use strncpy(). - #pragma warning(disable:4996) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef HIDAPI_USE_DDK - // Since we're not building with the DDK, and the HID header - // files aren't part of the SDK, we have to define all this - // stuff here. In lookup_functions(), the function pointers - // defined below are set. - typedef struct _HIDD_ATTRIBUTES{ - ULONG Size; - USHORT VendorID; - USHORT ProductID; - USHORT VersionNumber; - } HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES; - - typedef USHORT USAGE; - typedef struct _HIDP_CAPS { - USAGE Usage; - USAGE UsagePage; - USHORT InputReportByteLength; - USHORT OutputReportByteLength; - USHORT FeatureReportByteLength; - USHORT Reserved[17]; - USHORT fields_not_used_by_hidapi[10]; - } HIDP_CAPS, *PHIDP_CAPS; - typedef char* HIDP_PREPARSED_DATA; - #define HIDP_STATUS_SUCCESS 0x0 - - typedef BOOLEAN (__stdcall *HidD_GetAttributes_)(HANDLE device, PHIDD_ATTRIBUTES attrib); - typedef BOOLEAN (__stdcall *HidD_GetSerialNumberString_)(HANDLE device, PVOID buffer, ULONG buffer_len); - typedef BOOLEAN (__stdcall *HidD_GetManufacturerString_)(HANDLE handle, PVOID buffer, ULONG buffer_len); - typedef BOOLEAN (__stdcall *HidD_GetProductString_)(HANDLE handle, PVOID buffer, ULONG buffer_len); - typedef BOOLEAN (__stdcall *HidD_SetFeature_)(HANDLE handle, PVOID data, ULONG length); - typedef BOOLEAN (__stdcall *HidD_GetFeature_)(HANDLE handle, PVOID data, ULONG length); - typedef BOOLEAN (__stdcall *HidD_GetIndexedString_)(HANDLE handle, ULONG string_index, PVOID buffer, ULONG buffer_len); - typedef BOOLEAN (__stdcall *HidD_GetPreparsedData_)(HANDLE handle, HIDP_PREPARSED_DATA **preparsed_data); - typedef BOOLEAN (__stdcall *HidD_FreePreparsedData_)(HIDP_PREPARSED_DATA *preparsed_data); - typedef BOOLEAN (__stdcall *HidP_GetCaps_)(HIDP_PREPARSED_DATA *preparsed_data, HIDP_CAPS *caps); - - static HidD_GetAttributes_ HidD_GetAttributes; - static HidD_GetSerialNumberString_ HidD_GetSerialNumberString; - static HidD_GetManufacturerString_ HidD_GetManufacturerString; - static HidD_GetProductString_ HidD_GetProductString; - static HidD_SetFeature_ HidD_SetFeature; - static HidD_GetFeature_ HidD_GetFeature; - static HidD_GetIndexedString_ HidD_GetIndexedString; - static HidD_GetPreparsedData_ HidD_GetPreparsedData; - static HidD_FreePreparsedData_ HidD_FreePreparsedData; - static HidP_GetCaps_ HidP_GetCaps; - - static HMODULE lib_handle = NULL; - static BOOLEAN initialized = FALSE; -#endif // HIDAPI_USE_DDK - -struct hid_device_ { - HANDLE device_handle; - BOOL blocking; - size_t input_report_length; - void *last_error_str; - DWORD last_error_num; - BOOL read_pending; - char *read_buf; - OVERLAPPED ol; -}; - -static hid_device *new_hid_device() -{ - hid_device *dev = (hid_device*) calloc(1, sizeof(hid_device)); - dev->device_handle = INVALID_HANDLE_VALUE; - dev->blocking = TRUE; - dev->input_report_length = 0; - dev->last_error_str = NULL; - dev->last_error_num = 0; - dev->read_pending = FALSE; - dev->read_buf = NULL; - memset(&dev->ol, 0, sizeof(dev->ol)); - dev->ol.hEvent = CreateEvent(NULL, FALSE, FALSE /*inital state f=nonsignaled*/, NULL); - - return dev; -} - - -static void register_error(hid_device *device, const char *op) -{ - WCHAR *ptr, *msg; - - FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPWSTR)&msg, 0/*sz*/, - NULL); - - // Get rid of the CR and LF that FormatMessage() sticks at the - // end of the message. Thanks Microsoft! - ptr = msg; - while (*ptr) { - if (*ptr == '\r') { - *ptr = 0x0000; - break; - } - ptr++; - } - - // Store the message off in the Device entry so that - // the hid_error() function can pick it up. - LocalFree(device->last_error_str); - device->last_error_str = msg; -} - -#ifndef HIDAPI_USE_DDK -static int lookup_functions() -{ - lib_handle = LoadLibraryA("hid.dll"); - if (lib_handle) { -#define RESOLVE(x) x = (x##_)GetProcAddress(lib_handle, #x); if (!x) return -1; - RESOLVE(HidD_GetAttributes); - RESOLVE(HidD_GetSerialNumberString); - RESOLVE(HidD_GetManufacturerString); - RESOLVE(HidD_GetProductString); - RESOLVE(HidD_SetFeature); - RESOLVE(HidD_GetFeature); - RESOLVE(HidD_GetIndexedString); - RESOLVE(HidD_GetPreparsedData); - RESOLVE(HidD_FreePreparsedData); - RESOLVE(HidP_GetCaps); -#undef RESOLVE - } - else - return -1; - - return 0; -} -#endif - -static HANDLE open_device(const char *path) -{ - HANDLE handle; - - /* First, try to open with sharing mode turned off. This will make it so - that a HID device can only be opened once. This is to be consistent - with the behavior on the other platforms. */ - handle = CreateFileA(path, - GENERIC_WRITE |GENERIC_READ, - 0, /*share mode*/ - NULL, - OPEN_EXISTING, - FILE_FLAG_OVERLAPPED,//FILE_ATTRIBUTE_NORMAL, - 0); - - if (handle == INVALID_HANDLE_VALUE) { - /* Couldn't open the device. Some devices must be opened - with sharing enabled (even though they are only opened once), - so try it here. */ - handle = CreateFileA(path, - GENERIC_WRITE |GENERIC_READ, - FILE_SHARE_READ|FILE_SHARE_WRITE, /*share mode*/ - NULL, - OPEN_EXISTING, - FILE_FLAG_OVERLAPPED,//FILE_ATTRIBUTE_NORMAL, - 0); - } - - return handle; -} - -int HID_API_EXPORT hid_init(void) -{ -#ifndef HIDAPI_USE_DDK - if (!initialized) { - if (lookup_functions() < 0) { - hid_exit(); - return -1; - } - initialized = TRUE; - } -#endif - return 0; -} - -int HID_API_EXPORT hid_exit(void) -{ -#ifndef HIDAPI_USE_DDK - if (lib_handle) - FreeLibrary(lib_handle); - lib_handle = NULL; - initialized = FALSE; -#endif - return 0; -} - -struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id) -{ - BOOL res; - struct hid_device_info *root = NULL; // return object - struct hid_device_info *cur_dev = NULL; - - // Windows objects for interacting with the driver. - GUID InterfaceClassGuid = {0x4d1e55b2, 0xf16f, 0x11cf, {0x88, 0xcb, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30} }; - SP_DEVINFO_DATA devinfo_data; - SP_DEVICE_INTERFACE_DATA device_interface_data; - SP_DEVICE_INTERFACE_DETAIL_DATA_A *device_interface_detail_data = NULL; - HDEVINFO device_info_set = INVALID_HANDLE_VALUE; - int device_index = 0; - - if (hid_init() < 0) - return NULL; - - // Initialize the Windows objects. - devinfo_data.cbSize = sizeof(SP_DEVINFO_DATA); - device_interface_data.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA); - - // Get information for all the devices belonging to the HID class. - device_info_set = SetupDiGetClassDevsA(&InterfaceClassGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); - - // Iterate over each device in the HID class, looking for the right one. - - for (;;) { - HANDLE write_handle = INVALID_HANDLE_VALUE; - DWORD required_size = 0; - HIDD_ATTRIBUTES attrib; - - res = SetupDiEnumDeviceInterfaces(device_info_set, - NULL, - &InterfaceClassGuid, - device_index, - &device_interface_data); - - if (!res) { - // A return of FALSE from this function means that - // there are no more devices. - break; - } - - // Call with 0-sized detail size, and let the function - // tell us how long the detail struct needs to be. The - // size is put in &required_size. - res = SetupDiGetDeviceInterfaceDetailA(device_info_set, - &device_interface_data, - NULL, - 0, - &required_size, - NULL); - - // Allocate a long enough structure for device_interface_detail_data. - device_interface_detail_data = (SP_DEVICE_INTERFACE_DETAIL_DATA_A*) malloc(required_size); - device_interface_detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A); - - // Get the detailed data for this device. The detail data gives us - // the device path for this device, which is then passed into - // CreateFile() to get a handle to the device. - res = SetupDiGetDeviceInterfaceDetailA(device_info_set, - &device_interface_data, - device_interface_detail_data, - required_size, - NULL, - NULL); - - if (!res) { - //register_error(dev, "Unable to call SetupDiGetDeviceInterfaceDetail"); - // Continue to the next device. - goto cont; - } - - //wprintf(L"HandleName: %s\n", device_interface_detail_data->DevicePath); - - // Open a handle to the device - write_handle = open_device(device_interface_detail_data->DevicePath); - - // Check validity of write_handle. - if (write_handle == INVALID_HANDLE_VALUE) { - // Unable to open the device. - //register_error(dev, "CreateFile"); - goto cont_close; - } - - - // Get the Vendor ID and Product ID for this device. - attrib.Size = sizeof(HIDD_ATTRIBUTES); - HidD_GetAttributes(write_handle, &attrib); - //wprintf(L"Product/Vendor: %x %x\n", attrib.ProductID, attrib.VendorID); - - // Check the VID/PID to see if we should add this - // device to the enumeration list. - if ((vendor_id == 0x0 && product_id == 0x0) || - (attrib.VendorID == vendor_id && attrib.ProductID == product_id)) { - - #define WSTR_LEN 512 - const char *str; - struct hid_device_info *tmp; - HIDP_PREPARSED_DATA *pp_data = NULL; - HIDP_CAPS caps; - BOOLEAN res; - NTSTATUS nt_res; - wchar_t wstr[WSTR_LEN]; // TODO: Determine Size - size_t len; - - /* VID/PID match. Create the record. */ - tmp = (struct hid_device_info*) calloc(1, sizeof(struct hid_device_info)); - if (cur_dev) { - cur_dev->next = tmp; - } - else { - root = tmp; - } - cur_dev = tmp; - - // Get the Usage Page and Usage for this device. - res = HidD_GetPreparsedData(write_handle, &pp_data); - if (res) { - nt_res = HidP_GetCaps(pp_data, &caps); - if (nt_res == HIDP_STATUS_SUCCESS) { - cur_dev->usage_page = caps.UsagePage; - cur_dev->usage = caps.Usage; - } - - HidD_FreePreparsedData(pp_data); - } - - /* Fill out the record */ - cur_dev->next = NULL; - str = device_interface_detail_data->DevicePath; - if (str) { - len = strlen(str); - cur_dev->path = (char*) calloc(len+1, sizeof(char)); - strncpy(cur_dev->path, str, len+1); - cur_dev->path[len] = '\0'; - } - else - cur_dev->path = NULL; - - /* Serial Number */ - res = HidD_GetSerialNumberString(write_handle, wstr, sizeof(wstr)); - wstr[WSTR_LEN-1] = 0x0000; - if (res) { - cur_dev->serial_number = _wcsdup(wstr); - } - - /* Manufacturer String */ - res = HidD_GetManufacturerString(write_handle, wstr, sizeof(wstr)); - wstr[WSTR_LEN-1] = 0x0000; - if (res) { - cur_dev->manufacturer_string = _wcsdup(wstr); - } - - /* Product String */ - res = HidD_GetProductString(write_handle, wstr, sizeof(wstr)); - wstr[WSTR_LEN-1] = 0x0000; - if (res) { - cur_dev->product_string = _wcsdup(wstr); - } - - /* VID/PID */ - cur_dev->vendor_id = attrib.VendorID; - cur_dev->product_id = attrib.ProductID; - - /* Release Number */ - cur_dev->release_number = attrib.VersionNumber; - - /* Interface Number. It can sometimes be parsed out of the path - on Windows if a device has multiple interfaces. See - http://msdn.microsoft.com/en-us/windows/hardware/gg487473 or - search for "Hardware IDs for HID Devices" at MSDN. If it's not - in the path, it's set to -1. */ - cur_dev->interface_number = -1; - if (cur_dev->path) { - char *interface_component = strstr(cur_dev->path, "&mi_"); - if (interface_component) { - char *hex_str = interface_component + 4; - char *endptr = NULL; - cur_dev->interface_number = strtol(hex_str, &endptr, 16); - if (endptr == hex_str) { - /* The parsing failed. Set interface_number to -1. */ - cur_dev->interface_number = -1; - } - } - } - } - -cont_close: - CloseHandle(write_handle); -cont: - // We no longer need the detail data. It can be freed - free(device_interface_detail_data); - - device_index++; - - } - - // Close the device information handle. - SetupDiDestroyDeviceInfoList(device_info_set); - - return root; - -} - -void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs) -{ - // TODO: Merge this with the Linux version. This function is platform-independent. - struct hid_device_info *d = devs; - while (d) { - struct hid_device_info *next = d->next; - free(d->path); - free(d->serial_number); - free(d->manufacturer_string); - free(d->product_string); - free(d); - d = next; - } -} - - -HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number) -{ - // TODO: Merge this functions with the Linux version. This function should be platform independent. - struct hid_device_info *devs, *cur_dev; - const char *path_to_open = NULL; - hid_device *handle = NULL; - - devs = hid_enumerate(vendor_id, product_id); - cur_dev = devs; - while (cur_dev) { - if (cur_dev->vendor_id == vendor_id && - cur_dev->product_id == product_id) { - if (serial_number) { - if (wcscmp(serial_number, cur_dev->serial_number) == 0) { - path_to_open = cur_dev->path; - break; - } - } - else { - path_to_open = cur_dev->path; - break; - } - } - cur_dev = cur_dev->next; - } - - if (path_to_open) { - /* Open the device */ - handle = hid_open_path(path_to_open); - } - - hid_free_enumeration(devs); - - return handle; -} - -HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path) -{ - hid_device *dev; - HIDP_CAPS caps; - HIDP_PREPARSED_DATA *pp_data = NULL; - BOOLEAN res; - NTSTATUS nt_res; - - if (hid_init() < 0) { - return NULL; - } - - dev = new_hid_device(); - - // Open a handle to the device - dev->device_handle = open_device(path); - - // Check validity of write_handle. - if (dev->device_handle == INVALID_HANDLE_VALUE) { - // Unable to open the device. - register_error(dev, "CreateFile"); - goto err; - } - - // Get the Input Report length for the device. - res = HidD_GetPreparsedData(dev->device_handle, &pp_data); - if (!res) { - register_error(dev, "HidD_GetPreparsedData"); - goto err; - } - nt_res = HidP_GetCaps(pp_data, &caps); - if (nt_res != HIDP_STATUS_SUCCESS) { - register_error(dev, "HidP_GetCaps"); - goto err_pp_data; - } - dev->input_report_length = caps.InputReportByteLength; - HidD_FreePreparsedData(pp_data); - - dev->read_buf = (char*) malloc(dev->input_report_length); - - return dev; - -err_pp_data: - HidD_FreePreparsedData(pp_data); -err: - CloseHandle(dev->device_handle); - free(dev); - return NULL; -} - -int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *data, size_t length) -{ - DWORD bytes_written; - BOOL res; - - OVERLAPPED ol; - memset(&ol, 0, sizeof(ol)); - - res = WriteFile(dev->device_handle, data, length, NULL, &ol); - - if (!res) { - if (GetLastError() != ERROR_IO_PENDING) { - // WriteFile() failed. Return error. - register_error(dev, "WriteFile"); - return -1; - } - } - - // Wait here until the write is done. This makes - // hid_write() synchronous. - res = GetOverlappedResult(dev->device_handle, &ol, &bytes_written, TRUE/*wait*/); - if (!res) { - // The Write operation failed. - register_error(dev, "WriteFile"); - return -1; - } - - return bytes_written; -} - - -int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds) -{ - DWORD bytes_read = 0; - BOOL res; - - // Copy the handle for convenience. - HANDLE ev = dev->ol.hEvent; - - if (!dev->read_pending) { - // Start an Overlapped I/O read. - dev->read_pending = TRUE; - ResetEvent(ev); - res = ReadFile(dev->device_handle, dev->read_buf, dev->input_report_length, &bytes_read, &dev->ol); - - if (!res) { - if (GetLastError() != ERROR_IO_PENDING) { - // ReadFile() has failed. - // Clean up and return error. - CancelIo(dev->device_handle); - dev->read_pending = FALSE; - goto end_of_function; - } - } - } - - if (milliseconds >= 0) { - // See if there is any data yet. - res = WaitForSingleObject(ev, milliseconds); - if (res != WAIT_OBJECT_0) { - // There was no data this time. Return zero bytes available, - // but leave the Overlapped I/O running. - return 0; - } - } - - // Either WaitForSingleObject() told us that ReadFile has completed, or - // we are in non-blocking mode. Get the number of bytes read. The actual - // data has been copied to the data[] array which was passed to ReadFile(). - res = GetOverlappedResult(dev->device_handle, &dev->ol, &bytes_read, TRUE/*wait*/); - - // Set pending back to false, even if GetOverlappedResult() returned error. - dev->read_pending = FALSE; - - if (res && bytes_read > 0) { - if (dev->read_buf[0] == 0x0) { - /* If report numbers aren't being used, but Windows sticks a report - number (0x0) on the beginning of the report anyway. To make this - work like the other platforms, and to make it work more like the - HID spec, we'll skip over this byte. */ - bytes_read--; - memcpy(data, dev->read_buf+1, length); - } - else { - /* Copy the whole buffer, report number and all. */ - memcpy(data, dev->read_buf, length); - } - } - -end_of_function: - if (!res) { - register_error(dev, "GetOverlappedResult"); - return -1; - } - - return bytes_read; -} - -int HID_API_EXPORT HID_API_CALL hid_read(hid_device *dev, unsigned char *data, size_t length) -{ - return hid_read_timeout(dev, data, length, (dev->blocking)? -1: 0); -} - -int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *dev, int nonblock) -{ - dev->blocking = !nonblock; - return 0; /* Success */ -} - -int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length) -{ - BOOL res = HidD_SetFeature(dev->device_handle, (PVOID)data, length); - if (!res) { - register_error(dev, "HidD_SetFeature"); - return -1; - } - - return length; -} - - -int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length) -{ - BOOL res; -#if 0 - res = HidD_GetFeature(dev->device_handle, data, length); - if (!res) { - register_error(dev, "HidD_GetFeature"); - return -1; - } - return 0; /* HidD_GetFeature() doesn't give us an actual length, unfortunately */ -#else - DWORD bytes_returned; - - OVERLAPPED ol; - memset(&ol, 0, sizeof(ol)); - - res = DeviceIoControl(dev->device_handle, - IOCTL_HID_GET_FEATURE, - data, length, - data, length, - &bytes_returned, &ol); - - if (!res) { - if (GetLastError() != ERROR_IO_PENDING) { - // DeviceIoControl() failed. Return error. - register_error(dev, "Send Feature Report DeviceIoControl"); - return -1; - } - } - - // Wait here until the write is done. This makes - // hid_get_feature_report() synchronous. - res = GetOverlappedResult(dev->device_handle, &ol, &bytes_returned, TRUE/*wait*/); - if (!res) { - // The operation failed. - register_error(dev, "Send Feature Report GetOverLappedResult"); - return -1; - } - return bytes_returned; -#endif -} - -void HID_API_EXPORT HID_API_CALL hid_close(hid_device *dev) -{ - if (!dev) - return; - CancelIo(dev->device_handle); - CloseHandle(dev->ol.hEvent); - CloseHandle(dev->device_handle); - LocalFree(dev->last_error_str); - free(dev->read_buf); - free(dev); -} - -int HID_API_EXPORT_CALL HID_API_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen) -{ - BOOL res; - - res = HidD_GetManufacturerString(dev->device_handle, string, 2 * maxlen); - if (!res) { - register_error(dev, "HidD_GetManufacturerString"); - return -1; - } - - return 0; -} - -int HID_API_EXPORT_CALL HID_API_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen) -{ - BOOL res; - - res = HidD_GetProductString(dev->device_handle, string, 2 * maxlen); - if (!res) { - register_error(dev, "HidD_GetProductString"); - return -1; - } - - return 0; -} - -int HID_API_EXPORT_CALL HID_API_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen) -{ - BOOL res; - - res = HidD_GetSerialNumberString(dev->device_handle, string, 2 * maxlen); - if (!res) { - register_error(dev, "HidD_GetSerialNumberString"); - return -1; - } - - return 0; -} - -int HID_API_EXPORT_CALL HID_API_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen) -{ - BOOL res; - - res = HidD_GetIndexedString(dev->device_handle, string_index, string, 2 * maxlen); - if (!res) { - register_error(dev, "HidD_GetIndexedString"); - return -1; - } - - return 0; -} - - -HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev) -{ - return (wchar_t*)dev->last_error_str; -} - - -//#define PICPGM -//#define S11 -#define P32 -#ifdef S11 - unsigned short VendorID = 0xa0a0; - unsigned short ProductID = 0x0001; -#endif - -#ifdef P32 - unsigned short VendorID = 0x04d8; - unsigned short ProductID = 0x3f; -#endif - - -#ifdef PICPGM - unsigned short VendorID = 0x04d8; - unsigned short ProductID = 0x0033; -#endif - - -#if 0 -int __cdecl main(int argc, char* argv[]) -{ - int res; - unsigned char buf[65]; - - UNREFERENCED_PARAMETER(argc); - UNREFERENCED_PARAMETER(argv); - - // Set up the command buffer. - memset(buf,0x00,sizeof(buf)); - buf[0] = 0; - buf[1] = 0x81; - - - // Open the device. - int handle = open(VendorID, ProductID, L"12345"); - if (handle < 0) - printf("unable to open device\n"); - - - // Toggle LED (cmd 0x80) - buf[1] = 0x80; - res = write(handle, buf, 65); - if (res < 0) - printf("Unable to write()\n"); - - // Request state (cmd 0x81) - buf[1] = 0x81; - write(handle, buf, 65); - if (res < 0) - printf("Unable to write() (2)\n"); - - // Read requested state - read(handle, buf, 65); - if (res < 0) - printf("Unable to read()\n"); - - // Print out the returned buffer. - for (int i = 0; i < 4; i++) - printf("buf[%d]: %d\n", i, buf[i]); - - return 0; -} -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/gr-fcd/python/CMakeLists.txt b/gr-fcd/python/CMakeLists.txt deleted file mode 100644 index 39ec5efe9..000000000 --- a/gr-fcd/python/CMakeLists.txt +++ /dev/null @@ -1,47 +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. - -######################################################################## -include(GrPython) - -GR_PYTHON_INSTALL( - FILES - __init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/fcd - COMPONENT "fcd_python" -) - -######################################################################## -# Handle the unit tests -######################################################################## -if(ENABLE_TESTING) - -list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-fcd/python - ${CMAKE_BINARY_DIR}/gr-fcd/swig -) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-audio gnuradio-fcd) - -include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) -endif(ENABLE_TESTING) diff --git a/gr-fcd/python/__init__.py b/gr-fcd/python/__init__.py deleted file mode 100644 index daf9c890d..000000000 --- a/gr-fcd/python/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2011 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 is the gr-fcd package. This package provides a GNU Radio -source block for the FunCube Dongle hardware. -''' - -from fcd_swig import * - diff --git a/gr-fcd/python/qa_fcd.py b/gr-fcd/python/qa_fcd.py deleted file mode 100755 index 0993cab42..000000000 --- a/gr-fcd/python/qa_fcd.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import fcd_swig - -class test_fcd(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test_000_nop (self): - """Just see if we can import the module...""" - pass - -if __name__ == '__main__': - gr_unittest.run(test_fcd, "test_fcd.xml") diff --git a/gr-fcd/python/run_tests.in b/gr-fcd/python/run_tests.in deleted file mode 100644 index 4d28c1522..000000000 --- a/gr-fcd/python/run_tests.in +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# 1st parameter is absolute path to component source directory -# 2nd parameter is absolute path to component build directory -# 3rd parameter is path to Python QA directory - -@top_builddir@/run_tests.sh \ - @abs_top_srcdir@/gr-fcd \ - @abs_top_builddir@/gr-fcd \ - @srcdir@ diff --git a/gr-fcd/swig/CMakeLists.txt b/gr-fcd/swig/CMakeLists.txt deleted file mode 100644 index c170f3f66..000000000 --- a/gr-fcd/swig/CMakeLists.txt +++ /dev/null @@ -1,55 +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. - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -#set(GR_SWIG_FLAGS -DGR_HAVE_FCD) #needed to parse fcd_swig.i - -set(GR_SWIG_INCLUDE_DIRS - ${GR_FCD_INCLUDE_DIRS} - ${GR_AUDIO_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/fcd_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib) - -set(GR_SWIG_LIBRARIES gnuradio-fcd) - -GR_SWIG_MAKE(fcd_swig fcd_swig.i) - -GR_SWIG_INSTALL( - TARGETS fcd_swig - DESTINATION ${GR_PYTHON_DIR}/gnuradio/fcd - COMPONENT "fcd_python" -) - -install( - FILES - fcd_swig.i - ${CMAKE_CURRENT_BINARY_DIR}/fcd_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "fcd_swig" -) diff --git a/gr-fcd/swig/fcd_swig.i b/gr-fcd/swig/fcd_swig.i deleted file mode 100644 index f4ad1b320..000000000 --- a/gr-fcd/swig/fcd_swig.i +++ /dev/null @@ -1,40 +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. - */ - -#define FCD_API - -//suppress 319. No access specifier given for base class name (ignored). -#pragma SWIG nowarn=319 - -%include "gnuradio.i" - -//load generated python docstrings -%include "fcd_swig_doc.i" - -%{ -#include "fcd_source_c.h" -%} - -%include "fcd_source_c.h" - -GR_SWIG_BLOCK_MAGIC(fcd,source_c); -fcd_source_c_sptr fcd_make_source_c (const std::string device_name = ""); diff --git a/gr-noaa/CMakeLists.txt b/gr-noaa/CMakeLists.txt deleted file mode 100644 index 09ce2a329..000000000 --- a/gr-noaa/CMakeLists.txt +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) -GR_REGISTER_COMPONENT("gr-noaa" ENABLE_GR_NOAA - Boost_FOUND - ENABLE_GR_CORE -) - -GR_SET_GLOBAL(GR_NOAA_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/lib -) - -SET(GR_PKG_NOAA_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/noaa) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_NOAA) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_NOAA_DESCRIPTION "GNU Radio NOAA Blocks") - -CPACK_COMPONENT("noaa_runtime" - GROUP "NOAA" - DISPLAY_NAME "Runtime" - DESCRIPTION "Runtime" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("noaa_devel" - GROUP "NOAA" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("noaa_python" - GROUP "NOAA" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime; GRC xml files" - DEPENDS "core_python;noaa_runtime" -) - -CPACK_COMPONENT("noaa_swig" - GROUP "NOAA" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;noaa_python;noaa_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(lib) -if(ENABLE_PYTHON) - add_subdirectory(swig) - add_subdirectory(grc) - add_subdirectory(examples) -endif(ENABLE_PYTHON) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-noaa.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-noaa.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-noaa.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "noaa_devel" -) - -endif(ENABLE_GR_NOAA) diff --git a/gr-noaa/README b/gr-noaa/README deleted file mode 100644 index f00d2d28d..000000000 --- a/gr-noaa/README +++ /dev/null @@ -1,70 +0,0 @@ -This component implements an NOAA POES HRPT receiver. After installation, -the scripts described below will be install in the users PATH. - -As the scripts are generated using GRC, GRC must be installed at runtime -in order for them to operate. - - -HRPT OPERATION - -usrp_rx_hrpt.py ---------------- - -This GUI script will receive HRPT RF, demodulate, synchronize, and deframe -HRPT minor frames into a file. The file stores a series of 11090 word, -16-bits per word corresponding to the HRPT minor frame format (only the -lower 10-bits per word are significant.) - -The script file by default uses USRP side A, 1698 MHz, at decimation 16. The -gnuradio configuration file ~/.gnuradio/config.conf, section 'usrp_rx_hrpt.cfg', -will allow changing this, as well as implementing persistent storage of GUI -entered parameters from invocation to invocation. - -The present HRPT demodulator is only tested at decimation 16. The only other -valid decimation rates are 24 and 32, which may work but with more bit -errors. No other decimation rates will work. - - -file_rx_hrpt.py ---------------- - -This GUI script operates like usrp_rx_hrpt.py, but reads from a pre-captured -data file supplied by -F on the command line. - - -usrp_rx_hrpt_nogui.py ---------------------- - -This non-GUI script operates without a display and requires that all parameters -be set in the configuration file prior to running. It has no command-line -parameters, and works identically to the GUI scripts. - - -hrpt_demod_file.py ------------------- - -This non-GUI script will operate on a file generated with -usrp_rx_cfile.py and output frames in the same format as above. It does -*not* use the configuration file above; instead you must pass parameters to -it on the command line. To exit the program, press Enter. - -Usage: demod_hrpt_file.py: [options] - -Options: - -h, --help show this help message and exit - -d DECIM, --decim=DECIM - Set Decimation [default=16] - -p PLL_ALPHA, --pll-alpha=PLL_ALPHA - Set pll_alpha [default=50m] - -s CLOCK_ALPHA, --clock-alpha=CLOCK_ALPHA - Set clock_alpha [default=50m] - -F INPUT_FILENAME, --input-filename=INPUT_FILENAME - Set Filename [default=usrp.dat] - -o OUTPUT_FILENAME, --output-filename=OUTPUT_FILENAME - Set Output [default=frames.dat] - - -LRIT Operation --------------- - -The work-in-progress LRIT GRC script is not currently in a usable state. diff --git a/gr-noaa/examples/CMakeLists.txt b/gr-noaa/examples/CMakeLists.txt deleted file mode 100644 index 6994148df..000000000 --- a/gr-noaa/examples/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2011 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. - -INSTALL( - FILES - hrpt_decode.grc - hrpt_demod.grc - file_rx_hrpt.grc - usrp_rx_hrpt.grc - usrp_rx_hrpt_nogui.grc - DESTINATION ${GR_PKG_NOAA_EXAMPLES_DIR} - COMPONENT "noaa_python" -) diff --git a/gr-noaa/examples/file_rx_hrpt.grc b/gr-noaa/examples/file_rx_hrpt.grc deleted file mode 100644 index 4097e83d3..000000000 --- a/gr-noaa/examples/file_rx_hrpt.grc +++ /dev/null @@ -1,903 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Oct 27 13:48:25 2011</timestamp> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>max_carrier_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>2*math.pi*100e3/sample_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(575, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sym_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>600*1109</value> - </param> - <param> - <key>_coordinate</key> - <value>(301, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>sample_rate/sym_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(397, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>hs</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>int(sps/2.0)</value> - </param> - <param> - <key>_coordinate</key> - <value>(499, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>max_clock_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e-6</value> - </param> - <param> - <key>_coordinate</key> - <value>(705, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import math, os</value> - </param> - <param> - <key>_coordinate</key> - <value>(9, 106)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>config_filename</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>os.environ['HOME']+'/.gnuradio/config.conf'</value> - </param> - <param> - <key>_coordinate</key> - <value>(13, 168)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sample_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4e6</value> - </param> - <param> - <key>_coordinate</key> - <value>(198, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_clock_recovery_mm_xx</key> - <param> - <key>id</key> - <value>digital_clock_recovery_mm_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>omega</key> - <value>sps/2.0</value> - </param> - <param> - <key>gain_omega</key> - <value>clock_alpha**2/4.0</value> - </param> - <param> - <key>mu</key> - <value>0.5</value> - </param> - <param> - <key>gain_mu</key> - <value>clock_alpha</value> - </param> - <param> - <key>omega_relative_limit</key> - <value>max_clock_offset</value> - </param> - <param> - <key>_coordinate</key> - <value>(897, 341)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>virtual_sink</key> - <param> - <key>id</key> - <value>virtual_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>baseband</value> - </param> - <param> - <key>_coordinate</key> - <value>(1139, 373)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_pll_cf</key> - <param> - <key>id</key> - <value>pll</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>alpha</key> - <value>pll_alpha</value> - </param> - <param> - <key>beta</key> - <value>pll_alpha**2/4.0</value> - </param> - <param> - <key>max_offset</key> - <value>max_carrier_offset</value> - </param> - <param> - <key>_coordinate</key> - <value>(470, 357)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_moving_average_xx</key> - <param> - <key>id</key> - <value>gr_moving_average_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>length</key> - <value>hs</value> - </param> - <param> - <key>scale</key> - <value>1.0/hs</value> - </param> - <param> - <key>max_iter</key> - <value>4000</value> - </param> - <param> - <key>_coordinate</key> - <value>(683, 357)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_file_sink</key> - <param> - <key>id</key> - <value>frame_sink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>file</key> - <value>output_filename</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>unbuffered</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(809, 595)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_decoder</key> - <param> - <key>id</key> - <value>decoder</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>True</value> - </param> - <param> - <key>output</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(810, 496)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_agc_xx</key> - <param> - <key>id</key> - <value>agc</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>rate</key> - <value>1e-6</value> - </param> - <param> - <key>reference</key> - <value>1.0</value> - </param> - <param> - <key>gain</key> - <value>1.0</value> - </param> - <param> - <key>max_gain</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(302, 349)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_interleaved_short_to_complex</key> - <param> - <key>id</key> - <value>gr_interleaved_short_to_complex_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(92, 377)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>throttle</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>2*sample_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(94, 323)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>gr_file_source</key> - <param> - <key>id</key> - <value>gr_file_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>file</key> - <value>input_filename</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>repeat</key> - <value>False</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(95, 257)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1698e6</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'freq'</value> - </param> - <param> - <key>writeback</key> - <value>freq</value> - </param> - <param> - <key>_coordinate</key> - <value>(218, 104)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>35</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'gain'</value> - </param> - <param> - <key>writeback</key> - <value>gain</value> - </param> - <param> - <key>_coordinate</key> - <value>(375, 105)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>pll_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.01</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'pll_alpha'</value> - </param> - <param> - <key>writeback</key> - <value>pll_alpha</value> - </param> - <param> - <key>_coordinate</key> - <value>(534, 104)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>clock_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.01</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'clock_alpha'</value> - </param> - <param> - <key>writeback</key> - <value>clock_alpha</value> - </param> - <param> - <key>_coordinate</key> - <value>(692, 104)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>output_filename</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>'frames.hrpt'</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'filename'</value> - </param> - <param> - <key>writeback</key> - <value>output_filename</value> - </param> - <param> - <key>_coordinate</key> - <value>(850, 105)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_deframer</key> - <param> - <key>id</key> - <value>deframer</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(598, 546)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>virtual_source</key> - <param> - <key>id</key> - <value>virtual_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>baseband</value> - </param> - <param> - <key>_coordinate</key> - <value>(90, 542)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_binary_slicer_fb</key> - <param> - <key>id</key> - <value>digital_binary_slicer_fb_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(332, 546)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>options</key> - <param> - <key>id</key> - <value>file_rx_hrpt</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>USRP HRPT Receiver</value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>4096,4096</value> - </param> - <param> - <key>generate_options</key> - <value>no_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>digital_clock_recovery_mm_xx_0</source_block_id> - <sink_block_id>virtual_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_moving_average_xx_0</source_block_id> - <sink_block_id>digital_clock_recovery_mm_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pll</source_block_id> - <sink_block_id>gr_moving_average_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>agc</source_block_id> - <sink_block_id>pll</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>decoder</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>frame_sink</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_interleaved_short_to_complex_0</source_block_id> - <sink_block_id>agc</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>throttle</source_block_id> - <sink_block_id>gr_interleaved_short_to_complex_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_file_source_0</source_block_id> - <sink_block_id>throttle</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>virtual_source_0</source_block_id> - <sink_block_id>digital_binary_slicer_fb_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_binary_slicer_fb_0</source_block_id> - <sink_block_id>deframer</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-noaa/examples/hrpt_decode.grc b/gr-noaa/examples/hrpt_decode.grc deleted file mode 100644 index 39fe195d1..000000000 --- a/gr-noaa/examples/hrpt_decode.grc +++ /dev/null @@ -1,428 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sun Nov 8 10:48:59 2009</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>hrpt_decode</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>4096,4096</value> - </param> - <param> - <key>generate_options</key> - <value>no_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>run</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>max_carrier_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>2*math.pi*100e3/sample_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(575, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>hs</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>int(sps/2.0)</value> - </param> - <param> - <key>_coordinate</key> - <value>(499, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sample_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>64e6/decim</value> - </param> - <param> - <key>_coordinate</key> - <value>(198, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import math, os</value> - </param> - <param> - <key>_coordinate</key> - <value>(11, 103)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>max_clock_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e-6</value> - </param> - <param> - <key>_coordinate</key> - <value>(710, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sym_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>600*1109</value> - </param> - <param> - <key>_coordinate</key> - <value>(307, 18)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>sample_rate/sym_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(400, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>decim</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>decim</value> - </param> - <param> - <key>value</key> - <value>32</value> - </param> - <param> - <key>type</key> - <value>intx</value> - </param> - <param> - <key>short_id</key> - <value>d</value> - </param> - <param> - <key>_coordinate</key> - <value>(202, 102)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>pll_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>pll_alpha</value> - </param> - <param> - <key>value</key> - <value>0.01</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>p</value> - </param> - <param> - <key>_coordinate</key> - <value>(294, 101)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>clock_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>clock_alpha</value> - </param> - <param> - <key>value</key> - <value>0.01</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>s</value> - </param> - <param> - <key>_coordinate</key> - <value>(395, 101)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_file_source</key> - <param> - <key>id</key> - <value>file_source</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>file</key> - <value>input_filename</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>repeat</key> - <value>False</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(231, 419)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_decoder</key> - <param> - <key>id</key> - <value>decoder</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>True</value> - </param> - <param> - <key>output</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(462, 419)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>input_filename</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>input_filename</value> - </param> - <param> - <key>value</key> - <value>frames.hrpt</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value>F</value> - </param> - <param> - <key>_coordinate</key> - <value>(522, 100)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>file_source</source_block_id> - <sink_block_id>decoder</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-noaa/examples/hrpt_demod.grc b/gr-noaa/examples/hrpt_demod.grc deleted file mode 100644 index f5833b864..000000000 --- a/gr-noaa/examples/hrpt_demod.grc +++ /dev/null @@ -1,751 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Oct 27 13:51:57 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>hrpt_demod</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>4096,4096</value> - </param> - <param> - <key>generate_options</key> - <value>no_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>run</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>max_carrier_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>2*math.pi*100e3/sample_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(575, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>hs</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>int(sps/2.0)</value> - </param> - <param> - <key>_coordinate</key> - <value>(499, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import math, os</value> - </param> - <param> - <key>_coordinate</key> - <value>(11, 103)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>input_filename</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>input_filename</value> - </param> - <param> - <key>value</key> - <value>usrp.dat</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value>F</value> - </param> - <param> - <key>_coordinate</key> - <value>(618, 102)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>output_filename</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>output_filename</value> - </param> - <param> - <key>value</key> - <value>frames.dat</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value>o</value> - </param> - <param> - <key>_coordinate</key> - <value>(726, 102)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>gr_file_source</key> - <param> - <key>id</key> - <value>file_source</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>file</key> - <value>input_filename</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>repeat</key> - <value>False</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(63, 277)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_interleaved_short_to_complex</key> - <param> - <key>id</key> - <value>cs2cf</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(275, 289)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_agc_xx</key> - <param> - <key>id</key> - <value>agc</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>rate</key> - <value>1e-5</value> - </param> - <param> - <key>reference</key> - <value>1.0</value> - </param> - <param> - <key>gain</key> - <value>1.0/32768.0</value> - </param> - <param> - <key>max_gain</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(117, 394)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_pll_cf</key> - <param> - <key>id</key> - <value>pll</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>alpha</key> - <value>pll_alpha</value> - </param> - <param> - <key>beta</key> - <value>pll_alpha**2/4.0</value> - </param> - <param> - <key>max_offset</key> - <value>max_carrier_offset</value> - </param> - <param> - <key>_coordinate</key> - <value>(292, 402)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>max_clock_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e-6</value> - </param> - <param> - <key>_coordinate</key> - <value>(710, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sym_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>600*1109</value> - </param> - <param> - <key>_coordinate</key> - <value>(307, 18)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>sample_rate/sym_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(400, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>decim</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>decim</value> - </param> - <param> - <key>value</key> - <value>32</value> - </param> - <param> - <key>type</key> - <value>intx</value> - </param> - <param> - <key>short_id</key> - <value>d</value> - </param> - <param> - <key>_coordinate</key> - <value>(202, 102)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>pll_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>pll_alpha</value> - </param> - <param> - <key>value</key> - <value>0.01</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>p</value> - </param> - <param> - <key>_coordinate</key> - <value>(294, 101)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>clock_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>clock_alpha</value> - </param> - <param> - <key>value</key> - <value>0.01</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>s</value> - </param> - <param> - <key>_coordinate</key> - <value>(395, 101)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_decoder</key> - <param> - <key>id</key> - <value>decoder</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>True</value> - </param> - <param> - <key>output</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(1150, 341)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>gr_file_sink</key> - <param> - <key>id</key> - <value>gr_file_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>file</key> - <value>output_filename</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>unbuffered</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(1144, 489)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>gr_moving_average_xx</key> - <param> - <key>id</key> - <value>gr_moving_average_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>length</key> - <value>hs</value> - </param> - <param> - <key>scale</key> - <value>1.0/hs</value> - </param> - <param> - <key>max_iter</key> - <value>4000</value> - </param> - <param> - <key>_coordinate</key> - <value>(504, 402)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sample_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4e6</value> - </param> - <param> - <key>_coordinate</key> - <value>(198, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_clock_recovery_mm_xx</key> - <param> - <key>id</key> - <value>digital_clock_recovery_mm_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>omega</key> - <value>sps/2.0</value> - </param> - <param> - <key>gain_omega</key> - <value>clock_alpha**2/4.0</value> - </param> - <param> - <key>mu</key> - <value>0.5</value> - </param> - <param> - <key>gain_mu</key> - <value>clock_alpha</value> - </param> - <param> - <key>omega_relative_limit</key> - <value>max_clock_offset</value> - </param> - <param> - <key>_coordinate</key> - <value>(704, 386)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_deframer</key> - <param> - <key>id</key> - <value>noaa_hrpt_deframer_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(1142, 422)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_binary_slicer_fb</key> - <param> - <key>id</key> - <value>digital_binary_slicer_fb_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(957, 422)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>file_source</source_block_id> - <sink_block_id>cs2cf</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pll</source_block_id> - <sink_block_id>gr_moving_average_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>cs2cf</source_block_id> - <sink_block_id>agc</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>agc</source_block_id> - <sink_block_id>pll</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>noaa_hrpt_deframer_0</source_block_id> - <sink_block_id>gr_file_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>noaa_hrpt_deframer_0</source_block_id> - <sink_block_id>decoder</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_moving_average_xx_0</source_block_id> - <sink_block_id>digital_clock_recovery_mm_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_clock_recovery_mm_xx_0</source_block_id> - <sink_block_id>digital_binary_slicer_fb_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_binary_slicer_fb_0</source_block_id> - <sink_block_id>noaa_hrpt_deframer_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-noaa/examples/usrp_rx_hrpt.grc b/gr-noaa/examples/usrp_rx_hrpt.grc deleted file mode 100644 index 26af48ff0..000000000 --- a/gr-noaa/examples/usrp_rx_hrpt.grc +++ /dev/null @@ -1,1975 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Oct 27 13:26:39 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>usrp_rx_hrpt</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>USRP HRPT Receiver</value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>4096,4096</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>max_carrier_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>2*math.pi*100e3/sample_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(575, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sym_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>600*1109</value> - </param> - <param> - <key>_coordinate</key> - <value>(301, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>sample_rate/sym_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(397, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>hs</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>int(sps/2.0)</value> - </param> - <param> - <key>_coordinate</key> - <value>(499, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>RX Gain</value> - </param> - <param> - <key>value</key> - <value>saved_gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>100</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 1, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(340, 106)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_text_box</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Frequency</value> - </param> - <param> - <key>value</key> - <value>saved_freq</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(199, 106)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>pll_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>PLL Alpha</value> - </param> - <param> - <key>value</key> - <value>saved_pll_alpha</value> - </param> - <param> - <key>min</key> - <value>0.0</value> - </param> - <param> - <key>max</key> - <value>0.5</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 2, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(479, 106)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>clock_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Clock Alpha</value> - </param> - <param> - <key>value</key> - <value>saved_clock_alpha</value> - </param> - <param> - <key>min</key> - <value>0.0</value> - </param> - <param> - <key>max</key> - <value>0.5</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 3, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(618, 106)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>displays</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['Spectrum','Demod']</value> - </param> - <param> - <key>grid_pos</key> - <value>2,0,1,4</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(12, 249)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>rx_fft</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>RX Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>sample_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>freq</value> - </param> - <param> - <key>y_per_div</key> - <value>5</value> - </param> - <param> - <key>y_divs</key> - <value>8</value> - </param> - <param> - <key>ref_level</key> - <value>-5</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.1</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value>640, 360</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 0</value> - </param> - <param> - <key>_coordinate</key> - <value>(477, 457)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>max_clock_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e-6</value> - </param> - <param> - <key>_coordinate</key> - <value>(705, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_agc_xx</key> - <param> - <key>id</key> - <value>agc</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>rate</key> - <value>1e-6</value> - </param> - <param> - <key>reference</key> - <value>1.0</value> - </param> - <param> - <key>gain</key> - <value>1.0</value> - </param> - <param> - <key>max_gain</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(301, 705)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_pll_cf</key> - <param> - <key>id</key> - <value>pll</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>alpha</key> - <value>pll_alpha</value> - </param> - <param> - <key>beta</key> - <value>pll_alpha**2/4.0</value> - </param> - <param> - <key>max_offset</key> - <value>max_carrier_offset</value> - </param> - <param> - <key>_coordinate</key> - <value>(469, 713)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>addr</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>""</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'addr'</value> - </param> - <param> - <key>writeback</key> - <value>addr</value> - </param> - <param> - <key>_coordinate</key> - <value>(194, 253)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>uhd_usrp_source</key> - <param> - <key>id</key> - <value>uhd_usrp_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>dev_addr</key> - <value>addr</value> - </param> - <param> - <key>sync</key> - <value></value> - </param> - <param> - <key>clock_rate</key> - <value>0.0</value> - </param> - <param> - <key>num_mboards</key> - <value>1</value> - </param> - <param> - <key>ref_source0</key> - <value></value> - </param> - <param> - <key>sd_spec0</key> - <value></value> - </param> - <param> - <key>ref_source1</key> - <value></value> - </param> - <param> - <key>sd_spec1</key> - <value></value> - </param> - <param> - <key>ref_source2</key> - <value></value> - </param> - <param> - <key>sd_spec2</key> - <value></value> - </param> - <param> - <key>ref_source3</key> - <value></value> - </param> - <param> - <key>sd_spec3</key> - <value></value> - </param> - <param> - <key>ref_source4</key> - <value></value> - </param> - <param> - <key>sd_spec4</key> - <value></value> - </param> - <param> - <key>ref_source5</key> - <value></value> - </param> - <param> - <key>sd_spec5</key> - <value></value> - </param> - <param> - <key>ref_source6</key> - <value></value> - </param> - <param> - <key>sd_spec6</key> - <value></value> - </param> - <param> - <key>ref_source7</key> - <value></value> - </param> - <param> - <key>sd_spec7</key> - <value></value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>sample_rate</value> - </param> - <param> - <key>center_freq0</key> - <value>freq</value> - </param> - <param> - <key>gain0</key> - <value>0</value> - </param> - <param> - <key>ant0</key> - <value></value> - </param> - <param> - <key>bw0</key> - <value>0</value> - </param> - <param> - <key>center_freq1</key> - <value>0</value> - </param> - <param> - <key>gain1</key> - <value>0</value> - </param> - <param> - <key>ant1</key> - <value></value> - </param> - <param> - <key>bw1</key> - <value>0</value> - </param> - <param> - <key>center_freq2</key> - <value>0</value> - </param> - <param> - <key>gain2</key> - <value>0</value> - </param> - <param> - <key>ant2</key> - <value></value> - </param> - <param> - <key>bw2</key> - <value>0</value> - </param> - <param> - <key>center_freq3</key> - <value>0</value> - </param> - <param> - <key>gain3</key> - <value>0</value> - </param> - <param> - <key>ant3</key> - <value></value> - </param> - <param> - <key>bw3</key> - <value>0</value> - </param> - <param> - <key>center_freq4</key> - <value>0</value> - </param> - <param> - <key>gain4</key> - <value>0</value> - </param> - <param> - <key>ant4</key> - <value></value> - </param> - <param> - <key>bw4</key> - <value>0</value> - </param> - <param> - <key>center_freq5</key> - <value>0</value> - </param> - <param> - <key>gain5</key> - <value>0</value> - </param> - <param> - <key>ant5</key> - <value></value> - </param> - <param> - <key>bw5</key> - <value>0</value> - </param> - <param> - <key>center_freq6</key> - <value>0</value> - </param> - <param> - <key>gain6</key> - <value>0</value> - </param> - <param> - <key>ant6</key> - <value></value> - </param> - <param> - <key>bw6</key> - <value>0</value> - </param> - <param> - <key>center_freq7</key> - <value>0</value> - </param> - <param> - <key>gain7</key> - <value>0</value> - </param> - <param> - <key>ant7</key> - <value></value> - </param> - <param> - <key>bw7</key> - <value>0</value> - </param> - <param> - <key>center_freq8</key> - <value>0</value> - </param> - <param> - <key>gain8</key> - <value>0</value> - </param> - <param> - <key>ant8</key> - <value></value> - </param> - <param> - <key>bw8</key> - <value>0</value> - </param> - <param> - <key>center_freq9</key> - <value>0</value> - </param> - <param> - <key>gain9</key> - <value>0</value> - </param> - <param> - <key>ant9</key> - <value></value> - </param> - <param> - <key>bw9</key> - <value>0</value> - </param> - <param> - <key>center_freq10</key> - <value>0</value> - </param> - <param> - <key>gain10</key> - <value>0</value> - </param> - <param> - <key>ant10</key> - <value></value> - </param> - <param> - <key>bw10</key> - <value>0</value> - </param> - <param> - <key>center_freq11</key> - <value>0</value> - </param> - <param> - <key>gain11</key> - <value>0</value> - </param> - <param> - <key>ant11</key> - <value></value> - </param> - <param> - <key>bw11</key> - <value>0</value> - </param> - <param> - <key>center_freq12</key> - <value>0</value> - </param> - <param> - <key>gain12</key> - <value>0</value> - </param> - <param> - <key>ant12</key> - <value></value> - </param> - <param> - <key>bw12</key> - <value>0</value> - </param> - <param> - <key>center_freq13</key> - <value>0</value> - </param> - <param> - <key>gain13</key> - <value>0</value> - </param> - <param> - <key>ant13</key> - <value></value> - </param> - <param> - <key>bw13</key> - <value>0</value> - </param> - <param> - <key>center_freq14</key> - <value>0</value> - </param> - <param> - <key>gain14</key> - <value>0</value> - </param> - <param> - <key>ant14</key> - <value></value> - </param> - <param> - <key>bw14</key> - <value>0</value> - </param> - <param> - <key>center_freq15</key> - <value>0</value> - </param> - <param> - <key>gain15</key> - <value>0</value> - </param> - <param> - <key>ant15</key> - <value></value> - </param> - <param> - <key>bw15</key> - <value>0</value> - </param> - <param> - <key>center_freq16</key> - <value>0</value> - </param> - <param> - <key>gain16</key> - <value>0</value> - </param> - <param> - <key>ant16</key> - <value></value> - </param> - <param> - <key>bw16</key> - <value>0</value> - </param> - <param> - <key>center_freq17</key> - <value>0</value> - </param> - <param> - <key>gain17</key> - <value>0</value> - </param> - <param> - <key>ant17</key> - <value></value> - </param> - <param> - <key>bw17</key> - <value>0</value> - </param> - <param> - <key>center_freq18</key> - <value>0</value> - </param> - <param> - <key>gain18</key> - <value>0</value> - </param> - <param> - <key>ant18</key> - <value></value> - </param> - <param> - <key>bw18</key> - <value>0</value> - </param> - <param> - <key>center_freq19</key> - <value>0</value> - </param> - <param> - <key>gain19</key> - <value>0</value> - </param> - <param> - <key>ant19</key> - <value></value> - </param> - <param> - <key>bw19</key> - <value>0</value> - </param> - <param> - <key>center_freq20</key> - <value>0</value> - </param> - <param> - <key>gain20</key> - <value>0</value> - </param> - <param> - <key>ant20</key> - <value></value> - </param> - <param> - <key>bw20</key> - <value>0</value> - </param> - <param> - <key>center_freq21</key> - <value>0</value> - </param> - <param> - <key>gain21</key> - <value>0</value> - </param> - <param> - <key>ant21</key> - <value></value> - </param> - <param> - <key>bw21</key> - <value>0</value> - </param> - <param> - <key>center_freq22</key> - <value>0</value> - </param> - <param> - <key>gain22</key> - <value>0</value> - </param> - <param> - <key>ant22</key> - <value></value> - </param> - <param> - <key>bw22</key> - <value>0</value> - </param> - <param> - <key>center_freq23</key> - <value>0</value> - </param> - <param> - <key>gain23</key> - <value>0</value> - </param> - <param> - <key>ant23</key> - <value></value> - </param> - <param> - <key>bw23</key> - <value>0</value> - </param> - <param> - <key>center_freq24</key> - <value>0</value> - </param> - <param> - <key>gain24</key> - <value>0</value> - </param> - <param> - <key>ant24</key> - <value></value> - </param> - <param> - <key>bw24</key> - <value>0</value> - </param> - <param> - <key>center_freq25</key> - <value>0</value> - </param> - <param> - <key>gain25</key> - <value>0</value> - </param> - <param> - <key>ant25</key> - <value></value> - </param> - <param> - <key>bw25</key> - <value>0</value> - </param> - <param> - <key>center_freq26</key> - <value>0</value> - </param> - <param> - <key>gain26</key> - <value>0</value> - </param> - <param> - <key>ant26</key> - <value></value> - </param> - <param> - <key>bw26</key> - <value>0</value> - </param> - <param> - <key>center_freq27</key> - <value>0</value> - </param> - <param> - <key>gain27</key> - <value>0</value> - </param> - <param> - <key>ant27</key> - <value></value> - </param> - <param> - <key>bw27</key> - <value>0</value> - </param> - <param> - <key>center_freq28</key> - <value>0</value> - </param> - <param> - <key>gain28</key> - <value>0</value> - </param> - <param> - <key>ant28</key> - <value></value> - </param> - <param> - <key>bw28</key> - <value>0</value> - </param> - <param> - <key>center_freq29</key> - <value>0</value> - </param> - <param> - <key>gain29</key> - <value>0</value> - </param> - <param> - <key>ant29</key> - <value></value> - </param> - <param> - <key>bw29</key> - <value>0</value> - </param> - <param> - <key>center_freq30</key> - <value>0</value> - </param> - <param> - <key>gain30</key> - <value>0</value> - </param> - <param> - <key>ant30</key> - <value></value> - </param> - <param> - <key>bw30</key> - <value>0</value> - </param> - <param> - <key>center_freq31</key> - <value>0</value> - </param> - <param> - <key>gain31</key> - <value>0</value> - </param> - <param> - <key>ant31</key> - <value></value> - </param> - <param> - <key>bw31</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(49, 713)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>addr_text</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>USRP Addr</value> - </param> - <param> - <key>value</key> - <value>addr</value> - </param> - <param> - <key>converver</key> - <value>str_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(828, 20)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>rate_text</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Baseband Rate</value> - </param> - <param> - <key>value</key> - <value>sample_rate</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 1, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(973, 20)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import math, os</value> - </param> - <param> - <key>_coordinate</key> - <value>(9, 106)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>config_filename</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>os.environ['HOME']+'/.gnuradio/config.conf'</value> - </param> - <param> - <key>_coordinate</key> - <value>(13, 168)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>output_filename</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>'frames.hrpt'</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'filename'</value> - </param> - <param> - <key>writeback</key> - <value>output_filename</value> - </param> - <param> - <key>_coordinate</key> - <value>(990, 255)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>saved_clock_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.01</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'clock_alpha'</value> - </param> - <param> - <key>writeback</key> - <value>clock_alpha</value> - </param> - <param> - <key>_coordinate</key> - <value>(832, 254)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>saved_pll_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.01</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'pll_alpha'</value> - </param> - <param> - <key>writeback</key> - <value>pll_alpha</value> - </param> - <param> - <key>_coordinate</key> - <value>(674, 254)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>saved_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>35</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'gain'</value> - </param> - <param> - <key>writeback</key> - <value>gain</value> - </param> - <param> - <key>_coordinate</key> - <value>(515, 255)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>saved_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1698e6</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'freq'</value> - </param> - <param> - <key>writeback</key> - <value>freq</value> - </param> - <param> - <key>_coordinate</key> - <value>(358, 254)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sample_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4e6</value> - </param> - <param> - <key>_coordinate</key> - <value>(198, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>demod_scope</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Post-Demod</value> - </param> - <param> - <key>samp_rate</key> - <value>sym_rate*2.0</value> - </param> - <param> - <key>v_scale</key> - <value>0.5</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>10.0/sym_rate</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 1</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(666, 542)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>gr_moving_average_xx</key> - <param> - <key>id</key> - <value>gr_moving_average_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>length</key> - <value>hs</value> - </param> - <param> - <key>scale</key> - <value>1.0/hs</value> - </param> - <param> - <key>max_iter</key> - <value>4000</value> - </param> - <param> - <key>_coordinate</key> - <value>(682, 713)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>virtual_sink</key> - <param> - <key>id</key> - <value>virtual_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>baseband</value> - </param> - <param> - <key>_coordinate</key> - <value>(1138, 729)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_clock_recovery_mm_xx</key> - <param> - <key>id</key> - <value>digital_clock_recovery_mm_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>omega</key> - <value>sps/2.0</value> - </param> - <param> - <key>gain_omega</key> - <value>clock_alpha**2/4.0</value> - </param> - <param> - <key>mu</key> - <value>0.5</value> - </param> - <param> - <key>gain_mu</key> - <value>clock_alpha</value> - </param> - <param> - <key>omega_relative_limit</key> - <value>max_clock_offset</value> - </param> - <param> - <key>_coordinate</key> - <value>(896, 697)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>virtual_source</key> - <param> - <key>id</key> - <value>virtual_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>baseband</value> - </param> - <param> - <key>_coordinate</key> - <value>(173, 971)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_binary_slicer_fb</key> - <param> - <key>id</key> - <value>digital_binary_slicer_fb_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(423, 975)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_deframer</key> - <param> - <key>id</key> - <value>deframer</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(762, 975)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_decoder</key> - <param> - <key>id</key> - <value>decoder</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>True</value> - </param> - <param> - <key>output</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(974, 925)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_file_sink</key> - <param> - <key>id</key> - <value>frame_sink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>file</key> - <value>output_filename</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>unbuffered</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(973, 1024)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>frame_sink</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>decoder</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>agc</source_block_id> - <sink_block_id>pll</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>agc</source_block_id> - <sink_block_id>rx_fft</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>agc</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pll</source_block_id> - <sink_block_id>gr_moving_average_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_moving_average_xx_0</source_block_id> - <sink_block_id>demod_scope</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_moving_average_xx_0</source_block_id> - <sink_block_id>digital_clock_recovery_mm_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_clock_recovery_mm_xx_0</source_block_id> - <sink_block_id>virtual_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>virtual_source_0</source_block_id> - <sink_block_id>digital_binary_slicer_fb_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_binary_slicer_fb_0</source_block_id> - <sink_block_id>deframer</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-noaa/examples/usrp_rx_hrpt_nogui.grc b/gr-noaa/examples/usrp_rx_hrpt_nogui.grc deleted file mode 100644 index 5936c94c8..000000000 --- a/gr-noaa/examples/usrp_rx_hrpt_nogui.grc +++ /dev/null @@ -1,1472 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Oct 27 13:48:57 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>usrp_rx_hrpt_nogui</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>USRP HRPT Receiver</value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>4096,4096</value> - </param> - <param> - <key>generate_options</key> - <value>no_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>max_carrier_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>2*math.pi*100e3/sample_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(575, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sym_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>600*1109</value> - </param> - <param> - <key>_coordinate</key> - <value>(301, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>sample_rate/sym_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(397, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>hs</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>int(sps/2.0)</value> - </param> - <param> - <key>_coordinate</key> - <value>(499, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>max_clock_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e-6</value> - </param> - <param> - <key>_coordinate</key> - <value>(705, 19)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import math, os</value> - </param> - <param> - <key>_coordinate</key> - <value>(9, 106)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>config_filename</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>os.environ['HOME']+'/.gnuradio/config.conf'</value> - </param> - <param> - <key>_coordinate</key> - <value>(13, 168)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sample_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4e6</value> - </param> - <param> - <key>_coordinate</key> - <value>(198, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>clock_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.01</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'clock_alpha'</value> - </param> - <param> - <key>writeback</key> - <value>clock_alpha</value> - </param> - <param> - <key>_coordinate</key> - <value>(833, 104)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>pll_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.01</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'pll_alpha'</value> - </param> - <param> - <key>writeback</key> - <value>pll_alpha</value> - </param> - <param> - <key>_coordinate</key> - <value>(675, 104)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>35</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'gain'</value> - </param> - <param> - <key>writeback</key> - <value>gain</value> - </param> - <param> - <key>_coordinate</key> - <value>(516, 105)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1698e6</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'freq'</value> - </param> - <param> - <key>writeback</key> - <value>freq</value> - </param> - <param> - <key>_coordinate</key> - <value>(359, 104)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>output_filename</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>'frames.hrpt'</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'filename'</value> - </param> - <param> - <key>writeback</key> - <value>output_filename</value> - </param> - <param> - <key>_coordinate</key> - <value>(991, 105)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_clock_recovery_mm_xx</key> - <param> - <key>id</key> - <value>digital_clock_recovery_mm_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>omega</key> - <value>sps/2.0</value> - </param> - <param> - <key>gain_omega</key> - <value>clock_alpha**2/4.0</value> - </param> - <param> - <key>mu</key> - <value>0.5</value> - </param> - <param> - <key>gain_mu</key> - <value>clock_alpha</value> - </param> - <param> - <key>omega_relative_limit</key> - <value>max_clock_offset</value> - </param> - <param> - <key>_coordinate</key> - <value>(897, 341)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>virtual_sink</key> - <param> - <key>id</key> - <value>virtual_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>baseband</value> - </param> - <param> - <key>_coordinate</key> - <value>(1139, 373)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>uhd_usrp_source</key> - <param> - <key>id</key> - <value>uhd_usrp_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>dev_addr</key> - <value>addr</value> - </param> - <param> - <key>sync</key> - <value></value> - </param> - <param> - <key>clock_rate</key> - <value>0.0</value> - </param> - <param> - <key>num_mboards</key> - <value>1</value> - </param> - <param> - <key>ref_source0</key> - <value></value> - </param> - <param> - <key>sd_spec0</key> - <value></value> - </param> - <param> - <key>ref_source1</key> - <value></value> - </param> - <param> - <key>sd_spec1</key> - <value></value> - </param> - <param> - <key>ref_source2</key> - <value></value> - </param> - <param> - <key>sd_spec2</key> - <value></value> - </param> - <param> - <key>ref_source3</key> - <value></value> - </param> - <param> - <key>sd_spec3</key> - <value></value> - </param> - <param> - <key>ref_source4</key> - <value></value> - </param> - <param> - <key>sd_spec4</key> - <value></value> - </param> - <param> - <key>ref_source5</key> - <value></value> - </param> - <param> - <key>sd_spec5</key> - <value></value> - </param> - <param> - <key>ref_source6</key> - <value></value> - </param> - <param> - <key>sd_spec6</key> - <value></value> - </param> - <param> - <key>ref_source7</key> - <value></value> - </param> - <param> - <key>sd_spec7</key> - <value></value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>sample_rate</value> - </param> - <param> - <key>center_freq0</key> - <value>freq</value> - </param> - <param> - <key>gain0</key> - <value>0</value> - </param> - <param> - <key>ant0</key> - <value></value> - </param> - <param> - <key>bw0</key> - <value>0</value> - </param> - <param> - <key>center_freq1</key> - <value>0</value> - </param> - <param> - <key>gain1</key> - <value>0</value> - </param> - <param> - <key>ant1</key> - <value></value> - </param> - <param> - <key>bw1</key> - <value>0</value> - </param> - <param> - <key>center_freq2</key> - <value>0</value> - </param> - <param> - <key>gain2</key> - <value>0</value> - </param> - <param> - <key>ant2</key> - <value></value> - </param> - <param> - <key>bw2</key> - <value>0</value> - </param> - <param> - <key>center_freq3</key> - <value>0</value> - </param> - <param> - <key>gain3</key> - <value>0</value> - </param> - <param> - <key>ant3</key> - <value></value> - </param> - <param> - <key>bw3</key> - <value>0</value> - </param> - <param> - <key>center_freq4</key> - <value>0</value> - </param> - <param> - <key>gain4</key> - <value>0</value> - </param> - <param> - <key>ant4</key> - <value></value> - </param> - <param> - <key>bw4</key> - <value>0</value> - </param> - <param> - <key>center_freq5</key> - <value>0</value> - </param> - <param> - <key>gain5</key> - <value>0</value> - </param> - <param> - <key>ant5</key> - <value></value> - </param> - <param> - <key>bw5</key> - <value>0</value> - </param> - <param> - <key>center_freq6</key> - <value>0</value> - </param> - <param> - <key>gain6</key> - <value>0</value> - </param> - <param> - <key>ant6</key> - <value></value> - </param> - <param> - <key>bw6</key> - <value>0</value> - </param> - <param> - <key>center_freq7</key> - <value>0</value> - </param> - <param> - <key>gain7</key> - <value>0</value> - </param> - <param> - <key>ant7</key> - <value></value> - </param> - <param> - <key>bw7</key> - <value>0</value> - </param> - <param> - <key>center_freq8</key> - <value>0</value> - </param> - <param> - <key>gain8</key> - <value>0</value> - </param> - <param> - <key>ant8</key> - <value></value> - </param> - <param> - <key>bw8</key> - <value>0</value> - </param> - <param> - <key>center_freq9</key> - <value>0</value> - </param> - <param> - <key>gain9</key> - <value>0</value> - </param> - <param> - <key>ant9</key> - <value></value> - </param> - <param> - <key>bw9</key> - <value>0</value> - </param> - <param> - <key>center_freq10</key> - <value>0</value> - </param> - <param> - <key>gain10</key> - <value>0</value> - </param> - <param> - <key>ant10</key> - <value></value> - </param> - <param> - <key>bw10</key> - <value>0</value> - </param> - <param> - <key>center_freq11</key> - <value>0</value> - </param> - <param> - <key>gain11</key> - <value>0</value> - </param> - <param> - <key>ant11</key> - <value></value> - </param> - <param> - <key>bw11</key> - <value>0</value> - </param> - <param> - <key>center_freq12</key> - <value>0</value> - </param> - <param> - <key>gain12</key> - <value>0</value> - </param> - <param> - <key>ant12</key> - <value></value> - </param> - <param> - <key>bw12</key> - <value>0</value> - </param> - <param> - <key>center_freq13</key> - <value>0</value> - </param> - <param> - <key>gain13</key> - <value>0</value> - </param> - <param> - <key>ant13</key> - <value></value> - </param> - <param> - <key>bw13</key> - <value>0</value> - </param> - <param> - <key>center_freq14</key> - <value>0</value> - </param> - <param> - <key>gain14</key> - <value>0</value> - </param> - <param> - <key>ant14</key> - <value></value> - </param> - <param> - <key>bw14</key> - <value>0</value> - </param> - <param> - <key>center_freq15</key> - <value>0</value> - </param> - <param> - <key>gain15</key> - <value>0</value> - </param> - <param> - <key>ant15</key> - <value></value> - </param> - <param> - <key>bw15</key> - <value>0</value> - </param> - <param> - <key>center_freq16</key> - <value>0</value> - </param> - <param> - <key>gain16</key> - <value>0</value> - </param> - <param> - <key>ant16</key> - <value></value> - </param> - <param> - <key>bw16</key> - <value>0</value> - </param> - <param> - <key>center_freq17</key> - <value>0</value> - </param> - <param> - <key>gain17</key> - <value>0</value> - </param> - <param> - <key>ant17</key> - <value></value> - </param> - <param> - <key>bw17</key> - <value>0</value> - </param> - <param> - <key>center_freq18</key> - <value>0</value> - </param> - <param> - <key>gain18</key> - <value>0</value> - </param> - <param> - <key>ant18</key> - <value></value> - </param> - <param> - <key>bw18</key> - <value>0</value> - </param> - <param> - <key>center_freq19</key> - <value>0</value> - </param> - <param> - <key>gain19</key> - <value>0</value> - </param> - <param> - <key>ant19</key> - <value></value> - </param> - <param> - <key>bw19</key> - <value>0</value> - </param> - <param> - <key>center_freq20</key> - <value>0</value> - </param> - <param> - <key>gain20</key> - <value>0</value> - </param> - <param> - <key>ant20</key> - <value></value> - </param> - <param> - <key>bw20</key> - <value>0</value> - </param> - <param> - <key>center_freq21</key> - <value>0</value> - </param> - <param> - <key>gain21</key> - <value>0</value> - </param> - <param> - <key>ant21</key> - <value></value> - </param> - <param> - <key>bw21</key> - <value>0</value> - </param> - <param> - <key>center_freq22</key> - <value>0</value> - </param> - <param> - <key>gain22</key> - <value>0</value> - </param> - <param> - <key>ant22</key> - <value></value> - </param> - <param> - <key>bw22</key> - <value>0</value> - </param> - <param> - <key>center_freq23</key> - <value>0</value> - </param> - <param> - <key>gain23</key> - <value>0</value> - </param> - <param> - <key>ant23</key> - <value></value> - </param> - <param> - <key>bw23</key> - <value>0</value> - </param> - <param> - <key>center_freq24</key> - <value>0</value> - </param> - <param> - <key>gain24</key> - <value>0</value> - </param> - <param> - <key>ant24</key> - <value></value> - </param> - <param> - <key>bw24</key> - <value>0</value> - </param> - <param> - <key>center_freq25</key> - <value>0</value> - </param> - <param> - <key>gain25</key> - <value>0</value> - </param> - <param> - <key>ant25</key> - <value></value> - </param> - <param> - <key>bw25</key> - <value>0</value> - </param> - <param> - <key>center_freq26</key> - <value>0</value> - </param> - <param> - <key>gain26</key> - <value>0</value> - </param> - <param> - <key>ant26</key> - <value></value> - </param> - <param> - <key>bw26</key> - <value>0</value> - </param> - <param> - <key>center_freq27</key> - <value>0</value> - </param> - <param> - <key>gain27</key> - <value>0</value> - </param> - <param> - <key>ant27</key> - <value></value> - </param> - <param> - <key>bw27</key> - <value>0</value> - </param> - <param> - <key>center_freq28</key> - <value>0</value> - </param> - <param> - <key>gain28</key> - <value>0</value> - </param> - <param> - <key>ant28</key> - <value></value> - </param> - <param> - <key>bw28</key> - <value>0</value> - </param> - <param> - <key>center_freq29</key> - <value>0</value> - </param> - <param> - <key>gain29</key> - <value>0</value> - </param> - <param> - <key>ant29</key> - <value></value> - </param> - <param> - <key>bw29</key> - <value>0</value> - </param> - <param> - <key>center_freq30</key> - <value>0</value> - </param> - <param> - <key>gain30</key> - <value>0</value> - </param> - <param> - <key>ant30</key> - <value></value> - </param> - <param> - <key>bw30</key> - <value>0</value> - </param> - <param> - <key>center_freq31</key> - <value>0</value> - </param> - <param> - <key>gain31</key> - <value>0</value> - </param> - <param> - <key>ant31</key> - <value></value> - </param> - <param> - <key>bw31</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(50, 357)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_pll_cf</key> - <param> - <key>id</key> - <value>pll</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>alpha</key> - <value>pll_alpha</value> - </param> - <param> - <key>beta</key> - <value>pll_alpha**2/4.0</value> - </param> - <param> - <key>max_offset</key> - <value>max_carrier_offset</value> - </param> - <param> - <key>_coordinate</key> - <value>(470, 357)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_agc_xx</key> - <param> - <key>id</key> - <value>agc</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>rate</key> - <value>1e-6</value> - </param> - <param> - <key>reference</key> - <value>1.0</value> - </param> - <param> - <key>gain</key> - <value>1.0</value> - </param> - <param> - <key>max_gain</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(302, 349)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_moving_average_xx</key> - <param> - <key>id</key> - <value>gr_moving_average_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>length</key> - <value>hs</value> - </param> - <param> - <key>scale</key> - <value>1.0/hs</value> - </param> - <param> - <key>max_iter</key> - <value>4000</value> - </param> - <param> - <key>_coordinate</key> - <value>(683, 357)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_file_sink</key> - <param> - <key>id</key> - <value>frame_sink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>file</key> - <value>output_filename</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>unbuffered</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(809, 595)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_deframer</key> - <param> - <key>id</key> - <value>deframer</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(598, 546)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_binary_slicer_fb</key> - <param> - <key>id</key> - <value>digital_binary_slicer_fb_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(259, 546)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>virtual_source</key> - <param> - <key>id</key> - <value>virtual_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>baseband</value> - </param> - <param> - <key>_coordinate</key> - <value>(40, 542)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>noaa_hrpt_decoder</key> - <param> - <key>id</key> - <value>decoder</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>True</value> - </param> - <param> - <key>output</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(810, 496)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>addr</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>""</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>'usrp_rx_hrpt'</value> - </param> - <param> - <key>option</key> - <value>'addr'</value> - </param> - <param> - <key>writeback</key> - <value>addr</value> - </param> - <param> - <key>_coordinate</key> - <value>(195, 103)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>digital_clock_recovery_mm_xx_0</source_block_id> - <sink_block_id>virtual_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_moving_average_xx_0</source_block_id> - <sink_block_id>digital_clock_recovery_mm_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pll</source_block_id> - <sink_block_id>gr_moving_average_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>agc</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>agc</source_block_id> - <sink_block_id>pll</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_binary_slicer_fb_0</source_block_id> - <sink_block_id>deframer</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>virtual_source_0</source_block_id> - <sink_block_id>digital_binary_slicer_fb_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>decoder</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>deframer</source_block_id> - <sink_block_id>frame_sink</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-noaa/gnuradio-noaa.pc.in b/gr-noaa/gnuradio-noaa.pc.in deleted file mode 100644 index cacfeecca..000000000 --- a/gr-noaa/gnuradio-noaa.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-noaa -Description: GNU Radio blocks implementing a NOAA satellite protocols -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-noaa -Cflags: -I${includedir} diff --git a/gr-noaa/grc/CMakeLists.txt b/gr-noaa/grc/CMakeLists.txt deleted file mode 100644 index ae04d4b6e..000000000 --- a/gr-noaa/grc/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2011 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. - -install(FILES - noaa_hrpt_decoder.xml - noaa_hrpt_deframer.xml - noaa_hrpt_pll_cf.xml - DESTINATION ${GRC_BLOCKS_DIR} - COMPONENT "noaa_python" -) diff --git a/gr-noaa/grc/noaa_hrpt_decoder.xml b/gr-noaa/grc/noaa_hrpt_decoder.xml deleted file mode 100644 index 2d6e98c53..000000000 --- a/gr-noaa/grc/noaa_hrpt_decoder.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<block> - <name>HRPT Decoder</name> - <key>noaa_hrpt_decoder</key> - <category>NOAA</category> - <import>from gnuradio import noaa</import> - <make>noaa.hrpt_decoder($verbose,$output)</make> - - <param> - <name>Verbose</name> - <key>verbose</key> - <type>bool</type> - </param> - - <param> - <name>Output Files</name> - <key>output</key> - <type>bool</type> - </param> - - <sink> - <name>in</name> - <type>short</type> - </sink> -</block> diff --git a/gr-noaa/grc/noaa_hrpt_deframer.xml b/gr-noaa/grc/noaa_hrpt_deframer.xml deleted file mode 100644 index af36abf2a..000000000 --- a/gr-noaa/grc/noaa_hrpt_deframer.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> -<block> - <name>HRPT Deframer</name> - <key>noaa_hrpt_deframer</key> - <category>NOAA</category> - <import>from gnuradio import noaa</import> - <make>noaa.hrpt_deframer()</make> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>short</type> - </source> -</block> diff --git a/gr-noaa/grc/noaa_hrpt_pll_cf.xml b/gr-noaa/grc/noaa_hrpt_pll_cf.xml deleted file mode 100644 index bbe15e8c3..000000000 --- a/gr-noaa/grc/noaa_hrpt_pll_cf.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0"?> -<block> - <name>HRPT PLL</name> - <key>noaa_hrpt_pll_cf</key> - <category>NOAA</category> - <import>from gnuradio import noaa</import> - <make>noaa.hrpt_pll_cf($alpha, $beta, $max_offset)</make> - <callback>set_alpha($alpha)</callback> - <callback>set_beta($beta)</callback> - <callback>set_max_offset($max_offset)</callback> - <param> - <name>Alpha</name> - <key>alpha</key> - <type>real</type> - </param> - <param> - <name>Beta</name> - <key>beta</key> - <type>real</type> - </param> - <param> - <name>Max Offset</name> - <key>max_offset</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> -</block> diff --git a/gr-noaa/lib/CMakeLists.txt b/gr-noaa/lib/CMakeLists.txt deleted file mode 100644 index 3f369f8af..000000000 --- a/gr-noaa/lib/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${GR_NOAA_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_noaa_sources - noaa_hrpt_decoder.cc - noaa_hrpt_deframer.cc - noaa_hrpt_pll_cf.cc -) - -list(APPEND noaa_libs - gnuradio-core - ${Boost_LIBRARIES} -) - -add_library(gnuradio-noaa SHARED ${gr_noaa_sources}) -target_link_libraries(gnuradio-noaa ${noaa_libs}) -GR_LIBRARY_FOO(gnuradio-noaa RUNTIME_COMPONENT "noaa_runtime" DEVEL_COMPONENT "noaa_devel") - -######################################################################## -# Install header files -######################################################################## -install(FILES - noaa_api.h - noaa_hrpt_decoder.h - noaa_hrpt_deframer.h - noaa_hrpt_pll_cf.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "noaa_devel" -) diff --git a/gr-noaa/lib/noaa_api.h b/gr-noaa/lib/noaa_api.h deleted file mode 100644 index d3c3fbf2d..000000000 --- a/gr-noaa/lib/noaa_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_NOAA_API_H -#define INCLUDED_NOAA_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_noaa_EXPORTS -# define NOAA_API __GR_ATTR_EXPORT -#else -# define NOAA_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_NOAA_API_H */ diff --git a/gr-noaa/lib/noaa_hrpt.h b/gr-noaa/lib/noaa_hrpt.h deleted file mode 100644 index f0f0e53f4..000000000 --- a/gr-noaa/lib/noaa_hrpt.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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 INCLUDED_NOAA_HRPT_H -#define INCLUDED_NOAA_HRPT_H - -#define HRPT_SYNC1 0x0284 -#define HRPT_SYNC2 0x016F -#define HRPT_SYNC3 0x035C -#define HRPT_SYNC4 0x019D -#define HRPT_SYNC5 0x020F -#define HRPT_SYNC6 0x0095 - -#define HRPT_MINOR_FRAME_SYNC 0x0A116FD719D83C95LL - -#define HRPT_SYNC_WORDS 6 -#define HRPT_MINOR_FRAME_WORDS 11090 -#define HRPT_BITS_PER_WORD 10 - -#endif /* INCLUDED_NOAA_HRPT_H */ diff --git a/gr-noaa/lib/noaa_hrpt_decoder.cc b/gr-noaa/lib/noaa_hrpt_decoder.cc deleted file mode 100644 index d6a063285..000000000 --- a/gr-noaa/lib/noaa_hrpt_decoder.cc +++ /dev/null @@ -1,200 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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 <noaa_hrpt_decoder.h> -#include <noaa_hrpt.h> -#include <gr_io_signature.h> -#include <cstdio> - -static const char *hrpt_ids[] = { - "000000", - "NOAA11", - "000002", - "NOAA16", - "000004", - "000005", - "000006", - "NOAA15", - "000008", - "NOAA12", - "000010", - "NOAA17", - "000012", - "NOAA18", - "000014", - "NOAA19" -}; - -noaa_hrpt_decoder_sptr -noaa_make_hrpt_decoder(bool verbose, bool output_files) -{ - return gnuradio::get_initial_sptr(new noaa_hrpt_decoder(verbose, output_files)); -} - -noaa_hrpt_decoder::noaa_hrpt_decoder(bool verbose, bool output_files) - : gr_sync_block("noaa_hrpt_decoder", - gr_make_io_signature(1, 1, sizeof(short)), - gr_make_io_signature(0, 0, 0)), - d_verbose(verbose), - d_output_files(output_files), - d_word_num(0), - d_frames_seen(0), - d_current_mfnum(0), - d_expected_mfnum(0), - d_seq_errs(0), - d_address(0), - d_day_of_year(0), - d_milliseconds(0), - d_last_time(0) -{ - // Start of capture processing here -} - -int -noaa_hrpt_decoder::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned short *in = (const unsigned short*)input_items[0]; - - int i = 0; - while (i < noutput_items) { - d_current_word = in[i++] & 0x3FF; - d_word_num++; - - // Per HRPT word processing here - - switch (d_word_num) { - case 7: - process_mfnum(); - process_address(); - break; - - case 9: - process_day_of_year(); - break; - - case 10: - process_milli1(); - break; - - case 11: - process_milli2(); - break; - - case 12: - process_milli3(); - break; - - default: - break; - } - - if (d_word_num == HRPT_MINOR_FRAME_WORDS) { - - // End of minor frame processing here - d_frames_seen++; - d_word_num = 0; - fprintf(stderr, "\n"); - } - } - - return i; -} - -void -noaa_hrpt_decoder::process_mfnum() -{ - d_current_mfnum = (d_current_word & 0x180) >> 7; - - if (d_verbose) - fprintf(stderr, "MF:"); - - if (d_current_mfnum != d_expected_mfnum && d_frames_seen > 0) { - d_seq_errs++; - - if (d_verbose) - fprintf(stderr, "*"); - } - else - if (d_verbose) - fprintf(stderr, " "); - - if (d_verbose) - fprintf(stderr, "%i ", d_current_mfnum); - d_expected_mfnum = (d_current_mfnum == 3) ? 1 : d_current_mfnum+1; -} - -void -noaa_hrpt_decoder::process_address() -{ - d_address = ((d_current_word & 0x078) >> 3) & 0x000F; - - if (d_verbose) - fprintf(stderr, "SA: %s ", hrpt_ids[d_address]); -} - -void -noaa_hrpt_decoder::process_day_of_year() -{ - d_day_of_year = d_current_word >> 1; - - if (d_verbose) - fprintf(stderr, "DOY: %3i ", d_day_of_year); -} - -void -noaa_hrpt_decoder::process_milli1() -{ - d_milliseconds = (d_current_word & 0x7F) << 20; -} - -void -noaa_hrpt_decoder::process_milli2() -{ - d_milliseconds |= (d_current_word << 10); -} - -void -noaa_hrpt_decoder::process_milli3() -{ - d_milliseconds |= d_current_word; - int delta = d_milliseconds - d_last_time; - d_last_time = d_milliseconds; - - if (d_verbose) - fprintf(stderr, "MS: %8i DT: %8i", d_milliseconds, delta); -} - -noaa_hrpt_decoder::~noaa_hrpt_decoder() -{ - // End of capture processing here - - if (d_verbose) { - fprintf(stderr, "Frames seen: %10i\n", d_frames_seen); - fprintf(stderr, "Sequence errors: %10i\n", d_seq_errs); - } -} diff --git a/gr-noaa/lib/noaa_hrpt_decoder.h b/gr-noaa/lib/noaa_hrpt_decoder.h deleted file mode 100644 index 3b3214b72..000000000 --- a/gr-noaa/lib/noaa_hrpt_decoder.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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 INCLUDED_NOAA_HRPT_DECODER_H -#define INCLUDED_NOAA_HRPT_DECODER_H - -#include <noaa_api.h> -#include <gr_sync_block.h> - -class noaa_hrpt_decoder; -typedef boost::shared_ptr<noaa_hrpt_decoder> noaa_hrpt_decoder_sptr; - -NOAA_API noaa_hrpt_decoder_sptr -noaa_make_hrpt_decoder(bool verbose, bool output_files); - -class NOAA_API noaa_hrpt_decoder : public gr_sync_block -{ - friend NOAA_API noaa_hrpt_decoder_sptr noaa_make_hrpt_decoder(bool verbose, bool output_files); - noaa_hrpt_decoder(bool verbose, bool output_files); - - // Configuration - bool d_verbose; - bool d_output_files; - - // Frame-level state - unsigned short d_current_word; - unsigned int d_word_num; - int d_frames_seen; - - // Minor frame number - int d_current_mfnum; - int d_expected_mfnum; - int d_seq_errs; - - // Spacecraft address - int d_address; - - // Minor frame timestamp - int d_day_of_year; - int d_milliseconds; - int d_last_time; - - void process_mfnum(); - void process_address(); - void process_day_of_year(); - void process_milli1(); - void process_milli2(); - void process_milli3(); - -public: - ~noaa_hrpt_decoder(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_NOAA_HRPT_DECODER_H */ diff --git a/gr-noaa/lib/noaa_hrpt_deframer.cc b/gr-noaa/lib/noaa_hrpt_deframer.cc deleted file mode 100644 index d668ccad3..000000000 --- a/gr-noaa/lib/noaa_hrpt_deframer.cc +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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 <noaa_hrpt_deframer.h> -#include <gr_io_signature.h> -#include <noaa_hrpt.h> -#include <cstring> -#include <cstdio> - -#define ST_IDLE 0 -#define ST_SYNCED 1 - -noaa_hrpt_deframer_sptr -noaa_make_hrpt_deframer() -{ - return gnuradio::get_initial_sptr(new noaa_hrpt_deframer()); -} - -noaa_hrpt_deframer::noaa_hrpt_deframer() - : gr_block("noaa_hrpt_deframer", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(short))) -{ - set_output_multiple(6); // room for writing full sync when received - d_mid_bit = true; - d_last_bit = 0; - enter_idle(); -} - -void -noaa_hrpt_deframer::enter_idle() -{ - d_state = ST_IDLE; -} - -void -noaa_hrpt_deframer::enter_synced() -{ - d_state = ST_SYNCED; - d_bit_count = HRPT_BITS_PER_WORD; - d_word_count = HRPT_MINOR_FRAME_WORDS-HRPT_SYNC_WORDS; - d_word = 0; -} - -int -noaa_hrpt_deframer::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ninputs = ninput_items[0]; - const char *in = (const char *)input_items[0]; - unsigned short *out = (unsigned short *)output_items[0]; - - int i = 0, j = 0; - while (i < ninputs && j < noutput_items) { - char bit = in[i++]; - char diff = bit^d_last_bit; - d_last_bit = bit; - - // Wait for transition if not synced, otherwise, alternate bits - if (d_mid_bit && (diff | (d_state == ST_SYNCED))) { - switch (d_state) { - case ST_IDLE: - d_shifter = (d_shifter << 1) | bit; // MSB transmitted first - - if ((d_shifter & 0x0FFFFFFFFFFFFFFFLL) == HRPT_MINOR_FRAME_SYNC) { - out[j++] = HRPT_SYNC1; - out[j++] = HRPT_SYNC2; - out[j++] = HRPT_SYNC3; - out[j++] = HRPT_SYNC4; - out[j++] = HRPT_SYNC5; - out[j++] = HRPT_SYNC6; - enter_synced(); - } - break; - - case ST_SYNCED: - d_word = (d_word << 1) | bit; // MSB transmitted first - if (--d_bit_count == 0) { - out[j++] = d_word; - d_word = 0; - d_bit_count = HRPT_BITS_PER_WORD; - if (--d_word_count == 0) { - enter_idle(); - } - } - break; - - default: - throw std::runtime_error("noaa_hrpt_deframer: bad state\n"); - } - - d_mid_bit = false; - } - else { - d_mid_bit = true; - } - } - - consume_each(i); - return j; -} diff --git a/gr-noaa/lib/noaa_hrpt_deframer.h b/gr-noaa/lib/noaa_hrpt_deframer.h deleted file mode 100644 index 475ad90f6..000000000 --- a/gr-noaa/lib/noaa_hrpt_deframer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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 INCLUDED_NOAA_HRPT_DEFRAMER_H -#define INCLUDED_NOAA_HRPT_DEFRAMER_H - -#include <noaa_api.h> -#include <gr_block.h> - -class noaa_hrpt_deframer; -typedef boost::shared_ptr<noaa_hrpt_deframer> noaa_hrpt_deframer_sptr; - -NOAA_API noaa_hrpt_deframer_sptr -noaa_make_hrpt_deframer(); - -class NOAA_API noaa_hrpt_deframer : public gr_block -{ - friend NOAA_API noaa_hrpt_deframer_sptr noaa_make_hrpt_deframer(); - noaa_hrpt_deframer(); - - unsigned int d_state; - bool d_mid_bit; - unsigned char d_last_bit; - unsigned int d_bit_count; - unsigned int d_word_count; - unsigned long long d_shifter; // 60 bit sync word - unsigned short d_word; // 10 bit HRPT word - - void enter_idle(); - void enter_synced(); - -public: - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_NOAA_HRPT_DEFRAMER_H */ diff --git a/gr-noaa/lib/noaa_hrpt_pll_cf.cc b/gr-noaa/lib/noaa_hrpt_pll_cf.cc deleted file mode 100644 index ea948f04b..000000000 --- a/gr-noaa/lib/noaa_hrpt_pll_cf.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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 <noaa_hrpt_pll_cf.h> -#include <gr_io_signature.h> -#include <gr_math.h> -#include <gr_sincos.h> - -#define M_TWOPI (2*M_PI) - -noaa_hrpt_pll_cf_sptr -noaa_make_hrpt_pll_cf(float alpha, float beta, float max_offset) -{ - return gnuradio::get_initial_sptr(new noaa_hrpt_pll_cf(alpha, beta, max_offset)); -} - -noaa_hrpt_pll_cf::noaa_hrpt_pll_cf(float alpha, float beta, float max_offset) - : gr_sync_block("noaa_hrpt_pll_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))), - d_alpha(alpha), d_beta(beta), d_max_offset(max_offset), - d_phase(0.0), d_freq(0.0) -{ -} - -float -phase_wrap(float phase) -{ - while (phase < -M_PI) - phase += M_TWOPI; - while (phase > M_PI) - phase -= M_TWOPI; - - return phase; -} - -int -noaa_hrpt_pll_cf::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - float *out = (float *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) { - - // Generate and mix out carrier - float re, im; - gr_sincosf(d_phase, &im, &re); - out[i] = (in[i]*gr_complex(re, -im)).imag(); - - // Adjust PLL phase/frequency - float error = phase_wrap(gr_fast_atan2f(in[i].imag(), in[i].real()) - d_phase); - d_freq = gr_branchless_clip(d_freq + error*d_beta, d_max_offset); - d_phase = phase_wrap(d_phase + error*d_alpha + d_freq); - - } - - return noutput_items; -} diff --git a/gr-noaa/lib/noaa_hrpt_pll_cf.h b/gr-noaa/lib/noaa_hrpt_pll_cf.h deleted file mode 100644 index 178dccfb3..000000000 --- a/gr-noaa/lib/noaa_hrpt_pll_cf.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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 INCLUDED_NOAA_HRPT_PLL_CF_H -#define INCLUDED_NOAA_HRPT_PLL_CF_H - -#include <noaa_api.h> -#include <gr_sync_block.h> - -class noaa_hrpt_pll_cf; -typedef boost::shared_ptr<noaa_hrpt_pll_cf> noaa_hrpt_pll_cf_sptr; - -NOAA_API noaa_hrpt_pll_cf_sptr -noaa_make_hrpt_pll_cf(float alpha, float beta, float max_offset); - -class NOAA_API noaa_hrpt_pll_cf : public gr_sync_block -{ - friend NOAA_API noaa_hrpt_pll_cf_sptr noaa_make_hrpt_pll_cf(float alpha, float beta, float max_offset); - noaa_hrpt_pll_cf(float alpha, float beta, float max_offset); - - float d_alpha; // 1st order loop constant - float d_beta; // 2nd order loop constant - float d_max_offset; // Maximum frequency offset, radians/sample - float d_phase; // Instantaneous carrier phase - float d_freq; // Instantaneous carrier frequency, radians/sample - - public: - virtual int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_alpha(float alpha) { d_alpha = alpha; } - void set_beta(float beta) { d_beta = beta; } - void set_max_offset(float max_offset) { d_max_offset = max_offset; } -}; - -#endif /* INCLUDED_NOAA_HRPT_PLL_CF_H */ diff --git a/gr-noaa/oct/frames-to-png.sh b/gr-noaa/oct/frames-to-png.sh deleted file mode 100755 index cb3e3fb7d..000000000 --- a/gr-noaa/oct/frames-to-png.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -octave --eval frames_to_ppm - -convert chan1.ppm chan1.png && rm chan1.ppm -convert chan2.ppm chan2.png && rm chan2.ppm -convert chan3.ppm chan3.png && rm chan3.ppm -convert chan4.ppm chan4.png && rm chan4.ppm -convert chan5.ppm chan5.png && rm chan5.ppm diff --git a/gr-noaa/oct/frames_to_ppm.m b/gr-noaa/oct/frames_to_ppm.m deleted file mode 100644 index 099f96f2b..000000000 --- a/gr-noaa/oct/frames_to_ppm.m +++ /dev/null @@ -1,85 +0,0 @@ -% -*- octave -*- -% -% Copyright 2009 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. -% - -% Extract AVHRR images from HRPT frames.dat -clear - -fid = fopen('frames.hrpt'); -dat = fread(fid, 'uint16'); - -frame_len = 11090; - -len = floor(length(dat) / frame_len); - -chan1 = zeros(len, 2048); - -start = 751; -stop = 10986; - -for line = 1:len - chan1(line, 1:2048) = dat(start:5:stop)'; - start = start + frame_len; - stop = stop + frame_len; -end - -start = 752; -stop = 10987; - -for line = 1:len - chan2(line, 1:2048) = dat(start:5:stop)'; -start = start + frame_len; -stop = stop + frame_len; -end - -start = 753; -stop = 10988; - -for line = 1:len - chan3(line, 1:2048) = dat(start:5:stop)'; - start = start + frame_len; - stop = stop + frame_len; -end - -start = 754; -stop = 10989; - -for line = 1:len - chan4(line, 1:2048) = dat(start:5:stop)'; -start = start + frame_len; -stop = stop + frame_len; -end - -start = 755; -stop = 10990; - -for line = 1:len - chan5(line, 1:2048) = dat(start:5:stop)'; - start = start + frame_len; - stop = stop + frame_len; -end - -colormap(gray) -saveimage("chan1.ppm", chan1/4, 'ppm') -saveimage("chan2.ppm", chan2/4, 'ppm') -saveimage("chan3.ppm", chan3/4, 'ppm') -saveimage("chan4.ppm", chan4/4, 'ppm') -saveimage("chan5.ppm", chan5/4, 'ppm') diff --git a/gr-noaa/swig/CMakeLists.txt b/gr-noaa/swig/CMakeLists.txt deleted file mode 100644 index 532984036..000000000 --- a/gr-noaa/swig/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_INCLUDE_DIRS - ${GR_NOAA_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/noaa_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib) - -set(GR_SWIG_LIBRARIES gnuradio-noaa) - -GR_SWIG_MAKE(noaa_swig noaa_swig.i) - -GR_SWIG_INSTALL( - TARGETS noaa_swig - DESTINATION ${GR_PYTHON_DIR}/gnuradio/noaa - COMPONENT "noaa_python" -) - -install( - FILES - noaa_swig.i - noaa_hrpt_decoder.i - noaa_hrpt_deframer.i - noaa_hrpt_pll_cf.i - ${CMAKE_CURRENT_BINARY_DIR}/noaa_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "noaa_swig" -) - -GR_PYTHON_INSTALL( - FILES - __init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/noaa - COMPONENT "noaa_python" -) diff --git a/gr-noaa/swig/__init__.py b/gr-noaa/swig/__init__.py deleted file mode 100644 index 5ea4d934c..000000000 --- a/gr-noaa/swig/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright 2009 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. -# - -# The presence of this file turns this directory into a Python package - -''' -The GNU Radio NOAA package. -''' - -# Add SWIG generated code to this namespace -from noaa_swig import * - -# Add other content from pure-Python modules here - diff --git a/gr-noaa/swig/gnuradio/noaa.scm b/gr-noaa/swig/gnuradio/noaa.scm deleted file mode 100644 index 0bb4725ce..000000000 --- a/gr-noaa/swig/gnuradio/noaa.scm +++ /dev/null @@ -1,27 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see <http://www.gnu.org/licenses/>. -;;; - -;;; Module that just re-exports the noaa_swig module - -(define-module (gnuradio noaa) - #:use-module (gnuradio export-safely) - #:use-module (gnuradio noaa_swig) - #:duplicates (merge-generics replace check)) - -(re-export-all '(gnuradio noaa_swig)) diff --git a/gr-noaa/swig/noaa_hrpt_decoder.i b/gr-noaa/swig/noaa_hrpt_decoder.i deleted file mode 100644 index a3f8f48c3..000000000 --- a/gr-noaa/swig/noaa_hrpt_decoder.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -GR_SWIG_BLOCK_MAGIC(noaa,hrpt_decoder) - -noaa_hrpt_decoder_sptr -noaa_make_hrpt_decoder(bool verbose, bool output_files); - -class noaa_hrpt_decoder : public gr_sync_block -{ -private: - noaa_hrpt_decoder(); -}; diff --git a/gr-noaa/swig/noaa_hrpt_deframer.i b/gr-noaa/swig/noaa_hrpt_deframer.i deleted file mode 100644 index 833ad18ad..000000000 --- a/gr-noaa/swig/noaa_hrpt_deframer.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -GR_SWIG_BLOCK_MAGIC(noaa,hrpt_deframer) - -noaa_hrpt_deframer_sptr -noaa_make_hrpt_deframer(); - -class noaa_hrpt_deframer : public gr_block -{ -private: - noaa_hrpt_deframer(); -}; diff --git a/gr-noaa/swig/noaa_hrpt_pll_cf.i b/gr-noaa/swig/noaa_hrpt_pll_cf.i deleted file mode 100644 index 2a5f524b3..000000000 --- a/gr-noaa/swig/noaa_hrpt_pll_cf.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -GR_SWIG_BLOCK_MAGIC(noaa,hrpt_pll_cf) - -noaa_hrpt_pll_cf_sptr -noaa_make_hrpt_pll_cf(float alpha, float beta, float max_offset); - -class noaa_hrpt_pll_cf : public gr_sync_block -{ -private: - noaa_hrpt_pll_cf(); - -public: - void set_alpha(float alpha); - void set_beta(float beta); - void set_max_offset(float min_freq); -}; diff --git a/gr-noaa/swig/noaa_swig.i b/gr-noaa/swig/noaa_swig.i deleted file mode 100644 index 3c4d19650..000000000 --- a/gr-noaa/swig/noaa_swig.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -%include "gnuradio.i" - -//load generated python docstrings -%include "noaa_swig_doc.i" - -%{ -#include <noaa_hrpt_decoder.h> -#include <noaa_hrpt_deframer.h> -#include <noaa_hrpt_pll_cf.h> -%} - -%include "noaa_hrpt_decoder.i" -%include "noaa_hrpt_deframer.i" -%include "noaa_hrpt_pll_cf.i" diff --git a/gr-pager/CMakeLists.txt b/gr-pager/CMakeLists.txt deleted file mode 100644 index 845444859..000000000 --- a/gr-pager/CMakeLists.txt +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) -GR_REGISTER_COMPONENT("gr-pager" ENABLE_GR_PAGER - Boost_FOUND - ENABLE_GR_CORE -) - -GR_SET_GLOBAL(GR_PAGER_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/lib -) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_PAGER) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_PAGER_DESCRIPTION "GNU Radio Pager Blocks") - -CPACK_COMPONENT("pager_runtime" - GROUP "Pager" - DISPLAY_NAME "Runtime" - DESCRIPTION "Runtime" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("pager_devel" - GROUP "Pager" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("pager_python" - GROUP "Pager" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime; GRC xml files" - DEPENDS "core_python;pager_runtime" -) - -CPACK_COMPONENT("pager_swig" - GROUP "Pager" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;pager_python;pager_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(lib) -if(ENABLE_PYTHON) - add_subdirectory(python) - add_subdirectory(swig) - add_subdirectory(grc) - add_subdirectory(apps) -endif(ENABLE_PYTHON) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-pager.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-pager.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-pager.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "pager_devel" -) - -endif(ENABLE_GR_PAGER) diff --git a/gr-pager/README b/gr-pager/README deleted file mode 100644 index 441fee0b4..000000000 --- a/gr-pager/README +++ /dev/null @@ -1,85 +0,0 @@ -This GNU Radio component implements a FLEX radiopager receiver/demodulator. - -FLEX pager towers are between 929 MHz and 932 MHz at 25 KHz centers. - -Current status (7/16/07): - -FLEX receiving is completed except for addition of BCH error correction. - -There are three scripts: - -usrp_flex.py - Receives and displays pages from a single paging channel. To - work from recorded data, record from USRP with decimation 256 - at center frequency. - - Usage: usrp_flex.py [options] - - Options: - -h, --help show this help message and exit - -f Hz, --frequency=Hz set receive frequency to Hz - -R SUBDEV, --rx-subdev-spec=SUBDEV select USRP Rx side A or B - -c Hz, --calibration=Hz set frequency offset to Hz - -g dB, --gain=dB set RF gain - -l, --log log flowgraph to files (LOTS of data) - -v, --verbose display debug output - -F FROM_FILE, --from-file=FROM_FILE read samples from file instead of USRP - - Example, to receive from 931.95M (a common nationwide channel) with DBSRX in - side A of USRP: - - $ usrp_flex.py -f 931.95M -g 32 -R A - - -usrp_flex_band.py - Receives and displays pages from a 1 MHz paging band (40 pager - channels.) To work from recorded data, record from USRP with - decimation 64 at center frequency. - -Usage: usrp_flex_band.py [options] - - Options: - -h, --help show this help message and exit - -f Hz, --frequency=Hz set receive center frequency to Hz - -R SUBDEV, --rx-subdev-spec=SUBDEV select USRP Rx side A or B - -c Hz, --calibration=Hz set frequency offset to Hz - -g dB, --gain=dB set RF gain - -F FROM_FILE, --from-file=FROM_FILE Read from file instead of USRP - -l, --log log flowgraph to files (LOTS of data) - -v, --verbose display debug output - - Example, to receive from the lower third of the pager band with DBSRX in side B - of USRP: - - $ usrp_flex_band.py -f 929.5M -g 32 -R B - -usrp_flex_all.py - Receives and displays pages from entire pager band (3 MHz, - 120 pager channels.) This does not work in real time due - to CPU limitations, but can work from recorded USRP data. To - work from recorded data, record from USRP with decimation 20 at - center frequency of 930.5M. - - Usage: usrp_flex_all.py [options] - - Options: - -h, --help show this help message and exit - -R SUBDEV, --rx-subdev-spec=SUBDEVC select USRP Rx side A or B - -c Hz, --calibration=Hz set frequency offset to Hz - -g dB, --gain=dB set RF gain - -F FROM_FILE, --from-file=FROM_FILE Read from file instead of USRP - -l, --log log flowgraph to files (LOTS of data) - -v, --verbose display debug output - - Example, to receive all pager channels with DBSRX in side A: - - $ usrp_flex_all.py -R A - -The demodulator is relatively sensitive to frequency offset and can capture a signal -within 3k of the actual signal. - -All three scripts take a 'calibration' parameter, which specifies the frequency offset -of the daughterboard. This causes the USRP to be tuned to the given center frequency -plus the calibration offset. For example, if your DBSRX shows 930MHz as 930.001MHz in -usrp_fft.py, then use '-c 1k' in the command line to automatically add this. - -Johnathan Corgan -Corgan Enterprises LLC -jcorgan@corganenterprises.com diff --git a/gr-pager/apps/CMakeLists.txt b/gr-pager/apps/CMakeLists.txt deleted file mode 100644 index a02cad56e..000000000 --- a/gr-pager/apps/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2011 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. - -include(GrPython) - -GR_PYTHON_INSTALL( - PROGRAMS - usrp_flex - usrp_flex_all - usrp_flex_band - DESTINATION ${GR_RUNTIME_DIR} - COMPONENT "pager_python" -) diff --git a/gr-pager/apps/usrp_flex b/gr-pager/apps/usrp_flex deleted file mode 100755 index 33877ea4e..000000000 --- a/gr-pager/apps/usrp_flex +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2009,2011 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. -# - -from gnuradio import gr, gru, uhd, optfir, eng_notation, pager -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import time, os, sys - -class app_top_block(gr.top_block): - def __init__(self, options, queue): - gr.top_block.__init__(self, "usrp_flex") - self.options = options - self.offset = 0.0 - self.adj_time = time.time() - self.verbose = options.verbose - - if options.from_file is None: - # Set up USRP source - self.u = uhd.usrp_source(device_addr=options.address, stream_args=uhd.stream_args('fc32')) - - # Grab 250 KHz of spectrum - # (A UHD facility to get sample rate range and granularity would be useful) - self.u.set_samp_rate(250e3) - rate = self.u.get_samp_rate() - if rate != 250e3: - print "Unable to set required sample rate of 250 Ksps (got %f)" % rate - sys.exit(1) - - # Tune daughterboard - r = self.u.set_center_freq(options.freq+options.calibration, 0) - if not r: - frange = self.u.get_freq_range() - sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \ - (freq, frange.start(), frange.stop())) - sys.exit(1) - - # if no gain was specified, use the mid-point in dB - if options.rx_gain is None: - grange = self.u.get_gain_range() - options.rx_gain = float(grange.start()+grange.stop())/2.0 - print "\nNo gain specified." - print "Setting gain to %f (from [%f, %f])" % \ - (options.rx_gain, grange.start(), grange.stop()) - - self.u.set_gain(options.rx_gain, 0) - - else: - # Use supplied file as source of samples - self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file) - if options.verbose: - print "Reading samples from", options.from_file - - if options.log and not options.from_file: - usrp_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat') - self.connect(self.u, usrp_sink) - - # Set up 22KHz-wide bandpass about center frequency. Decimate by 10 - # to get channel rate of 25Ksps - taps = optfir.low_pass(1.0, # Filter gain - 250e3, # Sample rate - 11000, # One-sided modulation bandwidth - 12500, # One-sided channel bandwidth - 0.1, # Passband ripple - 60) # Stopband attenuation - - if options.verbose: - print "Channel filter has", len(taps), "taps." - - self.chan = gr.freq_xlating_fir_filter_ccf(10, # Decimation rate - taps, # Filter taps - 0.0, # Offset frequency - 250e3) # Sample rate - - if options.log: - chan_sink = gr.file_sink(gr.sizeof_gr_complex, 'chan.dat') - self.connect(self.chan, chan_sink) - - # FLEX protocol demodulator - self.flex = pager.flex_demod(queue, options.freq, options.verbose, options.log) - - self.connect(self.u, self.chan, self.flex) - - def freq_offset(self): - return self.flex.dc_offset()*1600 - - def adjust_freq(self): - if time.time() - self.adj_time > 1.6: # Only do it once per FLEX frame - self.adj_time = time.time() - self.offset -= self.freq_offset() - self.chan.set_center_freq(self.offset) - if self.verbose: - print "Channel frequency offset (Hz):", int(self.offset) - - -def get_options(): - parser = OptionParser(option_class=eng_option) - - parser.add_option('-f', '--freq', type="eng_float", default=None, - help="Set receive frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2", - help="Address of UHD device, [default=%default]") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--rx-gain", type="eng_float", default=None, - help="set receive gain in dB (default is midpoint)") - parser.add_option("-c", "--calibration", type="eng_float", default=0.0, - help="set frequency offset to Hz", metavar="Hz") - parser.add_option("-v", "--verbose", action="store_true", default=False) - parser.add_option("-l", "--log", action="store_true", default=False, - help="log flowgraph to files (LOTS of data)") - parser.add_option("-F", "--from-file", default=None, - help="read samples from file instead of USRP") - - (options, args) = parser.parse_args() - - if len(args) > 0: - print "Run 'usrp_flex.py -h' for options." - sys.exit(1) - - if (options.freq is None): - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - sys.exit(1) - - return (options, args) - -if __name__ == "__main__": - - (options, args) = get_options() - - # Flow graph emits pages into message queue - queue = gr.msg_queue() - tb = app_top_block(options, queue) - runner = pager.queue_runner(queue) - - try: - tb.run() - except KeyboardInterrupt: - pass - - runner.end() - diff --git a/gr-pager/apps/usrp_flex_all b/gr-pager/apps/usrp_flex_all deleted file mode 100755 index 8ecf5a41f..000000000 --- a/gr-pager/apps/usrp_flex_all +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2009 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. -# - -from gnuradio import gr, gru, uhd, optfir, eng_notation, blks2, pager -from gnuradio.eng_option import eng_option -from optparse import OptionParser -from string import split, join, printable -import sys - -class app_top_block(gr.top_block): - def __init__(self, options, queue): - gr.top_block.__init__(self, "usrp_flex_all") - - if options.from_file is not None: - self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file) - self.nchan = options.nchan - if options.verbose: - print "Reading samples from file", options.from_file - print "User specified file contains", options.nchan, "25 KHz channels." - - else: - # Set up USRP source - self.u = uhd.usrp_source(device_addr=options.address, stream_args=uhd.stream_args('fc32')) - - # Tune daughterboard - r = self.u.set_center_freq(options.freq+options.calibration, 0) - if not r: - frange = self.u.get_freq_range() - sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \ - (freq, frange.start(), frange.stop())) - sys.exit(1) - - if options.verbose: - print "Tuned to center frequency", (options.freq+options.calibration)/1e6, "MHz" - - # if no gain was specified, use the mid-point in dB - if options.rx_gain is None: - grange = self.u.get_gain_range() - options.rx_gain = float(grange.start()+grange.stop())/2.0 - print "\nNo gain specified." - print "Setting gain to %f (from [%f, %f])" % \ - (options.rx_gain, grange.start(), grange.stop()) - - self.u.set_gain(options.rx_gain, 0) - - # Grab >=3 MHz of spectrum, evenly divisible by 25 KHz channels - # (A UHD facility to get sample rate range and granularity would be useful) - - self.u.set_samp_rate(3.125e6) # Works if USRP is 100 Msps and can decimate by 32 - rate = self.u.get_samp_rate() - - if rate != 3.125e6: - self.u.set_samp_rate(3.2e6) # Works if USRP is 64 Msps and can decimate by 20 - rate = self.u.get_samp_rate() - if (rate != 3.2e6): - print "Unable to set required sample rate for >= 3MHz of 25 KHz channels." - sys.exit(1) - - self.nchan = int(rate/25e3) - if options.verbose: - print "\nReceiving", rate/1e6, "MHz of bandwidth containing", self.nchan, "baseband channels." - - taps = gr.firdes.low_pass(1.0, - 1.0, - 1.0/self.nchan*0.4, - 1.0/self.nchan*0.1, - gr.firdes.WIN_HANN) - - if options.verbose: - print "Channel filter has", len(taps), "taps" - - self.bank = blks2.analysis_filterbank(self.nchan, taps) - self.connect(self.u, self.bank) - - if options.log and options.from_file == None: - src_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat') - self.connect(self.u, src_sink) - - mid_chan = int(self.nchan/2) - for i in range(self.nchan): - if i < mid_chan: - freq = options.freq+i*25e3 - else: - freq = options.freq-(self.nchan-i)*25e3 - - if (freq < 929.0e6 or freq > 932.0e6): - self.connect((self.bank, i), gr.null_sink(gr.sizeof_gr_complex)) - else: - self.connect((self.bank, i), pager.flex_demod(queue, freq, options.verbose, options.log)) - if options.log: - self.connect((self.bank, i), gr.file_sink(gr.sizeof_gr_complex, 'chan_'+'%3.3f'%(freq/1e6)+'.dat')) - - -def get_options(): - parser = OptionParser(option_class=eng_option) - - parser.add_option('-f', '--freq', type="eng_float", default=929.5125e6, - help="Set receive frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2", - help="Address of UHD device, [default=%default]") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--rx-gain", type="eng_float", default=None, - help="set receive gain in dB (default is midpoint)") - parser.add_option("-c", "--calibration", type="eng_float", default=0.0, - help="set frequency offset to Hz", metavar="Hz") - parser.add_option("-v", "--verbose", action="store_true", default=False) - parser.add_option("-l", "--log", action="store_true", default=False, - help="log flowgraph to files (LOTS of data)") - parser.add_option("-F", "--from-file", default=None, - help="read samples from file instead of USRP") - parser.add_option("", "--nchan", type="int", default=None, - help="set to number of channels in capture file", metavar="nchan") - - (options, args) = parser.parse_args() - - if len(args) > 0: - print "Run 'usrp_flex_all.py -h' for options." - sys.exit(1) - - if options.nchan is None and options.from_file is not None: - print "You must specify the number of baseband channels with --nchan when reading from a file" - sys.exit(1) - - return (options, args) - - -def main(): - - (options, args) = get_options() - - queue = gr.msg_queue() - tb = app_top_block(options, queue) - runner = pager.queue_runner(queue) - - try: - tb.run() - except KeyboardInterrupt: - pass - - runner.end() - -if __name__ == "__main__": - main() diff --git a/gr-pager/apps/usrp_flex_band b/gr-pager/apps/usrp_flex_band deleted file mode 100755 index 5ec0065d6..000000000 --- a/gr-pager/apps/usrp_flex_band +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2009,2011 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. -# - -from gnuradio import gr, gru, uhd, optfir, eng_notation, blks2, pager -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -class app_top_block(gr.top_block): - def __init__(self, options, queue): - gr.top_block.__init__(self, "usrp_flex_all") - - if options.from_file is not None: - self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file) - if options.verbose: - print "Reading samples from file", options.from_file - else: - # Set up USRP source - self.u = uhd.usrp_source(device_addr=options.address, stream_args=uhd.stream_args('fc32')) - - # Grab 1 MHz of spectrum - # (A UHD facility to get sample rate range and granularity would be useful) - self.u.set_samp_rate(1e6) - rate = self.u.get_samp_rate() - if rate != 1e6: - print "Unable to set required sample rate of 1 Msps (got %f)" % rate - sys.exit(1) - - # Tune daughterboard - r = self.u.set_center_freq(options.freq+options.calibration, 0) - if not r: - frange = self.u.get_freq_range() - sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \ - (freq, frange.start(), frange.stop())) - sys.exit(1) - - # if no gain was specified, use the mid-point in dB - if options.rx_gain is None: - grange = self.u.get_gain_range() - options.rx_gain = float(grange.start()+grange.stop())/2.0 - print "\nNo gain specified." - print "Setting gain to %f (from [%f, %f])" % \ - (options.rx_gain, grange.start(), grange.stop()) - - self.u.set_gain(options.rx_gain, 0) - - - taps = gr.firdes.low_pass(1.0, - 1.0, - 1.0/40.0*0.4, - 1.0/40.0*0.1, - gr.firdes.WIN_HANN) - - if options.verbose: - print "Channel filter has", len(taps), "taps" - - bank = blks2.analysis_filterbank(40, taps) - self.connect(self.u, bank) - - if options.log and options.from_file == None: - src_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat') - self.connect(self.u, src_sink) - - for i in range(40): - if i < 20: - freq = options.freq+i*25e3 - else: - freq = options.freq-0.5e6+(i-20)*25e3 - - self.connect((bank, i), pager.flex_demod(queue, freq, options.verbose, options.log)) - if options.log: - self.connect((bank, i), gr.file_sink(gr.sizeof_gr_complex, 'chan_'+'%3.3f'%(freq/1e6)+'.dat')) - - -def get_options(): - parser = OptionParser(option_class=eng_option) - - parser.add_option('-f', '--freq', type="eng_float", default=None, - help="Set receive frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2", - help="Address of UHD device, [default=%default]") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--rx-gain", type="eng_float", default=None, - help="set receive gain in dB (default is midpoint)") - parser.add_option("-c", "--calibration", type="eng_float", default=0.0, - help="set frequency offset to Hz", metavar="Hz") - parser.add_option("-v", "--verbose", action="store_true", default=False) - parser.add_option("-l", "--log", action="store_true", default=False, - help="log flowgraph to files (LOTS of data)") - parser.add_option("-F", "--from-file", default=None, - help="read samples from file instead of USRP") - - (options, args) = parser.parse_args() - - if len(args) > 0: - print "Run 'usrp_flex_band.py -h' for options." - sys.exit(1) - - if (options.freq is None): - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - sys.exit(1) - - return (options, args) - - -if __name__ == "__main__": - - (options, args) = get_options() - - queue = gr.msg_queue() - tb = app_top_block(options, queue) - runner = pager.queue_runner(queue) - - try: - tb.run() - except KeyboardInterrupt: - pass - - runner.end() - - diff --git a/gr-pager/apps/usrp_rx_flex.grc b/gr-pager/apps/usrp_rx_flex.grc deleted file mode 100644 index b9461a57f..000000000 --- a/gr-pager/apps/usrp_rx_flex.grc +++ /dev/null @@ -1,1804 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Oct 29 11:01:22 2009</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>usrp_rx_flex</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>USRP FLEX Pager Receiver (Single Channel)</value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>4095,4095</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>adc_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>64e6</value> - </param> - <param> - <key>_coordinate</key> - <value>(225, 12)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sample_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>adc_rate/decim</value> - </param> - <param> - <key>_coordinate</key> - <value>(382, 12)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>band_freq+(channel-61)*25e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(480, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>FLEX Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>sample_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>band_freq</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>ref_scale</key> - <value>65536</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>0,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value>displays,0</value> - </param> - <param> - <key>_coordinate</key> - <value>(34, 508)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>displays</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['RX Spectrum','Baseband']</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 5</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(9, 209)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import os, math</value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 76)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>usrp_simple_source_x</key> - <param> - <key>id</key> - <value>usrp_source</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>format</key> - <value></value> - </param> - <param> - <key>which</key> - <value>0</value> - </param> - <param> - <key>decimation</key> - <value>decim</value> - </param> - <param> - <key>frequency</key> - <value>band_freq</value> - </param> - <param> - <key>lo_offset</key> - <value>float('inf')</value> - </param> - <param> - <key>gain</key> - <value>rx_gain</value> - </param> - <param> - <key>side</key> - <value>A</value> - </param> - <param> - <key>rx_ant</key> - <value>RXA</value> - </param> - <param> - <key>hb_filters</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(32, 734)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_freq_xlating_fir_filter_xxx</key> - <param> - <key>id</key> - <value>gr_freq_xlating_fir_filter_xxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ccc</value> - </param> - <param> - <key>decim</key> - <value>channel_decim</value> - </param> - <param> - <key>taps</key> - <value>channel_taps</value> - </param> - <param> - <key>center_freq</key> - <value>band_freq-freq+offset</value> - </param> - <param> - <key>samp_rate</key> - <value>sample_rate</value> - </param> - <param> - <key>_coordinate</key> - <value>(321, 750)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Channel Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>channel_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>freq</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>ref_scale</key> - <value>65536</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 0</value> - </param> - <param> - <key>_coordinate</key> - <value>(344, 511)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>decim</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>20</value> - </param> - <param> - <key>_coordinate</key> - <value>(310, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>symbol_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>3200</value> - </param> - <param> - <key>_coordinate</key> - <value>(590, 12)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>channel_decim</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>int(sample_rate/channel_rate)</value> - </param> - <param> - <key>_coordinate</key> - <value>(906, 12)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>deviation</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4800</value> - </param> - <param> - <key>_coordinate</key> - <value>(688, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>demod_k</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>3*channel_rate/(2*math.pi*deviation)</value> - </param> - <param> - <key>_coordinate</key> - <value>(598, 857)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>channel_taps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>firdes.low_pass(10, sample_rate, passband/2.0, (channel_rate-passband)/2.0)</value> - </param> - <param> - <key>_coordinate</key> - <value>(325, 857)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>config_filename</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>os.environ["HOME"]+"/.gnuradio/config.conf"</value> - </param> - <param> - <key>_coordinate</key> - <value>(9, 133)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>saved_band_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>930.5125e6</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>gr-pager</value> - </param> - <param> - <key>option</key> - <value>band_center</value> - </param> - <param> - <key>writeback</key> - <value>band_freq</value> - </param> - <param> - <key>_coordinate</key> - <value>(228, 311)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>saved_channel</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>25</value> - </param> - <param> - <key>type</key> - <value>int</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>gr-pager</value> - </param> - <param> - <key>option</key> - <value>channel</value> - </param> - <param> - <key>writeback</key> - <value>channel</value> - </param> - <param> - <key>_coordinate</key> - <value>(387, 312)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>saved_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>gr-pager</value> - </param> - <param> - <key>option</key> - <value>freq_offset</value> - </param> - <param> - <key>writeback</key> - <value>offset</value> - </param> - <param> - <key>_coordinate</key> - <value>(547, 312)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_config</key> - <param> - <key>id</key> - <value>saved_rx_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>40</value> - </param> - <param> - <key>type</key> - <value>int</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>gr-pager</value> - </param> - <param> - <key>option</key> - <value>rx_gain</value> - </param> - <param> - <key>writeback</key> - <value>rx_gain</value> - </param> - <param> - <key>_coordinate</key> - <value>(706, 312)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_text_box</key> - <param> - <key>id</key> - <value>band_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Band Freq.</value> - </param> - <param> - <key>value</key> - <value>saved_band_freq</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(225, 121)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>freq_text</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Ch. Freq</value> - </param> - <param> - <key>value</key> - <value>freq</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 2, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(801, 124)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>passband</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>2*(deviation+symbol_rate)</value> - </param> - <param> - <key>_coordinate</key> - <value>(327, 930)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>channel_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>8*3200</value> - </param> - <param> - <key>_coordinate</key> - <value>(792, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>channel</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Channel</value> - </param> - <param> - <key>value</key> - <value>saved_channel</value> - </param> - <param> - <key>min</key> - <value>1</value> - </param> - <param> - <key>max</key> - <value>120</value> - </param> - <param> - <key>num_steps</key> - <value>119</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>int_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 1, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(376, 120)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>rx_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Analog Gain</value> - </param> - <param> - <key>value</key> - <value>saved_rx_gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>100</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>int_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 4, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(658, 122)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Freq. Offset</value> - </param> - <param> - <key>value</key> - <value>saved_offset</value> - </param> - <param> - <key>min</key> - <value>-12.5e3</value> - </param> - <param> - <key>max</key> - <value>12.5e3</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 3, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(518, 118)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_quadrature_demod_cf</key> - <param> - <key>id</key> - <value>fm_demod</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>gain</key> - <value>demod_k</value> - </param> - <param> - <key>_coordinate</key> - <value>(599, 774)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>baseband_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>16000</value> - </param> - <param> - <key>_coordinate</key> - <value>(1019, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>nchan_taps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>len(channel_taps)</value> - </param> - <param> - <key>_coordinate</key> - <value>(412, 931)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>ma_ntaps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>int(channel_rate/symbol_rate)</value> - </param> - <param> - <key>_coordinate</key> - <value>(850, 863)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>bb_interp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>5</value> - </param> - <param> - <key>_coordinate</key> - <value>(938, 862)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>virtual_sink</key> - <param> - <key>id</key> - <value>virtual_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>baseband</value> - </param> - <param> - <key>_coordinate</key> - <value>(1100, 774)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_rational_resampler_xxx</key> - <param> - <key>id</key> - <value>resampler</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>fff</value> - </param> - <param> - <key>decim</key> - <value>bb_decim</value> - </param> - <param> - <key>interp</key> - <value>bb_interp</value> - </param> - <param> - <key>taps</key> - <value>[1.0/ma_ntaps,]*ma_ntaps*bb_interp</value> - </param> - <param> - <key>fractional_bw</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(851, 750)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>bb_decim</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>8</value> - </param> - <param> - <key>_coordinate</key> - <value>(1027, 864)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Baseband</value> - </param> - <param> - <key>samp_rate</key> - <value>16e3</value> - </param> - <param> - <key>v_scale</key> - <value>1</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>40.0/16e3</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 1</value> - </param> - <param> - <key>_coordinate</key> - <value>(851, 586)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>virtual_source</key> - <param> - <key>id</key> - <value>virtual_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>baseband</value> - </param> - <param> - <key>_coordinate</key> - <value>(79, 1186)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>pager_slicer_fb</key> - <param> - <key>id</key> - <value>pager_slicer_fb_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>alpha</key> - <value>1e-6</value> - </param> - <param> - <key>_coordinate</key> - <value>(304, 1186)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Slicer Output</value> - </param> - <param> - <key>samp_rate</key> - <value>baseband_rate</value> - </param> - <param> - <key>v_scale</key> - <value>1</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>40.0/baseband_rate</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value>displays, 1</value> - </param> - <param> - <key>_coordinate</key> - <value>(75, 1044)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>gr_char_to_float</key> - <param> - <key>id</key> - <value>gr_char_to_float_0</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(325, 1088)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>pager_flex_sync</key> - <param> - <key>id</key> - <value>pager_flex_sync_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(529, 1139)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>pager_flex_deinterleave</key> - <param> - <key>id</key> - <value>pager_flex_deinterleave_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(777, 1116)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_null_sink</key> - <param> - <key>id</key> - <value>gr_null_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>int</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1042, 1116)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>pager_flex_deinterleave</key> - <param> - <key>id</key> - <value>pager_flex_deinterleave_0_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(778, 1168)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>pager_flex_deinterleave</key> - <param> - <key>id</key> - <value>pager_flex_deinterleave_0_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(776, 1225)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>pager_flex_deinterleave</key> - <param> - <key>id</key> - <value>pager_flex_deinterleave_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(776, 1273)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_null_sink</key> - <param> - <key>id</key> - <value>gr_null_sink_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>int</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1042, 1168)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_null_sink</key> - <param> - <key>id</key> - <value>gr_null_sink_0_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>int</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1041, 1225)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_null_sink</key> - <param> - <key>id</key> - <value>gr_null_sink_0_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>int</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1040, 1273)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_freq_xlating_fir_filter_xxx_0</source_block_id> - <sink_block_id>wxgui_fftsink2_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>usrp_source</source_block_id> - <sink_block_id>gr_freq_xlating_fir_filter_xxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>usrp_source</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_freq_xlating_fir_filter_xxx_0</source_block_id> - <sink_block_id>fm_demod</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>resampler</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>fm_demod</source_block_id> - <sink_block_id>resampler</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>resampler</source_block_id> - <sink_block_id>virtual_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pager_slicer_fb_0</source_block_id> - <sink_block_id>pager_flex_sync_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>virtual_source_0</source_block_id> - <sink_block_id>pager_slicer_fb_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pager_slicer_fb_0</source_block_id> - <sink_block_id>gr_char_to_float_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_char_to_float_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pager_flex_sync_0</source_block_id> - <sink_block_id>pager_flex_deinterleave_0_1_0</sink_block_id> - <source_key>1</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pager_flex_sync_0</source_block_id> - <sink_block_id>pager_flex_deinterleave_0_1</sink_block_id> - <source_key>2</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pager_flex_sync_0</source_block_id> - <sink_block_id>pager_flex_deinterleave_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pager_flex_sync_0</source_block_id> - <sink_block_id>pager_flex_deinterleave_0_0</sink_block_id> - <source_key>3</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pager_flex_deinterleave_0</source_block_id> - <sink_block_id>gr_null_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pager_flex_deinterleave_0_1_0</source_block_id> - <sink_block_id>gr_null_sink_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pager_flex_deinterleave_0_1</source_block_id> - <sink_block_id>gr_null_sink_0_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>pager_flex_deinterleave_0_0</source_block_id> - <sink_block_id>gr_null_sink_0_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-pager/apps/usrp_rx_flex.py b/gr-pager/apps/usrp_rx_flex.py deleted file mode 100755 index 47bf5a3df..000000000 --- a/gr-pager/apps/usrp_rx_flex.py +++ /dev/null @@ -1,434 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: USRP FLEX Pager Receiver (Single Channel) -# Generated: Thu Oct 29 11:03:16 2009 -################################################## - -from gnuradio import blks2 -from gnuradio import eng_notation -from gnuradio import gr -from gnuradio import pager -from gnuradio import window -from gnuradio.eng_option import eng_option -from gnuradio.gr import firdes -from gnuradio.wxgui import fftsink2 -from gnuradio.wxgui import forms -from gnuradio.wxgui import scopesink2 -from grc_gnuradio import usrp as grc_usrp -from grc_gnuradio import wxgui as grc_wxgui -from optparse import OptionParser -import ConfigParser -import os, math -import wx - -class usrp_rx_flex(grc_wxgui.top_block_gui): - - def __init__(self): - grc_wxgui.top_block_gui.__init__(self, title="USRP FLEX Pager Receiver (Single Channel)") - - ################################################## - # Variables - ################################################## - self.config_filename = config_filename = os.environ["HOME"]+"/.gnuradio/config.conf" - self.symbol_rate = symbol_rate = 3200 - self._saved_channel_config = ConfigParser.ConfigParser() - self._saved_channel_config.read(config_filename) - try: saved_channel = self._saved_channel_config.getint("gr-pager", "channel") - except: saved_channel = 25 - self.saved_channel = saved_channel - self._saved_band_freq_config = ConfigParser.ConfigParser() - self._saved_band_freq_config.read(config_filename) - try: saved_band_freq = self._saved_band_freq_config.getfloat("gr-pager", "band_center") - except: saved_band_freq = 930.5125e6 - self.saved_band_freq = saved_band_freq - self.deviation = deviation = 4800 - self.decim = decim = 20 - self.adc_rate = adc_rate = 64e6 - self.sample_rate = sample_rate = adc_rate/decim - self.passband = passband = 2*(deviation+symbol_rate) - self.channel_rate = channel_rate = 8*3200 - self.channel = channel = saved_channel - self.band_freq = band_freq = saved_band_freq - self._saved_rx_gain_config = ConfigParser.ConfigParser() - self._saved_rx_gain_config.read(config_filename) - try: saved_rx_gain = self._saved_rx_gain_config.getint("gr-pager", "rx_gain") - except: saved_rx_gain = 40 - self.saved_rx_gain = saved_rx_gain - self._saved_offset_config = ConfigParser.ConfigParser() - self._saved_offset_config.read(config_filename) - try: saved_offset = self._saved_offset_config.getfloat("gr-pager", "freq_offset") - except: saved_offset = 0 - self.saved_offset = saved_offset - self.freq = freq = band_freq+(channel-61)*25e3 - self.channel_taps = channel_taps = firdes.low_pass(10, sample_rate, passband/2.0, (channel_rate-passband)/2.0) - self.rx_gain = rx_gain = saved_rx_gain - self.offset = offset = saved_offset - self.nchan_taps = nchan_taps = len(channel_taps) - self.ma_ntaps = ma_ntaps = int(channel_rate/symbol_rate) - self.freq_text = freq_text = freq - self.demod_k = demod_k = 3*channel_rate/(2*math.pi*deviation) - self.channel_decim = channel_decim = int(sample_rate/channel_rate) - self.bb_interp = bb_interp = 5 - self.bb_decim = bb_decim = 8 - self.baseband_rate = baseband_rate = 16000 - - ################################################## - # Notebooks - ################################################## - self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) - self.displays.AddPage(grc_wxgui.Panel(self.displays), "RX Spectrum") - self.displays.AddPage(grc_wxgui.Panel(self.displays), "Baseband") - self.GridAdd(self.displays, 1, 0, 1, 5) - - ################################################## - # Controls - ################################################## - _channel_sizer = wx.BoxSizer(wx.VERTICAL) - self._channel_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_channel_sizer, - value=self.channel, - callback=self.set_channel, - label="Channel", - converter=forms.int_converter(), - proportion=0, - ) - self._channel_slider = forms.slider( - parent=self.GetWin(), - sizer=_channel_sizer, - value=self.channel, - callback=self.set_channel, - minimum=1, - maximum=120, - num_steps=119, - style=wx.SL_HORIZONTAL, - cast=int, - proportion=1, - ) - self.GridAdd(_channel_sizer, 0, 1, 1, 1) - self._band_freq_text_box = forms.text_box( - parent=self.GetWin(), - value=self.band_freq, - callback=self.set_band_freq, - label="Band Freq.", - converter=forms.float_converter(), - ) - self.GridAdd(self._band_freq_text_box, 0, 0, 1, 1) - _rx_gain_sizer = wx.BoxSizer(wx.VERTICAL) - self._rx_gain_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_rx_gain_sizer, - value=self.rx_gain, - callback=self.set_rx_gain, - label="Analog Gain", - converter=forms.int_converter(), - proportion=0, - ) - self._rx_gain_slider = forms.slider( - parent=self.GetWin(), - sizer=_rx_gain_sizer, - value=self.rx_gain, - callback=self.set_rx_gain, - minimum=0, - maximum=100, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=int, - proportion=1, - ) - self.GridAdd(_rx_gain_sizer, 0, 4, 1, 1) - _offset_sizer = wx.BoxSizer(wx.VERTICAL) - self._offset_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_offset_sizer, - value=self.offset, - callback=self.set_offset, - label="Freq. Offset", - converter=forms.float_converter(), - proportion=0, - ) - self._offset_slider = forms.slider( - parent=self.GetWin(), - sizer=_offset_sizer, - value=self.offset, - callback=self.set_offset, - minimum=-12.5e3, - maximum=12.5e3, - num_steps=100, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_offset_sizer, 0, 3, 1, 1) - self._freq_text_static_text = forms.static_text( - parent=self.GetWin(), - value=self.freq_text, - callback=self.set_freq_text, - label="Ch. Freq", - converter=forms.float_converter(), - ) - self.GridAdd(self._freq_text_static_text, 0, 2, 1, 1) - - ################################################## - # Blocks - ################################################## - self.fm_demod = gr.quadrature_demod_cf(demod_k) - self.gr_freq_xlating_fir_filter_xxx_0 = gr.freq_xlating_fir_filter_ccc(channel_decim, (channel_taps), band_freq-freq+offset, sample_rate) - self.gr_null_sink_0 = gr.null_sink(gr.sizeof_int*1) - self.gr_null_sink_0_0 = gr.null_sink(gr.sizeof_int*1) - self.gr_null_sink_0_1 = gr.null_sink(gr.sizeof_int*1) - self.gr_null_sink_0_2 = gr.null_sink(gr.sizeof_int*1) - self.pager_flex_deinterleave_0 = pager.flex_deinterleave() - self.pager_flex_deinterleave_0_0 = pager.flex_deinterleave() - self.pager_flex_deinterleave_0_1 = pager.flex_deinterleave() - self.pager_flex_deinterleave_0_1_0 = pager.flex_deinterleave() - self.pager_flex_sync_0 = pager.flex_sync() - self.pager_slicer_fb_0 = pager.slicer_fb(1e-6) - self.resampler = blks2.rational_resampler_fff( - interpolation=bb_interp, - decimation=bb_decim, - taps=([1.0/ma_ntaps,]*ma_ntaps*bb_interp), - fractional_bw=None, - ) - self.usrp_source = grc_usrp.simple_source_c(which=0, side="A", rx_ant="RXA") - self.usrp_source.set_decim_rate(decim) - self.usrp_source.set_frequency(band_freq, verbose=True) - self.usrp_source.set_gain(rx_gain) - self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( - self.displays.GetPage(0).GetWin(), - baseband_freq=band_freq, - y_per_div=10, - y_divs=10, - ref_level=0, - ref_scale=65536, - sample_rate=sample_rate, - fft_size=1024, - fft_rate=30, - average=False, - avg_alpha=None, - title="FLEX Spectrum", - peak_hold=False, - ) - self.displays.GetPage(0).GridAdd(self.wxgui_fftsink2_0.win, 0, 0, 1, 1) - self.wxgui_fftsink2_1 = fftsink2.fft_sink_c( - self.displays.GetPage(0).GetWin(), - baseband_freq=freq, - y_per_div=10, - y_divs=10, - ref_level=0, - ref_scale=65536, - sample_rate=channel_rate, - fft_size=1024, - fft_rate=30, - average=False, - avg_alpha=None, - title="Channel Spectrum", - peak_hold=False, - ) - self.displays.GetPage(0).GridAdd(self.wxgui_fftsink2_1.win, 1, 0, 1, 1) - self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f( - self.displays.GetPage(1).GetWin(), - title="Baseband", - sample_rate=16e3, - v_scale=1, - v_offset=0, - t_scale=40.0/16e3, - ac_couple=False, - xy_mode=False, - num_inputs=1, - ) - self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1) - - ################################################## - # Connections - ################################################## - self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_1, 0)) - self.connect((self.usrp_source, 0), (self.gr_freq_xlating_fir_filter_xxx_0, 0)) - self.connect((self.usrp_source, 0), (self.wxgui_fftsink2_0, 0)) - self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.fm_demod, 0)) - self.connect((self.resampler, 0), (self.wxgui_scopesink2_0_0, 0)) - self.connect((self.fm_demod, 0), (self.resampler, 0)) - self.connect((self.pager_slicer_fb_0, 0), (self.pager_flex_sync_0, 0)) - self.connect((self.resampler, 0), (self.pager_slicer_fb_0, 0)) - self.connect((self.pager_flex_sync_0, 1), (self.pager_flex_deinterleave_0_1_0, 0)) - self.connect((self.pager_flex_sync_0, 2), (self.pager_flex_deinterleave_0_1, 0)) - self.connect((self.pager_flex_sync_0, 0), (self.pager_flex_deinterleave_0, 0)) - self.connect((self.pager_flex_sync_0, 3), (self.pager_flex_deinterleave_0_0, 0)) - self.connect((self.pager_flex_deinterleave_0, 0), (self.gr_null_sink_0, 0)) - self.connect((self.pager_flex_deinterleave_0_1_0, 0), (self.gr_null_sink_0_0, 0)) - self.connect((self.pager_flex_deinterleave_0_1, 0), (self.gr_null_sink_0_1, 0)) - self.connect((self.pager_flex_deinterleave_0_0, 0), (self.gr_null_sink_0_2, 0)) - - def set_config_filename(self, config_filename): - self.config_filename = config_filename - self._saved_band_freq_config = ConfigParser.ConfigParser() - self._saved_band_freq_config.read(self.config_filename) - if not self._saved_band_freq_config.has_section("gr-pager"): - self._saved_band_freq_config.add_section("gr-pager") - self._saved_band_freq_config.set("gr-pager", "band_center", str(self.band_freq)) - self._saved_band_freq_config.write(open(self.config_filename, 'w')) - self._saved_channel_config = ConfigParser.ConfigParser() - self._saved_channel_config.read(self.config_filename) - if not self._saved_channel_config.has_section("gr-pager"): - self._saved_channel_config.add_section("gr-pager") - self._saved_channel_config.set("gr-pager", "channel", str(self.channel)) - self._saved_channel_config.write(open(self.config_filename, 'w')) - self._saved_offset_config = ConfigParser.ConfigParser() - self._saved_offset_config.read(self.config_filename) - if not self._saved_offset_config.has_section("gr-pager"): - self._saved_offset_config.add_section("gr-pager") - self._saved_offset_config.set("gr-pager", "freq_offset", str(self.offset)) - self._saved_offset_config.write(open(self.config_filename, 'w')) - self._saved_rx_gain_config = ConfigParser.ConfigParser() - self._saved_rx_gain_config.read(self.config_filename) - if not self._saved_rx_gain_config.has_section("gr-pager"): - self._saved_rx_gain_config.add_section("gr-pager") - self._saved_rx_gain_config.set("gr-pager", "rx_gain", str(self.rx_gain)) - self._saved_rx_gain_config.write(open(self.config_filename, 'w')) - - def set_symbol_rate(self, symbol_rate): - self.symbol_rate = symbol_rate - self.set_passband(2*(self.deviation+self.symbol_rate)) - self.set_ma_ntaps(int(self.channel_rate/self.symbol_rate)) - - def set_saved_channel(self, saved_channel): - self.saved_channel = saved_channel - self.set_channel(self.saved_channel) - - def set_saved_band_freq(self, saved_band_freq): - self.saved_band_freq = saved_band_freq - self.set_band_freq(self.saved_band_freq) - - def set_deviation(self, deviation): - self.deviation = deviation - self.set_demod_k(3*self.channel_rate/(2*math.pi*self.deviation)) - self.set_passband(2*(self.deviation+self.symbol_rate)) - - def set_decim(self, decim): - self.decim = decim - self.set_sample_rate(self.adc_rate/self.decim) - self.usrp_source.set_decim_rate(self.decim) - - def set_adc_rate(self, adc_rate): - self.adc_rate = adc_rate - self.set_sample_rate(self.adc_rate/self.decim) - - def set_sample_rate(self, sample_rate): - self.sample_rate = sample_rate - self.wxgui_fftsink2_0.set_sample_rate(self.sample_rate) - self.set_channel_decim(int(self.sample_rate/self.channel_rate)) - self.set_channel_taps(firdes.low_pass(10, self.sample_rate, self.passband/2.0, (self.channel_rate-self.passband)/2.0)) - - def set_passband(self, passband): - self.passband = passband - self.set_channel_taps(firdes.low_pass(10, self.sample_rate, self.passband/2.0, (self.channel_rate-self.passband)/2.0)) - - def set_channel_rate(self, channel_rate): - self.channel_rate = channel_rate - self.wxgui_fftsink2_1.set_sample_rate(self.channel_rate) - self.set_channel_decim(int(self.sample_rate/self.channel_rate)) - self.set_demod_k(3*self.channel_rate/(2*math.pi*self.deviation)) - self.set_channel_taps(firdes.low_pass(10, self.sample_rate, self.passband/2.0, (self.channel_rate-self.passband)/2.0)) - self.set_ma_ntaps(int(self.channel_rate/self.symbol_rate)) - - def set_channel(self, channel): - self.channel = channel - self.set_freq(self.band_freq+(self.channel-61)*25e3) - self._saved_channel_config = ConfigParser.ConfigParser() - self._saved_channel_config.read(self.config_filename) - if not self._saved_channel_config.has_section("gr-pager"): - self._saved_channel_config.add_section("gr-pager") - self._saved_channel_config.set("gr-pager", "channel", str(self.channel)) - self._saved_channel_config.write(open(self.config_filename, 'w')) - self._channel_slider.set_value(self.channel) - self._channel_text_box.set_value(self.channel) - - def set_band_freq(self, band_freq): - self.band_freq = band_freq - self.set_freq(self.band_freq+(self.channel-61)*25e3) - self.wxgui_fftsink2_0.set_baseband_freq(self.band_freq) - self.usrp_source.set_frequency(self.band_freq) - self.gr_freq_xlating_fir_filter_xxx_0.set_center_freq(self.band_freq-self.freq+self.offset) - self._saved_band_freq_config = ConfigParser.ConfigParser() - self._saved_band_freq_config.read(self.config_filename) - if not self._saved_band_freq_config.has_section("gr-pager"): - self._saved_band_freq_config.add_section("gr-pager") - self._saved_band_freq_config.set("gr-pager", "band_center", str(self.band_freq)) - self._saved_band_freq_config.write(open(self.config_filename, 'w')) - self._band_freq_text_box.set_value(self.band_freq) - - def set_saved_rx_gain(self, saved_rx_gain): - self.saved_rx_gain = saved_rx_gain - self.set_rx_gain(self.saved_rx_gain) - - def set_saved_offset(self, saved_offset): - self.saved_offset = saved_offset - self.set_offset(self.saved_offset) - - def set_freq(self, freq): - self.freq = freq - self.gr_freq_xlating_fir_filter_xxx_0.set_center_freq(self.band_freq-self.freq+self.offset) - self.wxgui_fftsink2_1.set_baseband_freq(self.freq) - self.set_freq_text(self.freq) - - def set_channel_taps(self, channel_taps): - self.channel_taps = channel_taps - self.gr_freq_xlating_fir_filter_xxx_0.set_taps((self.channel_taps)) - self.set_nchan_taps(len(self.channel_taps)) - - def set_rx_gain(self, rx_gain): - self.rx_gain = rx_gain - self.usrp_source.set_gain(self.rx_gain) - self._saved_rx_gain_config = ConfigParser.ConfigParser() - self._saved_rx_gain_config.read(self.config_filename) - if not self._saved_rx_gain_config.has_section("gr-pager"): - self._saved_rx_gain_config.add_section("gr-pager") - self._saved_rx_gain_config.set("gr-pager", "rx_gain", str(self.rx_gain)) - self._saved_rx_gain_config.write(open(self.config_filename, 'w')) - self._rx_gain_slider.set_value(self.rx_gain) - self._rx_gain_text_box.set_value(self.rx_gain) - - def set_offset(self, offset): - self.offset = offset - self.gr_freq_xlating_fir_filter_xxx_0.set_center_freq(self.band_freq-self.freq+self.offset) - self._saved_offset_config = ConfigParser.ConfigParser() - self._saved_offset_config.read(self.config_filename) - if not self._saved_offset_config.has_section("gr-pager"): - self._saved_offset_config.add_section("gr-pager") - self._saved_offset_config.set("gr-pager", "freq_offset", str(self.offset)) - self._saved_offset_config.write(open(self.config_filename, 'w')) - self._offset_slider.set_value(self.offset) - self._offset_text_box.set_value(self.offset) - - def set_nchan_taps(self, nchan_taps): - self.nchan_taps = nchan_taps - - def set_ma_ntaps(self, ma_ntaps): - self.ma_ntaps = ma_ntaps - - def set_freq_text(self, freq_text): - self.freq_text = freq_text - self._freq_text_static_text.set_value(self.freq_text) - - def set_demod_k(self, demod_k): - self.demod_k = demod_k - - def set_channel_decim(self, channel_decim): - self.channel_decim = channel_decim - - def set_bb_interp(self, bb_interp): - self.bb_interp = bb_interp - - def set_bb_decim(self, bb_decim): - self.bb_decim = bb_decim - - def set_baseband_rate(self, baseband_rate): - self.baseband_rate = baseband_rate - -if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - (options, args) = parser.parse_args() - tb = usrp_rx_flex() - tb.Run(True) - diff --git a/gr-pager/gnuradio-pager.pc.in b/gr-pager/gnuradio-pager.pc.in deleted file mode 100644 index 408d94eb2..000000000 --- a/gr-pager/gnuradio-pager.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-pager -Description: GNU Radio blocks implementing a FLEX pager decoder -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-pager -Cflags: -I${includedir} diff --git a/gr-pager/grc/CMakeLists.txt b/gr-pager/grc/CMakeLists.txt deleted file mode 100644 index c982995b0..000000000 --- a/gr-pager/grc/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2011 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. - -install(FILES - pager_slicer_fb.xml - pager_flex_sync.xml - pager_flex_deinterleave.xml - DESTINATION ${GRC_BLOCKS_DIR} - COMPONENT "pager_python" -) diff --git a/gr-pager/grc/pager_flex_deinterleave.xml b/gr-pager/grc/pager_flex_deinterleave.xml deleted file mode 100644 index 14e5782da..000000000 --- a/gr-pager/grc/pager_flex_deinterleave.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## FLEX Pager Deinterleaver -################################################### - --> -<block> - <name>FLEX Deinterleave</name> - <key>pager_flex_deinterleave</key> - <category>Pager</category> - <import>from gnuradio import pager</import> - <make>pager.flex_deinterleave()</make> - - <sink> - <name>bits</name> - <type>byte</type> - </sink> - - <source> - <name>codes</name> - <type>int</type> - </source> -</block> diff --git a/gr-pager/grc/pager_flex_sync.xml b/gr-pager/grc/pager_flex_sync.xml deleted file mode 100644 index ec22321aa..000000000 --- a/gr-pager/grc/pager_flex_sync.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## FLEX Pager Synchronizer -################################################### - --> -<block> - <name>FLEX Synchronizer</name> - <key>pager_flex_sync</key> - <category>Pager</category> - <import>from gnuradio import pager</import> - <make>pager.flex_sync()</make> - - <sink> - <name>dibits</name> - <type>byte</type> - </sink> - - <source> - <name>A</name> - <type>byte</type> - </source> - <source> - <name>B</name> - <type>byte</type> - </source> - <source> - <name>C</name> - <type>byte</type> - </source> - <source> - <name>D</name> - <type>byte</type> - </source> - -</block> diff --git a/gr-pager/grc/pager_slicer_fb.xml b/gr-pager/grc/pager_slicer_fb.xml deleted file mode 100644 index 25642cb48..000000000 --- a/gr-pager/grc/pager_slicer_fb.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## FLEX Pager Slicer w/DC offset removal -################################################### - --> -<block> - <name>4-Level Slicer/DCR</name> - <key>pager_slicer_fb</key> - <category>Pager</category> - <import>from gnuradio import pager</import> - <make>pager.slicer_fb($alpha)</make> - - <param> - <name>Alpha</name> - <key>alpha</key> - <value>1e-6</value> - <type>real</type> - </param> - - <sink> - <name>bb</name> - <type>float</type> - </sink> - - <source> - <name>dibits</name> - <type>byte</type> - </source> - -</block> diff --git a/gr-pager/lib/CMakeLists.txt b/gr-pager/lib/CMakeLists.txt deleted file mode 100644 index cb62bcc75..000000000 --- a/gr-pager/lib/CMakeLists.txt +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${GR_PAGER_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_pager_sources - pager_flex_frame.cc - pager_slicer_fb.cc - pager_flex_sync.cc - pager_flex_deinterleave.cc - pager_flex_parse.cc - pageri_bch3221.cc - pageri_flex_modes.cc - pageri_util.cc -) - -list(APPEND pager_libs - gnuradio-core - ${Boost_LIBRARIES} -) - -add_library(gnuradio-pager SHARED ${gr_pager_sources}) -target_link_libraries(gnuradio-pager ${pager_libs}) -GR_LIBRARY_FOO(gnuradio-pager RUNTIME_COMPONENT "pager_runtime" DEVEL_COMPONENT "pager_devel") - -######################################################################## -# Install header files -######################################################################## -install(FILES - pager_api.h - pager_slicer_fb.h - pager_flex_sync.h - pager_flex_deinterleave.h - pager_flex_parse.h - pager_flex_frame.h - pageri_bch3221.h - pageri_flex_modes.h - pageri_util.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "pager_devel" -) diff --git a/gr-pager/lib/pager_api.h b/gr-pager/lib/pager_api.h deleted file mode 100644 index 4312c5ae3..000000000 --- a/gr-pager/lib/pager_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_PAGER_API_H -#define INCLUDED_PAGER_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_pager_EXPORTS -# define PAGER_API __GR_ATTR_EXPORT -#else -# define PAGER_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_PAGER_API_H */ diff --git a/gr-pager/lib/pager_flex_deinterleave.cc b/gr-pager/lib/pager_flex_deinterleave.cc deleted file mode 100644 index f7f1d9f69..000000000 --- a/gr-pager/lib/pager_flex_deinterleave.cc +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2004,2006,2010 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 <pager_flex_deinterleave.h> -#include <pageri_bch3221.h> -#include <pageri_util.h> -#include <gr_io_signature.h> - -pager_flex_deinterleave_sptr pager_make_flex_deinterleave() -{ - return gnuradio::get_initial_sptr(new pager_flex_deinterleave()); -} - -pager_flex_deinterleave::pager_flex_deinterleave() : - gr_sync_decimator("flex_deinterleave", - gr_make_io_signature(1, 1, sizeof(unsigned char)), - gr_make_io_signature(1, 1, sizeof(gr_int32)), 32) -{ - set_output_multiple(8); // One FLEX block at a time -} - -int pager_flex_deinterleave::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - gr_int32 *out = (gr_int32 *)output_items[0]; - - // FLEX codewords are interleaved in blocks of 256 bits or 8, 32 bit - // codes. To deinterleave we parcel each incoming bit into the MSB - // of each codeword, then switch to MSB-1, etc. This is done by shifting - // in the bits from the right on each codeword as the bits come in. - // When we are done we have a FLEX block of eight codewords, ready for - // conversion to data words. - // - // FLEX data words are recovered by reversing the bit order of the code - // word, masking off the (reversed) ECC, and inverting the remainder of - // the bits (!). - // - // The data portion of a FLEX frame consists of 11 of these deinterleaved - // and converted blocks. - // - // set_output_multiple garauntees we have output space for at least - // eight data words, and 256 bits are supplied on input - - int i, j; - for (i = 0; i < 32; i++) { - for (j = 0; j < 8; j++) { - d_codewords[j] <<= 1; - d_codewords[j] |= *in++; - } - } - - // Now convert code words into data words - for (j = 0; j < 8; j++) { - gr_int32 codeword = d_codewords[j]; - - // Apply BCH 32,21 error correction - // TODO: mark dataword when codeword fails ECC - pageri_bch3221(codeword); - - // Reverse bit order - codeword = pageri_reverse_bits32(codeword); - - // Mask off ECC then invert lower 21 bits - codeword = (codeword & 0x001FFFFF)^0x001FFFFF; - - *out++ = codeword; - } - - return j; -} diff --git a/gr-pager/lib/pager_flex_deinterleave.h b/gr-pager/lib/pager_flex_deinterleave.h deleted file mode 100644 index c702da23d..000000000 --- a/gr-pager/lib/pager_flex_deinterleave.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2006 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 INCLUDED_PAGER_FLEX_DEINTERLEAVE_H -#define INCLUDED_PAGER_FLEX_DEINTERLEAVE_H - -#include <pager_api.h> -#include <gr_sync_decimator.h> - -class pager_flex_deinterleave; -typedef boost::shared_ptr<pager_flex_deinterleave> pager_flex_deinterleave_sptr; - -PAGER_API pager_flex_deinterleave_sptr pager_make_flex_deinterleave(); - -/*! - * \brief flex deinterleave description - * \ingroup pager_blk - */ - -class PAGER_API pager_flex_deinterleave : public gr_sync_decimator -{ -private: - // Constructors - friend PAGER_API pager_flex_deinterleave_sptr pager_make_flex_deinterleave(); - pager_flex_deinterleave(); - - // One FLEX block of deinterleaved data - gr_int32 d_codewords[8]; - -public: - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_PAGER_FLEX_DEINTERLEAVE_H */ diff --git a/gr-pager/lib/pager_flex_frame.cc b/gr-pager/lib/pager_flex_frame.cc deleted file mode 100644 index 949f60320..000000000 --- a/gr-pager/lib/pager_flex_frame.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2006 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 <pager_flex_frame.h> - -pager_flex_frame_sptr pager_make_flex_frame() -{ - return pager_flex_frame_sptr(new pager_flex_frame()); -} - -pager_flex_frame::pager_flex_frame() -{ -} - -pager_flex_frame::~pager_flex_frame() -{ -} diff --git a/gr-pager/lib/pager_flex_frame.h b/gr-pager/lib/pager_flex_frame.h deleted file mode 100644 index 61973f722..000000000 --- a/gr-pager/lib/pager_flex_frame.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2006 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 INCLUDED_PAGER_FLEX_FRAME_H -#define INCLUDED_PAGER_FLEX_FRAME_H - -#include <pager_api.h> -#include <boost/shared_ptr.hpp> - -class pager_flex_frame; -typedef boost::shared_ptr<pager_flex_frame> pager_flex_frame_sptr; - -/*! - * \brief public constructor for pager_flex_frame - */ -PAGER_API pager_flex_frame_sptr pager_make_flex_frame(); - -/*! - * \brief flex_frame. - */ -class PAGER_API pager_flex_frame { - // Constructor is private to force use of shared_ptr - pager_flex_frame(); - friend PAGER_API pager_flex_frame_sptr pager_make_flex_frame(); - -public: - ~pager_flex_frame(); -}; - -#endif /* INCLUDED_PAGER_FLEX_FRAME_H */ diff --git a/gr-pager/lib/pager_flex_parse.cc b/gr-pager/lib/pager_flex_parse.cc deleted file mode 100644 index d7c308ddb..000000000 --- a/gr-pager/lib/pager_flex_parse.cc +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright 2004,2006,2007,2010 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 <pager_flex_parse.h> -#include <pageri_bch3221.h> -#include <gr_io_signature.h> -#include <ctype.h> -#include <iostream> -#include <iomanip> - -pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue, float freq) -{ - return gnuradio::get_initial_sptr(new pager_flex_parse(queue, freq)); -} - -pager_flex_parse::pager_flex_parse(gr_msg_queue_sptr queue, float freq) : - gr_sync_block("flex_parse", - gr_make_io_signature(1, 1, sizeof(gr_int32)), - gr_make_io_signature(0, 0, 0)), - d_queue(queue), - d_freq(freq) -{ - d_count = 0; -} - -int pager_flex_parse::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_int32 *in = (const gr_int32 *)input_items[0]; - - int i = 0; - while (i < noutput_items) { - // Accumulate one whole frame's worth of data words (88 of them) - d_datawords[d_count] = *in++; i++; - if (++d_count == 88) { - parse_data(); - d_count = 0; - } - } - - return i; -} - -/* FLEX data frames (that is, 88 data words per phase recovered after sync, - symbol decoding, dephasing, deinterleaving, error correction, and conversion - from codewords to data words) start with a block information word containing - indices of the page address field and page vector fields. -*/ - -void pager_flex_parse::parse_capcode(gr_int32 aw1, gr_int32 aw2) -{ - d_laddr = (aw1 < 0x008001L) || - (aw1 > 0x1E0000L) || - (aw1 > 0x1E7FFEL); - - if (d_laddr) - d_capcode = aw1+((aw2^0x001FFFFF)<<15)+0x1F9000; // Don't ask - else - d_capcode = aw1-0x8000; -} - -void pager_flex_parse::parse_data() -{ - // Block information word is the first data word in frame - gr_int32 biw = d_datawords[0]; - - // Nothing to see here, please move along - if (biw == 0 || biw == 0x001FFFFF) - return; - - // Vector start index is bits 15-10 - // Address start address is bits 9-8, plus one for offset - int voffset = (biw >> 10) & 0x3f; - int aoffset = ((biw >> 8) & 0x03) + 1; - - //printf("BIW:%08X AW:%02i-%02i\n", biw, aoffset, voffset); - - // Iterate through pages and dispatch to appropriate handler - for (int i = aoffset; i < voffset; i++) { - int j = voffset+i-aoffset; // Start of vector field for address @ i - - if (d_datawords[i] == 0x00000000 || - d_datawords[i] == 0x001FFFFF) - continue; // Idle codewords, invalid address - - parse_capcode(d_datawords[i], d_datawords[i+1]); - if (d_laddr) - i++; - - if (d_capcode < 0) // Invalid address, skip - continue; - - // Parse vector information word for address @ offset 'i' - gr_int32 viw = d_datawords[j]; - d_type = (page_type_t)((viw >> 4) & 0x00000007); - int mw1 = (viw >> 7) & 0x00000007F; - int len = (viw >> 14) & 0x0000007F; - - if (is_numeric_page(d_type)) - len &= 0x07; - int mw2 = mw1+len; - - if (mw1 == 0 && mw2 == 0) - continue; // Invalid VIW - - if (is_tone_page(d_type)) - mw1 = mw2 = 0; - - if (mw1 > 87 || mw2 > 87) - continue; // Invalid offsets - - d_payload.str(""); - d_payload.setf(std::ios::showpoint); - d_payload << std::setprecision(6) << std::setw(7) - << d_freq/1e6 << FIELD_DELIM - << std::setw(10) << d_capcode << FIELD_DELIM - << flex_page_desc[d_type] << FIELD_DELIM; - - if (is_alphanumeric_page(d_type)) - parse_alphanumeric(mw1, mw2-1, j); - else if (is_numeric_page(d_type)) - parse_numeric(mw1, mw2, j); - else if (is_tone_page(d_type)) - parse_tone_only(); - else - parse_unknown(mw1, mw2); - - gr_message_sptr msg = gr_make_message_from_string(std::string(d_payload.str())); - d_queue->handle(msg); - } -} - -void pager_flex_parse::parse_alphanumeric(int mw1, int mw2, int j) -{ - int frag; - //bool cont; - - if (!d_laddr) { - frag = (d_datawords[mw1] >> 11) & 0x03; - //cont = (d_datawords[mw1] >> 10) & 0x01; - mw1++; - } - else { - frag = (d_datawords[j+1] >> 11) & 0x03; - //cont = (d_datawords[j+1] >> 10) & 0x01; - mw2--; - } - - //d_payload << frag << FIELD_DELIM; - //d_payload << cont << FIELD_DELIM; - - for (int i = mw1; i <= mw2; i++) { - gr_int32 dw = d_datawords[i]; - unsigned char ch; - - if (i > mw1 || frag != 0x03) { - ch = dw & 0x7F; - if (ch != 0x03) - d_payload << ch; - } - - ch = (dw >> 7) & 0x7F; - if (ch != 0x03) // Fill - d_payload << ch; - - ch = (dw >> 14) & 0x7F; - if (ch != 0x03) // Fill - d_payload << ch; - } -} - -void pager_flex_parse::parse_numeric(int mw1, int mw2, int j) -{ - // Get first dataword from message field or from second - // vector word if long address - gr_int32 dw; - if (!d_laddr) { - dw = d_datawords[mw1]; - mw1++; - mw2++; - } - else { - dw = d_datawords[j+1]; - } - - unsigned char digit = 0; - int count = 4; - if (d_type == FLEX_NUMBERED_NUMERIC) - count += 10; // Skip 10 header bits for numbered numeric pages - else - count += 2; // Otherwise skip 2 - - for (int i = mw1; i <= mw2; i++) { - for (int k = 0; k < 21; k++) { - // Shift LSB from data word into digit - digit = (digit >> 1) & 0x0F; - if (dw & 0x01) - digit ^= 0x08; - dw >>= 1; - if (--count == 0) { - if (digit != 0x0C) // Fill - d_payload << flex_bcd[digit]; - count = 4; - } - } - - dw = d_datawords[i]; - } -} - -void pager_flex_parse::parse_tone_only() -{ -} - -void pager_flex_parse::parse_unknown(int mw1, int mw2) -{ -} diff --git a/gr-pager/lib/pager_flex_parse.h b/gr-pager/lib/pager_flex_parse.h deleted file mode 100644 index 499be299a..000000000 --- a/gr-pager/lib/pager_flex_parse.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2006 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 INCLUDED_PAGER_FLEX_PARSE_H -#define INCLUDED_PAGER_FLEX_PARSE_H - -#include <pager_api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> -#include <pageri_flex_modes.h> -#include <sstream> - -class pager_flex_parse; -typedef boost::shared_ptr<pager_flex_parse> pager_flex_parse_sptr; - -PAGER_API pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue, float freq); - -#define FIELD_DELIM ((unsigned char)128) - -/*! - * \brief flex parse description - * \ingroup pager_blk - */ -class PAGER_API pager_flex_parse : public gr_sync_block -{ -private: - // Constructors - friend PAGER_API pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue, float freq); - pager_flex_parse(gr_msg_queue_sptr queue, float freq); - - std::ostringstream d_payload; - gr_msg_queue_sptr d_queue; // Destination for decoded pages - - int d_count; // Count of received codewords - gr_int32 d_datawords[88]; // 11 blocks of 8 32-bit words - - page_type_t d_type; // Current page type - int d_capcode; // Current page destination address - bool d_laddr; // Current page has long address - float d_freq; // Channel frequency - - void parse_data(); // Handle a frame's worth of data - void parse_capcode(gr_int32 aw1, gr_int32 aw2); - void parse_alphanumeric(int mw1, int mw2, int j); - void parse_numeric(int mw1, int mw2, int j); - void parse_tone_only(); - void parse_unknown(int mw1, int mw2); - -public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_PAGER_FLEX_PARSE_H */ diff --git a/gr-pager/lib/pager_flex_sync.cc b/gr-pager/lib/pager_flex_sync.cc deleted file mode 100644 index c31acd7d2..000000000 --- a/gr-pager/lib/pager_flex_sync.cc +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright 2004,2006,2010 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 <pager_flex_sync.h> -#include <pageri_flex_modes.h> -#include <pageri_bch3221.h> -#include <pageri_util.h> -#include <gr_io_signature.h> -#include <gr_count_bits.h> -#include <cstdio> - -pager_flex_sync_sptr pager_make_flex_sync() -{ - return gnuradio::get_initial_sptr(new pager_flex_sync()); -} - -// FLEX sync block takes input from sliced baseband stream [0-3] at specified -// channel rate. Symbol timing is established based on receiving one of the -// defined FLEX protocol synchronization words. The block outputs one FLEX frame -// worth of bits on each output phase for the data portion of the frame. Unused phases -// get all zeros, which are considered idle code words. - -pager_flex_sync::pager_flex_sync() : - gr_block ("flex_sync", - gr_make_io_signature (1, 1, sizeof(unsigned char)), - gr_make_io_signature (4, 4, sizeof(unsigned char))), - d_sync(10) // Fixed at 10 samples per baud (@ 1600 baud) -{ - enter_idle(); -} - -void pager_flex_sync::forecast(int noutput_items, gr_vector_int &inputs_required) -{ - // samples per bit X number of outputs needed - int items = noutput_items*d_spb; - for (unsigned int i = 0; i < inputs_required.size(); i++) - inputs_required[i] = items; -} - -int pager_flex_sync::index_avg(int start, int end) -{ - // modulo average - if (start < end) - return (end + start)/2; - else - return ((end + start)/2 + d_spb/2) % d_spb; -} - -bool pager_flex_sync::test_sync(unsigned char sym) -{ - // 64-bit FLEX sync code: - // AAAA:BBBBBBBB:CCCC - // - // Where BBBBBBBB is always 0xA6C6AAAA - // and AAAA^CCCC is 0xFFFF - // - // Specific values of AAAA determine what bps and encoding the - // packet is beyond the frame information word - // - // First we match on the marker field with a hamming distance < 4 - // Then we match on the outer code with a hamming distance < 4 - - d_sync[d_index] = (d_sync[d_index] << 1) | (sym < 2); - gr_int64 val = d_sync[d_index]; - gr_int32 marker = ((val & 0x0000FFFFFFFF0000ULL)) >> 16; - - if (gr_count_bits32(marker^FLEX_SYNC_MARKER) < 4) { - gr_int32 code = ((val & 0xFFFF000000000000ULL) >> 32) | - (val & 0x000000000000FFFFULL); - - for (int i = 0; i < num_flex_modes; i++) { - if (gr_count_bits32(code^flex_modes[i].sync) < 4) { - d_mode = i; - return true; - } - } - - // Marker received but doesn't match known codes - // All codes have high word inverted to low word - unsigned short high = (code & 0xFFFF0000) >> 16; - unsigned short low = code & 0x0000FFFF; - unsigned short syn = high^low; - if (syn == 0xFFFF) - fprintf(stderr, "Unknown sync code detected: %08X\n", code); - } - - return false; -} - -void pager_flex_sync::enter_idle() -{ - d_state = ST_IDLE; - d_index = 0; - d_start = 0; - d_center = 0; - d_end = 0; - d_count = 0; - d_mode = 0; - d_baudrate = 1600; - d_levels = 2; - d_spb = 16000/d_baudrate; - d_bit_a = 0; - d_bit_b = 0; - d_bit_c = 0; - d_bit_d = 0; - d_hibit = false; - fflush(stdout); -} - -void pager_flex_sync::enter_syncing() -{ - d_start = d_index; - d_state = ST_SYNCING; -} - -void pager_flex_sync::enter_sync1() -{ - d_state = ST_SYNC1; - d_end = d_index; - d_center = index_avg(d_start, d_end); // Center of goodness - d_count = 0; -} - -void pager_flex_sync::enter_sync2() -{ - d_state = ST_SYNC2; - d_count = 0; - d_baudrate = flex_modes[d_mode].baud; - d_levels = flex_modes[d_mode].levels; - d_spb = 16000/d_baudrate; - - if (d_baudrate == 3200) { - // Oversampling buffer just got halved - d_center = d_center/2; - - // We're here at the center of a 1600 baud bit - // So this hack puts the index and bit counter - // in the right place for 3200 bps. - d_index = d_index/2-d_spb/2; - d_count = -1; - } -} - -void pager_flex_sync::enter_data() -{ - d_state = ST_DATA; - d_count = 0; -} - -void pager_flex_sync::parse_fiw() -{ - // Nothing is done with these now, but these will end up getting - // passed as metadata when mblocks are available - - // Bits 31-28 are frame number related, but unknown function - // This might be a checksum - d_unknown2 = pageri_reverse_bits8((d_fiw >> 24) & 0xF0); - - // Cycle is bits 27-24, reversed - d_cycle = pageri_reverse_bits8((d_fiw >> 20) & 0xF0); - - // Frame is bits 23-17, reversed - d_frame = pageri_reverse_bits8((d_fiw >> 16) & 0xFE); - - // Bits 16-11 are some sort of marker, usually identical across - // many frames but sometimes changes between frames or modes - d_unknown1 = (d_fiw >> 11) & 0x3F; - - //printf("CYC:%02i FRM:%03i\n", d_cycle, d_frame); -} - -int pager_flex_sync::output_symbol(unsigned char sym) -{ - // Here is where we output a 1 or 0 on each phase according - // to current FLEX mode and symbol value. Unassigned phases - // are zero from the enter_idle() initialization. - // - // FLEX can transmit the data portion of the frame at either - // 1600 bps or 3200 bps, and can use either two- or four-level - // FSK encoding. - // - // At 1600 bps, 2-level, a single "phase" is transmitted with bit - // value '0' using level '3' and bit value '1' using level '0'. - // - // At 1600 bps, 4-level, a second "phase" is transmitted, and the - // di-bits are encoded with a gray code: - // - // Symbol Phase 1 Phase 2 - // ------ ------- ------- - // 0 1 1 - // 1 1 0 - // 2 0 0 - // 3 0 1 - // - // At 1600 bps, 4-level, these are called PHASE A and PHASE B. - // - // At 3200 bps, the same 1 or 2 bit encoding occurs, except that - // additionally two streams are interleaved on alternating symbols. - // Thus, PHASE A (and PHASE B if 4-level) are decoded on one symbol, - // then PHASE C (and PHASE D if 4-level) are decoded on the next. - - int bits = 0; - - if (d_baudrate == 1600) { - d_bit_a = (sym < 2); - if (d_levels == 4) - d_bit_b = (sym == 0) || (sym == 3); - - *d_phase_a++ = d_bit_a; - *d_phase_b++ = d_bit_b; - *d_phase_c++ = d_bit_c; - *d_phase_d++ = d_bit_d; - bits++; - } - else { - if (!d_hibit) { - d_bit_a = (sym < 2); - if (d_levels == 4) - d_bit_b = (sym == 0) || (sym == 3); - d_hibit = true; - } - else { - d_bit_c = (sym < 2); - if (d_levels == 4) - d_bit_d = (sym == 0) || (sym == 3); - d_hibit = false; - - *d_phase_a++ = d_bit_a; - *d_phase_b++ = d_bit_b; - *d_phase_c++ = d_bit_c; - *d_phase_d++ = d_bit_d; - bits++; - } - } - - return bits; -} - -int pager_flex_sync::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - d_phase_a = (unsigned char *)output_items[0]; - d_phase_b = (unsigned char *)output_items[1]; - d_phase_c = (unsigned char *)output_items[2]; - d_phase_d = (unsigned char *)output_items[3]; - - int i = 0, j = 0; - int ninputs = ninput_items[0]; - - while (i < ninputs && j < noutput_items) { - unsigned char sym = *in++; i++; - d_index = (d_index+1) % d_spb; - - switch (d_state) { - case ST_IDLE: - // Continually compare the received symbol stream - // against the known FLEX sync words. - if (test_sync(sym)) - enter_syncing(); - break; - - case ST_SYNCING: - // Wait until we stop seeing sync, then calculate - // the center of the bit period (d_center) - if (!test_sync(sym)) - enter_sync1(); - break; - - case ST_SYNC1: - // Skip 16 bits of dotting, then accumulate 32 bits - // of Frame Information Word. - if (d_index == d_center) { - d_fiw = (d_fiw << 1) | (sym > 1); - if (++d_count == 48) { - // FIW is accumulated, call BCH to error correct it - pageri_bch3221(d_fiw); - parse_fiw(); - enter_sync2(); - } - } - break; - - case ST_SYNC2: - // This part and the remainder of the frame are transmitted - // at either 1600 bps or 3200 bps based on the received - // FLEX sync word. The second SYNC header is 25ms of idle bits - // at either speed. - if (d_index == d_center) { - // Skip 25 ms = 40 bits @ 1600 bps, 80 @ 3200 bps - if (++d_count == d_baudrate/40) - enter_data(); - } - break; - - case ST_DATA: - // The data portion of the frame is 1760 ms long at either - // baudrate. This is 2816 bits @ 1600 bps and 5632 bits @ 3200 bps. - // The output_symbol() routine decodes and doles out the bits - // to each of the four transmitted phases of FLEX interleaved codes. - if (d_index == d_center) { - j += output_symbol(sym); - if (++d_count == d_baudrate*1760/1000) - enter_idle(); - } - break; - - default: - assert(0); // memory corruption of d_state if ever gets here - break; - } - } - - consume_each(i); - return j; -} diff --git a/gr-pager/lib/pager_flex_sync.h b/gr-pager/lib/pager_flex_sync.h deleted file mode 100644 index b53737d12..000000000 --- a/gr-pager/lib/pager_flex_sync.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2006 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 INCLUDED_PAGER_FLEX_SYNC_H -#define INCLUDED_PAGER_FLEX_SYNC_H - -#include <pager_api.h> -#include <gr_block.h> - -class pager_flex_sync; -typedef boost::shared_ptr<pager_flex_sync> pager_flex_sync_sptr; -typedef std::vector<gr_int64> gr_int64_vector; - -PAGER_API pager_flex_sync_sptr pager_make_flex_sync(); - -/*! - * \brief flex sync description - * \ingroup pager_blk - */ - -class PAGER_API pager_flex_sync : public gr_block -{ -private: - // Constructors - friend PAGER_API pager_flex_sync_sptr pager_make_flex_sync(); - pager_flex_sync(); - - // State machine transitions - void enter_idle(); - void enter_syncing(); - void enter_sync1(); - void enter_sync2(); - void enter_data(); - - int index_avg(int start, int end); - bool test_sync(unsigned char sym); - void parse_fiw(); - int output_symbol(unsigned char sym); - - // Simple state machine - enum state_t { ST_IDLE, ST_SYNCING, ST_SYNC1, ST_SYNC2, ST_DATA }; - state_t d_state; - - int d_index; // Index into current baud - int d_start; // Start of good sync - int d_center; // Center of bit - int d_end; // End of good sync - int d_count; // Bit counter - - int d_mode; // Current packet mode - int d_baudrate; // Current decoding baud rate - int d_levels; // Current decoding levels - int d_spb; // Current samples per baud - bool d_hibit; // Alternating bit indicator for 3200 bps - - gr_int32 d_fiw; // Frame information word - int d_frame; // Current FLEX frame - int d_cycle; // Current FLEX cycle - int d_unknown1; - int d_unknown2; - - unsigned char d_bit_a; - unsigned char d_bit_b; - unsigned char d_bit_c; - unsigned char d_bit_d; - - unsigned char *d_phase_a; - unsigned char *d_phase_b; - unsigned char *d_phase_c; - unsigned char *d_phase_d; - - gr_int64_vector d_sync; // Trial synchronizers - -public: - void forecast(int noutput_items, gr_vector_int &inputs_required); - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_PAGER_FLEX_SYNC_H */ diff --git a/gr-pager/lib/pager_slicer_fb.cc b/gr-pager/lib/pager_slicer_fb.cc deleted file mode 100644 index 415e898cd..000000000 --- a/gr-pager/lib/pager_slicer_fb.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2004,2006,2007,2010 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 <pager_slicer_fb.h> -#include <gr_io_signature.h> - -pager_slicer_fb_sptr pager_make_slicer_fb(float alpha) -{ - return gnuradio::get_initial_sptr(new pager_slicer_fb(alpha)); -} - -pager_slicer_fb::pager_slicer_fb(float alpha) : - gr_sync_block ("slicer_fb", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (1, 1, sizeof(unsigned char))) -{ - d_alpha = alpha; - d_beta = 1.0-alpha; - d_avg = 0.0; -} - -// Tracks average, minimum, and peak, then converts input into one of: -// -// [0, 1, 2, 3] -unsigned char pager_slicer_fb::slice(float sample) -{ - unsigned char decision; - - // Update DC level and remove - d_avg = d_avg*d_beta+sample*d_alpha; - sample -= d_avg; - - if (sample > 0) { - if (sample > 2.0) - decision = 3; - else - decision = 2; - } - else { - if (sample < -2.0) - decision = 0; - else - decision = 1; - } - - return decision; -} - -int pager_slicer_fb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *iptr = (float *) input_items[0]; - unsigned char *optr = (unsigned char *) output_items[0]; - - int size = noutput_items; - - for (int i = 0; i < size; i++) - *optr++ = slice(*iptr++); - - return noutput_items; -} diff --git a/gr-pager/lib/pager_slicer_fb.h b/gr-pager/lib/pager_slicer_fb.h deleted file mode 100644 index cbbf9cd22..000000000 --- a/gr-pager/lib/pager_slicer_fb.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2006,2007 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 INCLUDED_PAGER_SLICER_FB_H -#define INCLUDED_PAGER_SLICER_FB_H - -#include <pager_api.h> -#include <gr_sync_block.h> - -class pager_slicer_fb; -typedef boost::shared_ptr<pager_slicer_fb> pager_slicer_fb_sptr; - -PAGER_API pager_slicer_fb_sptr pager_make_slicer_fb(float alpha); - -/*! - * \brief slicer description - * \ingroup pager_blk - */ -class PAGER_API pager_slicer_fb : public gr_sync_block -{ -private: - friend PAGER_API pager_slicer_fb_sptr pager_make_slicer_fb(float alpha); - pager_slicer_fb(float alpha); - - unsigned char slice(float sample); - - float d_alpha; // DC removal time constant - float d_beta; // 1.0-d_alpha - float d_avg; // Average value for DC offset subtraction - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - float dc_offset() const { return d_avg; } -}; - -#endif /* INCLUDED_PAGER_SLICER_FB_H */ diff --git a/gr-pager/lib/pageri_bch3221.cc b/gr-pager/lib/pageri_bch3221.cc deleted file mode 100644 index 9c6dd8148..000000000 --- a/gr-pager/lib/pageri_bch3221.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2006 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 <pageri_bch3221.h> - -// Corrects supplied data word according to BCH3221 encoding and -// returns the number of errors detected/corrected. -// -// Not implemented yet - -int pageri_bch3221(gr_int32 &data) -{ - return 0; -} diff --git a/gr-pager/lib/pageri_bch3221.h b/gr-pager/lib/pageri_bch3221.h deleted file mode 100644 index 54227e438..000000000 --- a/gr-pager/lib/pageri_bch3221.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2006 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 INCLUDED_PAGERI_BCH3221_H -#define INCLUDED_PAGERI_BCH3221_H - -#include <gr_types.h> - -// Perform BCH (32,21) error correction on supplied data -// Return number of errors found/corrected (0, 1, or 2) -int pageri_bch3221(gr_int32 &data); - -#endif /* INCLUDED_PAGERI_BCH3221_H */ diff --git a/gr-pager/lib/pageri_flex_modes.cc b/gr-pager/lib/pageri_flex_modes.cc deleted file mode 100644 index ad424fda1..000000000 --- a/gr-pager/lib/pageri_flex_modes.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2006,2007 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. - */ - -#include "pageri_flex_modes.h" - -const flex_mode_t flex_modes[] = -{ - { 0x870C78F3, 1600, 2 }, - { 0xB0684F97, 1600, 4 }, -// { 0xUNKNOWN, 3200, 2 }, - { 0xDEA0215F, 3200, 4 }, - { 0x4C7CB383, 3200, 4 } -}; - -const int num_flex_modes = sizeof(flex_modes)/sizeof(flex_modes[0]); - -unsigned char flex_bcd[17] = "0123456789 U -]["; - -const char *flex_page_desc[] = -{ - "ENC", - "UNK", - "TON", - "NUM", - "SPN", - "ALN", - "BIN", - "NNM" -}; - -int find_flex_mode(gr_int32 sync_code) -{ - for (int i = 0; i < num_flex_modes; i++) - if (flex_modes[i].sync == sync_code) - return i; - - // Not found - return -1; -} diff --git a/gr-pager/lib/pageri_flex_modes.h b/gr-pager/lib/pageri_flex_modes.h deleted file mode 100644 index 6d81613d7..000000000 --- a/gr-pager/lib/pageri_flex_modes.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2006,2007 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 INCLUDED_PAGERI_FLEX_MODES_H -#define INCLUDED_PAGERI_FLEX_MODES_H - -#include <gr_types.h> - -#define FLEX_SYNC_MARKER 0xA6C6AAAA - -typedef struct flex_mode -{ - gr_int32 sync; // Outer synchronization code - unsigned int baud; // Baudrate of SYNC2 and DATA - unsigned int levels; // FSK encoding of SYNC2 and DATA -} -flex_mode_t; - -extern const flex_mode_t flex_modes[]; -extern const char *flex_page_desc[]; -extern const int num_flex_modes; -int find_flex_mode(gr_int32 sync_code); -extern unsigned char flex_bcd[]; - -typedef enum { - FLEX_SECURE, - FLEX_UNKNOWN, - FLEX_TONE, - FLEX_STANDARD_NUMERIC, - FLEX_SPECIAL_NUMERIC, - FLEX_ALPHANUMERIC, - FLEX_BINARY, - FLEX_NUMBERED_NUMERIC, - NUM_FLEX_PAGE_TYPES -} -page_type_t; - -inline bool is_alphanumeric_page(page_type_t type) -{ - return (type == FLEX_ALPHANUMERIC || - type == FLEX_SECURE); -} - -inline bool is_numeric_page(page_type_t type) -{ - return (type == FLEX_STANDARD_NUMERIC || - type == FLEX_SPECIAL_NUMERIC || - type == FLEX_NUMBERED_NUMERIC); -} - -inline bool is_tone_page(page_type_t type) -{ - return (type == FLEX_TONE); -} - -#endif // INCLUDED_PAGERI_FLEX_MODES_H diff --git a/gr-pager/lib/pageri_util.cc b/gr-pager/lib/pageri_util.cc deleted file mode 100644 index 7fa85e6ed..000000000 --- a/gr-pager/lib/pageri_util.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2006 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 <pageri_util.h> - -unsigned char pageri_reverse_bits8(unsigned char val) -{ - // This method was attributed to Rich Schroeppel in the Programming - // Hacks section of Beeler, M., Gosper, R. W., and Schroeppel, R. - // HAKMEM. MIT AI Memo 239, Feb. 29, 1972. - // - // Reverses 8 bits in 5 machine operations with 64 bit arch - return (val * 0x0202020202ULL & 0x010884422010ULL) % 1023; -} - -gr_int32 pageri_reverse_bits32(gr_int32 val) -{ - gr_int32 out = 0x00000000; - out |= (pageri_reverse_bits8((val >> 24) & 0x000000FF) ); - out |= (pageri_reverse_bits8((val >> 16) & 0x000000FF) << 8); - out |= (pageri_reverse_bits8((val >> 8) & 0x000000FF) << 16); - out |= (pageri_reverse_bits8((val ) & 0x000000FF) << 24); - return out; -} diff --git a/gr-pager/lib/pageri_util.h b/gr-pager/lib/pageri_util.h deleted file mode 100644 index b90cddcce..000000000 --- a/gr-pager/lib/pageri_util.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2006 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 INCLUDED_PAGERI_UTIL_H -#define INCLUDED_PAGERI_UTIL_H - -#include <gr_types.h> - -unsigned char pageri_reverse_bits8(unsigned char val); -gr_int32 pageri_reverse_bits32(gr_int32 val); - -#endif /* INCLUDED_PAGERI_UTIL_H */ diff --git a/gr-pager/python/CMakeLists.txt b/gr-pager/python/CMakeLists.txt deleted file mode 100644 index 30ac0364d..000000000 --- a/gr-pager/python/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright 2011-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. - -######################################################################## -include(GrPython) - -GR_PYTHON_INSTALL( - FILES - __init__.py - pager_utils.py - flex_demod.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/pager - COMPONENT "pager_python" -) - -######################################################################## -# Handle the unit tests -######################################################################## -if(ENABLE_TESTING) - -list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-pager/python - ${CMAKE_BINARY_DIR}/gr-pager/swig -) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-pager) - -include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) -endif(ENABLE_TESTING) diff --git a/gr-pager/python/__init__.py b/gr-pager/python/__init__.py deleted file mode 100644 index c395d4e45..000000000 --- a/gr-pager/python/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright 2006 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. -# - -# The presence of this file turns this directory into a Python package - -''' -The GNU Radio pager application. -''' - -from pager_swig import * -from flex_demod import flex_demod -from pager_utils import * diff --git a/gr-pager/python/flex_demod.py b/gr-pager/python/flex_demod.py deleted file mode 100644 index 4146695f8..000000000 --- a/gr-pager/python/flex_demod.py +++ /dev/null @@ -1,63 +0,0 @@ -# -# Copyright 2006,2007 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. -# - -from gnuradio import gr, gru, optfir, blks2 -from math import pi -import pager_swig - -class flex_demod(gr.hier_block2): - """ - FLEX pager protocol demodulation block. - - This block demodulates a band-limited, complex down-converted baseband - channel into FLEX protocol frames. - - """ - - def __init__(self, queue, freq=0.0, verbose=False, log=False): - gr.hier_block2.__init__(self, "flex_demod", - gr.io_signature(1, 1, gr.sizeof_gr_complex), - gr.io_signature(0,0,0)) - - k = 25000/(2*pi*1600) # 4800 Hz max deviation - quad = gr.quadrature_demod_cf(k) - self.connect(self, quad) - - rsamp = blks2.rational_resampler_fff(16, 25) - self.slicer = pager_swig.slicer_fb(5e-6) # DC removal averaging filter constant - self.sync = pager_swig.flex_sync() - - self.connect(quad, rsamp, self.slicer, self.sync) - - for i in range(4): - self.connect((self.sync, i), pager_swig.flex_deinterleave(), pager_swig.flex_parse(queue, freq)) - - if log: - suffix = '_'+ "%3.3f" % (freq/1e6,) + '.dat' - quad_sink = gr.file_sink(gr.sizeof_float, 'quad'+suffix) - rsamp_sink = gr.file_sink(gr.sizeof_float, 'rsamp'+suffix) - slicer_sink = gr.file_sink(gr.sizeof_char, 'slicer'+suffix) - self.connect(rsamp, rsamp_sink) - self.connect(quad, quad_sink) - self.connect(self.slicer, slicer_sink) - - def dc_offset(self): - return self.slicer.dc_offset() diff --git a/gr-pager/python/pager_utils.py b/gr-pager/python/pager_utils.py deleted file mode 100644 index e935c86d4..000000000 --- a/gr-pager/python/pager_utils.py +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copyright 2008,2009 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 this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -from gnuradio import gr -import gnuradio.gr.gr_threading as _threading -from string import split, join, printable -import time - -def make_trans_table(): - table = 256 * ['.'] - for i in range(256): - if (i < 32): - table[i] = '.' - else: - table[i] = chr(i) - return ''.join(table) - -_trans_table = make_trans_table() - -def make_printable(s): - return s.translate(_trans_table) - - -class queue_runner(_threading.Thread): - def __init__(self, msgq): - _threading.Thread.__init__(self) - self.msgq = msgq - self.done = False - self.start() - - def run(self): - while 1: - msg = self.msgq.delete_head() # Blocking read - if msg.type() != 0: - break - - page = join(split(msg.to_string(), chr(128)), '|') - s = make_printable(page) - print msg.type(), s - - def end(self): - self.msgq.insert_tail(gr.message(1)) - self.done = True diff --git a/gr-pager/python/qa_pager.py b/gr-pager/python/qa_pager.py deleted file mode 100755 index 87f0d0026..000000000 --- a/gr-pager/python/qa_pager.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2006,2010 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. -# - -from gnuradio import gr, gr_unittest -import pager_swig - -class test_pager(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - -if __name__ == '__main__': - gr_unittest.run(test_pager, "test_pager.xml") diff --git a/gr-pager/swig/CMakeLists.txt b/gr-pager/swig/CMakeLists.txt deleted file mode 100644 index c98369a36..000000000 --- a/gr-pager/swig/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_INCLUDE_DIRS - ${GR_PAGER_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/pager_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib) - -set(GR_SWIG_LIBRARIES gnuradio-pager) - -GR_SWIG_MAKE(pager_swig pager_swig.i) - -GR_SWIG_INSTALL( - TARGETS pager_swig - DESTINATION ${GR_PYTHON_DIR}/gnuradio/pager - COMPONENT "pager_python" -) - -install( - FILES - pager_swig.i - pager_flex_deinterleave.i - pager_flex_frame.i - pager_flex_parse.i - pager_flex_sync.i - pager_slicer_fb.i - ${CMAKE_CURRENT_BINARY_DIR}/pager_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "pager_swig" -) diff --git a/gr-pager/swig/gnuradio/pager.scm b/gr-pager/swig/gnuradio/pager.scm deleted file mode 100644 index 99331b09c..000000000 --- a/gr-pager/swig/gnuradio/pager.scm +++ /dev/null @@ -1,28 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see <http://www.gnu.org/licenses/>. -;;; - -;;; Module that just re-exports the pager_swig module - -(define-module (gnuradio pager) - #:use-module (gnuradio export-safely) - #:use-module (gnuradio pager_swig) - #:duplicates (merge-generics replace check)) - -(re-export-all '(gnuradio pager_swig)) - diff --git a/gr-pager/swig/pager_flex_deinterleave.i b/gr-pager/swig/pager_flex_deinterleave.i deleted file mode 100644 index f34951a8a..000000000 --- a/gr-pager/swig/pager_flex_deinterleave.i +++ /dev/null @@ -1,11 +0,0 @@ -GR_SWIG_BLOCK_MAGIC(pager,flex_deinterleave); - -pager_flex_deinterleave_sptr pager_make_flex_deinterleave(); - -class pager_flex_deinterleave : public gr_sync_decimator -{ -private: - pager_flex_deinterleave(); - -public: -}; diff --git a/gr-pager/swig/pager_flex_frame.i b/gr-pager/swig/pager_flex_frame.i deleted file mode 100644 index 0ea996500..000000000 --- a/gr-pager/swig/pager_flex_frame.i +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2006 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. - */ - -class pager_flex_frame; -typedef boost::shared_ptr<pager_flex_frame> pager_flex_frame_sptr; -%template(pager_flex_frame_sptr) boost::shared_ptr<pager_flex_frame>; - -%rename(flex_frame) pager_make_flex_frame; -pager_flex_frame_sptr pager_make_flex_frame(); - -/*! - * \brief flex_frame. - */ -class pager_flex_frame { - pager_flex_frame(); - -public: -}; - diff --git a/gr-pager/swig/pager_flex_parse.i b/gr-pager/swig/pager_flex_parse.i deleted file mode 100644 index 21e0245cb..000000000 --- a/gr-pager/swig/pager_flex_parse.i +++ /dev/null @@ -1,11 +0,0 @@ -GR_SWIG_BLOCK_MAGIC(pager,flex_parse); - -pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue, float freq); - -class pager_flex_parse : public gr_block -{ -private: - pager_flex_parse(gr_msg_queue_sptr queue, float freq); - -public: -}; diff --git a/gr-pager/swig/pager_flex_sync.i b/gr-pager/swig/pager_flex_sync.i deleted file mode 100644 index 49823db06..000000000 --- a/gr-pager/swig/pager_flex_sync.i +++ /dev/null @@ -1,11 +0,0 @@ -GR_SWIG_BLOCK_MAGIC(pager,flex_sync); - -pager_flex_sync_sptr pager_make_flex_sync(); - -class pager_flex_sync : public gr_block -{ -private: - pager_flex_sync(); - -public: -}; diff --git a/gr-pager/swig/pager_slicer_fb.i b/gr-pager/swig/pager_slicer_fb.i deleted file mode 100644 index 4ffb5b73b..000000000 --- a/gr-pager/swig/pager_slicer_fb.i +++ /dev/null @@ -1,12 +0,0 @@ -GR_SWIG_BLOCK_MAGIC(pager,slicer_fb); - -pager_slicer_fb_sptr pager_make_slicer_fb(float alpha); - -class pager_slicer_fb : public gr_sync_block -{ -private: - pager_slicer_fb(float alpha); - -public: - float dc_offset() const { return d_avg; } -}; diff --git a/gr-pager/swig/pager_swig.i b/gr-pager/swig/pager_swig.i deleted file mode 100644 index 04f804157..000000000 --- a/gr-pager/swig/pager_swig.i +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2005,2006,2009 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. - */ - -%include "gnuradio.i" - -//load generated python docstrings -%include "pager_swig_doc.i" - -%{ -#include "pager_flex_frame.h" -#include "pager_slicer_fb.h" -#include "pager_flex_sync.h" -#include "pager_flex_deinterleave.h" -#include "pager_flex_parse.h" -%} - -%include "pager_flex_frame.i" -%include "pager_slicer_fb.i" -%include "pager_flex_sync.i" -%include "pager_flex_deinterleave.i" -%include "pager_flex_parse.i" diff --git a/gr-shd/CMakeLists.txt b/gr-shd/CMakeLists.txt deleted file mode 100644 index 7dad30cd8..000000000 --- a/gr-shd/CMakeLists.txt +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -PKG_CHECK_MODULES(PC_SHD shd) -FIND_PATH( - SHD_INCLUDE_DIRS - NAMES shd/config.hpp - HINTS $ENV{SHD_DIR}/include - ${PC_SHD_INCLUDE_DIRS} - PATHS /usr/local/include - /usr/include -) - -FIND_LIBRARY( - SHD_LIBRARIES - NAMES shd - HINTS $ENV{SHD_DIR}/lib - ${PC_SHD_LIBRARIES} - PATHS /usr/local/lib - /usr/lib -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SHD DEFAULT_MSG SHD_LIBRARIES SHD_INCLUDE_DIRS) -MARK_AS_ADVANCED(SHD_LIBRARIES SHD_INCLUDE_DIRS) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) -GR_REGISTER_COMPONENT("gr-shd" ENABLE_GR_SHD - Boost_FOUND - SHD_FOUND - ENABLE_GR_CORE -) - -GR_SET_GLOBAL(GR_SHD_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${SHD_INCLUDE_DIRS} -) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_SHD) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_SHD_DESCRIPTION "GNU Radio SHD Blocks") - -CPACK_COMPONENT("shd_runtime" - GROUP "SHD" - DISPLAY_NAME "Runtime" - DESCRIPTION "Runtime" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("shd_devel" - GROUP "SHD" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("shd_python" - GROUP "SHD" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime; GRC xml files" - DEPENDS "core_python;shd_runtime" -) - -CPACK_COMPONENT("shd_swig" - GROUP "SHD" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;shd_python;shd_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(include) -add_subdirectory(lib) -if(ENABLE_PYTHON) - add_subdirectory(swig) - add_subdirectory(grc) - add_subdirectory(apps) -endif(ENABLE_PYTHON) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-shd.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-shd.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-shd.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "shd_devel" -) - -endif(ENABLE_GR_SHD) diff --git a/gr-shd/apps/CMakeLists.txt b/gr-shd/apps/CMakeLists.txt deleted file mode 100644 index d36121da1..000000000 --- a/gr-shd/apps/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2011 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. - -include(GrPython) - -######################################################################## -# Install some shd apps -######################################################################## -GR_PYTHON_INSTALL( - PROGRAMS - shd_fft - shd_rx_cfile - shd_siggen - DESTINATION ${GR_RUNTIME_DIR} - COMPONENT "shd_python" -) diff --git a/gr-shd/apps/shd_fft b/gr-shd/apps/shd_fft deleted file mode 100755 index 60d07e55e..000000000 --- a/gr-shd/apps/shd_fft +++ /dev/null @@ -1,280 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gru -from gnuradio import shd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import stdgui2, fftsink2, waterfallsink2 -from gnuradio.wxgui import scopesink2, form, slider -from optparse import OptionParser -import wx -import sys -import numpy - -class app_top_block(stdgui2.std_top_block): - def __init__(self, frame, panel, vbox, argv): - stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv) - - self.frame = frame - self.panel = panel - - parser = OptionParser(option_class=eng_option) - parser.add_option("-a", "--address", type="string", - default="type=xmini", - help="Address of SHD device, [default=%default]") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6, - help="set sample rate (bandwidth) [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-W", "--waterfall", action="store_true", default=False, - help="Enable waterfall display") - parser.add_option("-S", "--oscilloscope", action="store_true", default=False, - help="Enable oscilloscope display") - parser.add_option("", "--avg-alpha", type="eng_float", default=1e-1, - help="Set fftsink averaging factor, default=[%default]") - parser.add_option("", "--ref-scale", type="eng_float", default=1.0, - help="Set dBFS=0dB input value, default=[%default]") - parser.add_option("--fft-size", type="int", default=1024, - help="Set number of FFT bins [default=%default]") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - self.options = options - self.show_debug_info = True - - self.src = shd.smini_source(device_addr=options.address, - io_type=shd.io_type.COMPLEX_FLOAT32, - num_channels=1) - - if(options.antenna): - self.src.set_antenna(options.antenna, 0) - - self.src.set_samp_rate(options.samp_rate) - input_rate = self.src.get_samp_rate() - - if options.waterfall: - self.scope = \ - waterfallsink2.waterfall_sink_c (panel, fft_size=1024, - sample_rate=input_rate) - self.frame.SetMinSize((800, 420)) - elif options.oscilloscope: - self.scope = scopesink2.scope_sink_c(panel, sample_rate=input_rate) - self.frame.SetMinSize((800, 600)) - else: - self.scope = fftsink2.fft_sink_c (panel, - fft_size=options.fft_size, - sample_rate=input_rate, - ref_scale=options.ref_scale, - ref_level=20.0, - y_divs = 12, - avg_alpha=options.avg_alpha) - self.frame.SetMinSize((800, 420)) - - self.connect(self.src, self.scope) - - self._build_gui(vbox) - self._setup_events() - - - # set initial values - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.src.get_gain_range() - options.gain = float(g.start()+g.stop())/2 - - if options.freq is None: - # if no freq was specified, use the mid-point - r = self.src.get_freq_range() - options.freq = float(r.start()+r.stop())/2 - - self.set_gain(options.gain) - - if self.show_debug_info: - self.myform['samprate'].set_value(self.src.get_samp_rate()) - self.myform['fs@gbe'].set_value(input_rate) - self.myform['baseband'].set_value(0) - self.myform['ddc'].set_value(0) - - if not(self.set_freq(options.freq)): - self._set_status_msg("Failed to set initial frequency") - - print "Center Freq: ", self.src.get_center_freq() - print "Freq Range: ", self.src.get_freq_range() - print "Gain: ", self.src.get_gain() - print "Gain Names: ", self.src.get_gain_names() - print "Gain Range: ", self.src.get_gain_range() - - def _set_status_msg(self, msg): - self.frame.GetStatusBar().SetStatusText(msg, 0) - - def _build_gui(self, vbox): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - vbox.Add(self.scope.win, 10, wx.EXPAND) - - # add control area at the bottom - self.myform = myform = form.form() - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0, 0) - myform['freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="Center freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, - self._set_status_msg)) - - hbox.Add((5,0), 0, 0) - g = self.src.get_gain_range() - - # some configurations don't have gain control - if g.stop() > g.start(): - myform['gain'] = form.slider_field(parent=self.panel, - sizer=hbox, label="Gain", - weight=3, - min=int(g.start()), - max=int(g.stop()), - callback=self.set_gain) - - hbox.Add((5,0), 0, 0) - vbox.Add(hbox, 0, wx.EXPAND) - - self._build_subpanel(vbox) - - def _build_subpanel(self, vbox_arg): - # build a secondary information panel (sometimes hidden) - - # FIXME figure out how to have this be a subpanel that is always - # created, but has its visibility controlled by foo.Show(True/False) - - def _form_set_samp_rate(kv): - return self.set_samp_rate(kv['samprate']) - - if not(self.show_debug_info): - return - - panel = self.panel - vbox = vbox_arg - myform = self.myform - - hbox = wx.BoxSizer(wx.HORIZONTAL) - - hbox.Add((5,0), 0) - myform['samprate'] = form.float_field( - parent=panel, sizer=hbox, label="Sample Rate", - callback=myform.check_input_and_call(_form_set_samp_rate, - self._set_status_msg)) - - hbox.Add((5,0), 1) - myform['fs@gbe'] = form.static_float_field( - parent=panel, sizer=hbox, label="Fs@GbE") - - hbox.Add((5,0), 1) - myform['baseband'] = form.static_float_field( - parent=panel, sizer=hbox, label="Analog BB") - - hbox.Add((5,0), 1) - myform['ddc'] = form.static_float_field( - parent=panel, sizer=hbox, label="DDC") - - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - - Tuning is a two step process. First we ask the front-end to - tune as close to the desired frequency as it can. Then we use - the result of that operation and our target_frequency to - determine the value for the digital down converter. - """ - r = self.src.set_center_freq(target_freq, 0) - - if r: - self.myform['freq'].set_value(target_freq) # update displayed value - if self.show_debug_info: - self.myform['baseband'].set_value(r.actual_rf_freq) - self.myform['ddc'].set_value(r.actual_dsp_freq) - if not self.options.oscilloscope: - self.scope.set_baseband_freq(target_freq) - return True - - return False - - def set_gain(self, gain): - if self.myform.has_key('gain'): - self.myform['gain'].set_value(gain) # update displayed value - self.src.set_gain(gain, 0) - - def set_samp_rate(self, samp_rate): - ok = self.src.set_samp_rate(samp_rate) - input_rate = self.src.get_samp_rate() - self.scope.set_sample_rate(input_rate) - if self.show_debug_info: # update displayed values - self.myform['samprate'].set_value(self.src.get_samp_rate()) - self.myform['fs@gbe'].set_value(input_rate) - - # shd set_samp_rate never fails; always falls back to closest requested. - return True - - def _setup_events(self): - if not self.options.waterfall and not self.options.oscilloscope: - self.scope.win.Bind(wx.EVT_LEFT_DCLICK, self.evt_left_dclick) - - def evt_left_dclick(self, event): - (ux, uy) = self.scope.win.GetXY(event) - if event.CmdDown(): - # Re-center on maximum power - points = self.scope.win._points - if self.scope.win.peak_hold: - if self.scope.win.peak_vals is not None: - ind = numpy.argmax(self.scope.win.peak_vals) - else: - ind = int(points.shape()[0]/2) - else: - ind = numpy.argmax(points[:,1]) - (freq, pwr) = points[ind] - target_freq = freq/self.scope.win._scale_factor - print ind, freq, pwr - self.set_freq(target_freq) - else: - # Re-center on clicked frequency - target_freq = ux/self.scope.win._scale_factor - self.set_freq(target_freq) - - -def main (): - app = stdgui2.stdapp(app_top_block, "SHD FFT", nstatus=1) - app.MainLoop() - -if __name__ == '__main__': - main () diff --git a/gr-shd/apps/shd_rx_cfile b/gr-shd/apps/shd_rx_cfile deleted file mode 100755 index 5b4178cf7..000000000 --- a/gr-shd/apps/shd_rx_cfile +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -""" -Read samples from a SHD device and write to file formatted as binary -outputs single precision complex float values or complex short values -(interleaved 16 bit signed short integers). -""" - -from gnuradio import gr, eng_notation -from gnuradio import shd -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -n2s = eng_notation.num_to_str - -class rx_cfile_block(gr.top_block): - - def __init__(self, options, filename): - gr.top_block.__init__(self) - - # Create a SHD device source - if options.output_shorts: - self._src = shd.smini_source(device_addr=options.address, - io_type=shd.io_type.COMPLEX_INT16, - num_channels=1) - self._sink = gr.file_sink(gr.sizeof_short*2, filename) - else: - self._src = shd.smini_source(device_addr=options.address, - io_type=shd.io_type.COMPLEX_FLOAT32, - num_channels=1) - self._sink = gr.file_sink(gr.sizeof_gr_complex, filename) - - # Set receiver sample rate - self._src.set_samp_rate(options.samp_rate) - - # Set receive daughterboard gain - if options.gain is None: - g = self._src.get_gain_range() - options.gain = float(g.start()+g.stop())/2 - print "Using mid-point gain of", \ - options.gain, "(", g.start(), "-", g.stop(), ")" - self._src.set_gain(options.gain) - - # Set the antenna - if(options.antenna): - self._src.set_antenna(options.antenna, 0) - - # Set frequency (tune request takes lo_offset) - if(options.lo_offset is not None): - treq = shd.tune_request(options.freq, options.lo_offset) - else: - treq = shd.tune_request(options.freq) - tr = self._src.set_center_freq(treq) - if tr == None: - sys.stderr.write('Failed to set center frequency\n') - raise SystemExit, 1 - - # Create head block if needed and wire it up - if options.nsamples is None: - self.connect(self._src, self._sink) - else: - if options.output_shorts: - self._head = gr.head(gr.sizeof_short*2, - int(options.nsamples)) - else: - self._head = gr.head(gr.sizeof_gr_complex, - int(options.nsamples)) - - self.connect(self._src, self._head, self._sink) - - input_rate = self._src.get_samp_rate() - - if options.verbose: - print "Address:", options.address - print "Rx gain:", options.gain - print "Rx baseband frequency:", n2s(tr.actual_rf_freq) - print "Rx DDC frequency:", n2s(tr.actual_dsp_freq) - print "Rx Sample Rate:", n2s(input_rate) - if options.nsamples is None: - print "Receiving samples until Ctrl-C" - else: - print "Receving", n2s(options.nsamples), "samples" - if options.output_shorts: - print "Writing 16-bit complex shorts" - else: - print "Writing 32-bit complex floats" - print "Output filename:", filename - -def get_options(): - usage="%prog: [options] output_filename" - parser = OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-a", "--address", type="string", default="type=xmini", - help="Address of SHD device, [default=%default]") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--samp-rate", type="eng_float", default=1e6, - help="set sample rate (bandwidth) [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option( "-s","--output-shorts", action="store_true", default=False, - help="output interleaved shorts instead of complex floats") - parser.add_option("-N", "--nsamples", type="eng_float", default=None, - help="number of samples to collect [default=+inf]") - parser.add_option("-v", "--verbose", action="store_true", default=False, - help="verbose output") - parser.add_option("", "--lo-offset", type="eng_float", default=None, - help="set daughterboard LO offset to OFFSET [default=hw default]") - - (options, args) = parser.parse_args () - if len(args) != 1: - parser.print_help() - raise SystemExit, 1 - - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - return (options, args[0]) - - -if __name__ == '__main__': - (options, filename) = get_options() - tb = rx_cfile_block(options, filename) - - try: - tb.run() - except KeyboardInterrupt: - pass diff --git a/gr-shd/apps/shd_siggen b/gr-shd/apps/shd_siggen deleted file mode 100755 index 9629d80d2..000000000 --- a/gr-shd/apps/shd_siggen +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -""" -Read samples from a SHD device and write to file formatted as binary -outputs single precision complex float values or complex short values -(interleaved 16 bit signed short integers). -""" - -from gnuradio import gr, eng_notation -from gnuradio import shd -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -n2s = eng_notation.num_to_str - -class shd_siggen(gr.top_block): - - def __init__(self, options): - gr.top_block.__init__(self) - - self._src = gr.sig_source_c(options.samp_rate, gr.GR_SIN_WAVE, - 200, 1) - - self._snk = shd.smini_sink(device_addr=options.address, - io_type=shd.io_type.COMPLEX_FLOAT32, - num_channels=1) - - # Set receiver sample rate - self._snk.set_samp_rate(options.samp_rate) - - # Set receive daughterboard gain - if options.gain is None: - g = self._snk.get_gain_range() - options.gain = float(g.start()+g.stop())/2 - print "Using mid-point gain of", \ - options.gain, "(", g.start(), "-", g.stop(), ")" - self._snk.set_gain(options.gain) - - # Set the antenna - if(options.antenna): - self._snk.set_antenna(options.antenna, 0) - - # Set frequency (tune request takes lo_offset) - if(options.lo_offset is not None): - treq = shd.tune_request(options.freq, options.lo_offset) - else: - treq = shd.tune_request(options.freq) - tr = self._snk.set_center_freq(treq) - if tr == None: - sys.stderr.write('Failed to set center frequency\n') - raise SystemExit, 1 - - # Create head block if needed and wire it up - self.connect(self._src, self._snk) - input_rate = self._snk.get_samp_rate() - - if options.verbose: - print "Address:", options.address - print "Rx gain:", options.gain - print "Rx baseband frequency:", n2s(tr.actual_rf_freq) - print "Rx DDC frequency:", n2s(tr.actual_dsp_freq) - print "Rx Sample Rate:", n2s(input_rate) - -def get_options(): - usage="%prog: [options]" - parser = OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-a", "--address", type="string", default="type=xmini", - help="Address of SHD device, [default=%default]") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--samp-rate", type="eng_float", default=1e6, - help="set sample rate (bandwidth) [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-v", "--verbose", action="store_true", default=False, - help="verbose output") - parser.add_option("", "--lo-offset", type="eng_float", default=None, - help="set daughterboard LO offset to OFFSET [default=hw default]") - - (options, args) = parser.parse_args () - - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - return (options) - - -if __name__ == '__main__': - options = get_options() - tb = shd_siggen(options) - - try: - tb.run() - except KeyboardInterrupt: - pass diff --git a/gr-shd/gnuradio-shd.pc.in b/gr-shd/gnuradio-shd.pc.in deleted file mode 100644 index cff0dcf00..000000000 --- a/gr-shd/gnuradio-shd.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-shd -Description: GNU Radio blocks for the Symplex Hardware Driver (SHD) -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-shd -Cflags: -I${includedir} diff --git a/gr-shd/grc/CMakeLists.txt b/gr-shd/grc/CMakeLists.txt deleted file mode 100644 index 67a8fc13f..000000000 --- a/gr-shd/grc/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Rules for generating the source and sink xml wrappers -######################################################################## -include(GrPython) - -macro(GEN_BLOCK_XML _generator _xml_block) - set(generator ${CMAKE_CURRENT_SOURCE_DIR}/${_generator}) - set(xml_block ${CMAKE_CURRENT_BINARY_DIR}/${_xml_block}) - list(APPEND xml_blocks ${xml_block}) - add_custom_command( - DEPENDS ${generator} OUTPUT ${xml_block} - COMMAND ${PYTHON_EXECUTABLE} ${generator} ${xml_block} - ) -endmacro(GEN_BLOCK_XML) - -GEN_BLOCK_XML(gen_shd_smini_blocks.py shd_smini_source.xml) -GEN_BLOCK_XML(gen_shd_smini_blocks.py shd_smini_sink.xml) - -add_custom_target(shd_grc_xml_blocks ALL DEPENDS ${xml_blocks}) - -install(FILES - ${xml_blocks} - shd_block_tree.xml - DESTINATION ${GRC_BLOCKS_DIR} - COMPONENT "shd_python" -) diff --git a/gr-shd/grc/gen_shd_smini_blocks.py b/gr-shd/grc/gen_shd_smini_blocks.py deleted file mode 100644 index 652b6cf51..000000000 --- a/gr-shd/grc/gen_shd_smini_blocks.py +++ /dev/null @@ -1,297 +0,0 @@ -""" -Copyright 2011 Free Software Foundation, Inc. - -This file is part of GNU Radio - -GNU Radio Companion 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 2 -of the License, or (at your option) any later version. - -GNU Radio Companion 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, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -""" - -MAIN_TMPL = """\ -<?xml version="1.0"?> -<block> - <name>SHD: SMINI $sourk.title()</name> - <key>shd_smini_$(sourk)</key> - <import>from gnuradio import shd</import> - <make>shd.smini_$(sourk)( - device_addr=\$dev_addr, - io_type=shd.io_type.\$type.type, - num_channels=\$nchan, -) -\#if \$clock_rate() -self.\$(id).set_clock_rate(\$clock_rate, shd.ALL_MBOARDS) -\#end if -#for $m in range($max_mboards) -######################################################################## -\#if \$num_mboards() > $m and \$ref_source$(m)() == 'external' -self.\$(id).set_clock_config(shd.clock_config.external(), $m) -\#end if -######################################################################## -\#if \$num_mboards() > $m and \$ref_source$(m)() == 'internal' -self.\$(id).set_clock_config(shd.clock_config.internal(), $m) -\#end if -######################################################################## -\#if \$num_mboards() > $m and \$ref_source$(m)() == 'mimo' -_config = shd.clock_config() -_config.ref_source = shd.clock_config.REF_MIMO -_config.pps_source = shd.clock_config.PPS_MIMO -self.\$(id).set_clock_config(_config, $m) -\#end if -######################################################################## -\#if \$num_mboards() > $m and \$sd_spec$(m)() -self.\$(id).set_subdev_spec(\$sd_spec$(m), $m) -\#end if -######################################################################## -#end for -\#if \$sync() -self.\$(id).set_time_unknown_pps(shd.time_spec()) -\#end if -self.\$(id).set_samp_rate(\$samp_rate) -#for $n in range($max_nchan) -\#if \$nchan() > $n -self.\$(id).set_center_freq(\$center_freq$(n), $n) -self.\$(id).set_gain(\$gain$(n), $n) -\#end if -#end for -</make> - <callback>set_samp_rate(\$samp_rate)</callback> - #for $n in range($max_nchan) - <callback>set_center_freq(\$center_freq$(n), $n)</callback> - <callback>set_gain(\$gain$(n), $n)</callback> - #end for - <param> - <name>$(direction.title())put Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>type:COMPLEX_FLOAT32</opt> - <opt>vlen:1</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>type:COMPLEX_INT16</opt> - <opt>vlen:2</opt> - </option> - </param> - <param> - <name>Device Addr</name> - <key>dev_addr</key> - <value></value> - <type>string</type> - <hide> - \#if \$dev_addr() - none - \#else - part - \#end if - </hide> - </param> - <param> - <name>Sync</name> - <key>sync</key> - <value></value> - <type>enum</type> - <hide>\#if \$sync() then 'none' else 'part'#</hide> - <option> - <name>unknown PPS</name> - <key>sync</key> - </option> - <option> - <name>don't sync</name> - <key></key> - </option> - </param> - <param> - <name>Clock Rate (Hz)</name> - <key>clock_rate</key> - <value>0.0</value> - <type>real</type> - <hide>\#if \$clock_rate() then 'none' else 'part'#</hide> - <option> - <name>Default</name> - <key>0.0</key> - </option> - </param> - <param> - <name>Num Mboards</name> - <key>num_mboards</key> - <value>1</value> - <type>int</type> - <hide>part</hide> - #for $m in range(1, $max_mboards+1) - <option> - <name>$(m)</name> - <key>$m</key> - </option> - #end for - </param> - #for $m in range($max_mboards) - <param> - <name>Mb$(m): Ref Source</name> - <key>ref_source$(m)</key> - <value></value> - <type>enum</type> - <hide> - \#if not \$num_mboards() > $m - all - \#elif \$ref_source$(m)() - none - \#else - part - \#end if - </hide> - <option><name>Default</name><key></key></option> - <option><name>Internal</name><key>internal</key></option> - <option><name>External</name><key>external</key></option> - <option><name>MIMO Cable</name><key>mimo</key></option> - </param> - <param> - <name>Mb$(m): Subdev Spec</name> - <key>sd_spec$(m)</key> - <value></value> - <type>string</type> - <hide> - \#if not \$num_mboards() > $m - all - \#elif \$sd_spec$(m)() - none - \#else - part - \#end if - </hide> - </param> - #end for - <param> - <name>Num Channels</name> - <key>nchan</key> - <value>1</value> - <type>int</type> - #for $n in range(1, $max_nchan+1) - <option> - <name>$(n)</name> - <key>$n</key> - </option> - #end for - </param> - <param> - <name>Samp Rate (Sps)</name> - <key>samp_rate</key> - <value>samp_rate</value> - <type>real</type> - </param> - $params - <check>$max_nchan >= \$nchan</check> - <check>\$nchan > 0</check> - <check>$max_mboards >= \$num_mboards</check> - <check>\$num_mboards > 0</check> - <check>\$nchan >= \$num_mboards</check> - <$sourk> - <name>$direction</name> - <type>\$type</type> - <vlen>\$type.vlen</vlen> - <nports>\$nchan</nports> - </$sourk> - <doc> -The SHD SMINI $sourk.title() Block: - -Device Address: -The device address is a delimited string used to locate SHD devices on your system. \\ -If left blank, the first SHD device found will be used. \\ -Use the device address to specify a specific device or list of devices. -SMINI1 Example: serial=12345678 -SMINI2 Example: type=xmini - -Num Motherboards: -Selects the number of SMINI motherboards in this device configuration. - -Reference Source: -Where the motherboard should sync its time and clock references. -If source and sink blocks reference the same device, -it is only necessary to set the reference source on one of the blocks. - -Subdevice specification: -Each motherboard should have its own subdevice specification \\ -and all subdevice specifications should be the same length. \\ -Select the subdevice or subdevices for each channel using a markup string. \\ -The markup string consists of a list of dboard_slot:subdev_name pairs (one pair per channel). \\ -If left blank, the SHD will try to select the first subdevice on your system. \\ -See the application notes for further details. -Single channel example: :AB -Dual channel example: :A :B - -Num Channels: -Selects the total number of channels in this multi-SMINI configuration. -Ex: 4 motherboards with 2 channels per board = 8 channels total - -Sample rate: -The sample rate is the number of samples per second input by this block. \\ -The SHD device driver will try its best to match the requested sample rate. \\ -If the requested rate is not possible, the SHD block will print an error at runtime. - -Center frequency: -The center frequency is the overall frequency of the RF chain. \\ -For greater control of how the SHD tunes elements in the RF chain, \\ -pass a tune_request object rather than a simple target frequency. -Tuning with an LO offset example: shd.tune_request(freq, lo_off) - - </doc> -</block> -""" - -PARAMS_TMPL = """ - <param> - <name>Ch$(n): Center Freq (Hz)</name> - <key>center_freq$(n)</key> - <value>0</value> - <type>real</type> - <hide>\#if \$nchan() > $n then 'none' else 'all'#</hide> - </param> - <param> - <name>Ch$(n): Gain (dB)</name> - <key>gain$(n)</key> - <value>0</value> - <type>real</type> - <hide>\#if \$nchan() > $n then 'none' else 'all'#</hide> - </param> -""" - -def parse_tmpl(_tmpl, **kwargs): - from Cheetah import Template - return str(Template.Template(_tmpl, kwargs)) - -max_num_mboards = 8 -max_num_channels = max_num_mboards*4 - -if __name__ == '__main__': - import sys - for file in sys.argv[1:]: - if 'source' in file: - sourk = 'source' - direction = 'out' - elif 'sink' in file: - sourk = 'sink' - direction = 'in' - else: raise Exception, 'is %s a source or sink?'%file - - params = ''.join([parse_tmpl(PARAMS_TMPL, n=n) for n in range(max_num_channels)]) - open(file, 'w').write(parse_tmpl(MAIN_TMPL, - max_nchan=max_num_channels, - max_mboards=max_num_mboards, - params=params, - sourk=sourk, - direction=direction, - )) diff --git a/gr-shd/grc/shd_block_tree.xml b/gr-shd/grc/shd_block_tree.xml deleted file mode 100644 index 5d9786f67..000000000 --- a/gr-shd/grc/shd_block_tree.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Block Tree for shd blocks. -################################################### - --> -<cat> - <name></name> <!-- Blank for Root Name --> - <cat> - <name>SHD</name> - <block>shd_smini_source</block> - <block>shd_smini_sink</block> - </cat> -</cat> diff --git a/gr-shd/include/CMakeLists.txt b/gr-shd/include/CMakeLists.txt deleted file mode 100644 index 34349841c..000000000 --- a/gr-shd/include/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Install header files -######################################################################## -install(FILES - gr_shd_api.h - gr_shd_smini_source.h - gr_shd_smini_sink.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "shd_devel" -) diff --git a/gr-shd/include/gr_shd_api.h b/gr-shd/include/gr_shd_api.h deleted file mode 100644 index 13b755cbd..000000000 --- a/gr-shd/include/gr_shd_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_GR_SHD_API_H -#define INCLUDED_GR_SHD_API_H - -#include <shd/config.hpp> - -#ifdef gnuradio_shd_EXPORTS -# define GR_SHD_API SHD_EXPORT -#else -# define GR_SHD_API SHD_IMPORT -#endif - -#endif /* INCLUDED_GR_SHD_API_H */ diff --git a/gr-shd/include/gr_shd_smini_sink.h b/gr-shd/include/gr_shd_smini_sink.h deleted file mode 100644 index b807e5c87..000000000 --- a/gr-shd/include/gr_shd_smini_sink.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_GR_SHD_SMINI_SINK_H -#define INCLUDED_GR_SHD_SMINI_SINK_H - -#include <gr_shd_api.h> -#include <gr_sync_block.h> -#include <shd/xmini/multi_xmini.hpp> - -class shd_smini_sink; - -GR_SHD_API boost::shared_ptr<shd_smini_sink> shd_make_smini_sink( - const shd::device_addr_t &device_addr, - const shd::io_type_t &io_type, - size_t num_channels -); - -class GR_SHD_API shd_smini_sink : virtual public gr_sync_block -{ - public: - - /*! - * Set the subdevice specification. - * \param spec the subdev spec markup string - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_subdev_spec(const std::string &spec, size_t mboard = 0) = 0; - - /*! - * Set the sample rate for the smini device. - * \param rate a new rate in Sps - */ - virtual void set_samp_rate(double rate) = 0; - - /*! - * Get the sample rate for the smini device. - * This is the actual sample rate and may differ from the rate set. - * \return the actual rate in Sps - */ - virtual double get_samp_rate(void) = 0; - - /*! - * Tune the smini device to the desired center frequency. - * \param tune_request the tune request instructions - * \param chan the channel index 0 to N-1 - * \return a tune result with the actual frequencies - */ - virtual shd::tune_result_t set_center_freq( - const shd::tune_request_t tune_request, size_t chan = 0 - ) = 0; - - /*! - * Tune the smini device to the desired center frequency. - * This is a wrapper around set center freq so that in this case, - * the user can pass a single frequency in the call through swig. - * \param freq the desired frequency in Hz - * \param chan the channel index 0 to N-1 - * \return a tune result with the actual frequencies - */ - shd::tune_result_t set_center_freq(double freq, size_t chan = 0){ - return set_center_freq(shd::tune_request_t(freq), chan); - } - - /*! - * Get the center frequency. - * \param chan the channel index 0 to N-1 - * \return the frequency in Hz - */ - virtual double get_center_freq(size_t chan = 0) = 0; - - /*! - * Get the tunable frequency range. - * \param chan the channel index 0 to N-1 - * \return the frequency range in Hz - */ - virtual shd::freq_range_t get_freq_range(size_t chan = 0) = 0; - - /*! - * Set the gain for the dboard. - * \param gain the gain in dB - * \param chan the channel index 0 to N-1 - */ - virtual void set_gain(double gain, size_t chan = 0) = 0; - - /*! - * Set the named gain on the dboard. - * \param gain the gain in dB - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - */ - virtual void set_gain(double gain, const std::string &name, - size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting. - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual double get_gain(size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting of named stage. - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual double get_gain(const std::string &name, - size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting of named stage. - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual std::vector<std::string> get_gain_names(size_t chan = 0) = 0; - - /*! - * Get the settable gain range. - * \param chan the channel index 0 to N-1 - * \return the gain range in dB - */ - virtual shd::gain_range_t get_gain_range(size_t chan = 0) = 0; - - /*! - * Get the settable gain range. - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - * \return the gain range in dB - */ - virtual shd::gain_range_t get_gain_range(const std::string &name, - size_t chan = 0) = 0; - - /*! - * Set the antenna to use. - * \param ant the antenna string - * \param chan the channel index 0 to N-1 - */ - virtual void set_antenna(const std::string &ant, - size_t chan = 0) = 0; - - /*! - * Get the antenna in use. - * \param chan the channel index 0 to N-1 - * \return the antenna string - */ - virtual std::string get_antenna(size_t chan = 0) = 0; - - /*! - * Get a list of possible antennas. - * \param chan the channel index 0 to N-1 - * \return a vector of antenna strings - */ - virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0; - - /*! - * Set the subdevice bandpass filter. - * \param chan the channel index 0 to N-1 - * \param bandwidth the filter bandwidth in Hz - */ - virtual void set_bandwidth(double bandwidth, size_t chan = 0) = 0; - - /*! - * Get a daughterboard sensor value. - * \param name the name of the sensor - * \param chan the channel index 0 to N-1 - * \return a sensor value object - */ - virtual shd::sensor_value_t get_dboard_sensor(const std::string &name, - size_t chan = 0) = 0; - - /*! - * Get a list of possible daughterboard sensor names. - * \param chan the channel index 0 to N-1 - * \return a vector of sensor names - */ - virtual std::vector<std::string> get_dboard_sensor_names(size_t chan = 0) = 0; - - /*! - * Get a motherboard sensor value. - * \param name the name of the sensor - * \param mboard the motherboard index 0 to M-1 - * \return a sensor value object - */ - virtual shd::sensor_value_t get_mboard_sensor(const std::string &name, - size_t mboard = 0) = 0; - - /*! - * Get a list of possible motherboard sensor names. - * \param mboard the motherboard index 0 to M-1 - * \return a vector of sensor names - */ - virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0; - - /*! - * Set the clock configuration. - * \param clock_config the new configuration - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_clock_config(const shd::clock_config_t &clock_config, - size_t mboard = 0) = 0; - - /*! - * Get the master clock rate. - * \param mboard the motherboard index 0 to M-1 - * \return the clock rate in Hz - */ - virtual double get_clock_rate(size_t mboard = 0) = 0; - - /*! - * Set the master clock rate. - * \param rate the new rate in Hz - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_clock_rate(double rate, size_t mboard = 0) = 0; - - /*! - * Get the current time registers. - * \param mboard the motherboard index 0 to M-1 - * \return the current smini time - */ - virtual shd::time_spec_t get_time_now(size_t mboard = 0) = 0; - - /*! - * Get the time when the last pps pulse occured. - * \param mboard the motherboard index 0 to M-1 - * \return the current smini time - */ - virtual shd::time_spec_t get_time_last_pps(size_t mboard = 0) = 0; - - /*! - * Sets the time registers immediately. - * \param time_spec the new time - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_time_now(const shd::time_spec_t &time_spec, - size_t mboard = 0) = 0; - - /*! - * Set the time registers at the next pps. - * \param time_spec the new time - */ - virtual void set_time_next_pps(const shd::time_spec_t &time_spec) = 0; - - /*! - * Sync the time registers with an unknown pps edge. - * \param time_spec the new time - */ - virtual void set_time_unknown_pps(const shd::time_spec_t &time_spec) = 0; - - /*! - * Get access to the underlying shd dboard iface object. - * \return the dboard_iface object - */ - virtual shd::xmini::dboard_iface::sptr get_dboard_iface(size_t chan = 0) = 0; - - /*! - * Get access to the underlying shd device object. - * \return the multi smini device object - */ - virtual shd::xmini::multi_xmini::sptr get_device(void) = 0; -}; - -#endif /* INCLUDED_GR_SHD_SMINI_SINK_H */ diff --git a/gr-shd/include/gr_shd_smini_source.h b/gr-shd/include/gr_shd_smini_source.h deleted file mode 100644 index 11c8563fe..000000000 --- a/gr-shd/include/gr_shd_smini_source.h +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_GR_SHD_SMINI_SOURCE_H -#define INCLUDED_GR_SHD_SMINI_SOURCE_H - -#include <gr_shd_api.h> -#include <gr_sync_block.h> -#include <shd/xmini/multi_xmini.hpp> - -class shd_smini_source; - -GR_SHD_API boost::shared_ptr<shd_smini_source> shd_make_smini_source( - const shd::device_addr_t &device_addr, - const shd::io_type_t &io_type, - size_t num_channels -); - -class GR_SHD_API shd_smini_source : virtual public gr_sync_block -{ - public: - - /*! - * Set the subdevice specification. - * \param spec the subdev spec markup string - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_subdev_spec(const std::string &spec, - size_t mboard = 0) = 0; - - /*! - * Set the sample rate for the smini device. - * \param rate a new rate in Sps - */ - virtual void set_samp_rate(double rate) = 0; - - /*! - * Get the sample rate for the smini device. - * This is the actual sample rate and may differ from the rate set. - * \return the actual rate in Sps - */ - virtual double get_samp_rate(void) = 0; - - /*! - * Tune the smini device to the desired center frequency. - * \param tune_request the tune request instructions - * \param chan the channel index 0 to N-1 - * \return a tune result with the actual frequencies - */ - virtual shd::tune_result_t set_center_freq( - const shd::tune_request_t tune_request, - size_t chan = 0 - ) = 0; - - /*! - * Tune the smini device to the desired center frequency. - * This is a wrapper around set center freq so that in this case, - * the user can pass a single frequency in the call through swig. - * \param freq the desired frequency in Hz - * \param chan the channel index 0 to N-1 - * \return a tune result with the actual frequencies - */ - shd::tune_result_t set_center_freq(double freq, size_t chan = 0){ - return set_center_freq(shd::tune_request_t(freq), chan); - } - - /*! - * Get the center frequency. - * \param chan the channel index 0 to N-1 - * \return the frequency in Hz - */ - virtual double get_center_freq(size_t chan = 0) = 0; - - /*! - * Get the tunable frequency range. - * \param chan the channel index 0 to N-1 - * \return the frequency range in Hz - */ - virtual shd::freq_range_t get_freq_range(size_t chan = 0) = 0; - - /*! - * Set the gain for the dboard. - * \param gain the gain in dB - * \param chan the channel index 0 to N-1 - */ - virtual void set_gain(double gain, size_t chan = 0) = 0; - - /*! - * Set the named gain on the dboard. - * \param gain the gain in dB - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - */ - virtual void set_gain(double gain, const std::string &name, - size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting. - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual double get_gain(size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting of named stage. - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual double get_gain(const std::string &name, - size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting of named stage. - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual std::vector<std::string> get_gain_names(size_t chan = 0) = 0; - - /*! - * Get the settable gain range. - * \param chan the channel index 0 to N-1 - * \return the gain range in dB - */ - virtual shd::gain_range_t get_gain_range(size_t chan = 0) = 0; - - /*! - * Get the settable gain range. - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - * \return the gain range in dB - */ - virtual shd::gain_range_t get_gain_range(const std::string &name, - size_t chan = 0) = 0; - - /*! - * Set the antenna to use. - * \param ant the antenna string - * \param chan the channel index 0 to N-1 - */ - virtual void set_antenna(const std::string &ant, - size_t chan = 0) = 0; - - /*! - * Get the antenna in use. - * \param chan the channel index 0 to N-1 - * \return the antenna string - */ - virtual std::string get_antenna(size_t chan = 0) = 0; - - /*! - * Get a list of possible antennas. - * \param chan the channel index 0 to N-1 - * \return a vector of antenna strings - */ - virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0; - - /*! - * Set the subdevice bandpass filter. - * \param bandwidth the filter bandwidth in Hz - * \param chan the channel index 0 to N-1 - */ - virtual void set_bandwidth(double bandwidth, - size_t chan = 0) = 0; - - /*! - * Get a daughterboard sensor value. - * \param name the name of the sensor - * \param chan the channel index 0 to N-1 - * \return a sensor value object - */ - virtual shd::sensor_value_t get_dboard_sensor(const std::string &name, - size_t chan = 0) = 0; - - /*! - * Get a list of possible daughterboard sensor names. - * \param chan the channel index 0 to N-1 - * \return a vector of sensor names - */ - virtual std::vector<std::string> get_dboard_sensor_names(size_t chan = 0) = 0; - - /*! - * Get a motherboard sensor value. - * \param name the name of the sensor - * \param mboard the motherboard index 0 to M-1 - * \return a sensor value object - */ - virtual shd::sensor_value_t get_mboard_sensor(const std::string &name, - size_t mboard = 0) = 0; - - /*! - * Get a list of possible motherboard sensor names. - * \param mboard the motherboard index 0 to M-1 - * \return a vector of sensor names - */ - virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0; - - /*! - * Set the clock configuration. - * \param clock_config the new configuration - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_clock_config(const shd::clock_config_t &clock_config, - size_t mboard = 0) = 0; - - /*! - * Get the master clock rate. - * \param mboard the motherboard index 0 to M-1 - * \return the clock rate in Hz - */ - virtual double get_clock_rate(size_t mboard = 0) = 0; - - /*! - * Set the master clock rate. - * \param rate the new rate in Hz - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_clock_rate(double rate, - size_t mboard = 0) = 0; - - /*! - * Get the current time registers. - * \param mboard the motherboard index 0 to M-1 - * \return the current smini time - */ - virtual shd::time_spec_t get_time_now(size_t mboard = 0) = 0; - - /*! - * Get the time when the last pps pulse occured. - * \param mboard the motherboard index 0 to M-1 - * \return the current smini time - */ - virtual shd::time_spec_t get_time_last_pps(size_t mboard = 0) = 0; - - /*! - * Sets the time registers immediately. - * \param time_spec the new time - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_time_now(const shd::time_spec_t &time_spec, - size_t mboard = 0) = 0; - - /*! - * Set the time registers at the next pps. - * \param time_spec the new time - */ - virtual void set_time_next_pps(const shd::time_spec_t &time_spec) = 0; - - /*! - * Sync the time registers with an unknown pps edge. - * \param time_spec the new time - */ - virtual void set_time_unknown_pps(const shd::time_spec_t &time_spec) = 0; - - /*! - * Get access to the underlying shd dboard iface object. - * \return the dboard_iface object - */ - virtual shd::xmini::dboard_iface::sptr get_dboard_iface(size_t chan = 0) = 0; - - /*! - * Get access to the underlying shd device object. - * \return the multi smini device object - */ - virtual shd::xmini::multi_xmini::sptr get_device(void) = 0; -}; - -#endif /* INCLUDED_GR_SHD_SMINI_SOURCE_H */ diff --git a/gr-shd/lib/CMakeLists.txt b/gr-shd/lib/CMakeLists.txt deleted file mode 100644 index 38154755c..000000000 --- a/gr-shd/lib/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${GR_SHD_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${SHD_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -} - -link_directories(${SHD_LIBRARY_DIRS}) -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_shd_sources - gr_shd_smini_source.cc - gr_shd_smini_sink.cc -) - -list(APPEND shd_libs - gnuradio-core - ${Boost_LIBRARIES} - ${SHD_LIBRARIES} -) - -add_library(gnuradio-shd SHARED ${gr_shd_sources}) -target_link_libraries(gnuradio-shd ${shd_libs}) -GR_LIBRARY_FOO(gnuradio-shd RUNTIME_COMPONENT "shd_runtime" DEVEL_COMPONENT "shd_devel") diff --git a/gr-shd/lib/gr_shd_smini_sink.cc b/gr-shd/lib/gr_shd_smini_sink.cc deleted file mode 100644 index 658f5719e..000000000 --- a/gr-shd/lib/gr_shd_smini_sink.cc +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright 2011 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. - */ - -#include <gr_shd_smini_sink.h> -#include <gr_io_signature.h> -#include <stdexcept> - -/********************************************************************* - * SHD Multi SMINI Sink Impl - ********************************************************************/ -class shd_smini_sink_impl : public shd_smini_sink -{ -public: - shd_smini_sink_impl(const shd::device_addr_t &device_addr, - const shd::io_type_t &io_type, - size_t num_channels): - gr_sync_block("gr shd smini sink", - gr_make_io_signature(num_channels, num_channels, io_type.size), - gr_make_io_signature(0, 0, 0)), - _type(io_type), - _nchan(num_channels), - _has_time_spec(_nchan > 1) - { - _dev = shd::xmini::multi_xmini::make(device_addr); - } - - void set_subdev_spec(const std::string &spec, - size_t mboard) - { - return _dev->set_tx_subdev_spec(spec, mboard); - } - - void set_samp_rate(double rate){ - _dev->set_tx_rate(rate); - _sample_rate = this->get_samp_rate(); - } - - double get_samp_rate(void){ - return _dev->get_tx_rate(); - } - - shd::tune_result_t set_center_freq( - const shd::tune_request_t tune_request, size_t chan) - { - return _dev->set_tx_freq(tune_request, chan); - } - - double get_center_freq(size_t chan) - { - return _dev->get_tx_freq(chan); - } - - shd::freq_range_t get_freq_range(size_t chan) - { - return _dev->get_tx_freq_range(chan); - } - - void set_gain(double gain, size_t chan) - { - return _dev->set_tx_gain(gain, chan); - } - - void set_gain(double gain, const std::string &name, - size_t chan) - { - return _dev->set_tx_gain(gain, name, chan); - } - - double get_gain(size_t chan){ - return _dev->get_tx_gain(chan); - } - - double get_gain(const std::string &name, size_t chan) - { - return _dev->get_tx_gain(name, chan); - } - - std::vector<std::string> get_gain_names(size_t chan) - { - return _dev->get_tx_gain_names(chan); - } - - shd::gain_range_t get_gain_range(size_t chan) - { - return _dev->get_tx_gain_range(chan); - } - - shd::gain_range_t get_gain_range(const std::string &name, - size_t chan) - { - return _dev->get_tx_gain_range(name, chan); - } - - void set_antenna(const std::string &ant, size_t chan) - { - return _dev->set_tx_antenna(ant, chan); - } - - std::string get_antenna(size_t chan) - { - return _dev->get_tx_antenna(chan); - } - - std::vector<std::string> get_antennas(size_t chan) - { - return _dev->get_tx_antennas(chan); - } - - void set_bandwidth(double bandwidth, size_t chan) - { - return _dev->set_tx_bandwidth(bandwidth, chan); - } - - shd::sensor_value_t get_dboard_sensor(const std::string &name, - size_t chan) - { - return _dev->get_tx_sensor(name, chan); - } - - std::vector<std::string> get_dboard_sensor_names(size_t chan) - { - return _dev->get_tx_sensor_names(chan); - } - - shd::sensor_value_t get_mboard_sensor(const std::string &name, - size_t mboard) - { - return _dev->get_mboard_sensor(name, mboard); - } - - std::vector<std::string> get_mboard_sensor_names(size_t mboard) - { - return _dev->get_mboard_sensor_names(mboard); - } - - void set_clock_config(const shd::clock_config_t &clock_config, - size_t mboard) - { - return _dev->set_clock_config(clock_config, mboard); - } - - double get_clock_rate(size_t mboard) - { - return _dev->get_master_clock_rate(mboard); - } - - void set_clock_rate(double rate, size_t mboard) - { - return _dev->set_master_clock_rate(rate, mboard); - } - - shd::time_spec_t get_time_now(size_t mboard = 0) - { - return _dev->get_time_now(mboard); - } - - shd::time_spec_t get_time_last_pps(size_t mboard) - { - return _dev->get_time_last_pps(mboard); - } - - void set_time_now(const shd::time_spec_t &time_spec, - size_t mboard) - { - return _dev->set_time_now(time_spec, mboard); - } - - void set_time_next_pps(const shd::time_spec_t &time_spec) - { - return _dev->set_time_next_pps(time_spec); - } - - void set_time_unknown_pps(const shd::time_spec_t &time_spec) - { - return _dev->set_time_unknown_pps(time_spec); - } - - shd::xmini::dboard_iface::sptr get_dboard_iface(size_t chan) - { - return _dev->get_tx_dboard_iface(chan); - } - - shd::xmini::multi_xmini::sptr get_device(void) - { - return _dev; - } - - /******************************************************************* - * Work - ******************************************************************/ - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - //send a mid-burst packet with time spec - _metadata.start_of_burst = false; - _metadata.end_of_burst = false; - _metadata.has_time_spec = _has_time_spec; - - size_t num_sent = _dev->get_device()->send( - input_items, noutput_items, _metadata, - _type, shd::device::SEND_MODE_FULL_BUFF, 1.0); - - //increment the timespec by the number of samples sent - _metadata.time_spec += shd::time_spec_t(0, num_sent, _sample_rate); - return num_sent; - } - - //Send an empty start-of-burst packet to begin streaming. - //Set at a time in the near future to avoid late packets. - bool start(void) - { - _metadata.start_of_burst = true; - _metadata.end_of_burst = false; - _metadata.has_time_spec = _has_time_spec; - _metadata.time_spec = get_time_now() + shd::time_spec_t(0.01); - - _dev->get_device()->send( - gr_vector_const_void_star(_nchan), 0, _metadata, - _type, shd::device::SEND_MODE_ONE_PACKET, 1.0); - return true; - } - - //Send an empty end-of-burst packet to end streaming. - //Ending the burst avoids an underflow error on stop. - bool stop(void) - { - _metadata.start_of_burst = false; - _metadata.end_of_burst = true; - _metadata.has_time_spec = false; - - _dev->get_device()->send( - gr_vector_const_void_star(_nchan), 0, _metadata, - _type, shd::device::SEND_MODE_ONE_PACKET, 1.0); - return true; - } - -protected: - shd::xmini::multi_xmini::sptr _dev; - const shd::io_type_t _type; - size_t _nchan; - bool _has_time_spec; - shd::tx_metadata_t _metadata; - double _sample_rate; -}; - -/********************************************************************* - * Make SHD Multi SMINI Sink - ********************************************************************/ - -boost::shared_ptr<shd_smini_sink> shd_make_smini_sink( - const shd::device_addr_t &device_addr, - const shd::io_type_t &io_type, - size_t num_channels) -{ - return boost::shared_ptr<shd_smini_sink>( - new shd_smini_sink_impl(device_addr, io_type, num_channels)); -} diff --git a/gr-shd/lib/gr_shd_smini_source.cc b/gr-shd/lib/gr_shd_smini_source.cc deleted file mode 100644 index 58559a623..000000000 --- a/gr-shd/lib/gr_shd_smini_source.cc +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright 2011 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. - */ - -#include <gr_shd_smini_source.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> -#include <boost/format.hpp> - -/********************************************************************* - * SHD Multi S-MINI Source Impl - ********************************************************************/ -class shd_smini_source_impl : public shd_smini_source -{ -public: - shd_smini_source_impl( - const shd::device_addr_t &device_addr, - const shd::io_type_t &io_type, - size_t num_channels - ): - gr_sync_block( - "gr shd smini source", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(num_channels, num_channels, io_type.size) - ), - _type(io_type), - _nchan(num_channels), - _stream_now(_nchan == 1), - _tmp_buffs(_nchan) - { - _dev = shd::xmini::multi_xmini::make(device_addr); - } - - void set_subdev_spec(const std::string &spec, size_t mboard) - { - return _dev->set_rx_subdev_spec(spec, mboard); - } - - void set_samp_rate(double rate) - { - _dev->set_rx_rate(rate); - } - - double get_samp_rate(void) - { - return _dev->get_rx_rate(); - } - - shd::tune_result_t set_center_freq( - const shd::tune_request_t tune_request, size_t chan) - { - return _dev->set_rx_freq(tune_request, chan); - } - - double get_center_freq(size_t chan) - { - return _dev->get_rx_freq(chan); - } - - shd::freq_range_t get_freq_range(size_t chan) - { - return _dev->get_rx_freq_range(chan); - } - - void set_gain(double gain, size_t chan) - { - return _dev->set_rx_gain(gain, chan); - } - - void set_gain(double gain, const std::string &name, - size_t chan) - { - return _dev->set_rx_gain(gain, name, chan); - } - - double get_gain(size_t chan) - { - return _dev->get_rx_gain(chan); - } - - double get_gain(const std::string &name, size_t chan) - { - return _dev->get_rx_gain(name, chan); - } - - std::vector<std::string> get_gain_names(size_t chan) - { - return _dev->get_rx_gain_names(chan); - } - - shd::gain_range_t get_gain_range(size_t chan) - { - return _dev->get_rx_gain_range(chan); - } - - shd::gain_range_t get_gain_range(const std::string &name, - size_t chan) - { - return _dev->get_rx_gain_range(name, chan); - } - - void set_antenna(const std::string &ant, size_t chan) - { - return _dev->set_rx_antenna(ant, chan); - } - - std::string get_antenna(size_t chan) - { - return _dev->get_rx_antenna(chan); - } - - std::vector<std::string> get_antennas(size_t chan) - { - return _dev->get_rx_antennas(chan); - } - - void set_bandwidth(double bandwidth, size_t chan) - { - return _dev->set_rx_bandwidth(bandwidth, chan); - } - - shd::sensor_value_t get_dboard_sensor(const std::string &name, - size_t chan) - { - return _dev->get_rx_sensor(name, chan); - } - - std::vector<std::string> get_dboard_sensor_names(size_t chan) - { - return _dev->get_rx_sensor_names(chan); - } - - shd::sensor_value_t get_mboard_sensor(const std::string &name, - size_t mboard) - { - return _dev->get_mboard_sensor(name, mboard); - } - - std::vector<std::string> get_mboard_sensor_names(size_t mboard) - { - return _dev->get_mboard_sensor_names(mboard); - } - - void set_clock_config(const shd::clock_config_t &clock_config, - size_t mboard) - { - return _dev->set_clock_config(clock_config, mboard); - } - - double get_clock_rate(size_t mboard) - { - return _dev->get_master_clock_rate(mboard); - } - - void set_clock_rate(double rate, size_t mboard) - { - return _dev->set_master_clock_rate(rate, mboard); - } - - shd::time_spec_t get_time_now(size_t mboard = 0) - { - return _dev->get_time_now(mboard); - } - - shd::time_spec_t get_time_last_pps(size_t mboard) - { - return _dev->get_time_last_pps(mboard); - } - - void set_time_now(const shd::time_spec_t &time_spec, - size_t mboard) - { - return _dev->set_time_now(time_spec, mboard); - } - - void set_time_next_pps(const shd::time_spec_t &time_spec) - { - return _dev->set_time_next_pps(time_spec); - } - - void set_time_unknown_pps(const shd::time_spec_t &time_spec) - { - return _dev->set_time_unknown_pps(time_spec); - } - - shd::xmini::dboard_iface::sptr get_dboard_iface(size_t chan) - { - return _dev->get_rx_dboard_iface(chan); - } - - shd::xmini::multi_xmini::sptr get_device(void) - { - return _dev; - } - - /******************************************************************* - * Work - ******************************************************************/ - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - //In order to allow for low-latency: - //We receive all available packets without timeout. - //This call can timeout under regular operation... - size_t num_samps = _dev->get_device()->recv( - output_items, noutput_items, _metadata, - _type, shd::device::RECV_MODE_FULL_BUFF, 0.0); - - //If receive resulted in a timeout condition: - //We now receive a single packet with a large timeout. - if(_metadata.error_code == shd::rx_metadata_t::ERROR_CODE_TIMEOUT) { - num_samps = _dev->get_device()->recv( - output_items, noutput_items, _metadata, - _type, shd::device::RECV_MODE_ONE_PACKET, 1.0); - } - - //handle possible errors conditions - switch(_metadata.error_code) { - case shd::rx_metadata_t::ERROR_CODE_NONE: - //TODO insert tag for time stamp - break; - - case shd::rx_metadata_t::ERROR_CODE_TIMEOUT: - //Assume that the user called stop() on the flow graph. - //However, a timeout can occur under error conditions. - return WORK_DONE; - - case shd::rx_metadata_t::ERROR_CODE_OVERFLOW: - //ignore overflows and try work again - //TODO insert tag for overflow - return work(noutput_items, input_items, output_items); - - default: - std::cout << boost::format("SHD source block got error code 0x%x" - ) % _metadata.error_code << std::endl; - return num_samps; - } - - return num_samps; - } - - bool start(void) - { - //setup a stream command that starts streaming slightly in the future - static const double reasonable_delay = 0.1; //order of magnitude over RTT - shd::stream_cmd_t stream_cmd(shd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); - stream_cmd.stream_now = _stream_now; - stream_cmd.time_spec = get_time_now() + shd::time_spec_t(reasonable_delay); - _dev->issue_stream_cmd(stream_cmd); - return true; - } - - bool stop(void) - { - _dev->issue_stream_cmd(shd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS); - return true; - } - -private: - shd::xmini::multi_xmini::sptr _dev; - const shd::io_type_t _type; - size_t _nchan; - bool _stream_now; - gr_vector_void_star _tmp_buffs; - shd::rx_metadata_t _metadata; -}; - - -/********************************************************************* - * Make SHD Multi SMINI Source - ********************************************************************/ - -boost::shared_ptr<shd_smini_source> shd_make_smini_source( - const shd::device_addr_t &device_addr, - const shd::io_type_t &io_type, - size_t num_channels) -{ - return boost::shared_ptr<shd_smini_source>( - new shd_smini_source_impl(device_addr, io_type, num_channels)); -} diff --git a/gr-shd/swig/CMakeLists.txt b/gr-shd/swig/CMakeLists.txt deleted file mode 100644 index 364656b86..000000000 --- a/gr-shd/swig/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_FLAGS -DGR_HAVE_SHD) #needed to parse shd_swig.i - -set(GR_SWIG_INCLUDE_DIRS - ${GR_SHD_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/shd_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include) - -link_directories(${SHD_LIBRARY_DIRS}) -set(GR_SWIG_LIBRARIES gnuradio-shd ${SHD_LIBRARIES}) - -GR_SWIG_MAKE(shd_swig shd_swig.i) - -GR_SWIG_INSTALL( - TARGETS shd_swig - DESTINATION ${GR_PYTHON_DIR}/gnuradio/shd - COMPONENT "shd_python" -) - -install( - FILES shd_swig.i - ${CMAKE_CURRENT_BINARY_DIR}/shd_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "shd_swig" -) - -GR_PYTHON_INSTALL( - FILES __init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/shd - COMPONENT "shd_python" -) diff --git a/gr-shd/swig/__init__.py b/gr-shd/swig/__init__.py deleted file mode 100644 index a9dea9420..000000000 --- a/gr-shd/swig/__init__.py +++ /dev/null @@ -1,92 +0,0 @@ -# -# Copyright 2011 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. -# - -''' -GNU Radio package for the Symplex Hardware Driver. -''' - -######################################################################## -# Prepare shd swig module to make it more pythonic -######################################################################## -def _prepare_shd_swig(): - import shd_swig - - #some useful typedefs for the user - setattr(shd_swig, 'freq_range_t', shd_swig.meta_range_t) - setattr(shd_swig, 'gain_range_t', shd_swig.meta_range_t) - - #Make the python tune request object inherit from float - #so that it can be passed in GRC as a frequency parameter. - #The type checking in GRC will accept the tune request. - class tune_request_t(shd_swig.tune_request_t, float): - def __new__(self, *args): return float.__new__(self) - def __float__(self): return self.target_freq - setattr(shd_swig, 'tune_request_t', tune_request_t) - - #Make the python tune request object inherit from string - #so that it can be passed in GRC as a string parameter. - #The type checking in GRC will accept the device address. - #Define the set/get item special methods for dict access. - class device_addr_t(shd_swig.device_addr_t, str): - def __new__(self, *args): return str.__new__(self) - def __getitem__(self, key): return self.get(key) - def __setitem__(self, key, val): self.set(key, val) - setattr(shd_swig, 'device_addr_t', device_addr_t) - - #handle general things on all shd_swig attributes - #Install the __str__ and __repr__ handlers if applicable - #Create aliases for shd swig attributes to avoid the "_t" - for attr in dir(shd_swig): - myobj = getattr(shd_swig, attr) - if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda o: o.to_string().strip() - if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda o: o.to_pp_string().strip() - if hasattr(myobj, 'to_bool'): myobj.__nonzero__ = lambda o: o.to_bool() - if hasattr(myobj, 'to_int'): myobj.__int__ = lambda o: o.to_int() - if hasattr(myobj, 'to_real'): myobj.__float__ = lambda o: o.to_real() - if attr.endswith('_t'): setattr(shd_swig, attr[:-2], myobj) - - #Cast constructor args (FIXME swig handle overloads?) - for attr in ('smini_source', 'smini_sink'): - def constructor_factory(old_constructor): - def constructor_interceptor(*args, **kwargs): - args = list(args) - kwargs = dict(kwargs) - for index, key, cast in ( - (0, 'device_addr', device_addr), - (1, 'io_type', io_type), - ): - if len(args) > index: args[index] = cast(args[index]) - if kwargs.has_key(key): kwargs[key] = cast(kwargs[key]) - return old_constructor(*args, **kwargs) - return constructor_interceptor - setattr(shd_swig, attr, constructor_factory(getattr(shd_swig, attr))) - - #Aliases for deprecated constructors - setattr(shd_swig, 'single_smini_source', shd_swig.smini_source) - setattr(shd_swig, 'single_smini_sink', shd_swig.smini_sink) - setattr(shd_swig, 'multi_smini_source', shd_swig.smini_source) - setattr(shd_swig, 'multi_smini_sink', shd_swig.smini_sink) - -######################################################################## -# Initialize this module with the contents of shd swig -######################################################################## -_prepare_shd_swig() -from shd_swig import * diff --git a/gr-shd/swig/gnuradio/shd.scm b/gr-shd/swig/gnuradio/shd.scm deleted file mode 100644 index 91af98dd8..000000000 --- a/gr-shd/swig/gnuradio/shd.scm +++ /dev/null @@ -1,27 +0,0 @@ -;;; -;;; Copyright 2011 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 this program. If not, see <http://www.gnu.org/licenses/>. -;;; - -;;; Semi bogus module that just reexports the shd_swig module - -(define-module (gnuradio shd) - #:use-module (gnuradio export-safely) - #:use-module (gnuradio shd_swig) - #:duplicates (merge-generics replace check)) - -(re-export-all '(gnuradio shd_swig)) diff --git a/gr-shd/swig/qa_shd.py b/gr-shd/swig/qa_shd.py deleted file mode 100755 index a589fee43..000000000 --- a/gr-shd/swig/qa_shd.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2008,2010 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. -# - -from gnuradio import gr, gr_unittest -import shd_swig - -class test_shd(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_000_nop (self): - """Just see if we can import the module... - They may not have a SHD device connected, etc. Don't try to run anything""" - pass - -if __name__ == '__main__': - gr_unittest.run(test_shd, "test_shd.xml") diff --git a/gr-shd/swig/shd_swig.i b/gr-shd/swig/shd_swig.i deleted file mode 100644 index 9d5dae51c..000000000 --- a/gr-shd/swig/shd_swig.i +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -// Defined during configure; avoids trying to locate -// header files if SHD was not installed. -#ifdef GR_HAVE_SHD - -#define GR_SHD_API - -//load generated python docstrings -%include "shd_swig_doc.i" - -//////////////////////////////////////////////////////////////////////// -// Language independent exception handler -//////////////////////////////////////////////////////////////////////// -%include exception.i - -%exception { - try { - $action - } - catch(std::exception &e) { - SWIG_exception(SWIG_RuntimeError, e.what()); - } - catch(...) { - SWIG_exception(SWIG_RuntimeError, "Unknown exception"); - } - -} - -//////////////////////////////////////////////////////////////////////// -// standard includes -//////////////////////////////////////////////////////////////////////// -%include "gnuradio.i" - -//////////////////////////////////////////////////////////////////////// -// block headers -//////////////////////////////////////////////////////////////////////// -%{ -#include <gr_shd_smini_source.h> -#include <gr_shd_smini_sink.h> -%} - -//////////////////////////////////////////////////////////////////////// -// used types -//////////////////////////////////////////////////////////////////////// -%template(string_vector_t) std::vector<std::string>; - -%include <shd/config.hpp> - -%include <shd/utils/pimpl.hpp> - -%ignore shd::dict::operator[]; //ignore warnings about %extend -%include <shd/types/dict.hpp> -%template(string_string_dict_t) shd::dict<std::string, std::string>; //define after dict - -%include <shd/types/device_addr.hpp> - -%include <shd/types/io_type.hpp> - -%template(range_vector_t) std::vector<shd::range_t>; //define before range -%include <shd/types/ranges.hpp> - -%include <shd/types/tune_request.hpp> - -%include <shd/types/tune_result.hpp> - -%include <shd/types/io_type.hpp> - -%include <shd/types/time_spec.hpp> - -%include <shd/types/clock_config.hpp> - -%include <shd/types/metadata.hpp> - -%ignore shd::device::register_device; //causes compile to choke in MSVC -%include <shd/device.hpp> -%template(device_addr_vector_t) std::vector<shd::device_addr_t>; - -%include <shd/types/sensors.hpp> - -//////////////////////////////////////////////////////////////////////// -// swig dboard_iface for python access -//////////////////////////////////////////////////////////////////////// -%include stdint.i -%include <shd/types/serial.hpp> -%template(byte_vector_t) std::vector<uint8_t>; -%include <shd/xmini/dboard_iface.hpp> - -%template(dboard_iface_sptr) boost::shared_ptr<shd::xmini::dboard_iface>; - -//////////////////////////////////////////////////////////////////////// -// block magic -//////////////////////////////////////////////////////////////////////// -GR_SWIG_BLOCK_MAGIC(shd,smini_source) -%include <gr_shd_smini_source.h> - -GR_SWIG_BLOCK_MAGIC(shd,smini_sink) -%include <gr_shd_smini_sink.h> - -//////////////////////////////////////////////////////////////////////// -// helpful constants -//////////////////////////////////////////////////////////////////////// -%{ -static const size_t ALL_MBOARDS = shd::xmini::multi_xmini::ALL_MBOARDS; -%} -static const size_t ALL_MBOARDS; - -#endif /* GR_HAVE_SHD */ diff --git a/gr-trellis/CMakeLists.txt b/gr-trellis/CMakeLists.txt deleted file mode 100644 index 16a3e7c19..000000000 --- a/gr-trellis/CMakeLists.txt +++ /dev/null @@ -1,120 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) -GR_REGISTER_COMPONENT("gr-trellis" ENABLE_GR_TRELLIS - Boost_FOUND - ENABLE_GR_CORE - ENABLE_GR_DIGITAL -) - -GR_SET_GLOBAL(GR_TRELLIS_INCLUDE_DIRS - ${CMAKE_CURRENT_BINARY_DIR}/src/lib - ${CMAKE_CURRENT_SOURCE_DIR}/src/lib -) - -SET(GR_PKG_TRELLIS_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/trellis) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_TRELLIS) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_TRELLIS_DESCRIPTION "GNU Radio Trellis Blocks") - -CPACK_COMPONENT("trellis_docs" - GROUP "Trellis" - DISPLAY_NAME "Documentation" - DESCRIPTION "Doxygen HTML and XML" -) - -CPACK_COMPONENT("trellis_runtime" - GROUP "Trellis" - DISPLAY_NAME "Runtime" - DESCRIPTION "Dynamic link libraries" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("trellis_devel" - GROUP "Trellis" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("trellis_python" - GROUP "Trellis" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime" - DEPENDS "core_python;trellis_runtime" -) - -CPACK_COMPONENT("trellis_examples" - GROUP "Trellis" - DISPLAY_NAME "Examples" - DESCRIPTION "Python examples for trellis" - DEPENDS "trellis_python" -) - -CPACK_COMPONENT("trellis_swig" - GROUP "Trellis" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;trellis_python;trellis_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(src/lib) -add_subdirectory(doc) -if(ENABLE_PYTHON) - add_subdirectory(grc) - add_subdirectory(src/python) - add_subdirectory(src/examples/python) - add_subdirectory(src/examples/grc) -endif(ENABLE_PYTHON) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-trellis.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-trellis.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-trellis.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "trellis_devel" -) - -endif(ENABLE_GR_TRELLIS) diff --git a/gr-trellis/README b/gr-trellis/README deleted file mode 100644 index 11b925b00..000000000 --- a/gr-trellis/README +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright 2005,2006 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. -# - - -The doc directory is not built by default. This is to avoid spurious -build problems on systems that don't have xmlto installed. If you -have xmlto and its dependencies installed, you can build the html -version of the gr-trellis article by cd'ing to doc and invoking make. diff --git a/gr-trellis/doc/CMakeLists.txt b/gr-trellis/doc/CMakeLists.txt deleted file mode 100644 index 568539582..000000000 --- a/gr-trellis/doc/CMakeLists.txt +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2011 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. - -include(GrPython) - -######################################################################## -# Generate HTML doc with xmlto -######################################################################## -find_program(XMLTO_EXECUTABLE xmlto) - -if(XMLTO_EXECUTABLE) -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gr-trellis.html - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gr-trellis.xml - COMMAND ${XMLTO_EXECUTABLE} html-nochunks - ${CMAKE_CURRENT_SOURCE_DIR}/gr-trellis.xml -) -add_custom_target(gr_trellis_html ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gr-trellis.html) -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gr-trellis.html - DESTINATION ${GR_PKG_DOC_DIR}/html - COMPONENT "trellis_docs" - -) -endif(XMLTO_EXECUTABLE) - -######################################################################## -# Generate xml doc -######################################################################## -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_tcm.py.xml - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test_tcm.py - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/make_numbered_listing.py - COMMAND ${PYTHON_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/make_numbered_listing.py - ${CMAKE_CURRENT_SOURCE_DIR}/test_tcm.py -) - -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_viterbi_equalization1.py.xml - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test_viterbi_equalization1.py - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/make_numbered_listing.py - COMMAND ${PYTHON_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/make_numbered_listing.py - ${CMAKE_CURRENT_SOURCE_DIR}/test_viterbi_equalization1.py -) - -add_custom_target(gr_trellis_xml ALL DEPENDS - ${CMAKE_CURRENT_BINARY_DIR}/test_tcm.py.xml - ${CMAKE_CURRENT_BINARY_DIR}/test_viterbi_equalization1.py.xml -) -install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/test_tcm.py.xml - ${CMAKE_CURRENT_BINARY_DIR}/test_viterbi_equalization1.py.xml - DESTINATION ${GR_PKG_DOC_DIR}/xml - COMPONENT "trellis_docs" -) diff --git a/gr-trellis/doc/gr-trellis.xml b/gr-trellis/doc/gr-trellis.xml deleted file mode 100644 index 4657dab38..000000000 --- a/gr-trellis/doc/gr-trellis.xml +++ /dev/null @@ -1,954 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "docbookx.dtd" [ - <!ENTITY test_tcm_listing SYSTEM "test_tcm.py.xml"> - <!ENTITY test_viterbi_equalization1_listing SYSTEM "test_viterbi_equalization1.py.xml"> -]> - -<article> - -<articleinfo> - <title>Trellis-based algorithms for GNU Radio</title> - <author> - <firstname>Achilleas</firstname> - <surname>Anastasopoulos</surname> - <affiliation> - <address> - <email>anastas@umich.edu</email> - </address> - </affiliation> - </author> - -<!-- -<revhistory> - <revision> - <revnumber>v0.0</revnumber> - <date>2006-08-03</date> - <revremark> - First cut. - </revremark> - </revision> -</revhistory> ---> - -<abstract><para>This document provides a description of the -Finite State Machine (FSM) implementation and the related -trellis-based encoding and decoding algorithms -for GNU Radio. -</para></abstract> - -</articleinfo> - - - - -<!--=====================================================--> -<sect1 id="intro"><title>Introduction</title> - -<para> -The basic goal of the implementation is to have a generic way of -describing an FSM that is decoupled from whether it describes a -convolutional -code (CC), a trellis code (TC), an inter-symbol interference (ISI) -channel, or any -other communication system that can be modeled with an FSM. -To achieve this goal, we need to separate the pure FSM descrition from the -rest of the model details. For instance, in the case of a rate 2/3 TC, -the FSM should not involve details about the modulation used (it can -be an 8-ary PAM, or 8-PSK, etc). Similarly, when attempting maximum likelihood -sequence detection (MLSD)--using for instance the Viterbi algorithm (VA)-- -the VA implementation should not be concerned with the channel details -(such as modulations, channel type, hard or soft inputs, etc). -Clearly, having generality as the primary goal implies some penalty -on the code efficiency, as compared to fully custom implementations. -</para> - -<para> -We will now describe the implementation of the basic ingedient, the FSM. -</para> - -</sect1> - - -<!--=====================================================--> -<sect1 id="fsm"><title>The FSM class</title> - -<para>An FSM describes the evolution of a system with inputs -x<subscript>k</subscript>, states s<subscript>k</subscript> and outputs y<subscript>k</subscript>. At time k the FSM state is s<subscript>k</subscript>. -Upon reception of a new input symbol x<subscript>k</subscript>, it outputs an output symbol -y<subscript>k</subscript> which is a function of both x<subscript>k</subscript> and s<subscript>k</subscript>. -It will then move to a next state s<subscript>k+1</subscript>. -An FSM has a finite number of states, input and output symbols. -All these are formally described as follows: -</para> - -<itemizedlist> -<listitem><para>The input alphabet A<subscript>I</subscript>={0,1,2,...,I-1}, with cardinality I, so that x<subscript>k</subscript> takes values in A<subscript>I</subscript>.</para></listitem> -<listitem><para>The state alphabet A<subscript>S</subscript>={0,1,2,...,S-1}, with cardinality S, so that s<subscript>k</subscript> takes values in A<subscript>S</subscript>.</para></listitem> -<listitem><para>The output alphabet A<subscript>O</subscript>={0,1,2,...,O-1}, with cardinality O, so that y<subscript>k</subscript> takes values in A<subscript>O</subscript></para></listitem> -<listitem><para>The "next-state" function NS: A<subscript>S</subscript> x A<subscript>I</subscript> --> A<subscript>S</subscript>, -with the meaning -s<subscript>k+1</subscript> = NS(s<subscript>k</subscript>, x<subscript>k</subscript>)</para></listitem> -<listitem><para>The "output-symbol" function OS: A<subscript>S</subscript> x A<subscript>I</subscript> --> A<subscript>S</subscript>, -with the meaning -y<subscript>k</subscript> = OS(s<subscript>k</subscript>, x<subscript>k</subscript>)</para></listitem> -</itemizedlist> - -<para> -Thus, a complete description of the FSM is given by the -the five-tuple (I,S,O,NS,OS). -Observe that implementation details are hidden -in how the outside world interprets these input and output -integer symbols. -Here is an example of an FSM describing the (2,1) CC -with constraint length 3 and generator polynomial matrix -(1+D+D<superscript>2</superscript> , 1+D<superscript>2</superscript>) -from Proakis-Salehi pg. 779. -</para> - - -<example id="cc_ex"><title>(2,1) CC with generator polynomials (1+D+D<superscript>2</superscript> , 1+D<superscript>2</superscript>)</title> - -<para> -This CC accepts 1 bit at a time, and outputs 2 bits at a time. -It has a shift register storing the last two input bits. -In particular, -b<subscript>k</subscript>(0)=x<subscript>k</subscript>+ -x<subscript>k-1</subscript>+x<subscript>k-2</subscript>, and -b<subscript>k</subscript>(1)=x<subscript>k</subscript>+ -x<subscript>k-2</subscript>, where addition is mod-2. -We can represent the state of this system -as s<subscript>k</subscript> = (x<subscript>k-1</subscript> x<subscript>k-2</subscript>)<subscript>10</subscript>. In addition we can represent its -output symbol as y<subscript>k</subscript> = (b<subscript>k</subscript>(1) b<subscript>k</subscript>(0))<subscript>10</subscript>. -Based on the above assumptions, the input alphabet A<subscript>I</subscript>={0,1}, so I=2; -the state alphabet A<subscript>S</subscript>={0,1,2,3}, so S=4; and -the output alphabet A<subscript>O</subscript>={0,1,2,3}, so O=4. -The "next-state" function NS(,) is given by -<programlisting> -s<subscript>k</subscript> x<subscript>k</subscript> s<subscript>k+1</subscript> -0 0 0 -0 1 2 -1 0 0 -1 1 2 -2 0 1 -2 1 3 -3 0 1 -3 1 3 -</programlisting> -The "output-symbol" function OS(,) can be given by -<programlisting> -s<subscript>k</subscript> x<subscript>k</subscript> y<subscript>k</subscript> -0 0 0 -0 1 3 -1 0 3 -1 1 0 -2 0 1 -2 1 2 -3 0 2 -3 1 1 -</programlisting> -</para> - -<para> -Note that although the CC outputs 2 bits per time period, following -our approach, there is only one (quaternary) output symbol per -time period (for instance, here we use the decimal representation -of the 2-bits). Also note that the modulation used is not part of -the FSM description: it can be BPSK, OOK, BFSK, QPSK with or without Gray mapping, etc; -it is up to the rest of the program to interpret the meaning of -the symbol y<subscript>k</subscript>. -</para> - -</example> - - -<para> -The C++ implementation of the FSM class keeps private information about -I,S,O,NS,OS and public methods to read and write them. The NS -and OS matrices are implemented as STL 1-dimensional vectors. -</para> - -<programlisting> -class fsm { -private: - int d_I; - int d_S; - int d_O; - std::vector<int> d_NS; - std::vector<int> d_OS; - std::vector<int> d_PS; - std::vector<int> d_PI; - std::vector<int> d_TMi; - std::vector<int> d_TMl; - void generate_PS_PI (); - void generate_TM (); - bool find_es(int es); -public: - fsm(); - fsm(const fsm &FSM); - fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS); - fsm(const char *name); - fsm(int k, int n, const std::vector<int> &G); - fsm(int mod_size, int ch_length); - int I () const { return d_I; } - int S () const { return d_S; } - int O () const { return d_O; } - const std::vector<int> & NS () const { return d_NS; } - const std::vector<int> & OS () const { return d_OS; } - const std::vector<int> & PS () const { return d_PS; } - const std::vector<int> & PI () const { return d_PI; } - const std::vector<int> & TMi () const { return d_TMi; } - const std::vector<int> & TMl () const { return d_TMl; } -}; -</programlisting> - -<para> -As can be seen, other than the trivial and the copy constructor, -there are three additional -ways to construct an FSM. -</para> - -<itemizedlist> -<listitem> -<para>Supplying the parameters I,S,O,NS,OS:</para> -<programlisting> - fsm(const int I, const int S, const int O, const std::vector<int> &NS, const std::vector<int> &OS); -</programlisting> -</listitem> - -<listitem> -<para>Giving a filename containing all the FSM information:</para> -<programlisting> - fsm(const char *name); -</programlisting> -<para> -This information has to be in the following format: -<programlisting> -I S O - -NS(0,0) NS(0,1) ... NS(0,I-1) -NS(1,0) NS(1,1) ... NS(1,I-1) -... -NS(S-1,0) NS(S-1,1) ... NS(S-1,I-1) - -OS(0,0) OS(0,1) ... OS(0,I-1) -OS(1,0) OS(1,1) ... OS(1,I-1) -... -OS(S-1,0) OS(S-1,1) ... OS(S-1,I-1) -</programlisting> -</para> -<para> -For instance, the file containing the information for the example mentioned above is of the form: -<programlisting> -2 4 4 - -0 2 -0 2 -1 3 -1 3 - -0 3 -3 0 -1 2 -2 1 -</programlisting> -</para> -</listitem> - - -<listitem> -<para> -The third way is specific to FSMs representing binary (n,k) conolutional codes. These FSMs are specified by the number of input bits k, the number of output bits n, and the generator matrix, which is a k x n matrix of integers -G = [g<subscript>i,j</subscript>]<subscript>i=1:k, j=1:n</subscript>, given as an one-dimensional STL vector. -Each integer g<subscript>i,j</subscript> is the decimal representation of the -polynomial g<subscript>i,j</subscript>(D) (e.g., g<subscript>i,j</subscript>= 6 = 110<subscript>2</subscript> is interpreted as g<subscript>i,j</subscript>(D)=1+D) describing the connections from the sequence x<subscript>i</subscript> to -y<subscript>j</subscript> (e.g., in the above example y<subscript>j</subscript>(k) = x<subscript>i</subscript>(k) + x<subscript>i</subscript>(k-1)). -</para> -<programlisting> - fsm(int k, int n, const std::vector<int> &G); -</programlisting> -</listitem> - - -<listitem> -<para> -The fourth way is specific to FSMs resulting from shift registers, and the output symbol being the entire transition (ie, current_state and current_input). These FSMs are usefull when describibg ISI channels. In particular the state is comprised of the input symbols x(k-1), x(k-2),...,x(k-L), where L = ch_length-1 and each x(i) belongs to an alphabet of size mod_size. The output is taken to be x(k), x(k-1), x(k-2),...,x(k-L) (in decimal format) -</para> -<programlisting> - fsm(const int mod_size, const int ch_length); -</programlisting> -</listitem> - -<listitem> -<para> -I have added other constructors as well, eg, one that constructs an FSM appropriate for modeling an arbitrary CPM scheme; one that constructs the radix-n version of a given FSM; one that constructs the "concatenation" of two FSMs, etc. -</para> -</listitem> - - - - -</itemizedlist> - - -<para> -As can be seen from the above description, there are -two more variables included in the FSM class implementation, -the PS and the PI matrices. These are computed internally -when an FSM is instantiated and their meaning is as follows. -Sometimes (eg, in the traceback operation of the VA) we need -to trace the history of the state or the input sequence. -To do this we would like to know for a given state s<subscript>k</subscript>, what are the possible previous states s<subscript>k-1</subscript> -and what input symbols x<subscript>k-1</subscript> will get us from -s<subscript>k-1</subscript> to s<subscript>k</subscript>. This information can be derived from NS; however we want to have it ready in a -convenient format. -In the following we assume that for any state, -the number of incoming transitions is the same as the number of -outgoing transitions, ie, equal to I. All applications of interest -have FSMs satisfying this requirement. - -If we arbitrarily index the incoming transitions to the current state -by "i", then as i goes from 0 to I-1, PS(s<subscript>k</subscript>,i) -gives all previous states s<subscript>k-1</subscript>, -and PI(s<subscript>k</subscript>,i) gives all previous inputs x<subscript>k-1</subscript>. -In other words, for any given s<subscript>k</subscript> and any index i=0,1,...I-1, starting from -s<subscript>k-1</subscript>=PS(s<subscript>k</subscript>,i) -with input -x<subscript>k-1</subscript>=PI(s<subscript>k</subscript>,i) -will get us to the state s<subscript>k</subscript>. -More formally, for any i=0,1,...I-1 we have -s<subscript>k</subscript> = NS(PS(s<subscript>k</subscript>,i),PI(s<subscript>k</subscript>,i)). - -</para> - - -<para> -Finally, there are -two more variables included in the FSM class implementation, -the TMl and the TMi matrices. These are both S x S matrices (represented as STL vectors) computed internally -when an FSM is instantiated and their meaning is as follows. -TMl(i,j) is the minimum number of trellis steps required to go from state i to state j. -Similarly, TMi(i,j) is the initial input required to get you from state i to state j in the minimum number of steps. As an example, if TMl(1,4)=2, it means that you need 2 steps in the trellis to get from state 1 to state 4. Further, -if TMi(1,4)=0 it means that the first such step will be followed if when at state 1 the input is 0. Furthermore, suppose that NS(1,0)=2. Then, TMl(2,4) should be 1 (ie, one more step is needed when starting from state 2 and having state 4 as the final destination). Finally, TMi(2,4) will give us the second input required to complete the path from 1 to 4. -These matrices are useful when we want to implement an encoder with proper state termination. For instance, based on these matrices we can evaluate how many -additional input symbols (and which particular inputs) are required to be appended at the end of an input sequence so that the final state is always 0. - -</para> - - -</sect1> - - - -<!--=====================================================--> -<sect1 id="blocks"><title>Blocks Using the FSM structure</title> - -<para> -In this section we give a brief description of the basic blocks implemented that make use of the previously described FSM structure. -</para> - - -<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --> -<sect2 id="encoder"><title>Trellis Encoder</title> -<para> -The <methodname>trellis.encoder_XX(FSM, ST)</methodname> block instantiates an FSM encoder corresponding to the fsm FSM and having initial state ST. The input and output is a sequence of bytes, shorts or integers. -</para> -</sect2> - -<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --> -<sect2 id="decoder"><title>Viterbi Decoder</title> -<para> -The <methodname>trellis.viterbi_X(FSM, K, S0, SK)</methodname> block instantiates a Viterbi decoder -for a sequence of K trellis steps generated by the given FSM and with initial and final states set to S0 and SK, respectively (S0 and/or SK are set to -1 -if the corresponding states are not fixed/known at the receiver side). -The output of this block is a sequence of K bytes, shorts or integers representing the estimated input (i.e., uncoded) sequence. -The input is a sequence of K x FSM.O( ) floats, where the k x K + i -float represents the cost associated with the k-th -step in the trellis and the i-th FSM output. -Observe that these inputs are generated externally and thus the Viterbi block is not informed of their meaning (they can be genarated as soft or hard inputs, etc); the only requirement is that they represent additive costs. -</para> -</sect2> - -<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --> -<sect2 id="metrics"><title>Metrics Calculator</title> -<para> -The <methodname>trellis.metrics_X(O,D,TABLE,TYPE)</methodname> block is responsible for -transforming the channel output to the stream of metrics appropriate as -inputs to the Viterbi block described above. For each D input bytes/shorts/integers/floats/complexes it produces O output floats - -</para> - -<para> - -The parameter TYPE dictates how these metrics are generated: - -<itemizedlist> -<listitem><para> -TRELLIS_EUCLIDEAN: for each D-dimensional vector -r<subscript>k</subscript>= -(r<subscript>k,1</subscript>,r<subscript>k,2</subscript>,...,r<subscript>k,D</subscript>) -evaluates -</para> -<para> -||r<subscript>k</subscript>-c<subscript>i</subscript>||<superscript>2</superscript> = sum<subscript>j=1</subscript><superscript>D</superscript> |r<subscript>k,j</subscript>-c<subscript>i,j</subscript>|<superscript>2</superscript> -</para> -<para> -for each of the O hypothesized ouput -symbols c<subscript>i</subscript> = (c<subscript>i,1</subscript>,c<subscript>i,2</subscript>,...,c<subscript>i,D</subscript>) defined in the vector TABLE, -where TABLE[i * D + j] = c<subscript>i,j</subscript>. -</para></listitem> - - -<listitem><para> -TRELLIS_HARD_SYMBOL: for each D-dimensional vector -r<subscript>k</subscript>= -(r<subscript>k,1</subscript>,r<subscript>k,2</subscript>,...,r<subscript>k,D</subscript>) -evaluates -</para> -<para> -i<subscript>0</subscript>= argmin<subscript>i</subscript> ||r<subscript>k</subscript>-c<subscript>i</subscript>||<superscript>2</superscript> = -argmin<subscript>i</subscript> sum<subscript>j=1</subscript><superscript>D</superscript> |r<subscript>k,j</subscript>-c<subscript>i,j</subscript>|<superscript>2</superscript> -</para> -<para> -and outputs a sequence of O floats of the form (0,...,0,1,0,...,0), where the -i<subscript>0</subscript> position is set to 1. This corresponds to generating hard inputs (based on the symbol-wise Hamming distance) to the Viterbi algorithm. -</para></listitem> - - -<listitem><para> -TRELLIS_HARD_BIT (not yet implemented): for each D-dimensional vector -r<subscript>k</subscript>= -(r<subscript>k,1</subscript>,r<subscript>k,2</subscript>,...,r<subscript>k,D</subscript>) -evaluates -</para> -<para> -i<subscript>0</subscript>= argmin<subscript>i</subscript> ||r<subscript>k</subscript>-c<subscript>i</subscript>||<superscript>2</superscript> = -argmin<subscript>i</subscript> sum<subscript>j=1</subscript><superscript>D</superscript> (r<subscript>k,j</subscript>-c<subscript>i,j</subscript>)<superscript>2</superscript> -</para> -<para> -and outputs a sequence of O floats of the form (d<subscript>1</subscript>,d<subscript>2</subscript>,...,d<subscript>O</subscript>), where the -d<subscript>i</subscript> is the bitwise Hamming distance between i and i<subscript>0</subscript>. This corresponds to generating hard inputs (based on the bit-wise Hamming distance) to the Viterbi algorithm. -</para></listitem> - - -</itemizedlist> - - -</para> -</sect2> - - - - -<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --> -<sect2 id="viterbi_combined"><title>Combined Metrics Calculator and Viterbi Decoder</title> -<para> -Although the separation of metric calculation and Viterbi algorithm blocks -is consistent with our goal of providing general blocks that can be easily -reused, this separation might result in large input/output buffer sizes -betwen blocks. Indeed for an FSM with a large output alphabet, the -output of the metric block/input of the Viterbi block is FSM.O( ) floats for -each trellis step. Sometimes this results in buffer overflow even for -moderate sequence lengths. -To overcome this problem we provide a block that incorporates the metric calculation and Viterbi algorithm into a single GNU Radio block, namely -<methodname>trellis.viterbi_combined_X( FSM, K, S0, SK, D, TABLE, TYPE)</methodname> where the arguments are exactly those used in the aforementioned two blocks. -</para> -</sect2> - - - - - -</sect1> - - -<!--=====================================================--> -<sect1 id="tcm"><title>A Complete Example: Trellis Coded Modulation (TCM)</title> - -<para> -We now discuss through a concrete example how -the above FSM model can be used in GNU Radio. - -The communication system that we want to simulate -consists of a source generating the -input information in packets, a CC encoding each packet separately, -a memoryless modulator, -an additive white Gaussian noise (AWGN) channel, and -the VA performing MLSD. -The program source is as follows. -</para> - -&test_tcm_listing; - -<para> -The program is called by -<literallayout> -./test_tcm.py fsm_fname Es/No_db repetitions -</literallayout> -where "fsm_fname" is the file containing the FSM specification of the -tested TCM code, "Es/No_db" is the SNR in dB, and "repetitions" -are the number of packets to be transmitted and received in order to -collect sufficient number of errors for an accurate estimate of the -error rate. -</para> - -<para> -The FSM is first intantiated in "main" by -</para> -<programlisting> - 62 f=trellis.fsm(fname) # get the FSM specification from a file -</programlisting> - - - - - - - -<para> -Each packet has size Kb bits -(we choose Kb to be a multiple of 16 so that all bits fit nicely into shorts and can be generated by the lfsr GNU Radio). -Assuming that the FSM input has cardinality I, each input symbol consists -of bitspersymbol=log<subscript>2</subscript>( I ). The Kb/16 shorts are now -unpacked to K=Kb/bitspersymbol input -symbols that will drive the FSM encoder. -</para> -<programlisting> - 63 Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - 64 bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - 65 K=Kb/bitspersymbol # packet size in trellis steps -</programlisting> - - - -<para> -The FSM will produce K output symbols (remeber the FSM produces always one output symbol for each input symbol). Each of these symbols needs to be modulated. Since we are simulating the communication system, we need not simulate the actual waveforms. An M-ary, D-dimensional -modulation is completely specified by a set of M, D-dimensional real vectors. In "fsm_utils.py" file we give a number of useful modulations with the following format: modulation = (D,constellation), where -constellation=[c11,c12,...,c1D,c21,c22,...,c2D,...,cM1,cM2,...cMD]. -The meaning of the above is that every constellation point c_i -is an D-dimnsional vector c_i=(ci1,ci2,...,ciD) -For instance, 4-ary PAM is represented as -(1,[-3, -1, 1, 3]), while QPSK is represented as -(2,[1, 0, 0, 1, 0, -1, -1, 0]). In our example we choose QPSK modulation. -Clearly, M should be equal to the cardinality of the FSM output, O. -Finally the average symbol energy and noise variance are calculated. -</para> -<programlisting> - 66 modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations - 67 dimensionality = modulation[0] - 68 constellation = modulation[1] - 69 if len(constellation)/dimensionality != f.O(): - 70 sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - 71 sys.exit (1) - 72 # calculate average symbol energy - 73 Es = 0 - 74 for i in range(len(constellation)): - 75 Es = Es + constellation[i]**2 - 76 Es = Es / (len(constellation)/dimensionality) - 77 N0=Es/pow(10.0,esn0_db/10.0); # noise variance -</programlisting> - - - -<para> -Then, "run_test" is called with a different "seed" so that we get -different noise realizations. -</para> -<programlisting> - 82 (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations -</programlisting> - - - -<para> -Let us examine now the "run_test" function. -First we set up the transmitter blocks. -The Kb/16 shorts are first unpacked to -symbols consistent with the FSM input alphabet. -The FSm encoder requires the FSM specification, -and an initial state (which is set to 0 in this example). -</para> -<programlisting> - 15 # TX - 16 src = gr.lfsr_32k_source_s() - 17 src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - 18 s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - 19 enc = trellis.encoder_ss(f,0) # initial state = 0 -</programlisting> - - - - -<para> -We now need to modulate the FSM output symbols. -The "chunks_to_symbols_sf" is essentially a memoryless mapper which -for each input symbol y_k -outputs a sequence of D numbers ci1,ci2,...,ciD representing the -coordianates of the constellation symbol c_i with i=y_k. -</para> -<programlisting> - 20 mod = gr.chunks_to_symbols_sf(constellation,dimensionality) -</programlisting> - -<para> -The channel is AWGN with appropriate noise variance. -For each transmitted symbol c_k=(ck1,ck2,...,ckD) we receive a noisy version -r_k=(rk1,rk2,...,rkD). -</para> -<programlisting> - 22 # CHANNEL - 23 add = gr.add_ff() - 24 noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) -</programlisting> - - - -<para> -Part of the design methodology was to decouple the FSM and VA from -the details of the modulation, channel, receiver front-end etc. -In order for the VA to run, we only need to provide it with -a number representing a cost associated with each transition -in the trellis. Then the VA will find the sequence with -the smallest total cost through the trellis. -The cost associated with a transition (s_k,x_k) is only a function -of the output y_k = OS(s_k,x_k), and the observation -vector r_k. Thus, for each time period, k, -we need to label each of the SxI transitions with such a cost. -This means that for each time period we need to evaluate -O such numbers (one for each possible output symbol y_k). -This is done -in "metrics_f". In particular, metrics_f is a memoryless device -taking D inputs at a time and producing O outputs. The D inputs are -rk1,rk2,...,rkD. -The O outputs -are the costs associated with observations rk1,rk2,...,rkD and -hypothesized output symbols c_1,c_2,...,c_M. For instance, -if we choose to perform soft-input VA, we need to evaluate -the Euclidean distance between r_k and each of c_1,c_2,...,c_M, -for each of the K transmitted symbols. -Other options are available as well; for instance, we can -do hard decision demodulation and feed the VA with -symbol Hamming distances, or even bit Hamming distances, etc. -These are all implemented in "metrics_f". -</para> -<programlisting> - 26 # RX - 27 metrics = trellis.metrics_f(f.O(),dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi -</programlisting> - -<para> -Now the VA can run once it is supplied by the initial and final states. -The initial state is known to be 0; the final state is usually -forced to some value by padding the information sequence appropriately. -In this example, we always send the the same info sequence (we only randomize noise) so we can evaluate off line the final state and then provide it to the VA (a value of -1 signifies that there is no fixed initial -or final state). The VA outputs the estimates of the symbols x_k which -are then packed to shorts and compared with the transmitted sequence. -</para> -<programlisting> - 28 va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. - 29 fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - 30 dst = gr.check_lfsr_32k_s(); -</programlisting> - - - - -<para> -The function returns the number of shorts and the number of shorts in error. Observe that this way the estimated error rate refers to -16-bit-symbol error rate. -</para> -<programlisting> - 48 return (ntotal,ntotal-nright) -</programlisting> - -</sect1> - - - - - - - - - - - - - -<!--=====================================================--> -<sect1 id="isi"><title>Another Complete Example: Viterbi Equalization</title> - -<para> -We now discuss through another concrete example how -the above FSM model can be used in GNU Radio. - -The communication system that we want to simulate -consists of a source generating the -input information in packets, an ISI channel with -additive white Gaussian noise (AWGN), and -the VA performing MLSD. -The program source is as follows. -</para> - -&test_viterbi_equalization1_listing; - -<para> -The program is called by -<literallayout> -./test_viterbi_equalization1.py Es/No_db repetitions -</literallayout> -where -"Es/No_db" is the SNR in dB, and "repetitions" -are the number of packets to be transmitted and received in order to -collect sufficient number of errors for an accurate estimate of the -error rate. -</para> - - -<para> -Each packet has size Kb bits. -The modulation is chosen to be 4-PAM in this example and the channel is chosen -to be one of the test channels defined in fsm_utils.py -</para> -<programlisting> - 71 Kb=2048 # packet size in bits - 72 modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - 73 channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels -</programlisting> - -<para> -The FSM is instantiated in -</para> -<programlisting> - 74 f=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically -</programlisting> -<para> -and generated automatically given the channel length and the modulation size. -Since in this example the channel has length 5 and the modulation is 4-ary, the corresponding FSM has 4<superscript>5-1</superscript>=256 states and -4<superscript>5</superscript>=1024 outputs (see the documentation on FSM for more explanation). -</para> - -<para> -Assuming that the FSM input has cardinality I, each input symbol consists -of bitspersymbol=log<subscript>2</subscript>( I ) bits, and thus correspond to K = Kb/bitspersymbol symbols. -</para> -<programlisting> - 75 bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - 76 K=Kb/bitspersymbol # packet size in trellis steps -</programlisting> - - - -<para> -The overall system with input the 4-ary input symbols -x<subscript>k</subscript>, modulated to the -4-PAM symbols s<subscript>k</subscript> and passed through the ISI channel to produce the -noise-free observations -z<subscript>k</subscript> = -sum<subscript>j=0</subscript><superscript>L-1</superscript> c<subscript>j</subscript> s<subscript>k-j</subscript> (where L is the channel length) -can be modeled as a FSM followed by a memoryless modulation. -In particular, the FSM input is the sequence -x<subscript>k</subscript> -and its output is the "combined" symbol -y<subscript>k</subscript>= -(x<subscript>k</subscript>,x<subscript>k-1</subscript>,...,x<subscript>k-L+1</subscript>) (actually its decimal representation). -The memoryless modulator maps every "combined" symbol -y<subscript>k</subscript> to -z<subscript>k</subscript> = -sum<subscript>j=0</subscript><superscript>L-1</superscript> c<subscript>j</subscript> s<subscript>k-j</subscript> -Clearly this modulation is memoryless since -each z<subscript>k</subscript> depends only on y<subscript>k</subscript>; the memory inherent in the ISI is hidden in the FSM structure. -This memoryless modulator is automatically generated by a helper function in -fsm_utils.py given the channel and modulation as in line 78, and has the -familiar format tot_channel=(dimensionality,tot_constellation) as described in the TCM example. -This is exactly what the metrics block (or the viterbi_combined block) require in order to evaluate the VA metrics from the noisy observations. -</para> -<programlisting> - 78 tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - 79 dimensionality = tot_channel[0] - 80 tot_constellation = tot_channel[1] - 81 N0=pow(10.0,-esn0_db/10.0); # noise variance - 82 if len(tot_constellation)/dimensionality != f.O(): - 83 sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - 84 sys.exit (1) -</programlisting> - - - -<para> -Then, "run_test" is called with a different "seed" so that we get -different data and noise realizations. -</para> -<programlisting> - 91 (s,e)=run_test(f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,-long(666+i)) # run experiment with different seed to get different data and noise realizations -</programlisting> - - - -<para> -Let us examine now the "run_test" function. -First we set up the transmitter blocks. -We generate a packet of K random symbols and add a head and a tail of L zeros, -L being the channel length. This is sufficient to drive the initial and final states to 0. -</para> -<programlisting> - 14 L = len(channel) - 15 - 16 # TX - 17 # this for loop is TOO slow in python!!! - 18 packet = [0]*(K+2*L) - 19 random.seed(seed) - 20 for i in range(len(packet)): - 21 packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols - 22 for i in range(L): # first/last L symbols set to 0 - 23 packet[i] = 0 - 24 packet[len(packet)-i-1] = 0 - 25 src = gr.vector_source_s(packet,False) - 26 mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) -</programlisting> - - -<para> -The modulated symbols are filtered by the ISI channel and AWGN with appropriate noise variance is added. -</para> -<programlisting> - 28 # CHANNEL - 29 isi = gr.fir_filter_fff(1,channel) - 30 add = gr.add_ff() - 31 noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) -</programlisting> - - - -<para> -Since the output alphabet of the equivalent FSM is quite large (1024) we chose to utilize the combined metrics calculator and Viterbi algorithm block. -Also note that the first L observations are irrelevant and thus can be skipped. -</para> -<programlisting> - 33 # RX - 34 skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols - 35 #metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - 36 #va = trellis.viterbi_s(f,K+L,0,0) # Put -1 if the Initial/Final states are not set. - 37 va = trellis.viterbi_combined_s(f,K+L,0,0,dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # using viterbi_combined_s instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application... - 38 dst = gr.vector_sink_s() -</programlisting> - -<para> -Now the VA can run once it is supplied by the initial and final states. -In this example both the initial and final states are set to 0. -The VA outputs the estimates of the input symbols which -are then compared with the transmitted sequence. -</para> -<programlisting> - 49 data = dst.data() - 50 ntotal = len(data) - L - 51 nright=0 - 52 for i in range(ntotal): - 53 if packet[i+L]==data[i]: - 54 nright=nright+1 - 55 #else: - 56 #print "Error in ", i -</programlisting> - - -<para> -The function returns the number of symbols and the number of symbols in error. Observe that this way the estimated error rate refers to -2-bit-symbol error rate. -</para> -<programlisting> - 58 return (ntotal,ntotal-nright) -</programlisting> - - - -</sect1> - - - - - - -<!--=====================================================--> -<sect1 id="turbo"><title>Support for Concatenated Coding and Turbo Decoding</title> - -<para> -Soft versions of the algorithms have been implemented. -Also examples of turbo equalization/decoding and of sccc can -be found in the examples directory. - -Recently we added gnuradio blocks for sccc and pccc encoders and -turbo decoders. -Although these can be generated by existing gr-trellis blocks (in particular, -the SISO blocks, as done in some of the python examples) there is an advantage -in having this functionality as a single block. To see why, think of a turbo decoder with 10 iterations. Previously we needed to concatenate 10 x 2 SISO blocks -(for a sccc decoder) to emulate the passing of soft information between SISOs over 10 iterartions. With the new block however, only a single such block is needed that internally loops through 10 iterations; this results in space savings -and possibly time saving as well (since queueing at the input/ouput of the gr-blocks is avoided). - - -Still need to document them... -</para> - - - - -</sect1> - - - - - - - - -<!--====================n================================--> -<sect1 id="future"><title>Future Work</title> - - - -<itemizedlist> - -<listitem> -<para> -Improve the documentation :-) -</para> -</listitem> - -<listitem> -<para> -automate fsm generation from rational functions -(feedback form). -</para> -</listitem> - -<listitem> -<para> -Optimize the VA code if possible. -</para> -</listitem> - -<listitem> -<para> -A host of suboptimal -decoders, eg, sphere decoding, M- and T- algorithms, sequential decoding, etc. -can be implemented. -</para> -</listitem> - - -<listitem> -<para> -Although turbo decoding is rediculously slow in software, -we can design it in principle. One question is, whether we should -use the encoder, and SISO blocks and connect them -through GNU radio or we should implement turbo-decoding -as a single block (issues with buffering between blocks). -So far the former has been implemented. -</para> -</listitem> - -</itemizedlist> - -</sect1> - - -</article> diff --git a/gr-trellis/doc/make_numbered_listing.py b/gr-trellis/doc/make_numbered_listing.py deleted file mode 100755 index c295dc876..000000000 --- a/gr-trellis/doc/make_numbered_listing.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python - -import sys -import os, os.path -from optparse import OptionParser - -def quote_line (line): - line = line.replace ('&', '&') - line = line.replace ('<', '<') - line = line.replace ('>', '>') - line = line.replace ("'", ''') - line = line.replace ('"', '"') - return line - -def generate_listing (input_filename, title=None): - inf = open (input_filename, "r") - output_filename = os.path.basename (input_filename) + '.xml' - outf = open (output_filename, "w") - outf.write ('<?xml version="1.0" encoding="ISO-8859-1"?>\n') - # outf.write ('<example id="%s">\n' % (input_filename,)) - # if not title: - # title = input_filename - # outf.write ('<title>') - # outf.write (title) - # outf.write ('</title>\n') - outf.write ('<programlisting>\n'); - - lineno = 0 - for line in inf: - line = line.expandtabs (8) - line = quote_line (line) - lineno = lineno + 1 - outf.write ('%3d %s' % (lineno, line)) - - outf.write ('</programlisting>\n') - # outf.write ('</example>\n') - - -def main (): - for file in sys.argv[1:]: - generate_listing (file) - -if __name__ == '__main__': - main () - diff --git a/gr-trellis/doc/test_tcm.py b/gr-trellis/doc/test_tcm.py deleted file mode 100644 index 8c046d697..000000000 --- a/gr-trellis/doc/test_tcm.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import audio -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - -def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - enc = trellis.encoder_ss(f,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics = trellis.metrics_f(f.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s(); - - tb.connect (src,src_head,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics) - tb.connect (metrics,va,fsmi2s,dst) - - tb.run() - - # A bit of cheating: run the program once and print the - # final encoder state. - # Then put it as the last argument in the viterbi block - #print "final state = " , enc.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 3: - fname=args[0] - esn0_db=float(args[1]) # Es/No in dB - rep=int(args[2]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_tcm.py fsm_fname Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - f=trellis.fsm(fname) # get the FSM specification from a file - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # noise variance - - tot_s=0 - terr_s=0 - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - if (i%100==0): - print i,s,e,tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s) - # estimate of the (short) error rate - print tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/doc/test_tcm.py.xml b/gr-trellis/doc/test_tcm.py.xml deleted file mode 100644 index b5074cb2f..000000000 --- a/gr-trellis/doc/test_tcm.py.xml +++ /dev/null @@ -1,95 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<programlisting> - 1 #!/usr/bin/env python - 2 - 3 from gnuradio import gr - 4 from gnuradio import audio - 5 from gnuradio import trellis - 6 from gnuradio import eng_notation - 7 import math - 8 import sys - 9 import random - 10 import fsm_utils - 11 - 12 def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - 13 tb = gr.top_block () - 14 - 15 # TX - 16 src = gr.lfsr_32k_source_s() - 17 src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - 18 s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - 19 enc = trellis.encoder_ss(f,0) # initial state = 0 - 20 mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - 21 - 22 # CHANNEL - 23 add = gr.add_ff() - 24 noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - 25 - 26 # RX - 27 metrics = trellis.metrics_f(f.O(),dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - 28 va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. - 29 fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - 30 dst = gr.check_lfsr_32k_s(); - 31 - 32 tb.connect (src,src_head,s2fsmi,enc,mod) - 33 tb.connect (mod,(add,0)) - 34 tb.connect (noise,(add,1)) - 35 tb.connect (add,metrics) - 36 tb.connect (metrics,va,fsmi2s,dst) - 37 - 38 tb.run() - 39 - 40 # A bit of cheating: run the program once and print the - 41 # final encoder state. - 42 # Then put it as the last argument in the viterbi block - 43 #print "final state = " , enc.ST() - 44 - 45 ntotal = dst.ntotal () - 46 nright = dst.nright () - 47 runlength = dst.runlength () - 48 return (ntotal,ntotal-nright) - 49 - 50 - 51 def main(args): - 52 nargs = len (args) - 53 if nargs == 3: - 54 fname=args[0] - 55 esn0_db=float(args[1]) # Es/No in dB - 56 rep=int(args[2]) # number of times the experiment is run to collect enough errors - 57 else: - 58 sys.stderr.write ('usage: test_tcm.py fsm_fname Es/No_db repetitions\n') - 59 sys.exit (1) - 60 - 61 # system parameters - 62 f=trellis.fsm(fname) # get the FSM specification from a file - 63 Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - 64 bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - 65 K=Kb/bitspersymbol # packet size in trellis steps - 66 modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations - 67 dimensionality = modulation[0] - 68 constellation = modulation[1] - 69 if len(constellation)/dimensionality != f.O(): - 70 sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - 71 sys.exit (1) - 72 # calculate average symbol energy - 73 Es = 0 - 74 for i in range(len(constellation)): - 75 Es = Es + constellation[i]**2 - 76 Es = Es / (len(constellation)/dimensionality) - 77 N0=Es/pow(10.0,esn0_db/10.0); # noise variance - 78 - 79 tot_s=0 - 80 terr_s=0 - 81 for i in range(rep): - 82 (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - 83 tot_s=tot_s+s - 84 terr_s=terr_s+e - 85 if (i%100==0): - 86 print i,s,e,tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s) - 87 # estimate of the (short) error rate - 88 print tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s) - 89 - 90 - 91 if __name__ == '__main__': - 92 main (sys.argv[1:]) -</programlisting> diff --git a/gr-trellis/doc/test_viterbi_equalization1.py b/gr-trellis/doc/test_viterbi_equalization1.py deleted file mode 100755 index 5967384cf..000000000 --- a/gr-trellis/doc/test_viterbi_equalization1.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import audio -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - -def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,seed): - tb = gr.top_block () - L = len(channel) - - # TX - # this for loop is TOO slow in python!!! - packet = [0]*(K+2*L) - random.seed(seed) - for i in range(len(packet)): - packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols - for i in range(L): # first/last L symbols set to 0 - packet[i] = 0 - packet[len(packet)-i-1] = 0 - src = gr.vector_source_s(packet,False) - mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) - - # CHANNEL - isi = gr.fir_filter_fff(1,channel) - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols - #metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - #va = trellis.viterbi_s(f,K+L,0,0) # Put -1 if the Initial/Final states are not set. - va = trellis.viterbi_combined_s(f,K+L,0,0,dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # using viterbi_combined_s instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application... - dst = gr.vector_sink_s() - - tb.connect (src,mod) - tb.connect (mod,isi,(add,0)) - tb.connect (noise,(add,1)) - #tb.connect (add,metrics) - #tb.connect (metrics,va,dst) - tb.connect (add,skip,va,dst) - - tb.run() - - data = dst.data() - ntotal = len(data) - L - nright=0 - for i in range(ntotal): - if packet[i+L]==data[i]: - nright=nright+1 - #else: - #print "Error in ", i - - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 2: - esn0_db=float(args[0]) - rep=int(args[1]) - else: - sys.stderr.write ('usage: test_viterbi_equalization1.py Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=2048 # packet size in bits - modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - f=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - - tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - dimensionality = tot_channel[0] - tot_constellation = tot_channel[1] - N0=pow(10.0,-esn0_db/10.0); # noise variance - if len(tot_constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - sys.exit (1) - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,-long(666+i)) # run experiment with different seed to get different data and noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or symbol) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/doc/test_viterbi_equalization1.py.xml b/gr-trellis/doc/test_viterbi_equalization1.py.xml deleted file mode 100644 index 27605870e..000000000 --- a/gr-trellis/doc/test_viterbi_equalization1.py.xml +++ /dev/null @@ -1,105 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<programlisting> - 1 #!/usr/bin/env python - 2 - 3 from gnuradio import gr - 4 from gnuradio import audio - 5 from gnuradio import trellis - 6 from gnuradio import eng_notation - 7 import math - 8 import sys - 9 import random - 10 import fsm_utils - 11 - 12 def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,seed): - 13 tb = gr.top_block () - 14 L = len(channel) - 15 - 16 # TX - 17 # this for loop is TOO slow in python!!! - 18 packet = [0]*(K+2*L) - 19 random.seed(seed) - 20 for i in range(len(packet)): - 21 packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols - 22 for i in range(L): # first/last L symbols set to 0 - 23 packet[i] = 0 - 24 packet[len(packet)-i-1] = 0 - 25 src = gr.vector_source_s(packet,False) - 26 mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) - 27 - 28 # CHANNEL - 29 isi = gr.fir_filter_fff(1,channel) - 30 add = gr.add_ff() - 31 noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - 32 - 33 # RX - 34 skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols - 35 #metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - 36 #va = trellis.viterbi_s(f,K+L,0,0) # Put -1 if the Initial/Final states are not set. - 37 va = trellis.viterbi_combined_s(f,K+L,0,0,dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # using viterbi_combined_s instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application... - 38 dst = gr.vector_sink_s() - 39 - 40 tb.connect (src,mod) - 41 tb.connect (mod,isi,(add,0)) - 42 tb.connect (noise,(add,1)) - 43 #tb.connect (add,metrics) - 44 #tb.connect (metrics,va,dst) - 45 tb.connect (add,skip,va,dst) - 46 - 47 tb.run() - 48 - 49 data = dst.data() - 50 ntotal = len(data) - L - 51 nright=0 - 52 for i in range(ntotal): - 53 if packet[i+L]==data[i]: - 54 nright=nright+1 - 55 #else: - 56 #print "Error in ", i - 57 - 58 return (ntotal,ntotal-nright) - 59 - 60 - 61 def main(args): - 62 nargs = len (args) - 63 if nargs == 2: - 64 esn0_db=float(args[0]) - 65 rep=int(args[1]) - 66 else: - 67 sys.stderr.write ('usage: test_viterbi_equalization1.py Es/No_db repetitions\n') - 68 sys.exit (1) - 69 - 70 # system parameters - 71 Kb=2048 # packet size in bits - 72 modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - 73 channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - 74 f=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - 75 bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - 76 K=Kb/bitspersymbol # packet size in trellis steps - 77 - 78 tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - 79 dimensionality = tot_channel[0] - 80 tot_constellation = tot_channel[1] - 81 N0=pow(10.0,-esn0_db/10.0); # noise variance - 82 if len(tot_constellation)/dimensionality != f.O(): - 83 sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - 84 sys.exit (1) - 85 - 86 tot_s=0 # total number of transmitted shorts - 87 terr_s=0 # total number of shorts in error - 88 terr_p=0 # total number of packets in error - 89 - 90 for i in range(rep): - 91 (s,e)=run_test(f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,-long(666+i)) # run experiment with different seed to get different data and noise realizations - 92 tot_s=tot_s+s - 93 terr_s=terr_s+e - 94 terr_p=terr_p+(terr_s!=0) - 95 if ((i+1)%100==0) : # display progress - 96 print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - 97 # estimate of the (short or symbol) error rate - 98 print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - 99 -100 -101 if __name__ == '__main__': -102 main (sys.argv[1:]) -</programlisting> diff --git a/gr-trellis/gnuradio-trellis.pc.in b/gr-trellis/gnuradio-trellis.pc.in deleted file mode 100644 index 618667c42..000000000 --- a/gr-trellis/gnuradio-trellis.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-trellis -Description: GNU Radio blocks for trellis coded modulation -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-trellis -Cflags: -I${includedir} diff --git a/gr-trellis/grc/CMakeLists.txt b/gr-trellis/grc/CMakeLists.txt deleted file mode 100644 index d60d64872..000000000 --- a/gr-trellis/grc/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2011 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. - -install(FILES - trellis_encoder_xx.xml - trellis_siso_combined_f.xml - trellis_viterbi_x.xml - trellis_metrics_x.xml - trellis_siso_f.xml - trellis_permutation.xml - trellis_viterbi_combined_xx.xml - trellis_sccc_encoder_xx.xml - trellis_sccc_decoder_x.xml - trellis_sccc_decoder_combined_xx.xml - trellis_pccc_encoder_xx.xml - trellis_pccc_decoder_x.xml - trellis_pccc_decoder_combined_xx.xml - DESTINATION ${GRC_BLOCKS_DIR} - COMPONENT "trellis_python" -) diff --git a/gr-trellis/grc/trellis_encoder_xx.xml b/gr-trellis/grc/trellis_encoder_xx.xml deleted file mode 100644 index 639e948ec..000000000 --- a/gr-trellis/grc/trellis_encoder_xx.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Trellis Encoder -################################################### - --> - -<block> - <name>Trellis Encoder</name> - <key>trellis_encoder_xx</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis</import> - <make>trellis.encoder_$(type)(trellis.fsm($fsm_args), $init_state)</make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Byte->Byte</name> - <key>bb</key> - <opt>input:byte</opt> - <opt>output:byte</opt> - </option> - <option> - <name>Byte->Short</name> - <key>bs</key> - <opt>input:byte</opt> - <opt>output:short</opt> - </option> - <option> - <name>Byte->Int</name> - <key>bi</key> - <opt>input:byte</opt> - <opt>output:int</opt> - </option> - <option> - <name>Short->Short</name> - <key>ss</key> - <opt>input:short</opt> - <opt>output:short</opt> - </option> - <option> - <name>Short->Int</name> - <key>si</key> - <opt>input:short</opt> - <opt>output:int</opt> - </option> - <option> - <name>Int->Int</name> - <key>ii</key> - <opt>input:int</opt> - <opt>output:int</opt> - </option> - </param> - <param> - <name>FSM Args</name> - <key>fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Initial State</name> - <key>init_state</key> - <value>0</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>$type.input</type> - </sink> - <source> - <name>out</name> - <type>$type.output</type> - </source> - <doc> -The fsm arguments are passed directly to the trellis.fsm() constructor. - </doc> -</block> diff --git a/gr-trellis/grc/trellis_metrics_x.xml b/gr-trellis/grc/trellis_metrics_x.xml deleted file mode 100644 index 0bc349514..000000000 --- a/gr-trellis/grc/trellis_metrics_x.xml +++ /dev/null @@ -1,88 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Trellis Metrics -################################################### - --> - - -<block> - <name>Trellis Metrics</name> - <key>trellis_metrics_x</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis, digital</import> - <make>trellis.metrics_$(type)($card, $dim, $table, $metric_type)</make> - <callback>set_TABLE($table)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>c</key> - <opt>io:complex</opt> - <opt>table:complex_vector</opt> - </option> - <option> - <name>Float</name> - <key>f</key> - <opt>io:float</opt> - <opt>table:real_vector</opt> - </option> - <option> - <name>Int</name> - <key>i</key> - <opt>io:int</opt> - <opt>table:int_vector</opt> - </option> - <option> - <name>Short</name> - <key>s</key> - <opt>io:short</opt> - <opt>table:int_vector</opt> - </option> - </param> - <param> - <name>Output Cardinality</name> - <key>card</key> - <type>int</type> - </param> - <param> - <name>Dimensionality</name> - <key>dim</key> - <type>int</type> - </param> - <param> - <name>Constellation</name> - <key>table</key> - <type>$type.table</type> - </param> - <param> - <name>Metric Type</name> - <key>metric_type</key> - <type>enum</type> - <option> - <name>Euclidean</name> - <key>digital.TRELLIS_EUCLIDEAN</key> - </option> - <option> - <name>Hard Symbol</name> - <key>digital.TRELLIS_HARD_SYMBOL</key> - </option> - <option> - <name>Hard Bit</name> - <key>digital.TRELLIS_HARD_BIT</key> - </option> - </param> - <sink> - <name>in</name> - <type>$type.io</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> - <doc> -Generate metrics required for Viterbi or SISO algorithms. - </doc> -</block> diff --git a/gr-trellis/grc/trellis_pccc_decoder_combined_xx.xml b/gr-trellis/grc/trellis_pccc_decoder_combined_xx.xml deleted file mode 100644 index 005a88d66..000000000 --- a/gr-trellis/grc/trellis_pccc_decoder_combined_xx.xml +++ /dev/null @@ -1,170 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## PCCC Decoder Combined -################################################### - --> - - -<block> - <name>PCCC Decoder Combo</name> - <key>trellis_pccc_decoder_combined_xx</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis, digital</import> - <make>trellis.pccc_decoder_combined_$(type)$(out_type)( - trellis.fsm($o_fsm_args), $o_init_state, $o_final_state, - trellis.fsm($i_fsm_args), $i_init_state, $i_final_state, - trellis.interleaver($interleaver), - $block_size, - $iterations, - $siso_type, - $dim, $table, $metric_type, - $scaling) - </make> - <callback>set_TABLE($table)</callback> - <param> - <name>Input Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>c</key> - <opt>io:complex</opt> - <opt>table:complex_vector</opt> - </option> - <option> - <name>Float</name> - <key>f</key> - <opt>io:float</opt> - <opt>table:real_vector</opt> - </option> - </param> - <param> - <name>Output Type</name> - <key>out_type</key> - <type>enum</type> - <option> - <name>Int</name> - <key>i</key> - <opt>io:int</opt> - </option> - <option> - <name>Short</name> - <key>s</key> - <opt>io:short</opt> - </option> - <option> - <name>Byte</name> - <key>b</key> - <opt>io:byte</opt> - </option> - </param> - <param> - <name>FSM 1</name> - <key>o_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Initial State 1</name> - <key>o_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Final State 1</name> - <key>o_final_state</key> - <value>-1</value> - <type>int</type> - </param> - <param> - <name>FSM 2</name> - <key>i_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Initial State 2</name> - <key>i_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Final State 2</name> - <key>i_final_state</key> - <value>-1</value> - <type>int</type> - </param> - <param> - <name>Interleaver</name> - <key>interleaver</key> - <type>raw</type> - </param> - <param> - <name>Block Size</name> - <key>block_size</key> - <type>int</type> - </param> - <param> - <name>Iterations</name> - <key>iterations</key> - <value>10</value> - <type>int</type> - </param> - <param> - <name>Dimensionality</name> - <key>dim</key> - <type>int</type> - </param> - <param> - <name>Constellation</name> - <key>table</key> - <type>$type.table</type> - </param> - <param> - <name>Metric Type</name> - <key>metric_type</key> - <type>enum</type> - <option> - <name>Euclidean</name> - <key>digital.TRELLIS_EUCLIDEAN</key> - </option> - <option> - <name>Hard Symbol</name> - <key>digital.TRELLIS_HARD_SYMBOL</key> - </option> - <option> - <name>Hard Bit</name> - <key>digital.TRELLIS_HARD_BIT</key> - </option> - </param> - <param> - <name>SISO Type</name> - <key>siso_type</key> - <type>enum</type> - <option> - <name>Min Sum</name> - <key>trellis.TRELLIS_MIN_SUM</key> - </option> - <option> - <name>Sum Product</name> - <key>trellis.TRELLIS_SUM_PRODUCT</key> - </option> - </param> - <param> - <name>Scaling</name> - <key>scaling</key> - <value>1.0</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>$type.io</type> - </sink> - <source> - <name>out</name> - <type>$out_type.io</type> - </source> - <doc> -PCCC turbo Decoder combined with metric calculation. -The fsm arguments are passed directly to the trellis.fsm() constructor. - </doc> -</block> diff --git a/gr-trellis/grc/trellis_pccc_decoder_x.xml b/gr-trellis/grc/trellis_pccc_decoder_x.xml deleted file mode 100644 index c79447826..000000000 --- a/gr-trellis/grc/trellis_pccc_decoder_x.xml +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## PCCC Decoder -################################################### - --> - - -<block> - <name>PCCC Decoder</name> - <key>trellis_pccc_decoder_x</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis</import> - <make>trellis.pccc_decoder_$(out_type)( - trellis.fsm($o_fsm_args), $o_init_state, $o_final_state, - trellis.fsm($i_fsm_args), $i_init_state, $i_final_state, - trellis.interleaver($interleaver), - $block_size, - $iterations, - $siso_type) - </make> - <param> - <name>Output Type</name> - <key>out_type</key> - <type>enum</type> - <option> - <name>Int</name> - <key>i</key> - <opt>io:int</opt> - </option> - <option> - <name>Short</name> - <key>s</key> - <opt>io:short</opt> - </option> - <option> - <name>Byte</name> - <key>b</key> - <opt>io:byte</opt> - </option> - </param> - <param> - <name>FSM 1</name> - <key>o_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Initial State 1</name> - <key>o_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Final State 1</name> - <key>o_final_state</key> - <value>-1</value> - <type>int</type> - </param> - <param> - <name>FSM 2</name> - <key>i_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Initial State 2</name> - <key>i_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Final State 2</name> - <key>i_final_state</key> - <value>-1</value> - <type>int</type> - </param> - <param> - <name>Interleaver</name> - <key>interleaver</key> - <type>raw</type> - </param> - <param> - <name>Block Size</name> - <key>block_size</key> - <type>int</type> - </param> - <param> - <name>Iterations</name> - <key>iterations</key> - <value>10</value> - <type>int</type> - </param> - <param> - <name>SISO Type</name> - <key>siso_type</key> - <type>enum</type> - <option> - <name>Min Sum</name> - <key>trellis.TRELLIS_MIN_SUM</key> - </option> - <option> - <name>Sum Product</name> - <key>trellis.TRELLIS_SUM_PRODUCT</key> - </option> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>$out_type.io</type> - </source> - <doc> -PCCC turbo Decoder. -The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors. - </doc> -</block> diff --git a/gr-trellis/grc/trellis_pccc_encoder_xx.xml b/gr-trellis/grc/trellis_pccc_encoder_xx.xml deleted file mode 100644 index 6774f18d2..000000000 --- a/gr-trellis/grc/trellis_pccc_encoder_xx.xml +++ /dev/null @@ -1,98 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## PCCC Encoder -################################################### - --> - -<block> - <name>PCCC Encoder</name> - <key>trellis_pccc_encoder_xx</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis</import> - <make>trellis.pccc_encoder_$(type)(trellis.fsm($o_fsm_args), $o_init_state, trellis.fsm($i_fsm_args), $i_init_state, trellis.interleaver($interleaver_args), $bl)</make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Byte->Byte</name> - <key>bb</key> - <opt>input:byte</opt> - <opt>output:byte</opt> - </option> - <option> - <name>Byte->Short</name> - <key>bs</key> - <opt>input:byte</opt> - <opt>output:short</opt> - </option> - <option> - <name>Byte->Int</name> - <key>bi</key> - <opt>input:byte</opt> - <opt>output:int</opt> - </option> - <option> - <name>Short->Short</name> - <key>ss</key> - <opt>input:short</opt> - <opt>output:short</opt> - </option> - <option> - <name>Short->Int</name> - <key>si</key> - <opt>input:short</opt> - <opt>output:int</opt> - </option> - <option> - <name>Int->Int</name> - <key>ii</key> - <opt>input:int</opt> - <opt>output:int</opt> - </option> - </param> - <param> - <name>FSM 1</name> - <key>o_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Initial State 1</name> - <key>o_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>FSM 2</name> - <key>i_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Initial State 2</name> - <key>i_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Interleaver</name> - <key>interleaver_args</key> - <type>raw</type> - </param> - <param> - <name>Blocklength</name> - <key>bl</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>$type.input</type> - </sink> - <source> - <name>out</name> - <type>$type.output</type> - </source> - <doc> -The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors. - </doc> -</block> diff --git a/gr-trellis/grc/trellis_permutation.xml b/gr-trellis/grc/trellis_permutation.xml deleted file mode 100644 index 212693311..000000000 --- a/gr-trellis/grc/trellis_permutation.xml +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Trellis Permutation -################################################### - --> - - -<block> - <name>Trellis Permutation</name> - <key>trellis_permutation</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis</import> - <make>trellis.permutation($interleaver_size, $table, $syms_per_block, $type.size*$vlen)</make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Interleaver Size</name> - <key>interleaver_size</key> - <type>int</type> - </param> - <param> - <name>Table</name> - <key>table</key> - <type>int_vector</type> - </param> - <param> - <name>Symbols per Block</name> - <key>syms_per_block</key> - <type>int</type> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>$type</type> - <vlen>$vlen</vlen> - </sink> - <source> - <name>out</name> - <type>$type</type> - <vlen>$vlen</vlen> - </source> - <doc> -Interleaver size is given in blocks. -One Symbol = (in/out type) * (vector length) - </doc> -</block> diff --git a/gr-trellis/grc/trellis_sccc_decoder_combined_xx.xml b/gr-trellis/grc/trellis_sccc_decoder_combined_xx.xml deleted file mode 100644 index 324f06e7f..000000000 --- a/gr-trellis/grc/trellis_sccc_decoder_combined_xx.xml +++ /dev/null @@ -1,170 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## SCCC Decoder Combined -################################################### - --> - - -<block> - <name>SCCC Decoder Combo</name> - <key>trellis_sccc_decoder_combined_xx</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis, digital</import> - <make>trellis.sccc_decoder_combined_$(type)$(out_type)( - trellis.fsm($o_fsm_args), $o_init_state, $o_final_state, - trellis.fsm($i_fsm_args), $i_init_state, $i_final_state, - trellis.interleaver($interleaver), - $block_size, - $iterations, - $siso_type, - $dim, $table, $metric_type, - $scaling) - </make> - <callback>set_TABLE($table)</callback> - <param> - <name>Input Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>c</key> - <opt>io:complex</opt> - <opt>table:complex_vector</opt> - </option> - <option> - <name>Float</name> - <key>f</key> - <opt>io:float</opt> - <opt>table:real_vector</opt> - </option> - </param> - <param> - <name>Output Type</name> - <key>out_type</key> - <type>enum</type> - <option> - <name>Int</name> - <key>i</key> - <opt>io:int</opt> - </option> - <option> - <name>Short</name> - <key>s</key> - <opt>io:short</opt> - </option> - <option> - <name>Byte</name> - <key>b</key> - <opt>io:byte</opt> - </option> - </param> - <param> - <name>Outer FSM</name> - <key>o_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Outer Initial State</name> - <key>o_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Outer Final State</name> - <key>o_final_state</key> - <value>-1</value> - <type>int</type> - </param> - <param> - <name>Inner FSM</name> - <key>i_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Inner Initial State</name> - <key>i_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Inner Final State</name> - <key>i_final_state</key> - <value>-1</value> - <type>int</type> - </param> - <param> - <name>Interleaver</name> - <key>interleaver</key> - <type>raw</type> - </param> - <param> - <name>Block Size</name> - <key>block_size</key> - <type>int</type> - </param> - <param> - <name>Iterations</name> - <key>iterations</key> - <value>10</value> - <type>int</type> - </param> - <param> - <name>Dimensionality</name> - <key>dim</key> - <type>int</type> - </param> - <param> - <name>Constellation</name> - <key>table</key> - <type>$type.table</type> - </param> - <param> - <name>Metric Type</name> - <key>metric_type</key> - <type>enum</type> - <option> - <name>Euclidean</name> - <key>digital.TRELLIS_EUCLIDEAN</key> - </option> - <option> - <name>Hard Symbol</name> - <key>digital.TRELLIS_HARD_SYMBOL</key> - </option> - <option> - <name>Hard Bit</name> - <key>digital.TRELLIS_HARD_BIT</key> - </option> - </param> - <param> - <name>SISO Type</name> - <key>siso_type</key> - <type>enum</type> - <option> - <name>Min Sum</name> - <key>trellis.TRELLIS_MIN_SUM</key> - </option> - <option> - <name>Sum Product</name> - <key>trellis.TRELLIS_SUM_PRODUCT</key> - </option> - </param> - <param> - <name>Scaling</name> - <key>scaling</key> - <value>1.0</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>$type.io</type> - </sink> - <source> - <name>out</name> - <type>$out_type.io</type> - </source> - <doc> -SCCC turbo Decoder combined with metric calculation. -The fsm arguments are passed directly to the trellis.fsm() constructor. - </doc> -</block> diff --git a/gr-trellis/grc/trellis_sccc_decoder_x.xml b/gr-trellis/grc/trellis_sccc_decoder_x.xml deleted file mode 100644 index 4bf8d26d5..000000000 --- a/gr-trellis/grc/trellis_sccc_decoder_x.xml +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## SCCC Decoder -################################################### - --> - - -<block> - <name>SCCC Decoder</name> - <key>trellis_sccc_decoder_x</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis</import> - <make>trellis.sccc_decoder_$(out_type)( - trellis.fsm($o_fsm_args), $o_init_state, $o_final_state, - trellis.fsm($i_fsm_args), $i_init_state, $i_final_state, - trellis.interleaver($interleaver), - $block_size, - $iterations, - $siso_type) - </make> - <param> - <name>Output Type</name> - <key>out_type</key> - <type>enum</type> - <option> - <name>Int</name> - <key>i</key> - <opt>io:int</opt> - </option> - <option> - <name>Short</name> - <key>s</key> - <opt>io:short</opt> - </option> - <option> - <name>Byte</name> - <key>b</key> - <opt>io:byte</opt> - </option> - </param> - <param> - <name>Outer FSM</name> - <key>o_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Outer Initial State</name> - <key>o_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Outer Final State</name> - <key>o_final_state</key> - <value>-1</value> - <type>int</type> - </param> - <param> - <name>Inner FSM</name> - <key>i_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Inner Initial State</name> - <key>i_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Inner Final State</name> - <key>i_final_state</key> - <value>-1</value> - <type>int</type> - </param> - <param> - <name>Interleaver</name> - <key>interleaver</key> - <type>raw</type> - </param> - <param> - <name>Block Size</name> - <key>block_size</key> - <type>int</type> - </param> - <param> - <name>Iterations</name> - <key>iterations</key> - <value>10</value> - <type>int</type> - </param> - <param> - <name>SISO Type</name> - <key>siso_type</key> - <type>enum</type> - <option> - <name>Min Sum</name> - <key>trellis.TRELLIS_MIN_SUM</key> - </option> - <option> - <name>Sum Product</name> - <key>trellis.TRELLIS_SUM_PRODUCT</key> - </option> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>$out_type.io</type> - </source> - <doc> -SCCC turbo Decoder. -The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors. - </doc> -</block> diff --git a/gr-trellis/grc/trellis_sccc_encoder_xx.xml b/gr-trellis/grc/trellis_sccc_encoder_xx.xml deleted file mode 100644 index 54d9c1e01..000000000 --- a/gr-trellis/grc/trellis_sccc_encoder_xx.xml +++ /dev/null @@ -1,98 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##SCCC Encoder -################################################### - --> - -<block> - <name>SCCC Encoder</name> - <key>trellis_sccc_encoder_xx</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis</import> - <make>trellis.sccc_encoder_$(type)(trellis.fsm($o_fsm_args), $o_init_state, trellis.fsm($i_fsm_args), $i_init_state, trellis.interleaver($interleaver_args), $bl)</make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Byte->Byte</name> - <key>bb</key> - <opt>input:byte</opt> - <opt>output:byte</opt> - </option> - <option> - <name>Byte->Short</name> - <key>bs</key> - <opt>input:byte</opt> - <opt>output:short</opt> - </option> - <option> - <name>Byte->Int</name> - <key>bi</key> - <opt>input:byte</opt> - <opt>output:int</opt> - </option> - <option> - <name>Short->Short</name> - <key>ss</key> - <opt>input:short</opt> - <opt>output:short</opt> - </option> - <option> - <name>Short->Int</name> - <key>si</key> - <opt>input:short</opt> - <opt>output:int</opt> - </option> - <option> - <name>Int->Int</name> - <key>ii</key> - <opt>input:int</opt> - <opt>output:int</opt> - </option> - </param> - <param> - <name>Outer FSM</name> - <key>o_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Outer Initial State</name> - <key>o_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Inner FSM</name> - <key>i_fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Inner Initial State</name> - <key>i_init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Interleaver</name> - <key>interleaver_args</key> - <type>raw</type> - </param> - <param> - <name>Blocklength</name> - <key>bl</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>$type.input</type> - </sink> - <source> - <name>out</name> - <type>$type.output</type> - </source> - <doc> -The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors. - </doc> -</block> diff --git a/gr-trellis/grc/trellis_siso_combined_f.xml b/gr-trellis/grc/trellis_siso_combined_f.xml deleted file mode 100644 index a39986a86..000000000 --- a/gr-trellis/grc/trellis_siso_combined_f.xml +++ /dev/null @@ -1,115 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Trellis SISO Combined -################################################### - --> - - -<block> - <name>SISO Combo</name> - <key>trellis_siso_combined_f</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis</import> - <make>trellis.siso_combined_f(trellis.fsm($fsm_args), $block_size, $init_state, $final_state, $a_post_in, $a_post_out, $siso_type, $dim, $table, $metric_type)</make> - <param> - <name>FSM Args</name> - <key>fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Block Size</name> - <key>block_size</key> - <type>int</type> - </param> - <param> - <name>Initial State</name> - <key>init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Final State</name> - <key>final_state</key> - <value>-1</value> - <type>int</type> - </param> - <param> - <name>A-posteriori In</name> - <key>a_post_in</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>A-posteriori Out</name> - <key>a_post_out</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>SISO Type</name> - <key>siso_type</key> - <type>enum</type> - <option> - <name>Min Sum</name> - <key>trellis.TRELLIS_MIN_SUM</key> - </option> - <option> - <name>Sum Product</name> - <key>trellis.TRELLIS_SUM_PRODUCT</key> - </option> - </param> - <param> - <name>Dimensionality</name> - <key>dim</key> - <type>int</type> - </param> - <param> - <name>Constellation</name> - <key>table</key> - <type>real_vector</type> - </param> - <param> - <name>Metric Type</name> - <key>metric_type</key> - <type>enum</type> - <option> - <name>Euclidean</name> - <key>trellis.TRELLIS_EUCLIDEAN</key> - </option> - <option> - <name>Hard Symbol</name> - <key>trellis.TRELLIS_HARD_SYMBOL</key> - </option> - <option> - <name>Hard Bit</name> - <key>trellis.TRELLIS_HARD_BIT</key> - </option> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> - <doc> -BCJR Algorithm combined with metric calculation. \ -The fsm arguments are passed directly to the trellis.fsm() constructor. - </doc> -</block> diff --git a/gr-trellis/grc/trellis_siso_f.xml b/gr-trellis/grc/trellis_siso_f.xml deleted file mode 100644 index e3fb502b3..000000000 --- a/gr-trellis/grc/trellis_siso_f.xml +++ /dev/null @@ -1,88 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Trellis SISO -################################################### - --> - - -<block> - <name>SISO</name> - <key>trellis_siso_f</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis</import> - <make>trellis.siso_f(trellis.fsm($fsm_args), $block_size, $init_state, $final_state, $a_post_in, $a_post_out, $siso_type)</make> - <param> - <name>FSM Args</name> - <key>fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Block Size</name> - <key>block_size</key> - <type>int</type> - </param> - <param> - <name>Initial State</name> - <key>init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Final State</name> - <key>final_state</key> - <value>-1</value> - <type>int</type> - </param> - <param> - <name>A-posteriori In</name> - <key>a_post_in</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>A-posteriori Out</name> - <key>a_post_out</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>SISO Type</name> - <key>siso_type</key> - <type>enum</type> - <option> - <name>Min Sum</name> - <key>trellis.TRELLIS_MIN_SUM</key> - </option> - <option> - <name>Sum Product</name> - <key>trellis.TRELLIS_SUM_PRODUCT</key> - </option> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> - <doc> -BCJR Algorithm. \ -The fsm arguments are passed directly to the trellis.fsm() constructor. - </doc> -</block> diff --git a/gr-trellis/grc/trellis_viterbi_combined_xx.xml b/gr-trellis/grc/trellis_viterbi_combined_xx.xml deleted file mode 100644 index 85128714c..000000000 --- a/gr-trellis/grc/trellis_viterbi_combined_xx.xml +++ /dev/null @@ -1,126 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Trellis Viterbi Combined -################################################### - --> - - -<block> - <name>Viterbi Combo</name> - <key>trellis_viterbi_combined_xx</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis, digital</import> - <make>trellis.viterbi_combined_$(type)$(out_type)(trellis.fsm($fsm_args), $block_size, $init_state, $final_state, $dim, $table, $metric_type)</make> - <callback>set_TABLE($table)</callback> - <param> - <name>Input Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>c</key> - <opt>io:complex</opt> - <opt>table:complex_vector</opt> - </option> - <option> - <name>Float</name> - <key>f</key> - <opt>io:float</opt> - <opt>table:real_vector</opt> - </option> - <option> - <name>Int</name> - <key>i</key> - <opt>io:int</opt> - <opt>table:int_vector</opt> - </option> - <option> - <name>Short</name> - <key>s</key> - <opt>io:short</opt> - <opt>table:int_vector</opt> - </option> - </param> - <param> - <name>Output Type</name> - <key>out_type</key> - <type>enum</type> - <option> - <name>Int</name> - <key>i</key> - <opt>io:int</opt> - </option> - <option> - <name>Short</name> - <key>s</key> - <opt>io:short</opt> - </option> - <option> - <name>Byte</name> - <key>b</key> - <opt>io:byte</opt> - </option> - </param> - <param> - <name>FSM Args</name> - <key>fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Block Size</name> - <key>block_size</key> - <type>int</type> - </param> - <param> - <name>Initial State</name> - <key>init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Final State</name> - <key>final_state</key> - <value>-1</value> - <type>int</type> - </param> - <param> - <name>Dimensionality</name> - <key>dim</key> - <type>int</type> - </param> - <param> - <name>Constellation</name> - <key>table</key> - <type>$type.table</type> - </param> - <param> - <name>Metric Type</name> - <key>metric_type</key> - <type>enum</type> - <option> - <name>Euclidean</name> - <key>digital.TRELLIS_EUCLIDEAN</key> - </option> - <option> - <name>Hard Symbol</name> - <key>digital.TRELLIS_HARD_SYMBOL</key> - </option> - <option> - <name>Hard Bit</name> - <key>digital.TRELLIS_HARD_BIT</key> - </option> - </param> - <sink> - <name>in</name> - <type>$type.io</type> - </sink> - <source> - <name>out</name> - <type>$out_type.io</type> - </source> - <doc> -Viterbi Decoder combined with metric calculation. \ -The fsm arguments are passed directly to the trellis.fsm() constructor. - </doc> -</block> diff --git a/gr-trellis/grc/trellis_viterbi_x.xml b/gr-trellis/grc/trellis_viterbi_x.xml deleted file mode 100644 index d97e6707a..000000000 --- a/gr-trellis/grc/trellis_viterbi_x.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Trellis Viterbi -################################################### - --> - - -<block> - <name>Viterbi</name> - <key>trellis_viterbi_x</key> - <category>Error Correction/Trellis</category> - <import>from gnuradio import trellis</import> - <make>trellis.viterbi_$(type)(trellis.fsm($fsm_args), $block_size, $init_state, $final_state)</make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Int</name> - <key>i</key> - <opt>io:int</opt> - </option> - <option> - <name>Short</name> - <key>s</key> - <opt>io:short</opt> - </option> - <option> - <name>Byte</name> - <key>b</key> - <opt>io:byte</opt> - </option> - </param> - <param> - <name>FSM Args</name> - <key>fsm_args</key> - <type>raw</type> - </param> - <param> - <name>Block Size</name> - <key>block_size</key> - <type>int</type> - </param> - <param> - <name>Initial State</name> - <key>init_state</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Final State</name> - <key>final_state</key> - <value>-1</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>$type.io</type> - </source> - <doc> -Viterbi Decoder. \ -The fsm arguments are passed directly to the trellis.fsm() constructor. - </doc> -</block> diff --git a/gr-trellis/src/examples/grc/CMakeLists.txt b/gr-trellis/src/examples/grc/CMakeLists.txt deleted file mode 100644 index 46b825d88..000000000 --- a/gr-trellis/src/examples/grc/CMakeLists.txt +++ /dev/null @@ -1,30 +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. - -install( - FILES - interference_cancellation.grc - pccc1.grc - pccc.grc - sccc1.grc - sccc.grc - readme.txt - DESTINATION ${GR_PKG_TRELLIS_EXAMPLES_DIR} - COMPONENT "trellis-examples" -) diff --git a/gr-trellis/src/examples/grc/interference_cancellation.grc b/gr-trellis/src/examples/grc/interference_cancellation.grc deleted file mode 100644 index 7674b4bf1..000000000 --- a/gr-trellis/src/examples/grc/interference_cancellation.grc +++ /dev/null @@ -1,2177 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Wed Aug 31 17:40:25 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>int_cancellation</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Superposition Coding</value> - </param> - <param> - <key>author</key> - <value>AA</value> - </param> - <param> - <key>description</key> - <value>gnuradio flow graph</value> - </param> - <param> - <key>window_size</key> - <value>2048, 2048</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>P1/P</value> - </param> - <param> - <key>value</key> - <value>0.6</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1.0</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(243, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>snr_db</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>P/sigma^2 (dB)</value> - </param> - <param> - <key>value</key> - <value>16</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>20</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(447, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>noisevar</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10**(-snr_db/10)</value> - </param> - <param> - <key>_coordinate</key> - <value>(637, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(21, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>alpha**0.5</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(988, 196)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(25, 291)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(660, 311)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>(1-alpha)**0.5</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(994, 319)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1224, 244)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(1146, 369)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(536, 529)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(771, 525)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(994, 545)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_3</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(535, 792)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(785, 779)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(1005, 798)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(405, 998)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>alpha**0.5</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(710, 1008)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(944, 978)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(540, 1141)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(796, 1136)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(1009, 1156)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(420, 1368)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>(1-alpha)**0.5</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(733, 1374)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(975, 1342)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(559, 1536)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(771, 1530)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(1010, 1551)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_encoder_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>init_state</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(336, 311)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_viterbi_combined_xx</key> - <param> - <key>id</key> - <value>trellis_viterbi_combined_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>c</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>block_size</key> - <value>1000</value> - </param> - <param> - <key>init_state</key> - <value>-1</value> - </param> - <param> - <key>final_state</key> - <value>-1</value> - </param> - <param> - <key>dim</key> - <value>1</value> - </param> - <param> - <key>table</key> - <value>alpha**0.5*1,alpha**0.5*1j,alpha**0.5*(-1j),alpha**0.5*(-1)</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(79, 501)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_viterbi_combined_xx</key> - <param> - <key>id</key> - <value>trellis_viterbi_combined_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>c</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>block_size</key> - <value>1000</value> - </param> - <param> - <key>init_state</key> - <value>-1</value> - </param> - <param> - <key>final_state</key> - <value>-1</value> - </param> - <param> - <key>dim</key> - <value>1</value> - </param> - <param> - <key>table</key> - <value>(1-alpha)**0.5*1,(1-alpha)**0.5*1j,(1-alpha)**0.5*(-1j),(1-alpha)**0.5*(-1)</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(82, 766)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_encoder_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>init_state</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(89, 998)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_viterbi_combined_xx</key> - <param> - <key>id</key> - <value>trellis_viterbi_combined_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>c</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>block_size</key> - <value>1000</value> - </param> - <param> - <key>init_state</key> - <value>-1</value> - </param> - <param> - <key>final_state</key> - <value>-1</value> - </param> - <param> - <key>dim</key> - <value>1</value> - </param> - <param> - <key>table</key> - <value>(1-alpha)**0.5*1,(1-alpha)**0.5*1j,(1-alpha)**0.5*(-1j),(1-alpha)**0.5*(-1)</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(83, 1111)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_encoder_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>init_state</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(105, 1367)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_viterbi_combined_xx</key> - <param> - <key>id</key> - <value>trellis_viterbi_combined_xx_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>c</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>block_size</key> - <value>1000</value> - </param> - <param> - <key>init_state</key> - <value>-1</value> - </param> - <param> - <key>final_state</key> - <value>-1</value> - </param> - <param> - <key>dim</key> - <value>1</value> - </param> - <param> - <key>table</key> - <value>alpha**0.5*1,alpha**0.5*1j,alpha**0.5*(-1j),alpha**0.5*(-1)</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(75, 1495)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1400, 262)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(1533, 149)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>prefix</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> - </param> - <param> - <key>_coordinate</key> - <value>(871, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_encoder_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>init_state</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(340, 187)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(534, 149)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(682, 186)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>R</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(748, 12)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER 1 (raw)</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>0,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1267, 410)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER 2 (raw)</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>0,1,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1260, 659)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER 2 (after cancelling user 1)</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,1,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1262, 1020)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER 1 (after cancelling user 2)</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1269, 1417)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>random_source_x_1</source_block_id> - <sink_block_id>trellis_encoder_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_encoder_xx_1</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>gr_add_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_1</source_block_id> - <sink_block_id>gr_multiply_const_vxx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_1</source_block_id> - <sink_block_id>gr_add_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_0</source_block_id> - <sink_block_id>gr_short_to_float_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_0</source_block_id> - <sink_block_id>wxgui_numbersink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2</source_block_id> - <sink_block_id>gr_short_to_float_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>trellis_encoder_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_viterbi_combined_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_1</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_0</source_block_id> - <sink_block_id>gr_sub_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_1</source_block_id> - <sink_block_id>gr_sub_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_1</source_block_id> - <sink_block_id>gr_multiply_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_1</source_block_id> - <sink_block_id>gr_multiply_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_2</source_block_id> - <sink_block_id>trellis_viterbi_combined_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>gr_sub_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_encoder_xx_2</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_2</source_block_id> - <sink_block_id>gr_multiply_const_vxx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_2</source_block_id> - <sink_block_id>gr_sub_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_1</source_block_id> - <sink_block_id>trellis_encoder_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_1</source_block_id> - <sink_block_id>gr_short_to_float_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_2</source_block_id> - <sink_block_id>wxgui_numbersink2_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_2</source_block_id> - <sink_block_id>gr_sub_xx_3</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_3</source_block_id> - <sink_block_id>gr_multiply_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_3</source_block_id> - <sink_block_id>gr_multiply_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_viterbi_combined_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_1</source_block_id> - <sink_block_id>gr_sub_xx_3</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1</source_block_id> - <sink_block_id>wxgui_numbersink2_3</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_encoder_xx_2_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_2_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_2</source_block_id> - <sink_block_id>trellis_encoder_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2_0</source_block_id> - <sink_block_id>gr_short_to_float_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_0_0</source_block_id> - <sink_block_id>gr_sub_xx_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_1_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_1_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_2_0</source_block_id> - <sink_block_id>trellis_viterbi_combined_xx_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1_0</source_block_id> - <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>gr_sub_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_2_0</source_block_id> - <sink_block_id>gr_sub_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-trellis/src/examples/grc/pccc.grc b/gr-trellis/src/examples/grc/pccc.grc deleted file mode 100644 index c3111c321..000000000 --- a/gr-trellis/src/examples/grc/pccc.grc +++ /dev/null @@ -1,832 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Sep 1 12:53:13 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>sccc1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Serially Concatenated Convolutional Code</value> - </param> - <param> - <key>author</key> - <value>AA</value> - </param> - <param> - <key>description</key> - <value>gnuradio flow graph</value> - </param> - <param> - <key>window_size</key> - <value>2048, 2048</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>noisevar</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10**(-snr_db/10)</value> - </param> - <param> - <key>_coordinate</key> - <value>(389, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>prefix</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> - </param> - <param> - <key>_coordinate</key> - <value>(590, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>block</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1000</value> - </param> - <param> - <key>_coordinate</key> - <value>(764, 16)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>snr_db</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>SNR (dB)</value> - </param> - <param> - <key>value</key> - <value>5</value> - </param> - <param> - <key>min</key> - <value>-10</value> - </param> - <param> - <key>max</key> - <value>10</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(229, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(392, 591)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(535, 609)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(713, 426)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 290)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(952, 73)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(21, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(517, 103)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>float</value> - </param> - <param> - <key>symbol_table</key> - <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> - </param> - <param> - <key>dimension</key> - <value>2</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(551, 184)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_pccc_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_pccc_encoder_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>interleaver_args</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>bl</key> - <value>block</value> - </param> - <param> - <key>_coordinate</key> - <value>(236, 147)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>R</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(482, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(951, 256)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_pccc_decoder_combined_xx</key> - <param> - <key>id</key> - <value>trellis_pccc_decoder_combined_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>f</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>o_final_state</key> - <value>-1</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>i_final_state</key> - <value>-1</value> - </param> - <param> - <key>interleaver</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>block_size</key> - <value>block</value> - </param> - <param> - <key>iterations</key> - <value>10</value> - </param> - <param> - <key>dim</key> - <value>2</value> - </param> - <param> - <key>table</key> - <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>siso_type</key> - <value>trellis.TRELLIS_MIN_SUM</value> - </param> - <param> - <key>scaling</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(196, 274)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(217, 597)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2_0</source_block_id> - <sink_block_id>gr_short_to_float_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1_0</source_block_id> - <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>trellis_pccc_encoder_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_pccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_pccc_decoder_combined_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_pccc_decoder_combined_xx_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> -</flow_graph> diff --git a/gr-trellis/src/examples/grc/pccc1.grc b/gr-trellis/src/examples/grc/pccc1.grc deleted file mode 100644 index 15a63707e..000000000 --- a/gr-trellis/src/examples/grc/pccc1.grc +++ /dev/null @@ -1,857 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Wed Aug 31 20:34:39 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>sccc1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Serially Concatenated Convolutional Code</value> - </param> - <param> - <key>author</key> - <value>AA</value> - </param> - <param> - <key>description</key> - <value>gnuradio flow graph</value> - </param> - <param> - <key>window_size</key> - <value>2048, 2048</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>noisevar</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10**(-snr_db/10)</value> - </param> - <param> - <key>_coordinate</key> - <value>(389, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>prefix</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> - </param> - <param> - <key>_coordinate</key> - <value>(590, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>block</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1000</value> - </param> - <param> - <key>_coordinate</key> - <value>(764, 16)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>snr_db</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>SNR (dB)</value> - </param> - <param> - <key>value</key> - <value>5</value> - </param> - <param> - <key>min</key> - <value>-10</value> - </param> - <param> - <key>max</key> - <value>10</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(229, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(392, 591)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(535, 609)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(713, 426)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 290)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(951, 256)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(952, 73)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(21, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(517, 103)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(217, 597)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>float</value> - </param> - <param> - <key>symbol_table</key> - <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> - </param> - <param> - <key>dimension</key> - <value>2</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(551, 184)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_pccc_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_pccc_encoder_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>interleaver_args</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>bl</key> - <value>block</value> - </param> - <param> - <key>_coordinate</key> - <value>(236, 147)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_pccc_decoder_x</key> - <param> - <key>id</key> - <value>trellis_pccc_decoder_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>o_final_state</key> - <value>-1</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>i_final_state</key> - <value>-1</value> - </param> - <param> - <key>interleaver</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>block_size</key> - <value>block</value> - </param> - <param> - <key>iterations</key> - <value>10</value> - </param> - <param> - <key>siso_type</key> - <value>trellis.TRELLIS_MIN_SUM</value> - </param> - <param> - <key>_coordinate</key> - <value>(357, 304)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_metrics_x</key> - <param> - <key>id</key> - <value>trellis_metrics_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>f</value> - </param> - <param> - <key>card</key> - <value>16</value> - </param> - <param> - <key>dim</key> - <value>2</value> - </param> - <param> - <key>table</key> - <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(58, 354)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>R</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(482, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2_0</source_block_id> - <sink_block_id>gr_short_to_float_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1_0</source_block_id> - <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_metrics_x_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>trellis_pccc_encoder_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_pccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_metrics_x_0</source_block_id> - <sink_block_id>trellis_pccc_decoder_x_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_pccc_decoder_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> -</flow_graph> diff --git a/gr-trellis/src/examples/grc/readme.txt b/gr-trellis/src/examples/grc/readme.txt deleted file mode 100644 index a5261ac0b..000000000 --- a/gr-trellis/src/examples/grc/readme.txt +++ /dev/null @@ -1,32 +0,0 @@ -These are examples of using gr-trellis in grc. - -INTERFERENCE CANCELLATION -------------------------- -Two users are transmitting simultaneously using convolutionally encoded QPSK, each with power P1=alpha*P and P2=(1-alpha)*P. -The combined signal is observed in noise and four different receivers are considered: -1) A viterbi decoder decoding user 1 assuming user 2 is noise -2) A viterbi decoder decoding user 2 assuming user 1 is noise -3) A viterbi decoder decoding user 1 first - and then reencoding this signal, subtracting it from the observation - and then running a Viterbi decoder decoding user 2 -4) A viterbi decoder decoding user 2 first - and then reencoding this signal, subtracting it from the observation - and then running a Viterbi decoder decoding user 1 - -You can change the signal to noise ratio P/sigma^2 and the allocation of power to the two users, alpha. - - -Serially Concatenated Convolutional Codes ------------------------------------------ -An SCCC can be defined by an outer and an inner FSM together with an interleaver -and a modulation type. You can change the SNR and observe the estimated BER. -In sccc.grc the decoding and metric calculation are combined; in sccc1.grc they are separate. - -Parallel Concatenated Convolutional Codes ------------------------------------------ -A PCCC can be defined by two FSMs together with an interleaver -and a modulation type. You can change the SNR and observe the estimated BER. -In pccc1.grc the decoding and metric calculation are separate. - - -Enjoy. diff --git a/gr-trellis/src/examples/grc/sccc.grc b/gr-trellis/src/examples/grc/sccc.grc deleted file mode 100644 index e8f656f63..000000000 --- a/gr-trellis/src/examples/grc/sccc.grc +++ /dev/null @@ -1,832 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Wed Aug 31 19:57:09 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>sccc</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Serially Concatenated Convolutional Code</value> - </param> - <param> - <key>author</key> - <value>AA</value> - </param> - <param> - <key>description</key> - <value>gnuradio flow graph</value> - </param> - <param> - <key>window_size</key> - <value>2048, 2048</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>noisevar</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10**(-snr_db/10)</value> - </param> - <param> - <key>_coordinate</key> - <value>(389, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(21, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>prefix</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> - </param> - <param> - <key>_coordinate</key> - <value>(590, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>block</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1000</value> - </param> - <param> - <key>_coordinate</key> - <value>(764, 16)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(951, 256)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(445, 517)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(228.25, 798.39170361874085)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(416, 815)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>snr_db</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>SNR (dB)</value> - </param> - <param> - <key>value</key> - <value>5</value> - </param> - <param> - <key>min</key> - <value>-10</value> - </param> - <param> - <key>max</key> - <value>10</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(229, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>R</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(482, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(952, 73)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(514, 105)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,0,1j,0,-1j,0,-1,0, 0,1,0,1j,0,-1j,0,-1</value> - </param> - <param> - <key>dimension</key> - <value>2</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(551, 184)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 290)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_sccc_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_sccc_encoder_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>interleaver_args</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>bl</key> - <value>block</value> - </param> - <param> - <key>_coordinate</key> - <value>(242, 154)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(688, 572)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_sccc_decoder_combined_xx</key> - <param> - <key>id</key> - <value>trellis_sccc_decoder_combined_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>c</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>o_final_state</key> - <value>-1</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>i_final_state</key> - <value>-1</value> - </param> - <param> - <key>interleaver</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>block_size</key> - <value>block</value> - </param> - <param> - <key>iterations</key> - <value>5</value> - </param> - <param> - <key>dim</key> - <value>2</value> - </param> - <param> - <key>table</key> - <value>1,0,1j,0,-1j,0,-1,0, 0,1,0,1j,0,-1j,0,-1</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>siso_type</key> - <value>trellis.TRELLIS_SUM_PRODUCT</value> - </param> - <param> - <key>scaling</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(159, 335)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>trellis_sccc_encoder_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_sccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_sccc_decoder_combined_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_sccc_decoder_combined_xx_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2_0</source_block_id> - <sink_block_id>gr_short_to_float_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1_0</source_block_id> - <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> -</flow_graph> diff --git a/gr-trellis/src/examples/grc/sccc1.grc b/gr-trellis/src/examples/grc/sccc1.grc deleted file mode 100644 index 0be59d0c4..000000000 --- a/gr-trellis/src/examples/grc/sccc1.grc +++ /dev/null @@ -1,857 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Wed Aug 31 20:09:23 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>sccc1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Serially Concatenated Convolutional Code</value> - </param> - <param> - <key>author</key> - <value>AA</value> - </param> - <param> - <key>description</key> - <value>gnuradio flow graph</value> - </param> - <param> - <key>window_size</key> - <value>2048, 2048</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>noisevar</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10**(-snr_db/10)</value> - </param> - <param> - <key>_coordinate</key> - <value>(389, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(21, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>prefix</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> - </param> - <param> - <key>_coordinate</key> - <value>(590, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>block</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1000</value> - </param> - <param> - <key>_coordinate</key> - <value>(764, 16)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>snr_db</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>SNR (dB)</value> - </param> - <param> - <key>value</key> - <value>5</value> - </param> - <param> - <key>min</key> - <value>-10</value> - </param> - <param> - <key>max</key> - <value>10</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(229, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>R</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(482, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_sccc_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_sccc_encoder_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>interleaver_args</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>bl</key> - <value>block</value> - </param> - <param> - <key>_coordinate</key> - <value>(242, 154)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_sccc_decoder_x</key> - <param> - <key>id</key> - <value>trellis_sccc_decoder_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>o_final_state</key> - <value>-1</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>i_final_state</key> - <value>-1</value> - </param> - <param> - <key>interleaver</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>block_size</key> - <value>block</value> - </param> - <param> - <key>iterations</key> - <value>10</value> - </param> - <param> - <key>siso_type</key> - <value>trellis.TRELLIS_MIN_SUM</value> - </param> - <param> - <key>_coordinate</key> - <value>(333, 305)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(217, 597)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(392, 591)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(535, 609)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(713, 426)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 290)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(951, 256)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_metrics_x</key> - <param> - <key>id</key> - <value>trellis_metrics_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>f</value> - </param> - <param> - <key>card</key> - <value>8</value> - </param> - <param> - <key>dim</key> - <value>1</value> - </param> - <param> - <key>table</key> - <value>-7, -5, -3, -1, 1, 3, 5, 7</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(58, 354)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(517, 103)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(952, 73)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>float</value> - </param> - <param> - <key>symbol_table</key> - <value>-7, -5, -3, -1, 1, 3, 5, 7</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(551, 184)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>trellis_sccc_encoder_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_sccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2_0</source_block_id> - <sink_block_id>gr_short_to_float_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1_0</source_block_id> - <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_metrics_x_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_metrics_x_0</source_block_id> - <sink_block_id>trellis_sccc_decoder_x_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_sccc_decoder_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> -</flow_graph> diff --git a/gr-trellis/src/examples/python/CMakeLists.txt b/gr-trellis/src/examples/python/CMakeLists.txt deleted file mode 100644 index e2c7e70ff..000000000 --- a/gr-trellis/src/examples/python/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2011 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. - -include(GrPython) - -GR_PYTHON_INSTALL( - PROGRAMS - fsm_utils.py - test_tcm.py - test_tcm_parallel.py - test_tcm_combined.py - test_sccc_hard.py - test_sccc_soft.py - test_sccc_turbo.py - test_viterbi_equalization1.py - test_viterbi_equalization.py - test_turbo_equalization.py - test_turbo_equalization1.py - test_turbo_equalization2.py - DESTINATION ${GR_PKG_TRELLIS_EXAMPLES_DIR} - COMPONENT "trellis_examples" -) - -install( - FILES README - DESTINATION ${GR_PKG_DATA_DIR}/examples/trellis - COMPONENT "trellis_examples" -) - -install( - FILES - fsm_files/awgn1o2_128.fsm - fsm_files/awgn1o2_16.fsm - fsm_files/awgn1o2_4.fsm - fsm_files/awgn1o2_8.fsm - fsm_files/awgn2o3_16.fsm - fsm_files/awgn2o3_4.fsm - fsm_files/awgn2o3_4_msb.fsm - fsm_files/awgn2o3_4_msbG.fsm - fsm_files/awgn2o3_8.fsm - fsm_files/awgn2o4_4.fsm - fsm_files/disconnected.fsm - fsm_files/rep3.fsm - fsm_files/rep5.fsm - fsm_files/simple.fsm - DESTINATION ${GR_PKG_TRELLIS_EXAMPLES_DIR}/fsm_files - COMPONENT "trellis_examples" -) diff --git a/gr-trellis/src/examples/python/README b/gr-trellis/src/examples/python/README deleted file mode 100644 index d51f231ac..000000000 --- a/gr-trellis/src/examples/python/README +++ /dev/null @@ -1,35 +0,0 @@ -Here we have several test programs for use with the gr-trellis implementation. -Documentation can be found in -http://gnuradio.utah.edu/svn/gnuradio/trunk/gr-trellis/doc/gr-trellis.html - -fsm_utils.py contains several useful functions. - -fsm_files is a directory with some FSM definitions - -If you just want to see what these programs do run them; -in your terminal you will see something like this: - -$ ./test_tcm.py --esn0 6.0 --repetitions 1000 -100 98 9.80e-01 102400 9 8.79e-05 -200 198 9.90e-01 204800 20 9.77e-05 -300 298 9.93e-01 307200 40 1.30e-04 -400 398 9.95e-01 409600 1074 2.62e-03 -500 498 9.96e-01 512000 1081 2.11e-03 -600 598 9.97e-01 614400 1090 1.77e-03 -700 698 9.97e-01 716800 1097 1.53e-03 -800 798 9.98e-01 819200 1107 1.35e-03 -900 898 9.98e-01 921600 1120 1.22e-03 -1000 998 9.98e-01 1024000 1129 1.10e-03 -1000 998 9.98e-01 1024000 1129 1.10e-03 - -which gives you information about the: -number of transmitted packets -number of packets in error -estimated packet error rate -number of transmitted shorts (or symbols, or bits, depending on the specific program) -number of shorts (or symbols, or bits) in error -estimated short (or symbol, or bit) error rate - -for instance, the final number 1.10e-03 is the error rate estimate by sending 1000 -packets of 1024 shorts each, using an 1/2 4-state convolutional code -and QPSK modulation through an AWGN with Es/N0 = 6.0 dB diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_128.fsm b/gr-trellis/src/examples/python/fsm_files/awgn1o2_128.fsm deleted file mode 100644 index 4b47007c5..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_128.fsm +++ /dev/null @@ -1,265 +0,0 @@ -2 128 4 - -0 64 -0 64 -1 65 -1 65 -2 66 -2 66 -3 67 -3 67 -4 68 -4 68 -5 69 -5 69 -6 70 -6 70 -7 71 -7 71 -8 72 -8 72 -9 73 -9 73 -10 74 -10 74 -11 75 -11 75 -12 76 -12 76 -13 77 -13 77 -14 78 -14 78 -15 79 -15 79 -16 80 -16 80 -17 81 -17 81 -18 82 -18 82 -19 83 -19 83 -20 84 -20 84 -21 85 -21 85 -22 86 -22 86 -23 87 -23 87 -24 88 -24 88 -25 89 -25 89 -26 90 -26 90 -27 91 -27 91 -28 92 -28 92 -29 93 -29 93 -30 94 -30 94 -31 95 -31 95 -32 96 -32 96 -33 97 -33 97 -34 98 -34 98 -35 99 -35 99 -36 100 -36 100 -37 101 -37 101 -38 102 -38 102 -39 103 -39 103 -40 104 -40 104 -41 105 -41 105 -42 106 -42 106 -43 107 -43 107 -44 108 -44 108 -45 109 -45 109 -46 110 -46 110 -47 111 -47 111 -48 112 -48 112 -49 113 -49 113 -50 114 -50 114 -51 115 -51 115 -52 116 -52 116 -53 117 -53 117 -54 118 -54 118 -55 119 -55 119 -56 120 -56 120 -57 121 -57 121 -58 122 -58 122 -59 123 -59 123 -60 124 -60 124 -61 125 -61 125 -62 126 -62 126 -63 127 -63 127 - -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -3 0 -0 3 -2 1 -1 2 -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 -0 3 -3 0 -1 2 -2 1 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -3 0 -0 3 -2 1 -1 2 -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 -0 3 -3 0 -1 2 -2 1 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 - - - -GM1o2_128=[1+D+D^2+D^5+D^7 1+D^3+D^4+D^5+D^6+D^7] - =[11100101 10011111] - =[229 159] diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_16.fsm b/gr-trellis/src/examples/python/fsm_files/awgn1o2_16.fsm deleted file mode 100644 index cdab41359..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_16.fsm +++ /dev/null @@ -1,39 +0,0 @@ -2 16 4 - -0 8 -0 8 -1 9 -1 9 -2 10 -2 10 -3 11 -3 11 -4 12 -4 12 -5 13 -5 13 -6 14 -6 14 -7 15 -7 15 - -0 3 -3 0 -1 2 -2 1 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -3 0 -0 3 -2 1 -1 2 - - - -GM1o2_16=[1+D+D^4 1+D^2+D^3+D^4 ] = [25,23] (decimal) diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_4.fsm b/gr-trellis/src/examples/python/fsm_files/awgn1o2_4.fsm deleted file mode 100644 index fb316b5ef..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_4.fsm +++ /dev/null @@ -1,14 +0,0 @@ -2 4 4 - -0 2 -0 2 -1 3 -1 3 - -0 3 -3 0 -1 2 -2 1 - -AWGN CC from Proakis-Salehi pg 779 -GM1o2_4=[1+D^2, 1+D+D^2] = [5, 7] (in decimal); diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_8.fsm b/gr-trellis/src/examples/python/fsm_files/awgn1o2_8.fsm deleted file mode 100644 index 604bac6c2..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_8.fsm +++ /dev/null @@ -1,24 +0,0 @@ -2 8 4 - -0 4 -0 4 -1 5 -1 5 -2 6 -2 6 -3 7 -3 7 - - -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 - - -1/2 8-state code (Proakis pg. 493) -GM1o2_8=[ 1+D+D^3 1+D+D^2+D^3] =[13 , 15] (decimal) diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_16.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o3_16.fsm deleted file mode 100644 index 9630cd9af..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_16.fsm +++ /dev/null @@ -1,40 +0,0 @@ -4 16 8 - -0 8 4 12 -0 8 4 12 -0 8 4 12 -0 8 4 12 -1 9 5 13 -1 9 5 13 -1 9 5 13 -1 9 5 13 -2 10 6 14 -2 10 6 14 -2 10 6 14 -2 10 6 14 -3 11 7 15 -3 11 7 15 -3 11 7 15 -3 11 7 15 - -0 1 7 6 -6 7 1 0 -3 2 4 5 -5 4 2 3 -2 3 5 4 -4 5 3 2 -1 0 6 7 -7 6 0 1 -4 5 3 2 -2 3 5 4 -7 6 0 1 -1 0 6 7 -6 7 1 0 -0 1 7 6 -5 4 2 3 -3 2 4 5 - - -2/3 code generated from the awgn 1/2 code with 16 states and puncturing the 4th bit. -d_free= - diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o3_4.fsm deleted file mode 100644 index 3ac57be18..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4.fsm +++ /dev/null @@ -1,15 +0,0 @@ -4 4 8 - -0 1 2 3 -0 1 2 3 -0 1 2 3 -0 1 2 3 - -0 7 4 3 -3 4 7 0 -5 2 1 6 -6 1 2 5 - -I don't remeber how I generated this one... -it is a bit better than awgn2o3_4_msb and worse -than awgn2o3_4_msbG. diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msb.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msb.fsm deleted file mode 100644 index d834c5271..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msb.fsm +++ /dev/null @@ -1,46 +0,0 @@ -4 4 8 - -0 1 2 3 -0 1 2 3 -0 1 2 3 -0 1 2 3 - -0 5 3 6 -4 1 7 2 -7 2 4 1 -3 6 0 5 - - -This is generated by the 1/2 AWGN code (5 7) operated twice, ie, -(xk+1 xki) [xk-1 xk-2] -> [xk+1 xki]. -We also puncture the first (MSB) bit. -This code is worse than awgn2o3_4_msbG and slightly worse than -awgn2o3_4, BUT seems to be a good innner code for sctcm (with 8PSK natural). - -intermediate states: - -00 21 02 23 -00 21 02 23 -10 31 12 33 -10 31 12 33 - -output before puncturing: - -00 31 03 32 -30 01 33 02 -13 22 10 21 -23 12 20 11 - -output after punturing the MSB: - -00 11 03 12 -10 01 13 02 -13 02 10 01 -03 12 00 11 - -and in decimal: - -0 5 3 6 -4 1 7 2 -7 2 4 1 -3 6 0 5 diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msbG.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msbG.fsm deleted file mode 100644 index 8956c53da..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msbG.fsm +++ /dev/null @@ -1,60 +0,0 @@ -4 4 8 - -0 1 2 3 -0 1 2 3 -0 1 2 3 -0 1 2 3 - -0 4 2 6 -5 1 3 7 -3 7 5 1 - - -This is generated by the 1/2 AWGN code (5 7) operated twice, ie, -(xk+1 xki) [xk-1 xk-2] -> [xk+1 xki]. -We also puncture the first (MSB) bit and Gray map the symbols. - -intermediate states: - -00 21 02 23 -00 21 02 23 -10 31 12 33 -10 31 12 33 - -output before puncturing: - -00 31 03 32 -30 01 33 02 -13 22 10 21 -23 12 20 11 - -output after punturing the MSB: - -00 11 03 12 -10 01 13 02 -13 02 10 01 -03 12 00 11 - -and in decimal: - -0 5 3 6 -4 1 7 2 -7 2 4 1 -3 6 0 5 - -After Gray mapping: -label -> phase -0 -> 0 -1 -> 0 -2 -> 7 -3 -> 2 -4 -> 5 -5 -> 4 -6 -> 6 -7 -> 3 - -0 4 2 6 -5 1 3 7 -3 7 5 1 -2 6 0 4 - diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_8.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o3_8.fsm deleted file mode 100644 index 34deeb68c..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_8.fsm +++ /dev/null @@ -1,25 +0,0 @@ -4 8 8 - -0 4 2 6 -0 4 2 6 -0 4 2 6 -0 4 2 6 -1 5 3 7 -1 5 3 7 -1 5 3 7 -1 5 3 7 - - -0 1 7 6 -6 7 1 0 -3 2 4 5 -5 4 2 3 -6 7 1 0 -0 1 7 6 -5 4 2 3 -3 2 4 5 - - - -This is generated by the 1/2 8-state AWGN code (15 17) by puncturing the fourth bit. ---> d_free=??? diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o4_4.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o4_4.fsm deleted file mode 100644 index a895be896..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o4_4.fsm +++ /dev/null @@ -1,36 +0,0 @@ -4 4 16 - -0 1 2 3 -0 1 2 3 -0 1 2 3 -0 1 2 3 - - 0 13 3 14 -12 1 15 2 - 7 10 4 9 -11 6 8 5 - - -This is generated by the 1/2 AWGN code (5 7) operated twice, ie, -(xk+1 xki) [xk-1 xk-2] -> [xk+1 xki]. - -intermediate states: - -00 21 02 23 -00 21 02 23 -10 31 12 33 -10 31 12 33 - -output: - -00 31 03 32 -30 01 33 02 -13 22 10 21 -23 12 20 11 - -and in decimal: - - 0 13 3 14 -12 1 15 2 - 7 10 4 9 -11 6 8 5 diff --git a/gr-trellis/src/examples/python/fsm_files/disconnected.fsm b/gr-trellis/src/examples/python/fsm_files/disconnected.fsm deleted file mode 100644 index 847963e7b..000000000 --- a/gr-trellis/src/examples/python/fsm_files/disconnected.fsm +++ /dev/null @@ -1,11 +0,0 @@ -1 4 1 - -1 -0 -3 -2 - -0 -0 -0 -0 diff --git a/gr-trellis/src/examples/python/fsm_files/irregular.fsm b/gr-trellis/src/examples/python/fsm_files/irregular.fsm deleted file mode 100644 index 80b82b889..000000000 --- a/gr-trellis/src/examples/python/fsm_files/irregular.fsm +++ /dev/null @@ -1,11 +0,0 @@ -2 2 2 - -0 0 -0 1 - -0 1 -0 1 - - -useless irregular FSM for testing. state 0 has 3 incoming edges and state -1 has 1 incoming edge. diff --git a/gr-trellis/src/examples/python/fsm_files/joint_16_16.fsm b/gr-trellis/src/examples/python/fsm_files/joint_16_16.fsm deleted file mode 100644 index 293ff4e7c..000000000 --- a/gr-trellis/src/examples/python/fsm_files/joint_16_16.fsm +++ /dev/null @@ -1,523 +0,0 @@ -4 256 16 - -0 8 128 136 -0 8 128 136 -1 9 129 137 -1 9 129 137 -2 10 130 138 -2 10 130 138 -3 11 131 139 -3 11 131 139 -4 12 132 140 -4 12 132 140 -5 13 133 141 -5 13 133 141 -6 14 134 142 -6 14 134 142 -7 15 135 143 -7 15 135 143 -0 8 128 136 -0 8 128 136 -1 9 129 137 -1 9 129 137 -2 10 130 138 -2 10 130 138 -3 11 131 139 -3 11 131 139 -4 12 132 140 -4 12 132 140 -5 13 133 141 -5 13 133 141 -6 14 134 142 -6 14 134 142 -7 15 135 143 -7 15 135 143 -16 24 144 152 -16 24 144 152 -17 25 145 153 -17 25 145 153 -18 26 146 154 -18 26 146 154 -19 27 147 155 -19 27 147 155 -20 28 148 156 -20 28 148 156 -21 29 149 157 -21 29 149 157 -22 30 150 158 -22 30 150 158 -23 31 151 159 -23 31 151 159 -16 24 144 152 -16 24 144 152 -17 25 145 153 -17 25 145 153 -18 26 146 154 -18 26 146 154 -19 27 147 155 -19 27 147 155 -20 28 148 156 -20 28 148 156 -21 29 149 157 -21 29 149 157 -22 30 150 158 -22 30 150 158 -23 31 151 159 -23 31 151 159 -32 40 160 168 -32 40 160 168 -33 41 161 169 -33 41 161 169 -34 42 162 170 -34 42 162 170 -35 43 163 171 -35 43 163 171 -36 44 164 172 -36 44 164 172 -37 45 165 173 -37 45 165 173 -38 46 166 174 -38 46 166 174 -39 47 167 175 -39 47 167 175 -32 40 160 168 -32 40 160 168 -33 41 161 169 -33 41 161 169 -34 42 162 170 -34 42 162 170 -35 43 163 171 -35 43 163 171 -36 44 164 172 -36 44 164 172 -37 45 165 173 -37 45 165 173 -38 46 166 174 -38 46 166 174 -39 47 167 175 -39 47 167 175 -48 56 176 184 -48 56 176 184 -49 57 177 185 -49 57 177 185 -50 58 178 186 -50 58 178 186 -51 59 179 187 -51 59 179 187 -52 60 180 188 -52 60 180 188 -53 61 181 189 -53 61 181 189 -54 62 182 190 -54 62 182 190 -55 63 183 191 -55 63 183 191 -48 56 176 184 -48 56 176 184 -49 57 177 185 -49 57 177 185 -50 58 178 186 -50 58 178 186 -51 59 179 187 -51 59 179 187 -52 60 180 188 -52 60 180 188 -53 61 181 189 -53 61 181 189 -54 62 182 190 -54 62 182 190 -55 63 183 191 -55 63 183 191 -64 72 192 200 -64 72 192 200 -65 73 193 201 -65 73 193 201 -66 74 194 202 -66 74 194 202 -67 75 195 203 -67 75 195 203 -68 76 196 204 -68 76 196 204 -69 77 197 205 -69 77 197 205 -70 78 198 206 -70 78 198 206 -71 79 199 207 -71 79 199 207 -64 72 192 200 -64 72 192 200 -65 73 193 201 -65 73 193 201 -66 74 194 202 -66 74 194 202 -67 75 195 203 -67 75 195 203 -68 76 196 204 -68 76 196 204 -69 77 197 205 -69 77 197 205 -70 78 198 206 -70 78 198 206 -71 79 199 207 -71 79 199 207 -80 88 208 216 -80 88 208 216 -81 89 209 217 -81 89 209 217 -82 90 210 218 -82 90 210 218 -83 91 211 219 -83 91 211 219 -84 92 212 220 -84 92 212 220 -85 93 213 221 -85 93 213 221 -86 94 214 222 -86 94 214 222 -87 95 215 223 -87 95 215 223 -80 88 208 216 -80 88 208 216 -81 89 209 217 -81 89 209 217 -82 90 210 218 -82 90 210 218 -83 91 211 219 -83 91 211 219 -84 92 212 220 -84 92 212 220 -85 93 213 221 -85 93 213 221 -86 94 214 222 -86 94 214 222 -87 95 215 223 -87 95 215 223 -96 104 224 232 -96 104 224 232 -97 105 225 233 -97 105 225 233 -98 106 226 234 -98 106 226 234 -99 107 227 235 -99 107 227 235 -100 108 228 236 -100 108 228 236 -101 109 229 237 -101 109 229 237 -102 110 230 238 -102 110 230 238 -103 111 231 239 -103 111 231 239 -96 104 224 232 -96 104 224 232 -97 105 225 233 -97 105 225 233 -98 106 226 234 -98 106 226 234 -99 107 227 235 -99 107 227 235 -100 108 228 236 -100 108 228 236 -101 109 229 237 -101 109 229 237 -102 110 230 238 -102 110 230 238 -103 111 231 239 -103 111 231 239 -112 120 240 248 -112 120 240 248 -113 121 241 249 -113 121 241 249 -114 122 242 250 -114 122 242 250 -115 123 243 251 -115 123 243 251 -116 124 244 252 -116 124 244 252 -117 125 245 253 -117 125 245 253 -118 126 246 254 -118 126 246 254 -119 127 247 255 -119 127 247 255 -112 120 240 248 -112 120 240 248 -113 121 241 249 -113 121 241 249 -114 122 242 250 -114 122 242 250 -115 123 243 251 -115 123 243 251 -116 124 244 252 -116 124 244 252 -117 125 245 253 -117 125 245 253 -118 126 246 254 -118 126 246 254 -119 127 247 255 -119 127 247 255 - -0 3 12 15 -3 0 15 12 -1 2 13 14 -2 1 14 13 -1 2 13 14 -2 1 14 13 -0 3 12 15 -3 0 15 12 -2 1 14 13 -1 2 13 14 -3 0 15 12 -0 3 12 15 -3 0 15 12 -0 3 12 15 -2 1 14 13 -1 2 13 14 -12 15 0 3 -15 12 3 0 -13 14 1 2 -14 13 2 1 -13 14 1 2 -14 13 2 1 -12 15 0 3 -15 12 3 0 -14 13 2 1 -13 14 1 2 -15 12 3 0 -12 15 0 3 -15 12 3 0 -12 15 0 3 -14 13 2 1 -13 14 1 2 -4 7 8 11 -7 4 11 8 -5 6 9 10 -6 5 10 9 -5 6 9 10 -6 5 10 9 -4 7 8 11 -7 4 11 8 -6 5 10 9 -5 6 9 10 -7 4 11 8 -4 7 8 11 -7 4 11 8 -4 7 8 11 -6 5 10 9 -5 6 9 10 -8 11 4 7 -11 8 7 4 -9 10 5 6 -10 9 6 5 -9 10 5 6 -10 9 6 5 -8 11 4 7 -11 8 7 4 -10 9 6 5 -9 10 5 6 -11 8 7 4 -8 11 4 7 -11 8 7 4 -8 11 4 7 -10 9 6 5 -9 10 5 6 -4 7 8 11 -7 4 11 8 -5 6 9 10 -6 5 10 9 -5 6 9 10 -6 5 10 9 -4 7 8 11 -7 4 11 8 -6 5 10 9 -5 6 9 10 -7 4 11 8 -4 7 8 11 -7 4 11 8 -4 7 8 11 -6 5 10 9 -5 6 9 10 -8 11 4 7 -11 8 7 4 -9 10 5 6 -10 9 6 5 -9 10 5 6 -10 9 6 5 -8 11 4 7 -11 8 7 4 -10 9 6 5 -9 10 5 6 -11 8 7 4 -8 11 4 7 -11 8 7 4 -8 11 4 7 -10 9 6 5 -9 10 5 6 -0 3 12 15 -3 0 15 12 -1 2 13 14 -2 1 14 13 -1 2 13 14 -2 1 14 13 -0 3 12 15 -3 0 15 12 -2 1 14 13 -1 2 13 14 -3 0 15 12 -0 3 12 15 -3 0 15 12 -0 3 12 15 -2 1 14 13 -1 2 13 14 -12 15 0 3 -15 12 3 0 -13 14 1 2 -14 13 2 1 -13 14 1 2 -14 13 2 1 -12 15 0 3 -15 12 3 0 -14 13 2 1 -13 14 1 2 -15 12 3 0 -12 15 0 3 -15 12 3 0 -12 15 0 3 -14 13 2 1 -13 14 1 2 -8 11 4 7 -11 8 7 4 -9 10 5 6 -10 9 6 5 -9 10 5 6 -10 9 6 5 -8 11 4 7 -11 8 7 4 -10 9 6 5 -9 10 5 6 -11 8 7 4 -8 11 4 7 -11 8 7 4 -8 11 4 7 -10 9 6 5 -9 10 5 6 -4 7 8 11 -7 4 11 8 -5 6 9 10 -6 5 10 9 -5 6 9 10 -6 5 10 9 -4 7 8 11 -7 4 11 8 -6 5 10 9 -5 6 9 10 -7 4 11 8 -4 7 8 11 -7 4 11 8 -4 7 8 11 -6 5 10 9 -5 6 9 10 -12 15 0 3 -15 12 3 0 -13 14 1 2 -14 13 2 1 -13 14 1 2 -14 13 2 1 -12 15 0 3 -15 12 3 0 -14 13 2 1 -13 14 1 2 -15 12 3 0 -12 15 0 3 -15 12 3 0 -12 15 0 3 -14 13 2 1 -13 14 1 2 -0 3 12 15 -3 0 15 12 -1 2 13 14 -2 1 14 13 -1 2 13 14 -2 1 14 13 -0 3 12 15 -3 0 15 12 -2 1 14 13 -1 2 13 14 -3 0 15 12 -0 3 12 15 -3 0 15 12 -0 3 12 15 -2 1 14 13 -1 2 13 14 -12 15 0 3 -15 12 3 0 -13 14 1 2 -14 13 2 1 -13 14 1 2 -14 13 2 1 -12 15 0 3 -15 12 3 0 -14 13 2 1 -13 14 1 2 -15 12 3 0 -12 15 0 3 -15 12 3 0 -12 15 0 3 -14 13 2 1 -13 14 1 2 -0 3 12 15 -3 0 15 12 -1 2 13 14 -2 1 14 13 -1 2 13 14 -2 1 14 13 -0 3 12 15 -3 0 15 12 -2 1 14 13 -1 2 13 14 -3 0 15 12 -0 3 12 15 -3 0 15 12 -0 3 12 15 -2 1 14 13 -1 2 13 14 -8 11 4 7 -11 8 7 4 -9 10 5 6 -10 9 6 5 -9 10 5 6 -10 9 6 5 -8 11 4 7 -11 8 7 4 -10 9 6 5 -9 10 5 6 -11 8 7 4 -8 11 4 7 -11 8 7 4 -8 11 4 7 -10 9 6 5 -9 10 5 6 -4 7 8 11 -7 4 11 8 -5 6 9 10 -6 5 10 9 -5 6 9 10 -6 5 10 9 -4 7 8 11 -7 4 11 8 -6 5 10 9 -5 6 9 10 -7 4 11 8 -4 7 8 11 -7 4 11 8 -4 7 8 11 -6 5 10 9 -5 6 9 10 - -This is the joint trellis of two trellises described in awgn1o2_16.fsm -It is useful for application of joint decoding... -It can be generated in python as follows: -> import trellis -> f1=trellis.fsm('awgn1o2_16.fsm') -> f=trellis.fsm(f1,f1) -> f.write_fsm_txt('joint_16_16.fsm') diff --git a/gr-trellis/src/examples/python/fsm_files/joint_4_16.fsm b/gr-trellis/src/examples/python/fsm_files/joint_4_16.fsm deleted file mode 100644 index 427a18207..000000000 --- a/gr-trellis/src/examples/python/fsm_files/joint_4_16.fsm +++ /dev/null @@ -1,141 +0,0 @@ -4 64 16 - -0 8 32 40 -0 8 32 40 -1 9 33 41 -1 9 33 41 -2 10 34 42 -2 10 34 42 -3 11 35 43 -3 11 35 43 -4 12 36 44 -4 12 36 44 -5 13 37 45 -5 13 37 45 -6 14 38 46 -6 14 38 46 -7 15 39 47 -7 15 39 47 -0 8 32 40 -0 8 32 40 -1 9 33 41 -1 9 33 41 -2 10 34 42 -2 10 34 42 -3 11 35 43 -3 11 35 43 -4 12 36 44 -4 12 36 44 -5 13 37 45 -5 13 37 45 -6 14 38 46 -6 14 38 46 -7 15 39 47 -7 15 39 47 -16 24 48 56 -16 24 48 56 -17 25 49 57 -17 25 49 57 -18 26 50 58 -18 26 50 58 -19 27 51 59 -19 27 51 59 -20 28 52 60 -20 28 52 60 -21 29 53 61 -21 29 53 61 -22 30 54 62 -22 30 54 62 -23 31 55 63 -23 31 55 63 -16 24 48 56 -16 24 48 56 -17 25 49 57 -17 25 49 57 -18 26 50 58 -18 26 50 58 -19 27 51 59 -19 27 51 59 -20 28 52 60 -20 28 52 60 -21 29 53 61 -21 29 53 61 -22 30 54 62 -22 30 54 62 -23 31 55 63 -23 31 55 63 - -0 3 12 15 -3 0 15 12 -1 2 13 14 -2 1 14 13 -1 2 13 14 -2 1 14 13 -0 3 12 15 -3 0 15 12 -2 1 14 13 -1 2 13 14 -3 0 15 12 -0 3 12 15 -3 0 15 12 -0 3 12 15 -2 1 14 13 -1 2 13 14 -12 15 0 3 -15 12 3 0 -13 14 1 2 -14 13 2 1 -13 14 1 2 -14 13 2 1 -12 15 0 3 -15 12 3 0 -14 13 2 1 -13 14 1 2 -15 12 3 0 -12 15 0 3 -15 12 3 0 -12 15 0 3 -14 13 2 1 -13 14 1 2 -4 7 8 11 -7 4 11 8 -5 6 9 10 -6 5 10 9 -5 6 9 10 -6 5 10 9 -4 7 8 11 -7 4 11 8 -6 5 10 9 -5 6 9 10 -7 4 11 8 -4 7 8 11 -7 4 11 8 -4 7 8 11 -6 5 10 9 -5 6 9 10 -8 11 4 7 -11 8 7 4 -9 10 5 6 -10 9 6 5 -9 10 5 6 -10 9 6 5 -8 11 4 7 -11 8 7 4 -10 9 6 5 -9 10 5 6 -11 8 7 4 -8 11 4 7 -11 8 7 4 -8 11 4 7 -10 9 6 5 -9 10 5 6 - -This is the joint trellis of two trellises described in awgn1o2_4.fsm and awgn1o2_16.fsm -It is useful for application of joint decoding... -It can be generated in python as follows: -> import trellis -> f1=trellis.fsm('awgn1o2_4.fsm') -> f2=trellis.fsm('awgn1o2_16.fsm') -> f=trellis.fsm(f1,f2) -> f.write_fsm_txt('joint_4_16.fsm') - diff --git a/gr-trellis/src/examples/python/fsm_files/rep3.fsm b/gr-trellis/src/examples/python/fsm_files/rep3.fsm deleted file mode 100644 index ef1bd1f02..000000000 --- a/gr-trellis/src/examples/python/fsm_files/rep3.fsm +++ /dev/null @@ -1,8 +0,0 @@ -2 1 8 - -0 0 - -0 7 - -1/3 repetition code (with binary input). -There is only one state, since this is essentially a memoryless system. diff --git a/gr-trellis/src/examples/python/fsm_files/rep5.fsm b/gr-trellis/src/examples/python/fsm_files/rep5.fsm deleted file mode 100644 index 2aa5d77cf..000000000 --- a/gr-trellis/src/examples/python/fsm_files/rep5.fsm +++ /dev/null @@ -1,7 +0,0 @@ -2 1 32 - -0 0 - -0 31 - -1/5 repetition code diff --git a/gr-trellis/src/examples/python/fsm_files/simple.fsm b/gr-trellis/src/examples/python/fsm_files/simple.fsm deleted file mode 100644 index f27f6b4b0..000000000 --- a/gr-trellis/src/examples/python/fsm_files/simple.fsm +++ /dev/null @@ -1,13 +0,0 @@ -1 4 1 - -1 -2 -3 -0 - -0 -0 -0 -0 - -essentially this fsm has no inputs and no outputs; it just cycles through all 4 states. diff --git a/gr-trellis/src/examples/python/fsm_utils.py b/gr-trellis/src/examples/python/fsm_utils.py deleted file mode 100755 index 06855ea77..000000000 --- a/gr-trellis/src/examples/python/fsm_utils.py +++ /dev/null @@ -1,239 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004 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. -# - - -import re -import math -import sys -import operator -import numpy - -from gnuradio import trellis - -try: - import scipy.linalg -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - - - -###################################################################### -# Decimal to any base conversion. -# Convert 'num' to a list of 'l' numbers representing 'num' -# to base 'base' (most significant symbol first). -###################################################################### -def dec2base(num,base,l): - s=range(l) - n=num - for i in range(l): - s[l-i-1]=n%base - n=int(n/base) - if n!=0: - print 'Number ', num, ' requires more than ', l, 'digits.' - return s - - -###################################################################### -# Conversion from any base to decimal. -# Convert a list 's' of symbols to a decimal number -# (most significant symbol first) -###################################################################### -def base2dec(s,base): - num=0 - for i in range(len(s)): - num=num*base+s[i] - return num - - - - -###################################################################### -# Automatically generate the lookup table that maps the FSM outputs -# to channel inputs corresponding to a channel 'channel' and a modulation -# 'mod'. Optional normalization of channel to unit energy. -# This table is used by the 'metrics' block to translate -# channel outputs to metrics for use with the Viterbi algorithm. -# Limitations: currently supports only one-dimensional modulations. -###################################################################### -def make_isi_lookup(mod,channel,normalize): - dim=mod[0] - constellation = mod[1] - - if normalize: - p = 0 - for i in range(len(channel)): - p = p + channel[i]**2 - for i in range(len(channel)): - channel[i] = channel[i]/math.sqrt(p) - - lookup=range(len(constellation)**len(channel)) - for o in range(len(constellation)**len(channel)): - ss=dec2base(o,len(constellation),len(channel)) - ll=0 - for i in range(len(channel)): - ll=ll+constellation[ss[i]]*channel[i] - lookup[o]=ll - return (1,lookup) - - - - - - -###################################################################### -# Automatically generate the signals appropriate for CPM -# decomposition. -# This decomposition is based on the paper by B. Rimoldi -# "A decomposition approach to CPM", IEEE Trans. Info Theory, March 1988 -# See also my own notes at http://www.eecs.umich.edu/~anastas/docs/cpm.pdf -###################################################################### -def make_cpm_signals(K,P,M,L,q,frac): - - Q=numpy.size(q)/L - h=(1.0*K)/P - f0=-h*(M-1)/2 - dt=0.0; # maybe start at t=0.5 - t=(dt+numpy.arange(0,Q))/Q - qq=numpy.zeros(Q) - for m in range(L): - qq=qq + q[m*Q:m*Q+Q] - w=math.pi*h*(M-1)*t-2*math.pi*h*(M-1)*qq+math.pi*h*(L-1)*(M-1) - - X=(M**L)*P - PSI=numpy.empty((X,Q)) - for x in range(X): - xv=dec2base(x/P,M,L) - xv=numpy.append(xv, x%P) - qq1=numpy.zeros(Q) - for m in range(L): - qq1=qq1+xv[m]*q[m*Q:m*Q+Q] - psi=2*math.pi*h*xv[-1]+4*math.pi*h*qq1+w - #print psi - PSI[x]=psi - PSI = numpy.transpose(PSI) - SS=numpy.exp(1j*PSI) # contains all signals as columns - #print SS - - - # Now we need to orthogonalize the signals - F = scipy.linalg.orth(SS) # find an orthonormal basis for SS - #print numpy.dot(numpy.transpose(F.conjugate()),F) # check for orthonormality - S = numpy.dot(numpy.transpose(F.conjugate()),SS) - #print F - #print S - - # We only want to keep those dimensions that contain most - # of the energy of the overall constellation (eg, frac=0.9 ==> 90%) - # evaluate mean energy in each dimension - E=numpy.sum(numpy.absolute(S)**2,axis=1)/Q - E=E/numpy.sum(E) - #print E - Es = -numpy.sort(-E) - Esi = numpy.argsort(-E) - #print Es - #print Esi - Ecum=numpy.cumsum(Es) - #print Ecum - v0=numpy.searchsorted(Ecum,frac) - N = v0+1 - #print v0 - #print Esi[0:v0+1] - Ff=numpy.transpose(numpy.transpose(F)[Esi[0:v0+1]]) - #print Ff - Sf = S[Esi[0:v0+1]] - #print Sf - - - return (f0,SS,S,F,Sf,Ff,N) - #return f0 - - - - -###################################################################### -# A list of common modulations. -# Format: (dimensionality,constellation) -###################################################################### -pam2 = (1,[-1, 1]) -pam4 = (1,[-3, -1, 3, 1]) # includes Gray mapping -pam8 = (1,[-7, -5, -3, -1, 1, 3, 5, 7]) - -psk4=(2,[1, 0, \ - 0, 1, \ - 0, -1,\ - -1, 0]) # includes Gray mapping -psk8=(2,[math.cos(2*math.pi*0/8), math.sin(2*math.pi*0/8), \ - math.cos(2*math.pi*1/8), math.sin(2*math.pi*1/8), \ - math.cos(2*math.pi*2/8), math.sin(2*math.pi*2/8), \ - math.cos(2*math.pi*3/8), math.sin(2*math.pi*3/8), \ - math.cos(2*math.pi*4/8), math.sin(2*math.pi*4/8), \ - math.cos(2*math.pi*5/8), math.sin(2*math.pi*5/8), \ - math.cos(2*math.pi*6/8), math.sin(2*math.pi*6/8), \ - math.cos(2*math.pi*7/8), math.sin(2*math.pi*7/8)]) - -orth2 = (2,[1, 0, \ - 0, 1]) -orth4=(4,[1, 0, 0, 0, \ - 0, 1, 0, 0, \ - 0, 0, 1, 0, \ - 0, 0, 0, 1]) - -###################################################################### -# A list of channels to be tested -###################################################################### - -# C test channel (J. Proakis, Digital Communications, McGraw-Hill Inc., 2001) -c_channel = [0.227, 0.460, 0.688, 0.460, 0.227] - - - - - - - - - - -if __name__ == '__main__': - f1=trellis.fsm('fsm_files/awgn1o2_4.fsm') - #f2=trellis.fsm('fsm_files/awgn2o3_4.fsm') - #print f1.I(), f1.S(), f1.O() - #print f1.NS() - #print f1.OS() - #print f2.I(), f2.S(), f2.O() - #print f2.NS() - #print f2.OS() - ##f1.write_trellis_svg('f1.svg',4) - #f2.write_trellis_svg('f2.svg',4) - #f=fsm_concatenate(f1,f2) - #f=fsm_radix(f1,2) - - #print "----------\n" - #print f.I(), f.S(), f.O() - #print f.NS() - #print f.OS() - #f.write_trellis_svg('f.svg',4) - - q=numpy.arange(0,8)/(2.0*8) - (f0,SS,S,F,Sf,Ff,N) = make_cpm_signals(1,2,2,1,q,0.99) - diff --git a/gr-trellis/src/examples/python/test_cpm.py b/gr-trellis/src/examples/python/test_cpm.py deleted file mode 100755 index 5342e57e8..000000000 --- a/gr-trellis/src/examples/python/test_cpm.py +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: CPM test -# Author: Achilleas Anastasopoulos -# Description: gnuradio flow graph -# Generated: Thu Feb 19 23:16:23 2009 -################################################## - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio.gr import firdes -from grc_gnuradio import blks2 as grc_blks2 -import math -import numpy -import fsm_utils -from gnuradio import trellis - -try: - import scipy.stats -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -def run_test(seed,blocksize): - tb = gr.top_block() - - ################################################## - # Variables - ################################################## - M = 2 - K = 1 - P = 2 - h = (1.0*K)/P - L = 3 - Q = 4 - frac = 0.99 - f = trellis.fsm(P,M,L) - - # CPFSK signals - #p = numpy.ones(Q)/(2.0) - #q = numpy.cumsum(p)/(1.0*Q) - - # GMSK signals - BT=0.3; - tt=numpy.arange(0,L*Q)/(1.0*Q)-L/2.0; - #print tt - p=(0.5*scipy.stats.erfc(2*math.pi*BT*(tt-0.5)/math.sqrt(math.log(2.0))/math.sqrt(2.0))-0.5*scipy.stats.erfc(2*math.pi*BT*(tt+0.5)/math.sqrt(math.log(2.0))/math.sqrt(2.0)))/2.0; - p=p/sum(p)*Q/2.0; - #print p - q=numpy.cumsum(p)/Q; - q=q/q[-1]/2.0; - #print q - - (f0T,SS,S,F,Sf,Ff,N) = fsm_utils.make_cpm_signals(K,P,M,L,q,frac) - #print N - #print Ff - Ffa = numpy.insert(Ff,Q,numpy.zeros(N),axis=0) - #print Ffa - MF = numpy.fliplr(numpy.transpose(Ffa)) - #print MF - E = numpy.sum(numpy.abs(Sf)**2,axis=0) - Es = numpy.sum(E)/f.O() - #print Es - - constellation = numpy.reshape(numpy.transpose(Sf),N*f.O()) - #print Ff - #print Sf - #print constellation - #print numpy.max(numpy.abs(SS - numpy.dot(Ff , Sf))) - - EsN0_db = 10.0 - N0 = Es * 10.0**(-(1.0*EsN0_db)/10.0) - #N0 = 0.0 - #print N0 - head = 4 - tail = 4 - numpy.random.seed(seed*666) - data = numpy.random.randint(0, M, head+blocksize+tail+1) - #data = numpy.zeros(blocksize+1+head+tail,'int') - for i in range(head): - data[i]=0 - for i in range(tail+1): - data[-i]=0 - - - - ################################################## - # Blocks - ################################################## - random_source_x_0 = gr.vector_source_b(data.tolist(), False) - gr_chunks_to_symbols_xx_0 = gr.chunks_to_symbols_bf((-1, 1), 1) - gr_interp_fir_filter_xxx_0 = gr.interp_fir_filter_fff(Q, p) - gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(2*math.pi*h*(1.0/Q)) - - gr_add_vxx_0 = gr.add_vcc(1) - gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, (N0/2.0)**0.5, -long(seed)) - - gr_multiply_vxx_0 = gr.multiply_vcc(1) - gr_sig_source_x_0 = gr.sig_source_c(Q, gr.GR_COS_WAVE, -f0T, 1, 0) - # only works for N=2, do it manually for N>2... - gr_fir_filter_xxx_0_0 = gr.fir_filter_ccc(Q, MF[0].conjugate()) - gr_fir_filter_xxx_0_0_0 = gr.fir_filter_ccc(Q, MF[1].conjugate()) - gr_streams_to_stream_0 = gr.streams_to_stream(gr.sizeof_gr_complex*1, int(N)) - gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1, int(N*(1+0))) - viterbi = trellis.viterbi_combined_cb(f, head+blocksize+tail, 0, -1, int(N), - constellation, digital.TRELLIS_EUCLIDEAN) - - gr_vector_sink_x_0 = gr.vector_sink_b() - - ################################################## - # Connections - ################################################## - tb.connect((random_source_x_0, 0), (gr_chunks_to_symbols_xx_0, 0)) - tb.connect((gr_chunks_to_symbols_xx_0, 0), (gr_interp_fir_filter_xxx_0, 0)) - tb.connect((gr_interp_fir_filter_xxx_0, 0), (gr_frequency_modulator_fc_0, 0)) - tb.connect((gr_frequency_modulator_fc_0, 0), (gr_add_vxx_0, 0)) - tb.connect((gr_noise_source_x_0, 0), (gr_add_vxx_0, 1)) - tb.connect((gr_add_vxx_0, 0), (gr_multiply_vxx_0, 0)) - tb.connect((gr_sig_source_x_0, 0), (gr_multiply_vxx_0, 1)) - tb.connect((gr_multiply_vxx_0, 0), (gr_fir_filter_xxx_0_0, 0)) - tb.connect((gr_multiply_vxx_0, 0), (gr_fir_filter_xxx_0_0_0, 0)) - tb.connect((gr_fir_filter_xxx_0_0, 0), (gr_streams_to_stream_0, 0)) - tb.connect((gr_fir_filter_xxx_0_0_0, 0), (gr_streams_to_stream_0, 1)) - tb.connect((gr_streams_to_stream_0, 0), (gr_skiphead_0, 0)) - tb.connect((gr_skiphead_0, 0), (viterbi, 0)) - tb.connect((viterbi, 0), (gr_vector_sink_x_0, 0)) - - - tb.run() - dataest = gr_vector_sink_x_0.data() - #print data - #print numpy.array(dataest) - perr = 0 - err = 0 - for i in range(blocksize): - if data[head+i] != dataest[head+i]: - #print i - err += 1 - if err != 0 : - perr = 1 - return (err,perr) - -if __name__ == '__main__': - blocksize = 1000 - ss=0 - ee=0 - for i in range(10000): - (s,e) = run_test(i,blocksize) - ss += s - ee += e - if (i+1) % 100 == 0: - print i+1,ss,ee,(1.0*ss)/(i+1)/(1.0*blocksize),(1.0*ee)/(i+1) - print i+1,ss,ee,(1.0*ss)/(i+1)/(1.0*blocksize),(1.0*ee)/(i+1) diff --git a/gr-trellis/src/examples/python/test_pccc_turbo1.py b/gr-trellis/src/examples/python/test_pccc_turbo1.py deleted file mode 100755 index 0655b972d..000000000 --- a/gr-trellis/src/examples/python/test_pccc_turbo1.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed): - tb = gr.top_block () - - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - #src = gr.vector_source_s([0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1],False) - enc = trellis.pccc_encoder_ss(fo,0,fi,0,interleaver,K) - code = gr.vector_sink_s() - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics_in = trellis.metrics_f(fi.O()*fo.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO - scale = gr.multiply_const_ff(1.0/N0) - dec = trellis.pccc_decoder_s(fo,0,-1,fi,0,-1,interleaver,K,IT,trellis.TRELLIS_MIN_SUM) - - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - tb.connect (src,src_head,s2fsmi,enc,mod) - #tb.connect (src,enc,mod) - #tb.connect(enc,code) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics_in,scale,dec,fsmi2s,dst) - - tb.run() - - #print code.data() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 5: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - IT=int(args[3]) - rep=int(args[4]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_pccc_turbo.py fsm_name_1 fsm_fname_2 Es/No_db iterations repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.I() != fi.I(): - sys.stderr.write ('Incompatible input cardinality between two FSMs.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - #modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = 4 - constellation = [ 1, 0, 1, 0,\ - 1, 0,-1, 0,\ - 1, 0, 0, 1,\ - 1, 0, 0,-1,\ - -1, 0, 1, 0,\ - -1, 0,-1, 0,\ - -1, 0, 0, 1,\ - -1, 0, 0,-1,\ - 0, 1, 1, 0,\ - 0, 1,-1, 0,\ - 0, 1, 0, 1,\ - 0, 1, 0,-1,\ - 0,-1, 1, 0,\ - 0,-1,-1, 0,\ - 0,-1, 0, 1,\ - 0,-1, 0,-1,] # equivalent to 2 QPSK symbols - if len(constellation)/dimensionality != fi.O()*fo.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0): # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_sccc_hard.py b/gr-trellis/src/examples/python/test_sccc_hard.py deleted file mode 100755 index 4eeb94a12..000000000 --- a/gr-trellis/src/examples/python/test_sccc_hard.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - tb = gr.top_block () - - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - enc_in = trellis.encoder_ss(fi,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi - va_in = trellis.viterbi_s(fi,K,0,-1) # Put -1 if the Initial/Final states are not set. - deinter = trellis.permutation(interleaver.K(),interleaver.DEINTER(),1,gr.sizeof_short) - metrics_out = trellis.metrics_s(fo.O(),1,[0,1,2,3],digital.TRELLIS_HARD_SYMBOL) # data preprocessing to generate metrics for outer Viterbi (hard decisions) - va_out = trellis.viterbi_s(fo,K,0,-1) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics_in) - tb.connect (metrics_in,va_in,deinter,metrics_out,va_out,fsmi2s,dst) - - tb.run() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 4: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - rep=int(args[3]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_tcm.py fsm_name_out fsm_fname_in Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_sccc_soft.py b/gr-trellis/src/examples/python/test_sccc_soft.py deleted file mode 100755 index 10c28419a..000000000 --- a/gr-trellis/src/examples/python/test_sccc_soft.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - - - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - tb = gr.top_block () - - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - enc_in = trellis.encoder_ss(fi,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi - gnd = gr.vector_source_f([0],True); - siso_in = trellis.siso_f(fi,K,0,-1,True,False,trellis.TRELLIS_MIN_SUM) # Put -1 if the Initial/Final states are not set. - deinter = trellis.permutation(interleaver.K(),interleaver.DEINTER(),fi.I(),gr.sizeof_float) - va_out = trellis.viterbi_s(fo,K,0,-1) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics_in) - tb.connect (gnd,(siso_in,0)) - tb.connect (metrics_in,(siso_in,1)) - tb.connect (siso_in,deinter,va_out,fsmi2s,dst) - - tb.run() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 4: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - rep=int(args[3]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_tcm.py fsm_name_out fsm_fname_in Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_sccc_turbo.py b/gr-trellis/src/examples/python/test_sccc_turbo.py deleted file mode 100755 index 762a93ba5..000000000 --- a/gr-trellis/src/examples/python/test_sccc_turbo.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - - - -def make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,type): - metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi - scale = gr.multiply_const_ff(1.0/N0) - gnd = gr.vector_source_f([0],True); - - inter=[] - deinter=[] - siso_in=[] - siso_out=[] - - # generate all blocks - for it in range(IT): - inter.append( trellis.permutation(interleaver.K(),interleaver.INTER(),fi.I(),gr.sizeof_float) ) - siso_in.append( trellis.siso_f(fi,K,0,-1,True,False,type) ) - deinter.append( trellis.permutation(interleaver.K(),interleaver.DEINTER(),fi.I(),gr.sizeof_float) ) - if it < IT-1: - siso_out.append( trellis.siso_f(fo,K,0,-1,False,True,type) ) - else: - siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed - - # connect first stage - tb.connect (gnd,inter[0]) - tb.connect (metrics_in,scale) - tb.connect (scale,(siso_in[0],1)) - - # connect the rest - for it in range(IT): - if it < IT-1: - tb.connect (metrics_in,(siso_in[it+1],1)) - tb.connect (siso_in[it],deinter[it],(siso_out[it],1)) - tb.connect (gnd,(siso_out[it],0)) - tb.connect (siso_out[it],inter[it+1]) - tb.connect (inter[it],(siso_in[it],0)) - else: - tb.connect (siso_in[it],deinter[it],siso_out[it]) - tb.connect (inter[it],(siso_in[it],0)) - - return (metrics_in,siso_out[IT-1]) - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed): - tb = gr.top_block () - - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - enc_in = trellis.encoder_ss(fi,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - (head,tail) = make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) - #(head,tail) = make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_SUM_PRODUCT) - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,head) - tb.connect (tail,fsmi2s,dst) - - tb.run() - - #print enc_out.ST(), enc_in.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 5: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - IT=int(args[3]) - rep=int(args[4]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_sccc_turbo.py fsm_name_out fsm_fname_in Es/No_db iterations repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0): # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_sccc_turbo1.py b/gr-trellis/src/examples/python/test_sccc_turbo1.py deleted file mode 100755 index 187a75185..000000000 --- a/gr-trellis/src/examples/python/test_sccc_turbo1.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - enc = trellis.sccc_encoder_ss(fo,0,fi,0,interleaver,K) - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - dec = trellis.sccc_decoder_combined_fs(fo,0,-1,fi,0,-1,interleaver,K,IT,trellis.TRELLIS_MIN_SUM,dimensionality,constellation,digital.TRELLIS_EUCLIDEAN,1.0) - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - #tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (src,src_head,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - #tb.connect (add,head) - #tb.connect (tail,fsmi2s,dst) - tb.connect (add,dec,fsmi2s,dst) - - tb.run() - - #print enc_out.ST(), enc_in.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 5: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - IT=int(args[3]) - rep=int(args[4]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_tcm.py fsm_name_out fsm_fname_in Es/No_db iterations repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0): # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_sccc_turbo2.py b/gr-trellis/src/examples/python/test_sccc_turbo2.py deleted file mode 100755 index dff1ba93c..000000000 --- a/gr-trellis/src/examples/python/test_sccc_turbo2.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - enc = trellis.sccc_encoder_ss(fo,0,fi,0,interleaver,K) - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO - scale = gr.multiply_const_ff(1.0/N0) - dec = trellis.sccc_decoder_s(fo,0,-1,fi,0,-1,interleaver,K,IT,trellis.TRELLIS_MIN_SUM) - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - #tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (src,src_head,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - #tb.connect (add,head) - #tb.connect (tail,fsmi2s,dst) - tb.connect (add,metrics_in,scale,dec,fsmi2s,dst) - - tb.run() - - #print enc_out.ST(), enc_in.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 5: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - IT=int(args[3]) - rep=int(args[4]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_tcm.py fsm_name_out fsm_fname_in Es/No_db iterations repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0): # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_tcm.py b/gr-trellis/src/examples/python/test_tcm.py deleted file mode 100755 index a7d6a02d0..000000000 --- a/gr-trellis/src/examples/python/test_tcm.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - tb = gr.top_block () - - - # TX - #packet = [0]*Kb - #for i in range(Kb-1*16): # last 16 bits = 0 to drive the final state to 0 - #packet[i] = random.randint(0, 1) # random 0s and 1s - #src = gr.vector_source_s(packet,False) - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - #b2s = gr.unpacked_to_packed_ss(1,gr.GR_MSB_FIRST) # pack bits in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - enc = trellis.encoder_ss(f,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics = trellis.metrics_f(f.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - #s2b = gr.packed_to_unpacked_ss(1,gr.GR_MSB_FIRST) # unpack shorts to bits - #dst = gr.vector_sink_s(); - dst = gr.check_lfsr_32k_s() - - - tb.connect (src,src_head,s2fsmi,enc,mod) - #tb.connect (src,b2s,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics) - tb.connect (metrics,va,fsmi2s,dst) - #tb.connect (metrics,va,fsmi2s,s2b,dst) - - - tb.run() - - # A bit of cheating: run the program once and print the - # final encoder state.. - # Then put it as the last argument in the viterbi block - #print "final state = " , enc.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - #ntotal = len(packet) - #if len(dst.data()) != ntotal: - #print "Error: not enough data\n" - #nright = 0; - #for i in range(ntotal): - #if packet[i]==dst.data()[i]: - #nright=nright+1 - #else: - #print "Error in ", i - return (ntotal,ntotal-nright) - - - - -def main(): - parser = OptionParser(option_class=eng_option) - parser.add_option("-f", "--fsm_file", type="string", default="fsm_files/awgn1o2_4.fsm", help="Filename containing the fsm specification, e.g. -f fsm_files/awgn1o2_4.fsm (default=fsm_files/awgn1o2_4.fsm)") - parser.add_option("-e", "--esn0", type="eng_float", default=10.0, help="Symbol energy to noise PSD level ratio in dB, e.g., -e 10.0 (default=10.0)") - parser.add_option("-r", "--repetitions", type="int", default=100, help="Number of packets to be generated for the simulation, e.g., -r 100 (default=100)") - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - fname=options.fsm_file - esn0_db=float(options.esn0) - rep=int(options.repetitions) - - # system parameters - f=trellis.fsm(fname) # get the FSM specification from a file - # alternatively you can specify the fsm from its generator matrix - #f=trellis.fsm(1,2,[5,7]) - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main() diff --git a/gr-trellis/src/examples/python/test_tcm_bit.py b/gr-trellis/src/examples/python/test_tcm_bit.py deleted file mode 100755 index 7f69c0e29..000000000 --- a/gr-trellis/src/examples/python/test_tcm_bit.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils -from gnuradio.eng_option import eng_option -from optparse import OptionParser - - -def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - tb = gr.top_block () - - # TX - packet = [0]*Kb - # this for loop is TOO slow!!! - for i in range(Kb-1*16): # last 16 bits = 0 to drive the final state to 0 - packet[i] = random.randint(0, 1) # random 0s and 1s - src = gr.vector_source_s(packet,False) - #src = gr.lfsr_32k_source_s() - #src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - b2s = gr.unpacked_to_packed_ss(1,gr.GR_MSB_FIRST) # pack bits in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - enc = trellis.encoder_ss(f,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - - # RX - metrics = trellis.metrics_f(f.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - s2b = gr.packed_to_unpacked_ss(1,gr.GR_MSB_FIRST) # unpack shorts to bits - dst = gr.vector_sink_s(); - #dst = gr.check_lfsr_32k_s(); - - - #tb.connect (src,src_head,s2fsmi,enc,mod) - tb.connect (src,b2s,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics) - #tb.connect (metrics,va,fsmi2s,dst) - tb.connect (metrics,va,fsmi2s,s2b,dst) - - - tb.run() - - # A bit of cheating: run the program once and print the - # final encoder state.. - # Then put it as the last argument in the viterbi block - #print "final state = " , enc.ST() - - #ntotal = dst.ntotal () - #nright = dst.nright () - #runlength = dst.runlength () - ntotal = len(packet) - if len(dst.data()) != ntotal: - print "Error: not enough data\n" - nright = 0; - # this for loop is TOO slow!!! - for i in range(ntotal): - if packet[i]==dst.data()[i]: - nright=nright+1 - #else: - #print "Error in ", i - return (ntotal,ntotal-nright) - - - - -def main(): - parser = OptionParser(option_class=eng_option) - parser.add_option("-f", "--fsm_file", type="string", default="fsm_files/awgn1o2_4.fsm", help="Filename containing the fsm specification, e.g. -f fsm_files/awgn1o2_4.fsm (default=fsm_files/awgn1o2_4.fsm)") - parser.add_option("-e", "--esn0", type="eng_float", default=10.0, help="Symbol energy to noise PSD level ratio in dB, e.g., -e 10.0 (default=10.0)") - parser.add_option("-r", "--repetitions", type="int", default=100, help="Number of packets to be generated for the simulation, e.g., -r 100 (default=100)") - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - fname=options.fsm_file - esn0_db=float(options.esn0) - rep=int(options.repetitions) - - - # system parameters - f=trellis.fsm(fname) # get the FSM specification from a file - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%1==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main() diff --git a/gr-trellis/src/examples/python/test_tcm_combined.py b/gr-trellis/src/examples/python/test_tcm_combined.py deleted file mode 100755 index d98e36e27..000000000 --- a/gr-trellis/src/examples/python/test_tcm_combined.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import fsm_utils -from gnuradio.eng_option import eng_option -from optparse import OptionParser - - -def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - enc = trellis.encoder_ss(f,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - - # RX - va = trellis.viterbi_combined_fs(f,K,0,-1,dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s(); - - - tb.connect (src,src_head,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,va,fsmi2s,dst) - - - tb.run() - - # A bit of cheating: run the program once and print the - # final encoder state.. - # Then put it as the last argument in the viterbi block - #print "final state = " , enc.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - - return (ntotal,ntotal-nright) - - - - -def main(): - parser = OptionParser(option_class=eng_option) - parser.add_option("-f", "--fsm_file", type="string", default="fsm_files/awgn1o2_4.fsm", help="Filename containing the fsm specification, e.g. -f fsm_files/awgn1o2_4.fsm (default=fsm_files/awgn1o2_4.fsm)") - parser.add_option("-e", "--esn0", type="eng_float", default=10.0, help="Symbol energy to noise PSD level ratio in dB, e.g., -e 10.0 (default=10.0)") - parser.add_option("-r", "--repetitions", type="int", default=100, help="Number of packets to be generated for the simulation, e.g., -r 100 (default=100)") - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - fname=options.fsm_file - esn0_db=float(options.esn0) - rep=int(options.repetitions) - - # system parameters - f=trellis.fsm(fname) # get the FSM specification from a file (will hopefully be automated in the future...) - Kb=1024*16 # packet size in bits (make it multiple of 16) - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - modulation = fsm_utils.psk4 # see fsm_utils.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main() - diff --git a/gr-trellis/src/examples/python/test_tcm_parallel.py b/gr-trellis/src/examples/python/test_tcm_parallel.py deleted file mode 100755 index 0372351aa..000000000 --- a/gr-trellis/src/examples/python/test_tcm_parallel.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import fsm_utils -from gnuradio.eng_option import eng_option -from optparse import OptionParser - - -def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed,P): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16*P) # packet size in shorts - s2fsmi=gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - s2p = gr.stream_to_streams(gr.sizeof_short,P) # serial to parallel - enc = trellis.encoder_ss(f,0) # initiali state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add=[] - noise=[] - for i in range(P): - add.append(gr.add_ff()) - noise.append(gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)) - - # RX - metrics = trellis.metrics_f(f.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. - p2s = gr.streams_to_stream(gr.sizeof_short,P) # parallel to serial - fsmi2s=gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - tb.connect (src,src_head,s2fsmi,s2p) - for i in range(P): - tb.connect ((s2p,i),(enc,i),(mod,i)) - tb.connect ((mod,i),(add[i],0)) - tb.connect (noise[i],(add[i],1)) - tb.connect (add[i],(metrics,i)) - tb.connect ((metrics,i),(va,i),(p2s,i)) - tb.connect (p2s,fsmi2s,dst) - - - tb.run() - - # A bit of cheating: run the program once and print the - # final encoder state. - # Then put it as the last argument in the viterbi block - #print "final state = " , enc.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - - return (ntotal,ntotal-nright) - - - -def main(): - parser = OptionParser(option_class=eng_option) - parser.add_option("-f", "--fsm_file", type="string", default="fsm_files/awgn1o2_4.fsm", help="Filename containing the fsm specification, e.g. -f fsm_files/awgn1o2_4.fsm (default=fsm_files/awgn1o2_4.fsm)") - parser.add_option("-e", "--esn0", type="eng_float", default=10.0, help="Symbol energy to noise PSD level ratio in dB, e.g., -e 10.0 (default=10.0)") - parser.add_option("-r", "--repetitions", type="int", default=100, help="Number of packets to be generated for the simulation, e.g., -r 100 (default=100)") - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - fname=options.fsm_file - esn0_db=float(options.esn0) - rep=int(options.repetitions) - - # system parameters - f=trellis.fsm(fname) # get the FSM specification from a file - P=4 # how many parallel streams? - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i),P) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main() - diff --git a/gr-trellis/src/examples/python/test_turbo_equalization.py b/gr-trellis/src/examples/python/test_turbo_equalization.py deleted file mode 100755 index 18bfb022a..000000000 --- a/gr-trellis/src/examples/python/test_turbo_equalization.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import fsm_utils - - -def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): - metrics_in = trellis.metrics_f(fi.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO - scale = gr.multiply_const_ff(1.0/N0) - gnd = gr.vector_source_f([0],True); - - inter=[] - deinter=[] - siso_in=[] - siso_out=[] - - # generate all blocks - for it in range(IT): - inter.append( trellis.permutation(interleaver.K(),interleaver.INTER(),fi.I(),gr.sizeof_float) ) - siso_in.append( trellis.siso_f(fi,K,0,-1,True,False,type) ) - deinter.append( trellis.permutation(interleaver.K(),interleaver.DEINTER(),fi.I(),gr.sizeof_float) ) - if it < IT-1: - siso_out.append( trellis.siso_f(fo,K,0,-1,False,True,type) ) - else: - siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed - - # connect first stage - tb.connect (gnd,inter[0]) - tb.connect (metrics_in,scale) - tb.connect (scale,(siso_in[0],1)) - - # connect the rest - for it in range(IT): - if it < IT-1: - tb.connect (metrics_in,(siso_in[it+1],1)) - tb.connect (siso_in[it],deinter[it],(siso_out[it],1)) - tb.connect (gnd,(siso_out[it],0)) - tb.connect (siso_out[it],inter[it+1]) - tb.connect (inter[it],(siso_in[it],0)) - else: - tb.connect (siso_in[it],deinter[it],siso_out[it]) - tb.connect (inter[it],(siso_in[it],0)) - - return (metrics_in,siso_out[IT-1]) - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,tot_constellation,Es,N0,IT,seed): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the iouter FSM input cardinality - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - enc_in = trellis.encoder_ss(fi,0) # initial state = 0 - # essentially here we implement the combination of modulation and channel as a memoryless modulation (the memory induced by the channel is hidden in the innner FSM) - mod = gr.chunks_to_symbols_sf(tot_constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s(); - - tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,head) - tb.connect (tail,fsmi2s,dst) - - tb.run() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - #print ntotal,nright,runlength - - return (ntotal,ntotal-nright) - - - - -def main(args): - nargs = len (args) - if nargs == 3: - fname_out=args[0] - esn0_db=float(args[1]) - rep=int(args[2]) - else: - sys.stderr.write ('usage: test_turbo_equalization.py fsm_name_out Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=64*16 # packet size in bits (multiple of 16) - modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - print 'size = ',K - interleaver=trellis.interleaver(K,666) # construct a random interleaver - tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - dimensionality = tot_channel[0] - tot_constellation = tot_channel[1] - if len(tot_constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - sys.exit (1) - N0=pow(10.0,-esn0_db/10.0); # noise variance - IT = 3 # number of turbo iterations - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,tot_constellation,1,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - print s - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) - diff --git a/gr-trellis/src/examples/python/test_turbo_equalization1.py b/gr-trellis/src/examples/python/test_turbo_equalization1.py deleted file mode 100755 index 17ad43023..000000000 --- a/gr-trellis/src/examples/python/test_turbo_equalization1.py +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - -def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): - metrics_in = trellis.metrics_f(fi.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO - scale = gr.multiply_const_ff(1.0/N0) - gnd = gr.vector_source_f([0],True); - - inter=[] - deinter=[] - siso_in=[] - siso_out=[] - - # generate all blocks - for it in range(IT): - inter.append( trellis.permutation(interleaver.K(),interleaver.INTER(),fi.I(),gr.sizeof_float) ) - siso_in.append( trellis.siso_f(fi,K,0,-1,True,False,type) ) - deinter.append( trellis.permutation(interleaver.K(),interleaver.DEINTER(),fi.I(),gr.sizeof_float) ) - if it < IT-1: - siso_out.append( trellis.siso_f(fo,K,0,-1,False,True,type) ) - else: - siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed - - # connect first stage - tb.connect (gnd,inter[0]) - tb.connect (metrics_in,scale) - tb.connect (scale,(siso_in[0],1)) - - # connect the rest - for it in range(IT): - if it < IT-1: - tb.connect (scale,(siso_in[it+1],1)) - tb.connect (siso_in[it],deinter[it],(siso_out[it],1)) - tb.connect (gnd,(siso_out[it],0)) - tb.connect (siso_out[it],inter[it+1]) - tb.connect (inter[it],(siso_in[it],0)) - else: - tb.connect (siso_in[it],deinter[it],siso_out[it]) - tb.connect (inter[it],(siso_in[it],0)) - - return (metrics_in,siso_out[IT-1]) - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,Es,N0,IT,seed): - tb = gr.top_block () - L = len(channel) - - # TX - # this for loop is TOO slow in python!!! - packet = [0]*(K) - random.seed(seed) - for i in range(len(packet)): - packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols - src = gr.vector_source_s(packet,False) - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) - - # CHANNEL - isi = gr.fir_filter_fff(1,channel) - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) - dst = gr.vector_sink_s(); - - tb.connect (src,enc_out,inter,mod) - tb.connect (mod,isi,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,head) - tb.connect (tail,dst) - - tb.run() - - data = dst.data() - ntotal = len(data) - nright=0 - for i in range(ntotal): - if packet[i]==data[i]: - nright=nright+1 - #else: - #print "Error in ", i - - return (ntotal,ntotal-nright) - - - - -def main(args): - nargs = len (args) - if nargs == 3: - fname_out=args[0] - esn0_db=float(args[1]) - rep=int(args[2]) - else: - sys.stderr.write ('usage: test_turbo_equalization.py fsm_name_out Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=64*16 # packet size in bits (multiple of 16) - modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - dimensionality = tot_channel[0] - tot_constellation = tot_channel[1] - if len(tot_constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - sys.exit (1) - N0=pow(10.0,-esn0_db/10.0); # noise variance - IT = 3 # number of turbo iterations - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,1,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) - diff --git a/gr-trellis/src/examples/python/test_turbo_equalization2.py b/gr-trellis/src/examples/python/test_turbo_equalization2.py deleted file mode 100755 index 5a6c77e9d..000000000 --- a/gr-trellis/src/examples/python/test_turbo_equalization2.py +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - -def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): - scale = gr.multiply_const_ff(math.sqrt(1.0/N0)) - gnd = gr.vector_source_f([0],True); - - inter=[] - deinter=[] - siso_in=[] - siso_out=[] - - # generate all blocks - for it in range(IT): - inter.append( trellis.permutation(interleaver.K(),interleaver.INTER(),fi.I(),gr.sizeof_float) ) - siso_in.append( trellis.siso_combined_f(fi,K,0,-1,True,False,type,dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) ) - deinter.append( trellis.permutation(interleaver.K(),interleaver.DEINTER(),fi.I(),gr.sizeof_float) ) - if it < IT-1: - siso_out.append( trellis.siso_f(fo,K,0,-1,False,True,type) ) - else: - siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed - - # connect first stage - tb.connect (gnd,inter[0]) - tb.connect (scale,(siso_in[0],1)) - - # connect the rest - for it in range(IT): - if it < IT-1: - tb.connect (scale,(siso_in[it+1],1)) - tb.connect (siso_in[it],deinter[it],(siso_out[it],1)) - tb.connect (gnd,(siso_out[it],0)) - tb.connect (siso_out[it],inter[it+1]) - tb.connect (inter[it],(siso_in[it],0)) - else: - tb.connect (siso_in[it],deinter[it],siso_out[it]) - tb.connect (inter[it],(siso_in[it],0)) - - return (scale,siso_out[IT-1]) - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,Es,N0,IT,seed): - tb = gr.top_block () - L = len(channel) - - # TX - # this for loop is TOO slow in python!!! - packet = [0]*(K) - random.seed(seed) - for i in range(len(packet)): - packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols - src = gr.vector_source_s(packet,False) - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) - - # CHANNEL - isi = gr.fir_filter_fff(1,channel) - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) - dst = gr.vector_sink_s(); - - tb.connect (src,enc_out,inter,mod) - tb.connect (mod,isi,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,head) - tb.connect (tail,dst) - - tb.run() - - data = dst.data() - ntotal = len(data) - nright=0 - for i in range(ntotal): - if packet[i]==data[i]: - nright=nright+1 - #else: - #print "Error in ", i - - return (ntotal,ntotal-nright) - - - - -def main(args): - nargs = len (args) - if nargs == 3: - fname_out=args[0] - esn0_db=float(args[1]) - rep=int(args[2]) - else: - sys.stderr.write ('usage: test_turbo_equalization.py fsm_name_out Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=64*16 # packet size in bits (multiple of 16) - modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - dimensionality = tot_channel[0] - N0=pow(10.0,-esn0_db/10.0); # noise variance - tot_constellation =[0]*len(tot_channel[1]) - for i in range(len(tot_channel[1])): - tot_constellation[i] = tot_channel[1][i] * math.sqrt(1.0/N0) - if len(tot_constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - sys.exit (1) - IT = 3 # number of turbo iterations - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,1,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) - diff --git a/gr-trellis/src/examples/python/test_viterbi_equalization.py b/gr-trellis/src/examples/python/test_viterbi_equalization.py deleted file mode 100755 index 9f3f7e391..000000000 --- a/gr-trellis/src/examples/python/test_viterbi_equalization.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import fsm_utils - -def run_test (f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,seed): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - enc = trellis.encoder_ss(f,0) # initial state = 0 - # essentially here we implement the combination of modulation and channel as a memoryless modulation (the memory induced by the channel is hidden in the FSM) - mod = gr.chunks_to_symbols_sf(tot_constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s(); - - tb.connect (src,src_head,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics) - tb.connect (metrics,va,fsmi2s,dst) - - tb.run() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - #print ntotal,nright,runlength - - return (ntotal,ntotal-nright) - - - - -def main(args): - nargs = len (args) - if nargs == 2: - esn0_db=float(args[0]) - rep=int(args[1]) - else: - sys.stderr.write ('usage: test_viterbi_equalization.py Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=128*16 # packet size in bits (multiple of 16) - modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - f=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - - tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - dimensionality = tot_channel[0] - tot_constellation = tot_channel[1] - N0=pow(10.0,-esn0_db/10.0); # noise variance - if len(tot_constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - sys.exit (1) - - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) - diff --git a/gr-trellis/src/examples/python/test_viterbi_equalization1.py b/gr-trellis/src/examples/python/test_viterbi_equalization1.py deleted file mode 100755 index 90eb4790e..000000000 --- a/gr-trellis/src/examples/python/test_viterbi_equalization1.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - -def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,seed): - tb = gr.top_block () - L = len(channel) - - # TX - # this for loop is TOO slow in python!!! - packet = [0]*(K+2*L) - random.seed(seed) - for i in range(len(packet)): - packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols - for i in range(L): # first/last L symbols set to 0 - packet[i] = 0 - packet[len(packet)-i-1] = 0 - src = gr.vector_source_s(packet,False) - mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) - - # CHANNEL - isi = gr.fir_filter_fff(1,channel) - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols - #metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - #va = trellis.viterbi_s(f,K+L,-1,0) # Put -1 if the Initial/Final states are not set. - va = trellis.viterbi_combined_fs(f,K+L,0,0,dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # using viterbi_combined_fs instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application... - dst = gr.vector_sink_s() - - tb.connect (src,mod) - tb.connect (mod,isi,(add,0)) - tb.connect (noise,(add,1)) - #tb.connect (add,metrics) - #tb.connect (metrics,va,dst) - tb.connect (add,skip,va,dst) - - tb.run() - - data = dst.data() - ntotal = len(data) - L - nright=0 - for i in range(ntotal): - if packet[i+L]==data[i]: - nright=nright+1 - #else: - #print "Error in ", i - - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 2: - esn0_db=float(args[0]) - rep=int(args[1]) - else: - sys.stderr.write ('usage: test_viterbi_equalization1.py Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=128*16 # packet size in bits (multiple of 16) - modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - f=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - - tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - dimensionality = tot_channel[0] - tot_constellation = tot_channel[1] - N0=pow(10.0,-esn0_db/10.0); # noise variance - if len(tot_constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - sys.exit (1) - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or symbol) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/lib/CMakeLists.txt b/gr-trellis/src/lib/CMakeLists.txt deleted file mode 100644 index e2abf0238..000000000 --- a/gr-trellis/src/lib/CMakeLists.txt +++ /dev/null @@ -1,226 +0,0 @@ -# Copyright 2011 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. - -include(GrPython) - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${GR_TRELLIS_INCLUDE_DIRS} - ${GR_DIGITAL_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# generate the python helper script which calls into the build utils -######################################################################## -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " -#!${PYTHON_EXECUTABLE} - -import sys, os, re -sys.path.append('${GR_CORE_PYTHONPATH}') -sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}') -os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.chdir('${CMAKE_CURRENT_BINARY_DIR}') - -if __name__ == '__main__': - import build_utils, generate_trellis - root, inp = sys.argv[1:3] - for sig in sys.argv[3:]: - name = re.sub ('X+', sig, root) - d = generate_trellis.standard_dict(name, sig) - build_utils.expand_template(d, inp) - -") - -######################################################################## -# generation helper macro to generate various files from template -######################################################################## -macro(expand_h_cc_i root) - - foreach(ext h cc i) - #make a list of all the generated files - unset(expanded_files_${ext}) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_${ext} ${CMAKE_CURRENT_BINARY_DIR}/${name}.${ext}) - endforeach(sig) - - #create a command to generate the files - add_custom_command( - OUTPUT ${expanded_files_${ext}} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.${ext}.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.${ext}.t ${ARGN} - ) - endforeach(ext) - - #make source files depends on headers to force generation - set_source_files_properties(${expanded_files_cc} - PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" - ) - - #install rules for the generated cc, h, and i files - list(APPEND generated_trellis_sources ${expanded_files_cc}) - list(APPEND generated_trellis_includes ${expanded_files_h}) - list(APPEND generated_trellis_swigs ${expanded_files_i}) - -endmacro(expand_h_cc_i) - -######################################################################## -# Invoke macro to generate various sources -######################################################################## -expand_h_cc_i(trellis_encoder_XX bb bs bi ss si ii) -expand_h_cc_i(trellis_sccc_encoder_XX bb bs bi ss si ii) -expand_h_cc_i(trellis_pccc_encoder_XX bb bs bi ss si ii) -expand_h_cc_i(trellis_metrics_X s i f c) -expand_h_cc_i(trellis_viterbi_X b s i) -expand_h_cc_i(trellis_viterbi_combined_XX sb ss si ib is ii fb fs fi cb cs ci) -expand_h_cc_i(trellis_sccc_decoder_X b s i) -expand_h_cc_i(trellis_sccc_decoder_combined_XX fb fs fi cb cs ci) -expand_h_cc_i(trellis_pccc_decoder_X b s i) -expand_h_cc_i(trellis_pccc_decoder_combined_XX fb fs fi cb cs ci) - -######################################################################## -# Create the master trellis swig include files -######################################################################## -set(generated_index ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i.in) -file(WRITE ${generated_index} " -// -// This file is machine generated. All edits will be overwritten -// -") - -file(APPEND ${generated_index} "%{\n") -foreach(swig_file ${generated_trellis_swigs}) - get_filename_component(name ${swig_file} NAME_WE) - file(APPEND ${generated_index} "#include<${name}.h>\n") -endforeach(swig_file) -file(APPEND ${generated_index} "%}\n") - -foreach(swig_file ${generated_trellis_swigs}) - get_filename_component(name ${swig_file} NAME) - file(APPEND ${generated_index} "%include<${name}>\n") -endforeach(swig_file) - -execute_process( - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${generated_index} ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i -) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_trellis_sources - fsm.cc - quicksort_index.cc - base.cc - interleaver.cc - calc_metric.cc - core_algorithms.cc - trellis_permutation.cc - trellis_siso_f.cc - trellis_siso_combined_f.cc - trellis_constellation_metrics_cf.cc - ${generated_trellis_sources} -) - -list(APPEND trellis_libs - gnuradio-core - ${Boost_LIBRARIES} -) - -add_library(gnuradio-trellis SHARED ${gr_trellis_sources}) -target_link_libraries(gnuradio-trellis ${trellis_libs}) -GR_LIBRARY_FOO(gnuradio-trellis RUNTIME_COMPONENT "trellis_runtime" DEVEL_COMPONENT "trellis_devel") - -######################################################################## -# Handle the generated sources + a few non-generated ones -######################################################################## -install(FILES - ${generated_trellis_includes} - trellis_api.h - fsm.h - quicksort_index.h - base.h - interleaver.h - calc_metric.h - core_algorithms.h - trellis_permutation.h - siso_type.h - trellis_siso_f.h - trellis_siso_combined_f.h - trellis_constellation_metrics_cf.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "trellis_devel" -) - -if(ENABLE_PYTHON) - install(FILES - trellis.i - ${generated_trellis_swigs} - fsm.i - interleaver.i - trellis_permutation.i - trellis_siso_f.i - trellis_siso_combined_f.i - trellis_constellation_metrics_cf.i - ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i - ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "trellis_swig" - ) - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_SOURCE_DEPS - ${generated_trellis_includes} - ${generated_trellis_swigs} -) -set(GR_SWIG_INCLUDE_DIRS - ${GR_TRELLIS_INCLUDE_DIRS} - ${GR_DIGITAL_SWIG_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - -set(GR_SWIG_LIBRARIES gnuradio-trellis) -GR_SWIG_MAKE(trellis trellis.i) - -GR_SWIG_INSTALL( - TARGETS trellis - DESTINATION ${GR_PYTHON_DIR}/gnuradio - COMPONENT "trellis_python" -) - -endif(ENABLE_PYTHON) diff --git a/gr-trellis/src/lib/Makefile.gen b/gr-trellis/src/lib/Makefile.gen deleted file mode 100644 index b9b9afb1f..000000000 --- a/gr-trellis/src/lib/Makefile.gen +++ /dev/null @@ -1,174 +0,0 @@ -# -# This file is machine generated. All edits will be overwritten -# -GENERATED_H = \ - trellis_encoder_bb.h \ - trellis_encoder_bi.h \ - trellis_encoder_bs.h \ - trellis_encoder_ii.h \ - trellis_encoder_si.h \ - trellis_encoder_ss.h \ - trellis_metrics_c.h \ - trellis_metrics_f.h \ - trellis_metrics_i.h \ - trellis_metrics_s.h \ - trellis_pccc_decoder_b.h \ - trellis_pccc_decoder_combined_cb.h \ - trellis_pccc_decoder_combined_ci.h \ - trellis_pccc_decoder_combined_cs.h \ - trellis_pccc_decoder_combined_fb.h \ - trellis_pccc_decoder_combined_fi.h \ - trellis_pccc_decoder_combined_fs.h \ - trellis_pccc_decoder_i.h \ - trellis_pccc_decoder_s.h \ - trellis_pccc_encoder_bb.h \ - trellis_pccc_encoder_bi.h \ - trellis_pccc_encoder_bs.h \ - trellis_pccc_encoder_ii.h \ - trellis_pccc_encoder_si.h \ - trellis_pccc_encoder_ss.h \ - trellis_sccc_decoder_b.h \ - trellis_sccc_decoder_combined_cb.h \ - trellis_sccc_decoder_combined_ci.h \ - trellis_sccc_decoder_combined_cs.h \ - trellis_sccc_decoder_combined_fb.h \ - trellis_sccc_decoder_combined_fi.h \ - trellis_sccc_decoder_combined_fs.h \ - trellis_sccc_decoder_i.h \ - trellis_sccc_decoder_s.h \ - trellis_sccc_encoder_bb.h \ - trellis_sccc_encoder_bi.h \ - trellis_sccc_encoder_bs.h \ - trellis_sccc_encoder_ii.h \ - trellis_sccc_encoder_si.h \ - trellis_sccc_encoder_ss.h \ - trellis_viterbi_b.h \ - trellis_viterbi_combined_cb.h \ - trellis_viterbi_combined_ci.h \ - trellis_viterbi_combined_cs.h \ - trellis_viterbi_combined_fb.h \ - trellis_viterbi_combined_fi.h \ - trellis_viterbi_combined_fs.h \ - trellis_viterbi_combined_ib.h \ - trellis_viterbi_combined_ii.h \ - trellis_viterbi_combined_is.h \ - trellis_viterbi_combined_sb.h \ - trellis_viterbi_combined_si.h \ - trellis_viterbi_combined_ss.h \ - trellis_viterbi_i.h \ - trellis_viterbi_s.h - -GENERATED_I = \ - trellis_encoder_bb.i \ - trellis_encoder_bi.i \ - trellis_encoder_bs.i \ - trellis_encoder_ii.i \ - trellis_encoder_si.i \ - trellis_encoder_ss.i \ - trellis_metrics_c.i \ - trellis_metrics_f.i \ - trellis_metrics_i.i \ - trellis_metrics_s.i \ - trellis_pccc_decoder_b.i \ - trellis_pccc_decoder_combined_cb.i \ - trellis_pccc_decoder_combined_ci.i \ - trellis_pccc_decoder_combined_cs.i \ - trellis_pccc_decoder_combined_fb.i \ - trellis_pccc_decoder_combined_fi.i \ - trellis_pccc_decoder_combined_fs.i \ - trellis_pccc_decoder_i.i \ - trellis_pccc_decoder_s.i \ - trellis_pccc_encoder_bb.i \ - trellis_pccc_encoder_bi.i \ - trellis_pccc_encoder_bs.i \ - trellis_pccc_encoder_ii.i \ - trellis_pccc_encoder_si.i \ - trellis_pccc_encoder_ss.i \ - trellis_sccc_decoder_b.i \ - trellis_sccc_decoder_combined_cb.i \ - trellis_sccc_decoder_combined_ci.i \ - trellis_sccc_decoder_combined_cs.i \ - trellis_sccc_decoder_combined_fb.i \ - trellis_sccc_decoder_combined_fi.i \ - trellis_sccc_decoder_combined_fs.i \ - trellis_sccc_decoder_i.i \ - trellis_sccc_decoder_s.i \ - trellis_sccc_encoder_bb.i \ - trellis_sccc_encoder_bi.i \ - trellis_sccc_encoder_bs.i \ - trellis_sccc_encoder_ii.i \ - trellis_sccc_encoder_si.i \ - trellis_sccc_encoder_ss.i \ - trellis_viterbi_b.i \ - trellis_viterbi_combined_cb.i \ - trellis_viterbi_combined_ci.i \ - trellis_viterbi_combined_cs.i \ - trellis_viterbi_combined_fb.i \ - trellis_viterbi_combined_fi.i \ - trellis_viterbi_combined_fs.i \ - trellis_viterbi_combined_ib.i \ - trellis_viterbi_combined_ii.i \ - trellis_viterbi_combined_is.i \ - trellis_viterbi_combined_sb.i \ - trellis_viterbi_combined_si.i \ - trellis_viterbi_combined_ss.i \ - trellis_viterbi_i.i \ - trellis_viterbi_s.i - -GENERATED_CC = \ - trellis_encoder_bb.cc \ - trellis_encoder_bi.cc \ - trellis_encoder_bs.cc \ - trellis_encoder_ii.cc \ - trellis_encoder_si.cc \ - trellis_encoder_ss.cc \ - trellis_metrics_c.cc \ - trellis_metrics_f.cc \ - trellis_metrics_i.cc \ - trellis_metrics_s.cc \ - trellis_pccc_decoder_b.cc \ - trellis_pccc_decoder_combined_cb.cc \ - trellis_pccc_decoder_combined_ci.cc \ - trellis_pccc_decoder_combined_cs.cc \ - trellis_pccc_decoder_combined_fb.cc \ - trellis_pccc_decoder_combined_fi.cc \ - trellis_pccc_decoder_combined_fs.cc \ - trellis_pccc_decoder_i.cc \ - trellis_pccc_decoder_s.cc \ - trellis_pccc_encoder_bb.cc \ - trellis_pccc_encoder_bi.cc \ - trellis_pccc_encoder_bs.cc \ - trellis_pccc_encoder_ii.cc \ - trellis_pccc_encoder_si.cc \ - trellis_pccc_encoder_ss.cc \ - trellis_sccc_decoder_b.cc \ - trellis_sccc_decoder_combined_cb.cc \ - trellis_sccc_decoder_combined_ci.cc \ - trellis_sccc_decoder_combined_cs.cc \ - trellis_sccc_decoder_combined_fb.cc \ - trellis_sccc_decoder_combined_fi.cc \ - trellis_sccc_decoder_combined_fs.cc \ - trellis_sccc_decoder_i.cc \ - trellis_sccc_decoder_s.cc \ - trellis_sccc_encoder_bb.cc \ - trellis_sccc_encoder_bi.cc \ - trellis_sccc_encoder_bs.cc \ - trellis_sccc_encoder_ii.cc \ - trellis_sccc_encoder_si.cc \ - trellis_sccc_encoder_ss.cc \ - trellis_viterbi_b.cc \ - trellis_viterbi_combined_cb.cc \ - trellis_viterbi_combined_ci.cc \ - trellis_viterbi_combined_cs.cc \ - trellis_viterbi_combined_fb.cc \ - trellis_viterbi_combined_fi.cc \ - trellis_viterbi_combined_fs.cc \ - trellis_viterbi_combined_ib.cc \ - trellis_viterbi_combined_ii.cc \ - trellis_viterbi_combined_is.cc \ - trellis_viterbi_combined_sb.cc \ - trellis_viterbi_combined_si.cc \ - trellis_viterbi_combined_ss.cc \ - trellis_viterbi_i.cc \ - trellis_viterbi_s.cc - diff --git a/gr-trellis/src/lib/base.cc b/gr-trellis/src/lib/base.cc deleted file mode 100644 index 002c964cd..000000000 --- a/gr-trellis/src/lib/base.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cstdio> -#include <stdexcept> -#include <cmath> -#include "base.h" - - -bool dec2base(unsigned int num, int base, std::vector<int> &s) -{ - int l = s.size(); - unsigned int n=num; - for(int i=0;i<l;i++) { - s[l-i-1] = n % base; //MSB first - n /= base; - } - if(n!=0) { - printf("Number %d requires more than %d digits.",num,l); - return false; - } - else - return true; -} - - -unsigned int base2dec(const std::vector<int> &s, int base) -{ - int l = s.size(); - unsigned int num=0; - for(int i=0;i<l;i++) - num=num*base+s[i]; - return num; -} - - -bool dec2bases(unsigned int num, const std::vector<int> &bases, std::vector<int> &s) -{ - int l = s.size(); - unsigned int n=num; - for(int i=0;i<l;i++) { - s[l-i-1] = n % bases[l-i-1]; - n /= bases[l-i-1]; - } - if(n!=0) { - printf("Number %d requires more than %d digits.",num,l); - return false; - } - else - return true; -} - - - -unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> &bases) -{ - int l = s.size(); - unsigned int num=0; - for(int i=0;i<l;i++) - num = num * bases[i] + s[i]; - return num; -} - - - - - - - - - - - diff --git a/gr-trellis/src/lib/base.h b/gr-trellis/src/lib/base.h deleted file mode 100644 index aa407cbec..000000000 --- a/gr-trellis/src/lib/base.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 INCLUDED_TRELLIS_BASE_H -#define INCLUDED_TRELLIS_BASE_H - -#include <vector> - -/*! - * \brief change base - */ - - -bool dec2base(unsigned int num, int base, std::vector<int> &s); -bool dec2bases(unsigned int num, const std::vector<int> &bases, std::vector<int> &s); -unsigned int base2dec(const std::vector<int> &s, int base); -unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> &bases); - -#endif diff --git a/gr-trellis/src/lib/calc_metric.cc b/gr-trellis/src/lib/calc_metric.cc deleted file mode 100644 index ce628209b..000000000 --- a/gr-trellis/src/lib/calc_metric.cc +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#include <float.h> -#include <stdexcept> -#include "calc_metric.h" - - - -template <class T> -void calc_metric(int O, int D, const std::vector<T> &TABLE, const T *in, float *metric, trellis_metric_type_t type) -{ - float minm = FLT_MAX; - int minmi = 0; - - - switch (type){ - case TRELLIS_EUCLIDEAN: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - T s=in[m]-TABLE[o*D+m]; - //gr_complex sc(1.0*s,0); - //metric[o]+=(sc*conj(sc)).real(); - metric[o]+= s * s; - } - } - break; - case TRELLIS_HARD_SYMBOL: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - T s=in[m]-TABLE[o*D+m]; - //gr_complex sc(1.0*s,0); - //metric[o]+=(sc*conj(sc)).real(); - metric[o]+= s * s; - } - if(metric[o]<minm) { - minm=metric[o]; - minmi=o; - } - } - for(int o=0;o<O;o++) { - metric[o] = (o==minmi?0.0:1.0); - } - break; - case TRELLIS_HARD_BIT: - throw std::runtime_error ("Invalid metric type (not yet implemented)."); - break; - default: - throw std::runtime_error ("Invalid metric type."); - } -} - - - -template -void calc_metric<short>(int O, int D, const std::vector<short> &TABLE, const short *in, float *metric, trellis_metric_type_t type); - -template -void calc_metric<int>(int O, int D, const std::vector<int> &TABLE, const int *in, float *metric, trellis_metric_type_t type); - -template -void calc_metric<float>(int O, int D, const std::vector<float> &TABLE, const float *in, float *metric, trellis_metric_type_t type); - - -/* -void calc_metric(int O, int D, const std::vector<short> &TABLE, const short *in, float *metric, trellis_metric_type_t type) -{ - float minm = FLT_MAX; - int minmi = 0; - - switch (type){ - case TRELLIS_EUCLIDEAN: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - } - break; - case TRELLIS_HARD_SYMBOL: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - if(metric[o]<minm) { - minm=metric[o]; - minmi=o; - } - } - for(int o=0;o<O;o++) { - metric[o] = (o==minmi?0.0:1.0); - } - break; - case TRELLIS_HARD_BIT: - throw std::runtime_error ("Invalid metric type (not yet implemented)."); - break; - default: - throw std::runtime_error ("Invalid metric type."); - } -} - - -void calc_metric(int O, int D, const std::vector<int> &TABLE, const int *in, float *metric, trellis_metric_type_t type) -{ - float minm = FLT_MAX; - int minmi = 0; - - switch (type){ - case TRELLIS_EUCLIDEAN: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - } - break; - case TRELLIS_HARD_SYMBOL: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - if(metric[o]<minm) { - minm=metric[o]; - minmi=o; - } - } - for(int o=0;o<O;o++) { - metric[o] = (o==minmi?0.0:1.0); - } - break; - case TRELLIS_HARD_BIT: - throw std::runtime_error ("Invalid metric type (not yet implemented)."); - break; - default: - throw std::runtime_error ("Invalid metric type."); - } -} - - - -void calc_metric(int O, int D, const std::vector<float> &TABLE, const float *in, float *metric, trellis_metric_type_t type) -{ - float minm = FLT_MAX; - int minmi = 0; - - switch (type){ - case TRELLIS_EUCLIDEAN: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - } - break; - case TRELLIS_HARD_SYMBOL: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - if(metric[o]<minm) { - minm=metric[o]; - minmi=o; - } - } - for(int o=0;o<O;o++) { - metric[o] = (o==minmi?0.0:1.0); - } - break; - case TRELLIS_HARD_BIT: - throw std::runtime_error ("Invalid metric type (not yet implemented)."); - break; - default: - throw std::runtime_error ("Invalid metric type."); - } -} -*/ - - - - - -void calc_metric(int O, int D, const std::vector<gr_complex> &TABLE, const gr_complex *in, float *metric, trellis_metric_type_t type) -{ - float minm = FLT_MAX; - int minmi = 0; - - - switch (type){ - case TRELLIS_EUCLIDEAN: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - gr_complex s=in[m]-TABLE[o*D+m]; - metric[o]+=s.real()*s.real()+s.imag()*s.imag(); - } - } - break; - case TRELLIS_HARD_SYMBOL: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - gr_complex s=in[m]-TABLE[o*D+m]; - metric[o]+=s.real()*s.real()+s.imag()*s.imag(); - } - if(metric[o]<minm) { - minm=metric[o]; - minmi=o; - } - } - for(int o=0;o<O;o++) { - metric[o] = (o==minmi?0.0:1.0); - } - break; - case TRELLIS_HARD_BIT: - throw std::runtime_error ("Invalid metric type (not yet implemented)."); - break; - default: - throw std::runtime_error ("Invalid metric type."); - } -} diff --git a/gr-trellis/src/lib/calc_metric.h b/gr-trellis/src/lib/calc_metric.h deleted file mode 100644 index 7cad6160a..000000000 --- a/gr-trellis/src/lib/calc_metric.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 INCLUDED_CALC_METRIC_H -#define INCLUDED_CALC_METRIC_H - -#include <vector> -#include <gr_complex.h> -#include <digital_metric_type.h> - - -template <class T> -void calc_metric(int O, int D, const std::vector<T> &TABLE, const T *in, float *metric, trellis_metric_type_t type); - -/* -void calc_metric(int O, int D, const std::vector<short> &TABLE, const short *in, float *metric, trellis_metric_type_t type); - -void calc_metric(int O, int D, const std::vector<int> &TABLE, const int *in, float *metric, trellis_metric_type_t type); - -void calc_metric(int O, int D, const std::vector<float> &TABLE, const float *in, float *metric, trellis_metric_type_t type); -*/ - -void calc_metric(int O, int D, const std::vector<gr_complex> &TABLE, const gr_complex *in, float *metric, trellis_metric_type_t type); - - - -#endif diff --git a/gr-trellis/src/lib/core_algorithms.cc b/gr-trellis/src/lib/core_algorithms.cc deleted file mode 100644 index 3ed912c08..000000000 --- a/gr-trellis/src/lib/core_algorithms.cc +++ /dev/null @@ -1,1437 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#include <cstring> -#include <stdexcept> -//#include <cstdio> -#include <iostream> -#include "core_algorithms.h" -#include "calc_metric.h" - -static const float INF = 1.0e9; - -float min(float a, float b) -{ - return a <= b ? a : b; -} - -float min_star(float a, float b) -{ - return (a <= b ? a : b)-log(1+exp(a <= b ? a-b : b-a)); -} - - - - -template <class T> -void viterbi_algorithm(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - const float *in, T *out)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - int alphai; - float norm,mm,minm; - int minmi; - int st; - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (T) PI[st][i0]; - st=PS[st][i0]; - } - -} - - -template -void viterbi_algorithm<unsigned char>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - const float *in, unsigned char *out); - - -template -void viterbi_algorithm<short>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - const float *in, short *out); - -template -void viterbi_algorithm<int>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - const float *in, int *out); - - - -//============================================== - -template <class Ti, class To> -void viterbi_algorithm_combined(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<Ti> &TABLE, - trellis_metric_type_t TYPE, - const Ti *in, To *out -) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - float *metric = new float[O]; - int alphai; - float norm,mm,minm; - int minmi; - int st; - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - calc_metric(O, D, TABLE, &(in[k*D]), metric,TYPE); // calc metrics - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+metric[OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (To) PI[st][i0]; - st=PS[st][i0]; - } - - delete [] metric; - -} - -// Ti = s i f c -// To = b s i - -//--------------- - -template -void viterbi_algorithm_combined<short,unsigned char>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<short> &TABLE, - trellis_metric_type_t TYPE, - const short *in, unsigned char *out -); - -template -void viterbi_algorithm_combined<int,unsigned char>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<int> &TABLE, - trellis_metric_type_t TYPE, - const int *in, unsigned char *out -); - -template -void viterbi_algorithm_combined<float,unsigned char>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE, - const float *in, unsigned char *out -); - -template -void viterbi_algorithm_combined<gr_complex,unsigned char>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<gr_complex> &TABLE, - trellis_metric_type_t TYPE, - const gr_complex *in, unsigned char *out -); - -//--------------- - -template -void viterbi_algorithm_combined<short,short>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<short> &TABLE, - trellis_metric_type_t TYPE, - const short *in, short *out -); - -template -void viterbi_algorithm_combined<int,short>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<int> &TABLE, - trellis_metric_type_t TYPE, - const int *in, short *out -); - -template -void viterbi_algorithm_combined<float,short>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE, - const float *in, short *out -); - -template -void viterbi_algorithm_combined<gr_complex,short>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<gr_complex> &TABLE, - trellis_metric_type_t TYPE, - const gr_complex *in, short *out -); - -//-------------- - -template -void viterbi_algorithm_combined<short,int>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<short> &TABLE, - trellis_metric_type_t TYPE, - const short *in, int *out -); - -template -void viterbi_algorithm_combined<int,int>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<int> &TABLE, - trellis_metric_type_t TYPE, - const int *in, int *out -); - -template -void viterbi_algorithm_combined<float,int>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE, - const float *in, int *out -); - -template -void viterbi_algorithm_combined<gr_complex,int>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<gr_complex> &TABLE, - trellis_metric_type_t TYPE, - const gr_complex *in, int *out -); - - - - - - - - - - - - - - - - - - - - -//=============================================== - - -void siso_algorithm(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - const float *priori, const float *prioro, float *post//, - //std::vector<float> &alpha, - //std::vector<float> &beta - ) -{ - float norm,mm,minm; - std::vector<float> alpha(S*(K+1)); - std::vector<float> beta(S*(K+1)); - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - for(int k=0;k<K;k++) { // forward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]]; - minm=(*p2mymin)(minm,mm); - } - alpha[(k+1)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode - } - - if(SK<0) { // final state not specified - for(int i=0;i<S;i++) beta[K*S+i]=0; - } - else { - for(int i=0;i<S;i++) beta[K*S+i]=INF; - beta[K*S+SK]=0.0; - } - - for(int k=K-1;k>=0;k--) { // backward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(int i=0;i<I;i++) { - int i0 = j*I+i; - mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]]; - minm=(*p2mymin)(minm,mm); - } - beta[k*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - beta[k*S+j]-=norm; // normalize total metrics so they do not explode - } - - -if (POSTI && POSTO) -{ - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*(I+O)+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*(I+O)+i]-=norm; // normalize metrics - } - - - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*(I+O)+I+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*(I+O)+I+n]-=norm; // normalize metrics - } -} -else if(POSTI) -{ - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*I+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*I+i]-=norm; // normalize metrics - } -} -else if(POSTO) -{ - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*O+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*O+n]-=norm; // normalize metrics - } -} -else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - -} - - -//=========================================================== - -template <class T> -void siso_algorithm_combined(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - int D, - const std::vector<T> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const T *observations, float *post -) -{ - float norm,mm,minm; - std::vector<float> alpha(S*(K+1)); - std::vector<float> beta(S*(K+1)); - float *prioro = new float[O*K]; - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - for(int k=0;k<K;k++) { // forward recursion - calc_metric(O, D, TABLE, &(observations[k*D]), &(prioro[k*O]),TYPE); // calc metrics - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]]; - minm=(*p2mymin)(minm,mm); - } - alpha[(k+1)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode - } - - if(SK<0) { // final state not specified - for(int i=0;i<S;i++) beta[K*S+i]=0; - } - else { - for(int i=0;i<S;i++) beta[K*S+i]=INF; - beta[K*S+SK]=0.0; - } - - for(int k=K-1;k>=0;k--) { // backward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(int i=0;i<I;i++) { - int i0 = j*I+i; - mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]]; - minm=(*p2mymin)(minm,mm); - } - beta[k*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - beta[k*S+j]-=norm; // normalize total metrics so they do not explode - } - - - if (POSTI && POSTO) - { - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*(I+O)+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*(I+O)+i]-=norm; // normalize metrics - } - - - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*(I+O)+I+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*(I+O)+I+n]-=norm; // normalize metrics - } - } - else if(POSTI) - { - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*I+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*I+i]-=norm; // normalize metrics - } - } - else if(POSTO) - { - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*O+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*O+n]-=norm; // normalize metrics - } - } - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - - delete [] prioro; - -} - -//--------- - -template -void siso_algorithm_combined<short>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - int D, - const std::vector<short> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const short *observations, float *post -); - -template -void siso_algorithm_combined<int>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - int D, - const std::vector<int> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const int *observations, float *post -); - -template -void siso_algorithm_combined<float>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const float *observations, float *post -); - -template -void siso_algorithm_combined<gr_complex>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - int D, - const std::vector<gr_complex> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const gr_complex *observations, float *post -); - -//========================================================= - -template<class Ti, class To> -void sccc_decoder_combined( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<Ti> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const Ti *observations, To *data -) -{ - -//allocate space for priori, prioro and posti of inner FSM -std::vector<float> ipriori(blocklength*FSMi.I(),0.0); -std::vector<float> iprioro(blocklength*FSMi.O()); -std::vector<float> iposti(blocklength*FSMi.I()); - -//allocate space for priori, prioro and posto of outer FSM -std::vector<float> opriori(blocklength*FSMo.I(),0.0); -std::vector<float> oprioro(blocklength*FSMo.O()); -std::vector<float> oposti(blocklength*FSMo.I()); -std::vector<float> oposto(blocklength*FSMo.O()); - -// turn observations to neg-log-priors -for(int k=0;k<blocklength;k++) { - calc_metric(FSMi.O(), D, TABLE, &(observations[k*D]), &(iprioro[k*FSMi.O()]),METRIC_TYPE); - iprioro[k*FSMi.O()] *= scaling; -} - -for(int rep=0;rep<iterations;rep++) { - // run inner SISO - siso_algorithm(FSMi.I(),FSMi.S(),FSMi.O(), - FSMi.NS(), FSMi.OS(), FSMi.PS(), FSMi.PI(), - blocklength, - STi0,STiK, - true, false, - p2mymin, - &(ipriori[0]), &(iprioro[0]), &(iposti[0]) - ); - - //interleave soft info inner -> outer - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.DEINTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i]; - //} - memcpy(&(oprioro[k*FSMi.I()]),&(iposti[ki*FSMi.I()]),FSMi.I()*sizeof(float)); - } - - // run outer SISO - - if(rep<iterations-1) { // do not produce posti - siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - false, true, - p2mymin, - &(opriori[0]), &(oprioro[0]), &(oposto[0]) - ); - - //interleave soft info outer --> inner - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.DEINTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i]; - //} - memcpy(&(ipriori[ki*FSMi.I()]),&(oposto[k*FSMi.I()]),FSMi.I()*sizeof(float)); - } - } - else // produce posti but not posto - - siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - true, false, - p2mymin, - &(opriori[0]), &(oprioro[0]), &(oposti[0]) - ); - - /* - viterbi_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - &(oprioro[0]), data - ); - */ - -} - - -// generate hard decisions -for(int k=0;k<blocklength;k++) { - float min=INF; - int mini=0; - for(int i=0;i<FSMo.I();i++) { - if(oposti[k*FSMo.I()+i]<min) { - min=oposti[k*FSMo.I()+i]; - mini=i; - } - } - data[k]=(To)mini; -} - - - -} - -//------- - -template -void sccc_decoder_combined<float,unsigned char>( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, unsigned char *data -); - -template -void sccc_decoder_combined<float,short>( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, short *data -); - -template -void sccc_decoder_combined<float,int>( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, int *data -); - -template -void sccc_decoder_combined<gr_complex,unsigned char>( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, unsigned char *data -); - -template -void sccc_decoder_combined<gr_complex,short>( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, short *data -); - -template -void sccc_decoder_combined<gr_complex,int>( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, int *data -); - - - -//========================================================= - -template<class T> -void sccc_decoder( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *iprioro, T *data -) -{ - //allocate space for priori, and posti of inner FSM - std::vector<float> ipriori(blocklength*FSMi.I(),0.0); - std::vector<float> iposti(blocklength*FSMi.I()); - - //allocate space for priori, prioro and posto of outer FSM - std::vector<float> opriori(blocklength*FSMo.I(),0.0); - std::vector<float> oprioro(blocklength*FSMo.O()); - std::vector<float> oposti(blocklength*FSMo.I()); - std::vector<float> oposto(blocklength*FSMo.O()); - - for(int rep=0;rep<iterations;rep++) { - // run inner SISO - siso_algorithm(FSMi.I(),FSMi.S(),FSMi.O(), - FSMi.NS(), FSMi.OS(), FSMi.PS(), FSMi.PI(), - blocklength, - STi0,STiK, - true, false, - p2mymin, - &(ipriori[0]), &(iprioro[0]), &(iposti[0]) - ); - - //interleave soft info inner -> outer - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.DEINTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i]; - //} - memcpy(&(oprioro[k*FSMi.I()]),&(iposti[ki*FSMi.I()]),FSMi.I()*sizeof(float)); - } - - // run outer SISO - - if(rep<iterations-1) { // do not produce posti - siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - false, true, - p2mymin, - &(opriori[0]), &(oprioro[0]), &(oposto[0]) - ); - - //interleave soft info outer --> inner - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.DEINTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i]; - //} - memcpy(&(ipriori[ki*FSMi.I()]),&(oposto[k*FSMi.I()]),FSMi.I()*sizeof(float)); - } - } - else {// produce posti but not posto - - siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - true, false, - p2mymin, - &(opriori[0]), &(oprioro[0]), &(oposti[0]) - ); - - /* - viterbi_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - &(oprioro[0]), data - ); - */ - } - - } // end iterations - - // generate hard decisions - for(int k=0;k<blocklength;k++) { - float min=INF; - int mini=0; - for(int i=0;i<FSMo.I();i++) { - if(oposti[k*FSMo.I()+i]<min) { - min=oposti[k*FSMo.I()+i]; - mini=i; - } - } - data[k]=(T)mini; - } - - - -} - -//------- - -template -void sccc_decoder<unsigned char>( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *iprioro, unsigned char *data -); - -template -void sccc_decoder<short>( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *iprioro, short *data -); - -template -void sccc_decoder<int>( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *iprioro, int *data -); - - -//==================================================== - -template<class T> -void pccc_decoder( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *cprioro, T *data -) -{ - - //allocate space for priori, prioro and posti of FSM1 - std::vector<float> priori1(blocklength*FSM1.I(),0.0); - std::vector<float> prioro1(blocklength*FSM1.O()); - std::vector<float> posti1(blocklength*FSM1.I()); - - //allocate space for priori, prioro and posti of FSM2 - std::vector<float> priori2(blocklength*FSM2.I(),0.0); - std::vector<float> prioro2(blocklength*FSM2.O()); - std::vector<float> posti2(blocklength*FSM2.I()); - - //generate prioro1,2 (metrics are not updated per iteration: this is not the best you can do...) - for (int k=0;k<blocklength;k++) { - //std::cout << k << std::endl; - for(int i=0;i<FSM1.O();i++) { - float x=cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+0]; - for(int j=1;j<FSM2.O();j++) - x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+j]); - prioro1[k*FSM1.O()+i]=x; - //std::cout << prioro1[k*FSM1.O()+i] << ", "; - } - //std::cout << std::endl; - for(int i=0;i<FSM2.O();i++) { - float x=cprioro[k*FSM1.O()*FSM2.O()+0*FSM1.O()+i]; - for(int j=1;j<FSM1.O();j++) - x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+j*FSM1.O()+i]); - prioro2[k*FSM2.O()+i]=x; - } - } - - for(int rep=0;rep<iterations;rep++) { - // run SISO 1 - siso_algorithm(FSM1.I(),FSM1.S(),FSM1.O(), - FSM1.NS(), FSM1.OS(), FSM1.PS(), FSM1.PI(), - blocklength, - ST10,ST1K, - true, false, - p2mymin, - &(priori1[0]), &(prioro1[0]), &(posti1[0]) - ); - - //for(int k=0;k<blocklength;k++){ - //for(int i=0;i<FSM1.I();i++) - //std::cout << posti1[k*FSM1.I()+i] << ", "; - //std::cout << std::endl; - //} - - //interleave soft info 1 -> 2 - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.INTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i]; - //} - memcpy(&(priori2[k*FSM2.I()]),&(posti1[ki*FSM1.I()]),FSM1.I()*sizeof(float)); - } - - // run SISO 2 - siso_algorithm(FSM2.I(),FSM2.S(),FSM2.O(), - FSM2.NS(), FSM2.OS(), FSM2.PS(), FSM2.PI(), - blocklength, - ST20,ST2K, - true, false, - p2mymin, - &(priori2[0]), &(prioro2[0]), &(posti2[0]) - ); - - //interleave soft info 2 --> 1 - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.INTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i]; - //} - memcpy(&(priori1[ki*FSM1.I()]),&(posti2[k*FSM2.I()]),FSM1.I()*sizeof(float)); - } - - } // end iterations - - // generate hard decisions - for(int k=0;k<blocklength;k++) { - for(int i=0;i<FSM1.I();i++) - posti1[k*FSM1.I()+i] = (*p2mymin)(priori1[k*FSM1.I()+i],posti1[k*FSM1.I()+i]); - float min=INF; - int mini=0; - for(int i=0;i<FSM1.I();i++) { - if(posti1[k*FSM1.I()+i]<min) { - min=posti1[k*FSM1.I()+i]; - mini=i; - } - } - data[k]=(T)mini; - //std::cout << data[k] << ", "<< std::endl; - } - //std::cout << std::endl; - -} - -//---------------- - -template -void pccc_decoder<unsigned char>( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *cprioro, unsigned char *data -); - -template -void pccc_decoder<short>( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *cprioro, short *data -); - -template -void pccc_decoder<int>( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *cprioro, int *data -); - - - -//---------------- - - -template<class Ti, class To> -void pccc_decoder_combined( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<Ti> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const Ti *observations, To *data -) -{ - - //allocate space for cprioro - std::vector<float> cprioro(blocklength*FSM1.O()*FSM2.O(),0.0); - - //allocate space for priori, prioro and posti of FSM1 - std::vector<float> priori1(blocklength*FSM1.I(),0.0); - std::vector<float> prioro1(blocklength*FSM1.O()); - std::vector<float> posti1(blocklength*FSM1.I()); - - //allocate space for priori, prioro and posti of FSM2 - std::vector<float> priori2(blocklength*FSM2.I(),0.0); - std::vector<float> prioro2(blocklength*FSM2.O()); - std::vector<float> posti2(blocklength*FSM2.I()); - - // turn observations to neg-log-priors for cprioiro - int O=FSM1.O()*FSM2.O(); - for(int k=0;k<blocklength;k++) { - calc_metric(O, D, TABLE, &(observations[k*D]), &(cprioro[k*O]),METRIC_TYPE); - cprioro[k*O] *= scaling; - } - - //generate prioro1,2 (metrics are not updated per iteration: this is not the best you can do...) - for (int k=0;k<blocklength;k++) { - //std::cout << k << std::endl; - for(int i=0;i<FSM1.O();i++) { - float x=cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+0]; - for(int j=1;j<FSM2.O();j++) - x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+j]); - prioro1[k*FSM1.O()+i]=x; - //std::cout << prioro1[k*FSM1.O()+i] << ", "; - } - //std::cout << std::endl; - for(int i=0;i<FSM2.O();i++) { - float x=cprioro[k*FSM1.O()*FSM2.O()+0*FSM1.O()+i]; - for(int j=1;j<FSM1.O();j++) - x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+j*FSM1.O()+i]); - prioro2[k*FSM2.O()+i]=x; - } - } - - for(int rep=0;rep<iterations;rep++) { - // run SISO 1 - siso_algorithm(FSM1.I(),FSM1.S(),FSM1.O(), - FSM1.NS(), FSM1.OS(), FSM1.PS(), FSM1.PI(), - blocklength, - ST10,ST1K, - true, false, - p2mymin, - &(priori1[0]), &(prioro1[0]), &(posti1[0]) - ); - - //for(int k=0;k<blocklength;k++){ - //for(int i=0;i<FSM1.I();i++) - //std::cout << posti1[k*FSM1.I()+i] << ", "; - //std::cout << std::endl; - //} - - //interleave soft info 1 -> 2 - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.INTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i]; - //} - memcpy(&(priori2[k*FSM2.I()]),&(posti1[ki*FSM1.I()]),FSM1.I()*sizeof(float)); - } - - // run SISO 2 - siso_algorithm(FSM2.I(),FSM2.S(),FSM2.O(), - FSM2.NS(), FSM2.OS(), FSM2.PS(), FSM2.PI(), - blocklength, - ST20,ST2K, - true, false, - p2mymin, - &(priori2[0]), &(prioro2[0]), &(posti2[0]) - ); - - //interleave soft info 2 --> 1 - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.INTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i]; - //} - memcpy(&(priori1[ki*FSM1.I()]),&(posti2[k*FSM2.I()]),FSM1.I()*sizeof(float)); - } - - } // end iterations - - // generate hard decisions - for(int k=0;k<blocklength;k++) { - for(int i=0;i<FSM1.I();i++) - posti1[k*FSM1.I()+i] = (*p2mymin)(priori1[k*FSM1.I()+i],posti1[k*FSM1.I()+i]); - float min=INF; - int mini=0; - for(int i=0;i<FSM1.I();i++) { - if(posti1[k*FSM1.I()+i]<min) { - min=posti1[k*FSM1.I()+i]; - mini=i; - } - } - data[k]=(To)mini; - //std::cout << data[k] << ", "<< std::endl; - } - //std::cout << std::endl; - -} - - -template -void pccc_decoder_combined( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, unsigned char *data -); - - -template -void pccc_decoder_combined( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, short *data -); - - -template -void pccc_decoder_combined( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, int *data -); - - -template -void pccc_decoder_combined( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, unsigned char *data -); - - -template -void pccc_decoder_combined( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, short *data -); - - -template -void pccc_decoder_combined( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, int *data -); diff --git a/gr-trellis/src/lib/core_algorithms.h b/gr-trellis/src/lib/core_algorithms.h deleted file mode 100644 index a8765225b..000000000 --- a/gr-trellis/src/lib/core_algorithms.h +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 INCLUDED_CORE_ALGORITHMS_H -#define INCLUDED_CORE_ALGORITHMS_H - -#include <cmath> -#include <vector> -//#include <gr_complex.h> -#include "digital_metric_type.h" -#include "fsm.h" -#include "interleaver.h" - - -float min(float a, float b); -float min_star(float a, float b); - -template <class T> -void viterbi_algorithm(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - const float *in, T *out -); - -template <class Ti, class To> -void viterbi_algorithm_combined(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<Ti> &TABLE, - trellis_metric_type_t TYPE, - const Ti *in, To *out -); - - - -void siso_algorithm(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - const float *priori, const float *prioro, float *post -); - - -template <class T> -void siso_algorithm_combined(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - int D, - const std::vector<T> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const T *observations, float *post -); - - -template<class T> -void sccc_decoder( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *iprioro, T *data -); - - -template<class Ti, class To> -void sccc_decoder_combined( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<Ti> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const Ti *observations, To *data -); - -template<class T> -void pccc_decoder( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *cprioro, T *data -); - -template<class Ti, class To> -void pccc_decoder_combined( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<Ti> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const Ti *observations, To *data -); - - - - -#endif diff --git a/gr-trellis/src/lib/fsm.cc b/gr-trellis/src/lib/fsm.cc deleted file mode 100644 index fb2b4d2c9..000000000 --- a/gr-trellis/src/lib/fsm.cc +++ /dev/null @@ -1,548 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cstdio> -#include <string> -#include <iostream> -#include <fstream> -#include <stdexcept> -#include <cmath> -#include <stdlib.h> -#include "base.h" -#include "fsm.h" - - -fsm::fsm() -{ - d_I=0; - d_S=0; - d_O=0; - d_NS.resize(0); - d_OS.resize(0); - d_PS.resize(0); - d_PI.resize(0); - d_TMi.resize(0); - d_TMl.resize(0); -} - -fsm::fsm(const fsm &FSM) -{ - d_I=FSM.I(); - d_S=FSM.S(); - d_O=FSM.O(); - d_NS=FSM.NS(); - d_OS=FSM.OS(); - d_PS=FSM.PS(); // is this going to make a deep copy? - d_PI=FSM.PI(); - d_TMi=FSM.TMi(); - d_TMl=FSM.TMl(); -} - -fsm::fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS) -{ - d_I=I; - d_S=S; - d_O=O; - d_NS=NS; - d_OS=OS; - - generate_PS_PI(); - generate_TM(); -} - -//###################################################################### -//# Read an FSM specification from a file. -//# Format (hopefully will become more flexible in the future...): -//# I S O (in the first line) -//# blank line -//# Next state matrix (S lines, each with I integers separated by spaces) -//# blank line -//# output symbol matrix (S lines, each with I integers separated by spaces) -//# optional comments -//###################################################################### -fsm::fsm(const char *name) -{ - FILE *fsmfile; - - if((fsmfile=fopen(name,"r"))==NULL) - throw std::runtime_error ("fsm::fsm(const char *name): file open error\n"); - //printf("file open error in fsm()\n"); - - if(fscanf(fsmfile,"%d %d %d\n",&d_I,&d_S,&d_O) == EOF) { - if(ferror(fsmfile) != 0) - throw std::runtime_error ("fsm::fsm(const char *name): file read error\n"); - } - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - - for(int i=0;i<d_S;i++) { - for(int j=0;j<d_I;j++) { - if(fscanf(fsmfile,"%d",&(d_NS[i*d_I+j])) == EOF) { - if(ferror(fsmfile) != 0) - throw std::runtime_error ("fsm::fsm(const char *name): file read error\n"); - } - } - } - for(int i=0;i<d_S;i++) { - for(int j=0;j<d_I;j++) { - if(fscanf(fsmfile,"%d",&(d_OS[i*d_I+j])) == EOF) { - if(ferror(fsmfile) != 0) - throw std::runtime_error ("fsm::fsm(const char *name): file read error\n"); - } - } - } - - fclose(fsmfile); - - generate_PS_PI(); - generate_TM(); -} - - - -//###################################################################### -//# Automatically generate the FSM from the generator matrix -//# of a (n,k) binary convolutional code -//###################################################################### -fsm::fsm(int k, int n, const std::vector<int> &G) -{ - - // calculate maximum memory requirements for each input stream - std::vector<int> max_mem_x(k,-1); - int max_mem = -1; - for(int i=0;i<k;i++) { - for(int j=0;j<n;j++) { - int mem = -1; - if(G[i*n+j]!=0) - mem=(int)(log(double(G[i*n+j]))/log(2.0)); - if(mem>max_mem_x[i]) - max_mem_x[i]=mem; - if(mem>max_mem) - max_mem=mem; - } - } - -//printf("max_mem_x\n"); -//for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n"); - - // calculate total memory requirements to set S - int sum_max_mem = 0; - for(int i=0;i<k;i++) - sum_max_mem += max_mem_x[i]; - -//printf("sum_max_mem = %d\n",sum_max_mem); - - d_I=1<<k; - d_S=1<<sum_max_mem; - d_O=1<<n; - - // binary representation of the G matrix - std::vector<std::vector<int> > Gb(k*n); - for(int j=0;j<k*n;j++) { - Gb[j].resize(max_mem+1); - dec2base(G[j],2,Gb[j]); -//printf("Gb\n"); -//for(int m=0;m<Gb[j].size();m++) printf("%d ",Gb[j][m]); printf("\n"); - } - - // alphabet size of each shift register - std::vector<int> bases_x(k); - for(int j=0;j<k ;j++) - bases_x[j] = 1 << max_mem_x[j]; -//printf("bases_x\n"); -//for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n"); - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - - std::vector<int> sx(k); - std::vector<int> nsx(k); - std::vector<int> tx(k); - std::vector<std::vector<int> > tb(k); - for(int j=0;j<k;j++) - tb[j].resize(max_mem+1); - std::vector<int> inb(k); - std::vector<int> outb(n); - - - for(int s=0;s<d_S;s++) { - dec2bases(s,bases_x,sx); // split s into k values, each representing one of the k shift registers -//printf("state = %d \nstates = ",s); -//for(int j=0;j<sx.size();j++) printf("%d ",sx[j]); printf("\n"); - for(int i=0;i<d_I;i++) { - dec2base(i,2,inb); // input in binary -//printf("input = %d \ninputs = ",i); -//for(int j=0;j<inb.size();j++) printf("%d ",inb[j]); printf("\n"); - - // evaluate next state - for(int j=0;j<k;j++) - nsx[j] = (inb[j]*bases_x[j]+sx[j])/2; // next state (for each shift register) MSB first - d_NS[s*d_I+i]=bases2dec(nsx,bases_x); // collect all values into the new state - - // evaluate transitions - for(int j=0;j<k;j++) - tx[j] = inb[j]*bases_x[j]+sx[j]; // transition (for each shift register)MSB first - for(int j=0;j<k;j++) { - dec2base(tx[j],2,tb[j]); // transition in binary -//printf("transition = %d \ntransitions = ",tx[j]); -//for(int m=0;m<tb[j].size();m++) printf("%d ",tb[j][m]); printf("\n"); - } - - // evaluate outputs - for(int nn=0;nn<n;nn++) { - outb[nn] = 0; - for(int j=0;j<k;j++) { - for(int m=0;m<max_mem+1;m++) - outb[nn] = (outb[nn] + Gb[j*n+nn][m]*tb[j][m]) % 2; // careful: polynomial 1+D ir represented as 110, not as 011 -//printf("output %d equals %d\n",nn,outb[nn]); - } - } - d_OS[s*d_I+i] = base2dec(outb,2); - } - } - - generate_PS_PI(); - generate_TM(); -} - - - - -//###################################################################### -//# Automatically generate an FSM specification describing the -//# ISI for a channel -//# of length ch_length and a modulation of size mod_size -//###################################################################### -fsm::fsm(int mod_size, int ch_length) -{ - d_I=mod_size; - d_S=(int) (pow(1.0*d_I,1.0*ch_length-1)+0.5); - d_O=d_S*d_I; - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - - for(int s=0;s<d_S;s++) { - for(int i=0;i<d_I;i++) { - int t=i*d_S+s; - d_NS[s*d_I+i] = t/d_I; - d_OS[s*d_I+i] = t; - } - } - - generate_PS_PI(); - generate_TM(); -} - - - - -//###################################################################### -//# Automatically generate an FSM specification describing the -//# the trellis for a CPM with h=K/P (relatively prime), -//# alphabet size M, and frequency pulse duration L symbols -//# -//# This FSM is based on the paper by B. Rimoldi -//# "A decomposition approach to CPM", IEEE Trans. Info Theory, March 1988 -//# See also my own notes at http://www.eecs.umich.edu/~anastas/docs/cpm.pdf -//###################################################################### -fsm::fsm(int P, int M, int L) -{ - d_I=M; - d_S=(int)(pow(1.0*M,1.0*L-1)+0.5)*P; - d_O=(int)(pow(1.0*M,1.0*L)+0.5)*P; - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - int nv; - for(int s=0;s<d_S;s++) { - for(int i=0;i<d_I;i++) { - int s1=s/P; - int v=s%P; - int ns1= (i*(int)(pow(1.0*M,1.0*(L-1))+0.5)+s1)/M; - if (L==1) - nv=(i+v)%P; - else - nv=(s1%M+v)%P; - d_NS[s*d_I+i] = ns1*P+nv; - d_OS[s*d_I+i] = i*d_S+s; - } - } - - generate_PS_PI(); - generate_TM(); -} - - - - - - - - - - -//###################################################################### -//# Automatically generate an FSM specification describing the -//# the joint trellis of fsm1 and fsm2 -//###################################################################### -fsm::fsm(const fsm &FSM1, const fsm &FSM2) -{ - d_I=FSM1.I()*FSM2.I(); - d_S=FSM1.S()*FSM2.S(); - d_O=FSM1.O()*FSM2.O(); - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - - for(int s=0;s<d_S;s++) { - for(int i=0;i<d_I;i++) { - int s1=s/FSM2.S(); - int s2=s%FSM2.S(); - int i1=i/FSM2.I(); - int i2=i%FSM2.I(); - d_NS[s*d_I+i] = FSM1.NS()[s1 * FSM1.I() + i1] * FSM2.S() + FSM2.NS()[s2 * FSM2.I() + i2]; - d_OS[s*d_I+i] = FSM1.OS()[s1 * FSM1.I() + i1] * FSM2.O() + FSM2.OS()[s2 * FSM2.I() + i2]; - } - } - - generate_PS_PI(); - generate_TM(); -} - - - - -//###################################################################### -//# Generate a new FSM representing n stages through the original FSM -//# AKA radix-n FSM -//###################################################################### -fsm::fsm(const fsm &FSM, int n) -{ - d_I=(int) (pow(1.0*FSM.I(),1.0*n)+0.5); - d_S=FSM.S(); - d_O=(int) (pow(1.0*FSM.O(),1.0*n)+0.5); - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - - for(int s=0;s<d_S;s++ ) { - for(int i=0;i<d_I;i++ ) { - std::vector<int> ii(n); - dec2base(i,FSM.I(),ii); - std::vector<int> oo(n); - int ns=s; - for(int k=0;k<n;k++) { - oo[k]=FSM.OS()[ns*FSM.I()+ii[k]]; - ns=FSM.NS()[ns*FSM.I()+ii[k]]; - } - d_NS[s*d_I+i]=ns; - d_OS[s*d_I+i]=base2dec(oo,FSM.O()); - } - } - - generate_PS_PI(); - generate_TM(); -} - - - - - - - - - -//###################################################################### -//# generate the PS and PI tables for later use -//###################################################################### -void fsm::generate_PS_PI() -{ - d_PS.resize(d_S); - d_PI.resize(d_S); - - for(int i=0;i<d_S;i++) { - d_PS[i].resize(d_I*d_S); // max possible size - d_PI[i].resize(d_I*d_S); - int j=0; - for(int ii=0;ii<d_S;ii++) for(int jj=0;jj<d_I;jj++) { - if(d_NS[ii*d_I+jj]!=i) continue; - d_PS[i][j]=ii; - d_PI[i][j]=jj; - j++; - } - d_PS[i].resize(j); - d_PI[i].resize(j); - } -} - - -//###################################################################### -//# generate the termination matrices TMl and TMi for later use -//###################################################################### -void fsm::generate_TM() -{ - d_TMi.resize(d_S*d_S); - d_TMl.resize(d_S*d_S); - - for(int i=0;i<d_S*d_S;i++) { - d_TMi[i] = -1; // no meaning - d_TMl[i] = d_S; //infinity: you need at most S-1 steps - if (i/d_S == i%d_S) - d_TMl[i] = 0; - } - - for(int s=0;s<d_S;s++) { - bool done = false; - int attempts = 0; - while (done == false && attempts < d_S-1) { - done = find_es(s); - attempts ++; - } - if (done == false && d_S > 1) { - //throw std::runtime_error ("fsm::generate_TM(): FSM appears to be disconnected\n"); - printf("fsm::generate_TM(): FSM appears to be disconnected\n"); - printf("state %d cannot be reached from all other states\n",s); - } - } -} - - -// find a path from any state to the ending state "es" -bool fsm::find_es(int es) -{ - bool done = true; - for(int s=0;s<d_S;s++) { - if(d_TMl[s*d_S+es] < d_S) - continue; - int minl=d_S; - int mini=-1; - for(int i=0;i<d_I;i++) { - if( 1 + d_TMl[d_NS[s*d_I+i]*d_S+es] < minl) { - minl = 1 + d_TMl[d_NS[s*d_I+i]*d_S+es]; - mini = i; - } - } - if (mini != -1) { - d_TMl[s*d_S+es]=minl; - d_TMi[s*d_S+es]=mini; - } - else - done = false; - } - return done; -} - - - - - -//###################################################################### -//# generate trellis representation of FSM as an SVG file -//###################################################################### -void fsm::write_trellis_svg( std::string filename ,int number_stages) -{ - std::ofstream trellis_fname (filename.c_str()); - if (!trellis_fname) {std::cout << "file not found " << std::endl ; exit(-1);} - const int TRELLIS_Y_OFFSET = 30; - const int TRELLIS_X_OFFSET = 20; - const int STAGE_LABEL_Y_OFFSET = 25; - const int STAGE_LABEL_X_OFFSET = 20; - const int STATE_LABEL_Y_OFFSET = 30; - const int STATE_LABEL_X_OFFSET = 5; - const int STAGE_STATE_OFFSETS = 10; -// std::cout << "################## BEGIN SVG TRELLIS PIC #####################" << std::endl; - trellis_fname << "<svg viewBox = \"0 0 200 200\" version = \"1.1\">" << std::endl; - - for( int stage_num = 0;stage_num < number_stages;stage_num ++){ - // draw states - for ( int state_num = 0;state_num < d_S ; state_num ++ ) { - trellis_fname << "<circle cx = \"" << stage_num * STAGE_STATE_OFFSETS + TRELLIS_X_OFFSET << - "\" cy = \"" << state_num * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET << "\" r = \"1\"/>" << std::endl; - //draw branches - if(stage_num != number_stages-1){ - for( int branch_num = 0;branch_num < d_I; branch_num++){ - trellis_fname << "<line x1 =\"" << STAGE_STATE_OFFSETS * stage_num+ TRELLIS_X_OFFSET << "\" "; - trellis_fname << "y1 =\"" << state_num * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET<< "\" "; - trellis_fname << "x2 =\"" << STAGE_STATE_OFFSETS *stage_num + STAGE_STATE_OFFSETS+ TRELLIS_X_OFFSET << "\" "; - trellis_fname << "y2 =\"" << d_NS[d_I * state_num + branch_num] * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET << "\" "; - trellis_fname << " stroke-dasharray = \"3," << branch_num << "\" "; - trellis_fname << " stroke = \"black\" stroke-width = \"0.3\"/>" << std::endl; - } - } - } - } - // label the stages - trellis_fname << "<g font-size = \"4\" font= \"times\" fill = \"black\">" << std::endl; - for( int stage_num = 0;stage_num < number_stages ;stage_num ++){ - trellis_fname << "<text x = \"" << stage_num * STAGE_STATE_OFFSETS + STAGE_LABEL_X_OFFSET << - "\" y = \"" << STAGE_LABEL_Y_OFFSET << "\" >" << std::endl; - trellis_fname << stage_num << std::endl; - trellis_fname << "</text>" << std::endl; - } - trellis_fname << "</g>" << std::endl; - - // label the states - trellis_fname << "<g font-size = \"4\" font= \"times\" fill = \"black\">" << std::endl; - for( int state_num = 0;state_num < d_S ; state_num ++){ - trellis_fname << "<text y = \"" << state_num * STAGE_STATE_OFFSETS + STATE_LABEL_Y_OFFSET << - "\" x = \"" << STATE_LABEL_X_OFFSET << "\" >" << std::endl; - trellis_fname << state_num << std::endl; - trellis_fname << "</text>" << std::endl; - } - trellis_fname << "</g>" << std::endl; - - - trellis_fname << "</svg>" << std::endl; -// std::cout << "################## END SVG TRELLIS PIC ##################### " << std::endl; - trellis_fname.close(); -} - - - - - - -//###################################################################### -//# Write trellis specification to a text file, -//# in the same format used when reading FSM files -//###################################################################### -void fsm::write_fsm_txt(std::string filename) -{ - std::ofstream trellis_fname (filename.c_str()); - if (!trellis_fname) {std::cout << "file not found " << std::endl ; exit(-1);} - trellis_fname << d_I << ' ' << d_S << ' ' << d_O << std::endl; - trellis_fname << std::endl; - for(int i=0;i<d_S;i++) { - for(int j=0;j<d_I;j++) trellis_fname << d_NS[i*d_I+j] << ' '; - trellis_fname << std::endl; - } - trellis_fname << std::endl; - for(int i=0;i<d_S;i++) { - for(int j=0;j<d_I;j++) trellis_fname << d_OS[i*d_I+j] << ' '; - trellis_fname << std::endl; - } - trellis_fname << std::endl; - trellis_fname.close(); -} - diff --git a/gr-trellis/src/lib/fsm.h b/gr-trellis/src/lib/fsm.h deleted file mode 100644 index 47e467898..000000000 --- a/gr-trellis/src/lib/fsm.h +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2011 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 INCLUDED_TRELLIS_FSM_H -#define INCLUDED_TRELLIS_FSM_H - -#include <trellis_api.h> -#include <vector> -#include <iosfwd> - -/*! - * \brief Finite State Machine Specification class. - * - * An instance of this class represents a finite state machine specification (FSMS) - * rather than the FSM itself. It particular the state of the FSM - * is not stored within an instance of this class. - */ -class TRELLIS_API fsm { -private: - // Input alphabet cardinality. - int d_I; - // Number of states. - int d_S; - // Output alphabet cardinality. - int d_O; - // NS means Next State. - // next_state = d_NS[current_state * d_I + input_symbol] - std::vector<int> d_NS; - // OS means Output Symbol. - // output_symbol = d_OS[current_state * d_I + input_symbol] - std::vector<int> d_OS; - // PS means Previous State. - std::vector< std::vector<int> > d_PS; - // PI means Previous Input Symbol. - // d_PS[current_state][k] and d_PI[current_state][k], is a pair of the form - // (previous_state, previous_input_symbol) that could have produced the - // current state. - std::vector< std::vector<int> > d_PI; - // TM means Termination matrix. - // d_TMl[s*d_S+es] is the shortest number of steps to get from state s to - // state es. - std::vector<int> d_TMl; - // d_TMi[s*d_S+es] is the input symbol required to set off on the shortest - // path from state s to es. - std::vector<int> d_TMi; - void generate_PS_PI (); - void generate_TM (); - bool find_es(int es); -public: - /*! - * \brief Constructor to create an uninitialized FSMS. - */ - fsm(); - /*! - * \brief Constructor to copy an FSMS. - */ - fsm(const fsm &FSM); - /*! - * \brief Constructor to to create an FSMS. - * - * \param I The number of possible input symbols. - * \param S The number of possible FSM states. - * \param O The number of possible output symbols. - * \param NS A mapping from (current state, input symbol) to next state. - * next_state = NS[current_state * I + input_symbol] - * \param OS A mapping from (current state, input symbol) to output symbol. - * output_symbol = OS[current_state * I + input_symbol] - * - */ - fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS); - /*! - * \brief Constructor to create an FSMS from file contents. - * - * \param name filename - * - */ - fsm(const char *name); - /*! - * \brief Creates an FSMS from the generator matrix of a (n, k) binary convolutional code. - * - * \param k ??? - * \param n ??? - * \param G ??? - * - */ - fsm(int k, int n, const std::vector<int> &G); - /*! - * \brief Creates an FSMS describing ISI. - * - * \param mod_size modulation size - * \param ch_length channel length - * - */ - fsm(int mod_size, int ch_length); - /*! - * \brief Creates an FSMS describing the trellis for a CPM. - * - * \param P ???? h=K/P (relatively prime) - * \param M alphabet size - * \param L pulse duration - * - * This FSM is based on the paper by B. Rimoldi - * "A decomposition approach to CPM", IEEE Trans. Info Theory, March 1988 - * See also my own notes at http://www.eecs.umich.edu/~anastas/docs/cpm.pdf - */ - fsm(int P, int M, int L); - /*! - * \brief Creates an FSMS describing the joint trellis of two FSMs. - * - * \param FSM1 first FSMS - * \param FSM2 second FSMS - */ - fsm(const fsm &FSM1, const fsm &FSM2); - /*! - * \brief Creates an FSMS representing n stages through the originial FSM (AKA radix-n FSM). - * - * \param FSM Original FSMs - * \param n Number of stages. - */ - fsm(const fsm &FSM, int n); - int I () const { return d_I; } - int S () const { return d_S; } - int O () const { return d_O; } - const std::vector<int> & NS () const { return d_NS; } - const std::vector<int> & OS () const { return d_OS; } - const std::vector< std::vector<int> > & PS () const { return d_PS; } - const std::vector< std::vector<int> > & PI () const { return d_PI; } - const std::vector<int> & TMi () const { return d_TMi; } - const std::vector<int> & TMl () const { return d_TMl; } - /*! - * \brief Creates an svg image of the trellis representation. - * - * \param filename filename - * \param number_stages ???? - * - */ - void write_trellis_svg(std::string filename ,int number_stages); - /*! - * \brief Write the FSMS to a file. - * - * \param filename filename - * - */ - void write_fsm_txt(std::string filename); -}; - -#endif diff --git a/gr-trellis/src/lib/fsm.i b/gr-trellis/src/lib/fsm.i deleted file mode 100644 index 1e9c7ad8f..000000000 --- a/gr-trellis/src/lib/fsm.i +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -class fsm { -private: - int d_I; - int d_S; - int d_O; - std::vector<int> d_NS; - std::vector<int> d_OS; - std::vector< std::vector<int> > d_PS; - std::vector< std::vector<int> > d_PI; - std::vector<int> d_TMi; - std::vector<int> d_TMl; - void generate_PS_PI (); - void generate_TM (); -public: - fsm(); - fsm(const fsm &FSM); - fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS); - fsm(const char *name); - fsm(int k, int n, const std::vector<int> &G); - fsm(int mod_size, int ch_length); - fsm(int P, int M, int L); - fsm(const fsm &FSM1, const fsm &FSM2); - fsm(const fsm &FSM, int n); - int I () const { return d_I; } - int S () const { return d_S; } - int O () const { return d_O; } - const std::vector<int> & NS () const { return d_NS; } - const std::vector<int> & OS () const { return d_OS; } - // disable these accessors until we find out how to swig them - //const std::vector< std::vector<int> > & PS () const { return d_PS; } - //const std::vector< std::vector<int> > & PI () const { return d_PI; } - const std::vector<int> & TMi () const { return d_TMi; } - const std::vector<int> & TMl () const { return d_TMl; } - void fsm::write_trellis_svg(std::string filename ,int number_stages); - void fsm::write_fsm_txt(std::string filename); -}; - diff --git a/gr-trellis/src/lib/generate_all.py b/gr-trellis/src/lib/generate_all.py deleted file mode 100644 index 78e36270c..000000000 --- a/gr-trellis/src/lib/generate_all.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007 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. -# - -from build_utils import output_glue - -import generate_trellis - -def generate_all (): - generate_trellis.generate () - output_glue ('trellis') - -if __name__ == '__main__': - generate_all () diff --git a/gr-trellis/src/lib/generate_trellis.py b/gr-trellis/src/lib/generate_trellis.py deleted file mode 100644 index 60a81f77a..000000000 --- a/gr-trellis/src/lib/generate_trellis.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007 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. -# - -from build_utils import expand_template, copyright, open_and_log_name -from build_utils_codes import * -import re - -# regular blocks - -other_roots = [ - 'trellis_encoder_XX', - 'trellis_sccc_encoder_XX', - 'trellis_pccc_encoder_XX', - 'trellis_metrics_X', - 'trellis_viterbi_X', - 'trellis_viterbi_combined_XX', - 'trellis_sccc_decoder_X', - 'trellis_sccc_decoder_combined_XX', - 'trellis_pccc_decoder_X', - 'trellis_pccc_decoder_combined_XX', - ] - -other_signatures = ( - ['bb','bs','bi','ss','si','ii'], - ['bb','bs','bi','ss','si','ii'], - ['bb','bs','bi','ss','si','ii'], - ['s','i','f','c'], - ['b','s','i'], - ['sb','ss','si','ib','is','ii','fb','fs','fi','cb','cs','ci'], - ['b','s','i'], - ['fb','fs','fi','cb','cs','ci'], - ['b','s','i'], - ['fb','fs','fi','cb','cs','ci'], - ) - - -def is_byte (code3): - if i_code (code3) == 'b' or o_code (code3) == 'b': - return '1' - else: - return '0' - - -def is_short (code3): - if i_code (code3) == 's' or o_code (code3) == 's': - return '1' - else: - return '0' - - -def is_int (code3): - if i_code (code3) == 'i' or o_code (code3) == 'i': - return '1' - else: - return '0' - - -def is_float (code3): - if i_code (code3) == 'f' or o_code (code3) == 'f': - return '1' - else: - return '0' - - -def is_complex (code3): - if i_code (code3) == 'c' or o_code (code3) == 'c': - return '1' - else: - return '0' - - -def standard_dict (name, code3): - d = {} - d['NAME'] = name - d['GUARD_NAME'] = 'INCLUDED_%s_H' % name.upper () - d['BASE_NAME'] = re.sub ('^trellis_', '', name) - d['SPTR_NAME'] = '%s_sptr' % name - d['WARNING'] = 'WARNING: this file is machine generated. Edits will be over written' - d['COPYRIGHT'] = copyright - d['TYPE'] = i_type (code3) - d['I_TYPE'] = i_type (code3) - d['O_TYPE'] = o_type (code3) - d['TAP_TYPE'] = tap_type (code3) - d['IS_BYTE'] = is_byte (code3) - d['IS_SHORT'] = is_short (code3) - d['IS_INT'] = is_int (code3) - d['IS_FLOAT'] = is_float (code3) - d['IS_COMPLEX'] = is_complex (code3) - return d - - -def expand_h_cc_i (root, sig): - # root looks like 'gr_vector_sink_X' - name = re.sub ('X+', sig, root) - d = standard_dict (name, sig) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - - -def generate (): - i=0 - for r in other_roots : - for s in other_signatures[i]: - expand_h_cc_i (r, s) - i=i+1 - - -if __name__ == '__main__': - generate () diff --git a/gr-trellis/src/lib/interleaver.cc b/gr-trellis/src/lib/interleaver.cc deleted file mode 100644 index 740f33ab3..000000000 --- a/gr-trellis/src/lib/interleaver.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cstdlib> -#include <cstdio> -#include <iostream> -#include <string> -#include <fstream> -#include <stdexcept> -#include <cmath> -#include "quicksort_index.h" -#include "interleaver.h" - - - - -interleaver::interleaver() -{ - d_K=0; - d_INTER.resize(0); - d_DEINTER.resize(0); -} - -interleaver::interleaver(const interleaver &INTERLEAVER) -{ - d_K=INTERLEAVER.K(); - d_INTER=INTERLEAVER.INTER(); - d_DEINTER=INTERLEAVER.DEINTER(); -} - -interleaver::interleaver(int K, const std::vector<int> &INTER) -{ - d_K=K; - d_INTER=INTER; - d_DEINTER.resize(d_K); - - // generate DEINTER table - for(int i=0;i<d_K;i++) { - d_DEINTER[d_INTER[i]]=i; - } -} - -//###################################################################### -//# Read an INTERLEAVER specification from a file. -//# Format (hopefully will become more flexible in the future...): -//# K -//# blank line -//# list of space separated K integers from 0 to K-1 in appropriate order -//# optional comments -//###################################################################### -interleaver::interleaver(const char *name) -{ - FILE *interleaverfile; - - if((interleaverfile=fopen(name,"r"))==NULL) - throw std::runtime_error ("file open error in interleaver()"); - //printf("file open error in interleaver()\n"); - - if(fscanf(interleaverfile,"%d\n",&d_K) == EOF) { - if(ferror(interleaverfile) != 0) - throw std::runtime_error ("interleaver::interleaver(const char *name): file read error\n"); - } - - d_INTER.resize(d_K); - d_DEINTER.resize(d_K); - - for(int i=0;i<d_K;i++) { - if(fscanf(interleaverfile,"%d",&(d_INTER[i])) == EOF) { - if(ferror(interleaverfile) != 0) - throw std::runtime_error ("interleaver::interleaver(const char *name): file read error\n"); - } - } - - // generate DEINTER table - for(int i=0;i<d_K;i++) { - d_DEINTER[d_INTER[i]]=i; - } -} - -//###################################################################### -//# Generate a random interleaver -//###################################################################### -interleaver::interleaver(int K, int seed) -{ - d_K=K; - d_INTER.resize(d_K); - d_DEINTER.resize(d_K); - - if(seed>=0) srand((unsigned int)seed); - std::vector<int> tmp(d_K); - for(int i=0;i<d_K;i++) { - d_INTER[i]=i; - tmp[i] = rand(); - } - quicksort_index <int> (tmp,d_INTER,0,d_K-1); - - // generate DEINTER table - for(int i=0;i<d_K;i++) { - d_DEINTER[d_INTER[i]]=i; - } -} - - - - - -//###################################################################### -//# Write an INTERLEAVER specification to a file. -//# Format -//# K -//# blank line -//# list of space separated K integers from 0 to K-1 in appropriate order -//# optional comments -//###################################################################### -void interleaver::write_interleaver_txt(std::string filename) -{ - std::ofstream interleaver_fname (filename.c_str()); - if (!interleaver_fname) {std::cout << "file not found " << std::endl ; exit(-1);} - interleaver_fname << d_K << std::endl; - interleaver_fname << std::endl; - for(int i=0;i<d_K;i++) - interleaver_fname << d_INTER[i] << ' '; - interleaver_fname << std::endl; - interleaver_fname.close(); -} diff --git a/gr-trellis/src/lib/interleaver.h b/gr-trellis/src/lib/interleaver.h deleted file mode 100644 index fbd378d62..000000000 --- a/gr-trellis/src/lib/interleaver.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 INCLUDED_TRELLIS_INTERLEAVER_H -#define INCLUDED_TRELLIS_INTERLEAVER_H - -#include <trellis_api.h> -#include <vector> - -/*! - * \brief INTERLEAVER class - */ -class TRELLIS_API interleaver { -private: - int d_K; - std::vector<int> d_INTER; - std::vector<int> d_DEINTER; -public: - interleaver(); - interleaver(const interleaver & INTERLEAVER); - interleaver(int K, const std::vector<int> & INTER); - interleaver(const char *name); - interleaver(int K, int seed); - int K () const { return d_K; } - const std::vector<int> & INTER () const { return d_INTER; } - const std::vector<int> & DEINTER () const { return d_DEINTER; } - void write_interleaver_txt(std::string filename); -}; - -#endif diff --git a/gr-trellis/src/lib/interleaver.i b/gr-trellis/src/lib/interleaver.i deleted file mode 100644 index bb9078b1b..000000000 --- a/gr-trellis/src/lib/interleaver.i +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -class interleaver { -private: - int d_K; - std::vector<int> d_INTER; - std::vector<int> d_DEINTER; -public: - interleaver(); - interleaver(const interleaver & INTERLEAVER); - interleaver(int K, const std::vector<int> & INTER); - interleaver(const char *name); - interleaver(int K, int seed); - int K () const { return d_K; } - const std::vector<int> & INTER () const { return d_INTER; } - const std::vector<int> & DEINTER () const { return d_DEINTER; } - void write_interleaver_txt(std::string filename); -}; diff --git a/gr-trellis/src/lib/quicksort_index.cc b/gr-trellis/src/lib/quicksort_index.cc deleted file mode 100644 index cf37e862e..000000000 --- a/gr-trellis/src/lib/quicksort_index.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#include "quicksort_index.h" - -template <class T> -void -SWAP -(T & a, T & b) -{ - T temp = a; - a = b; - b = temp; -} - -template <class T> -void -quicksort_index -(std::vector<T> & p, std::vector<int> & index, int left, int right) -{ - if (left < right) { - int i = left; - int j = right + 1; - T pivot = p[left]; - do { - do - i++; - while ((p[i] < pivot) && (i < right)); - do - j--; - while ((p[j] > pivot) && (j > left)); - if (i < j) { - SWAP <T> (p[i],p[j]); - SWAP <int> (index[i],index[j]); - } - } while (i < j); - SWAP <T> (p[left], p[j]); - SWAP <int> (index[left], index[j]); - quicksort_index <T> (p,index, left, j-1); - quicksort_index <T> (p,index, j+1, right); - } -} - -// instantiate an <int> version of the quicksort_index -//template <int> void SWAP (int & a, int & b); -template -void -quicksort_index<int> -(std::vector<int> & p, std::vector<int> & index, int left, int right); diff --git a/gr-trellis/src/lib/quicksort_index.h b/gr-trellis/src/lib/quicksort_index.h deleted file mode 100644 index 9583955db..000000000 --- a/gr-trellis/src/lib/quicksort_index.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007 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 INCLUDED_QUICKSORT_INDEX_H -#define INCLUDED_QUICKSORT_INDEX_H - -#include <vector> - -template <class T> -void SWAP (T & a, T & b); - -template <class T> -void quicksort_index (std::vector<T> & p, std::vector<int> & index, int left, int right); - -#endif diff --git a/gr-trellis/src/lib/siso_type.h b/gr-trellis/src/lib/siso_type.h deleted file mode 100644 index 3a7163d02..000000000 --- a/gr-trellis/src/lib/siso_type.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 INCLUDED_TRELLIS_SISO_TYPE_H -#define INCLUDED_TRELLIS_SISO_TYPE_H - -typedef enum { - TRELLIS_MIN_SUM = 200, TRELLIS_SUM_PRODUCT -} trellis_siso_type_t; - -#endif - diff --git a/gr-trellis/src/lib/trellis.i b/gr-trellis/src/lib/trellis.i deleted file mode 100644 index 0debf5e5d..000000000 --- a/gr-trellis/src/lib/trellis.i +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -%include "gnuradio.i" // the common stuff - -//load generated python docstrings -%include "trellis_swig_doc.i" - -%{ -#include "fsm.h" -#include "interleaver.h" -#include "trellis_permutation.h" -#include "trellis_siso_f.h" -#include "trellis_siso_combined_f.h" -#include "trellis_constellation_metrics_cf.h" -#include "digital_constellation.h" -%} - - -// ---------------------------------------------------------------- - -%include "fsm.i" -%include "interleaver.i" -%include "trellis_permutation.i" -%include "trellis_siso_f.i" -%include "trellis_siso_combined_f.i" - -%include "siso_type.h" - -%include "trellis_constellation_metrics_cf.i" - -%include "trellis_generated.i" - -%import "digital_metric_type.h" -%import "digital_constellation.i" - - //%pythoncode %{ - // from gnuradio.gr import TRELLIS_EUCLIDEAN, TRELLIS_HARD_SYMBOL, TRELLIS_HARD_BIT - // %} diff --git a/gr-trellis/src/lib/trellis_api.h b/gr-trellis/src/lib/trellis_api.h deleted file mode 100644 index c09b340d6..000000000 --- a/gr-trellis/src/lib/trellis_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_TRELLIS_API_H -#define INCLUDED_TRELLIS_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_trellis_EXPORTS -# define TRELLIS_API __GR_ATTR_EXPORT -#else -# define TRELLIS_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_TRELLIS_API_H */ diff --git a/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc b/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc deleted file mode 100644 index 6e6aa2dd0..000000000 --- a/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2011 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 <trellis_constellation_metrics_cf.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <iostream> - - - -trellis_constellation_metrics_cf_sptr -trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE) -{ - return gnuradio::get_initial_sptr (new trellis_constellation_metrics_cf (constellation, TYPE)); -} - - - -trellis_constellation_metrics_cf::trellis_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE) - : gr_block ("constellation_metrics_cf", - gr_make_io_signature (1, -1, sizeof (gr_complex)), - gr_make_io_signature (1, -1, sizeof (float))), - d_constellation (constellation), - d_TYPE (TYPE), - d_O (constellation->arity()), - d_D (constellation->dimensionality()) -{ - set_relative_rate (1.0 * d_O / ((double) d_D)); - set_output_multiple ((int)d_O); -} - -void -trellis_constellation_metrics_cf::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_O == 0); - unsigned int input_required = d_D * noutput_items / d_O; - unsigned int ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = input_required; -} - - - -int -trellis_constellation_metrics_cf::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - - assert (noutput_items % d_O == 0); - assert (input_items.size() == output_items.size()); - unsigned int nstreams = input_items.size(); - -for (unsigned int m=0;m<nstreams;m++) { - const gr_complex *in = (gr_complex *) input_items[m]; - float *out = (float *) output_items[m]; - - for (unsigned int i = 0; i < noutput_items / d_O ; i++){ - d_constellation->calc_metric(&(in[i*d_D]), &(out[i*d_O]), d_TYPE); - } -} - - consume_each (d_D * noutput_items / d_O); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_constellation_metrics_cf.h b/gr-trellis/src/lib/trellis_constellation_metrics_cf.h deleted file mode 100644 index 2c2070522..000000000 --- a/gr-trellis/src/lib/trellis_constellation_metrics_cf.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2011 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 INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H -#define INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H - -#include <trellis_api.h> -#include <gr_block.h> -#include <digital_constellation.h> -#include <digital_metric_type.h> - -class trellis_constellation_metrics_cf; -typedef boost::shared_ptr<trellis_constellation_metrics_cf> trellis_constellation_metrics_cf_sptr; - -TRELLIS_API trellis_constellation_metrics_cf_sptr trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); - -/*! - * \brief Evaluate metrics for use by the Viterbi algorithm. - * \ingroup coding_blk - */ -class TRELLIS_API trellis_constellation_metrics_cf : public gr_block -{ - public: - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - protected: - trellis_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); - - private: - digital_constellation_sptr d_constellation; - trellis_metric_type_t d_TYPE; - unsigned int d_O; - unsigned int d_D; - friend TRELLIS_API trellis_constellation_metrics_cf_sptr trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); - -}; - - -#endif diff --git a/gr-trellis/src/lib/trellis_constellation_metrics_cf.i b/gr-trellis/src/lib/trellis_constellation_metrics_cf.i deleted file mode 100644 index c17522b11..000000000 --- a/gr-trellis/src/lib/trellis_constellation_metrics_cf.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,constellation_metrics_cf); - -trellis_constellation_metrics_cf_sptr trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); - -class trellis_constellation_metrics_cf : public gr_block -{ -private: - trellis_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); -}; diff --git a/gr-trellis/src/lib/trellis_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_encoder_XX.cc.t deleted file mode 100644 index dca92b08f..000000000 --- a/gr-trellis/src/lib/trellis_encoder_XX.cc.t +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <iostream> - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ (const fsm &FSM, int ST) -{ - return gnuradio::get_initial_sptr (new @NAME@ (FSM,ST)); -} - -@NAME@::@NAME@ (const fsm &FSM, int ST) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, -1, sizeof (@O_TYPE@))), - d_FSM (FSM), - d_ST (ST) -{ -} - - - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ST_tmp=0; - - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - - for (int m=0;m<nstreams;m++) { - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[m]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[m]; - ST_tmp = d_ST; - - // per stream processing - for (int i = 0; i < noutput_items; i++){ - out[i] = (@O_TYPE@) d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]]; // direction of time? - ST_tmp = (int) d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]]; - } - // end per stream processing - } - d_ST = ST_tmp; - - return noutput_items; -} - diff --git a/gr-trellis/src/lib/trellis_encoder_XX.h.t b/gr-trellis/src/lib/trellis_encoder_XX.h.t deleted file mode 100644 index 7c4250a92..000000000 --- a/gr-trellis/src/lib/trellis_encoder_XX.h.t +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST); - -/*! - * \brief Convolutional encoder. - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_sync_block -{ -private: - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST); - fsm d_FSM; - int d_ST; - @NAME@ (const fsm &FSM, int ST); - -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_encoder_XX.i.t b/gr-trellis/src/lib/trellis_encoder_XX.i.t deleted file mode 100644 index 29c9c4db3..000000000 --- a/gr-trellis/src/lib/trellis_encoder_XX.i.t +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST); - -class @NAME@ : public gr_sync_block -{ -private: - @NAME@ (const fsm &FSM, int ST); -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } -}; diff --git a/gr-trellis/src/lib/trellis_metrics_X.cc.t b/gr-trellis/src/lib/trellis_metrics_X.cc.t deleted file mode 100644 index 77eb8c81b..000000000 --- a/gr-trellis/src/lib/trellis_metrics_X.cc.t +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <iostream> - - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE) -{ - return gnuradio::get_initial_sptr (new @NAME@ (O,D,TABLE,TYPE)); -} - - - -@NAME@::@NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, -1, sizeof (float))), - d_O (O), - d_D (D), - d_TYPE (TYPE), - d_TABLE (TABLE) -{ - set_relative_rate (1.0 * d_O / ((double) d_D)); - set_output_multiple ((int)d_O); -} - -void @NAME@::set_TABLE (const std::vector<@I_TYPE@> &table) -{ - d_TABLE = table; -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_O == 0); - int input_required = d_D * noutput_items / d_O; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = input_required; -} - - - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - - assert (noutput_items % d_O == 0); - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - -for (int m=0;m<nstreams;m++) { - const @I_TYPE@ *in = (@I_TYPE@ *) input_items[m]; - float *out = (float *) output_items[m]; - - for (int i = 0; i < noutput_items / d_O ; i++){ - calc_metric(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); - } -} - - consume_each (d_D * noutput_items / d_O); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_metrics_X.h.t b/gr-trellis/src/lib/trellis_metrics_X.h.t deleted file mode 100644 index ab406c51e..000000000 --- a/gr-trellis/src/lib/trellis_metrics_X.h.t +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include <gr_block.h> -#include "calc_metric.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); - -/*! - * \brief Evaluate metrics for use by the Viterbi algorithm. - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - int d_O; - int d_D; - trellis_metric_type_t d_TYPE; - std::vector<@I_TYPE@> d_TABLE; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); - @NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - void set_TABLE (const std::vector<@I_TYPE@> &table); - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gr-trellis/src/lib/trellis_metrics_X.i.t b/gr-trellis/src/lib/trellis_metrics_X.i.t deleted file mode 100644 index 50aa7a767..000000000 --- a/gr-trellis/src/lib/trellis_metrics_X.i.t +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); - -class @NAME@ : public gr_block -{ -private: - @NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - void set_TABLE (const std::vector<@I_TYPE@> &table); - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } -}; diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_X.cc.t b/gr-trellis/src/lib/trellis_pccc_decoder_X.cc.t deleted file mode 100644 index d79192491..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_X.cc.t +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -) -{ - return gnuradio::get_initial_sptr (new @NAME@ ( - FSM1, ST10, ST1K, - FSM2, ST20, ST2K, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE - )); -} - -@NAME@::@NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_FSM1 (FSM1), d_ST10 (ST10), d_ST1K (ST1K), - d_FSM2 (FSM2), d_ST20 (ST20), d_ST2K (ST2K), - d_INTERLEAVER (INTERLEAVER), - d_blocklength (blocklength), - d_repetitions (repetitions), - d_SISO_TYPE (SISO_TYPE) -{ - assert(d_FSM1.I() == d_FSM2.I()); - set_relative_rate (1.0 / ((double) d_FSM1.O() * d_FSM2.O())); - set_output_multiple (d_blocklength); -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_blocklength == 0); - int input_required = d_FSM1.O() * d_FSM2.O() * noutput_items ; - ninput_items_required[0] = input_required; -} - - - -//=========================================================== - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (noutput_items % d_blocklength == 0); - int nblocks = noutput_items / d_blocklength; - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - const float *in = (const float *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - for (int n=0;n<nblocks;n++) { - pccc_decoder( - d_FSM1, d_ST10, d_ST1K, - d_FSM2, d_ST20, d_ST2K, - d_INTERLEAVER, d_blocklength, d_repetitions, - p2min, - &(in[n*d_blocklength*d_FSM1.O()*d_FSM2.O()]),&(out[n*d_blocklength]) - ); - } - - consume_each (d_FSM1.O() * d_FSM2.O() * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t b/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t deleted file mode 100644 index e9bc94681..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include "interleaver.h" -#include <gr_block.h> -#include <vector> -#include "siso_type.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE // perform "min-sum" or "sum-product" combining -); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSM1; - int d_ST10; - int d_ST1K; - fsm d_FSM2; - int d_ST20; - int d_ST2K; - interleaver d_INTERLEAVER; - int d_blocklength; - int d_repetitions; - trellis_siso_type_t d_SISO_TYPE; - std::vector<float> d_buffer; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - - @NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - -public: - fsm FSM1 () const { return d_FSM1; } - fsm FSM2 () const { return d_FSM2; } - int ST10 () const { return d_ST10; } - int ST1K () const { return d_ST1K; } - int ST20 () const { return d_ST20; } - int ST2K () const { return d_ST2K; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_X.i.t b/gr-trellis/src/lib/trellis_pccc_decoder_X.i.t deleted file mode 100644 index 83d7fe969..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_X.i.t +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - -public: - fsm FSM1 () const { return d_FSM1; } - fsm FSM2 () const { return d_FSM2; } - int ST10 () const { return d_ST10; } - int ST1K () const { return d_ST1K; } - int ST20 () const { return d_ST20; } - int ST2K () const { return d_ST2K; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } -}; diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t deleted file mode 100644 index 03e21de1f..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) -{ - return gnuradio::get_initial_sptr (new @NAME@ ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE, - D, - TABLE,METRIC_TYPE, - scaling - )); -} - -@NAME@::@NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_FSMo (FSMo), d_STo0 (STo0), d_SToK (SToK), - d_FSMi (FSMi), d_STi0 (STi0), d_STiK (STiK), - d_INTERLEAVER (INTERLEAVER), - d_blocklength (blocklength), - d_repetitions (repetitions), - d_SISO_TYPE (SISO_TYPE), - d_D (D), - d_TABLE (TABLE), - d_METRIC_TYPE (METRIC_TYPE), - d_scaling (scaling) -{ - assert(d_FSMo.I() == d_FSMi.I()); - set_relative_rate (1.0 / ((double) d_D)); - set_output_multiple (d_blocklength); -} - -void @NAME@::set_scaling(float scaling) -{ - d_scaling = scaling; -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_blocklength == 0); - int input_required = d_D * noutput_items ; - ninput_items_required[0] = input_required; -} - - - -//=========================================================== - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (noutput_items % d_blocklength == 0); - int nblocks = noutput_items / d_blocklength; - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - for (int n=0;n<nblocks;n++) { - pccc_decoder_combined( - d_FSMo, d_STo0, d_SToK, - d_FSMi, d_STi0, d_STiK, - d_INTERLEAVER, d_blocklength, d_repetitions, - p2min, - d_D,d_TABLE, - d_METRIC_TYPE, - d_scaling, - &(in[n*d_blocklength*d_D]),&(out[n*d_blocklength]) - ); - } - - consume_each (d_D * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t deleted file mode 100644 index 6e45ea10a..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include "interleaver.h" -#include <gr_block.h> -#include <vector> -#include "calc_metric.h" -#include "siso_type.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, // perform "min-sum" or "sum-product" combining - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSMo; - int d_STo0; - int d_SToK; - fsm d_FSMi; - int d_STi0; - int d_STiK; - interleaver d_INTERLEAVER; - int d_blocklength; - int d_repetitions; - trellis_siso_type_t d_SISO_TYPE; - int d_D; - std::vector<@I_TYPE@> d_TABLE; - trellis_metric_type_t d_METRIC_TYPE; - float d_scaling; - std::vector<float> d_buffer; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - -public: - fsm FSM1 () const { return d_FSMo; } - fsm FSM2 () const { return d_FSMi; } - int ST10 () const { return d_STo0; } - int ST1K () const { return d_SToK; } - int ST20 () const { return d_STi0; } - int ST2K () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - float scaling () const { return d_scaling; } - void set_scaling (float scaling); - - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t deleted file mode 100644 index d841f67b4..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - -public: - fsm FSM1 () const { return d_FSMo; } - fsm FSM2 () const { return d_FSMi; } - int ST10 () const { return d_STo0; } - int ST1K () const { return d_SToK; } - int ST20 () const { return d_STi0; } - int ST2K () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - float scaling() const { return d_scaling; } - void set_scaling (float scaling); -}; diff --git a/gr-trellis/src/lib/trellis_pccc_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_pccc_encoder_XX.cc.t deleted file mode 100644 index 6cab858cd..000000000 --- a/gr-trellis/src/lib/trellis_pccc_encoder_XX.cc.t +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <iostream> - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST1, - const fsm &FSM2, int ST2, - const interleaver &INTERLEAVER, - int blocklength -) -{ - return gnuradio::get_initial_sptr (new @NAME@ (FSM1,ST1,FSM2,ST2,INTERLEAVER,blocklength)); -} - -@NAME@::@NAME@ ( - const fsm &FSM1, int ST1, - const fsm &FSM2, int ST2, - const interleaver &INTERLEAVER, - int blocklength -) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_FSM1 (FSM1), - d_ST1 (ST1), - d_FSM2 (FSM2), - d_ST2 (ST2), - d_INTERLEAVER (INTERLEAVER), - d_blocklength (blocklength) -{ - assert(d_FSM1.I() == d_FSM2.I()); - set_output_multiple(d_blocklength); - d_buffer.resize(d_blocklength); -} - - - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert(noutput_items%d_blocklength ==0); - for (int b = 0 ; b<noutput_items/d_blocklength; b++) { - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]+b*d_blocklength; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]+b*d_blocklength; - - int ST1_tmp = d_ST1; - int ST2_tmp = d_ST2; - for (int i = 0; i < d_blocklength; i++){ - int k = d_INTERLEAVER.INTER()[i]; - int o1 = d_FSM1.OS()[ST1_tmp*d_FSM1.I()+in[i]]; - ST1_tmp = (int) d_FSM1.NS()[ST1_tmp*d_FSM1.I()+in[i]]; - int o2 = d_FSM2.OS()[ST2_tmp*d_FSM2.I()+in[k]]; - ST2_tmp = (int) d_FSM2.NS()[ST2_tmp*d_FSM2.I()+in[k]]; - out[i] = (@O_TYPE@) (o1*d_FSM1.O() + o2); - } - } - return noutput_items; -} - diff --git a/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t b/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t deleted file mode 100644 index 75a22b829..000000000 --- a/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include <vector> -#include "fsm.h" -#include "interleaver.h" -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST1, - const fsm &FSM2, int ST2, - const interleaver &INTERLEAVER, - int blocklength -); - -/*! - * \brief SCCC encoder. - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_sync_block -{ -private: - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST1, - const fsm &FSM2, int ST2, - const interleaver &INTERLEAVER, - int blocklength - ); - fsm d_FSM1; - int d_ST1; - fsm d_FSM2; - int d_ST2; - interleaver d_INTERLEAVER; - int d_blocklength; - std::vector<int> d_buffer; - @NAME@ ( - const fsm &FSM1, int ST1, - const fsm &FSM2, int ST2, - const interleaver &INTERLEAVER, - int blocklength - ); - -public: - fsm FSM1 () const { return d_FSM1; } - int ST1 () const { return d_ST1; } - fsm FSM2 () const { return d_FSM2; } - int ST2 () const { return d_ST2; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_pccc_encoder_XX.i.t b/gr-trellis/src/lib/trellis_pccc_encoder_XX.i.t deleted file mode 100644 index c02ee428a..000000000 --- a/gr-trellis/src/lib/trellis_pccc_encoder_XX.i.t +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST1, - const fsm &FSM2, int ST2, - const interleaver &INTERLEAVER, - int blocklength -); - -class @NAME@ : public gr_sync_block -{ -private: - @NAME@ ( - const fsm &FSM1, int ST1, - const fsm &FSM2, int ST2, - const interleaver &INTERLEAVER, - int blocklength - ); -public: - fsm FSM1 () const { return d_FSM1; } - int ST1 () const { return d_ST1; } - fsm FSM2 () const { return d_FSM2; } - int ST2 () const { return d_ST2; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } -}; diff --git a/gr-trellis/src/lib/trellis_permutation.cc b/gr-trellis/src/lib/trellis_permutation.cc deleted file mode 100644 index 57c6d2693..000000000 --- a/gr-trellis/src/lib/trellis_permutation.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 <trellis_permutation.h> -#include <gr_io_signature.h> -#include <iostream> -#include <string.h> - -trellis_permutation_sptr -trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL) -{ - return gnuradio::get_initial_sptr(new trellis_permutation (K,TABLE,SYMS_PER_BLOCK,BYTES_PER_SYMBOL)); -} - -trellis_permutation::trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL) - : gr_sync_block ("permutation", - gr_make_io_signature (1, -1, BYTES_PER_SYMBOL), - gr_make_io_signature (1, -1, BYTES_PER_SYMBOL)), - d_K (K), - d_TABLE (TABLE), - d_SYMS_PER_BLOCK (SYMS_PER_BLOCK), - d_BYTES_PER_SYMBOL (BYTES_PER_SYMBOL) -{ - set_output_multiple (d_K*SYMS_PER_BLOCK); - //std::cout << d_K << "\n"; -} - - - -int -trellis_permutation::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int nstreams = input_items.size(); - assert (input_items.size() == output_items.size()); - assert (noutput_items % d_K ==0); - - for (int m=0;m<nstreams;m++) { - const char *in = (const char *) input_items[m]; - char *out = (char *) output_items[m]; - - // per stream processing - for (int i = 0; i < noutput_items/d_SYMS_PER_BLOCK; i++){ - // Index i refers to blocks. - // Begining of packet (in blocks) - int i0 = d_K*(i/d_K); - // position of block within packet (in blocks) - int j0 = i%d_K; - // new position of block within packet (in blocks) - int k0 = d_TABLE[j0]; - memcpy(&(out[i*d_SYMS_PER_BLOCK*d_BYTES_PER_SYMBOL]), - &(in[(i0+k0)*d_SYMS_PER_BLOCK*d_BYTES_PER_SYMBOL]), - d_BYTES_PER_SYMBOL*d_SYMS_PER_BLOCK); - } - // end per stream processing - } - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_permutation.h b/gr-trellis/src/lib/trellis_permutation.h deleted file mode 100644 index cc40518c2..000000000 --- a/gr-trellis/src/lib/trellis_permutation.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 INCLUDED_TRELLIS_PERMUTATION_H -#define INCLUDED_TRELLIS_PERMUTATION_H - -#include <trellis_api.h> -#include <vector> -#include <gr_sync_block.h> - -class trellis_permutation; -typedef boost::shared_ptr<trellis_permutation> trellis_permutation_sptr; - -TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); - -/*! - * \brief Permutation. - * \ingroup coding_blk - */ -class TRELLIS_API trellis_permutation : public gr_sync_block -{ -private: - friend TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); - int d_K; - std::vector<int> d_TABLE; - int d_SYMS_PER_BLOCK; - size_t d_BYTES_PER_SYMBOL; - trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES); - -public: - int K () const { return d_K; } - const std::vector<int> & TABLE () const { return d_TABLE; } - int SYMS_PER_BLOCK () const { return d_SYMS_PER_BLOCK; } - size_t BYTES_PER_SYMBOL () const { return d_BYTES_PER_SYMBOL; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_permutation.i b/gr-trellis/src/lib/trellis_permutation.i deleted file mode 100644 index fdfaa44d3..000000000 --- a/gr-trellis/src/lib/trellis_permutation.i +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -GR_SWIG_BLOCK_MAGIC(trellis,permutation); - -trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); - -class trellis_permutation : public gr_sync_block -{ -private: - int d_K; - std::vector<int> d_TABLE; - int d_SYMS_PER_BLOCK; - size_t d_BYTES_PER_SYMBOL; - trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); - -public: - int K () const { return d_K; } - const std::vector<int> & TABLE () const { return d_TABLE; } - int SYMS_PER_BLOCK () const { return d_SYMS_PER_BLOCK; } - size_t BYTES_PER_SYMBOL () const { return d_BYTES_PER_SYMBOL; } -}; diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t b/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t deleted file mode 100644 index c9b78aa8f..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -) -{ - return gnuradio::get_initial_sptr (new @NAME@ ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE - )); -} - -@NAME@::@NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_FSMo (FSMo), d_STo0 (STo0), d_SToK (SToK), - d_FSMi (FSMi), d_STi0 (STi0), d_STiK (STiK), - d_INTERLEAVER (INTERLEAVER), - d_blocklength (blocklength), - d_repetitions (repetitions), - d_SISO_TYPE (SISO_TYPE) -{ - assert(d_FSMo.O() == d_FSMi.I()); - set_relative_rate (1.0 / ((double) d_FSMi.O())); - set_output_multiple (d_blocklength); -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_blocklength == 0); - int input_required = d_FSMi.O() * noutput_items ; - ninput_items_required[0] = input_required; -} - - - -//=========================================================== - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (noutput_items % d_blocklength == 0); - int nblocks = noutput_items / d_blocklength; - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - const float *in = (const float *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - for (int n=0;n<nblocks;n++) { - sccc_decoder( - d_FSMo, d_STo0, d_SToK, - d_FSMi, d_STi0, d_STiK, - d_INTERLEAVER, d_blocklength, d_repetitions, - p2min, - &(in[n*d_blocklength*d_FSMi.O()]),&(out[n*d_blocklength]) - ); - } - - consume_each (d_FSMi.O() * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t b/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t deleted file mode 100644 index d6fb72f68..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include "interleaver.h" -#include <gr_block.h> -#include <vector> -#include "siso_type.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE // perform "min-sum" or "sum-product" combining -); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSMo; - int d_STo0; - int d_SToK; - fsm d_FSMi; - int d_STi0; - int d_STiK; - interleaver d_INTERLEAVER; - int d_blocklength; - int d_repetitions; - trellis_siso_type_t d_SISO_TYPE; - std::vector<float> d_buffer; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - -public: - fsm FSMo () const { return d_FSMo; } - fsm FSMi () const { return d_FSMi; } - int STo0 () const { return d_STo0; } - int SToK () const { return d_SToK; } - int STi0 () const { return d_STi0; } - int STiK () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_X.i.t b/gr-trellis/src/lib/trellis_sccc_decoder_X.i.t deleted file mode 100644 index a4392ee6f..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_X.i.t +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - -public: - fsm FSMo () const { return d_FSMo; } - fsm FSMi () const { return d_FSMi; } - int STo0 () const { return d_STo0; } - int SToK () const { return d_SToK; } - int STi0 () const { return d_STi0; } - int STiK () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } -}; diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t deleted file mode 100644 index 4508ca5cb..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) -{ - return gnuradio::get_initial_sptr (new @NAME@ ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE, - D, - TABLE,METRIC_TYPE, - scaling - )); -} - -@NAME@::@NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_FSMo (FSMo), d_STo0 (STo0), d_SToK (SToK), - d_FSMi (FSMi), d_STi0 (STi0), d_STiK (STiK), - d_INTERLEAVER (INTERLEAVER), - d_blocklength (blocklength), - d_repetitions (repetitions), - d_SISO_TYPE (SISO_TYPE), - d_D (D), - d_TABLE (TABLE), - d_METRIC_TYPE (METRIC_TYPE), - d_scaling (scaling) -{ - assert(d_FSMo.O() == d_FSMi.I()); - set_relative_rate (1.0 / ((double) d_D)); - set_output_multiple (d_blocklength); -} - -void @NAME@::set_scaling(float scaling) -{ - d_scaling = scaling; -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_blocklength == 0); - int input_required = d_D * noutput_items ; - ninput_items_required[0] = input_required; -} - - - -//=========================================================== - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (noutput_items % d_blocklength == 0); - int nblocks = noutput_items / d_blocklength; - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - for (int n=0;n<nblocks;n++) { - sccc_decoder_combined( - d_FSMo, d_STo0, d_SToK, - d_FSMi, d_STi0, d_STiK, - d_INTERLEAVER, d_blocklength, d_repetitions, - p2min, - d_D,d_TABLE, - d_METRIC_TYPE, - d_scaling, - &(in[n*d_blocklength*d_D]),&(out[n*d_blocklength]) - ); - } - - consume_each (d_D * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t deleted file mode 100644 index 3fdc53c62..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include "interleaver.h" -#include <gr_block.h> -#include <vector> -#include "calc_metric.h" -#include "siso_type.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, // perform "min-sum" or "sum-product" combining - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSMo; - int d_STo0; - int d_SToK; - fsm d_FSMi; - int d_STi0; - int d_STiK; - interleaver d_INTERLEAVER; - int d_blocklength; - int d_repetitions; - trellis_siso_type_t d_SISO_TYPE; - int d_D; - std::vector<@I_TYPE@> d_TABLE; - trellis_metric_type_t d_METRIC_TYPE; - float d_scaling; - std::vector<float> d_buffer; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - -public: - fsm FSMo () const { return d_FSMo; } - fsm FSMi () const { return d_FSMi; } - int STo0 () const { return d_STo0; } - int SToK () const { return d_SToK; } - int STi0 () const { return d_STi0; } - int STiK () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - float scaling () const { return d_scaling; } - void set_scaling (float scaling); - - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.i.t b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.i.t deleted file mode 100644 index 84f2eb07d..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.i.t +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - -public: - fsm FSMo () const { return d_FSMo; } - fsm FSMi () const { return d_FSMi; } - int STo0 () const { return d_STo0; } - int SToK () const { return d_SToK; } - int STi0 () const { return d_STi0; } - int STiK () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - float scaling() const { return d_scaling; } - void set_scaling (float scaling); -}; diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t deleted file mode 100644 index 8054909db..000000000 --- a/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <iostream> - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo, - const fsm &FSMi, int STi, - const interleaver &INTERLEAVER, - int blocklength -) -{ - return gnuradio::get_initial_sptr (new @NAME@ (FSMo,STo,FSMi,STi,INTERLEAVER,blocklength)); -} - -@NAME@::@NAME@ ( - const fsm &FSMo, int STo, - const fsm &FSMi, int STi, - const interleaver &INTERLEAVER, - int blocklength -) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_FSMo (FSMo), - d_STo (STo), - d_FSMi (FSMi), - d_STi (STi), - d_INTERLEAVER (INTERLEAVER), - d_blocklength (blocklength) -{ - assert(d_FSMo.O() == d_FSMi.I()); - set_output_multiple(d_blocklength); - d_buffer.resize(d_blocklength); -} - - - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert(noutput_items%d_blocklength ==0); - for (int b = 0 ; b<noutput_items/d_blocklength; b++) { - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]+b*d_blocklength; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]+b*d_blocklength; - - int STo_tmp = d_STo; - for (int i = 0; i < d_blocklength; i++){ - d_buffer[i] = d_FSMo.OS()[STo_tmp*d_FSMo.I()+in[i]]; - STo_tmp = (int) d_FSMo.NS()[STo_tmp*d_FSMo.I()+in[i]]; - } - int STi_tmp = d_STi; - for (int i = 0; i < d_blocklength; i++){ - int k = d_INTERLEAVER.INTER()[i]; - out[i] = (@O_TYPE@) d_FSMi.OS()[STi_tmp*d_FSMi.I()+d_buffer[k]]; - STi_tmp = (int) d_FSMi.NS()[STi_tmp*d_FSMi.I()+d_buffer[k]]; - } - } - return noutput_items; -} - diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t deleted file mode 100644 index b16d7ffca..000000000 --- a/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include <vector> -#include "fsm.h" -#include "interleaver.h" -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo, - const fsm &FSMi, int STi, - const interleaver &INTERLEAVER, - int blocklength -); - -/*! - * \brief SCCC encoder. - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_sync_block -{ -private: - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo, - const fsm &FSMi, int STi, - const interleaver &INTERLEAVER, - int blocklength - ); - fsm d_FSMo; - int d_STo; - fsm d_FSMi; - int d_STi; - interleaver d_INTERLEAVER; - int d_blocklength; - std::vector<int> d_buffer; - @NAME@ ( - const fsm &FSMo, int STo, - const fsm &FSMi, int STi, - const interleaver &INTERLEAVER, - int blocklength - ); - -public: - fsm FSMo () const { return d_FSMo; } - int STo () const { return d_STo; } - fsm FSMi () const { return d_FSMi; } - int STi () const { return d_STi; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t deleted file mode 100644 index ca6b56199..000000000 --- a/gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo, - const fsm &FSMi, int STi, - const interleaver &INTERLEAVER, - int blocklength -); - -class @NAME@ : public gr_sync_block -{ -private: - @NAME@ ( - const fsm &FSMo, int STo, - const fsm &FSMi, int STi, - const interleaver &INTERLEAVER, - int blocklength - ); -public: - fsm FSMo () const { return d_FSMo; } - int STo () const { return d_STo; } - fsm FSMi () const { return d_FSMi; } - int STi () const { return d_STi; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } -}; diff --git a/gr-trellis/src/lib/trellis_siso_combined_f.cc b/gr-trellis/src/lib/trellis_siso_combined_f.cc deleted file mode 100644 index d27fe4425..000000000 --- a/gr-trellis/src/lib/trellis_siso_combined_f.cc +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 <trellis_siso_combined_f.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -trellis_siso_combined_f_sptr -trellis_make_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE) -{ - return gnuradio::get_initial_sptr(new trellis_siso_combined_f (FSM,K,S0,SK,POSTI,POSTO,SISO_TYPE,D,TABLE,TYPE)); -} - -trellis_siso_combined_f::trellis_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE) - : gr_block ("siso_combined_f", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (float))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK), - d_POSTI (POSTI), - d_POSTO (POSTO), - d_SISO_TYPE (SISO_TYPE), - d_D (D), - d_TABLE (TABLE), - d_TYPE (TYPE)//, - //d_alpha(FSM.S()*(K+1)), - //d_beta(FSM.S()*(K+1)) -{ - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - //printf("constructor: Multiple = %d\n",multiple); - set_output_multiple (d_K*multiple); - //what is the meaning of relative rate for a block with 2 inputs? - //set_relative_rate ( multiple / ((double) d_FSM.I()) ); - // it turns out that the above gives problems in the scheduler, so - // let's try (assumption O>I) - //set_relative_rate ( multiple / ((double) d_FSM.O()) ); - // I am tempted to automate like this - if(d_FSM.I() <= d_D) - set_relative_rate ( multiple / ((double) d_D) ); - else - set_relative_rate ( multiple / ((double) d_FSM.I()) ); -} - - -void -trellis_siso_combined_f::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - //printf("forecast: Multiple = %d\n",multiple); - assert (noutput_items % (d_K*multiple) == 0); - int input_required1 = d_FSM.I() * (noutput_items/multiple) ; - int input_required2 = d_D * (noutput_items/multiple) ; - //printf("forecast: Output requirements: %d\n",noutput_items); - //printf("forecast: Input requirements: %d %d\n",input_required1,input_required2); - unsigned ninputs = ninput_items_required.size(); - assert(ninputs % 2 == 0); - for (unsigned int i = 0; i < ninputs/2; i++) { - ninput_items_required[2*i] = input_required1; - ninput_items_required[2*i+1] = input_required2; - } -} - - - - - -/* - - -inline float min(float a, float b) -{ - return a <= b ? a : b; -} - -inline float min_star(float a, float b) -{ - return (a <= b ? a : b)-log(1+exp(a <= b ? a-b : b-a)); -} - -void siso_algorithm_combined(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const float *observations, float *post//, - //std::vector<float> &alpha, - //std::vector<float> &beta - ) -{ - float norm,mm,minm; - std::vector<float> alpha(S*(K+1)); - std::vector<float> beta(S*(K+1)); - float *prioro = new float[O*K]; - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - for(int k=0;k<K;k++) { // forward recursion - calc_metric(O, D, TABLE, &(observations[k*D]), &(prioro[k*O]),TYPE); // calc metrics - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]]; - minm=(*p2mymin)(minm,mm); - } - alpha[(k+1)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode - } - - if(SK<0) { // final state not specified - for(int i=0;i<S;i++) beta[K*S+i]=0; - } - else { - for(int i=0;i<S;i++) beta[K*S+i]=INF; - beta[K*S+SK]=0.0; - } - - for(int k=K-1;k>=0;k--) { // backward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(int i=0;i<I;i++) { - int i0 = j*I+i; - mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]]; - minm=(*p2mymin)(minm,mm); - } - beta[k*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - beta[k*S+j]-=norm; // normalize total metrics so they do not explode - } - - - if (POSTI && POSTO) - { - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*(I+O)+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*(I+O)+i]-=norm; // normalize metrics - } - - - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*(I+O)+I+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*(I+O)+I+n]-=norm; // normalize metrics - } - } - else if(POSTI) - { - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*I+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*I+i]-=norm; // normalize metrics - } - } - else if(POSTO) - { - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*O+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*O+n]-=norm; // normalize metrics - } - } - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - - delete [] prioro; - -} - -*/ - - - - -int -trellis_siso_combined_f::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == 2*output_items.size()); - int nstreams = output_items.size(); - //printf("general_work:Streams: %d\n",nstreams); - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - - assert (noutput_items % (d_K*multiple) == 0); - int nblocks = noutput_items / (d_K*multiple); - //printf("general_work:Blocks: %d\n",nblocks); - //for(int i=0;i<ninput_items.size();i++) - //printf("general_work:Input items available: %d\n",ninput_items[i]); - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - for (int m=0;m<nstreams;m++) { - const float *in1 = (const float *) input_items[2*m]; - const float *in2 = (const float *) input_items[2*m+1]; - float *out = (float *) output_items[m]; - for (int n=0;n<nblocks;n++) { - siso_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(), - d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(), - d_K,d_S0,d_SK, - d_POSTI,d_POSTO, - p2min, - d_D,d_TABLE,d_TYPE, - &(in1[n*d_K*d_FSM.I()]),&(in2[n*d_K*d_D]), - &(out[n*d_K*multiple])//, - //d_alpha,d_beta - ); - } - } - - for (unsigned int i = 0; i < input_items.size()/2; i++) { - consume(2*i,d_FSM.I() * noutput_items / multiple ); - consume(2*i+1,d_D * noutput_items / multiple ); - } - - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_siso_combined_f.h b/gr-trellis/src/lib/trellis_siso_combined_f.h deleted file mode 100644 index 4b28e8de4..000000000 --- a/gr-trellis/src/lib/trellis_siso_combined_f.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 INCLUDED_TRELLIS_SISO_COMBINED_F_H -#define INCLUDED_TRELLIS_SISO_COMBINED_F_H - -#include <trellis_api.h> -#include "fsm.h" -#include "siso_type.h" -#include "calc_metric.h" -#include "core_algorithms.h" -#include <gr_block.h> - -class trellis_siso_combined_f; -typedef boost::shared_ptr<trellis_siso_combined_f> trellis_siso_combined_f_sptr; - -TRELLIS_API trellis_siso_combined_f_sptr trellis_make_siso_combined_f ( - const fsm &FSM, // underlying FSM - int K, // block size in trellis steps - int S0, // initial state (put -1 if not specified) - int SK, // final state (put -1 if not specified) - bool POSTI, // true if you want a-posteriori info about the input symbols to be mux-ed in the output - bool POSTO, // true if you want a-posteriori info about the output symbols to be mux-ed in the output - trellis_siso_type_t d_SISO_TYPE, // perform "min-sum" or "sum-product" combining - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE -); - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API trellis_siso_combined_f : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - bool d_POSTI; - bool d_POSTO; - trellis_siso_type_t d_SISO_TYPE; - int d_D; - std::vector<float> d_TABLE; - trellis_metric_type_t d_TYPE; - //std::vector<float> d_alpha; - //std::vector<float> d_beta; - - friend TRELLIS_API trellis_siso_combined_f_sptr trellis_make_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t d_SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - - trellis_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t d_SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - bool POSTI () const { return d_POSTI; } - bool POSTO () const { return d_POSTO; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_siso_combined_f.i b/gr-trellis/src/lib/trellis_siso_combined_f.i deleted file mode 100644 index 781280d89..000000000 --- a/gr-trellis/src/lib/trellis_siso_combined_f.i +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -GR_SWIG_BLOCK_MAGIC(trellis,siso_combined_f); - -trellis_siso_combined_f_sptr trellis_make_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -class trellis_siso_combined_f : public gr_block -{ -private: - trellis_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - bool POSTI () const { return d_POSTI; } - bool POSTO () const { return d_POSTO; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } -}; diff --git a/gr-trellis/src/lib/trellis_siso_f.cc b/gr-trellis/src/lib/trellis_siso_f.cc deleted file mode 100644 index ffebf1928..000000000 --- a/gr-trellis/src/lib/trellis_siso_f.cc +++ /dev/null @@ -1,338 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 <trellis_siso_f.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -trellis_siso_f_sptr -trellis_make_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE) -{ - return gnuradio::get_initial_sptr(new trellis_siso_f (FSM,K,S0,SK,POSTI,POSTO,SISO_TYPE)); -} - -trellis_siso_f::trellis_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE) - : gr_block ("siso_f", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (float))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK), - d_POSTI (POSTI), - d_POSTO (POSTO), - d_SISO_TYPE (SISO_TYPE)//, - //d_alpha(FSM.S()*(K+1)), - //d_beta(FSM.S()*(K+1)) -{ - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - //printf("constructor: Multiple = %d\n",multiple); - set_output_multiple (d_K*multiple); - //what is the meaning of relative rate for a block with 2 inputs? - //set_relative_rate ( multiple / ((double) d_FSM.I()) ); - // it turns out that the above gives problems in the scheduler, so - // let's try (assumption O>I) - //set_relative_rate ( multiple / ((double) d_FSM.O()) ); - // I am tempted to automate like this - if(d_FSM.I() <= d_FSM.O()) - set_relative_rate ( multiple / ((double) d_FSM.O()) ); - else - set_relative_rate ( multiple / ((double) d_FSM.I()) ); -} - - -void -trellis_siso_f::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - //printf("forecast: Multiple = %d\n",multiple); - assert (noutput_items % (d_K*multiple) == 0); - int input_required1 = d_FSM.I() * (noutput_items/multiple) ; - int input_required2 = d_FSM.O() * (noutput_items/multiple) ; - //printf("forecast: Output requirements: %d\n",noutput_items); - //printf("forecast: Input requirements: %d %d\n",input_required1,input_required2); - unsigned ninputs = ninput_items_required.size(); - assert(ninputs % 2 == 0); - for (unsigned int i = 0; i < ninputs/2; i++) { - ninput_items_required[2*i] = input_required1; - ninput_items_required[2*i+1] = input_required2; - } -} - - - - -/* Moved it to "core_algorithms.cc" */ -/* -inline float min(float a, float b) -{ - return a <= b ? a : b; -} - -inline float min_star(float a, float b) -{ - return (a <= b ? a : b)-log(1+exp(a <= b ? a-b : b-a)); -} - -void siso_algorithm(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - const float *priori, const float *prioro, float *post//, - //std::vector<float> &alpha, - //std::vector<float> &beta - ) -{ - float norm,mm,minm; - std::vector<float> alpha(S*(K+1)); - std::vector<float> beta(S*(K+1)); - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - for(int k=0;k<K;k++) { // forward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]]; - minm=(*p2mymin)(minm,mm); - } - alpha[(k+1)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode - } - - if(SK<0) { // final state not specified - for(int i=0;i<S;i++) beta[K*S+i]=0; - } - else { - for(int i=0;i<S;i++) beta[K*S+i]=INF; - beta[K*S+SK]=0.0; - } - - for(int k=K-1;k>=0;k--) { // backward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(int i=0;i<I;i++) { - int i0 = j*I+i; - mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]]; - minm=(*p2mymin)(minm,mm); - } - beta[k*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - beta[k*S+j]-=norm; // normalize total metrics so they do not explode - } - - -if (POSTI && POSTO) -{ - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*(I+O)+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*(I+O)+i]-=norm; // normalize metrics - } - - - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*(I+O)+I+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*(I+O)+I+n]-=norm; // normalize metrics - } -} -else if(POSTI) -{ - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*I+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*I+i]-=norm; // normalize metrics - } -} -else if(POSTO) -{ - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*O+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*O+n]-=norm; // normalize metrics - } -} -else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - -} - -*/ - - - - -int -trellis_siso_f::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == 2*output_items.size()); - int nstreams = output_items.size(); - //printf("general_work:Streams: %d\n",nstreams); - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - - assert (noutput_items % (d_K*multiple) == 0); - int nblocks = noutput_items / (d_K*multiple); - //printf("general_work:Blocks: %d\n",nblocks); - //for(int i=0;i<ninput_items.size();i++) - //printf("general_work:Input items available: %d\n",ninput_items[i]); - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - for (int m=0;m<nstreams;m++) { - const float *in1 = (const float *) input_items[2*m]; - const float *in2 = (const float *) input_items[2*m+1]; - float *out = (float *) output_items[m]; - for (int n=0;n<nblocks;n++) { - siso_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(), - d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(), - d_K,d_S0,d_SK, - d_POSTI,d_POSTO, - p2min, - &(in1[n*d_K*d_FSM.I()]),&(in2[n*d_K*d_FSM.O()]), - &(out[n*d_K*multiple])//, - //d_alpha,d_beta - ); - } - } - - for (unsigned int i = 0; i < input_items.size()/2; i++) { - consume(2*i,d_FSM.I() * noutput_items / multiple ); - consume(2*i+1,d_FSM.O() * noutput_items / multiple ); - } - - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_siso_f.h b/gr-trellis/src/lib/trellis_siso_f.h deleted file mode 100644 index 9341f2468..000000000 --- a/gr-trellis/src/lib/trellis_siso_f.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 INCLUDED_TRELLIS_SISO_F_H -#define INCLUDED_TRELLIS_SISO_F_H - -#include <trellis_api.h> -#include "fsm.h" -#include "siso_type.h" -#include "core_algorithms.h" -#include <gr_block.h> - -class trellis_siso_f; -typedef boost::shared_ptr<trellis_siso_f> trellis_siso_f_sptr; - -TRELLIS_API trellis_siso_f_sptr trellis_make_siso_f ( - const fsm &FSM, // underlying FSM - int K, // block size in trellis steps - int S0, // initial state (put -1 if not specified) - int SK, // final state (put -1 if not specified) - bool POSTI, // true if you want a-posteriori info about the input symbols to be mux-ed in the output - bool POSTO, // true if you want a-posteriori info about the output symbols to be mux-ed in the output - trellis_siso_type_t d_SISO_TYPE // perform "min-sum" or "sum-product" combining -); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API trellis_siso_f : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - bool d_POSTI; - bool d_POSTO; - trellis_siso_type_t d_SISO_TYPE; - //std::vector<float> d_alpha; - //std::vector<float> d_beta; - - friend TRELLIS_API trellis_siso_f_sptr trellis_make_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t d_SISO_TYPE); - - - trellis_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t d_SISO_TYPE); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - bool POSTI () const { return d_POSTI; } - bool POSTO () const { return d_POSTO; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_siso_f.i b/gr-trellis/src/lib/trellis_siso_f.i deleted file mode 100644 index 63bfb48c8..000000000 --- a/gr-trellis/src/lib/trellis_siso_f.i +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -GR_SWIG_BLOCK_MAGIC(trellis,siso_f); - -trellis_siso_f_sptr trellis_make_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE); - - -class trellis_siso_f : public gr_block -{ -private: - trellis_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - bool POSTI () const { return d_POSTI; } - bool POSTO () const { return d_POSTO; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } -}; diff --git a/gr-trellis/src/lib/trellis_viterbi_X.cc.t b/gr-trellis/src/lib/trellis_viterbi_X.cc.t deleted file mode 100644 index cadb89d57..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_X.cc.t +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK) -{ - return gnuradio::get_initial_sptr (new @NAME@ (FSM,K,S0,SK)); -} - -@NAME@::@NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (@TYPE@))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK)//, - //d_trace(FSM.S()*K) -{ - set_relative_rate (1.0 / ((double) d_FSM.O())); - set_output_multiple (d_K); -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_K == 0); - int input_required = d_FSM.O() * noutput_items ; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) { - ninput_items_required[i] = input_required; - } -} - -/* -template -void viterbi_algorithm<@O_TYPE@>(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - const float *in, @O_TYPE@ *out); -*/ - - - -/* Moved it to "core_algorithms.cc" */ -/* -void viterbi_algorithm(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - const float *in, @TYPE@ *out)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - int alphai; - float norm,mm,minm; - int minmi; - int st; - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (@TYPE@) PI[st][i0]; - st=PS[st][i0]; - } - -} - -*/ - - - - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - assert (noutput_items % d_K == 0); - int nblocks = noutput_items / d_K; - - for (int m=0;m<nstreams;m++) { - const float *in = (const float *) input_items[m]; - @TYPE@ *out = (@TYPE@ *) output_items[m]; - for (int n=0;n<nblocks;n++) { - viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]));//,d_trace); - } - } - - consume_each (d_FSM.O() * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_viterbi_X.h.t b/gr-trellis/src/lib/trellis_viterbi_X.h.t deleted file mode 100644 index c0400d341..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_X.h.t +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include <gr_block.h> -#include "core_algorithms.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK); - - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - //std::vector<int> d_trace; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK); - - - @NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - //std::vector<int> trace () const { return d_trace; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - - - - - - - - -#endif diff --git a/gr-trellis/src/lib/trellis_viterbi_X.i.t b/gr-trellis/src/lib/trellis_viterbi_X.i.t deleted file mode 100644 index 063f4a1b3..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_X.i.t +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - //std::vector<short> trace () const { return d_trace; } -}; diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t deleted file mode 100644 index 74611ab8f..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t +++ /dev/null @@ -1,191 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE) -{ - return gnuradio::get_initial_sptr (new @NAME@ (FSM,K,S0,SK,D,TABLE,TYPE)); -} - -@NAME@::@NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, -1, sizeof (@O_TYPE@))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK), - d_D (D), - d_TABLE (TABLE), - d_TYPE (TYPE)//, - //d_trace(FSM.S()*K) -{ - set_relative_rate (1.0 / ((double) d_D)); - set_output_multiple (d_K); -} - - -void @NAME@::set_TABLE(const std::vector<@I_TYPE@> &table) -{ - d_TABLE = table; -} - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_K == 0); - int input_required = d_D * noutput_items ; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) { - ninput_items_required[i] = input_required; - } -} - - - - -/* -void viterbi_algorithm_combined(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE, - const @I_TYPE@ *in, @O_TYPE@ *out)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - float *metric = new float[O]; - int alphai; - float norm,mm,minm; - int minmi; - int st; - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - calc_metric(O, D, TABLE, &(in[k*D]), metric,TYPE); // calc metrics - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+metric[OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (@O_TYPE@) PI[st][i0]; - st=PS[st][i0]; - } - - delete [] metric; - -} - - -*/ - - - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - assert (noutput_items % d_K == 0); - int nblocks = noutput_items / d_K; - - for (int m=0;m<nstreams;m++) { - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[m]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[m]; - for (int n=0;n<nblocks;n++) { - viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,d_D,d_TABLE,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]));//,d_trace); - } - } - - consume_each (d_D * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t deleted file mode 100644 index c7e468e73..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include <gr_block.h> -#include "calc_metric.h" -#include "core_algorithms.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - int d_D; - std::vector<@I_TYPE@> d_TABLE; - trellis_metric_type_t d_TYPE; - //std::vector<int> d_trace; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE); - - - @NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - //std::vector<int> trace () const { return d_trace; } - void set_TABLE (const std::vector<@I_TYPE@> &table); - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t deleted file mode 100644 index 633ded770..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - //std::vector<short> trace () const { return d_trace; } - void set_TABLE (const std::vector<@I_TYPE@> &table); -}; diff --git a/gr-trellis/src/python/CMakeLists.txt b/gr-trellis/src/python/CMakeLists.txt deleted file mode 100644 index f8e4d9532..000000000 --- a/gr-trellis/src/python/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2011-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. - -######################################################################## -# Handle the unit tests -######################################################################## -if(ENABLE_TESTING) - -list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-digital/swig - ${CMAKE_BINARY_DIR}/gr-trellis/src/lib -) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-digital gnuradio-trellis) - -include(GrPython) -include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) -endif(ENABLE_TESTING) diff --git a/gr-trellis/src/python/awgn1o2_4.fsm b/gr-trellis/src/python/awgn1o2_4.fsm deleted file mode 100644 index 9245c69ac..000000000 --- a/gr-trellis/src/python/awgn1o2_4.fsm +++ /dev/null @@ -1,15 +0,0 @@ -2 4 4 - -0 2 -0 2 -1 3 -1 3 - -0 3 -3 0 -1 2 -2 1 - -AWGN CC from Proakis-Salehi pg 779 - - diff --git a/gr-trellis/src/python/qa_trellis.py b/gr-trellis/src/python/qa_trellis.py deleted file mode 100755 index fcc651ec6..000000000 --- a/gr-trellis/src/python/qa_trellis.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2010 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. -# - -import math - - -from gnuradio import gr, gr_unittest, blks2 -# It's pretty ugly that we can't import trellis from gnuradio in this test -# but because it runs on the non-installed python code it's all a mess. -import trellis - -import os -import digital_swig - -fsm_args = {"awgn1o2_4": (2, 4, 4, - (0, 2, 0, 2, 1, 3, 1, 3), - (0, 3, 3, 0, 1, 2, 2, 1), - ), - "rep2": (2, 1, 4, (0, 0), (0, 3)), - "nothing": (2, 1, 2, (0, 0), (0, 1)), - } - -constells = {2: digital_swig.constellation_bpsk(), - 4: digital_swig.constellation_qpsk(), - } - -class test_trellis (gr_unittest.TestCase): - - def test_001_fsm (self): - f = trellis.fsm(*fsm_args["awgn1o2_4"]) - self.assertEqual(fsm_args["awgn1o2_4"],(f.I(),f.S(),f.O(),f.NS(),f.OS())) - - def test_002_fsm (self): - f = trellis.fsm(*fsm_args["awgn1o2_4"]) - g = trellis.fsm(f) - self.assertEqual((g.I(),g.S(),g.O(),g.NS(),g.OS()),(f.I(),f.S(),f.O(),f.NS(),f.OS())) - - def test_003_fsm (self): - # FIXME: no file "awgn1o2_4.fsm" - #f = trellis.fsm("awgn1o2_4.fsm") - #self.assertEqual(fsm_args["awgn1o2_4"],(f.I(),f.S(),f.O(),f.NS(),f.OS())) - pass - - def test_004_fsm(self): - """ Test to make sure fsm works with a single state fsm.""" - # Just checking that it initializes properly. - f = trellis.fsm(*fsm_args["rep2"]) - - def test_001_interleaver (self): - K = 5 - IN = (1,2,3,4,0) - DIN = (4,0,1,2,3) - i = trellis.interleaver(K,IN) - self.assertEqual((K,IN,DIN),(i.K(),i.INTER(),i.DEINTER())) - - def test_001_viterbi(self): - """ - Runs some coding/decoding tests with a few different FSM - specs. - """ - for name, args in fsm_args.items(): - constellation = constells[args[2]] - fsms = trellis.fsm(*args) - noise = 0.1 - tb = trellis_tb(constellation, fsms, noise) - tb.run() - # Make sure all packets succesfully transmitted. - self.assertEqual(tb.dst.ntotal(), tb.dst.nright()) - - -class trellis_tb(gr.top_block): - """ - A simple top block for use testing gr-trellis. - """ - def __init__(self, constellation, f, N0=0.25, seed=-666L): - """ - constellation - a constellation object used for modulation. - f - a finite state machine specification used for coding. - N0 - noise level - seed - random seed - """ - super(trellis_tb, self).__init__() - # packet size in bits (make it multiple of 16 so it can be packed in a short) - packet_size = 1024*16 - # bits per FSM input symbol - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - # packet size in trellis steps - K = packet_size/bitspersymbol - - # TX - src = gr.lfsr_32k_source_s() - # packet size in shorts - src_head = gr.head (gr.sizeof_short, packet_size/16) - # unpack shorts to symbols compatible with the FSM input cardinality - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol, gr.GR_MSB_FIRST) - # initial FSM state = 0 - enc = trellis.encoder_ss(f, 0) - mod = gr.chunks_to_symbols_sc(constellation.points(), 1) - - # CHANNEL - add = gr.add_cc() - noise = gr.noise_source_c(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - # data preprocessing to generate metrics for Viterbi - metrics = trellis.constellation_metrics_cf(constellation.base(), digital_swig.TRELLIS_EUCLIDEAN) - # Put -1 if the Initial/Final states are not set. - va = trellis.viterbi_s(f, K, 0, -1) - # pack FSM input symbols to shorts - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol, gr.GR_MSB_FIRST) - # check the output - self.dst = gr.check_lfsr_32k_s() - - self.connect (src, src_head, s2fsmi, enc, mod) - self.connect (mod, (add, 0)) - self.connect (noise, (add, 1)) - self.connect (add, metrics, va, fsmi2s, self.dst) - - -if __name__ == '__main__': - gr_unittest.run(test_trellis, "test_trellis.xml") diff --git a/gr-uhd/CMakeLists.txt b/gr-uhd/CMakeLists.txt deleted file mode 100644 index 38624b871..000000000 --- a/gr-uhd/CMakeLists.txt +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -find_package(UHD) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) -GR_REGISTER_COMPONENT("gr-uhd" ENABLE_GR_UHD - Boost_FOUND - UHD_FOUND - ENABLE_GR_CORE -) - -GR_SET_GLOBAL(GR_UHD_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/include -) - -SET(GR_PKG_UHD_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/uhd) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_UHD) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_UHD_DESCRIPTION "GNU Radio UHD Blocks") - -CPACK_COMPONENT("uhd_runtime" - GROUP "UHD" - DISPLAY_NAME "Runtime" - DESCRIPTION "Runtime" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("uhd_devel" - GROUP "UHD" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("uhd_python" - GROUP "UHD" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime; GRC xml files" - DEPENDS "core_python;uhd_runtime" -) - -CPACK_COMPONENT("uhd_examples" - GROUP "UHD" - DISPLAY_NAME "Examples" - DESCRIPTION "Example programs" - DEPENDS "uhd_runtime" -) - -CPACK_COMPONENT("uhd_swig" - GROUP "UHD" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;uhd_python;uhd_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(include) -add_subdirectory(lib) -add_subdirectory(doc) -add_subdirectory(examples/c++) -if(ENABLE_PYTHON) - add_subdirectory(swig) - add_subdirectory(grc) - add_subdirectory(apps) - add_subdirectory(examples/python) - add_subdirectory(examples/grc) -endif(ENABLE_PYTHON) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-uhd.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-uhd.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-uhd.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "uhd_devel" -) - -endif(ENABLE_GR_UHD) diff --git a/gr-uhd/apps/CMakeLists.txt b/gr-uhd/apps/CMakeLists.txt deleted file mode 100644 index 1d68c00ac..000000000 --- a/gr-uhd/apps/CMakeLists.txt +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright 2011 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. - -include(GrPython) - -######################################################################## -# Install some uhd apps -######################################################################## -GR_PYTHON_INSTALL( - FILES - uhd_siggen_base.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/uhd - COMPONENT "uhd_python" -) - -GR_PYTHON_INSTALL( - PROGRAMS - uhd_fft - uhd_rx_cfile - uhd_siggen - uhd_siggen_gui - uhd_rx_nogui - DESTINATION ${GR_RUNTIME_DIR} - COMPONENT "uhd_python" -) - -######################################################################## -# Install hf radio apps -######################################################################## -install( - FILES - hf_radio/hfir.sci - hf_radio/radio.xml - hf_radio/README.TXT - hf_radio/ssb_taps - DESTINATION ${GR_PKG_DATA_DIR}/examples/hf_radio - COMPONENT "uhd_python" -) - -GR_PYTHON_INSTALL( - PROGRAMS - hf_radio/input.py - hf_radio/output.py - hf_radio/ssbagc.py - hf_radio/ssbdemod.py - hf_radio/startup.py - DESTINATION ${GR_PKG_DATA_DIR}/examples/hf_radio - COMPONENT "uhd_python" -) - -GR_PYTHON_INSTALL( - PROGRAMS - hf_radio/radio.py - hf_radio/ui.py - DESTINATION ${GR_PKG_DATA_DIR}/examples/hf_radio - COMPONENT "uhd_python" -) - -######################################################################## -# Install hf explorer -######################################################################## -install( - FILES - hf_explorer/README - hf_explorer/hfx_help - DESTINATION ${GR_PKG_DATA_DIR}/examples/hf_explorer - COMPONENT "uhd_python" -) - -GR_PYTHON_INSTALL( - PROGRAMS - hf_explorer/hfx.py - DESTINATION ${GR_PKG_DATA_DIR}/examples/hf_explorer - COMPONENT "uhd_python" -) diff --git a/gr-uhd/apps/hf_explorer/README b/gr-uhd/apps/hf_explorer/README deleted file mode 100644 index 57f45ceba..000000000 --- a/gr-uhd/apps/hf_explorer/README +++ /dev/null @@ -1,42 +0,0 @@ -hfx.py is meant to be a full-featured Long Wave / Medium Wave -and Short Wave (250kHz to 30Mhz) AM and Single Sideband receiver. -It uses the USRP with a Basic RX board, and will need an -antenna and some preamps, about 30db gain will work. See the -'Help' menu or hfx_help for more info. - ----------------------------------------------------------- - -Powermate knob supported but not required, tooltip frequency display, -single click tuning, AGC, record to disk, play from disk and record -audio. Ability to tailor the audio passband with two sliders over the -spectrum display. The sliders almost align with the actual -frequency. Preset filter settings for LSB (-3000 to 0kHz), USB (0 to -+3000kHz), CW (-400 to -800Hz) and AM (-5kHz from carrier to +5kHz). - -AM now switches in a synchronous PLL detector with the carriers at -7.5kHz. The PLL carrier is displayed in the bottom display and helps -show where on the upper spectrum the demodulated signal -lies. Everything gets shifted up 7.5kHz in AM, center frequency, -tooltips, etc. The target AM carrier needs to be closely tuned in, it -will have a hollow sound untill it is locked, and then the PLL carrier -in the bottom display will jump up and remain relatively -constant. There is a slider "AM sync carrier" to play with different -levels to mix with the signal for demodulation. The filter in AM is -preset to 2500/12500 (7.5kHz +/- 5kHz) and is handy for removing -adjacent channel interference. Change AM_SYNC_DISPLAY in script for -whether to show AM Sync carrier or not. - -Run with "-h" for command line help with setting USRP ddc center -frequency, decimation, rf data record, playback and audio data -recording. - -There are some controls for controlling a varactor and tuning an -antenna - just ignore them unless you want to build a voltage tuned -antenna to track frequency. - -There is also code for Web based control of frequency and volume - so -I can tune the radio with an Ipaq from bed. Disabled by default - it -takes a web server, some directories and scripts to use. - - - diff --git a/gr-uhd/apps/hf_explorer/hfx.py b/gr-uhd/apps/hf_explorer/hfx.py deleted file mode 100755 index 1f08bd8ba..000000000 --- a/gr-uhd/apps/hf_explorer/hfx.py +++ /dev/null @@ -1,823 +0,0 @@ -#!/usr/bin/env python -# generated by wxGlade 0.4 on Tue Mar 14 10:16:06 2006 -# -# Copyright 2006,2011 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. -# -#----------------------------------------------------------------- -# -# +-->(fft) -# | -# (src)->(xlate)--+->(audio filter)--+-->(sel_am)-+--------------+ -# | | | -# | (pll) | -# | | | -# | (pll_carrier_scale) | -# | | | -# | (pll_carrier_filter) | -# | | | -# | +--(fft2) | -# | | | -# | +--(c2f3)--+ | -# | | | | -# | (phaser1) (phaser2) | -# | | | | -# | +--(f2c)---+ | -# | | V -# V +---------->(am_det) -# (c2f) | -# | (c2f2) -# | | -# +-->(sel_sb)------------>(combine) -# | -# V -# +--------------------------(scale) -# | | -# | | -# | +++ -# V | | -# (agc)<--(offset)<--(intr)<---(sqr1) -# | -# V -# (dst) -# -#---------------------------------------------------------------------- -# -# Versions 2.2.1 adds loop antenna automatic tuner -# -# 2.3.1 adds web control, made AM Sync display optional, -# added more comments. -# -# 2.4.1 updates usrp interface to support auto subdev -# -# 2.8.1 changed saved file format from 8-byte complex to -# 4-byte short for obvious storage space savings. - -# Web server control disabled by default. Do not enable -# until directory structure and scripts are in place. -WEB_CONTROL = False - -# Controls display of AM Sync Carrier - turn off for smaller -# window if not needed -AM_SYNC_DISPLAY = False - -import os, wx, sys, math -import wx.lib.evtmgr as em -from gnuradio.wxgui import powermate, fftsink2 -from gnuradio import gr, audio, eng_notation -from gnuradio.eng_option import eng_option -from gnuradio import uhd -from optparse import OptionParser - -n2s = eng_notation.num_to_str - -ID_BUTTON_1 = wx.NewId() # LSB button -ID_BUTTON_2 = wx.NewId() # USB -ID_BUTTON_3 = wx.NewId() # AM -ID_BUTTON_4 = wx.NewId() # CW -ID_BUTTON_5 = wx.NewId() # Powermate controls: Upper audio freq cutoff -ID_BUTTON_6 = wx.NewId() # " Lower audio freq cutoff -ID_BUTTON_7 = wx.NewId() # " Frequency -ID_BUTTON_8 = wx.NewId() # " Volume -ID_BUTTON_9 = wx.NewId() # " Time -ID_BUTTON_10 = wx.NewId() # Time Seek Forwards -ID_BUTTON_11 = wx.NewId() # Time Seek Backwards -ID_BUTTON_12 = wx.NewId() # Automatic Antenna Tune (AT) enable -ID_BUTTON_13 = wx.NewId() # AT Calibrate point -ID_BUTTON_14 = wx.NewId() # AT Reset -ID_TEXT_1 = wx.NewId() # Band Center, USRP ddc Freq -ID_SPIN_1 = wx.NewId() # Frequency display and control -ID_SLIDER_1 = wx.NewId() # Upper audio freq cutoff -ID_SLIDER_2 = wx.NewId() # Lower audio freq cutoff -ID_SLIDER_3 = wx.NewId() # Frequency -ID_SLIDER_4 = wx.NewId() # Volume -ID_SLIDER_5 = wx.NewId() # Programmable Gain Amp, PGA, RF gain -ID_SLIDER_6 = wx.NewId() # AM Sync carrier level -ID_SLIDER_7 = wx.NewId() # AT control voltage output -ID_EXIT = wx.NewId() # Menu Exit - - -class MyFrame(wx.Frame): - def __init__(self, *args, **kwds): - # begin wxGlade: MyFrame.__init__ - kwds["style"] = wx.DEFAULT_FRAME_STYLE - wx.Frame.__init__(self, *args, **kwds) - - # Menu Bar - self.frame_1_menubar = wx.MenuBar() - self.SetMenuBar(self.frame_1_menubar) - wxglade_tmp_menu = wx.Menu() - self.Exit = wx.MenuItem(wxglade_tmp_menu, ID_EXIT, "Exit", - "Exit", wx.ITEM_NORMAL) - wxglade_tmp_menu.AppendItem(self.Exit) - self.frame_1_menubar.Append(wxglade_tmp_menu, "File") - # Menu Bar end - self.panel_1 = wx.Panel(self, -1) - self.button_1 = wx.Button(self, ID_BUTTON_1, "LSB") - self.button_2 = wx.Button(self, ID_BUTTON_2, "USB") - self.button_3 = wx.Button(self, ID_BUTTON_3, "AM") - self.button_4 = wx.Button(self, ID_BUTTON_4, "CW") - self.button_5 = wx.ToggleButton(self, ID_BUTTON_5, "Upper") - self.slider_fcutoff_hi = wx.Slider(self, ID_SLIDER_1, 0, -15798, 15799, - style=wx.SL_HORIZONTAL|wx.SL_LABELS) - self.button_6 = wx.ToggleButton(self, ID_BUTTON_6, "Lower") - self.slider_fcutoff_lo = wx.Slider(self, ID_SLIDER_2, 0, -15799, 15798, - style=wx.SL_HORIZONTAL|wx.SL_LABELS) - self.panel_5 = wx.Panel(self, -1) - self.label_1 = wx.StaticText(self, -1, " Band\nCenter") - self.text_ctrl_1 = wx.TextCtrl(self, ID_TEXT_1, "") - self.panel_6 = wx.Panel(self, -1) - self.panel_7 = wx.Panel(self, -1) - self.panel_2 = wx.Panel(self, -1) - self.button_7 = wx.ToggleButton(self, ID_BUTTON_7, "Freq") - self.slider_3 = wx.Slider(self, ID_SLIDER_3, 3000, 0, 6000) - self.spin_ctrl_1 = wx.SpinCtrl(self, ID_SPIN_1, "", min=0, max=100) - self.button_8 = wx.ToggleButton(self, ID_BUTTON_8, "Vol") - self.slider_4 = wx.Slider(self, ID_SLIDER_4, 0, 0, 500) - self.slider_5 = wx.Slider(self, ID_SLIDER_5, 0, 0, 20) - self.button_9 = wx.ToggleButton(self, ID_BUTTON_9, "Time") - self.button_11 = wx.Button(self, ID_BUTTON_11, "Rew") - self.button_10 = wx.Button(self, ID_BUTTON_10, "Fwd") - self.panel_3 = wx.Panel(self, -1) - self.label_2 = wx.StaticText(self, -1, "PGA ") - self.panel_4 = wx.Panel(self, -1) - self.panel_8 = wx.Panel(self, -1) - self.panel_9 = wx.Panel(self, -1) - self.label_3 = wx.StaticText(self, -1, "AM Sync\nCarrier") - self.slider_6 = wx.Slider(self, ID_SLIDER_6, 50, 0, 200, - style=wx.SL_HORIZONTAL|wx.SL_LABELS) - self.label_4 = wx.StaticText(self, -1, "Antenna Tune") - self.slider_7 = wx.Slider(self, ID_SLIDER_7, 1575, 950, 2200, - style=wx.SL_HORIZONTAL|wx.SL_LABELS) - self.panel_10 = wx.Panel(self, -1) - self.button_12 = wx.ToggleButton(self, ID_BUTTON_12, "Auto Tune") - self.button_13 = wx.Button(self, ID_BUTTON_13, "Calibrate") - self.button_14 = wx.Button(self, ID_BUTTON_14, "Reset") - self.panel_11 = wx.Panel(self, -1) - self.panel_12 = wx.Panel(self, -1) - - self.__set_properties() - self.__do_layout() - # end wxGlade - - parser = OptionParser (option_class=eng_option) - parser.add_option("", "--address", type="string", default="addr=192.168.10.2", - help="Address of UHD device, [default=%default]") - parser.add_option ("-c", "--ddc-freq", type="eng_float", default=3.9e6, - help="set Rx DDC frequency to FREQ", metavar="FREQ") - parser.add_option ("-s", "--samp-rate", type="eng_float", default=256e3, - help="set sample rate (bandwidth) [default=%default]") - parser.add_option ("-a", "--audio_file", default="", - help="audio output file", metavar="FILE") - parser.add_option ("-r", "--radio_file", default="", - help="radio output file", metavar="FILE") - parser.add_option ("-i", "--input_file", default="", - help="radio input file", metavar="FILE") - parser.add_option ("-O", "--audio-output", type="string", default="", - help="audio output device name. E.g., hw:0,0, /dev/dsp, or pulse") - - (options, args) = parser.parse_args () - - self.usrp_center = options.ddc_freq - input_rate = options.samp_rate - self.slider_range = input_rate * 0.9375 - self.f_lo = self.usrp_center - (self.slider_range/2) - self.f_hi = self.usrp_center + (self.slider_range/2) - self.af_sample_rate = 32000 - fir_decim = long (input_rate / self.af_sample_rate) - - # data point arrays for antenna tuner - self.xdata = [] - self.ydata = [] - - self.tb = gr.top_block() - - # radio variables, initial conditions - self.frequency = self.usrp_center - # these map the frequency slider (0-6000) to the actual range - self.f_slider_offset = self.f_lo - self.f_slider_scale = 10000 - self.spin_ctrl_1.SetRange(self.f_lo,self.f_hi) - self.text_ctrl_1.SetValue(str(int(self.usrp_center))) - self.slider_5.SetValue(0) - self.AM_mode = False - - self.slider_3.SetValue((self.frequency-self.f_slider_offset)/self.f_slider_scale) - self.spin_ctrl_1.SetValue(int(self.frequency)) - - POWERMATE = True - try: - self.pm = powermate.powermate(self) - except: - sys.stderr.write("Unable to find PowerMate or Contour Shuttle\n") - POWERMATE = False - - if POWERMATE: - powermate.EVT_POWERMATE_ROTATE(self, self.on_rotate) - powermate.EVT_POWERMATE_BUTTON(self, self.on_pmButton) - self.active_button = 7 - - # command line options - if options.audio_file == "": SAVE_AUDIO_TO_FILE = False - else: SAVE_AUDIO_TO_FILE = True - if options.radio_file == "": SAVE_RADIO_TO_FILE = False - else: SAVE_RADIO_TO_FILE = True - if options.input_file == "": self.PLAY_FROM_USRP = True - else: self.PLAY_FROM_USRP = False - - if self.PLAY_FROM_USRP: - self.src = uhd.usrp_source(device_addr=options.address, - io_type=uhd.io_type.COMPLEX_FLOAT32, - num_channels=1) - self.src.set_samp_rate(input_rate) - input_rate = self.src.get_samp_rate() - - self.src.set_center_freq(self.usrp_center, 0) - self.tune_offset = 0 - - else: - self.src = gr.file_source (gr.sizeof_short,options.input_file) - self.tune_offset = 2200 # 2200 works for 3.5-4Mhz band - - # convert rf data in interleaved short int form to complex - s2ss = gr.stream_to_streams(gr.sizeof_short,2) - s2f1 = gr.short_to_float() - s2f2 = gr.short_to_float() - src_f2c = gr.float_to_complex() - self.tb.connect(self.src,s2ss) - self.tb.connect((s2ss,0),s2f1) - self.tb.connect((s2ss,1),s2f2) - self.tb.connect(s2f1,(src_f2c,0)) - self.tb.connect(s2f2,(src_f2c,1)) - - # save radio data to a file - if SAVE_RADIO_TO_FILE: - radio_file = gr.file_sink(gr.sizeof_short, options.radio_file) - self.tb.connect (self.src, radio_file) - - # 2nd DDC - xlate_taps = gr.firdes.low_pass ( \ - 1.0, input_rate, 16e3, 4e3, gr.firdes.WIN_HAMMING ) - self.xlate = gr.freq_xlating_fir_filter_ccf ( \ - fir_decim, xlate_taps, self.tune_offset, input_rate ) - - # Complex Audio filter - audio_coeffs = gr.firdes.complex_band_pass ( - 1.0, # gain - self.af_sample_rate, # sample rate - -3000, # low cutoff - 0, # high cutoff - 100, # transition - gr.firdes.WIN_HAMMING) # window - self.slider_fcutoff_hi.SetValue(0) - self.slider_fcutoff_lo.SetValue(-3000) - - self.audio_filter = gr.fir_filter_ccc(1, audio_coeffs) - - # Main +/- 16Khz spectrum display - self.fft = fftsink2.fft_sink_c(self.panel_2, fft_size=512, - sample_rate=self.af_sample_rate, - average=True, size=(640,240)) - - # AM Sync carrier - if AM_SYNC_DISPLAY: - self.fft2 = fftsink.fft_sink_c(self.tb, self.panel_9, - y_per_div=20, fft_size=512, - sample_rate=self.af_sample_rate, - average=True, size=(640,240)) - - c2f = gr.complex_to_float() - - # AM branch - self.sel_am = gr.multiply_const_cc(0) - # the following frequencies turn out to be in radians/sample - # gr.pll_refout_cc(alpha,beta,min_freq,max_freq) - # suggested alpha = X, beta = .25 * X * X - pll = gr.pll_refout_cc(.5,.0625,(2.*math.pi*7.5e3/self.af_sample_rate), - (2.*math.pi*6.5e3/self.af_sample_rate)) - self.pll_carrier_scale = gr.multiply_const_cc(complex(10,0)) - am_det = gr.multiply_cc() - # these are for converting +7.5kHz to -7.5kHz - # for some reason gr.conjugate_cc() adds noise ?? - c2f2 = gr.complex_to_float() - c2f3 = gr.complex_to_float() - f2c = gr.float_to_complex() - phaser1 = gr.multiply_const_ff(1) - phaser2 = gr.multiply_const_ff(-1) - - # filter for pll generated carrier - pll_carrier_coeffs = gr.firdes.complex_band_pass ( - 2.0, # gain - self.af_sample_rate, # sample rate - 7400, # low cutoff - 7600, # high cutoff - 100, # transition - gr.firdes.WIN_HAMMING) # window - - self.pll_carrier_filter = gr.fir_filter_ccc (1, pll_carrier_coeffs) - - self.sel_sb = gr.multiply_const_ff(1) - combine = gr.add_ff() - - #AGC - sqr1 = gr.multiply_ff() - intr = gr.iir_filter_ffd ( [.004, 0], [0, .999] ) - offset = gr.add_const_ff(1) - agc = gr.divide_ff() - - self.scale = gr.multiply_const_ff(0.00001) - dst = audio.sink(long(self.af_sample_rate), - options.audio_output) - - - if self.PLAY_FROM_USRP: - self.tb.connect(self.src, self.xlate, self.fft) - else: - self.tb.connect(src_f2c, self.xlate, self.fft) - - self.tb.connect(self.xlate,self.audio_filter,self.sel_am,(am_det,0)) - self.tb.connect(self.sel_am,pll,self.pll_carrier_scale, - self.pll_carrier_filter,c2f3) - self.tb.connect((c2f3,0),phaser1,(f2c,0)) - self.tb.connect((c2f3,1),phaser2,(f2c,1)) - self.tb.connect(f2c,(am_det,1)) - self.tb.connect(am_det,c2f2,(combine,0)) - self.tb.connect(self.audio_filter,c2f, - self.sel_sb,(combine,1)) - - if AM_SYNC_DISPLAY: - self.tb.connect(self.pll_carrier_filter,self.fft2) - - self.tb.connect(combine,self.scale) - self.tb.connect(self.scale,(sqr1,0)) - self.tb.connect(self.scale,(sqr1,1)) - self.tb.connect(sqr1, intr, offset, (agc, 1)) - self.tb.connect(self.scale,(agc, 0)) - self.tb.connect(agc,dst) - - if SAVE_AUDIO_TO_FILE: - f_out = gr.file_sink(gr.sizeof_short,options.audio_file) - sc1 = gr.multiply_const_ff(64000) - f2s1 = gr.float_to_short() - self.tb.connect(agc,sc1,f2s1,f_out) - - self.tb.start() - - # for mouse position reporting on fft display - self.fft.win.Bind(wx.EVT_LEFT_UP, self.Mouse) - # and left click to re-tune - self.fft.win.Bind(wx.EVT_LEFT_DOWN, self.Click) - - # start a timer to check for web commands - if WEB_CONTROL: - self.timer = UpdateTimer(self, 1000) # every 1000 mSec, 1 Sec - - - wx.EVT_BUTTON(self,ID_BUTTON_1,self.set_lsb) - wx.EVT_BUTTON(self,ID_BUTTON_2,self.set_usb) - wx.EVT_BUTTON(self,ID_BUTTON_3,self.set_am) - wx.EVT_BUTTON(self,ID_BUTTON_4,self.set_cw) - wx.EVT_BUTTON(self,ID_BUTTON_10,self.fwd) - wx.EVT_BUTTON(self,ID_BUTTON_11,self.rew) - wx.EVT_BUTTON(self, ID_BUTTON_13, self.AT_calibrate) - wx.EVT_BUTTON(self, ID_BUTTON_14, self.AT_reset) - wx.EVT_TOGGLEBUTTON(self,ID_BUTTON_5,self.on_button) - wx.EVT_TOGGLEBUTTON(self,ID_BUTTON_6,self.on_button) - wx.EVT_TOGGLEBUTTON(self,ID_BUTTON_7,self.on_button) - wx.EVT_TOGGLEBUTTON(self,ID_BUTTON_8,self.on_button) - wx.EVT_TOGGLEBUTTON(self,ID_BUTTON_9,self.on_button) - wx.EVT_SLIDER(self,ID_SLIDER_1,self.set_filter) - wx.EVT_SLIDER(self,ID_SLIDER_2,self.set_filter) - wx.EVT_SLIDER(self,ID_SLIDER_3,self.slide_tune) - wx.EVT_SLIDER(self,ID_SLIDER_4,self.set_volume) - wx.EVT_SLIDER(self,ID_SLIDER_5,self.set_pga) - wx.EVT_SLIDER(self,ID_SLIDER_6,self.am_carrier) - wx.EVT_SLIDER(self,ID_SLIDER_7,self.antenna_tune) - wx.EVT_SPINCTRL(self,ID_SPIN_1,self.spin_tune) - - wx.EVT_MENU(self, ID_EXIT, self.TimeToQuit) - - def __set_properties(self): - # begin wxGlade: MyFrame.__set_properties - self.SetTitle("HF Explorer") - self.slider_fcutoff_hi.SetMinSize((450, 38)) - self.slider_fcutoff_lo.SetMinSize((450, 38)) - self.panel_2.SetMinSize((640, 240)) - self.button_7.SetValue(1) - self.slider_3.SetMinSize((450, 19)) - self.slider_4.SetMinSize((275, 19)) - self.slider_5.SetMinSize((275, 19)) - if AM_SYNC_DISPLAY: - self.panel_9.SetMinSize((640, 240)) - self.slider_6.SetMinSize((300, 38)) - self.slider_7.SetMinSize((400, 38)) - # end wxGlade - - def __do_layout(self): - # begin wxGlade: MyFrame.__do_layout - sizer_1 = wx.BoxSizer(wx.VERTICAL) - grid_sizer_1 = wx.FlexGridSizer(11, 2, 0, 0) - sizer_7 = wx.BoxSizer(wx.HORIZONTAL) - sizer_5 = wx.BoxSizer(wx.HORIZONTAL) - sizer_4 = wx.BoxSizer(wx.HORIZONTAL) - sizer_3 = wx.BoxSizer(wx.HORIZONTAL) - sizer_6 = wx.BoxSizer(wx.VERTICAL) - sizer_2 = wx.BoxSizer(wx.HORIZONTAL) - grid_sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0) - sizer_2.Add(self.button_1, 0, wx.ADJUST_MINSIZE, 0) - sizer_2.Add(self.button_2, 0, wx.ADJUST_MINSIZE, 0) - sizer_2.Add(self.button_3, 0, wx.ADJUST_MINSIZE, 0) - sizer_2.Add(self.button_4, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(sizer_2, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.button_5, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.slider_fcutoff_hi, 0, - wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.button_6, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.slider_fcutoff_lo, 0, - wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0) - sizer_6.Add(self.panel_5, 1, wx.EXPAND, 0) - sizer_6.Add(self.label_1, 0, - wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0) - sizer_6.Add(self.text_ctrl_1, 0, wx.ADJUST_MINSIZE, 0) - sizer_6.Add(self.panel_6, 1, wx.EXPAND, 0) - sizer_6.Add(self.panel_7, 1, wx.EXPAND, 0) - grid_sizer_1.Add(sizer_6, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.panel_2, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.button_7, 0, wx.ADJUST_MINSIZE, 0) - sizer_3.Add(self.slider_3, 0, wx.ADJUST_MINSIZE, 0) - sizer_3.Add(self.spin_ctrl_1, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(sizer_3, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.button_8, 0, wx.ADJUST_MINSIZE, 0) - sizer_4.Add(self.slider_4, 0, wx.ADJUST_MINSIZE, 0) - sizer_4.Add(self.slider_5, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(sizer_4, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.button_9, 0, wx.ADJUST_MINSIZE, 0) - sizer_5.Add(self.button_11, 0, wx.ADJUST_MINSIZE, 0) - sizer_5.Add(self.button_10, 0, wx.ADJUST_MINSIZE, 0) - sizer_5.Add(self.panel_3, 1, wx.EXPAND, 0) - sizer_5.Add(self.label_2, 0, wx.ADJUST_MINSIZE, 0) - sizer_5.Add(self.panel_4, 1, wx.EXPAND, 0) - grid_sizer_1.Add(sizer_5, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.panel_8, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.panel_9, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.label_3, 0, - wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.slider_6, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.label_4, 0, - wx.ALIGN_BOTTOM|wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.slider_7, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.panel_10, 1, wx.EXPAND, 0) - sizer_7.Add(self.button_12, 0, wx.ADJUST_MINSIZE, 0) - sizer_7.Add(self.button_13, 0, wx.ADJUST_MINSIZE, 0) - sizer_7.Add(self.button_14, 0, wx.ADJUST_MINSIZE, 0) - sizer_7.Add(self.panel_11, 1, wx.EXPAND, 0) - sizer_7.Add(self.panel_12, 1, wx.EXPAND, 0) - grid_sizer_1.Add(sizer_7, 1, wx.EXPAND, 0) - sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0) - self.SetAutoLayout(True) - self.SetSizer(sizer_1) - sizer_1.Fit(self) - sizer_1.SetSizeHints(self) - self.Layout() - # end wxGlade - - # Menu exit - def TimeToQuit(self, event): - self.tb.stop() - self.Close(True) - - # Powermate being turned - def on_rotate(self, event): - if self.active_button == 5: - self.slider_fcutoff_hi.SetValue(self.slider_fcutoff_hi.GetValue()+event.delta) - if self.slider_fcutoff_lo.GetValue() > (self.slider_fcutoff_hi.GetValue() - 200) : - self.slider_fcutoff_lo.SetValue(self.slider_fcutoff_hi.GetValue() - 200) - self.filter() - if self.active_button == 6: - self.slider_fcutoff_lo.SetValue(self.slider_fcutoff_lo.GetValue()+event.delta) - if self.slider_fcutoff_hi.GetValue() < (self.slider_fcutoff_lo.GetValue() + 200) : - self.slider_fcutoff_hi.SetValue(self.slider_fcutoff_lo.GetValue() + 200) - self.filter() - if self.active_button == 7: - new = max(0, min(6000, self.slider_3.GetValue() + event.delta)) - self.slider_3.SetValue(new) - self.frequency = (self.f_slider_scale * new) + self.f_slider_offset - self.spin_ctrl_1.SetValue(self.frequency) - if self.AM_mode == False: - self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset)) - else: - self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset - 7.5e3)) - if self.button_12.GetValue(): - self.auto_antenna_tune() - if self.active_button == 8: - new = max(0, min(500, self.slider_4.GetValue() + event.delta)) - self.slider_4.SetValue(new) - self.scale.set_k(math.pow(10.,((self.slider_4.GetValue()-500.)/100.))) - if self.active_button == 9: - if self.PLAY_FROM_USRP == False: - if event.delta == -1: - self.src.seek(-1000000,gr.SEEK_CUR) - elif event.delta == 1: - self.src.seek(1000000,gr.SEEK_CUR) - - - # Powermate pressed to switch controlled function - def on_pmButton(self, event): - if event.value == 0: - if self.active_button == 5: - self.active_button = 6 - self.button_5.SetValue(False) - self.button_6.SetValue(True) - elif self.active_button == 6: - self.active_button = 7 - self.button_6.SetValue(False) - self.button_7.SetValue(True) - elif self.active_button == 7: - self.active_button = 8 - self.button_7.SetValue(False) - self.button_8.SetValue(True) - elif self.active_button == 8: - self.active_button = 9 - self.button_8.SetValue(False) - self.button_9.SetValue(True) - elif self.active_button == 9: - self.active_button = 5 - self.button_9.SetValue(False) - self.button_5.SetValue(True) - - # Clicking one PM control button turns the rest off - def on_button(self, event): - id = event.GetId() - if id == ID_BUTTON_5: - self.active_button = 5 - self.button_6.SetValue(False) - self.button_7.SetValue(False) - self.button_8.SetValue(False) - self.button_9.SetValue(False) - if id == ID_BUTTON_6: - self.active_button = 6 - self.button_5.SetValue(False) - self.button_7.SetValue(False) - self.button_8.SetValue(False) - self.button_9.SetValue(False) - if id == ID_BUTTON_7: - self.active_button = 7 - self.button_5.SetValue(False) - self.button_6.SetValue(False) - self.button_8.SetValue(False) - self.button_9.SetValue(False) - if id == ID_BUTTON_8: - self.active_button = 8 - self.button_5.SetValue(False) - self.button_6.SetValue(False) - self.button_7.SetValue(False) - self.button_9.SetValue(False) - if id == ID_BUTTON_9: - self.active_button = 9 - self.button_5.SetValue(False) - self.button_6.SetValue(False) - self.button_7.SetValue(False) - self.button_8.SetValue(False) - - # Make sure filter settings are legal - def set_filter(self, event): - slider = event.GetId() - slider1 = self.slider_fcutoff_hi.GetValue() - slider2 = self.slider_fcutoff_lo.GetValue() - if slider == ID_SLIDER_1: - if slider2 > (self.slider_fcutoff_hi.GetValue() - 200) : - self.slider_fcutoff_lo.SetValue(slider1 - 200) - elif slider == ID_SLIDER_2: - if slider1 < (self.slider_fcutoff_lo.GetValue() + 200) : - self.slider_fcutoff_hi.SetValue(slider2 + 200) - self.filter() - - # Calculate taps and apply - def filter(self): - audio_coeffs = gr.firdes.complex_band_pass ( - 1.0, # gain - self.af_sample_rate, # sample rate - self.slider_fcutoff_lo.GetValue(), # low cutoff - self.slider_fcutoff_hi.GetValue(), # high cutoff - 100, # transition - gr.firdes.WIN_HAMMING) # window - self.audio_filter.set_taps(audio_coeffs) - - def set_lsb(self, event): - self.AM_mode = False - self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset)) - self.sel_sb.set_k(1) - self.sel_am.set_k(0) - self.slider_fcutoff_hi.SetValue(0) - self.slider_fcutoff_lo.SetValue(-3000) - self.filter() - - def set_usb(self, event): - self.AM_mode = False - self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset)) - self.sel_sb.set_k(1) - self.sel_am.set_k(0) - self.slider_fcutoff_hi.SetValue(3000) - self.slider_fcutoff_lo.SetValue(0) - self.filter() - - def set_am(self, event): - self.AM_mode = True - self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset - 7.5e3)) - self.sel_sb.set_k(0) - self.sel_am.set_k(1) - self.slider_fcutoff_hi.SetValue(12500) - self.slider_fcutoff_lo.SetValue(2500) - self.filter() - - def set_cw(self, event): - self.AM_mode = False - self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset)) - self.AM_mode = False - self.sel_sb.set_k(1) - self.sel_am.set_k(0) - self.slider_fcutoff_hi.SetValue(-400) - self.slider_fcutoff_lo.SetValue(-800) - self.filter() - - def set_volume(self, event): - self.scale.set_k(math.pow(10.,((self.slider_4.GetValue()-500.)/100.))) - - def set_pga(self,event): - if self.PLAY_FROM_USRP: - self.src.set_gain(self.slider_5.GetValue()) - - def slide_tune(self, event): - self.frequency = (self.f_slider_scale * self.slider_3.GetValue()) + self.f_slider_offset - if self.AM_mode == False: - self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset)) - else: - self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset - 7.5e3)) - self.spin_ctrl_1.SetValue(self.frequency) - if self.button_12.GetValue(): - self.auto_antenna_tune() - - def spin_tune(self, event): - self.frequency = self.spin_ctrl_1.GetValue() - if self.AM_mode == False: - self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset)) - else: - self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset - 7.5e3)) - self.slider_3.SetValue(int((self.frequency-self.f_slider_offset)/self.f_slider_scale)) - if self.button_12.GetValue(): - self.auto_antenna_tune() - - # Seek forwards in file - def fwd(self, event): - if self.PLAY_FROM_USRP == False: - self.src.seek(10000000,gr.SEEK_CUR) - - # Seek backwards in file - def rew(self, event): - if self.PLAY_FROM_USRP == False: - self.src.seek(-10000000,gr.SEEK_CUR) - - # Mouse over fft display - show frequency in tooltip - def Mouse(self,event): - if self.AM_mode: - fRel = ( event.GetX() - 330. ) / 14.266666 - 7.5 - else: - fRel = ( event.GetX() - 330. ) / 14.266666 - self.fft.win.SetToolTip(wx.ToolTip(eng_notation.num_to_str(self.frequency + (fRel*1e3)))) - - # Mouse clicked on fft display - change frequency - def Click(self,event): - fRel = ( event.GetX() - 330. ) / 14.266666 - if self.AM_mode == False: - self.frequency = self.frequency + (fRel*1e3) - else: - self.frequency = self.frequency + (fRel*1e3) - 7.5e3 - self.spin_ctrl_1.SetValue(int(self.frequency)) - self.slider_3.SetValue(int((self.frequency-self.f_slider_offset)/self.f_slider_scale)) - if self.AM_mode == False: - self.xlate.set_center_freq ( self.usrp_center - ( self.frequency - self.tune_offset )) - else: - self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset - 7.5e3)) - - # Set power of AM sync carrier - def am_carrier(self,event): - scale = math.pow(10,(self.slider_6.GetValue())/50.) - self.pll_carrier_scale.set_k(complex(scale,0)) - - # Reset AT data and start calibrate over - def AT_reset(self, event): - self.xdata = [] - self.ydata = [] - - # Save AT setting for a particular frequency - def AT_calibrate(self, event): - self.xdata.append(float(self.frequency)) - self.ydata.append(self.slider_7.GetValue()) - if len(self.xdata) > 1: - self.m = [] - self.b = [] - for i in range(0,len(self.xdata)-1): - self.m.append( (self.ydata[i+1] - self.ydata[i]) / (self.xdata[i+1] - self.xdata[i]) ) - self.b.append( self.ydata[i] - self.m[i] * self.xdata[i] ) - - # Lookup calibrated points and calculate interpolated antenna tune voltage. - # This is to automatically tune a narrowband loop antenna when the freq - # is changed, to keep signals peaked. - def auto_antenna_tune(self): - for i in range(0,len(self.xdata)-1): - if (self.frequency > self.xdata[i]) & (self.frequency < self.xdata[i+1]): - self.slider_7.SetValue(self.m[i]*self.frequency + self.b[i]) - self.antenna_tune(0) - - # Slider to set loop antenna capacitance - def antenna_tune(self, evt): - if self.PLAY_FROM_USRP: - dev = self.src.get_dboard_iface() - dev.write_aux_dac(uhd.dboard_iface.UNIT_RX, - uhd.dboard_iface.AUX_DAC_C, - float(self.slider_7.GetValue())) - - # Timer events - check for web commands - def OnUpdate(self): - cmds = os.listdir("/var/www/cgi-bin/commands/") - if cmds!=[]: - if cmds[0]=='chfreq': - fd=open("/var/www/cgi-bin/commands/chfreq","r") - new=fd.readline() - fd.close() - if new!='': - os.unlink("/var/www/cgi-bin/commands/chfreq") - if ( int(new) >= self.f_lo ) & ( int(new) <= self.f_hi ): - self.frequency = int(new) - self.slider_3.SetValue(( self.frequency - self.f_slider_offset) / self.f_slider_scale ) - self.spin_ctrl_1.SetValue(self.frequency) - if self.button_12.GetValue(): - self.auto_antenna_tune() - if self.AM_mode: - self.xlate.set_center_freq ( self.usrp_center - ( self.frequency - self.tune_offset - 7.5e3 )) - else: - self.xlate.set_center_freq ( self.usrp_center - ( self.frequency - self.tune_offset )) - - if cmds[0]=='chvolume': - fd=open("/var/www/cgi-bin/commands/chvolume","r") - new=fd.readline() - fd.close() - if new!='': - os.unlink("/var/www/cgi-bin/commands/chvolume") - if ( int(new) >= 0 ) & ( int(new) <= 500 ): - self.volume = int(new) - self.slider_4.SetValue(self.volume) - self.scale.set_k(math.pow(10.,((self.slider_4.GetValue()-500.)/100.))) - - else: # no new web commands, update state - fh = open("/var/www/cgi-bin/state/freq","w") - fh.write(str(int(self.frequency))+'\n') - fh.close() - fh = open("/var/www/cgi-bin/state/volume","w") - fh.write(str(self.slider_4.GetValue())+'\n') - fh.close() - - -# end of class MyFrame - -# wx.Timer to check for web updates -class UpdateTimer(wx.Timer): - def __init__(self, target, dur=1000): - wx.Timer.__init__(self) - self.target = target - self.Start(dur) - - def Notify(self): - """Called every timer interval""" - if self.target: - self.target.OnUpdate() - - -class MyApp(wx.App): - def OnInit(self): - frame = MyFrame(None, -1, "HF Explorer") - frame.Show(True) - self.SetTopWindow(frame) - return True - - -if __name__ == "__main__": - app = MyApp(0) - app.MainLoop() - diff --git a/gr-uhd/apps/hf_explorer/hfx_help b/gr-uhd/apps/hf_explorer/hfx_help deleted file mode 100644 index c8fa28dbd..000000000 --- a/gr-uhd/apps/hf_explorer/hfx_help +++ /dev/null @@ -1,180 +0,0 @@ - - HF Explorer Help - - ----------------------------------------------------------------------- - - Command Line Switches: - - -c DDC center frequency, set band. - -c 7.2e6 or -c 7.2M for 40 meter ham band. - Default is 3.9e6 80 meter ham band. - Example: - - hfx.py -c 9500k - - starts up in the 31 meter band. - - -a Audio output file. Output file for 32kHz two channel - signed word audio. Two channels are used for - independent sideband. This file can be converted - to a wav file with sox. Example: - - sox -c 2 -r 3200 file.sw file.wav - - sox needs the .sw extension to indicate file type. - If not specified no audio file is created. - - -r Radio output file. File to write RF data to for later - demodulation. Records the entire band to disk, width - determined by sample rate/decimation. Be sure to - note the decimation and center freq for later use! - Example: - - hfx.py -c 900e3 -d 80 -r rf_data_AM-c900e3-d80 - - writes a pre-demod rf file centered on 900kHz with a - bandwidth of 800kHz (That's 80 AM stations!). The - center and decimation could be put in the filename for - proper use later. - If not specified no rf data file is created. - At default 250 decimation disk usage is about - 8Gb / hour. - - -i Radio input file. Use to play back a previously - recorded rf data file. Example: - - hfx.py -c 900e3 -d 80 -i rf_data_AM-c900e3-d80 - - plays back the previously recorded band, no - usrp hardware needed. Tune about the 800kHz wide band. - When playing a recorded file, time controls - fast-forward and rewind are available. - - -d Decimation. Sets sample rate and bandwidth. - This is the factor that the usrp sample rate, 64e6, - is divided by. Default is 250 for 256kHz bandwidth - which is enough to record a ham band without - eating up disk space too fast. The 64e6 sample - rate limits the upper practical frequency to 32MHz. - The Basic RX transformer limits the lower frequency - to about 200kHz. - - - Powermate Knob: - - A Powermate knob is recommended but not necessary. If a knob - is used, it is in one of 3 or 4 modes controlling frequency, - volume, filter and (if playing a recorded file) time. - Pushing the knob switches mode and the buttons on the HFX panel - change to show which mode is in effect. Then just turn the knob - to set frequency, volume, filter or go fast forward or rewind. - - - Bandswitch: - - Across the top are a set of predefined bands and buttons - to rapidly switch to the center of that band. To change a band, - type the frequency in Hz into the box under "Center Frequency", - then press "Set" on the left, then the button you want to - program. From then on (untill the program is exited) pushing - that button takes you to that band. To make a band button - permenant edit the hfx.py script with whatever frequency you - want assigned to what button. - - - Frequency: - - There are 6 ways to set the frequency. - 1) Move the slider with the mouse - 2) Use the Spin Control up/down arrows (very fine 1Hz control) - 3) Type the frequency in Hz into the Spin Control - 4) Turn the Powermate knob - 5) Web control. - 6) Clicking on the FFT display to set demod center. This is very - convenient for tuning +-15kHz when you see a signal on the - display. If in Lower Sideband, clicking just to the right of - a signal will tune to it immediately. Clicking several times - on the far right right or left of the display will rapidly - tune up or down the band. - - - Volume: - - Move the volume slider with the mouse, or push the Powermate knob - untill the volume button is active, or click on the volume button, - then turn the knob. Volume can also be set by web control if web - control is setup and enabled. - - - Filter: - - Similar to volume, switches in any of 30 audio filters from 600 - to 3600Hz in Sideband or up to 5kHz in AM. - - - Mode: - - Demodulation modes are chosen by clicking on the buttons for - Lower Sideband, Upper Sideband, or AM. - - - PGA: - - PGA slider sets the rf gain in the Analog-to-Digital converter - before digitizing. 0 to 20db gain easily shows up on the FFT - display. - - - Time: - - When playing back a recorded RF data file, you can enjoy the - freedom of rewinding or fast-forwarding. Replay a weak signal - or skip through annoying AM commercials. - - - Antennas and Preamps: - - The USRP Basic RX board is not sensitive enough for anything but - the strongest signals. In my experience about 40 db of small - signal gain is required to make the HFX as sensitive as other - receivers. Some working amplifiers are the Ramsey PR-2 with 20db - gain, fairly low noise and more bandwidth than we can use here. - Also the amp modules from Advanced Receiver Research are nice. - I use an ARR 7-7.4MHz GaAsFET 29db amp with .5db noise at the - apex of a 40 meter dipole with excellent results. Another - amp I like is a Minicircuits ZHL-32A 29db amp but they are - expensive and hard to find. Also it may help to use some filters - to keep strong local signals from the ADC, or limit rf input - to the band of interest, etc. - Resonant outdoor antennas, like a dipole, in a low-noise (away - from consumer electronics) environment are nice. Long random wires - with a tuner work. I like a small indoor tuned loop made from 10ft - of 1/4" copper tube, a 365pf tuning cap and a pickup loop connected - to rg-58. - - - Web Control: - - To control your radio remotely, ensure you have a web server - (Apache, etc) working and a compatible directory structure in - place. Directories /var/www/cgi-bin/commands and - /var/www/cgi-bin/state must already exist. You will need a - home page with forms and a set of scripts to put commands in - and put the current state on the home page. email me for further - help. Setting WEB_CONTROL to True in hfx.py turns on the timers - that check for commands and update the state. - - - IF Output: - - There is a provision for outputting un-demodulated complex - through the audio out in stereo for use with Digital Radio - Mondial (DRM) or using a seperate demodulation program like - SDRadio (by I2PHD). - Set IF_OUTPUT to True in weaver_isb_am1_usrp4.py. - - - --Good luck and happy LW/MW/SW Exploring. - Chuck - chuckek@musicriver.homeunix.com - diff --git a/gr-uhd/apps/hf_radio/README.TXT b/gr-uhd/apps/hf_radio/README.TXT deleted file mode 100644 index c5c57f847..000000000 --- a/gr-uhd/apps/hf_radio/README.TXT +++ /dev/null @@ -1,60 +0,0 @@ -# 2008-02-07 -# -# These files have not yet been update to use the new top_block/hier_block2 -# interfaces. Until someone does that, this files will no longer run. -# - - -The files in this directory implement a fairly simple HF radio that works -with the basic rx daughter board on the USRP. - -Many thanks to the Gnu Radio folks for a great new way to waste large blocks -of time in infinitely tweaking a huge number of free parameters. - -Start the receiver by running the radio.py in this directory. Or from the -Python prompt type "from radio import *" and you'll get the prompt back -with the receiver running. You can then poke around to see what's going on. - -There are two spectrum displays. One is the output of the USRP and displays -about 300KHz of bandwidth centered at the current tuning freq. The other -displays the output spectrum of the demodulator. - -The demodulator does AM demod using the complex modulus block from gr. It -does SSB demod using the frequency translating fir filter as a complex -hilbert transformer. The taps for this filter were generated using a program -called Scilab and the Scilab program in the file hfir.sci. More details in -the associated files. - -Tune the receiver using the spin buttons under the big frequency display. - -The agc block is a roll your own. The standard agc in the newer CVS updates -seems to work but doesn't seem to have adjustable time constants or provide -access to internal signal nodes which are used for the RSSI. - -The AGC authority (a sort of gain parameter) and the reference level used -in the power to dB computagion can be adjusted using the spin buttons. - -The audio bandwidth can be similarly adjusted from about 50Hz to 10KHz. - -The GUI layout was produced using wxGlade. The file radio.xml is the GUI -specification. It will produce a file called ui.py which is subclassed -by classes defined in radio.py. The ui.py is purely generated by wxGlade -all app specific code for the GUI is in radio.py. - -Most of the actual signal processing code is built up in the other included -files using the hierarchical block facilities. This organization should -make it easier to tweak to your heart's content. - -Known bugs weakness and other - -wxPython and wxGlade seem to conspire to insure that the layout can never -be exactly what you have in mind. - -Some of the controls don't behave as one might like. wx spin controls -and spin boxes only support integers so it is rather a nuisance to make -units come out nice. In the process of development I came up with a reasonable -kluge so there is a mixture of approaches. - -Enjoy. - -M. Revnell 2006-Jan-06 diff --git a/gr-uhd/apps/hf_radio/hfir.sci b/gr-uhd/apps/hf_radio/hfir.sci deleted file mode 100644 index 64f5385d7..000000000 --- a/gr-uhd/apps/hf_radio/hfir.sci +++ /dev/null @@ -1,59 +0,0 @@ -// designs a complex tap fir filter akin to the hilbert transformer. -// -// The hilbert transformer is classified as a linear phase fir -// with allpass magnitude response and 90 degree phase response for -// positive frequencies and -90 degrees phase for negative frequencies. -// Or, if you prefer, normalized frequencies between .5 and 1 since -// negative frequencies don't really have much meaning outside the complex -// domain. -// -// Normally one would use the hilbert transformer in one leg of a complex -// processing block and a compensating delay in the other. -// -// This one differs in the following respects: -// It is low pass with a cutoff of .078125 -// The filter is a lowpass kaiser windowed filter with parameter 3 -// The phase response is 45 degrees for positive frequencies and -45 -// for negative frequencies. -// The coefficent set is used in one path and the same coefficients -// are used time reversed in the other. This results in the net effect -// of +/- 90 degrees as in the usual hilbert application. -// -// The coefficient set can be used in the gnuradio frequency translating -// fir filter for ssb demodulation. -// -// This isn't as computationally efficient as using the hilbert transformer -// and compensating delay but fascinating none the less. -// -// This program is for the scilab language a very powerful free math -// package similar to Matlab with infinitely better price/performace. -// -// compute the prototype lowpass fir -// length is 255 (odd) for the same symmetry reasons as the hilbert transformer - -len = 1023; -l2 = floor(len/2); -md = l2 + 1; -l3 = md + 1; - -h = wfir( 'lp', len, [10.0/256 0], 'kr', [3 0] ); - -H = fft(h); - -H(1:l2)=H(1:l2)*exp(%i*%pi/4); -H(md)=0+%i*0; -H(l3:len)=H(l3:len)*exp(-%i*%pi/4); - -j=real(ifft(H)); -k(1:len)=j(len:-1:1); -x=j+%i.*k; -X=fft(x); -plot(abs(X)) - -f = file('open','taps') -for i=(1:len) - fprintf( f, '%f%+fj', j(i), k(i) ) -end - -file('close',f) - diff --git a/gr-uhd/apps/hf_radio/input.py b/gr-uhd/apps/hf_radio/input.py deleted file mode 100644 index 78e800bb6..000000000 --- a/gr-uhd/apps/hf_radio/input.py +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 2011 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. -# - -# Basic USRP setup and control. -# It's only ever been tried with a basic rx daughter card. -# -# Imagine that the gnuradio boilerplate is here. -# -# M. Revnell 2005-Dec - -from gnuradio import gr -from gnuradio import uhd - -class uhd_input(gr.hier_block2): - def __init__( self, address, samp_rate): - gr.hier_block2.__init__(self, "uhd_input", - gr.io_signature(0,0,0), - gr.io_signature(1,1,gr.sizeof_gr_complex)) - - self.src = uhd.usrp_source(device_addr=address, - io_type=uhd.io_type.COMPLEX_FLOAT32, - num_channels=1) - - self.src.set_samp_rate(samp_rate) - self.usrp_rate = self.src.get_samp_rate() - - self.connect(self.src, self) - - def set_freq(self, target_freq): - """ - Set the center frequency. - - @param target_freq: frequency in Hz - @type: bool - """ - r = self.src.set_center_freq(target_freq, 0) - - if r: - self.freq = target_freq - return True - else: - return False - - def get_freq(self): - return self.src.get_center_freq(0) - - def set_gain(self, gain): - self.gain = gain - self.src.set_gain(gain, 0) - - def add_options(parser): - parser.add_option("-a", "--address", type="string", - default="addr=192.168.10.2", - help="Address of UHD device, [default=%default]") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - add_options = staticmethod(add_options) diff --git a/gr-uhd/apps/hf_radio/output.py b/gr-uhd/apps/hf_radio/output.py deleted file mode 100644 index 70add5b84..000000000 --- a/gr-uhd/apps/hf_radio/output.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2011 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. -# - - -# Audio output with a volume control. -# -# M. Revnell 2005-Dec - -from gnuradio import gr, gru -from gnuradio import audio - -class output( gr.hier_block2 ): - def __init__( self, rate, device ): - gr.hier_block2.__init__(self, "output", - gr.io_signature(1,1,gr.sizeof_float), - gr.io_signature(0,0,0)) - - self.vol = gr.multiply_const_ff( 0.1 ) - self.out = audio.sink( int(rate), device ) - - self.connect( self, self.vol, self.out ) - - def set( self, val ): - self.vol.set_k( val ) - diff --git a/gr-uhd/apps/hf_radio/radio.py b/gr-uhd/apps/hf_radio/radio.py deleted file mode 100755 index 93d985067..000000000 --- a/gr-uhd/apps/hf_radio/radio.py +++ /dev/null @@ -1,319 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -# GUI interactions and high level connections handled here. -# -# Interacts with classes defined by wxGlade in ui.py. -# -# M. Revnell 2006-Jan - -from threading import * -import wx -import wx.lib.evtmgr as em -import time - -from gnuradio import gr, gru, eng_notation, optfir -from gnuradio import audio -from gnuradio import uhd -from gnuradio import blks2 -from gnuradio.wxgui import fftsink2 -from gnuradio.wxgui import waterfallsink2 -from gnuradio.wxgui import scopesink2 - -from input import * -from output import * -from ssbdemod import * -from ssbagc import * -from ui import * -from math import log10 - -class radio_top_block( gr.top_block ): - def __init__( self ): - gr.top_block.__init__(self, "radio_top_block") - - self.address = "addr=192.168.11.2" - self.samp_rate = 256e3 - self.freq = -2.5e6 - self.gain = 0 - self.src = uhd_input( self.address, - self.samp_rate) - self.src.set_freq(self.freq) - self.src.set_gain(self.gain) - - self.fe_rate = self.src.usrp_rate - self.filter_decim = 1 - self.audio_decim = 16 - self.demod_rate = self.fe_rate / self.filter_decim - self.audio_rate = self.demod_rate / self.audio_decim - self.audio_dev = "pulse" - - self.demod = ssb_demod( self.demod_rate, self.audio_rate ) - self.agc = agc() - self.out = output( self.audio_rate, self.audio_dev ) - - self.connect( self.src, self.demod, self.agc, self.out ) - - def tune( self, freq ): - fe_target = -freq - self.src.set_freq( fe_target ) - demod_cf = fe_target - self.src.get_freq() - self.demod.tune( demod_cf ) - -class radio_frame( ui_frame ): - def __init__( self, block, *args, **kwds ): - ui_frame.__init__( self, *args, **kwds ) - self.block = block - self.freq_disp.SetRange(0, 30e6) - f = self.block.src.freq - self.freq_disp.SetValue( -f ) - self.volume.SetRange( 0, 20 ) - self.pga.SetRange( 0, 20 ) - self.rssi_range = 1 - self.rssi.SetRange( self.rssi_range ) - self.agc_max.SetValue( str( self.rssi_range ) ) - self.spin_e0.SetValue( 50 ) - self.spin_e1.SetValue( 50 ) - self.spin_e2.SetValue( 50 ) - self.spin_e3.SetValue( 50 ) - self.spin_e4.SetValue( 50 ) - self.spin_e5.SetValue( 50 ) - self.spin_e6.SetValue( 50 ) - bw = 3.3e3 - self.bandwidth.SetValue( str( bw ) ) - self.block.demod.set_bw( bw ) - self.bw_spin.SetValue( 5 ) - agc_gain = self.block.agc.gain.k() - self.agc_gain_s.SetValue( 5 ) - self.agc_gain.SetValue( str( agc_gain ) ) - agc_ref = self.block.agc.offs.k() - self.agc_ref.SetValue( str( agc_ref ) ) - self.agc_ref_s.SetValue( 5 ) - - self.fespectrum = fftsink2.fft_sink_c( - self.fe_panel, - fft_size=512, - sample_rate = block.fe_rate, - ref_scale = 1.0, - ref_level = 20.0, - y_divs = 12, - avg_alpha = 0.1) - - self.ifspectrum = fftsink2.fft_sink_c( - self.if_panel, - fft_size=512, - sample_rate = block.audio_rate, - ref_scale = 1.0, - ref_level = 20.0, - y_divs = 12, - avg_alpha = 0.1) - - self.fespectrum.win.Bind( wx.EVT_MOTION, self.fe_mouse) - self.fespectrum.win.Bind( wx.EVT_LEFT_DOWN, self.fe_click) - - block.connect( block.src.src, self.fespectrum ) - block.connect( block.demod.xlate, self.ifspectrum ) - - def agc_ref_up( self, event ): - self.agc_ref_s.SetValue( 5 ) - r = float( self.agc_ref.GetValue() ) - r = r + 5 - self.agc_ref.SetValue( str( r ) ) - self.block.agc.offs.set_k( r ) - - def agc_ref_down( self, event ): - self.agc_ref_s.SetValue( 5 ) - r = float( self.agc_ref.GetValue() ) - r = r - 5 - self.agc_ref.SetValue( str( r ) ) - self.block.agc.offs.set_k( r ) - - def agc_gain_up( self, event ): - self.agc_gain_s.SetValue( 5 ) - g = float(self.agc_gain.GetValue()) - g = g + 10 - self.agc_gain.SetValue( str( g ) ) - self.block.agc.gain.set_k( g ) - - def agc_gain_down( self, event ): - self.agc_gain_s.SetValue( 5 ) - g = float(self.agc_gain.GetValue()) - g = g - 10 - self.agc_gain.SetValue( str( g ) ) - self.block.agc.gain.set_k( g ) - - def fe_mouse( self, event ): - f = int(self.freq_disp.GetValue()) - f = f+((event.GetX()-346.)*(400./610.))*1000 - self.fespectrum.win.SetToolTip( - wx.ToolTip( eng_notation.num_to_str(f))) - - def fe_click( self, event ): - f = int(self.freq_disp.GetValue()) - f = f+((event.GetX()-346.)*(400./610.))*1000 - self.tune( f ) - - def setrssi( self, level ): - if level < 0: - level = 0 - if level > self.rssi_range: - self.rssi_range = level - self.rssi.SetRange( level ) - self.agc_max.SetValue( str( level )) - self.rssi.SetValue( level ) - self.agc_level.SetValue( str( level )) - - def tune_evt( self, event ): - f = self.freq_disp.GetValue() - self.tune( f ) - - def tune( self, frequency ): - self.freq_disp.SetValue( frequency ) - self.block.tune( frequency ) - - def up_e0( self, event ): - self.spin_e0.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() + 1e0 ) - - def down_e0( self, event ): - self.spin_e0.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() - 1e0 ) - - def up_e1( self, event ): - self.spin_e1.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() + 1e1 ) - - def down_e1( self, event ): - self.spin_e1.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() - 1e1 ) - - def up_e2( self, event ): - self.spin_e2.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() + 1e2 ) - - def down_e2( self, event ): - self.spin_e2.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() - 1e2 ) - - def up_e3( self, event ): - self.spin_e3.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() + 1e3 ) - - def down_e3( self, event ): - self.spin_e3.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() - 1e3 ) - - def up_e4( self, event ): - self.spin_e4.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() + 1e4 ) - - def down_e4( self, event ): - self.spin_e4.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() - 1e4 ) - - def up_e5( self, event ): - self.spin_e5.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() + 1e5 ) - - def down_e5( self, event ): - self.spin_e5.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() - 1e5 ) - - def up_e6( self, event ): - self.spin_e6.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() + 1e6 ) - - def down_e6( self, event ): - self.spin_e6.SetValue( 50 ) - self.tune( self.freq_disp.GetValue() - 1e6 ) - - def event_pga( self, event ): - self.block.src.set_gain(self.pga.GetValue()) - - def event_vol( self, event ): - self.block.out.set( self.volume.GetValue()/20.0 ) - - def set_usb( self, event ): - self.block.demod.upper_sb() - - def set_lsb( self, event ): - self.block.demod.lower_sb() - - def set_am( self, event ): - self.block.demod.set_am() - - def bw_up( self, event ): - self.bw_spin.SetValue( 5 ) - bw = float(self.bandwidth.GetValue()) - bw = bw + 20.0 - if bw > 10e3: - bw = 10e3 - self.bandwidth.SetValue( str( bw ) ) - self.block.demod.set_bw( bw ) - - def bw_down( self, event ): - self.bw_spin.SetValue( 5 ) - bw = float(self.bandwidth.GetValue()) - bw = bw - 20.0 - if bw < 50: - bw = 50 - self.bandwidth.SetValue( str( bw ) ) - self.block.demod.set_bw( bw ) - - -class radio( wx.App ): - def OnInit( self ): - self.block = radio_top_block() - self.frame = radio_frame( self.block, None, -1, "HF Receiver" ) - self.frame.Show( True ) - self.SetTopWindow( self.frame ) - self.block.start() - return True - -def rssi_function(): - global radio_obj - global sig_probe - - go = True - while go: - try: - level = sig_probe.level() - wx.CallAfter( radio_obj.frame.setrssi, level ) - time.sleep( .1 ) - except: - go = False - -def main(): - global radio_obj, sig_probe - - radio_obj = radio( 0 ) - sig_probe = gr.probe_signal_f() - radio_obj.block.connect(radio_obj.block.agc.offs, sig_probe) - - thread2 = Thread( target = rssi_function ) - thread2.start() - - radio_obj.MainLoop() - - -if __name__ == "__main__": - main() - diff --git a/gr-uhd/apps/hf_radio/radio.xml b/gr-uhd/apps/hf_radio/radio.xml deleted file mode 100644 index 81daa19b0..000000000 --- a/gr-uhd/apps/hf_radio/radio.xml +++ /dev/null @@ -1,441 +0,0 @@ -<?xml version="1.0"?> -<!-- generated by wxGlade 0.4 on Fri Jan 6 09:51:36 2006 --> - -<application path="/root/radio/ui.py" name="" class="" option="0" language="python" top_window="" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6"> - <object class="ui_frame" name="frame_1" base="EditFrame"> - <style>wxDEFAULT_FRAME_STYLE</style> - <title>frame_1</title> - <object class="wxStaticBoxSizer" name="sizer_1" base="EditStaticBoxSizer"> - <orient>wxVERTICAL</orient> - <label>sizer_1</label> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxBoxSizer" name="sizer_2" base="EditBoxSizer"> - <orient>wxHORIZONTAL</orient> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxBoxSizer" name="sizer_3" base="EditBoxSizer"> - <orient>wxVERTICAL</orient> - <object class="sizeritem"> - <flag>wxEXPAND|wxADJUST_MINSIZE</flag> - <border>0</border> - <option>1</option> - <object class="wxSpinCtrl" name="freq_disp" base="EditSpinCtrl"> - <font> - <size>32</size> - <family>default</family> - <style>normal</style> - <weight>normal</weight> - <underlined>0</underlined> - <face></face> - </font> - <events> - <handler event="EVT_SPINCTRL">tune_evt</handler> - </events> - </object> - </object> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxGridSizer" name="grid_sizer_1" base="EditGridSizer"> - <hgap>0</hgap> - <rows>2</rows> - <cols>3</cols> - <vgap>0</vgap> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxGridSizer" name="grid_sizer_2" base="EditGridSizer"> - <hgap>0</hgap> - <rows>1</rows> - <cols>7</cols> - <vgap>0</vgap> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinButton" name="spin_e6" base="EditSpinButton"> - <events> - <handler event="EVT_SPIN_UP">up_e6</handler> - <handler event="EVT_SPIN_DOWN">down_e6</handler> - </events> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinButton" name="spin_e5" base="EditSpinButton"> - <events> - <handler event="EVT_SPIN_UP">up_e5</handler> - <handler event="EVT_SPIN_DOWN">down_e5</handler> - </events> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinButton" name="spin_e4" base="EditSpinButton"> - <events> - <handler event="EVT_SPIN_UP">up_e4</handler> - <handler event="EVT_SPIN_DOWN">down_e4</handler> - </events> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinButton" name="spin_e3" base="EditSpinButton"> - <events> - <handler event="EVT_SPIN_UP">up_e3</handler> - <handler event="EVT_SPIN_DOWN">down_e3</handler> - </events> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinButton" name="spin_e2" base="EditSpinButton"> - <events> - <handler event="EVT_SPIN_UP">up_e2</handler> - <handler event="EVT_SPIN_DOWN">down_e2</handler> - </events> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinButton" name="spin_e1" base="EditSpinButton"> - <events> - <handler event="EVT_SPIN_UP">up_e1</handler> - <handler event="EVT_SPIN_DOWN">down_e1</handler> - </events> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinButton" name="spin_e0" base="EditSpinButton"> - <events> - <handler event="EVT_SPIN_UP">up_e0</handler> - <handler event="EVT_SPIN_DOWN">down_e0</handler> - </events> - </object> - </object> - </object> - </object> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxPanel" name="panel_1" base="EditPanel"> - <style>wxTAB_TRAVERSAL</style> - </object> - </object> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxPanel" name="panel_2" base="EditPanel"> - <style>wxTAB_TRAVERSAL</style> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxButton" name="button_lsb" base="EditButton"> - <label>LSB</label> - <events> - <handler event="EVT_BUTTON">set_lsb</handler> - </events> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxButton" name="button_usb" base="EditButton"> - <label>USB</label> - <events> - <handler event="EVT_BUTTON">set_usb</handler> - </events> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxButton" name="button_am" base="EditButton"> - <label>AM</label> - <events> - <handler event="EVT_BUTTON">set_am</handler> - </events> - </object> - </object> - </object> - </object> - </object> - </object> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxBoxSizer" name="sizer_4" base="EditBoxSizer"> - <orient>wxVERTICAL</orient> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxGridSizer" name="grid_sizer_3" base="EditGridSizer"> - <hgap>0</hgap> - <rows>2</rows> - <cols>4</cols> - <vgap>0</vgap> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxStaticText" name="label_1" base="EditStaticText"> - <attribute>1</attribute> - <label>VOLUME</label> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxStaticText" name="label_2" base="EditStaticText"> - <attribute>1</attribute> - <label>PGA</label> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxTextCtrl" name="agc_level" base="EditTextCtrl"> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxStaticText" name="label_6" base="EditStaticText"> - <attribute>1</attribute> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinCtrl" name="volume" base="EditSpinCtrl"> - <events> - <handler event="EVT_SPINCTRL">event_vol</handler> - </events> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinCtrl" name="pga" base="EditSpinCtrl"> - <events> - <handler event="EVT_SPINCTRL">event_pga</handler> - </events> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxTextCtrl" name="agc_max" base="EditTextCtrl"> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxStaticText" name="label_7" base="EditStaticText"> - <attribute>1</attribute> - </object> - </object> - </object> - </object> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxGridSizer" name="grid_sizer_4" base="EditGridSizer"> - <hgap>0</hgap> - <rows>2</rows> - <cols>4</cols> - <vgap>0</vgap> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxStaticText" name="label_4" base="EditStaticText"> - <attribute>1</attribute> - <label>AGC AUTHORITY</label> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxStaticText" name="label_5" base="EditStaticText"> - <attribute>1</attribute> - <label>AGC REF LVL</label> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxStaticText" name="label_3" base="EditStaticText"> - <attribute>1</attribute> - <label>BANDWIDTH</label> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxStaticText" name="label_8" base="EditStaticText"> - <attribute>1</attribute> - </object> - </object> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxBoxSizer" name="sizer_6" base="EditBoxSizer"> - <orient>wxHORIZONTAL</orient> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxTextCtrl" name="agc_gain" base="EditTextCtrl"> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinButton" name="agc_gain_s" base="EditSpinButton"> - <events> - <handler event="EVT_SPIN_UP">agc_gain_up</handler> - <handler event="EVT_SPIN_DOWN">agc_gain_down</handler> - </events> - </object> - </object> - </object> - </object> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxBoxSizer" name="sizer_7" base="EditBoxSizer"> - <orient>wxHORIZONTAL</orient> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxTextCtrl" name="agc_ref" base="EditTextCtrl"> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinButton" name="agc_ref_s" base="EditSpinButton"> - <events> - <handler event="EVT_SPIN_UP">agc_ref_up</handler> - <handler event="EVT_SPIN_DOWN">agc_ref_down</handler> - </events> - </object> - </object> - </object> - </object> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxBoxSizer" name="sizer_5" base="EditBoxSizer"> - <orient>wxHORIZONTAL</orient> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxTextCtrl" name="bandwidth" base="EditTextCtrl"> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxSpinButton" name="bw_spin" base="EditSpinButton"> - <events> - <handler event="EVT_SPIN_UP">bw_up</handler> - <handler event="EVT_SPIN_DOWN">bw_down</handler> - </events> - </object> - </object> - </object> - </object> - <object class="sizeritem"> - <flag>wxADJUST_MINSIZE</flag> - <border>0</border> - <option>0</option> - <object class="wxStaticText" name="label_9" base="EditStaticText"> - <attribute>1</attribute> - </object> - </object> - </object> - </object> - <object class="sizeritem"> - <flag>wxEXPAND|wxADJUST_MINSIZE</flag> - <border>0</border> - <option>1</option> - <object class="wxGauge" name="rssi" base="EditGauge"> - <foreground>#ff0000</foreground> - <style>wxGA_HORIZONTAL|wxGA_SMOOTH</style> - <range>10</range> - <size>315, 10</size> - </object> - </object> - </object> - </object> - </object> - </object> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxPanel" name="fe_panel" base="EditPanel"> - <style>wxTAB_TRAVERSAL</style> - </object> - </object> - <object class="sizeritem"> - <flag>wxEXPAND</flag> - <border>0</border> - <option>1</option> - <object class="wxPanel" name="if_panel" base="EditPanel"> - <style>wxTAB_TRAVERSAL</style> - </object> - </object> - </object> - </object> -</application> diff --git a/gr-uhd/apps/hf_radio/ssb_taps b/gr-uhd/apps/hf_radio/ssb_taps deleted file mode 100644 index 0ef3bbf26..000000000 --- a/gr-uhd/apps/hf_radio/ssb_taps +++ /dev/null @@ -1,1023 +0,0 @@ --0.000035-0.000009j --0.000066-0.000020j --0.000080-0.000044j --0.000084-0.000071j --0.000077-0.000100j --0.000063-0.000127j --0.000041-0.000150j --0.000013-0.000167j -0.000020-0.000177j -0.000054-0.000180j -0.000089-0.000174j -0.000121-0.000161j -0.000150-0.000140j -0.000173-0.000113j -0.000188-0.000081j -0.000196-0.000046j -0.000194-0.000011j -0.000184+0.000022j -0.000165+0.000052j -0.000139+0.000077j -0.000107+0.000093j -0.000071+0.000102j -0.000034+0.000101j --0.000002+0.000090j --0.000036+0.000070j --0.000064+0.000042j --0.000086+0.000006j --0.000098-0.000034j --0.000101-0.000077j --0.000093-0.000120j --0.000076-0.000161j --0.000049-0.000197j --0.000014-0.000227j -0.000026-0.000248j -0.000071-0.000259j -0.000117-0.000259j -0.000162-0.000249j -0.000203-0.000228j -0.000237-0.000199j -0.000263-0.000162j -0.000279-0.000120j -0.000284-0.000075j -0.000278-0.000031j -0.000260+0.000010j -0.000232+0.000045j -0.000196+0.000073j -0.000153+0.000090j -0.000106+0.000095j -0.000059+0.000089j -0.000014+0.000071j --0.000027+0.000041j --0.000059+0.000002j --0.000082-0.000046j --0.000093-0.000098j --0.000091-0.000152j --0.000077-0.000206j --0.000050-0.000255j --0.000012-0.000298j -0.000034-0.000330j -0.000088-0.000351j -0.000145-0.000359j -0.000202-0.000354j -0.000256-0.000335j -0.000304-0.000304j -0.000343-0.000262j -0.000370-0.000213j -0.000384-0.000158j -0.000384-0.000102j -0.000369-0.000048j -0.000341+0.000002j -0.000302+0.000042j -0.000252+0.000072j -0.000196+0.000088j -0.000137+0.000089j -0.000078+0.000075j -0.000024+0.000047j --0.000023+0.000005j --0.000059-0.000048j --0.000082-0.000109j --0.000090-0.000175j --0.000081-0.000242j --0.000058-0.000306j --0.000019-0.000364j -0.000032-0.000411j -0.000093-0.000445j -0.000161-0.000465j -0.000232-0.000467j -0.000301-0.000453j -0.000365-0.000423j -0.000419-0.000379j -0.000461-0.000323j -0.000487-0.000259j -0.000497-0.000190j -0.000489-0.000121j -0.000464-0.000056j -0.000423+0.000001j -0.000369+0.000046j -0.000304+0.000076j -0.000233+0.000089j -0.000160+0.000083j -0.000089+0.000060j -0.000025+0.000018j --0.000027-0.000038j --0.000065-0.000107j --0.000086-0.000185j --0.000088-0.000266j --0.000071-0.000347j --0.000035-0.000422j -0.000019-0.000487j -0.000086-0.000538j -0.000164-0.000573j -0.000248-0.000588j -0.000334-0.000582j -0.000415-0.000557j -0.000488-0.000513j -0.000548-0.000452j -0.000592-0.000379j -0.000616-0.000297j -0.000619-0.000213j -0.000600-0.000130j -0.000561-0.000054j -0.000504+0.000010j -0.000432+0.000058j -0.000350+0.000086j -0.000261+0.000093j -0.000173+0.000078j -0.000090+0.000040j -0.000017-0.000017j --0.000040-0.000092j --0.000078-0.000180j --0.000095-0.000275j --0.000088-0.000374j --0.000058-0.000469j --0.000006-0.000555j -0.000065-0.000627j -0.000152-0.000681j -0.000250-0.000712j -0.000352-0.000720j -0.000454-0.000703j -0.000548-0.000663j -0.000630-0.000601j -0.000694-0.000521j -0.000737-0.000428j -0.000755-0.000327j -0.000748-0.000225j -0.000715-0.000128j -0.000659-0.000042j -0.000582+0.000028j -0.000490+0.000077j -0.000387+0.000101j -0.000280+0.000099j -0.000175+0.000070j -0.000080+0.000015j --0.000001-0.000063j --0.000061-0.000159j --0.000097-0.000268j --0.000106-0.000385j --0.000087-0.000501j --0.000040-0.000611j -0.000032-0.000708j -0.000125-0.000786j -0.000235-0.000839j -0.000354-0.000866j -0.000477-0.000863j -0.000595-0.000831j -0.000702-0.000772j -0.000792-0.000688j -0.000859-0.000585j -0.000898-0.000469j -0.000907-0.000347j -0.000886-0.000227j -0.000835-0.000115j -0.000757-0.000019j -0.000657+0.000055j -0.000540+0.000102j -0.000415+0.000119j -0.000287+0.000103j -0.000165+0.000056j -0.000058-0.000020j --0.000029-0.000122j --0.000090-0.000243j --0.000121-0.000378j --0.000118-0.000517j --0.000082-0.000653j --0.000014-0.000778j -0.000082-0.000885j -0.000201-0.000966j -0.000337-0.001017j -0.000481-0.001034j -0.000626-0.001016j -0.000762-0.000965j -0.000882-0.000882j -0.000978-0.000772j -0.001044-0.000643j -0.001076-0.000501j -0.001072-0.000355j -0.001032-0.000215j -0.000958-0.000089j -0.000854+0.000016j -0.000726+0.000091j -0.000582+0.000133j -0.000431+0.000138j -0.000281+0.000105j -0.000143+0.000035j -0.000024-0.000068j --0.000068-0.000199j --0.000126-0.000350j --0.000147-0.000513j --0.000128-0.000677j --0.000070-0.000834j -0.000024-0.000974j -0.000150-0.001089j -0.000300-0.001171j -0.000465-0.001216j -0.000637-0.001219j -0.000805-0.001182j -0.000960-0.001105j -0.001091-0.000993j -0.001191-0.000853j -0.001253-0.000692j -0.001274-0.000521j -0.001252-0.000350j -0.001188-0.000189j -0.001085-0.000049j -0.000950+0.000062j -0.000790+0.000136j -0.000614+0.000168j -0.000435+0.000156j -0.000261+0.000099j -0.000105+0.000000j --0.000024-0.000136j --0.000117-0.000301j --0.000169-0.000486j --0.000175-0.000680j --0.000134-0.000872j --0.000048-0.001051j -0.000079-0.001206j -0.000240-0.001326j -0.000426-0.001406j -0.000626-0.001439j -0.000829-0.001424j -0.001022-0.001361j -0.001195-0.001252j -0.001336-0.001106j -0.001437-0.000929j -0.001491-0.000733j -0.001496-0.000529j -0.001449-0.000330j -0.001354-0.000148j -0.001217+0.000005j -0.001044+0.000120j -0.000846+0.000188j -0.000635+0.000206j -0.000424+0.000170j -0.000226+0.000083j -0.000053-0.000053j --0.000084-0.000228j --0.000176-0.000434j --0.000216-0.000659j --0.000201-0.000889j --0.000131-0.001111j --0.000009-0.001312j -0.000158-0.001480j -0.000362-0.001604j -0.000590-0.001677j -0.000829-0.001694j -0.001066-0.001653j -0.001286-0.001556j -0.001477-0.001408j -0.001626-0.001219j -0.001724-0.001000j -0.001765-0.000762j -0.001746-0.000522j -0.001668-0.000293j -0.001534-0.000090j -0.001353+0.000075j -0.001135+0.000190j -0.000893+0.000247j -0.000642+0.000243j -0.000396+0.000176j -0.000172+0.000049j --0.000017-0.000131j --0.000159-0.000355j --0.000244-0.000609j --0.000266-0.000880j --0.000222-0.001151j --0.000114-0.001406j -0.000053-0.001630j -0.000270-0.001810j -0.000524-0.001934j -0.000802-0.001994j -0.001087-0.001987j -0.001362-0.001911j -0.001611-0.001772j -0.001819-0.001576j -0.001973-0.001336j -0.002063-0.001065j -0.002084-0.000779j -0.002033-0.000497j -0.001914-0.000236j -0.001732-0.000011j -0.001498+0.000162j -0.001225+0.000272j -0.000931+0.000312j -0.000633+0.000277j -0.000349+0.000168j -0.000097-0.000009j --0.000107-0.000246j --0.000250-0.000528j --0.000322-0.000841j --0.000316-0.001166j --0.000233-0.001484j --0.000076-0.001775j -0.000148-0.002024j -0.000426-0.002213j -0.000743-0.002332j -0.001080-0.002373j -0.001418-0.002332j -0.001736-0.002211j -0.002017-0.002017j -0.002241-0.001760j -0.002397-0.001457j -0.002473-0.001124j -0.002464-0.000783j -0.002371-0.000453j -0.002198-0.000156j -0.001954+0.000091j -0.001654+0.000269j -0.001316+0.000369j -0.000959+0.000381j -0.000606+0.000303j -0.000279+0.000139j --0.000003-0.000103j --0.000220-0.000411j --0.000359-0.000768j --0.000408-0.001152j --0.000365-0.001542j --0.000229-0.001915j --0.000006-0.002248j -0.000292-0.002522j -0.000648-0.002719j -0.001042-0.002826j -0.001452-0.002837j -0.001853-0.002750j -0.002223-0.002569j -0.002537-0.002304j -0.002778-0.001971j -0.002930-0.001588j -0.002984-0.001179j -0.002933-0.000770j -0.002782-0.000384j -0.002538-0.000046j -0.002215+0.000222j -0.001831+0.000402j -0.001410+0.000481j -0.000976+0.000452j -0.000557+0.000316j -0.000179+0.000077j --0.000134-0.000252j --0.000362-0.000654j --0.000490-0.001105j --0.000506-0.001580j --0.000407-0.002052j --0.000197-0.002492j -0.000113-0.002875j -0.000508-0.003176j -0.000966-0.003377j -0.001460-0.003464j -0.001963-0.003432j -0.002444-0.003281j -0.002876-0.003019j -0.003231-0.002659j -0.003488-0.002224j -0.003631-0.001739j -0.003649-0.001233j -0.003540-0.000737j -0.003309-0.000282j -0.002969+0.000103j -0.002539+0.000393j -0.002044+0.000568j -0.001515+0.000614j -0.000982+0.000525j -0.000480+0.000304j -0.000039-0.000039j --0.000311-0.000487j --0.000547-0.001016j --0.000652-0.001595j --0.000615-0.002193j --0.000436-0.002773j --0.000122-0.003301j -0.000311-0.003746j -0.000842-0.004081j -0.001440-0.004282j -0.002071-0.004338j -0.002700-0.004243j -0.003289-0.004000j -0.003803-0.003622j -0.004210-0.003132j -0.004485-0.002556j -0.004610-0.001930j -0.004574-0.001291j -0.004379-0.000679j -0.004034-0.000133j -0.003558+0.000313j -0.002977+0.000627j -0.002327+0.000787j -0.001647+0.000779j -0.000977+0.000598j -0.000360+0.000250j --0.000163-0.000249j --0.000559-0.000872j --0.000799-0.001587j --0.000864-0.002354j --0.000744-0.003129j --0.000442-0.003866j -0.000031-0.004522j -0.000651-0.005057j -0.001385-0.005437j -0.002193-0.005637j -0.003030-0.005643j -0.003848-0.005451j -0.004597-0.005069j -0.005234-0.004519j -0.005718-0.003830j -0.006019-0.003044j -0.006114-0.002206j -0.005997-0.001368j -0.005669-0.000583j -0.005147+0.000099j -0.004460+0.000631j -0.003647+0.000975j -0.002757+0.001105j -0.001842+0.001003j -0.000961+0.000668j -0.000168+0.000111j --0.000482-0.000643j --0.000944-0.001555j --0.001183-0.002578j --0.001176-0.003656j --0.000912-0.004727j --0.000397-0.005728j -0.000346-0.006601j -0.001284-0.007292j -0.002368-0.007755j -0.003540-0.007959j -0.004735-0.007886j -0.005885-0.007535j -0.006922-0.006922j -0.007782-0.006078j -0.008412-0.005050j -0.008769-0.003898j -0.008825-0.002691j -0.008572-0.001504j -0.008016-0.000412j -0.007185+0.000510j -0.006123+0.001196j -0.004891+0.001591j -0.003560+0.001657j -0.002212+0.001372j -0.000933+0.000734j --0.000192-0.000236j --0.001083-0.001500j --0.001672-0.002998j --0.001905-0.004655j --0.001747-0.006384j --0.001182-0.008090j --0.000222-0.009676j -0.001101-0.011045j -0.002732-0.012114j -0.004593-0.012810j -0.006591-0.013081j -0.008621-0.012896j -0.010571-0.012253j -0.012328-0.011175j -0.013785-0.009712j -0.014847-0.007941j -0.015438-0.005962j -0.015507-0.003893j -0.015029-0.001863j -0.014011-0.000011j -0.012494+0.001529j -0.010549+0.002630j -0.008277+0.003179j -0.005809+0.003090j -0.003294+0.002304j -0.000896+0.000795j --0.001212-0.001423j --0.002859-0.004299j --0.003886-0.007744j --0.004151-0.011630j --0.003539-0.015799j --0.001969-0.020066j -0.000601-0.024225j -0.004168-0.028064j -0.008684-0.031367j -0.014056-0.033927j -0.020145-0.035558j -0.026775-0.036101j -0.033735-0.035433j -0.040789-0.033475j -0.047684-0.030197j -0.054164-0.025619j -0.059974-0.019815j -0.064878-0.012907j -0.068665-0.005067j -0.071159+0.003494j -0.072228+0.012531j -0.071791+0.021776j -0.069818+0.030947j -0.066339+0.039761j -0.061435+0.047944j -0.055243+0.055243j -0.047944+0.061435j -0.039761+0.066339j -0.030947+0.069818j -0.021776+0.071791j -0.012531+0.072228j -0.003494+0.071159j --0.005067+0.068665j --0.012907+0.064878j --0.019815+0.059974j --0.025619+0.054164j --0.030197+0.047684j --0.033475+0.040789j --0.035433+0.033735j --0.036101+0.026775j --0.035558+0.020145j --0.033927+0.014056j --0.031367+0.008684j --0.028064+0.004168j --0.024225+0.000601j --0.020066-0.001969j --0.015799-0.003539j --0.011630-0.004151j --0.007744-0.003886j --0.004299-0.002859j --0.001423-0.001212j -0.000795+0.000896j -0.002304+0.003294j -0.003090+0.005809j -0.003179+0.008277j -0.002630+0.010549j -0.001529+0.012494j --0.000011+0.014011j --0.001863+0.015029j --0.003893+0.015507j --0.005962+0.015438j --0.007941+0.014847j --0.009712+0.013785j --0.011175+0.012328j --0.012253+0.010571j --0.012896+0.008621j --0.013081+0.006591j --0.012810+0.004593j --0.012114+0.002732j --0.011045+0.001101j --0.009676-0.000222j --0.008090-0.001182j --0.006384-0.001747j --0.004655-0.001905j --0.002998-0.001672j --0.001500-0.001083j --0.000236-0.000192j -0.000734+0.000933j -0.001372+0.002212j -0.001657+0.003560j -0.001591+0.004891j -0.001196+0.006123j -0.000510+0.007185j --0.000412+0.008016j --0.001504+0.008572j --0.002691+0.008825j --0.003898+0.008769j --0.005050+0.008412j --0.006078+0.007782j --0.006922+0.006922j --0.007535+0.005885j --0.007886+0.004735j --0.007959+0.003540j --0.007755+0.002368j --0.007292+0.001284j --0.006601+0.000346j --0.005728-0.000397j --0.004727-0.000912j --0.003656-0.001176j --0.002578-0.001183j --0.001555-0.000944j --0.000643-0.000482j -0.000111+0.000168j -0.000668+0.000961j -0.001003+0.001842j -0.001105+0.002757j -0.000975+0.003647j -0.000631+0.004460j -0.000099+0.005147j --0.000583+0.005669j --0.001368+0.005997j --0.002206+0.006114j --0.003044+0.006019j --0.003830+0.005718j --0.004519+0.005234j --0.005069+0.004597j --0.005451+0.003848j --0.005643+0.003030j --0.005637+0.002193j --0.005437+0.001385j --0.005057+0.000651j --0.004522+0.000031j --0.003866-0.000442j --0.003129-0.000744j --0.002354-0.000864j --0.001587-0.000799j --0.000872-0.000559j --0.000249-0.000163j -0.000250+0.000360j -0.000598+0.000977j -0.000779+0.001647j -0.000787+0.002327j -0.000627+0.002977j -0.000313+0.003558j --0.000133+0.004034j --0.000679+0.004379j --0.001291+0.004574j --0.001930+0.004610j --0.002556+0.004485j --0.003132+0.004210j --0.003622+0.003803j --0.004000+0.003289j --0.004243+0.002700j --0.004338+0.002071j --0.004282+0.001440j --0.004081+0.000842j --0.003746+0.000311j --0.003301-0.000122j --0.002773-0.000436j --0.002193-0.000615j --0.001595-0.000652j --0.001016-0.000547j --0.000487-0.000311j --0.000039+0.000039j -0.000304+0.000480j -0.000525+0.000982j -0.000614+0.001515j -0.000568+0.002044j -0.000393+0.002539j -0.000103+0.002969j --0.000282+0.003309j --0.000737+0.003540j --0.001233+0.003649j --0.001739+0.003631j --0.002224+0.003488j --0.002659+0.003231j --0.003019+0.002876j --0.003281+0.002444j --0.003432+0.001963j --0.003464+0.001460j --0.003377+0.000966j --0.003176+0.000508j --0.002875+0.000113j --0.002492-0.000197j --0.002052-0.000407j --0.001580-0.000506j --0.001105-0.000490j --0.000654-0.000362j --0.000252-0.000134j -0.000077+0.000179j -0.000316+0.000557j -0.000452+0.000976j -0.000481+0.001410j -0.000402+0.001831j -0.000222+0.002215j --0.000046+0.002538j --0.000384+0.002782j --0.000770+0.002933j --0.001179+0.002984j --0.001588+0.002930j --0.001971+0.002778j --0.002304+0.002537j --0.002569+0.002223j --0.002750+0.001853j --0.002837+0.001452j --0.002826+0.001042j --0.002719+0.000648j --0.002522+0.000292j --0.002248-0.000006j --0.001915-0.000229j --0.001542-0.000365j --0.001152-0.000408j --0.000768-0.000359j --0.000411-0.000220j --0.000103-0.000003j -0.000139+0.000279j -0.000303+0.000606j -0.000381+0.000959j -0.000369+0.001316j -0.000269+0.001654j -0.000091+0.001954j --0.000156+0.002198j --0.000453+0.002371j --0.000783+0.002464j --0.001124+0.002473j --0.001457+0.002397j --0.001760+0.002241j --0.002017+0.002017j --0.002211+0.001736j --0.002332+0.001418j --0.002373+0.001080j --0.002332+0.000743j --0.002213+0.000426j --0.002024+0.000148j --0.001775-0.000076j --0.001484-0.000233j --0.001166-0.000316j --0.000841-0.000322j --0.000528-0.000250j --0.000246-0.000107j --0.000009+0.000097j -0.000168+0.000349j -0.000277+0.000633j -0.000312+0.000931j -0.000272+0.001225j -0.000162+0.001498j --0.000011+0.001732j --0.000236+0.001914j --0.000497+0.002033j --0.000779+0.002084j --0.001065+0.002063j --0.001336+0.001973j --0.001576+0.001819j --0.001772+0.001611j --0.001911+0.001362j --0.001987+0.001087j --0.001994+0.000802j --0.001934+0.000524j --0.001810+0.000270j --0.001630+0.000053j --0.001406-0.000114j --0.001151-0.000222j --0.000880-0.000266j --0.000609-0.000244j --0.000355-0.000159j --0.000131-0.000017j -0.000049+0.000172j -0.000176+0.000396j -0.000243+0.000642j -0.000247+0.000893j -0.000190+0.001135j -0.000075+0.001353j --0.000090+0.001534j --0.000293+0.001668j --0.000522+0.001746j --0.000762+0.001765j --0.001000+0.001724j --0.001219+0.001626j --0.001408+0.001477j --0.001556+0.001286j --0.001653+0.001066j --0.001694+0.000829j --0.001677+0.000590j --0.001604+0.000362j --0.001480+0.000158j --0.001312-0.000009j --0.001111-0.000131j --0.000889-0.000201j --0.000659-0.000216j --0.000434-0.000176j --0.000228-0.000084j --0.000053+0.000053j -0.000083+0.000226j -0.000170+0.000424j -0.000206+0.000635j -0.000188+0.000846j -0.000120+0.001044j -0.000005+0.001217j --0.000148+0.001354j --0.000330+0.001449j --0.000529+0.001496j --0.000733+0.001491j --0.000929+0.001437j --0.001106+0.001336j --0.001252+0.001195j --0.001361+0.001022j --0.001424+0.000829j --0.001439+0.000626j --0.001406+0.000426j --0.001326+0.000240j --0.001206+0.000079j --0.001051-0.000048j --0.000872-0.000134j --0.000680-0.000175j --0.000486-0.000169j --0.000301-0.000117j --0.000136-0.000024j -0.000000+0.000105j -0.000099+0.000261j -0.000156+0.000435j -0.000168+0.000614j -0.000136+0.000790j -0.000062+0.000950j --0.000049+0.001085j --0.000189+0.001188j --0.000350+0.001252j --0.000521+0.001274j --0.000692+0.001253j --0.000853+0.001191j --0.000993+0.001091j --0.001105+0.000960j --0.001182+0.000805j --0.001219+0.000637j --0.001216+0.000465j --0.001171+0.000300j --0.001089+0.000150j --0.000974+0.000024j --0.000834-0.000070j --0.000677-0.000128j --0.000513-0.000147j --0.000350-0.000126j --0.000199-0.000068j --0.000068+0.000024j -0.000035+0.000143j -0.000105+0.000281j -0.000138+0.000431j -0.000133+0.000582j -0.000091+0.000726j -0.000016+0.000854j --0.000089+0.000958j --0.000215+0.001032j --0.000355+0.001072j --0.000501+0.001076j --0.000643+0.001044j --0.000772+0.000978j --0.000882+0.000882j --0.000965+0.000762j --0.001016+0.000626j --0.001034+0.000481j --0.001017+0.000337j --0.000966+0.000201j --0.000885+0.000082j --0.000778-0.000014j --0.000653-0.000082j --0.000517-0.000118j --0.000378-0.000121j --0.000243-0.000090j --0.000122-0.000029j --0.000020+0.000058j -0.000056+0.000165j -0.000103+0.000287j -0.000119+0.000415j -0.000102+0.000540j -0.000055+0.000657j --0.000019+0.000757j --0.000115+0.000835j --0.000227+0.000886j --0.000347+0.000907j --0.000469+0.000898j --0.000585+0.000859j --0.000688+0.000792j --0.000772+0.000702j --0.000831+0.000595j --0.000863+0.000477j --0.000866+0.000354j --0.000839+0.000235j --0.000786+0.000125j --0.000708+0.000032j --0.000611-0.000040j --0.000501-0.000087j --0.000385-0.000106j --0.000268-0.000097j --0.000159-0.000061j --0.000063-0.000001j -0.000015+0.000080j -0.000070+0.000175j -0.000099+0.000280j -0.000101+0.000387j -0.000077+0.000490j -0.000028+0.000582j --0.000042+0.000659j --0.000128+0.000715j --0.000225+0.000748j --0.000327+0.000755j --0.000428+0.000737j --0.000521+0.000694j --0.000601+0.000630j --0.000663+0.000548j --0.000703+0.000454j --0.000720+0.000352j --0.000712+0.000250j --0.000681+0.000152j --0.000627+0.000065j --0.000555-0.000006j --0.000469-0.000058j --0.000374-0.000088j --0.000275-0.000095j --0.000180-0.000078j --0.000092-0.000040j --0.000017+0.000017j -0.000040+0.000090j -0.000078+0.000173j -0.000093+0.000261j -0.000086+0.000350j -0.000058+0.000432j -0.000010+0.000504j --0.000054+0.000561j --0.000130+0.000600j --0.000213+0.000619j --0.000297+0.000616j --0.000379+0.000592j --0.000452+0.000548j --0.000513+0.000488j --0.000557+0.000415j --0.000582+0.000334j --0.000588+0.000248j --0.000573+0.000164j --0.000538+0.000086j --0.000487+0.000019j --0.000422-0.000035j --0.000347-0.000071j --0.000266-0.000088j --0.000185-0.000086j --0.000107-0.000065j --0.000038-0.000027j -0.000018+0.000025j -0.000060+0.000089j -0.000083+0.000160j -0.000089+0.000233j -0.000076+0.000304j -0.000046+0.000369j -0.000001+0.000423j --0.000056+0.000464j --0.000121+0.000489j --0.000190+0.000497j --0.000259+0.000487j --0.000323+0.000461j --0.000379+0.000419j --0.000423+0.000365j --0.000453+0.000301j --0.000467+0.000232j --0.000465+0.000161j --0.000445+0.000093j --0.000411+0.000032j --0.000364-0.000019j --0.000306-0.000058j --0.000242-0.000081j --0.000175-0.000090j --0.000109-0.000082j --0.000048-0.000059j -0.000005-0.000023j -0.000047+0.000024j -0.000075+0.000078j -0.000089+0.000137j -0.000088+0.000196j -0.000072+0.000252j -0.000042+0.000302j -0.000002+0.000341j --0.000048+0.000369j --0.000102+0.000384j --0.000158+0.000384j --0.000213+0.000370j --0.000262+0.000343j --0.000304+0.000304j --0.000335+0.000256j --0.000354+0.000202j --0.000359+0.000145j --0.000351+0.000088j --0.000330+0.000034j --0.000298-0.000012j --0.000255-0.000050j --0.000206-0.000077j --0.000152-0.000091j --0.000098-0.000093j --0.000046-0.000082j -0.000002-0.000059j -0.000041-0.000027j -0.000071+0.000014j -0.000089+0.000059j -0.000095+0.000106j -0.000090+0.000153j -0.000073+0.000196j -0.000045+0.000232j -0.000010+0.000260j --0.000031+0.000278j --0.000075+0.000284j --0.000120+0.000279j --0.000162+0.000263j --0.000199+0.000237j --0.000228+0.000203j --0.000249+0.000162j --0.000259+0.000117j --0.000259+0.000071j --0.000248+0.000026j --0.000227-0.000014j --0.000197-0.000049j --0.000161-0.000076j --0.000120-0.000093j --0.000077-0.000101j --0.000034-0.000098j -0.000006-0.000086j -0.000042-0.000064j -0.000070-0.000036j -0.000090-0.000002j -0.000101+0.000034j -0.000102+0.000071j -0.000093+0.000107j -0.000077+0.000139j -0.000052+0.000165j -0.000022+0.000184j --0.000011+0.000194j --0.000046+0.000196j --0.000081+0.000188j --0.000113+0.000173j --0.000140+0.000150j --0.000161+0.000121j --0.000174+0.000089j --0.000180+0.000054j --0.000177+0.000020j --0.000167-0.000013j --0.000150-0.000041j --0.000127-0.000063j --0.000100-0.000077j --0.000071-0.000084j --0.000044-0.000080j --0.000020-0.000066j --0.000009-0.000035j diff --git a/gr-uhd/apps/hf_radio/ssbagc.py b/gr-uhd/apps/hf_radio/ssbagc.py deleted file mode 100644 index 6a2e0a7cd..000000000 --- a/gr-uhd/apps/hf_radio/ssbagc.py +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright 2011 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. - - -# post detection agc processing -# -# This agc strategy is copied more or less verbatim from -# weaver_isb_am1_usrp3.py by cswiger. -# -# Thanks. -# -# Then modified in a variety of ways. -# -# There doesn't appear to be a way to hook multiple blocks to the -# input port when building a hier block like this. Thus the -# split below. -# -# Basic operation. -# Power is estimated by squaring the input. -# Low pass filter using a 1 pole iir. -# The time constant can be tweaked by changing the taps. -# Currently there is no implementation to change this while operating -# a potentially useful addition. -# The log block turns this into dB -# gain adjusts the agc authority. -# -# M. Revnell 2006-Jan - -from gnuradio import gr - -class agc( gr.hier_block2 ): - def __init__( self ): - gr.hier_block2.__init__(self, "agc", - gr.io_signature(1,1,gr.sizeof_float), - gr.io_signature(1,1,gr.sizeof_float)) - - self.split = gr.multiply_const_ff( 1 ) - self.sqr = gr.multiply_ff( ) - self.int0 = gr.iir_filter_ffd( [.004, 0], [0, .999] ) - self.offs = gr.add_const_ff( -30 ) - self.gain = gr.multiply_const_ff( 70 ) - self.log = gr.nlog10_ff( 10, 1 ) - self.agc = gr.divide_ff( ) - - self.connect(self, self.split) - self.connect(self.split, (self.agc, 0)) - self.connect(self.split, (self.sqr, 0)) - self.connect(self.split, (self.sqr, 1)) - self.connect(self.sqr, self.int0) - self.connect(self.int0, self.log) - self.connect(self.log, self.offs) - self.connect(self.offs, self.gain) - self.connect(self.gain, (self.agc, 1)) - self.connect(self.agc, self) diff --git a/gr-uhd/apps/hf_radio/ssbdemod.py b/gr-uhd/apps/hf_radio/ssbdemod.py deleted file mode 100644 index 3c533f617..000000000 --- a/gr-uhd/apps/hf_radio/ssbdemod.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright 2011 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 tries to push the hilbert transform for ssb demod back into the -# freq. xlating filter. -# -# The starting point for this was weaver_isb_am1_usrp3.py. -# -# The tap coefficients for freq_xlating_fir_filter_ccf were generated -# externally and are read from a file because I didn't want to learn how -# to make fir filters with arbitrary phase response using python numeric -# facilities. -# -# They were generated using Scilab which I am already familiar with. -# M. Revnell Jan 06 - -from gnuradio import gr - -class ssb_demod( gr.hier_block2 ): - def __init__( self, if_rate, af_rate ): - gr.hier_block2.__init__(self, "ssb_demod", - gr.io_signature(1,1,gr.sizeof_gr_complex), - gr.io_signature(1,1,gr.sizeof_float)) - - self.if_rate = int(if_rate) - self.af_rate = int(af_rate) - self.if_decim = int(if_rate / af_rate) - self.sideband = 1 - - self.xlate_taps = ([complex(v) for v in file('ssb_taps').readlines()]) - - self.audio_taps = gr.firdes.low_pass( - 1.0, - self.af_rate, - 3e3, - 600, - gr.firdes.WIN_HAMMING ) - - self.xlate = gr.freq_xlating_fir_filter_ccc( - self.if_decim, - self.xlate_taps, - 0, - self.if_rate ) - - self.split = gr.complex_to_float() - - self.lpf = gr.fir_filter_fff( - 1, self.audio_taps ) - - self.sum = gr.add_ff( ) - self.am_sel = gr.multiply_const_ff( 0 ) - self.sb_sel = gr.multiply_const_ff( 1 ) - self.mixer = gr.add_ff() - self.am_det = gr.complex_to_mag() - - self.connect(self, self.xlate) - self.connect(self.xlate, self.split) - self.connect((self.split, 0), (self.sum, 0)) - self.connect((self.split, 1), (self.sum, 1)) - self.connect(self.sum, self.sb_sel) - self.connect(self.xlate, self.am_det) - self.connect(self.sb_sel, (self.mixer, 0)) - self.connect(self.am_det, self.am_sel) - self.connect(self.am_sel, (self.mixer, 1)) - self.connect(self.mixer, self.lpf) - self.connect(self.lpf, self) - - def upper_sb( self ): - self.xlate.set_taps([v.conjugate() for v in self.xlate_taps]) - self.sb_sel.set_k( 1.0 ) - self.am_sel.set_k( 0.0 ) - - def lower_sb( self ): - self.xlate.set_taps(self.xlate_taps) - self.sb_sel.set_k( 1.0 ) - self.am_sel.set_k( 0.0 ) - - def set_am( self ): - taps = gr.firdes.low_pass( 1.0, - self.if_rate, - 5e3, - 2e3, - gr.firdes.WIN_HAMMING ) - self.xlate.set_taps( taps ) - self.sb_sel.set_k( 0.0 ) - self.am_sel.set_k( 1.0 ) - - def set_bw( self, bw ): - self.audio_taps = gr.firdes.low_pass( - 1.0, - self.af_rate, - bw, - 600, - gr.firdes.WIN_HAMMING ) - self.lpf.set_taps( self.audio_taps ) - - def tune( self, freq ): - self.xlate.set_center_freq( freq ) - diff --git a/gr-uhd/apps/hf_radio/startup.py b/gr-uhd/apps/hf_radio/startup.py deleted file mode 100644 index 093369b57..000000000 --- a/gr-uhd/apps/hf_radio/startup.py +++ /dev/null @@ -1 +0,0 @@ -from radio import * diff --git a/gr-uhd/apps/hf_radio/ui.py b/gr-uhd/apps/hf_radio/ui.py deleted file mode 100755 index a20ba4fab..000000000 --- a/gr-uhd/apps/hf_radio/ui.py +++ /dev/null @@ -1,316 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -# -*- coding: UTF-8 -*- -# generated by wxGlade 0.4 on Mon Jan 2 19:02:03 2006 - -import wx - -class ui_frame(wx.Frame): - def __init__(self, *args, **kwds): - # begin wxGlade: ui_frame.__init__ - kwds["style"] = wx.DEFAULT_FRAME_STYLE - wx.Frame.__init__(self, *args, **kwds) - self.sizer_1_staticbox = wx.StaticBox(self, -1, "sizer_1") - self.freq_disp = wx.SpinCtrl(self, -1, "", min=0, max=100) - self.spin_e6 = wx.SpinButton(self, -1 ) - self.spin_e5 = wx.SpinButton(self, -1 ) - self.spin_e4 = wx.SpinButton(self, -1 ) - self.spin_e3 = wx.SpinButton(self, -1 ) - self.spin_e2 = wx.SpinButton(self, -1 ) - self.spin_e1 = wx.SpinButton(self, -1 ) - self.spin_e0 = wx.SpinButton(self, -1 ) - self.panel_1 = wx.Panel(self, -1) - self.panel_2 = wx.Panel(self, -1) - self.button_lsb = wx.Button(self, -1, "LSB") - self.button_usb = wx.Button(self, -1, "USB") - self.button_am = wx.Button(self, -1, "AM") - self.label_1 = wx.StaticText(self, -1, "VOLUME") - self.label_2 = wx.StaticText(self, -1, "PGA") - self.agc_level = wx.TextCtrl(self, -1, "") - self.label_6 = wx.StaticText(self, -1, "") - self.volume = wx.SpinCtrl(self, -1, "", min=0, max=100) - self.pga = wx.SpinCtrl(self, -1, "", min=0, max=100) - self.agc_max = wx.TextCtrl(self, -1, "") - self.label_7 = wx.StaticText(self, -1, "") - self.label_4 = wx.StaticText(self, -1, "AGC AUTHORITY") - self.label_5 = wx.StaticText(self, -1, "AGC REF LVL") - self.label_3 = wx.StaticText(self, -1, "BANDWIDTH") - self.label_8 = wx.StaticText(self, -1, "") - self.agc_gain = wx.TextCtrl(self, -1, "") - self.agc_gain_s = wx.SpinButton(self, -1 ) - self.agc_ref = wx.TextCtrl(self, -1, "") - self.agc_ref_s = wx.SpinButton(self, -1 ) - self.bandwidth = wx.TextCtrl(self, -1, "") - self.bw_spin = wx.SpinButton(self, -1 ) - self.label_9 = wx.StaticText(self, -1, "") - self.rssi = wx.Gauge(self, -1, 10, style=wx.GA_HORIZONTAL|wx.GA_SMOOTH) - self.fe_panel = wx.Panel(self, -1) - self.if_panel = wx.Panel(self, -1) - - self.__set_properties() - self.__do_layout() - - self.Bind(wx.EVT_SPINCTRL, self.tune_evt, self.freq_disp) - self.Bind(wx.EVT_SPIN_DOWN, self.down_e6, self.spin_e6) - self.Bind(wx.EVT_SPIN_UP, self.up_e6, self.spin_e6) - self.Bind(wx.EVT_SPIN_DOWN, self.down_e5, self.spin_e5) - self.Bind(wx.EVT_SPIN_UP, self.up_e5, self.spin_e5) - self.Bind(wx.EVT_SPIN_DOWN, self.down_e4, self.spin_e4) - self.Bind(wx.EVT_SPIN_UP, self.up_e4, self.spin_e4) - self.Bind(wx.EVT_SPIN_DOWN, self.down_e3, self.spin_e3) - self.Bind(wx.EVT_SPIN_UP, self.up_e3, self.spin_e3) - self.Bind(wx.EVT_SPIN_DOWN, self.down_e2, self.spin_e2) - self.Bind(wx.EVT_SPIN_UP, self.up_e2, self.spin_e2) - self.Bind(wx.EVT_SPIN_DOWN, self.down_e1, self.spin_e1) - self.Bind(wx.EVT_SPIN_UP, self.up_e1, self.spin_e1) - self.Bind(wx.EVT_SPIN_DOWN, self.down_e0, self.spin_e0) - self.Bind(wx.EVT_SPIN_UP, self.up_e0, self.spin_e0) - self.Bind(wx.EVT_BUTTON, self.set_lsb, self.button_lsb) - self.Bind(wx.EVT_BUTTON, self.set_usb, self.button_usb) - self.Bind(wx.EVT_BUTTON, self.set_am, self.button_am) - self.Bind(wx.EVT_SPINCTRL, self.event_vol, self.volume) - self.Bind(wx.EVT_SPINCTRL, self.event_pga, self.pga) - self.Bind(wx.EVT_SPIN_DOWN, self.agc_gain_down, self.agc_gain_s) - self.Bind(wx.EVT_SPIN_UP, self.agc_gain_up, self.agc_gain_s) - self.Bind(wx.EVT_SPIN_DOWN, self.agc_ref_down, self.agc_ref_s) - self.Bind(wx.EVT_SPIN_UP, self.agc_ref_up, self.agc_ref_s) - self.Bind(wx.EVT_SPIN_DOWN, self.bw_down, self.bw_spin) - self.Bind(wx.EVT_SPIN_UP, self.bw_up, self.bw_spin) - # end wxGlade - - def __set_properties(self): - # begin wxGlade: ui_frame.__set_properties - self.SetTitle("frame_1") - self.freq_disp.SetFont(wx.Font(32, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) - self.rssi.SetMinSize((315, 10)) - self.rssi.SetForegroundColour(wx.Colour(255, 0, 0)) - # end wxGlade - - def __do_layout(self): - # begin wxGlade: ui_frame.__do_layout - sizer_1 = wx.StaticBoxSizer(self.sizer_1_staticbox, wx.VERTICAL) - sizer_2 = wx.BoxSizer(wx.HORIZONTAL) - sizer_4 = wx.BoxSizer(wx.VERTICAL) - grid_sizer_4 = wx.GridSizer(2, 4, 0, 0) - sizer_5 = wx.BoxSizer(wx.HORIZONTAL) - sizer_7 = wx.BoxSizer(wx.HORIZONTAL) - sizer_6 = wx.BoxSizer(wx.HORIZONTAL) - grid_sizer_3 = wx.GridSizer(2, 4, 0, 0) - sizer_3 = wx.BoxSizer(wx.VERTICAL) - grid_sizer_1 = wx.GridSizer(2, 3, 0, 0) - grid_sizer_2 = wx.GridSizer(1, 7, 0, 0) - sizer_3.Add(self.freq_disp, 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) - grid_sizer_2.Add(self.spin_e6, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_2.Add(self.spin_e5, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_2.Add(self.spin_e4, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_2.Add(self.spin_e3, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_2.Add(self.spin_e2, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_2.Add(self.spin_e1, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_2.Add(self.spin_e0, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(grid_sizer_2, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.panel_2, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.button_lsb, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.button_usb, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.button_am, 0, wx.ADJUST_MINSIZE, 0) - sizer_3.Add(grid_sizer_1, 1, wx.EXPAND, 0) - sizer_2.Add(sizer_3, 1, wx.EXPAND, 0) - grid_sizer_3.Add(self.label_1, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_3.Add(self.label_2, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_3.Add(self.agc_level, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_3.Add(self.label_6, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_3.Add(self.volume, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_3.Add(self.pga, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_3.Add(self.agc_max, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_3.Add(self.label_7, 0, wx.ADJUST_MINSIZE, 0) - sizer_4.Add(grid_sizer_3, 1, wx.EXPAND, 0) - grid_sizer_4.Add(self.label_4, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_4.Add(self.label_5, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_4.Add(self.label_3, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_4.Add(self.label_8, 0, wx.ADJUST_MINSIZE, 0) - sizer_6.Add(self.agc_gain, 0, wx.ADJUST_MINSIZE, 0) - sizer_6.Add(self.agc_gain_s, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_4.Add(sizer_6, 1, wx.EXPAND, 0) - sizer_7.Add(self.agc_ref, 0, wx.ADJUST_MINSIZE, 0) - sizer_7.Add(self.agc_ref_s, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_4.Add(sizer_7, 1, wx.EXPAND, 0) - sizer_5.Add(self.bandwidth, 0, wx.ADJUST_MINSIZE, 0) - sizer_5.Add(self.bw_spin, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_4.Add(sizer_5, 1, wx.EXPAND, 0) - grid_sizer_4.Add(self.label_9, 0, wx.ADJUST_MINSIZE, 0) - sizer_4.Add(grid_sizer_4, 1, wx.EXPAND, 0) - sizer_4.Add(self.rssi, 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) - sizer_2.Add(sizer_4, 1, wx.EXPAND, 0) - sizer_1.Add(sizer_2, 1, wx.EXPAND, 0) - sizer_1.Add(self.fe_panel, 1, wx.EXPAND, 0) - sizer_1.Add(self.if_panel, 1, wx.EXPAND, 0) - self.SetAutoLayout(True) - self.SetSizer(sizer_1) - sizer_1.Fit(self) - sizer_1.SetSizeHints(self) - self.Layout() - # end wxGlade - - def down_e6(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `down_e6' not implemented" - event.Skip() - - def up_e6(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `up_e6' not implemented" - event.Skip() - - def down_e5(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `down_e5' not implemented" - event.Skip() - - def up_e5(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `up_e5' not implemented" - event.Skip() - - def down_e4(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `down_e4' not implemented" - event.Skip() - - def up_e4(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `up_e4' not implemented" - event.Skip() - - def down_e3(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `down_e3' not implemented" - event.Skip() - - def up_e3(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `up_e3' not implemented" - event.Skip() - - def down_e2(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `down_e2' not implemented" - event.Skip() - - def up_e2(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `up_e2' not implemented" - event.Skip() - - def down_e1(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `down_e1' not implemented" - event.Skip() - - def up_e1(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `up_e1' not implemented" - event.Skip() - - def down_e0(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `down_e0' not implemented" - event.Skip() - - def up_e0(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `up_e0' not implemented" - event.Skip() - - def event_vol(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `event_vol' not implemented" - event.Skip() - - def event_pga(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `event_pga' not implemented" - event.Skip() - - def set_lsb(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `set_lsb' not implemented" - event.Skip() - - def set_usb(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `set_usb' not implemented" - event.Skip() - - def set_am(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `set_am' not implemented" - event.Skip() - - def set_bw(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `set_bw' not implemented" - event.Skip() - - def tune_evt(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `tune_evt' not implemented" - event.Skip() - - def bw_down(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `bw_down' not implemented" - event.Skip() - - def bw_up(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `bw_up' not implemented" - event.Skip() - - def agc_gain_down(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `agc_gain_down' not implemented" - event.Skip() - - def agc_gain_up(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `agc_gain_up' not implemented" - event.Skip() - - def agc_ref_down(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `agc_ref_down' not implemented" - event.Skip() - - def agc_ref_up(self, event): # wxGlade: ui_frame.<event_handler> - print "Event handler `agc_ref_up' not implemented" - event.Skip() - -# end of class ui_frame - - -class RadioFrame(wx.Frame): - def __init__(self, *args, **kwds): - # content of this block not found: did you rename this class? - pass - - def __set_properties(self): - # content of this block not found: did you rename this class? - pass - - def __do_layout(self): - # content of this block not found: did you rename this class? - pass - -# end of class RadioFrame - - -class MyFrame(wx.Frame): - def __init__(self, *args, **kwds): - # content of this block not found: did you rename this class? - pass - - def __set_properties(self): - # content of this block not found: did you rename this class? - pass - - def __do_layout(self): - # content of this block not found: did you rename this class? - pass - -# end of class MyFrame - - diff --git a/gr-uhd/apps/uhd_fft b/gr-uhd/apps/uhd_fft deleted file mode 100755 index 800a5fab8..000000000 --- a/gr-uhd/apps/uhd_fft +++ /dev/null @@ -1,340 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gru -from gnuradio import uhd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import sys -import numpy - -try: - from gnuradio.wxgui import stdgui2, form, slider - from gnuradio.wxgui import forms - from gnuradio.wxgui import fftsink2, waterfallsink2, scopesink2 - import wx -except ImportError: - sys.stderr.write("Error importing GNU Radio's wxgui. Please make sure gr-wxgui is installed.\n") - sys.exit(1) - -class app_top_block(stdgui2.std_top_block): - def __init__(self, frame, panel, vbox, argv): - stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv) - - self.frame = frame - self.panel = panel - - parser = OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args , [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6, - help="set sample rate (bandwidth) [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-W", "--waterfall", action="store_true", default=False, - help="Enable waterfall display") - parser.add_option("-S", "--oscilloscope", action="store_true", default=False, - help="Enable oscilloscope display") - parser.add_option("", "--avg-alpha", type="eng_float", default=1e-1, - help="Set fftsink averaging factor, default=[%default]") - parser.add_option ("", "--averaging", action="store_true", default=False, - help="Enable fftsink averaging, default=[%default]") - parser.add_option("", "--ref-scale", type="eng_float", default=1.0, - help="Set dBFS=0dB input value, default=[%default]") - parser.add_option("", "--fft-size", type="int", default=1024, - help="Set number of FFT bins [default=%default]") - parser.add_option("", "--fft-rate", type="int", default=30, - help="Set FFT update rate, [default=%default]") - parser.add_option("", "--wire-format", type="string", default="sc16", - help="Set wire format from USRP [default=%default]") - parser.add_option("", "--stream-args", type="string", default="", - help="Set additional stream args [default=%default]") - parser.add_option("", "--show-async-msg", action="store_true", default=False, - help="Show asynchronous message notifications from UHD [default=%default]") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - self.options = options - self.show_debug_info = True - - self.u = uhd.usrp_source(device_addr=options.args, - stream_args=uhd.stream_args(cpu_format='fc32', - otw_format=options.wire_format, args=options.stream_args)) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - self.u.set_samp_rate(options.samp_rate) - input_rate = self.u.get_samp_rate() - - if options.waterfall: - self.scope = \ - waterfallsink2.waterfall_sink_c (panel, fft_size=1024, - sample_rate=input_rate) - self.frame.SetMinSize((800, 420)) - elif options.oscilloscope: - self.scope = scopesink2.scope_sink_c(panel, sample_rate=input_rate) - self.frame.SetMinSize((800, 600)) - else: - self.scope = fftsink2.fft_sink_c (panel, - fft_size=options.fft_size, - sample_rate=input_rate, - ref_scale=options.ref_scale, - ref_level=20.0, - y_divs = 12, - average=options.averaging, - avg_alpha=options.avg_alpha, - fft_rate=options.fft_rate) - def fftsink_callback(x, y): - self.set_freq(x) - - self.scope.set_callback(fftsink_callback) - self.frame.SetMinSize((800, 420)) - - self.connect(self.u, self.scope) - - self._build_gui(vbox) - self._setup_events() - - - # set initial values - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2 - - if options.freq is None: - # if no freq was specified, use the mid-point - r = self.u.get_freq_range() - options.freq = float(r.start()+r.stop())/2 - - self.set_gain(options.gain) - - if self.show_debug_info: - self.myform['samprate'].set_value(self.u.get_samp_rate()) - self.myform['rffreq'].set_value(0) - self.myform['dspfreq'].set_value(0) - - if not(self.set_freq(options.freq)): - self._set_status_msg("Failed to set initial frequency") - - # Direct asynchronous notifications to callback function - if self.options.show_async_msg: - self.async_msgq = gr.msg_queue(0) - self.async_src = uhd.amsg_source("", self.async_msgq) - self.async_rcv = gru.msgq_runner(self.async_msgq, self.async_callback) - - def async_callback(self, msg): - md = self.async_src.msg_to_async_metadata_t(msg) - print "Channel: %i Time: %f Event: %i" % (md.channel, md.time_spec.get_real_secs(), md.event_code) - - def _set_status_msg(self, msg): - self.frame.GetStatusBar().SetStatusText(msg, 0) - - def _build_gui(self, vbox): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - vbox.Add(self.scope.win, 10, wx.EXPAND) - - # add control area at the bottom - self.myform = myform = form.form() - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0, 0) - myform['freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="Center freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, - self._set_status_msg)) - - hbox.Add((5,0), 0, 0) - g = self.u.get_gain_range() - - # some configurations don't have gain control - if g.stop() <= g.start(): - glow = 0.0 - ghigh = 1.0 - - else: - glow = g.start() - ghigh = g.stop() - - myform['gain'] = form.slider_field(parent=self.panel, - sizer=hbox, label="Gain", - weight=3, - min=int(glow), max=int(ghigh), - callback=self.set_gain) - - try: - mboard_id = self.u.get_usrp_info().get("mboard_id") - mboard_serial = self.u.get_usrp_info().get("mboard_serial") - if mboard_serial == "": - mboard_serial = "no serial" - dboard_subdev_name = self.u.get_usrp_info().get("rx_subdev_name") - dboard_serial = self.u.get_usrp_info().get("rx_serial") - if dboard_serial == "": - dboard_serial = "no serial" - subdev = self.u.get_subdev_spec() - antenna = self.u.get_antenna() - - usrp_config_val = "%s (%s), %s (%s, %s, %s)" % (mboard_id, mboard_serial, dboard_subdev_name, dboard_serial, subdev, antenna) - except: - usrp_config_val = "Not implemented in this version." - - uhd_box = forms.static_box_sizer(parent=self.panel, - label="UHD (%s)" % (uhd.get_version_string()), - orient=wx.HORIZONTAL) - usrp_config_form = forms.static_text( - parent=self.panel, - sizer=uhd_box, - value=usrp_config_val, - label="USRP", - converter=forms.str_converter(), - ) - vbox.Add(uhd_box, 0, wx.EXPAND) - vbox.AddSpacer(5) - - hbox.Add((5,0), 0, 0) - vbox.Add(hbox, 0, wx.EXPAND) - - self._build_subpanel(vbox) - - def _build_subpanel(self, vbox_arg): - # build a secondary information panel (sometimes hidden) - - # FIXME figure out how to have this be a subpanel that is always - # created, but has its visibility controlled by foo.Show(True/False) - - def _form_set_samp_rate(kv): - return self.set_samp_rate(kv['samprate']) - - if not(self.show_debug_info): - return - - panel = self.panel - vbox = vbox_arg - myform = self.myform - - hbox = wx.BoxSizer(wx.HORIZONTAL) - - hbox.Add((5,0), 0) - myform['samprate'] = form.float_field( - parent=panel, sizer=hbox, label="Sample Rate", - callback=myform.check_input_and_call(_form_set_samp_rate, - self._set_status_msg)) - - hbox.Add((5,0), 1) - myform['rffreq'] = form.static_float_field( - parent=panel, sizer=hbox, label="RF Freq.") - - hbox.Add((5,0), 1) - myform['dspfreq'] = form.static_float_field( - parent=panel, sizer=hbox, label="DSP Freq.") - - vbox.AddSpacer(5) - - vbox.Add(hbox, 0, wx.EXPAND) - vbox.AddSpacer(5) - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - """ - r = self.u.set_center_freq(target_freq, 0) - - if r: - self.myform['freq'].set_value(self.u.get_center_freq()) - self.myform['rffreq'].set_value(r.actual_rf_freq) - self.myform['dspfreq'].set_value(r.actual_dsp_freq) - - if not self.options.oscilloscope: - self.scope.set_baseband_freq(target_freq) - return True - - return False - - def set_gain(self, gain): - if self.myform.has_key('gain'): - self.myform['gain'].set_value(gain) # update displayed value - self.u.set_gain(gain, 0) - - def set_samp_rate(self, samp_rate): - ok = self.u.set_samp_rate(samp_rate) - input_rate = self.u.get_samp_rate() - self.scope.set_sample_rate(input_rate) - if self.show_debug_info: # update displayed values - self.myform['samprate'].set_value(self.u.get_samp_rate()) - - # uhd set_samp_rate never fails; always falls back to closest requested. - return True - - def _setup_events(self): - if not self.options.waterfall and not self.options.oscilloscope: - self.scope.win.Bind(wx.EVT_LEFT_DCLICK, self.evt_left_dclick) - - def evt_left_dclick(self, event): - (ux, uy) = self.scope.win.GetXY(event) - if event.CmdDown(): - # Re-center on maximum power - points = self.scope.win._points - if self.scope.win.peak_hold: - if self.scope.win.peak_vals is not None: - ind = numpy.argmax(self.scope.win.peak_vals) - else: - ind = int(points.shape()[0]/2) - else: - ind = numpy.argmax(points[:,1]) - - (freq, pwr) = points[ind] - target_freq = freq/self.scope.win._scale_factor - print ind, freq, pwr - self.set_freq(target_freq) - else: - # Re-center on clicked frequency - target_freq = ux/self.scope.win._scale_factor - self.set_freq(target_freq) - - -def main (): - app = stdgui2.stdapp(app_top_block, "UHD FFT", nstatus=1) - app.MainLoop() - -if __name__ == '__main__': - main () diff --git a/gr-uhd/apps/uhd_rx_cfile b/gr-uhd/apps/uhd_rx_cfile deleted file mode 100755 index 62874771c..000000000 --- a/gr-uhd/apps/uhd_rx_cfile +++ /dev/null @@ -1,190 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -""" -Read samples from a UHD device and write to file formatted as binary -outputs single precision complex float values or complex short values -(interleaved 16 bit signed short integers). -""" - -from gnuradio import gr, gru, eng_notation -from gnuradio import uhd -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -n2s = eng_notation.num_to_str - -class rx_cfile_block(gr.top_block): - - def __init__(self, options, filename): - gr.top_block.__init__(self) - - # Create a UHD device source - if options.output_shorts: - self._u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('sc16', - options.wire_format, args=options.stream_args)) - self._sink = gr.file_sink(gr.sizeof_short*2, filename) - else: - self._u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32', - options.wire_format, args=options.stream_args)) - self._sink = gr.file_sink(gr.sizeof_gr_complex, filename) - - # Set the subdevice spec - if(options.spec): - self._u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self._u.set_antenna(options.antenna, 0) - - # Set receiver sample rate - self._u.set_samp_rate(options.samp_rate) - - # Set receive daughterboard gain - if options.gain is None: - g = self._u.get_gain_range() - options.gain = float(g.start()+g.stop())/2 - print "Using mid-point gain of", options.gain, "(", g.start(), "-", g.stop(), ")" - self._u.set_gain(options.gain) - - # Set frequency (tune request takes lo_offset) - if(options.lo_offset is not None): - treq = uhd.tune_request(options.freq, options.lo_offset) - else: - treq = uhd.tune_request(options.freq) - tr = self._u.set_center_freq(treq) - if tr == None: - sys.stderr.write('Failed to set center frequency\n') - raise SystemExit, 1 - - # Create head block if needed and wire it up - if options.nsamples is None: - self.connect(self._u, self._sink) - else: - if options.output_shorts: - self._head = gr.head(gr.sizeof_short*2, int(options.nsamples)) - else: - self._head = gr.head(gr.sizeof_gr_complex, int(options.nsamples)) - - self.connect(self._u, self._head, self._sink) - - input_rate = self._u.get_samp_rate() - - if options.verbose: - try: - info = self._u.get_usrp_info() - - mboard_id = info.get("mboard_id").split(" ")[0] - if info.get("mboard_serial") == "": - mboard_serial = "no serial" - else: - mboard_serial = info.get("mboard_serial") - - rx_id = info.get("rx_id").split(" ")[0] - if info.get("rx_serial") == "": - rx_serial = "no serial" - else: - rx_serial = info.get("rx_serial") - rx_antenna = info.get("rx_antenna") - rx_subdev_spec = info.get("rx_subdev_spec") - - print "Motherboard: %s (%s)" % (mboard_id, mboard_serial) - print "Daughterboard: %s (%s, %s, %s)" % (rx_id, rx_serial, rx_antenna, rx_subdev_spec) - except: - print "Args: ", options.args - print "Rx gain:", options.gain - print "Rx baseband frequency:", n2s(tr.actual_rf_freq) - print "Rx DDC frequency:", n2s(tr.actual_dsp_freq) - print "Rx Sample Rate:", n2s(input_rate) - if options.nsamples is None: - print "Receiving samples until Ctrl-C" - else: - print "Receving", n2s(options.nsamples), "samples" - if options.output_shorts: - print "Writing 16-bit complex shorts" - else: - print "Writing 32-bit complex floats" - print "Output filename:", filename - - # Direct asynchronous notifications to callback function - if options.show_async_msg: - self.async_msgq = gr.msg_queue(0) - self.async_src = uhd.amsg_source("", self.async_msgq) - self.async_rcv = gru.msgq_runner(self.async_msgq, self.async_callback) - - def async_callback(self, msg): - md = self.async_src.msg_to_async_metadata_t(msg) - print "Channel: %i Time: %f Event: %i" % (md.channel, md.time_spec.get_real_secs(), md.event_code) - - -def get_options(): - usage="%prog: [options] output_filename" - parser = OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args , [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--samp-rate", type="eng_float", default=1e6, - help="set sample rate (bandwidth) [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option( "-s","--output-shorts", action="store_true", default=False, - help="output interleaved shorts instead of complex floats") - parser.add_option("-N", "--nsamples", type="eng_float", default=None, - help="number of samples to collect [default=+inf]") - parser.add_option("-v", "--verbose", action="store_true", default=False, - help="verbose output") - parser.add_option("", "--lo-offset", type="eng_float", default=None, - help="set daughterboard LO offset to OFFSET [default=hw default]") - parser.add_option("", "--wire-format", type="string", default="sc16", - help="set wire format from USRP [default=%default") - parser.add_option("", "--stream-args", type="string", default="", - help="set stream arguments [default=%default]") - parser.add_option("", "--show-async-msg", action="store_true", default=False, - help="Show asynchronous message notifications from UHD [default=%default]") - - (options, args) = parser.parse_args () - if len(args) != 1: - parser.print_help() - raise SystemExit, 1 - - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - return (options, args[0]) - - -if __name__ == '__main__': - (options, filename) = get_options() - tb = rx_cfile_block(options, filename) - - try: - tb.run() - except KeyboardInterrupt: - pass diff --git a/gr-uhd/apps/uhd_rx_nogui b/gr-uhd/apps/uhd_rx_nogui deleted file mode 100755 index f0cfdd8be..000000000 --- a/gr-uhd/apps/uhd_rx_nogui +++ /dev/null @@ -1,255 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2011,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. -# - -from gnuradio import gr, gru, uhd, optfir, audio, blks2 -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -""" -This example application demonstrates receiving and demodulating -different types of signals using the USRP. - -A receive chain is built up of the following signal processing -blocks: - -USRP - Daughter board source generating complex baseband signal. -CHAN - Low pass filter to select channel bandwidth -RFSQL - RF squelch zeroing output when input power below threshold -AGC - Automatic gain control leveling signal at [-1.0, +1.0] -DEMOD - Demodulation block appropriate to selected signal type. - This converts the complex baseband to real audio frequencies, - and applies an appropriate low pass decimating filter. -CTCSS - Optional tone squelch zeroing output when tone is not present. -RSAMP - Resampler block to convert audio sample rate to user specified - sound card output rate. -AUDIO - Audio sink for playing final output to speakers. - -The following are required command line parameters: - --f FREQ USRP receive frequency --m MOD Modulation type, select from AM, FM, or WFM - -The following are optional command line parameters: - --R SUBDEV Daughter board specification, defaults to first found --c FREQ Calibration offset. Gets added to receive frequency. - Defaults to 0.0 Hz. --g GAIN Daughterboard gain setting. Defaults to mid-range. --o RATE Sound card output rate. Defaults to 32000. Useful if - your sound card only accepts particular sample rates. --r RFSQL RF squelch in db. Defaults to -50.0. --p FREQ CTCSS frequency. Opens squelch when tone is present. - -Once the program is running, ctrl-break (Ctrl-C) stops operation. - -Please see fm_demod.py and am_demod.py for details of the demodulation -blocks. -""" - -# (device_rate, channel_rate, audio_rate, channel_pass, channel_stop, demod) -demod_params = { - 'AM' : (256e3, 16e3, 16e3, 5000, 8000, blks2.demod_10k0a3e_cf), - 'FM' : (256e3, 32e3, 8e3, 8000, 9000, blks2.demod_20k0f3e_cf), - 'WFM' : (320e3, 320e3, 32e3, 80000, 115000, blks2.demod_200kf3e_cf) - } - -class uhd_src(gr.hier_block2): - """ - Create a UHD source object supplying complex floats. - - Selects user supplied subdevice or chooses first available one. - - Calibration value is the offset from the tuned frequency to - the actual frequency. - """ - def __init__(self, args, spec, antenna, samp_rate, gain=None, calibration=0.0): - gr.hier_block2.__init__(self, "uhd_src", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - self._src = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(spec): - self._src.set_subdev_spec(spec, 0) - - # Set the antenna - if(antenna): - self._src.set_antenna(antenna, 0) - - self._src.set_samp_rate(samp_rate) - dev_rate = self._src.get_samp_rate() - self._samp_rate = samp_rate - - # Resampler to get to exactly samp_rate no matter what dev_rate is - self._rrate = samp_rate / dev_rate - self._resamp = blks2.pfb_arb_resampler_ccf(self._rrate) - - # If no gain specified, set to midrange - gain_range = self._src.get_gain_range() - if gain is None: - gain = (gain_range.start()+gain_range.stop())/2.0 - print "Using gain: ", gain - self._src.set_gain(gain) - - self._cal = calibration - self.connect(self._src, self._resamp, self) - - def tune(self, freq): - r = self._src.set_center_freq(freq+self._cal, 0) - - def rate(self): - return self._samp_rate - -class app_top_block(gr.top_block): - def __init__(self, options): - gr.top_block.__init__(self) - self.options = options - - (dev_rate, channel_rate, audio_rate, - channel_pass, channel_stop, demod) = demod_params[options.modulation] - - DEV = uhd_src(options.args, # UHD device address - options.spec, # device subdev spec - options.antenna, # device antenna - dev_rate, # device sample rate - options.gain, # Receiver gain - options.calibration) # Frequency offset - DEV.tune(options.frequency) - - if_rate = DEV.rate() - channel_decim = int(if_rate // channel_rate) - audio_decim = int(channel_rate // audio_rate) - - CHAN_taps = optfir.low_pass(1.0, # Filter gain - if_rate, # Sample rate - channel_pass, # One sided modulation bandwidth - channel_stop, # One sided channel bandwidth - 0.1, # Passband ripple - 60) # Stopband attenuation - - CHAN = gr.freq_xlating_fir_filter_ccf(channel_decim, # Decimation rate - CHAN_taps, # Filter taps - 0.0, # Offset frequency - if_rate) # Sample rate - - RFSQL = gr.pwr_squelch_cc(options.rf_squelch, # Power threshold - 125.0/channel_rate, # Time constant - int(channel_rate/20), # 50ms rise/fall - False) # Zero, not gate output - - AGC = gr.agc_cc(1.0/channel_rate, # Time constant - 1.0, # Reference power - 1.0, # Initial gain - 1.0) # Maximum gain - - DEMOD = demod(channel_rate, audio_decim) - - # From RF to audio - #self.connect(DEV, CHAN, RFSQL, AGC, DEMOD) - self.connect(DEV, CHAN, DEMOD) - - # Optionally add CTCSS and RSAMP if needed - tail = DEMOD - if options.ctcss != None and options.ctcss > 60.0: - CTCSS = gr.ctcss_squelch_ff(audio_rate, # Sample rate - options.ctcss) # Squelch tone - self.connect(DEMOD, CTCSS) - tail = CTCSS - - if options.output_rate != audio_rate: - out_lcm = gru.lcm(audio_rate, options.output_rate) - out_interp = int(out_lcm // audio_rate) - out_decim = int(out_lcm // options.output_rate) - RSAMP = blks2.rational_resampler_fff(out_interp, out_decim) - self.connect(tail, RSAMP) - tail = RSAMP - - # Send to audio output device - AUDIO = audio.sink(int(options.output_rate), - options.audio_output) - self.connect(tail, AUDIO) - - # Direct asynchronous notifications to callback function - if self.options.show_async_msg: - self.async_msgq = gr.msg_queue(0) - self.async_src = uhd.amsg_source("", self.async_msgq) - self.async_rcv = gru.msgq_runner(self.async_msgq, self.async_callback) - - def async_callback(self, msg): - md = self.async_src.msg_to_async_metadata_t(msg) - print "Channel: %i Time: %f Event: %i" % (md.channel, md.time_spec.get_real_secs(), md.event_code) - - -def main(): - parser = OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args , [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate [default=%default]") - parser.add_option("-f", "--frequency", type="eng_float", - default=None, metavar="Hz", - help="set receive frequency to Hz [default=%default]") - parser.add_option("-c", "--calibration", type="eng_float", - default=0.0, metavar="Hz", - help="set frequency offset to Hz [default=%default]") - parser.add_option("-g", "--gain", type="eng_float", - metavar="dB", default=None, - help="set RF gain [default is midpoint]") - parser.add_option("-m", "--modulation", type="choice", choices=('AM','FM','WFM'), - metavar="TYPE", default=None, - help="set modulation type (AM,FM,WFM) [default=%default]") - parser.add_option("-o", "--output-rate", type="eng_float", - default=32000, metavar="RATE", - help="set audio output rate to RATE [default=%default]") - parser.add_option("-r", "--rf-squelch", type="eng_float", - default=-50.0, metavar="dB", - help="set RF squelch to dB [default=%default]") - parser.add_option("-p", "--ctcss", type="float", - default=None, metavar="FREQ", - help="set CTCSS squelch to FREQ [default=%default]") - parser.add_option("-O", "--audio-output", type="string", default="default", - help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") - parser.add_option("", "--show-async-msg", action="store_true", default=False, - help="Show asynchronous message notifications from UHD [default=%default]") - (options, args) = parser.parse_args() - - if options.frequency is None: - sys.stderr.write("Must supply receive frequency with -f.\n") - sys.exit(1) - - if options.modulation is None: - sys.stderr.write("Must supply a modulation type (AM, FM, WFM).\n") - sys.exit(1) - - tb = app_top_block(options) - try: - tb.run() - except KeyboardInterrupt: - pass - -if __name__ == "__main__": - main() diff --git a/gr-uhd/apps/uhd_siggen b/gr-uhd/apps/uhd_siggen deleted file mode 100755 index 52fc24922..000000000 --- a/gr-uhd/apps/uhd_siggen +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008,2009,2011,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. -# - -from gnuradio import gr -from gnuradio.uhd import uhd_siggen_base as uhd_siggen -import sys - -def main(): - if gr.enable_realtime_scheduling() != gr.RT_OK: - print "Note: failed to enable realtime scheduling, continuing" - - # Grab command line options and create top block - try: - (options, args) = uhd_siggen.get_options() - tb = uhd_siggen.top_block(options, args) - - except RuntimeError, e: - print e - sys.exit(1) - - tb.start() - raw_input('Press Enter to quit: ') - tb.stop() - tb.wait() - -# Make sure to create the top block (tb) within a function: -# That code in main will allow tb to go out of scope on return, -# which will call the decontructor on usrp and stop transmit. -# Whats odd is that grc works fine with tb in the __main__, -# perhaps its because the try/except clauses around tb. -if __name__ == "__main__": - main() diff --git a/gr-uhd/apps/uhd_siggen_base.py b/gr-uhd/apps/uhd_siggen_base.py deleted file mode 100644 index 8c69da1cc..000000000 --- a/gr-uhd/apps/uhd_siggen_base.py +++ /dev/null @@ -1,395 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008,2009,2011,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. -# - -DESC_KEY = 'desc' -SAMP_RATE_KEY = 'samp_rate' -LINK_RATE_KEY = 'link_rate' -GAIN_KEY = 'gain' -TX_FREQ_KEY = 'tx_freq' -DSP_FREQ_KEY = 'dsp_freq' -RF_FREQ_KEY = 'rf_freq' -AMPLITUDE_KEY = 'amplitude' -AMPL_RANGE_KEY = 'ampl_range' -WAVEFORM_FREQ_KEY = 'waveform_freq' -WAVEFORM_OFFSET_KEY = 'waveform_offset' -WAVEFORM2_FREQ_KEY = 'waveform2_freq' -FREQ_RANGE_KEY = 'freq_range' -GAIN_RANGE_KEY = 'gain_range' -TYPE_KEY = 'type' - -def setter(ps, key, val): ps[key] = val - -from gnuradio import gr, gru, uhd, eng_notation -from gnuradio.gr.pubsub import pubsub -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys -import math - -n2s = eng_notation.num_to_str - -waveforms = { gr.GR_SIN_WAVE : "Complex Sinusoid", - gr.GR_CONST_WAVE : "Constant", - gr.GR_GAUSSIAN : "Gaussian Noise", - gr.GR_UNIFORM : "Uniform Noise", - "2tone" : "Two Tone", - "sweep" : "Sweep" } - -# -# GUI-unaware GNU Radio flowgraph. This may be used either with command -# line applications or GUI applications. -# -class top_block(gr.top_block, pubsub): - def __init__(self, options, args): - gr.top_block.__init__(self) - pubsub.__init__(self) - self._verbose = options.verbose - - #initialize values from options - self._setup_usrpx(options) - self[SAMP_RATE_KEY] = options.samp_rate - self[TX_FREQ_KEY] = options.tx_freq - self[AMPLITUDE_KEY] = options.amplitude - self[WAVEFORM_FREQ_KEY] = options.waveform_freq - self[WAVEFORM_OFFSET_KEY] = options.offset - self[WAVEFORM2_FREQ_KEY] = options.waveform2_freq - self[DSP_FREQ_KEY] = 0 - self[RF_FREQ_KEY] = 0 - - #subscribe set methods - self.subscribe(SAMP_RATE_KEY, self.set_samp_rate) - self.subscribe(GAIN_KEY, self.set_gain) - self.subscribe(TX_FREQ_KEY, self.set_freq) - self.subscribe(AMPLITUDE_KEY, self.set_amplitude) - self.subscribe(WAVEFORM_FREQ_KEY, self.set_waveform_freq) - self.subscribe(WAVEFORM2_FREQ_KEY, self.set_waveform2_freq) - self.subscribe(TYPE_KEY, self.set_waveform) - - #force update on pubsub keys - for key in (SAMP_RATE_KEY, GAIN_KEY, TX_FREQ_KEY, - AMPLITUDE_KEY, WAVEFORM_FREQ_KEY, - WAVEFORM_OFFSET_KEY, WAVEFORM2_FREQ_KEY): - self[key] = self[key] - self[TYPE_KEY] = options.type #set type last - - def _setup_usrpx(self, options): - self._u = uhd.usrp_sink(device_addr=options.args, stream_args=uhd.stream_args('fc32')) - self._u.set_samp_rate(options.samp_rate) - - # Set the subdevice spec - if(options.spec): - self._u.set_subdev_spec(options.spec, 0) - - # Set the gain on the usrp from options - if(options.gain): - self._u.set_gain(options.gain) - - # Set the antenna - if(options.antenna): - self._u.set_antenna(options.antenna, 0) - - # Setup USRP Configuration value - try: - usrp_info = self._u.get_usrp_info() - mboard_id = usrp_info.get("mboard_id") - mboard_serial = usrp_info.get("mboard_serial") - if mboard_serial == "": - mboard_serial = "no serial" - dboard_subdev_name = usrp_info.get("tx_subdev_name") - dboard_serial = usrp_info.get("tx_serial") - if dboard_serial == "": - dboard_serial = "no serial" - subdev = self._u.get_subdev_spec() - antenna = self._u.get_antenna() - - desc_key_str = "Motherboard: %s [%s]\n" % (mboard_id, mboard_serial) - desc_key_str += "Daughterboard: %s [%s]\n" % (dboard_subdev_name, dboard_serial) - desc_key_str += "Subdev: %s\n" % subdev - desc_key_str += "Antenna: %s" % antenna - except: - desc_key_str = "USRP configuration output not implemented in this version" - - self.publish(DESC_KEY, lambda: desc_key_str) - self.publish(FREQ_RANGE_KEY, self._u.get_freq_range) - self.publish(GAIN_RANGE_KEY, self._u.get_gain_range) - self.publish(GAIN_KEY, self._u.get_gain) - - print "UHD Signal Generator" - print "Version: %s" % uhd.get_version_string() - print "\nUsing USRP configuration:" - print desc_key_str + "\n" - - # Direct asynchronous notifications to callback function - if options.show_async_msg: - self.async_msgq = gr.msg_queue(0) - self.async_src = uhd.amsg_source("", self.async_msgq) - self.async_rcv = gru.msgq_runner(self.async_msgq, self.async_callback) - - def async_callback(self, msg): - md = self.async_src.msg_to_async_metadata_t(msg) - print "Channel: %i Time: %f Event: %i" % (md.channel, md.time_spec.get_real_secs(), md.event_code) - - def _set_tx_amplitude(self, ampl): - """ - Sets the transmit amplitude sent to the USRP - @param ampl the amplitude or None for automatic - """ - ampl_range = self[AMPL_RANGE_KEY] - if ampl is None: - ampl = (ampl_range[1] - ampl_range[0])*0.15 + ampl_range[0] - self[AMPLITUDE_KEY] = max(ampl_range[0], min(ampl, ampl_range[1])) - - def set_samp_rate(self, sr): - self._u.set_samp_rate(sr) - sr = self._u.get_samp_rate() - - if self[TYPE_KEY] in (gr.GR_SIN_WAVE, gr.GR_CONST_WAVE): - self._src.set_sampling_freq(self[SAMP_RATE_KEY]) - elif self[TYPE_KEY] == "2tone": - self._src1.set_sampling_freq(self[SAMP_RATE_KEY]) - self._src2.set_sampling_freq(self[SAMP_RATE_KEY]) - elif self[TYPE_KEY] == "sweep": - self._src1.set_sampling_freq(self[SAMP_RATE_KEY]) - self._src2.set_sampling_freq(self[WAVEFORM_FREQ_KEY]*2*math.pi/self[SAMP_RATE_KEY]) - else: - return True # Waveform not yet set - - if self._verbose: - print "Set sample rate to:", sr - - return True - - def set_gain(self, gain): - if gain is None: - g = self[GAIN_RANGE_KEY] - gain = float(g.start()+g.stop())/2 - if self._verbose: - print "Using auto-calculated mid-point TX gain" - self[GAIN_KEY] = gain - return - self._u.set_gain(gain) - if self._verbose: - print "Set TX gain to:", gain - - def set_freq(self, target_freq): - - if target_freq is None: - f = self[FREQ_RANGE_KEY] - target_freq = float(f.start()+f.stop())/2.0 - if self._verbose: - print "Using auto-calculated mid-point frequency" - self[TX_FREQ_KEY] = target_freq - return - - tr = self._u.set_center_freq(target_freq) - fs = "%sHz" % (n2s(target_freq),) - if tr is not None: - self._freq = target_freq - self[DSP_FREQ_KEY] = tr.actual_dsp_freq - self[RF_FREQ_KEY] = tr.actual_rf_freq - if self._verbose: - print "Set center frequency to", self._u.get_center_freq() - print "Tx RF frequency: %sHz" % (n2s(tr.actual_rf_freq),) - print "Tx DSP frequency: %sHz" % (n2s(tr.actual_dsp_freq),) - elif self._verbose: - print "Failed to set freq." - return tr - - def set_waveform_freq(self, freq): - if self[TYPE_KEY] == gr.GR_SIN_WAVE: - self._src.set_frequency(freq) - elif self[TYPE_KEY] == "2tone": - self._src1.set_frequency(freq) - elif self[TYPE_KEY] == 'sweep': - #there is no set sensitivity, redo fg - self[TYPE_KEY] = self[TYPE_KEY] - return True - - def set_waveform2_freq(self, freq): - if freq is None: - self[WAVEFORM2_FREQ_KEY] = -self[WAVEFORM_FREQ_KEY] - return - if self[TYPE_KEY] == "2tone": - self._src2.set_frequency(freq) - elif self[TYPE_KEY] == "sweep": - self._src1.set_frequency(freq) - return True - - def set_waveform(self, type): - self.lock() - self.disconnect_all() - if type == gr.GR_SIN_WAVE or type == gr.GR_CONST_WAVE: - self._src = gr.sig_source_c(self[SAMP_RATE_KEY], # Sample rate - type, # Waveform type - self[WAVEFORM_FREQ_KEY], # Waveform frequency - self[AMPLITUDE_KEY], # Waveform amplitude - self[WAVEFORM_OFFSET_KEY]) # Waveform offset - elif type == gr.GR_GAUSSIAN or type == gr.GR_UNIFORM: - self._src = gr.noise_source_c(type, self[AMPLITUDE_KEY]) - elif type == "2tone": - self._src1 = gr.sig_source_c(self[SAMP_RATE_KEY], - gr.GR_SIN_WAVE, - self[WAVEFORM_FREQ_KEY], - self[AMPLITUDE_KEY]/2.0, - 0) - if(self[WAVEFORM2_FREQ_KEY] is None): - self[WAVEFORM2_FREQ_KEY] = -self[WAVEFORM_FREQ_KEY] - - self._src2 = gr.sig_source_c(self[SAMP_RATE_KEY], - gr.GR_SIN_WAVE, - self[WAVEFORM2_FREQ_KEY], - self[AMPLITUDE_KEY]/2.0, - 0) - self._src = gr.add_cc() - self.connect(self._src1,(self._src,0)) - self.connect(self._src2,(self._src,1)) - elif type == "sweep": - # rf freq is center frequency - # waveform_freq is total swept width - # waveform2_freq is sweep rate - # will sweep from (rf_freq-waveform_freq/2) to (rf_freq+waveform_freq/2) - if self[WAVEFORM2_FREQ_KEY] is None: - self[WAVEFORM2_FREQ_KEY] = 0.1 - - self._src1 = gr.sig_source_f(self[SAMP_RATE_KEY], - gr.GR_TRI_WAVE, - self[WAVEFORM2_FREQ_KEY], - 1.0, - -0.5) - self._src2 = gr.frequency_modulator_fc(self[WAVEFORM_FREQ_KEY]*2*math.pi/self[SAMP_RATE_KEY]) - self._src = gr.multiply_const_cc(self[AMPLITUDE_KEY]) - self.connect(self._src1,self._src2,self._src) - else: - raise RuntimeError("Unknown waveform type") - - self.connect(self._src, self._u) - self.unlock() - - if self._verbose: - print "Set baseband modulation to:", waveforms[type] - if type == gr.GR_SIN_WAVE: - print "Modulation frequency: %sHz" % (n2s(self[WAVEFORM_FREQ_KEY]),) - print "Initial phase:", self[WAVEFORM_OFFSET_KEY] - elif type == "2tone": - print "Tone 1: %sHz" % (n2s(self[WAVEFORM_FREQ_KEY]),) - print "Tone 2: %sHz" % (n2s(self[WAVEFORM2_FREQ_KEY]),) - elif type == "sweep": - print "Sweeping across %sHz to %sHz" % (n2s(-self[WAVEFORM_FREQ_KEY]/2.0),n2s(self[WAVEFORM_FREQ_KEY]/2.0)) - print "Sweep rate: %sHz" % (n2s(self[WAVEFORM2_FREQ_KEY]),) - print "TX amplitude:", self[AMPLITUDE_KEY] - - - def set_amplitude(self, amplitude): - if amplitude < 0.0 or amplitude > 1.0: - if self._verbose: - print "Amplitude out of range:", amplitude - return False - - if self[TYPE_KEY] in (gr.GR_SIN_WAVE, gr.GR_CONST_WAVE, gr.GR_GAUSSIAN, gr.GR_UNIFORM): - self._src.set_amplitude(amplitude) - elif self[TYPE_KEY] == "2tone": - self._src1.set_amplitude(amplitude/2.0) - self._src2.set_amplitude(amplitude/2.0) - elif self[TYPE_KEY] == "sweep": - self._src.set_k(amplitude) - else: - return True # Waveform not yet set - - if self._verbose: - print "Set amplitude to:", amplitude - return True - -def get_options(): - usage="%prog: [options]" - - parser = OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args , [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6, - help="set sample rate (bandwidth) [default=%default]") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-f", "--tx-freq", type="eng_float", default=None, - help="Set carrier frequency to FREQ [default=mid-point]", - metavar="FREQ") - parser.add_option("-x", "--waveform-freq", type="eng_float", default=0, - help="Set baseband waveform frequency to FREQ [default=%default]") - parser.add_option("-y", "--waveform2-freq", type="eng_float", default=None, - help="Set 2nd waveform frequency to FREQ [default=%default]") - parser.add_option("--sine", dest="type", action="store_const", const=gr.GR_SIN_WAVE, - help="Generate a carrier modulated by a complex sine wave", - default=gr.GR_SIN_WAVE) - parser.add_option("--const", dest="type", action="store_const", const=gr.GR_CONST_WAVE, - help="Generate a constant carrier") - parser.add_option("--offset", type="eng_float", default=0, - help="Set waveform phase offset to OFFSET [default=%default]") - parser.add_option("--gaussian", dest="type", action="store_const", const=gr.GR_GAUSSIAN, - help="Generate Gaussian random output") - parser.add_option("--uniform", dest="type", action="store_const", const=gr.GR_UNIFORM, - help="Generate Uniform random output") - parser.add_option("--2tone", dest="type", action="store_const", const="2tone", - help="Generate Two Tone signal for IMD testing") - parser.add_option("--sweep", dest="type", action="store_const", const="sweep", - help="Generate a swept sine wave") - parser.add_option("", "--amplitude", type="eng_float", default=0.15, - help="Set output amplitude to AMPL (0.0-1.0) [default=%default]", - metavar="AMPL") - parser.add_option("-v", "--verbose", action="store_true", default=False, - help="Use verbose console output [default=%default]") - parser.add_option("", "--show-async-msg", action="store_true", default=False, - help="Show asynchronous message notifications from UHD [default=%default]") - - (options, args) = parser.parse_args() - - return (options, args) - -# If this script is executed, the following runs. If it is imported, -# the below does not run. -def test_main(): - if gr.enable_realtime_scheduling() != gr.RT_OK: - print "Note: failed to enable realtime scheduling, continuing" - - # Grab command line options and create top block - try: - (options, args) = get_options() - tb = top_block(options, args) - - except RuntimeError, e: - print e - sys.exit(1) - - tb.start() - raw_input('Press Enter to quit: ') - tb.stop() - tb.wait() - -# Make sure to create the top block (tb) within a function: -# That code in main will allow tb to go out of scope on return, -# which will call the decontructor on usrp and stop transmit. -# Whats odd is that grc works fine with tb in the __main__, -# perhaps its because the try/except clauses around tb. -if __name__ == "__main__": - test_main() diff --git a/gr-uhd/apps/uhd_siggen_gui b/gr-uhd/apps/uhd_siggen_gui deleted file mode 100755 index 70929b182..000000000 --- a/gr-uhd/apps/uhd_siggen_gui +++ /dev/null @@ -1,318 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009,2011,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. -# - -import wx -from gnuradio import gr, uhd -from gnuradio.gr.pubsub import pubsub -from gnuradio.wxgui import gui, forms -from gnuradio.uhd import uhd_siggen_base as uhd_siggen -import sys, math - -class app_gui(pubsub): - def __init__(self, frame, panel, vbox, top_block, options, args): - pubsub.__init__(self) - self.frame = frame # Use for top-level application window frame - self.panel = panel # Use as parent class for created windows - self.vbox = vbox # Use as sizer for created windows - self.tb = top_block # GUI-unaware flowgraph class - self.options = options # Supplied command-line options - self.args = args # Supplied command-line arguments - self.build_gui() - - # Event response handlers - def evt_set_status_msg(self, msg): - self.frame.SetStatusText(msg, 0) - - # GUI construction - def build_gui(self): - self.vbox.AddSpacer(5) - self.vbox.AddStretchSpacer() - ################################################## - # Baseband controls - ################################################## - bb_vbox = forms.static_box_sizer(parent=self.panel, label="Baseband Modulation", orient=wx.VERTICAL, bold=True) - self.vbox.Add(bb_vbox, 0, wx.EXPAND) - sine_bb_hbox = wx.BoxSizer(wx.HORIZONTAL) - sweep_bb_hbox = wx.BoxSizer(wx.HORIZONTAL) - tone_bb_hbox = wx.BoxSizer(wx.HORIZONTAL) - self.vbox.AddSpacer(10) - self.vbox.AddStretchSpacer() - #callback to show/hide forms - def set_type(type): - sine_bb_hbox.ShowItems(type == gr.GR_SIN_WAVE) - sweep_bb_hbox.ShowItems(type == 'sweep') - tone_bb_hbox.ShowItems(type == '2tone') - self.vbox.Layout() - self.tb.subscribe(uhd_siggen.TYPE_KEY, set_type) - #create sine forms - sine_bb_hbox.AddSpacer(10) - forms.text_box( - parent=self.panel, sizer=sine_bb_hbox, - label='Frequency (Hz)', - ps=self.tb, - key=uhd_siggen.WAVEFORM_FREQ_KEY, - converter=forms.float_converter(), - ) - sine_bb_hbox.AddStretchSpacer() - #create sweep forms - sweep_bb_hbox.AddSpacer(10) - forms.text_box( - parent=self.panel, sizer=sweep_bb_hbox, - label='Sweep Width (Hz)', - ps=self.tb, - key=uhd_siggen.WAVEFORM_FREQ_KEY, - converter=forms.float_converter(), - ) - sweep_bb_hbox.AddStretchSpacer() - forms.text_box( - parent=self.panel, sizer=sweep_bb_hbox, - label='Sweep Rate (Hz)', - ps=self.tb, - key=uhd_siggen.WAVEFORM2_FREQ_KEY, - converter=forms.float_converter(), - ) - sweep_bb_hbox.AddStretchSpacer() - #create 2tone forms - tone_bb_hbox.AddSpacer(10) - forms.text_box( - parent=self.panel, sizer=tone_bb_hbox, - label='Tone 1 (Hz)', - ps=self.tb, - key=uhd_siggen.WAVEFORM_FREQ_KEY, - converter=forms.float_converter(), - ) - tone_bb_hbox.AddStretchSpacer() - forms.text_box( - parent=self.panel, sizer=tone_bb_hbox, - label='Tone 2 (Hz)', - ps=self.tb, - key=uhd_siggen.WAVEFORM2_FREQ_KEY, - converter=forms.float_converter(), - ) - tone_bb_hbox.AddStretchSpacer() - forms.radio_buttons( - parent=self.panel, sizer=bb_vbox, - choices=uhd_siggen.waveforms.keys(), - labels=uhd_siggen.waveforms.values(), - ps=self.tb, - key=uhd_siggen.TYPE_KEY, - style=wx.NO_BORDER | wx.RA_HORIZONTAL, - ) - bb_vbox.AddSpacer(10) - bb_vbox.Add(sine_bb_hbox, 0, wx.EXPAND) - bb_vbox.Add(sweep_bb_hbox, 0, wx.EXPAND) - bb_vbox.Add(tone_bb_hbox, 0, wx.EXPAND) - set_type(self.tb[uhd_siggen.TYPE_KEY]) - - ################################################## - # Frequency controls - ################################################## - fc_vbox = forms.static_box_sizer(parent=self.panel, - label="Center Frequency", - orient=wx.VERTICAL, - bold=True) - fc_vbox.AddSpacer(5) - # First row of frequency controls (center frequency) - freq_hbox = wx.BoxSizer(wx.HORIZONTAL) - fc_vbox.Add(freq_hbox, 0, wx.EXPAND) - fc_vbox.AddSpacer(10) - # Second row of frequency controls (results) - tr_hbox = wx.BoxSizer(wx.HORIZONTAL) - fc_vbox.Add(tr_hbox, 0, wx.EXPAND) - fc_vbox.AddSpacer(5) - # Add frequency controls to top window sizer - self.vbox.Add(fc_vbox, 0, wx.EXPAND) - self.vbox.AddSpacer(10) - self.vbox.AddStretchSpacer() - freq_hbox.AddSpacer(5) - forms.text_box( - parent=self.panel, sizer=freq_hbox, - proportion=1, - converter=forms.float_converter(), - ps=self.tb, - key=uhd_siggen.TX_FREQ_KEY, - ) - freq_hbox.AddSpacer(10) - - forms.slider( - parent=self.panel, sizer=freq_hbox, - proportion=2, - ps=self.tb, - key=uhd_siggen.TX_FREQ_KEY, - minimum=self.tb[uhd_siggen.FREQ_RANGE_KEY].start(), - maximum=self.tb[uhd_siggen.FREQ_RANGE_KEY].stop(), - num_steps=100, - ) - freq_hbox.AddSpacer(5) - tr_hbox.AddSpacer(5) - forms.static_text( - parent=self.panel, sizer=tr_hbox, - label='RF Frequency', - ps=self.tb, - key=uhd_siggen.RF_FREQ_KEY, - converter=forms.float_converter(), - proportion=1, - ) - tr_hbox.AddSpacer(10) - forms.static_text( - parent=self.panel, sizer=tr_hbox, - label='DSP Frequency', - ps=self.tb, - key=uhd_siggen.DSP_FREQ_KEY, - converter=forms.float_converter(), - proportion=1, - ) - tr_hbox.AddSpacer(5) - - ################################################## - # Amplitude controls - ################################################## - amp_hbox = forms.static_box_sizer(parent=self.panel, - label="Amplitude", - orient=wx.VERTICAL, - bold=True) - amp_hbox.AddSpacer(5) - # First row of amp controls (ampl) - lvl_hbox = wx.BoxSizer(wx.HORIZONTAL) - amp_hbox.Add(lvl_hbox, 0, wx.EXPAND) - amp_hbox.AddSpacer(10) - # Second row of amp controls (tx gain) - gain_hbox = wx.BoxSizer(wx.HORIZONTAL) - amp_hbox.Add(gain_hbox, 0, wx.EXPAND) - amp_hbox.AddSpacer(5) - self.vbox.Add(amp_hbox, 0, wx.EXPAND) - self.vbox.AddSpacer(10) - self.vbox.AddStretchSpacer() - lvl_hbox.AddSpacer(5) - forms.text_box( - parent=self.panel, sizer=lvl_hbox, - proportion=1, - converter=forms.float_converter(), - ps=self.tb, - key=uhd_siggen.AMPLITUDE_KEY, - label="Level (0.0-1.0)", - ) - lvl_hbox.AddSpacer(10) - forms.log_slider( - parent=self.panel, sizer=lvl_hbox, - proportion=2, - ps=self.tb, - key=uhd_siggen.AMPLITUDE_KEY, - min_exp=-6, - max_exp=0, - base=10, - num_steps=100, - ) - lvl_hbox.AddSpacer(5) - if self.tb[uhd_siggen.GAIN_RANGE_KEY].start() < self.tb[uhd_siggen.GAIN_RANGE_KEY].stop(): - gain_hbox.AddSpacer(5) - forms.text_box( - parent=self.panel, sizer=gain_hbox, - proportion=1, - converter=forms.float_converter(), - ps=self.tb, - key=uhd_siggen.GAIN_KEY, - label="TX Gain (dB)", - ) - gain_hbox.AddSpacer(10) - forms.slider( - parent=self.panel, sizer=gain_hbox, - proportion=2, - ps=self.tb, - key=uhd_siggen.GAIN_KEY, - minimum=self.tb[uhd_siggen.GAIN_RANGE_KEY].start(), - maximum=self.tb[uhd_siggen.GAIN_RANGE_KEY].stop(), - step_size=self.tb[uhd_siggen.GAIN_RANGE_KEY].step(), - ) - gain_hbox.AddSpacer(5) - - ################################################## - # Sample Rate controls - ################################################## - sam_hbox = forms.static_box_sizer(parent=self.panel, - label="Sample Rate", - orient=wx.HORIZONTAL, - bold=True) - self.vbox.Add(sam_hbox, 0, wx.EXPAND) - self.vbox.AddSpacer(10) - self.vbox.AddStretchSpacer() - sam_hbox.AddStretchSpacer(20) - forms.static_text( - parent=self.panel, sizer=sam_hbox, - label='Sample Rate (sps)', - ps=self.tb, - key=uhd_siggen.SAMP_RATE_KEY, - converter=forms.float_converter(), - ) - sam_hbox.AddStretchSpacer(20) - - ################################################## - # UHD status - ################################################## - u2_hbox = forms.static_box_sizer(parent=self.panel, - label="UHD (%s)" % (uhd.get_version_string()), - orient=wx.HORIZONTAL, - bold=True) - self.vbox.Add(u2_hbox, 0, wx.EXPAND) - self.vbox.AddSpacer(10) - self.vbox.AddStretchSpacer() - u2_hbox.AddSpacer(10) - forms.static_text( - parent=self.panel, sizer=u2_hbox, - ps=self.tb, - key=uhd_siggen.DESC_KEY, - converter=forms.str_converter(), - ) - self.vbox.AddSpacer(5) - self.vbox.AddStretchSpacer() - -def main(): - try: - # Get command line parameters - (options, args) = uhd_siggen.get_options() - - # Create the top block using these - tb = uhd_siggen.top_block(options, args) - - # Create the GUI application - app = gui.app(top_block=tb, # Constructed top block - gui=app_gui, # User interface class - options=options, # Command line options - args=args, # Command line args - title="UHD Signal Generator", # Top window title - nstatus=1, # Number of status lines - start=True, # Whether to start flowgraph - realtime=True) # Whether to set realtime priority - - # And run it - app.MainLoop() - - except RuntimeError, e: - print e - sys.exit(1) - -# Make sure to create the top block (tb) within a function: That code -# in main will allow tb to go out of scope on return, which will call -# the decontructor on uhd device and stop transmit. Whats odd is that -# grc works fine with tb in the __main__, perhaps its because the -# try/except clauses around tb. -if __name__ == "__main__": main() diff --git a/gr-uhd/doc/CMakeLists.txt b/gr-uhd/doc/CMakeLists.txt deleted file mode 100644 index b78c50a02..000000000 --- a/gr-uhd/doc/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2011 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. - -install( - FILES README.uhd - DESTINATION ${GR_PKG_DOC_DIR} -) diff --git a/gr-uhd/doc/README.uhd b/gr-uhd/doc/README.uhd deleted file mode 100644 index b0720d6d0..000000000 --- a/gr-uhd/doc/README.uhd +++ /dev/null @@ -1,14 +0,0 @@ -This is the GNU Radio UHD package. It is the interface to the UHD -library to connect to and send and receive data between the Ettus -Research, LLC product line. To use the UHD blocks, the Python -namespaces is in gnuradio.uhd, which would be normally imported -as: - - from gnuradio import uhd - -See the Doxygen documentation for details about the blocks available -in this package. A quick listing of the details can be found in Python -after importing by using: - - help(uhd) - diff --git a/gr-uhd/doc/uhd.dox b/gr-uhd/doc/uhd.dox deleted file mode 100644 index f03705fe1..000000000 --- a/gr-uhd/doc/uhd.dox +++ /dev/null @@ -1,101 +0,0 @@ -/*! \page page_uhd UHD Interface - -\section Introduction -This is the GNU Radio UHD package. It is the interface to the UHD -library to connect to and send and receive data between the Ettus -Research, LLC product line. To use the UHD blocks, the Python -namespaces is in gnuradio.uhd, which would be normally imported -as: - -\code - from gnuradio import uhd -\endcode - -The relevant blocks are listed in the \ref uhd_blk group. - -A quick listing of the details can be found in Python after importing -by using: - -\code - help(uhd) -\endcode - - -\section External Documentation - -Ettus Research keeps the comprehensive documentation to the underlying UHD driver, which can be found: - - http://files.ettus.com/uhd_docs/manual/html/ - -The UHD Doxygen page is located: - - http://files.ettus.com/uhd_docs/doxygen/html/index.html - - -\section Typical Setup - -A typical option parser setup for a UHD device looks like - -\code - parser = OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args , [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6, - help="set sample rate (bandwidth) [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") -\endcode - -To use these options to create a UHD source object: - -\code - self.u = uhd.usrp_source(device_addr=options.args, - io_type=uhd.io_type.COMPLEX_FLOAT32, - num_channels=1) - - self.u.set_samp_rate(options.samp_rate) - - # if no gain was specified, use the mid-point in dB - if options.gain is None: - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2 - self.u.set_gain(options.gain, 0) - - # Set the center frequency - self.u.set_center_freq(options.freq, 0) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) -\endcode - -Frequently, your application may need a sample rate that is not -supported by the UHD device. If you have extra CPU power to spare, you -can easily set the sample rate you want, then ask the device what the -actual sample rate set was. Then, you can easily create an arbitrary -resampler to take care of the difference. - -\code - self.u.set_samp_rate(options.samp_rate) - - desired_rate = options.samp_rate - actual_rate = self.u.get_samp_rate() - resample = desired_rate / actual_rate - - # Use the blks2 version and pass only the resample factor. - # This block builds a half-band filter for you - - self.resampler = blks2.pfb_arb_resampler_ccf(resample) -\endcode - -*/ diff --git a/gr-uhd/examples/c++/CMakeLists.txt b/gr-uhd/examples/c++/CMakeLists.txt deleted file mode 100644 index a6c9891d7..000000000 --- a/gr-uhd/examples/c++/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${GR_UHD_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${UHD_INCLUDE_DIRS} -) - -link_directories(${UHD_LIBRARY_DIRS}) -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# Build executable -######################################################################## -add_executable(tags_demo tags_demo.cc) -target_link_libraries(tags_demo gnuradio-uhd) - -INSTALL(TARGETS - tags_demo - DESTINATION ${GR_PKG_UHD_EXAMPLES_DIR} - COMPONENT "uhd_examples" -) diff --git a/gr-uhd/examples/c++/tag_sink_demo.h b/gr-uhd/examples/c++/tag_sink_demo.h deleted file mode 100644 index 5417bd324..000000000 --- a/gr-uhd/examples/c++/tag_sink_demo.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2011 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. - */ - -#include <gr_sync_block.h> -#include <gr_io_signature.h> -#include <boost/foreach.hpp> -#include <boost/format.hpp> -#include <iostream> -#include <complex> - -class tag_sink_demo : public gr_sync_block{ -public: - - tag_sink_demo(void): - gr_sync_block( - "uhd tag sink demo", - gr_make_io_signature(1, 1, sizeof(std::complex<float>)), - gr_make_io_signature(0, 0, 0) - ) - { - //NOP - } - - int work( - int ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ - //grab all "rx time" tags in this work call - const uint64_t samp0_count = this->nitems_read(0); - std::vector<gr_tag_t> rx_time_tags; - get_tags_in_range(rx_time_tags, 0, samp0_count, samp0_count + ninput_items, pmt::pmt_string_to_symbol("rx_time")); - - //print all tags - BOOST_FOREACH(const gr_tag_t &rx_time_tag, rx_time_tags){ - const uint64_t offset = rx_time_tag.offset; - const pmt::pmt_t &value = rx_time_tag.value; - - std::cout << boost::format("Full seconds %u, Frac seconds %f, abs sample offset %u") - % pmt::pmt_to_uint64(pmt::pmt_tuple_ref(value, 0)) - % pmt::pmt_to_double(pmt::pmt_tuple_ref(value, 1)) - % offset - << std::endl; - } - - return ninput_items; - } -}; diff --git a/gr-uhd/examples/c++/tag_source_demo.h b/gr-uhd/examples/c++/tag_source_demo.h deleted file mode 100644 index 7d48502b2..000000000 --- a/gr-uhd/examples/c++/tag_source_demo.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2011 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. - */ - -#include <gr_sync_block.h> -#include <gr_io_signature.h> -#include <boost/foreach.hpp> -#include <boost/format.hpp> -#include <iostream> -#include <complex> - -class tag_source_demo : public gr_sync_block{ -public: - - tag_source_demo( - const uint64_t start_secs, - const double start_fracs, - const double samp_rate, - const double idle_duration, - const double burst_duration - ): - gr_sync_block( - "uhd tag source demo", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(std::complex<float>)) - ), - _time_secs(start_secs), - _time_fracs(start_fracs), - _samp_rate(samp_rate), - _samps_per_burst(samp_rate*burst_duration), - _cycle_duration(idle_duration + burst_duration), - _samps_left_in_burst(1), //immediate EOB - _do_new_burst(false) - { - //NOP - } - - void make_time_tag(const uint64_t tag_count){; - const pmt::pmt_t key = pmt::pmt_string_to_symbol("tx_time"); - const pmt::pmt_t value = pmt::pmt_make_tuple( - pmt::pmt_from_uint64(_time_secs), - pmt::pmt_from_double(_time_fracs) - ); - const pmt::pmt_t srcid = pmt::pmt_string_to_symbol(this->name()); - this->add_item_tag(0/*chan0*/, tag_count, key, value, srcid); - } - - void make_sob_tag(const uint64_t tag_count){ - const pmt::pmt_t key = pmt::pmt_string_to_symbol("tx_sob"); - const pmt::pmt_t value = pmt::PMT_T; - const pmt::pmt_t srcid = pmt::pmt_string_to_symbol(this->name()); - this->add_item_tag(0/*chan0*/, tag_count, key, value, srcid); - } - - void make_eob_tag(const uint64_t tag_count){; - const pmt::pmt_t key = pmt::pmt_string_to_symbol("tx_eob"); - const pmt::pmt_t value = pmt::PMT_T; - const pmt::pmt_t srcid = pmt::pmt_string_to_symbol(this->name()); - this->add_item_tag(0/*chan0*/, tag_count, key, value, srcid); - } - - int work( - int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ - //load the output with a constant - std::complex<float> *output = reinterpret_cast<std::complex<float> *>(output_items[0]); - for (size_t i = 0; i < size_t(noutput_items); i++){ - output[i] = std::complex<float>(0.7, 0.7); - } - - //Handle the start of burst condition. - //Tag a start of burst and timestamp. - //Increment the time for the next burst. - if (_do_new_burst){ - _do_new_burst = false; - _samps_left_in_burst = _samps_per_burst; - - this->make_sob_tag(this->nitems_written(0)); - this->make_time_tag(this->nitems_written(0)); - - _time_fracs += _cycle_duration; - double intpart; //normalize - _time_fracs = std::modf(_time_fracs, &intpart); - _time_secs += uint64_t(intpart); - } - - //Handle the end of burst condition. - //Tag an end of burst and return early. - //the next work call will be a start of burst. - if (_samps_left_in_burst < size_t(noutput_items)){ - this->make_eob_tag(this->nitems_written(0) + _samps_left_in_burst - 1); - _do_new_burst = true; - noutput_items = _samps_left_in_burst; - } - - _samps_left_in_burst -= noutput_items; - return noutput_items; - } - -private: - uint64_t _time_secs; - double _time_fracs; - const double _samp_rate; - const uint64_t _samps_per_burst; - const double _cycle_duration; - uint64_t _samps_left_in_burst; - bool _do_new_burst; - -}; diff --git a/gr-uhd/examples/c++/tags_demo.cc b/gr-uhd/examples/c++/tags_demo.cc deleted file mode 100644 index cc4c93272..000000000 --- a/gr-uhd/examples/c++/tags_demo.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2011 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. - */ - -#include <gr_top_block.h> -#include <gr_uhd_usrp_source.h> -#include <gr_uhd_usrp_sink.h> -#include <tag_source_demo.h> -#include <tag_sink_demo.h> -#include <boost/make_shared.hpp> -#include <boost/thread/thread.hpp> //sleep -#include <boost/program_options.hpp> -#include <csignal> -#include <iostream> - -namespace po = boost::program_options; - -/*********************************************************************** - * Signal handlers - **********************************************************************/ -static bool stop_signal_called = false; -void sig_int_handler(int){stop_signal_called = true;} - -/*********************************************************************** - * Main w/ program options - **********************************************************************/ -int main(int argc, char *argv[]){ - - std::string device_addr; - double center_freq, samp_rate, burst_dur, idle_dur; - - //setup the program options - po::options_description desc("Allowed options"); - desc.add_options() - ("help", "help message") - ("addr", po::value<std::string>(&device_addr)->default_value(""), "the device address in string format") - ("rate", po::value<double>(&samp_rate)->default_value(1e6), "the sample rate in samples per second") - ("freq", po::value<double>(¢er_freq)->default_value(10e6), "the center frequency in Hz") - ("burst", po::value<double>(&burst_dur)->default_value(0.1), "the duration of each burst in seconds") - ("idle", po::value<double>(&idle_dur)->default_value(0.05), "idle time between bursts in seconds") - ; - po::variables_map vm; - po::store(po::parse_command_line(argc, argv, desc), vm); - po::notify(vm); - - //print the help message - if (vm.count("help")){ - std::cout - << boost::format("UHD Tags Demo %s") % desc << std::endl - << "The tags sink demo block will print USRP source time stamps." << std::endl - << "The tags source demo block will send bursts to the USRP sink." << std::endl - << "Look at the USRP output on a scope to see the timed bursts." << std::endl - << std::endl; - return ~0; - } - - //------------------------------------------------------------------ - //-- make a top block - //------------------------------------------------------------------ - gr_top_block_sptr tb = gr_make_top_block("tags_demo"); - - //------------------------------------------------------------------ - //-- make the usrp source test blocks - //------------------------------------------------------------------ - boost::shared_ptr<uhd_usrp_source> usrp_source = uhd_make_usrp_source( - device_addr, uhd::stream_args_t("fc32") - ); - usrp_source->set_samp_rate(samp_rate); - usrp_source->set_center_freq(center_freq); - - boost::shared_ptr<tag_sink_demo> tag_sink = boost::make_shared<tag_sink_demo>(); - - //------------------------------------------------------------------ - //-- connect the usrp source test blocks - //------------------------------------------------------------------ - tb->connect(usrp_source, 0, tag_sink, 0); - - //------------------------------------------------------------------ - //-- make the usrp sink test blocks - //------------------------------------------------------------------ - boost::shared_ptr<uhd_usrp_sink> usrp_sink = uhd_make_usrp_sink( - device_addr, uhd::stream_args_t("fc32") - ); - usrp_sink->set_samp_rate(samp_rate); - usrp_sink->set_center_freq(center_freq); - const uhd::time_spec_t time_now = usrp_sink->get_time_now(); - - boost::shared_ptr<tag_source_demo> tag_source = boost::make_shared<tag_source_demo>( - time_now.get_full_secs() + 1, time_now.get_frac_secs(), //time now + 1 second - samp_rate, idle_dur, burst_dur - ); - - //------------------------------------------------------------------ - //-- connect the usrp sink test blocks - //------------------------------------------------------------------ - tb->connect(tag_source, 0, usrp_sink, 0); - - //------------------------------------------------------------------ - //-- start flow graph execution - //------------------------------------------------------------------ - std::cout << "starting flow graph" << std::endl; - tb->start(); - - //------------------------------------------------------------------ - //-- poll the exit signal while running - //------------------------------------------------------------------ - std::signal(SIGINT, &sig_int_handler); - std::cout << "press ctrl + c to exit" << std::endl; - while (not stop_signal_called){ - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); - } - - //------------------------------------------------------------------ - //-- stop flow graph execution - //------------------------------------------------------------------ - std::cout << "stopping flow graph" << std::endl; - tb->stop(); - tb->wait(); - - std::cout << "done!" << std::endl; - return 0; -} diff --git a/gr-uhd/examples/grc/CMakeLists.txt b/gr-uhd/examples/grc/CMakeLists.txt deleted file mode 100644 index 06c233d45..000000000 --- a/gr-uhd/examples/grc/CMakeLists.txt +++ /dev/null @@ -1,31 +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. - -install( - FILES - uhd_const_wave.grc - uhd_dpsk_mod.grc - uhd_fft.grc - uhd_rx_dpsk.grc - uhd_two_tone_loopback.grc - uhd_tx_dpsk.grc - uhd_wbfm_receive.grc - DESTINATION ${GR_PKG_UHD_EXAMPLES_DIR} - COMPONENT "uhd_python" -) diff --git a/gr-uhd/examples/grc/uhd_const_wave.grc b/gr-uhd/examples/grc/uhd_const_wave.grc deleted file mode 100644 index c64721c83..000000000 --- a/gr-uhd/examples/grc/uhd_const_wave.grc +++ /dev/null @@ -1,1020 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sat Oct 8 10:24:27 2011</timestamp> - <block> - <key>const_source_x</key> - <param> - <key>id</key> - <value>const_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>ampl</value> - </param> - <param> - <key>_coordinate</key> - <value>(102, 193)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>ampl</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Amplitude</value> - </param> - <param> - <key>value</key> - <value>.1</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(174, 313)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>UHD Gain</value> - </param> - <param> - <key>value</key> - <value>gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>20</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(318, 314)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>UHD Freq (Hz)</value> - </param> - <param> - <key>value</key> - <value>freq</value> - </param> - <param> - <key>min</key> - <value>2.4e9</value> - </param> - <param> - <key>max</key> - <value>2.5e9</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(24, 315)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>options</key> - <param> - <key>id</key> - <value>uhd_const_wave</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>UHD Constant Wave</value> - </param> - <param> - <key>author</key> - <value>Example</value> - </param> - <param> - <key>description</key> - <value>Tune UHD Device</value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>address</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>IP Address</value> - </param> - <param> - <key>value</key> - <value>addr=192.168.11.2</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value>a</value> - </param> - <param> - <key>_coordinate</key> - <value>(188, 12)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Sample Rate</value> - </param> - <param> - <key>value</key> - <value>1e6</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>s</value> - </param> - <param> - <key>_coordinate</key> - <value>(342, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>uhd_usrp_sink</key> - <param> - <key>id</key> - <value>uhd_usrp_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>dev_addr</key> - <value>address</value> - </param> - <param> - <key>sync</key> - <value></value> - </param> - <param> - <key>clock_rate</key> - <value>0.0</value> - </param> - <param> - <key>num_mboards</key> - <value>1</value> - </param> - <param> - <key>ref_source0</key> - <value></value> - </param> - <param> - <key>sd_spec0</key> - <value></value> - </param> - <param> - <key>ref_source1</key> - <value></value> - </param> - <param> - <key>sd_spec1</key> - <value></value> - </param> - <param> - <key>ref_source2</key> - <value></value> - </param> - <param> - <key>sd_spec2</key> - <value></value> - </param> - <param> - <key>ref_source3</key> - <value></value> - </param> - <param> - <key>sd_spec3</key> - <value></value> - </param> - <param> - <key>ref_source4</key> - <value></value> - </param> - <param> - <key>sd_spec4</key> - <value></value> - </param> - <param> - <key>ref_source5</key> - <value></value> - </param> - <param> - <key>sd_spec5</key> - <value></value> - </param> - <param> - <key>ref_source6</key> - <value></value> - </param> - <param> - <key>sd_spec6</key> - <value></value> - </param> - <param> - <key>ref_source7</key> - <value></value> - </param> - <param> - <key>sd_spec7</key> - <value></value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>center_freq0</key> - <value>tun_freq</value> - </param> - <param> - <key>gain0</key> - <value>tun_gain</value> - </param> - <param> - <key>ant0</key> - <value></value> - </param> - <param> - <key>bw0</key> - <value>0</value> - </param> - <param> - <key>center_freq1</key> - <value>0</value> - </param> - <param> - <key>gain1</key> - <value>0</value> - </param> - <param> - <key>ant1</key> - <value></value> - </param> - <param> - <key>bw1</key> - <value>0</value> - </param> - <param> - <key>center_freq2</key> - <value>0</value> - </param> - <param> - <key>gain2</key> - <value>0</value> - </param> - <param> - <key>ant2</key> - <value></value> - </param> - <param> - <key>bw2</key> - <value>0</value> - </param> - <param> - <key>center_freq3</key> - <value>0</value> - </param> - <param> - <key>gain3</key> - <value>0</value> - </param> - <param> - <key>ant3</key> - <value></value> - </param> - <param> - <key>bw3</key> - <value>0</value> - </param> - <param> - <key>center_freq4</key> - <value>0</value> - </param> - <param> - <key>gain4</key> - <value>0</value> - </param> - <param> - <key>ant4</key> - <value></value> - </param> - <param> - <key>bw4</key> - <value>0</value> - </param> - <param> - <key>center_freq5</key> - <value>0</value> - </param> - <param> - <key>gain5</key> - <value>0</value> - </param> - <param> - <key>ant5</key> - <value></value> - </param> - <param> - <key>bw5</key> - <value>0</value> - </param> - <param> - <key>center_freq6</key> - <value>0</value> - </param> - <param> - <key>gain6</key> - <value>0</value> - </param> - <param> - <key>ant6</key> - <value></value> - </param> - <param> - <key>bw6</key> - <value>0</value> - </param> - <param> - <key>center_freq7</key> - <value>0</value> - </param> - <param> - <key>gain7</key> - <value>0</value> - </param> - <param> - <key>ant7</key> - <value></value> - </param> - <param> - <key>bw7</key> - <value>0</value> - </param> - <param> - <key>center_freq8</key> - <value>0</value> - </param> - <param> - <key>gain8</key> - <value>0</value> - </param> - <param> - <key>ant8</key> - <value></value> - </param> - <param> - <key>bw8</key> - <value>0</value> - </param> - <param> - <key>center_freq9</key> - <value>0</value> - </param> - <param> - <key>gain9</key> - <value>0</value> - </param> - <param> - <key>ant9</key> - <value></value> - </param> - <param> - <key>bw9</key> - <value>0</value> - </param> - <param> - <key>center_freq10</key> - <value>0</value> - </param> - <param> - <key>gain10</key> - <value>0</value> - </param> - <param> - <key>ant10</key> - <value></value> - </param> - <param> - <key>bw10</key> - <value>0</value> - </param> - <param> - <key>center_freq11</key> - <value>0</value> - </param> - <param> - <key>gain11</key> - <value>0</value> - </param> - <param> - <key>ant11</key> - <value></value> - </param> - <param> - <key>bw11</key> - <value>0</value> - </param> - <param> - <key>center_freq12</key> - <value>0</value> - </param> - <param> - <key>gain12</key> - <value>0</value> - </param> - <param> - <key>ant12</key> - <value></value> - </param> - <param> - <key>bw12</key> - <value>0</value> - </param> - <param> - <key>center_freq13</key> - <value>0</value> - </param> - <param> - <key>gain13</key> - <value>0</value> - </param> - <param> - <key>ant13</key> - <value></value> - </param> - <param> - <key>bw13</key> - <value>0</value> - </param> - <param> - <key>center_freq14</key> - <value>0</value> - </param> - <param> - <key>gain14</key> - <value>0</value> - </param> - <param> - <key>ant14</key> - <value></value> - </param> - <param> - <key>bw14</key> - <value>0</value> - </param> - <param> - <key>center_freq15</key> - <value>0</value> - </param> - <param> - <key>gain15</key> - <value>0</value> - </param> - <param> - <key>ant15</key> - <value></value> - </param> - <param> - <key>bw15</key> - <value>0</value> - </param> - <param> - <key>center_freq16</key> - <value>0</value> - </param> - <param> - <key>gain16</key> - <value>0</value> - </param> - <param> - <key>ant16</key> - <value></value> - </param> - <param> - <key>bw16</key> - <value>0</value> - </param> - <param> - <key>center_freq17</key> - <value>0</value> - </param> - <param> - <key>gain17</key> - <value>0</value> - </param> - <param> - <key>ant17</key> - <value></value> - </param> - <param> - <key>bw17</key> - <value>0</value> - </param> - <param> - <key>center_freq18</key> - <value>0</value> - </param> - <param> - <key>gain18</key> - <value>0</value> - </param> - <param> - <key>ant18</key> - <value></value> - </param> - <param> - <key>bw18</key> - <value>0</value> - </param> - <param> - <key>center_freq19</key> - <value>0</value> - </param> - <param> - <key>gain19</key> - <value>0</value> - </param> - <param> - <key>ant19</key> - <value></value> - </param> - <param> - <key>bw19</key> - <value>0</value> - </param> - <param> - <key>center_freq20</key> - <value>0</value> - </param> - <param> - <key>gain20</key> - <value>0</value> - </param> - <param> - <key>ant20</key> - <value></value> - </param> - <param> - <key>bw20</key> - <value>0</value> - </param> - <param> - <key>center_freq21</key> - <value>0</value> - </param> - <param> - <key>gain21</key> - <value>0</value> - </param> - <param> - <key>ant21</key> - <value></value> - </param> - <param> - <key>bw21</key> - <value>0</value> - </param> - <param> - <key>center_freq22</key> - <value>0</value> - </param> - <param> - <key>gain22</key> - <value>0</value> - </param> - <param> - <key>ant22</key> - <value></value> - </param> - <param> - <key>bw22</key> - <value>0</value> - </param> - <param> - <key>center_freq23</key> - <value>0</value> - </param> - <param> - <key>gain23</key> - <value>0</value> - </param> - <param> - <key>ant23</key> - <value></value> - </param> - <param> - <key>bw23</key> - <value>0</value> - </param> - <param> - <key>center_freq24</key> - <value>0</value> - </param> - <param> - <key>gain24</key> - <value>0</value> - </param> - <param> - <key>ant24</key> - <value></value> - </param> - <param> - <key>bw24</key> - <value>0</value> - </param> - <param> - <key>center_freq25</key> - <value>0</value> - </param> - <param> - <key>gain25</key> - <value>0</value> - </param> - <param> - <key>ant25</key> - <value></value> - </param> - <param> - <key>bw25</key> - <value>0</value> - </param> - <param> - <key>center_freq26</key> - <value>0</value> - </param> - <param> - <key>gain26</key> - <value>0</value> - </param> - <param> - <key>ant26</key> - <value></value> - </param> - <param> - <key>bw26</key> - <value>0</value> - </param> - <param> - <key>center_freq27</key> - <value>0</value> - </param> - <param> - <key>gain27</key> - <value>0</value> - </param> - <param> - <key>ant27</key> - <value></value> - </param> - <param> - <key>bw27</key> - <value>0</value> - </param> - <param> - <key>center_freq28</key> - <value>0</value> - </param> - <param> - <key>gain28</key> - <value>0</value> - </param> - <param> - <key>ant28</key> - <value></value> - </param> - <param> - <key>bw28</key> - <value>0</value> - </param> - <param> - <key>center_freq29</key> - <value>0</value> - </param> - <param> - <key>gain29</key> - <value>0</value> - </param> - <param> - <key>ant29</key> - <value></value> - </param> - <param> - <key>bw29</key> - <value>0</value> - </param> - <param> - <key>center_freq30</key> - <value>0</value> - </param> - <param> - <key>gain30</key> - <value>0</value> - </param> - <param> - <key>ant30</key> - <value></value> - </param> - <param> - <key>bw30</key> - <value>0</value> - </param> - <param> - <key>center_freq31</key> - <value>0</value> - </param> - <param> - <key>gain31</key> - <value>0</value> - </param> - <param> - <key>ant31</key> - <value></value> - </param> - <param> - <key>bw31</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(308, 169)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Frequency</value> - </param> - <param> - <key>value</key> - <value>2.45e9</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>f</value> - </param> - <param> - <key>_coordinate</key> - <value>(468, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Gain</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>g</value> - </param> - <param> - <key>_coordinate</key> - <value>(616, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>const_source_x_0</source_block_id> - <sink_block_id>uhd_usrp_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-uhd/examples/grc/uhd_dpsk_mod.grc b/gr-uhd/examples/grc/uhd_dpsk_mod.grc deleted file mode 100644 index 18ae9c3db..000000000 --- a/gr-uhd/examples/grc/uhd_dpsk_mod.grc +++ /dev/null @@ -1,2238 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sat Oct 8 14:44:48 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>uhd_dpsk_mod</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>UHD DPSK Modulation</value> - </param> - <param> - <key>author</key> - <value>Example</value> - </param> - <param> - <key>description</key> - <value>Generate a DPSK signal</value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samps_per_sym</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>8</value> - </param> - <param> - <key>_coordinate</key> - <value>(33, 280)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>FFT Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>tun_freq</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(697, 248)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>1e-6</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(469, 355)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>256</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(245, 139)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>ampl</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(647, 163)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_rx_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>UHD RX Gain</value> - </param> - <param> - <key>value</key> - <value>rx_gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>20</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(477, 509)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>rx_freq_off</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>RX Freq Offset (Hz)</value> - </param> - <param> - <key>value</key> - <value>freq_offset</value> - </param> - <param> - <key>min</key> - <value>-50e3</value> - </param> - <param> - <key>max</key> - <value>+50e3</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(190, 507)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>rx_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default RX Gain</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1137, 8)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>freq_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Rx Frequency Offset</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>o</value> - </param> - <param> - <key>_coordinate</key> - <value>(824, 8)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>uhd_usrp_source</key> - <param> - <key>id</key> - <value>uhd_usrp_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>dev_addr</key> - <value>address1</value> - </param> - <param> - <key>sync</key> - <value></value> - </param> - <param> - <key>clock_rate</key> - <value>0.0</value> - </param> - <param> - <key>num_mboards</key> - <value>1</value> - </param> - <param> - <key>ref_source0</key> - <value></value> - </param> - <param> - <key>sd_spec0</key> - <value></value> - </param> - <param> - <key>ref_source1</key> - <value></value> - </param> - <param> - <key>sd_spec1</key> - <value></value> - </param> - <param> - <key>ref_source2</key> - <value></value> - </param> - <param> - <key>sd_spec2</key> - <value></value> - </param> - <param> - <key>ref_source3</key> - <value></value> - </param> - <param> - <key>sd_spec3</key> - <value></value> - </param> - <param> - <key>ref_source4</key> - <value></value> - </param> - <param> - <key>sd_spec4</key> - <value></value> - </param> - <param> - <key>ref_source5</key> - <value></value> - </param> - <param> - <key>sd_spec5</key> - <value></value> - </param> - <param> - <key>ref_source6</key> - <value></value> - </param> - <param> - <key>sd_spec6</key> - <value></value> - </param> - <param> - <key>ref_source7</key> - <value></value> - </param> - <param> - <key>sd_spec7</key> - <value></value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>center_freq0</key> - <value>tun_freq+rx_freq_off</value> - </param> - <param> - <key>gain0</key> - <value>tun_rx_gain</value> - </param> - <param> - <key>ant0</key> - <value></value> - </param> - <param> - <key>bw0</key> - <value>0</value> - </param> - <param> - <key>center_freq1</key> - <value>0</value> - </param> - <param> - <key>gain1</key> - <value>0</value> - </param> - <param> - <key>ant1</key> - <value></value> - </param> - <param> - <key>bw1</key> - <value>0</value> - </param> - <param> - <key>center_freq2</key> - <value>0</value> - </param> - <param> - <key>gain2</key> - <value>0</value> - </param> - <param> - <key>ant2</key> - <value></value> - </param> - <param> - <key>bw2</key> - <value>0</value> - </param> - <param> - <key>center_freq3</key> - <value>0</value> - </param> - <param> - <key>gain3</key> - <value>0</value> - </param> - <param> - <key>ant3</key> - <value></value> - </param> - <param> - <key>bw3</key> - <value>0</value> - </param> - <param> - <key>center_freq4</key> - <value>0</value> - </param> - <param> - <key>gain4</key> - <value>0</value> - </param> - <param> - <key>ant4</key> - <value></value> - </param> - <param> - <key>bw4</key> - <value>0</value> - </param> - <param> - <key>center_freq5</key> - <value>0</value> - </param> - <param> - <key>gain5</key> - <value>0</value> - </param> - <param> - <key>ant5</key> - <value></value> - </param> - <param> - <key>bw5</key> - <value>0</value> - </param> - <param> - <key>center_freq6</key> - <value>0</value> - </param> - <param> - <key>gain6</key> - <value>0</value> - </param> - <param> - <key>ant6</key> - <value></value> - </param> - <param> - <key>bw6</key> - <value>0</value> - </param> - <param> - <key>center_freq7</key> - <value>0</value> - </param> - <param> - <key>gain7</key> - <value>0</value> - </param> - <param> - <key>ant7</key> - <value></value> - </param> - <param> - <key>bw7</key> - <value>0</value> - </param> - <param> - <key>center_freq8</key> - <value>0</value> - </param> - <param> - <key>gain8</key> - <value>0</value> - </param> - <param> - <key>ant8</key> - <value></value> - </param> - <param> - <key>bw8</key> - <value>0</value> - </param> - <param> - <key>center_freq9</key> - <value>0</value> - </param> - <param> - <key>gain9</key> - <value>0</value> - </param> - <param> - <key>ant9</key> - <value></value> - </param> - <param> - <key>bw9</key> - <value>0</value> - </param> - <param> - <key>center_freq10</key> - <value>0</value> - </param> - <param> - <key>gain10</key> - <value>0</value> - </param> - <param> - <key>ant10</key> - <value></value> - </param> - <param> - <key>bw10</key> - <value>0</value> - </param> - <param> - <key>center_freq11</key> - <value>0</value> - </param> - <param> - <key>gain11</key> - <value>0</value> - </param> - <param> - <key>ant11</key> - <value></value> - </param> - <param> - <key>bw11</key> - <value>0</value> - </param> - <param> - <key>center_freq12</key> - <value>0</value> - </param> - <param> - <key>gain12</key> - <value>0</value> - </param> - <param> - <key>ant12</key> - <value></value> - </param> - <param> - <key>bw12</key> - <value>0</value> - </param> - <param> - <key>center_freq13</key> - <value>0</value> - </param> - <param> - <key>gain13</key> - <value>0</value> - </param> - <param> - <key>ant13</key> - <value></value> - </param> - <param> - <key>bw13</key> - <value>0</value> - </param> - <param> - <key>center_freq14</key> - <value>0</value> - </param> - <param> - <key>gain14</key> - <value>0</value> - </param> - <param> - <key>ant14</key> - <value></value> - </param> - <param> - <key>bw14</key> - <value>0</value> - </param> - <param> - <key>center_freq15</key> - <value>0</value> - </param> - <param> - <key>gain15</key> - <value>0</value> - </param> - <param> - <key>ant15</key> - <value></value> - </param> - <param> - <key>bw15</key> - <value>0</value> - </param> - <param> - <key>center_freq16</key> - <value>0</value> - </param> - <param> - <key>gain16</key> - <value>0</value> - </param> - <param> - <key>ant16</key> - <value></value> - </param> - <param> - <key>bw16</key> - <value>0</value> - </param> - <param> - <key>center_freq17</key> - <value>0</value> - </param> - <param> - <key>gain17</key> - <value>0</value> - </param> - <param> - <key>ant17</key> - <value></value> - </param> - <param> - <key>bw17</key> - <value>0</value> - </param> - <param> - <key>center_freq18</key> - <value>0</value> - </param> - <param> - <key>gain18</key> - <value>0</value> - </param> - <param> - <key>ant18</key> - <value></value> - </param> - <param> - <key>bw18</key> - <value>0</value> - </param> - <param> - <key>center_freq19</key> - <value>0</value> - </param> - <param> - <key>gain19</key> - <value>0</value> - </param> - <param> - <key>ant19</key> - <value></value> - </param> - <param> - <key>bw19</key> - <value>0</value> - </param> - <param> - <key>center_freq20</key> - <value>0</value> - </param> - <param> - <key>gain20</key> - <value>0</value> - </param> - <param> - <key>ant20</key> - <value></value> - </param> - <param> - <key>bw20</key> - <value>0</value> - </param> - <param> - <key>center_freq21</key> - <value>0</value> - </param> - <param> - <key>gain21</key> - <value>0</value> - </param> - <param> - <key>ant21</key> - <value></value> - </param> - <param> - <key>bw21</key> - <value>0</value> - </param> - <param> - <key>center_freq22</key> - <value>0</value> - </param> - <param> - <key>gain22</key> - <value>0</value> - </param> - <param> - <key>ant22</key> - <value></value> - </param> - <param> - <key>bw22</key> - <value>0</value> - </param> - <param> - <key>center_freq23</key> - <value>0</value> - </param> - <param> - <key>gain23</key> - <value>0</value> - </param> - <param> - <key>ant23</key> - <value></value> - </param> - <param> - <key>bw23</key> - <value>0</value> - </param> - <param> - <key>center_freq24</key> - <value>0</value> - </param> - <param> - <key>gain24</key> - <value>0</value> - </param> - <param> - <key>ant24</key> - <value></value> - </param> - <param> - <key>bw24</key> - <value>0</value> - </param> - <param> - <key>center_freq25</key> - <value>0</value> - </param> - <param> - <key>gain25</key> - <value>0</value> - </param> - <param> - <key>ant25</key> - <value></value> - </param> - <param> - <key>bw25</key> - <value>0</value> - </param> - <param> - <key>center_freq26</key> - <value>0</value> - </param> - <param> - <key>gain26</key> - <value>0</value> - </param> - <param> - <key>ant26</key> - <value></value> - </param> - <param> - <key>bw26</key> - <value>0</value> - </param> - <param> - <key>center_freq27</key> - <value>0</value> - </param> - <param> - <key>gain27</key> - <value>0</value> - </param> - <param> - <key>ant27</key> - <value></value> - </param> - <param> - <key>bw27</key> - <value>0</value> - </param> - <param> - <key>center_freq28</key> - <value>0</value> - </param> - <param> - <key>gain28</key> - <value>0</value> - </param> - <param> - <key>ant28</key> - <value></value> - </param> - <param> - <key>bw28</key> - <value>0</value> - </param> - <param> - <key>center_freq29</key> - <value>0</value> - </param> - <param> - <key>gain29</key> - <value>0</value> - </param> - <param> - <key>ant29</key> - <value></value> - </param> - <param> - <key>bw29</key> - <value>0</value> - </param> - <param> - <key>center_freq30</key> - <value>0</value> - </param> - <param> - <key>gain30</key> - <value>0</value> - </param> - <param> - <key>ant30</key> - <value></value> - </param> - <param> - <key>bw30</key> - <value>0</value> - </param> - <param> - <key>center_freq31</key> - <value>0</value> - </param> - <param> - <key>gain31</key> - <value>0</value> - </param> - <param> - <key>ant31</key> - <value></value> - </param> - <param> - <key>bw31</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(216, 288)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_constellationsink2</key> - <param> - <key>id</key> - <value>wxgui_constellationsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Constellation Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>frame_rate</key> - <value>5</value> - </param> - <param> - <key>const_size</key> - <value>2048</value> - </param> - <param> - <key>M</key> - <value>4</value> - </param> - <param> - <key>theta</key> - <value>0</value> - </param> - <param> - <key>loop_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>fmax</key> - <value>0.06</value> - </param> - <param> - <key>mu</key> - <value>0.5</value> - </param> - <param> - <key>gain_mu</key> - <value>0.005</value> - </param> - <param> - <key>symbol_rate</key> - <value>samp_rate/samps_per_sym</value> - </param> - <param> - <key>omega_limit</key> - <value>0.005</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(862, 336)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_dxpsk_mod</key> - <param> - <key>id</key> - <value>digital_dxpsk_mod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>dqpsk</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>samps_per_sym</value> - </param> - <param> - <key>excess_bw</key> - <value>0.35</value> - </param> - <param> - <key>gray_coded</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(426, 139)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>ampl</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Amplitude</value> - </param> - <param> - <key>value</key> - <value>.1</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(33, 353)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>uhd_usrp_sink</key> - <param> - <key>id</key> - <value>uhd_usrp_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>dev_addr</key> - <value>address0</value> - </param> - <param> - <key>sync</key> - <value></value> - </param> - <param> - <key>clock_rate</key> - <value>0.0</value> - </param> - <param> - <key>num_mboards</key> - <value>1</value> - </param> - <param> - <key>ref_source0</key> - <value></value> - </param> - <param> - <key>sd_spec0</key> - <value></value> - </param> - <param> - <key>ref_source1</key> - <value></value> - </param> - <param> - <key>sd_spec1</key> - <value></value> - </param> - <param> - <key>ref_source2</key> - <value></value> - </param> - <param> - <key>sd_spec2</key> - <value></value> - </param> - <param> - <key>ref_source3</key> - <value></value> - </param> - <param> - <key>sd_spec3</key> - <value></value> - </param> - <param> - <key>ref_source4</key> - <value></value> - </param> - <param> - <key>sd_spec4</key> - <value></value> - </param> - <param> - <key>ref_source5</key> - <value></value> - </param> - <param> - <key>sd_spec5</key> - <value></value> - </param> - <param> - <key>ref_source6</key> - <value></value> - </param> - <param> - <key>sd_spec6</key> - <value></value> - </param> - <param> - <key>ref_source7</key> - <value></value> - </param> - <param> - <key>sd_spec7</key> - <value></value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>center_freq0</key> - <value>tun_freq</value> - </param> - <param> - <key>gain0</key> - <value>tun_rx_gain</value> - </param> - <param> - <key>ant0</key> - <value></value> - </param> - <param> - <key>bw0</key> - <value>0</value> - </param> - <param> - <key>center_freq1</key> - <value>0</value> - </param> - <param> - <key>gain1</key> - <value>0</value> - </param> - <param> - <key>ant1</key> - <value></value> - </param> - <param> - <key>bw1</key> - <value>0</value> - </param> - <param> - <key>center_freq2</key> - <value>0</value> - </param> - <param> - <key>gain2</key> - <value>0</value> - </param> - <param> - <key>ant2</key> - <value></value> - </param> - <param> - <key>bw2</key> - <value>0</value> - </param> - <param> - <key>center_freq3</key> - <value>0</value> - </param> - <param> - <key>gain3</key> - <value>0</value> - </param> - <param> - <key>ant3</key> - <value></value> - </param> - <param> - <key>bw3</key> - <value>0</value> - </param> - <param> - <key>center_freq4</key> - <value>0</value> - </param> - <param> - <key>gain4</key> - <value>0</value> - </param> - <param> - <key>ant4</key> - <value></value> - </param> - <param> - <key>bw4</key> - <value>0</value> - </param> - <param> - <key>center_freq5</key> - <value>0</value> - </param> - <param> - <key>gain5</key> - <value>0</value> - </param> - <param> - <key>ant5</key> - <value></value> - </param> - <param> - <key>bw5</key> - <value>0</value> - </param> - <param> - <key>center_freq6</key> - <value>0</value> - </param> - <param> - <key>gain6</key> - <value>0</value> - </param> - <param> - <key>ant6</key> - <value></value> - </param> - <param> - <key>bw6</key> - <value>0</value> - </param> - <param> - <key>center_freq7</key> - <value>0</value> - </param> - <param> - <key>gain7</key> - <value>0</value> - </param> - <param> - <key>ant7</key> - <value></value> - </param> - <param> - <key>bw7</key> - <value>0</value> - </param> - <param> - <key>center_freq8</key> - <value>0</value> - </param> - <param> - <key>gain8</key> - <value>0</value> - </param> - <param> - <key>ant8</key> - <value></value> - </param> - <param> - <key>bw8</key> - <value>0</value> - </param> - <param> - <key>center_freq9</key> - <value>0</value> - </param> - <param> - <key>gain9</key> - <value>0</value> - </param> - <param> - <key>ant9</key> - <value></value> - </param> - <param> - <key>bw9</key> - <value>0</value> - </param> - <param> - <key>center_freq10</key> - <value>0</value> - </param> - <param> - <key>gain10</key> - <value>0</value> - </param> - <param> - <key>ant10</key> - <value></value> - </param> - <param> - <key>bw10</key> - <value>0</value> - </param> - <param> - <key>center_freq11</key> - <value>0</value> - </param> - <param> - <key>gain11</key> - <value>0</value> - </param> - <param> - <key>ant11</key> - <value></value> - </param> - <param> - <key>bw11</key> - <value>0</value> - </param> - <param> - <key>center_freq12</key> - <value>0</value> - </param> - <param> - <key>gain12</key> - <value>0</value> - </param> - <param> - <key>ant12</key> - <value></value> - </param> - <param> - <key>bw12</key> - <value>0</value> - </param> - <param> - <key>center_freq13</key> - <value>0</value> - </param> - <param> - <key>gain13</key> - <value>0</value> - </param> - <param> - <key>ant13</key> - <value></value> - </param> - <param> - <key>bw13</key> - <value>0</value> - </param> - <param> - <key>center_freq14</key> - <value>0</value> - </param> - <param> - <key>gain14</key> - <value>0</value> - </param> - <param> - <key>ant14</key> - <value></value> - </param> - <param> - <key>bw14</key> - <value>0</value> - </param> - <param> - <key>center_freq15</key> - <value>0</value> - </param> - <param> - <key>gain15</key> - <value>0</value> - </param> - <param> - <key>ant15</key> - <value></value> - </param> - <param> - <key>bw15</key> - <value>0</value> - </param> - <param> - <key>center_freq16</key> - <value>0</value> - </param> - <param> - <key>gain16</key> - <value>0</value> - </param> - <param> - <key>ant16</key> - <value></value> - </param> - <param> - <key>bw16</key> - <value>0</value> - </param> - <param> - <key>center_freq17</key> - <value>0</value> - </param> - <param> - <key>gain17</key> - <value>0</value> - </param> - <param> - <key>ant17</key> - <value></value> - </param> - <param> - <key>bw17</key> - <value>0</value> - </param> - <param> - <key>center_freq18</key> - <value>0</value> - </param> - <param> - <key>gain18</key> - <value>0</value> - </param> - <param> - <key>ant18</key> - <value></value> - </param> - <param> - <key>bw18</key> - <value>0</value> - </param> - <param> - <key>center_freq19</key> - <value>0</value> - </param> - <param> - <key>gain19</key> - <value>0</value> - </param> - <param> - <key>ant19</key> - <value></value> - </param> - <param> - <key>bw19</key> - <value>0</value> - </param> - <param> - <key>center_freq20</key> - <value>0</value> - </param> - <param> - <key>gain20</key> - <value>0</value> - </param> - <param> - <key>ant20</key> - <value></value> - </param> - <param> - <key>bw20</key> - <value>0</value> - </param> - <param> - <key>center_freq21</key> - <value>0</value> - </param> - <param> - <key>gain21</key> - <value>0</value> - </param> - <param> - <key>ant21</key> - <value></value> - </param> - <param> - <key>bw21</key> - <value>0</value> - </param> - <param> - <key>center_freq22</key> - <value>0</value> - </param> - <param> - <key>gain22</key> - <value>0</value> - </param> - <param> - <key>ant22</key> - <value></value> - </param> - <param> - <key>bw22</key> - <value>0</value> - </param> - <param> - <key>center_freq23</key> - <value>0</value> - </param> - <param> - <key>gain23</key> - <value>0</value> - </param> - <param> - <key>ant23</key> - <value></value> - </param> - <param> - <key>bw23</key> - <value>0</value> - </param> - <param> - <key>center_freq24</key> - <value>0</value> - </param> - <param> - <key>gain24</key> - <value>0</value> - </param> - <param> - <key>ant24</key> - <value></value> - </param> - <param> - <key>bw24</key> - <value>0</value> - </param> - <param> - <key>center_freq25</key> - <value>0</value> - </param> - <param> - <key>gain25</key> - <value>0</value> - </param> - <param> - <key>ant25</key> - <value></value> - </param> - <param> - <key>bw25</key> - <value>0</value> - </param> - <param> - <key>center_freq26</key> - <value>0</value> - </param> - <param> - <key>gain26</key> - <value>0</value> - </param> - <param> - <key>ant26</key> - <value></value> - </param> - <param> - <key>bw26</key> - <value>0</value> - </param> - <param> - <key>center_freq27</key> - <value>0</value> - </param> - <param> - <key>gain27</key> - <value>0</value> - </param> - <param> - <key>ant27</key> - <value></value> - </param> - <param> - <key>bw27</key> - <value>0</value> - </param> - <param> - <key>center_freq28</key> - <value>0</value> - </param> - <param> - <key>gain28</key> - <value>0</value> - </param> - <param> - <key>ant28</key> - <value></value> - </param> - <param> - <key>bw28</key> - <value>0</value> - </param> - <param> - <key>center_freq29</key> - <value>0</value> - </param> - <param> - <key>gain29</key> - <value>0</value> - </param> - <param> - <key>ant29</key> - <value></value> - </param> - <param> - <key>bw29</key> - <value>0</value> - </param> - <param> - <key>center_freq30</key> - <value>0</value> - </param> - <param> - <key>gain30</key> - <value>0</value> - </param> - <param> - <key>ant30</key> - <value></value> - </param> - <param> - <key>bw30</key> - <value>0</value> - </param> - <param> - <key>center_freq31</key> - <value>0</value> - </param> - <param> - <key>gain31</key> - <value>0</value> - </param> - <param> - <key>ant31</key> - <value></value> - </param> - <param> - <key>bw31</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(838, 139)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_tx_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>UHD TX Gain</value> - </param> - <param> - <key>value</key> - <value>tx_gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>20</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(351, 508)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>address0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>IP Address, Dev 0</value> - </param> - <param> - <key>value</key> - <value>addr=192.168.10.2</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(197, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>address1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>IP Address, Dev 1</value> - </param> - <param> - <key>value</key> - <value>addr=192.168.11.2</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(357, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Sample Rate</value> - </param> - <param> - <key>value</key> - <value>1e6</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>s</value> - </param> - <param> - <key>_coordinate</key> - <value>(543, 8)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Frequency</value> - </param> - <param> - <key>value</key> - <value>2.45e9</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>f</value> - </param> - <param> - <key>_coordinate</key> - <value>(669, 8)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>tx_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default TX Gain</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1003, 8)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Freq (Hz)</value> - </param> - <param> - <key>value</key> - <value>freq</value> - </param> - <param> - <key>min</key> - <value>2.4e9</value> - </param> - <param> - <key>max</key> - <value>2.5e9</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(35, 506)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>wxgui_constellationsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>uhd_usrp_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>digital_dxpsk_mod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_dxpsk_mod_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-uhd/examples/grc/uhd_fft.grc b/gr-uhd/examples/grc/uhd_fft.grc deleted file mode 100644 index 2582b5e3b..000000000 --- a/gr-uhd/examples/grc/uhd_fft.grc +++ /dev/null @@ -1,1528 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Mon Jun 18 14:20:11 2012</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>uhd_fft</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>UHD FFT</value> - </param> - <param> - <key>author</key> - <value>Example</value> - </param> - <param> - <key>description</key> - <value>UHD FFT Waveform Plotter</value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(15, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import numpy</value> - </param> - <param> - <key>_coordinate</key> - <value>(15, 121)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>param_samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Sample Rate</value> - </param> - <param> - <key>value</key> - <value>1e6</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>s</value> - </param> - <param> - <key>_coordinate</key> - <value>(358, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>param_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Frequency</value> - </param> - <param> - <key>value</key> - <value>2.45e9</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>f</value> - </param> - <param> - <key>_coordinate</key> - <value>(508, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>param_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Gain</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>g</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>nb0, 2</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(314, 250)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>uhd_usrp_source</key> - <param> - <key>id</key> - <value>uhd_usrp_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>fc32</value> - </param> - <param> - <key>otw</key> - <value></value> - </param> - <param> - <key>stream_args</key> - <value></value> - </param> - <param> - <key>dev_addr</key> - <value>address</value> - </param> - <param> - <key>sync</key> - <value></value> - </param> - <param> - <key>clock_rate</key> - <value>0.0</value> - </param> - <param> - <key>num_mboards</key> - <value>1</value> - </param> - <param> - <key>clock_source0</key> - <value></value> - </param> - <param> - <key>time_source0</key> - <value></value> - </param> - <param> - <key>sd_spec0</key> - <value></value> - </param> - <param> - <key>clock_source1</key> - <value></value> - </param> - <param> - <key>time_source1</key> - <value></value> - </param> - <param> - <key>sd_spec1</key> - <value></value> - </param> - <param> - <key>clock_source2</key> - <value></value> - </param> - <param> - <key>time_source2</key> - <value></value> - </param> - <param> - <key>sd_spec2</key> - <value></value> - </param> - <param> - <key>clock_source3</key> - <value></value> - </param> - <param> - <key>time_source3</key> - <value></value> - </param> - <param> - <key>sd_spec3</key> - <value></value> - </param> - <param> - <key>clock_source4</key> - <value></value> - </param> - <param> - <key>time_source4</key> - <value></value> - </param> - <param> - <key>sd_spec4</key> - <value></value> - </param> - <param> - <key>clock_source5</key> - <value></value> - </param> - <param> - <key>time_source5</key> - <value></value> - </param> - <param> - <key>sd_spec5</key> - <value></value> - </param> - <param> - <key>clock_source6</key> - <value></value> - </param> - <param> - <key>time_source6</key> - <value></value> - </param> - <param> - <key>sd_spec6</key> - <value></value> - </param> - <param> - <key>clock_source7</key> - <value></value> - </param> - <param> - <key>time_source7</key> - <value></value> - </param> - <param> - <key>sd_spec7</key> - <value></value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>center_freq0</key> - <value>freq</value> - </param> - <param> - <key>gain0</key> - <value>gain</value> - </param> - <param> - <key>ant0</key> - <value>ant</value> - </param> - <param> - <key>bw0</key> - <value>samp_rate</value> - </param> - <param> - <key>center_freq1</key> - <value>0</value> - </param> - <param> - <key>gain1</key> - <value>0</value> - </param> - <param> - <key>ant1</key> - <value></value> - </param> - <param> - <key>bw1</key> - <value>0</value> - </param> - <param> - <key>center_freq2</key> - <value>0</value> - </param> - <param> - <key>gain2</key> - <value>0</value> - </param> - <param> - <key>ant2</key> - <value></value> - </param> - <param> - <key>bw2</key> - <value>0</value> - </param> - <param> - <key>center_freq3</key> - <value>0</value> - </param> - <param> - <key>gain3</key> - <value>0</value> - </param> - <param> - <key>ant3</key> - <value></value> - </param> - <param> - <key>bw3</key> - <value>0</value> - </param> - <param> - <key>center_freq4</key> - <value>0</value> - </param> - <param> - <key>gain4</key> - <value>0</value> - </param> - <param> - <key>ant4</key> - <value></value> - </param> - <param> - <key>bw4</key> - <value>0</value> - </param> - <param> - <key>center_freq5</key> - <value>0</value> - </param> - <param> - <key>gain5</key> - <value>0</value> - </param> - <param> - <key>ant5</key> - <value></value> - </param> - <param> - <key>bw5</key> - <value>0</value> - </param> - <param> - <key>center_freq6</key> - <value>0</value> - </param> - <param> - <key>gain6</key> - <value>0</value> - </param> - <param> - <key>ant6</key> - <value></value> - </param> - <param> - <key>bw6</key> - <value>0</value> - </param> - <param> - <key>center_freq7</key> - <value>0</value> - </param> - <param> - <key>gain7</key> - <value>0</value> - </param> - <param> - <key>ant7</key> - <value></value> - </param> - <param> - <key>bw7</key> - <value>0</value> - </param> - <param> - <key>center_freq8</key> - <value>0</value> - </param> - <param> - <key>gain8</key> - <value>0</value> - </param> - <param> - <key>ant8</key> - <value></value> - </param> - <param> - <key>bw8</key> - <value>0</value> - </param> - <param> - <key>center_freq9</key> - <value>0</value> - </param> - <param> - <key>gain9</key> - <value>0</value> - </param> - <param> - <key>ant9</key> - <value></value> - </param> - <param> - <key>bw9</key> - <value>0</value> - </param> - <param> - <key>center_freq10</key> - <value>0</value> - </param> - <param> - <key>gain10</key> - <value>0</value> - </param> - <param> - <key>ant10</key> - <value></value> - </param> - <param> - <key>bw10</key> - <value>0</value> - </param> - <param> - <key>center_freq11</key> - <value>0</value> - </param> - <param> - <key>gain11</key> - <value>0</value> - </param> - <param> - <key>ant11</key> - <value></value> - </param> - <param> - <key>bw11</key> - <value>0</value> - </param> - <param> - <key>center_freq12</key> - <value>0</value> - </param> - <param> - <key>gain12</key> - <value>0</value> - </param> - <param> - <key>ant12</key> - <value></value> - </param> - <param> - <key>bw12</key> - <value>0</value> - </param> - <param> - <key>center_freq13</key> - <value>0</value> - </param> - <param> - <key>gain13</key> - <value>0</value> - </param> - <param> - <key>ant13</key> - <value></value> - </param> - <param> - <key>bw13</key> - <value>0</value> - </param> - <param> - <key>center_freq14</key> - <value>0</value> - </param> - <param> - <key>gain14</key> - <value>0</value> - </param> - <param> - <key>ant14</key> - <value></value> - </param> - <param> - <key>bw14</key> - <value>0</value> - </param> - <param> - <key>center_freq15</key> - <value>0</value> - </param> - <param> - <key>gain15</key> - <value>0</value> - </param> - <param> - <key>ant15</key> - <value></value> - </param> - <param> - <key>bw15</key> - <value>0</value> - </param> - <param> - <key>center_freq16</key> - <value>0</value> - </param> - <param> - <key>gain16</key> - <value>0</value> - </param> - <param> - <key>ant16</key> - <value></value> - </param> - <param> - <key>bw16</key> - <value>0</value> - </param> - <param> - <key>center_freq17</key> - <value>0</value> - </param> - <param> - <key>gain17</key> - <value>0</value> - </param> - <param> - <key>ant17</key> - <value></value> - </param> - <param> - <key>bw17</key> - <value>0</value> - </param> - <param> - <key>center_freq18</key> - <value>0</value> - </param> - <param> - <key>gain18</key> - <value>0</value> - </param> - <param> - <key>ant18</key> - <value></value> - </param> - <param> - <key>bw18</key> - <value>0</value> - </param> - <param> - <key>center_freq19</key> - <value>0</value> - </param> - <param> - <key>gain19</key> - <value>0</value> - </param> - <param> - <key>ant19</key> - <value></value> - </param> - <param> - <key>bw19</key> - <value>0</value> - </param> - <param> - <key>center_freq20</key> - <value>0</value> - </param> - <param> - <key>gain20</key> - <value>0</value> - </param> - <param> - <key>ant20</key> - <value></value> - </param> - <param> - <key>bw20</key> - <value>0</value> - </param> - <param> - <key>center_freq21</key> - <value>0</value> - </param> - <param> - <key>gain21</key> - <value>0</value> - </param> - <param> - <key>ant21</key> - <value></value> - </param> - <param> - <key>bw21</key> - <value>0</value> - </param> - <param> - <key>center_freq22</key> - <value>0</value> - </param> - <param> - <key>gain22</key> - <value>0</value> - </param> - <param> - <key>ant22</key> - <value></value> - </param> - <param> - <key>bw22</key> - <value>0</value> - </param> - <param> - <key>center_freq23</key> - <value>0</value> - </param> - <param> - <key>gain23</key> - <value>0</value> - </param> - <param> - <key>ant23</key> - <value></value> - </param> - <param> - <key>bw23</key> - <value>0</value> - </param> - <param> - <key>center_freq24</key> - <value>0</value> - </param> - <param> - <key>gain24</key> - <value>0</value> - </param> - <param> - <key>ant24</key> - <value></value> - </param> - <param> - <key>bw24</key> - <value>0</value> - </param> - <param> - <key>center_freq25</key> - <value>0</value> - </param> - <param> - <key>gain25</key> - <value>0</value> - </param> - <param> - <key>ant25</key> - <value></value> - </param> - <param> - <key>bw25</key> - <value>0</value> - </param> - <param> - <key>center_freq26</key> - <value>0</value> - </param> - <param> - <key>gain26</key> - <value>0</value> - </param> - <param> - <key>ant26</key> - <value></value> - </param> - <param> - <key>bw26</key> - <value>0</value> - </param> - <param> - <key>center_freq27</key> - <value>0</value> - </param> - <param> - <key>gain27</key> - <value>0</value> - </param> - <param> - <key>ant27</key> - <value></value> - </param> - <param> - <key>bw27</key> - <value>0</value> - </param> - <param> - <key>center_freq28</key> - <value>0</value> - </param> - <param> - <key>gain28</key> - <value>0</value> - </param> - <param> - <key>ant28</key> - <value></value> - </param> - <param> - <key>bw28</key> - <value>0</value> - </param> - <param> - <key>center_freq29</key> - <value>0</value> - </param> - <param> - <key>gain29</key> - <value>0</value> - </param> - <param> - <key>ant29</key> - <value></value> - </param> - <param> - <key>bw29</key> - <value>0</value> - </param> - <param> - <key>center_freq30</key> - <value>0</value> - </param> - <param> - <key>gain30</key> - <value>0</value> - </param> - <param> - <key>ant30</key> - <value></value> - </param> - <param> - <key>bw30</key> - <value>0</value> - </param> - <param> - <key>center_freq31</key> - <value>0</value> - </param> - <param> - <key>gain31</key> - <value>0</value> - </param> - <param> - <key>ant31</key> - <value></value> - </param> - <param> - <key>bw31</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(37, 394)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_function_probe</key> - <param> - <key>id</key> - <value>chan0_lo_locked</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>uhd.sensor_value("", False, "")</value> - </param> - <param> - <key>block_id</key> - <value>uhd_usrp_source_0</value> - </param> - <param> - <key>function_name</key> - <value>get_sensor</value> - </param> - <param> - <key>function_args</key> - <value>"'lo_locked'"</value> - </param> - <param> - <key>poll_rate</key> - <value>10</value> - </param> - <param> - <key>_coordinate</key> - <value>(583, 432)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>nb0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['FFT', 'Waterfall', 'Scope']</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 8</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(15, 172)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_chooser</key> - <param> - <key>id</key> - <value>ant_xcvr</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>label</key> - <value>Antenna</value> - </param> - <param> - <key>value</key> - <value>"J2"</value> - </param> - <param> - <key>choices</key> - <value>["J2","J1"]</value> - </param> - <param> - <key>labels</key> - <value>["J2","J1"]</value> - </param> - <param> - <key>type</key> - <value>radio_buttons</value> - </param> - <param> - <key>style</key> - <value>wx.RA_HORIZONTAL</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(830, 278)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>lo_locked_probe</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>LO Locked</value> - </param> - <param> - <key>value</key> - <value>chan0_lo_locked.to_bool()</value> - </param> - <param> - <key>converver</key> - <value>str_converter</value> - </param> - <param> - <key>formatter</key> - <value>lambda x: x and "True" or "False"</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 7, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(583, 314)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_chooser</key> - <param> - <key>id</key> - <value>ant</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Antenna</value> - </param> - <param> - <key>value</key> - <value>"RX2"</value> - </param> - <param> - <key>choices</key> - <value>["RX2","TX/RX"]</value> - </param> - <param> - <key>labels</key> - <value>["RX2","TX/RX"]</value> - </param> - <param> - <key>type</key> - <value>radio_buttons</value> - </param> - <param> - <key>style</key> - <value>wx.RA_HORIZONTAL</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 4, 1, 2</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(830, 130)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>address</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>IP Address</value> - </param> - <param> - <key>value</key> - <value></value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value>a</value> - </param> - <param> - <key>_coordinate</key> - <value>(190, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>fft</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>FFT Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>freq</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>15</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value>(-1, 400)</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>nb0, 0</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(314, 359)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_waterfallsink2</key> - <param> - <key>id</key> - <value>wxgui_waterfallsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Waterfall Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>dynamic_range</key> - <value>100</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>512</value> - </param> - <param> - <key>fft_rate</key> - <value>15</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value>(-1, 400)</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>nb0, 1</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(313, 573)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_text_box</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Sample Rate</value> - </param> - <param> - <key>value</key> - <value>param_samp_rate</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 3</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(358, 129)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>RX Tune Frequency</value> - </param> - <param> - <key>value</key> - <value>param_freq</value> - </param> - <param> - <key>min</key> - <value>50e6</value> - </param> - <param> - <key>max</key> - <value>6e9</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>3, 0, 1, 8</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(510, 128)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>RX Gain</value> - </param> - <param> - <key>value</key> - <value>param_gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>31.5</value> - </param> - <param> - <key>num_steps</key> - <value>63</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>2, 0, 1, 8</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(679, 130)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>wxgui_waterfallsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>fft</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-uhd/examples/grc/uhd_rx_dpsk.grc b/gr-uhd/examples/grc/uhd_rx_dpsk.grc deleted file mode 100644 index 73848ff3c..000000000 --- a/gr-uhd/examples/grc/uhd_rx_dpsk.grc +++ /dev/null @@ -1,1431 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sat Oct 8 15:08:55 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>uhd_rx_dpsk</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>UHD RX DPSK</value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(12, 9)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samps_per_sym</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4</value> - </param> - <param> - <key>_coordinate</key> - <value>(12, 88)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Sample Rate</value> - </param> - <param> - <key>value</key> - <value>1e6</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>s</value> - </param> - <param> - <key>_coordinate</key> - <value>(339, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Frequency</value> - </param> - <param> - <key>value</key> - <value>2.45e9</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>f</value> - </param> - <param> - <key>_coordinate</key> - <value>(466, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Gain</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>g</value> - </param> - <param> - <key>_coordinate</key> - <value>(624, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>address</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>IP Address</value> - </param> - <param> - <key>value</key> - <value>addr=192.168.10.2</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value>a</value> - </param> - <param> - <key>_coordinate</key> - <value>(186, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>freq_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Rx Frequency Offset</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>o</value> - </param> - <param> - <key>_coordinate</key> - <value>(748, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Freq (Hz)</value> - </param> - <param> - <key>value</key> - <value>freq</value> - </param> - <param> - <key>min</key> - <value>2.4e9</value> - </param> - <param> - <key>max</key> - <value>2.5e9</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(12, 436)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_null_sink</key> - <param> - <key>id</key> - <value>gr_null_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(615, 144)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>timing_bw</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Loop BW</value> - </param> - <param> - <key>value</key> - <value>6.28/100.0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(604, 436)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>phase_bw</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Phase Loop BW</value> - </param> - <param> - <key>value</key> - <value>6.28/100.0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1.0</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(461, 436)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_constellationsink2</key> - <param> - <key>id</key> - <value>wxgui_constellationsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Constellation Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>frame_rate</key> - <value>5</value> - </param> - <param> - <key>const_size</key> - <value>2048</value> - </param> - <param> - <key>M</key> - <value>4</value> - </param> - <param> - <key>theta</key> - <value>0</value> - </param> - <param> - <key>loop_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>fmax</key> - <value>0.06</value> - </param> - <param> - <key>mu</key> - <value>0.5</value> - </param> - <param> - <key>gain_mu</key> - <value>0.005</value> - </param> - <param> - <key>symbol_rate</key> - <value>samp_rate/samps_per_sym</value> - </param> - <param> - <key>omega_limit</key> - <value>0.005</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(931, 313)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>FFT Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>tun_freq</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(710, 236)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_dxpsk_demod</key> - <param> - <key>id</key> - <value>digital_dxpsk_demod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>dqpsk</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>samps_per_sym</value> - </param> - <param> - <key>excess_bw</key> - <value>0.35</value> - </param> - <param> - <key>phase_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>timing_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>omega_relative_limit</key> - <value>0.005</value> - </param> - <param> - <key>gray_coded</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>sync_out</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(303, 154)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>rx_freq_off</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>RX Freq Offset (Hz)</value> - </param> - <param> - <key>value</key> - <value>freq_offset</value> - </param> - <param> - <key>min</key> - <value>-100e3</value> - </param> - <param> - <key>max</key> - <value>+100e3</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(149, 437)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>UHD Gain</value> - </param> - <param> - <key>value</key> - <value>gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>20</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(306, 438)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>uhd_usrp_source</key> - <param> - <key>id</key> - <value>uhd_usrp_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>dev_addr</key> - <value>address</value> - </param> - <param> - <key>sync</key> - <value></value> - </param> - <param> - <key>clock_rate</key> - <value>0.0</value> - </param> - <param> - <key>num_mboards</key> - <value>1</value> - </param> - <param> - <key>ref_source0</key> - <value></value> - </param> - <param> - <key>sd_spec0</key> - <value></value> - </param> - <param> - <key>ref_source1</key> - <value></value> - </param> - <param> - <key>sd_spec1</key> - <value></value> - </param> - <param> - <key>ref_source2</key> - <value></value> - </param> - <param> - <key>sd_spec2</key> - <value></value> - </param> - <param> - <key>ref_source3</key> - <value></value> - </param> - <param> - <key>sd_spec3</key> - <value></value> - </param> - <param> - <key>ref_source4</key> - <value></value> - </param> - <param> - <key>sd_spec4</key> - <value></value> - </param> - <param> - <key>ref_source5</key> - <value></value> - </param> - <param> - <key>sd_spec5</key> - <value></value> - </param> - <param> - <key>ref_source6</key> - <value></value> - </param> - <param> - <key>sd_spec6</key> - <value></value> - </param> - <param> - <key>ref_source7</key> - <value></value> - </param> - <param> - <key>sd_spec7</key> - <value></value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>center_freq0</key> - <value>tun_freq+rx_freq_off</value> - </param> - <param> - <key>gain0</key> - <value>tun_gain</value> - </param> - <param> - <key>ant0</key> - <value></value> - </param> - <param> - <key>bw0</key> - <value>0</value> - </param> - <param> - <key>center_freq1</key> - <value>0</value> - </param> - <param> - <key>gain1</key> - <value>0</value> - </param> - <param> - <key>ant1</key> - <value></value> - </param> - <param> - <key>bw1</key> - <value>0</value> - </param> - <param> - <key>center_freq2</key> - <value>0</value> - </param> - <param> - <key>gain2</key> - <value>0</value> - </param> - <param> - <key>ant2</key> - <value></value> - </param> - <param> - <key>bw2</key> - <value>0</value> - </param> - <param> - <key>center_freq3</key> - <value>0</value> - </param> - <param> - <key>gain3</key> - <value>0</value> - </param> - <param> - <key>ant3</key> - <value></value> - </param> - <param> - <key>bw3</key> - <value>0</value> - </param> - <param> - <key>center_freq4</key> - <value>0</value> - </param> - <param> - <key>gain4</key> - <value>0</value> - </param> - <param> - <key>ant4</key> - <value></value> - </param> - <param> - <key>bw4</key> - <value>0</value> - </param> - <param> - <key>center_freq5</key> - <value>0</value> - </param> - <param> - <key>gain5</key> - <value>0</value> - </param> - <param> - <key>ant5</key> - <value></value> - </param> - <param> - <key>bw5</key> - <value>0</value> - </param> - <param> - <key>center_freq6</key> - <value>0</value> - </param> - <param> - <key>gain6</key> - <value>0</value> - </param> - <param> - <key>ant6</key> - <value></value> - </param> - <param> - <key>bw6</key> - <value>0</value> - </param> - <param> - <key>center_freq7</key> - <value>0</value> - </param> - <param> - <key>gain7</key> - <value>0</value> - </param> - <param> - <key>ant7</key> - <value></value> - </param> - <param> - <key>bw7</key> - <value>0</value> - </param> - <param> - <key>center_freq8</key> - <value>0</value> - </param> - <param> - <key>gain8</key> - <value>0</value> - </param> - <param> - <key>ant8</key> - <value></value> - </param> - <param> - <key>bw8</key> - <value>0</value> - </param> - <param> - <key>center_freq9</key> - <value>0</value> - </param> - <param> - <key>gain9</key> - <value>0</value> - </param> - <param> - <key>ant9</key> - <value></value> - </param> - <param> - <key>bw9</key> - <value>0</value> - </param> - <param> - <key>center_freq10</key> - <value>0</value> - </param> - <param> - <key>gain10</key> - <value>0</value> - </param> - <param> - <key>ant10</key> - <value></value> - </param> - <param> - <key>bw10</key> - <value>0</value> - </param> - <param> - <key>center_freq11</key> - <value>0</value> - </param> - <param> - <key>gain11</key> - <value>0</value> - </param> - <param> - <key>ant11</key> - <value></value> - </param> - <param> - <key>bw11</key> - <value>0</value> - </param> - <param> - <key>center_freq12</key> - <value>0</value> - </param> - <param> - <key>gain12</key> - <value>0</value> - </param> - <param> - <key>ant12</key> - <value></value> - </param> - <param> - <key>bw12</key> - <value>0</value> - </param> - <param> - <key>center_freq13</key> - <value>0</value> - </param> - <param> - <key>gain13</key> - <value>0</value> - </param> - <param> - <key>ant13</key> - <value></value> - </param> - <param> - <key>bw13</key> - <value>0</value> - </param> - <param> - <key>center_freq14</key> - <value>0</value> - </param> - <param> - <key>gain14</key> - <value>0</value> - </param> - <param> - <key>ant14</key> - <value></value> - </param> - <param> - <key>bw14</key> - <value>0</value> - </param> - <param> - <key>center_freq15</key> - <value>0</value> - </param> - <param> - <key>gain15</key> - <value>0</value> - </param> - <param> - <key>ant15</key> - <value></value> - </param> - <param> - <key>bw15</key> - <value>0</value> - </param> - <param> - <key>center_freq16</key> - <value>0</value> - </param> - <param> - <key>gain16</key> - <value>0</value> - </param> - <param> - <key>ant16</key> - <value></value> - </param> - <param> - <key>bw16</key> - <value>0</value> - </param> - <param> - <key>center_freq17</key> - <value>0</value> - </param> - <param> - <key>gain17</key> - <value>0</value> - </param> - <param> - <key>ant17</key> - <value></value> - </param> - <param> - <key>bw17</key> - <value>0</value> - </param> - <param> - <key>center_freq18</key> - <value>0</value> - </param> - <param> - <key>gain18</key> - <value>0</value> - </param> - <param> - <key>ant18</key> - <value></value> - </param> - <param> - <key>bw18</key> - <value>0</value> - </param> - <param> - <key>center_freq19</key> - <value>0</value> - </param> - <param> - <key>gain19</key> - <value>0</value> - </param> - <param> - <key>ant19</key> - <value></value> - </param> - <param> - <key>bw19</key> - <value>0</value> - </param> - <param> - <key>center_freq20</key> - <value>0</value> - </param> - <param> - <key>gain20</key> - <value>0</value> - </param> - <param> - <key>ant20</key> - <value></value> - </param> - <param> - <key>bw20</key> - <value>0</value> - </param> - <param> - <key>center_freq21</key> - <value>0</value> - </param> - <param> - <key>gain21</key> - <value>0</value> - </param> - <param> - <key>ant21</key> - <value></value> - </param> - <param> - <key>bw21</key> - <value>0</value> - </param> - <param> - <key>center_freq22</key> - <value>0</value> - </param> - <param> - <key>gain22</key> - <value>0</value> - </param> - <param> - <key>ant22</key> - <value></value> - </param> - <param> - <key>bw22</key> - <value>0</value> - </param> - <param> - <key>center_freq23</key> - <value>0</value> - </param> - <param> - <key>gain23</key> - <value>0</value> - </param> - <param> - <key>ant23</key> - <value></value> - </param> - <param> - <key>bw23</key> - <value>0</value> - </param> - <param> - <key>center_freq24</key> - <value>0</value> - </param> - <param> - <key>gain24</key> - <value>0</value> - </param> - <param> - <key>ant24</key> - <value></value> - </param> - <param> - <key>bw24</key> - <value>0</value> - </param> - <param> - <key>center_freq25</key> - <value>0</value> - </param> - <param> - <key>gain25</key> - <value>0</value> - </param> - <param> - <key>ant25</key> - <value></value> - </param> - <param> - <key>bw25</key> - <value>0</value> - </param> - <param> - <key>center_freq26</key> - <value>0</value> - </param> - <param> - <key>gain26</key> - <value>0</value> - </param> - <param> - <key>ant26</key> - <value></value> - </param> - <param> - <key>bw26</key> - <value>0</value> - </param> - <param> - <key>center_freq27</key> - <value>0</value> - </param> - <param> - <key>gain27</key> - <value>0</value> - </param> - <param> - <key>ant27</key> - <value></value> - </param> - <param> - <key>bw27</key> - <value>0</value> - </param> - <param> - <key>center_freq28</key> - <value>0</value> - </param> - <param> - <key>gain28</key> - <value>0</value> - </param> - <param> - <key>ant28</key> - <value></value> - </param> - <param> - <key>bw28</key> - <value>0</value> - </param> - <param> - <key>center_freq29</key> - <value>0</value> - </param> - <param> - <key>gain29</key> - <value>0</value> - </param> - <param> - <key>ant29</key> - <value></value> - </param> - <param> - <key>bw29</key> - <value>0</value> - </param> - <param> - <key>center_freq30</key> - <value>0</value> - </param> - <param> - <key>gain30</key> - <value>0</value> - </param> - <param> - <key>ant30</key> - <value></value> - </param> - <param> - <key>bw30</key> - <value>0</value> - </param> - <param> - <key>center_freq31</key> - <value>0</value> - </param> - <param> - <key>gain31</key> - <value>0</value> - </param> - <param> - <key>ant31</key> - <value></value> - </param> - <param> - <key>bw31</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(18, 276)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>digital_dxpsk_demod_0</source_block_id> - <sink_block_id>gr_null_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>digital_dxpsk_demod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>wxgui_constellationsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-uhd/examples/grc/uhd_two_tone_loopback.grc b/gr-uhd/examples/grc/uhd_two_tone_loopback.grc deleted file mode 100644 index 8bcbc0792..000000000 --- a/gr-uhd/examples/grc/uhd_two_tone_loopback.grc +++ /dev/null @@ -1,2204 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sat Oct 8 15:27:04 2011</timestamp> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>tx_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default TX Gain</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(999, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Frequency</value> - </param> - <param> - <key>value</key> - <value>2.45e9</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>f</value> - </param> - <param> - <key>_coordinate</key> - <value>(665, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>freq_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Rx Frequency Offset</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>o</value> - </param> - <param> - <key>_coordinate</key> - <value>(820, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>address1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>IP Address, Dev 1</value> - </param> - <param> - <key>value</key> - <value>addr=192.168.11.2</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(353, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>address0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>IP Address, Dev 0</value> - </param> - <param> - <key>value</key> - <value>addr=192.168.10.2</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(193, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>tone1</value> - </param> - <param> - <key>amp</key> - <value>tone_ampl</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(258, 136)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>tone2</value> - </param> - <param> - <key>amp</key> - <value>tone_ampl</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(259, 248)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noise_ampl</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(279, 364)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>uhd_usrp_sink</key> - <param> - <key>id</key> - <value>uhd_usrp_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>dev_addr</key> - <value>address0</value> - </param> - <param> - <key>sync</key> - <value></value> - </param> - <param> - <key>clock_rate</key> - <value>0.0</value> - </param> - <param> - <key>num_mboards</key> - <value>1</value> - </param> - <param> - <key>ref_source0</key> - <value></value> - </param> - <param> - <key>sd_spec0</key> - <value></value> - </param> - <param> - <key>ref_source1</key> - <value></value> - </param> - <param> - <key>sd_spec1</key> - <value></value> - </param> - <param> - <key>ref_source2</key> - <value></value> - </param> - <param> - <key>sd_spec2</key> - <value></value> - </param> - <param> - <key>ref_source3</key> - <value></value> - </param> - <param> - <key>sd_spec3</key> - <value></value> - </param> - <param> - <key>ref_source4</key> - <value></value> - </param> - <param> - <key>sd_spec4</key> - <value></value> - </param> - <param> - <key>ref_source5</key> - <value></value> - </param> - <param> - <key>sd_spec5</key> - <value></value> - </param> - <param> - <key>ref_source6</key> - <value></value> - </param> - <param> - <key>sd_spec6</key> - <value></value> - </param> - <param> - <key>ref_source7</key> - <value></value> - </param> - <param> - <key>sd_spec7</key> - <value></value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>center_freq0</key> - <value>tun_freq</value> - </param> - <param> - <key>gain0</key> - <value>tun_rx_gain</value> - </param> - <param> - <key>ant0</key> - <value></value> - </param> - <param> - <key>bw0</key> - <value>0</value> - </param> - <param> - <key>center_freq1</key> - <value>0</value> - </param> - <param> - <key>gain1</key> - <value>0</value> - </param> - <param> - <key>ant1</key> - <value></value> - </param> - <param> - <key>bw1</key> - <value>0</value> - </param> - <param> - <key>center_freq2</key> - <value>0</value> - </param> - <param> - <key>gain2</key> - <value>0</value> - </param> - <param> - <key>ant2</key> - <value></value> - </param> - <param> - <key>bw2</key> - <value>0</value> - </param> - <param> - <key>center_freq3</key> - <value>0</value> - </param> - <param> - <key>gain3</key> - <value>0</value> - </param> - <param> - <key>ant3</key> - <value></value> - </param> - <param> - <key>bw3</key> - <value>0</value> - </param> - <param> - <key>center_freq4</key> - <value>0</value> - </param> - <param> - <key>gain4</key> - <value>0</value> - </param> - <param> - <key>ant4</key> - <value></value> - </param> - <param> - <key>bw4</key> - <value>0</value> - </param> - <param> - <key>center_freq5</key> - <value>0</value> - </param> - <param> - <key>gain5</key> - <value>0</value> - </param> - <param> - <key>ant5</key> - <value></value> - </param> - <param> - <key>bw5</key> - <value>0</value> - </param> - <param> - <key>center_freq6</key> - <value>0</value> - </param> - <param> - <key>gain6</key> - <value>0</value> - </param> - <param> - <key>ant6</key> - <value></value> - </param> - <param> - <key>bw6</key> - <value>0</value> - </param> - <param> - <key>center_freq7</key> - <value>0</value> - </param> - <param> - <key>gain7</key> - <value>0</value> - </param> - <param> - <key>ant7</key> - <value></value> - </param> - <param> - <key>bw7</key> - <value>0</value> - </param> - <param> - <key>center_freq8</key> - <value>0</value> - </param> - <param> - <key>gain8</key> - <value>0</value> - </param> - <param> - <key>ant8</key> - <value></value> - </param> - <param> - <key>bw8</key> - <value>0</value> - </param> - <param> - <key>center_freq9</key> - <value>0</value> - </param> - <param> - <key>gain9</key> - <value>0</value> - </param> - <param> - <key>ant9</key> - <value></value> - </param> - <param> - <key>bw9</key> - <value>0</value> - </param> - <param> - <key>center_freq10</key> - <value>0</value> - </param> - <param> - <key>gain10</key> - <value>0</value> - </param> - <param> - <key>ant10</key> - <value></value> - </param> - <param> - <key>bw10</key> - <value>0</value> - </param> - <param> - <key>center_freq11</key> - <value>0</value> - </param> - <param> - <key>gain11</key> - <value>0</value> - </param> - <param> - <key>ant11</key> - <value></value> - </param> - <param> - <key>bw11</key> - <value>0</value> - </param> - <param> - <key>center_freq12</key> - <value>0</value> - </param> - <param> - <key>gain12</key> - <value>0</value> - </param> - <param> - <key>ant12</key> - <value></value> - </param> - <param> - <key>bw12</key> - <value>0</value> - </param> - <param> - <key>center_freq13</key> - <value>0</value> - </param> - <param> - <key>gain13</key> - <value>0</value> - </param> - <param> - <key>ant13</key> - <value></value> - </param> - <param> - <key>bw13</key> - <value>0</value> - </param> - <param> - <key>center_freq14</key> - <value>0</value> - </param> - <param> - <key>gain14</key> - <value>0</value> - </param> - <param> - <key>ant14</key> - <value></value> - </param> - <param> - <key>bw14</key> - <value>0</value> - </param> - <param> - <key>center_freq15</key> - <value>0</value> - </param> - <param> - <key>gain15</key> - <value>0</value> - </param> - <param> - <key>ant15</key> - <value></value> - </param> - <param> - <key>bw15</key> - <value>0</value> - </param> - <param> - <key>center_freq16</key> - <value>0</value> - </param> - <param> - <key>gain16</key> - <value>0</value> - </param> - <param> - <key>ant16</key> - <value></value> - </param> - <param> - <key>bw16</key> - <value>0</value> - </param> - <param> - <key>center_freq17</key> - <value>0</value> - </param> - <param> - <key>gain17</key> - <value>0</value> - </param> - <param> - <key>ant17</key> - <value></value> - </param> - <param> - <key>bw17</key> - <value>0</value> - </param> - <param> - <key>center_freq18</key> - <value>0</value> - </param> - <param> - <key>gain18</key> - <value>0</value> - </param> - <param> - <key>ant18</key> - <value></value> - </param> - <param> - <key>bw18</key> - <value>0</value> - </param> - <param> - <key>center_freq19</key> - <value>0</value> - </param> - <param> - <key>gain19</key> - <value>0</value> - </param> - <param> - <key>ant19</key> - <value></value> - </param> - <param> - <key>bw19</key> - <value>0</value> - </param> - <param> - <key>center_freq20</key> - <value>0</value> - </param> - <param> - <key>gain20</key> - <value>0</value> - </param> - <param> - <key>ant20</key> - <value></value> - </param> - <param> - <key>bw20</key> - <value>0</value> - </param> - <param> - <key>center_freq21</key> - <value>0</value> - </param> - <param> - <key>gain21</key> - <value>0</value> - </param> - <param> - <key>ant21</key> - <value></value> - </param> - <param> - <key>bw21</key> - <value>0</value> - </param> - <param> - <key>center_freq22</key> - <value>0</value> - </param> - <param> - <key>gain22</key> - <value>0</value> - </param> - <param> - <key>ant22</key> - <value></value> - </param> - <param> - <key>bw22</key> - <value>0</value> - </param> - <param> - <key>center_freq23</key> - <value>0</value> - </param> - <param> - <key>gain23</key> - <value>0</value> - </param> - <param> - <key>ant23</key> - <value></value> - </param> - <param> - <key>bw23</key> - <value>0</value> - </param> - <param> - <key>center_freq24</key> - <value>0</value> - </param> - <param> - <key>gain24</key> - <value>0</value> - </param> - <param> - <key>ant24</key> - <value></value> - </param> - <param> - <key>bw24</key> - <value>0</value> - </param> - <param> - <key>center_freq25</key> - <value>0</value> - </param> - <param> - <key>gain25</key> - <value>0</value> - </param> - <param> - <key>ant25</key> - <value></value> - </param> - <param> - <key>bw25</key> - <value>0</value> - </param> - <param> - <key>center_freq26</key> - <value>0</value> - </param> - <param> - <key>gain26</key> - <value>0</value> - </param> - <param> - <key>ant26</key> - <value></value> - </param> - <param> - <key>bw26</key> - <value>0</value> - </param> - <param> - <key>center_freq27</key> - <value>0</value> - </param> - <param> - <key>gain27</key> - <value>0</value> - </param> - <param> - <key>ant27</key> - <value></value> - </param> - <param> - <key>bw27</key> - <value>0</value> - </param> - <param> - <key>center_freq28</key> - <value>0</value> - </param> - <param> - <key>gain28</key> - <value>0</value> - </param> - <param> - <key>ant28</key> - <value></value> - </param> - <param> - <key>bw28</key> - <value>0</value> - </param> - <param> - <key>center_freq29</key> - <value>0</value> - </param> - <param> - <key>gain29</key> - <value>0</value> - </param> - <param> - <key>ant29</key> - <value></value> - </param> - <param> - <key>bw29</key> - <value>0</value> - </param> - <param> - <key>center_freq30</key> - <value>0</value> - </param> - <param> - <key>gain30</key> - <value>0</value> - </param> - <param> - <key>ant30</key> - <value></value> - </param> - <param> - <key>bw30</key> - <value>0</value> - </param> - <param> - <key>center_freq31</key> - <value>0</value> - </param> - <param> - <key>gain31</key> - <value>0</value> - </param> - <param> - <key>ant31</key> - <value></value> - </param> - <param> - <key>bw31</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(669, 178)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>rx_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default RX Gain</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1139, 12)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tone1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Tone 1</value> - </param> - <param> - <key>value</key> - <value>50e3</value> - </param> - <param> - <key>min</key> - <value>-samp_rate/2</value> - </param> - <param> - <key>max</key> - <value>samp_rate/2</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 4</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(161, 484)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tone2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Tone 2</value> - </param> - <param> - <key>value</key> - <value>75e3</value> - </param> - <param> - <key>min</key> - <value>-samp_rate/2</value> - </param> - <param> - <key>max</key> - <value>samp_rate/2</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 4, 1, 4</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(308, 483)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_tx_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>UHD TX Gain</value> - </param> - <param> - <key>value</key> - <value>tx_gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>20</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(655, 486)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Freq (Hz)</value> - </param> - <param> - <key>value</key> - <value>freq</value> - </param> - <param> - <key>min</key> - <value>2.4e9</value> - </param> - <param> - <key>max</key> - <value>2.5e9</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(514, 487)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_rx_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>UHD RX Gain</value> - </param> - <param> - <key>value</key> - <value>rx_gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>20</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(781, 487)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>uhd_usrp_source</key> - <param> - <key>id</key> - <value>uhd_usrp_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>dev_addr</key> - <value>address1</value> - </param> - <param> - <key>sync</key> - <value></value> - </param> - <param> - <key>clock_rate</key> - <value>0.0</value> - </param> - <param> - <key>num_mboards</key> - <value>1</value> - </param> - <param> - <key>ref_source0</key> - <value></value> - </param> - <param> - <key>sd_spec0</key> - <value></value> - </param> - <param> - <key>ref_source1</key> - <value></value> - </param> - <param> - <key>sd_spec1</key> - <value></value> - </param> - <param> - <key>ref_source2</key> - <value></value> - </param> - <param> - <key>sd_spec2</key> - <value></value> - </param> - <param> - <key>ref_source3</key> - <value></value> - </param> - <param> - <key>sd_spec3</key> - <value></value> - </param> - <param> - <key>ref_source4</key> - <value></value> - </param> - <param> - <key>sd_spec4</key> - <value></value> - </param> - <param> - <key>ref_source5</key> - <value></value> - </param> - <param> - <key>sd_spec5</key> - <value></value> - </param> - <param> - <key>ref_source6</key> - <value></value> - </param> - <param> - <key>sd_spec6</key> - <value></value> - </param> - <param> - <key>ref_source7</key> - <value></value> - </param> - <param> - <key>sd_spec7</key> - <value></value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>center_freq0</key> - <value>tun_freq</value> - </param> - <param> - <key>gain0</key> - <value>tun_rx_gain</value> - </param> - <param> - <key>ant0</key> - <value></value> - </param> - <param> - <key>bw0</key> - <value>0</value> - </param> - <param> - <key>center_freq1</key> - <value>0</value> - </param> - <param> - <key>gain1</key> - <value>0</value> - </param> - <param> - <key>ant1</key> - <value></value> - </param> - <param> - <key>bw1</key> - <value>0</value> - </param> - <param> - <key>center_freq2</key> - <value>0</value> - </param> - <param> - <key>gain2</key> - <value>0</value> - </param> - <param> - <key>ant2</key> - <value></value> - </param> - <param> - <key>bw2</key> - <value>0</value> - </param> - <param> - <key>center_freq3</key> - <value>0</value> - </param> - <param> - <key>gain3</key> - <value>0</value> - </param> - <param> - <key>ant3</key> - <value></value> - </param> - <param> - <key>bw3</key> - <value>0</value> - </param> - <param> - <key>center_freq4</key> - <value>0</value> - </param> - <param> - <key>gain4</key> - <value>0</value> - </param> - <param> - <key>ant4</key> - <value></value> - </param> - <param> - <key>bw4</key> - <value>0</value> - </param> - <param> - <key>center_freq5</key> - <value>0</value> - </param> - <param> - <key>gain5</key> - <value>0</value> - </param> - <param> - <key>ant5</key> - <value></value> - </param> - <param> - <key>bw5</key> - <value>0</value> - </param> - <param> - <key>center_freq6</key> - <value>0</value> - </param> - <param> - <key>gain6</key> - <value>0</value> - </param> - <param> - <key>ant6</key> - <value></value> - </param> - <param> - <key>bw6</key> - <value>0</value> - </param> - <param> - <key>center_freq7</key> - <value>0</value> - </param> - <param> - <key>gain7</key> - <value>0</value> - </param> - <param> - <key>ant7</key> - <value></value> - </param> - <param> - <key>bw7</key> - <value>0</value> - </param> - <param> - <key>center_freq8</key> - <value>0</value> - </param> - <param> - <key>gain8</key> - <value>0</value> - </param> - <param> - <key>ant8</key> - <value></value> - </param> - <param> - <key>bw8</key> - <value>0</value> - </param> - <param> - <key>center_freq9</key> - <value>0</value> - </param> - <param> - <key>gain9</key> - <value>0</value> - </param> - <param> - <key>ant9</key> - <value></value> - </param> - <param> - <key>bw9</key> - <value>0</value> - </param> - <param> - <key>center_freq10</key> - <value>0</value> - </param> - <param> - <key>gain10</key> - <value>0</value> - </param> - <param> - <key>ant10</key> - <value></value> - </param> - <param> - <key>bw10</key> - <value>0</value> - </param> - <param> - <key>center_freq11</key> - <value>0</value> - </param> - <param> - <key>gain11</key> - <value>0</value> - </param> - <param> - <key>ant11</key> - <value></value> - </param> - <param> - <key>bw11</key> - <value>0</value> - </param> - <param> - <key>center_freq12</key> - <value>0</value> - </param> - <param> - <key>gain12</key> - <value>0</value> - </param> - <param> - <key>ant12</key> - <value></value> - </param> - <param> - <key>bw12</key> - <value>0</value> - </param> - <param> - <key>center_freq13</key> - <value>0</value> - </param> - <param> - <key>gain13</key> - <value>0</value> - </param> - <param> - <key>ant13</key> - <value></value> - </param> - <param> - <key>bw13</key> - <value>0</value> - </param> - <param> - <key>center_freq14</key> - <value>0</value> - </param> - <param> - <key>gain14</key> - <value>0</value> - </param> - <param> - <key>ant14</key> - <value></value> - </param> - <param> - <key>bw14</key> - <value>0</value> - </param> - <param> - <key>center_freq15</key> - <value>0</value> - </param> - <param> - <key>gain15</key> - <value>0</value> - </param> - <param> - <key>ant15</key> - <value></value> - </param> - <param> - <key>bw15</key> - <value>0</value> - </param> - <param> - <key>center_freq16</key> - <value>0</value> - </param> - <param> - <key>gain16</key> - <value>0</value> - </param> - <param> - <key>ant16</key> - <value></value> - </param> - <param> - <key>bw16</key> - <value>0</value> - </param> - <param> - <key>center_freq17</key> - <value>0</value> - </param> - <param> - <key>gain17</key> - <value>0</value> - </param> - <param> - <key>ant17</key> - <value></value> - </param> - <param> - <key>bw17</key> - <value>0</value> - </param> - <param> - <key>center_freq18</key> - <value>0</value> - </param> - <param> - <key>gain18</key> - <value>0</value> - </param> - <param> - <key>ant18</key> - <value></value> - </param> - <param> - <key>bw18</key> - <value>0</value> - </param> - <param> - <key>center_freq19</key> - <value>0</value> - </param> - <param> - <key>gain19</key> - <value>0</value> - </param> - <param> - <key>ant19</key> - <value></value> - </param> - <param> - <key>bw19</key> - <value>0</value> - </param> - <param> - <key>center_freq20</key> - <value>0</value> - </param> - <param> - <key>gain20</key> - <value>0</value> - </param> - <param> - <key>ant20</key> - <value></value> - </param> - <param> - <key>bw20</key> - <value>0</value> - </param> - <param> - <key>center_freq21</key> - <value>0</value> - </param> - <param> - <key>gain21</key> - <value>0</value> - </param> - <param> - <key>ant21</key> - <value></value> - </param> - <param> - <key>bw21</key> - <value>0</value> - </param> - <param> - <key>center_freq22</key> - <value>0</value> - </param> - <param> - <key>gain22</key> - <value>0</value> - </param> - <param> - <key>ant22</key> - <value></value> - </param> - <param> - <key>bw22</key> - <value>0</value> - </param> - <param> - <key>center_freq23</key> - <value>0</value> - </param> - <param> - <key>gain23</key> - <value>0</value> - </param> - <param> - <key>ant23</key> - <value></value> - </param> - <param> - <key>bw23</key> - <value>0</value> - </param> - <param> - <key>center_freq24</key> - <value>0</value> - </param> - <param> - <key>gain24</key> - <value>0</value> - </param> - <param> - <key>ant24</key> - <value></value> - </param> - <param> - <key>bw24</key> - <value>0</value> - </param> - <param> - <key>center_freq25</key> - <value>0</value> - </param> - <param> - <key>gain25</key> - <value>0</value> - </param> - <param> - <key>ant25</key> - <value></value> - </param> - <param> - <key>bw25</key> - <value>0</value> - </param> - <param> - <key>center_freq26</key> - <value>0</value> - </param> - <param> - <key>gain26</key> - <value>0</value> - </param> - <param> - <key>ant26</key> - <value></value> - </param> - <param> - <key>bw26</key> - <value>0</value> - </param> - <param> - <key>center_freq27</key> - <value>0</value> - </param> - <param> - <key>gain27</key> - <value>0</value> - </param> - <param> - <key>ant27</key> - <value></value> - </param> - <param> - <key>bw27</key> - <value>0</value> - </param> - <param> - <key>center_freq28</key> - <value>0</value> - </param> - <param> - <key>gain28</key> - <value>0</value> - </param> - <param> - <key>ant28</key> - <value></value> - </param> - <param> - <key>bw28</key> - <value>0</value> - </param> - <param> - <key>center_freq29</key> - <value>0</value> - </param> - <param> - <key>gain29</key> - <value>0</value> - </param> - <param> - <key>ant29</key> - <value></value> - </param> - <param> - <key>bw29</key> - <value>0</value> - </param> - <param> - <key>center_freq30</key> - <value>0</value> - </param> - <param> - <key>gain30</key> - <value>0</value> - </param> - <param> - <key>ant30</key> - <value></value> - </param> - <param> - <key>bw30</key> - <value>0</value> - </param> - <param> - <key>center_freq31</key> - <value>0</value> - </param> - <param> - <key>gain31</key> - <value>0</value> - </param> - <param> - <key>ant31</key> - <value></value> - </param> - <param> - <key>bw31</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 320)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tone_ampl</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Tone Ampl</value> - </param> - <param> - <key>value</key> - <value>0.15</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_VERTICAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 2, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(14, 485)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>noise_ampl</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Noise Ampl</value> - </param> - <param> - <key>value</key> - <value>0.1</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_VERTICAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 1, 2, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(15, 335)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>3</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(529, 172)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>options</key> - <param> - <key>id</key> - <value>uhd_two_tone_loopback</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>UHD Loopback - 2 Tone</value> - </param> - <param> - <key>author</key> - <value>Example</value> - </param> - <param> - <key>description</key> - <value>Loopback test</value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>FFT Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>512*2</value> - </param> - <param> - <key>fft_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>window.blackmanharris</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1, 2, 2, 4</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1114, 264)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Sample Rate</value> - </param> - <param> - <key>value</key> - <value>500e3</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>s</value> - </param> - <param> - <key>_coordinate</key> - <value>(539, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_noise_source_x</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>2</sink_key> - </connection> - <connection> - <source_block_id>gr_sig_source_x0</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_sig_source_x</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx</source_block_id> - <sink_block_id>uhd_usrp_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>wxgui_fftsink2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-uhd/examples/grc/uhd_tx_dpsk.grc b/gr-uhd/examples/grc/uhd_tx_dpsk.grc deleted file mode 100644 index 281ba8429..000000000 --- a/gr-uhd/examples/grc/uhd_tx_dpsk.grc +++ /dev/null @@ -1,1234 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sat Oct 8 14:55:39 2011</timestamp> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samps_per_sym</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4</value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 100)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>ampl</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Amplitude</value> - </param> - <param> - <key>value</key> - <value>.1</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(7, 299)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Sample Rate</value> - </param> - <param> - <key>value</key> - <value>1e6</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>s</value> - </param> - <param> - <key>_coordinate</key> - <value>(334, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Frequency</value> - </param> - <param> - <key>value</key> - <value>2.45e9</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>f</value> - </param> - <param> - <key>_coordinate</key> - <value>(463, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>UHD Gain</value> - </param> - <param> - <key>value</key> - <value>gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>20</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(151, 441)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Freq (Hz)</value> - </param> - <param> - <key>value</key> - <value>freq</value> - </param> - <param> - <key>min</key> - <value>2.4e9</value> - </param> - <param> - <key>max</key> - <value>2.5e9</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(7, 441)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2**8</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(177, 162)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_dxpsk_mod</key> - <param> - <key>id</key> - <value>digital_dxpsk_mod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>dqpsk</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>samps_per_sym</value> - </param> - <param> - <key>excess_bw</key> - <value>0.35</value> - </param> - <param> - <key>gray_coded</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(366, 162)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Gain</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>g</value> - </param> - <param> - <key>_coordinate</key> - <value>(619, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>address</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>IP Address</value> - </param> - <param> - <key>value</key> - <value>addr=192.168.10.2</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value>a</value> - </param> - <param> - <key>_coordinate</key> - <value>(177, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>uhd_usrp_sink</key> - <param> - <key>id</key> - <value>uhd_usrp_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>dev_addr</key> - <value>address</value> - </param> - <param> - <key>sync</key> - <value></value> - </param> - <param> - <key>clock_rate</key> - <value>0.0</value> - </param> - <param> - <key>num_mboards</key> - <value>1</value> - </param> - <param> - <key>ref_source0</key> - <value></value> - </param> - <param> - <key>sd_spec0</key> - <value></value> - </param> - <param> - <key>ref_source1</key> - <value></value> - </param> - <param> - <key>sd_spec1</key> - <value></value> - </param> - <param> - <key>ref_source2</key> - <value></value> - </param> - <param> - <key>sd_spec2</key> - <value></value> - </param> - <param> - <key>ref_source3</key> - <value></value> - </param> - <param> - <key>sd_spec3</key> - <value></value> - </param> - <param> - <key>ref_source4</key> - <value></value> - </param> - <param> - <key>sd_spec4</key> - <value></value> - </param> - <param> - <key>ref_source5</key> - <value></value> - </param> - <param> - <key>sd_spec5</key> - <value></value> - </param> - <param> - <key>ref_source6</key> - <value></value> - </param> - <param> - <key>sd_spec6</key> - <value></value> - </param> - <param> - <key>ref_source7</key> - <value></value> - </param> - <param> - <key>sd_spec7</key> - <value></value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>center_freq0</key> - <value>tun_freq</value> - </param> - <param> - <key>gain0</key> - <value>tun_gain</value> - </param> - <param> - <key>ant0</key> - <value></value> - </param> - <param> - <key>bw0</key> - <value>0</value> - </param> - <param> - <key>center_freq1</key> - <value>0</value> - </param> - <param> - <key>gain1</key> - <value>0</value> - </param> - <param> - <key>ant1</key> - <value></value> - </param> - <param> - <key>bw1</key> - <value>0</value> - </param> - <param> - <key>center_freq2</key> - <value>0</value> - </param> - <param> - <key>gain2</key> - <value>0</value> - </param> - <param> - <key>ant2</key> - <value></value> - </param> - <param> - <key>bw2</key> - <value>0</value> - </param> - <param> - <key>center_freq3</key> - <value>0</value> - </param> - <param> - <key>gain3</key> - <value>0</value> - </param> - <param> - <key>ant3</key> - <value></value> - </param> - <param> - <key>bw3</key> - <value>0</value> - </param> - <param> - <key>center_freq4</key> - <value>0</value> - </param> - <param> - <key>gain4</key> - <value>0</value> - </param> - <param> - <key>ant4</key> - <value></value> - </param> - <param> - <key>bw4</key> - <value>0</value> - </param> - <param> - <key>center_freq5</key> - <value>0</value> - </param> - <param> - <key>gain5</key> - <value>0</value> - </param> - <param> - <key>ant5</key> - <value></value> - </param> - <param> - <key>bw5</key> - <value>0</value> - </param> - <param> - <key>center_freq6</key> - <value>0</value> - </param> - <param> - <key>gain6</key> - <value>0</value> - </param> - <param> - <key>ant6</key> - <value></value> - </param> - <param> - <key>bw6</key> - <value>0</value> - </param> - <param> - <key>center_freq7</key> - <value>0</value> - </param> - <param> - <key>gain7</key> - <value>0</value> - </param> - <param> - <key>ant7</key> - <value></value> - </param> - <param> - <key>bw7</key> - <value>0</value> - </param> - <param> - <key>center_freq8</key> - <value>0</value> - </param> - <param> - <key>gain8</key> - <value>0</value> - </param> - <param> - <key>ant8</key> - <value></value> - </param> - <param> - <key>bw8</key> - <value>0</value> - </param> - <param> - <key>center_freq9</key> - <value>0</value> - </param> - <param> - <key>gain9</key> - <value>0</value> - </param> - <param> - <key>ant9</key> - <value></value> - </param> - <param> - <key>bw9</key> - <value>0</value> - </param> - <param> - <key>center_freq10</key> - <value>0</value> - </param> - <param> - <key>gain10</key> - <value>0</value> - </param> - <param> - <key>ant10</key> - <value></value> - </param> - <param> - <key>bw10</key> - <value>0</value> - </param> - <param> - <key>center_freq11</key> - <value>0</value> - </param> - <param> - <key>gain11</key> - <value>0</value> - </param> - <param> - <key>ant11</key> - <value></value> - </param> - <param> - <key>bw11</key> - <value>0</value> - </param> - <param> - <key>center_freq12</key> - <value>0</value> - </param> - <param> - <key>gain12</key> - <value>0</value> - </param> - <param> - <key>ant12</key> - <value></value> - </param> - <param> - <key>bw12</key> - <value>0</value> - </param> - <param> - <key>center_freq13</key> - <value>0</value> - </param> - <param> - <key>gain13</key> - <value>0</value> - </param> - <param> - <key>ant13</key> - <value></value> - </param> - <param> - <key>bw13</key> - <value>0</value> - </param> - <param> - <key>center_freq14</key> - <value>0</value> - </param> - <param> - <key>gain14</key> - <value>0</value> - </param> - <param> - <key>ant14</key> - <value></value> - </param> - <param> - <key>bw14</key> - <value>0</value> - </param> - <param> - <key>center_freq15</key> - <value>0</value> - </param> - <param> - <key>gain15</key> - <value>0</value> - </param> - <param> - <key>ant15</key> - <value></value> - </param> - <param> - <key>bw15</key> - <value>0</value> - </param> - <param> - <key>center_freq16</key> - <value>0</value> - </param> - <param> - <key>gain16</key> - <value>0</value> - </param> - <param> - <key>ant16</key> - <value></value> - </param> - <param> - <key>bw16</key> - <value>0</value> - </param> - <param> - <key>center_freq17</key> - <value>0</value> - </param> - <param> - <key>gain17</key> - <value>0</value> - </param> - <param> - <key>ant17</key> - <value></value> - </param> - <param> - <key>bw17</key> - <value>0</value> - </param> - <param> - <key>center_freq18</key> - <value>0</value> - </param> - <param> - <key>gain18</key> - <value>0</value> - </param> - <param> - <key>ant18</key> - <value></value> - </param> - <param> - <key>bw18</key> - <value>0</value> - </param> - <param> - <key>center_freq19</key> - <value>0</value> - </param> - <param> - <key>gain19</key> - <value>0</value> - </param> - <param> - <key>ant19</key> - <value></value> - </param> - <param> - <key>bw19</key> - <value>0</value> - </param> - <param> - <key>center_freq20</key> - <value>0</value> - </param> - <param> - <key>gain20</key> - <value>0</value> - </param> - <param> - <key>ant20</key> - <value></value> - </param> - <param> - <key>bw20</key> - <value>0</value> - </param> - <param> - <key>center_freq21</key> - <value>0</value> - </param> - <param> - <key>gain21</key> - <value>0</value> - </param> - <param> - <key>ant21</key> - <value></value> - </param> - <param> - <key>bw21</key> - <value>0</value> - </param> - <param> - <key>center_freq22</key> - <value>0</value> - </param> - <param> - <key>gain22</key> - <value>0</value> - </param> - <param> - <key>ant22</key> - <value></value> - </param> - <param> - <key>bw22</key> - <value>0</value> - </param> - <param> - <key>center_freq23</key> - <value>0</value> - </param> - <param> - <key>gain23</key> - <value>0</value> - </param> - <param> - <key>ant23</key> - <value></value> - </param> - <param> - <key>bw23</key> - <value>0</value> - </param> - <param> - <key>center_freq24</key> - <value>0</value> - </param> - <param> - <key>gain24</key> - <value>0</value> - </param> - <param> - <key>ant24</key> - <value></value> - </param> - <param> - <key>bw24</key> - <value>0</value> - </param> - <param> - <key>center_freq25</key> - <value>0</value> - </param> - <param> - <key>gain25</key> - <value>0</value> - </param> - <param> - <key>ant25</key> - <value></value> - </param> - <param> - <key>bw25</key> - <value>0</value> - </param> - <param> - <key>center_freq26</key> - <value>0</value> - </param> - <param> - <key>gain26</key> - <value>0</value> - </param> - <param> - <key>ant26</key> - <value></value> - </param> - <param> - <key>bw26</key> - <value>0</value> - </param> - <param> - <key>center_freq27</key> - <value>0</value> - </param> - <param> - <key>gain27</key> - <value>0</value> - </param> - <param> - <key>ant27</key> - <value></value> - </param> - <param> - <key>bw27</key> - <value>0</value> - </param> - <param> - <key>center_freq28</key> - <value>0</value> - </param> - <param> - <key>gain28</key> - <value>0</value> - </param> - <param> - <key>ant28</key> - <value></value> - </param> - <param> - <key>bw28</key> - <value>0</value> - </param> - <param> - <key>center_freq29</key> - <value>0</value> - </param> - <param> - <key>gain29</key> - <value>0</value> - </param> - <param> - <key>ant29</key> - <value></value> - </param> - <param> - <key>bw29</key> - <value>0</value> - </param> - <param> - <key>center_freq30</key> - <value>0</value> - </param> - <param> - <key>gain30</key> - <value>0</value> - </param> - <param> - <key>ant30</key> - <value></value> - </param> - <param> - <key>bw30</key> - <value>0</value> - </param> - <param> - <key>center_freq31</key> - <value>0</value> - </param> - <param> - <key>gain31</key> - <value>0</value> - </param> - <param> - <key>ant31</key> - <value></value> - </param> - <param> - <key>bw31</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(783, 162)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>ampl</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(566, 186)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Transmit Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>tun_freq</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>ref_scale</key> - <value>2</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>20</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(827, 299)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>options</key> - <param> - <key>id</key> - <value>uhd_tx_dpsk</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>UHD TX DPSK</value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>digital_dxpsk_mod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>uhd_usrp_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_dxpsk_mod_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-uhd/examples/grc/uhd_wbfm_receive.grc b/gr-uhd/examples/grc/uhd_wbfm_receive.grc deleted file mode 100644 index 7f14123f2..000000000 --- a/gr-uhd/examples/grc/uhd_wbfm_receive.grc +++ /dev/null @@ -1,1405 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Tue Apr 24 16:59:09 2012</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>uhd_wbfm_receive</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>UHD WBFM Receive</value> - </param> - <param> - <key>author</key> - <value>Example</value> - </param> - <param> - <key>description</key> - <value>WBFM Receive</value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Gain</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>g</value> - </param> - <param> - <key>_coordinate</key> - <value>(631, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Default Frequency</value> - </param> - <param> - <key>value</key> - <value>93.3e6</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>f</value> - </param> - <param> - <key>_coordinate</key> - <value>(479, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Freq (Hz)</value> - </param> - <param> - <key>value</key> - <value>freq</value> - </param> - <param> - <key>min</key> - <value>87.9e6</value> - </param> - <param> - <key>max</key> - <value>108.1e6</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(15, 441)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>fine</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Fine Freq (MHz)</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>-.1</value> - </param> - <param> - <key>max</key> - <value>.1</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 2, 1, 2</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(277, 444)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>tun_gain</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>UHD Gain</value> - </param> - <param> - <key>value</key> - <value>gain</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>20</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(158, 440)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>volume</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Volume</value> - </param> - <param> - <key>value</key> - <value>1</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>10</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 4</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(436, 446)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>const</key> - <value>volume</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(836, 161)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>uhd_usrp_source</key> - <param> - <key>id</key> - <value>uhd_usrp_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>fc32</value> - </param> - <param> - <key>otw</key> - <value></value> - </param> - <param> - <key>stream_args</key> - <value></value> - </param> - <param> - <key>dev_addr</key> - <value>address</value> - </param> - <param> - <key>sync</key> - <value></value> - </param> - <param> - <key>clock_rate</key> - <value>0.0</value> - </param> - <param> - <key>num_mboards</key> - <value>1</value> - </param> - <param> - <key>clock_source0</key> - <value></value> - </param> - <param> - <key>time_source0</key> - <value></value> - </param> - <param> - <key>sd_spec0</key> - <value></value> - </param> - <param> - <key>clock_source1</key> - <value></value> - </param> - <param> - <key>time_source1</key> - <value></value> - </param> - <param> - <key>sd_spec1</key> - <value></value> - </param> - <param> - <key>clock_source2</key> - <value></value> - </param> - <param> - <key>time_source2</key> - <value></value> - </param> - <param> - <key>sd_spec2</key> - <value></value> - </param> - <param> - <key>clock_source3</key> - <value></value> - </param> - <param> - <key>time_source3</key> - <value></value> - </param> - <param> - <key>sd_spec3</key> - <value></value> - </param> - <param> - <key>clock_source4</key> - <value></value> - </param> - <param> - <key>time_source4</key> - <value></value> - </param> - <param> - <key>sd_spec4</key> - <value></value> - </param> - <param> - <key>clock_source5</key> - <value></value> - </param> - <param> - <key>time_source5</key> - <value></value> - </param> - <param> - <key>sd_spec5</key> - <value></value> - </param> - <param> - <key>clock_source6</key> - <value></value> - </param> - <param> - <key>time_source6</key> - <value></value> - </param> - <param> - <key>sd_spec6</key> - <value></value> - </param> - <param> - <key>clock_source7</key> - <value></value> - </param> - <param> - <key>time_source7</key> - <value></value> - </param> - <param> - <key>sd_spec7</key> - <value></value> - </param> - <param> - <key>nchan</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>center_freq0</key> - <value>tun_freq+fine</value> - </param> - <param> - <key>gain0</key> - <value>tun_gain</value> - </param> - <param> - <key>ant0</key> - <value></value> - </param> - <param> - <key>bw0</key> - <value>0</value> - </param> - <param> - <key>center_freq1</key> - <value>0</value> - </param> - <param> - <key>gain1</key> - <value>0</value> - </param> - <param> - <key>ant1</key> - <value></value> - </param> - <param> - <key>bw1</key> - <value>0</value> - </param> - <param> - <key>center_freq2</key> - <value>0</value> - </param> - <param> - <key>gain2</key> - <value>0</value> - </param> - <param> - <key>ant2</key> - <value></value> - </param> - <param> - <key>bw2</key> - <value>0</value> - </param> - <param> - <key>center_freq3</key> - <value>0</value> - </param> - <param> - <key>gain3</key> - <value>0</value> - </param> - <param> - <key>ant3</key> - <value></value> - </param> - <param> - <key>bw3</key> - <value>0</value> - </param> - <param> - <key>center_freq4</key> - <value>0</value> - </param> - <param> - <key>gain4</key> - <value>0</value> - </param> - <param> - <key>ant4</key> - <value></value> - </param> - <param> - <key>bw4</key> - <value>0</value> - </param> - <param> - <key>center_freq5</key> - <value>0</value> - </param> - <param> - <key>gain5</key> - <value>0</value> - </param> - <param> - <key>ant5</key> - <value></value> - </param> - <param> - <key>bw5</key> - <value>0</value> - </param> - <param> - <key>center_freq6</key> - <value>0</value> - </param> - <param> - <key>gain6</key> - <value>0</value> - </param> - <param> - <key>ant6</key> - <value></value> - </param> - <param> - <key>bw6</key> - <value>0</value> - </param> - <param> - <key>center_freq7</key> - <value>0</value> - </param> - <param> - <key>gain7</key> - <value>0</value> - </param> - <param> - <key>ant7</key> - <value></value> - </param> - <param> - <key>bw7</key> - <value>0</value> - </param> - <param> - <key>center_freq8</key> - <value>0</value> - </param> - <param> - <key>gain8</key> - <value>0</value> - </param> - <param> - <key>ant8</key> - <value></value> - </param> - <param> - <key>bw8</key> - <value>0</value> - </param> - <param> - <key>center_freq9</key> - <value>0</value> - </param> - <param> - <key>gain9</key> - <value>0</value> - </param> - <param> - <key>ant9</key> - <value></value> - </param> - <param> - <key>bw9</key> - <value>0</value> - </param> - <param> - <key>center_freq10</key> - <value>0</value> - </param> - <param> - <key>gain10</key> - <value>0</value> - </param> - <param> - <key>ant10</key> - <value></value> - </param> - <param> - <key>bw10</key> - <value>0</value> - </param> - <param> - <key>center_freq11</key> - <value>0</value> - </param> - <param> - <key>gain11</key> - <value>0</value> - </param> - <param> - <key>ant11</key> - <value></value> - </param> - <param> - <key>bw11</key> - <value>0</value> - </param> - <param> - <key>center_freq12</key> - <value>0</value> - </param> - <param> - <key>gain12</key> - <value>0</value> - </param> - <param> - <key>ant12</key> - <value></value> - </param> - <param> - <key>bw12</key> - <value>0</value> - </param> - <param> - <key>center_freq13</key> - <value>0</value> - </param> - <param> - <key>gain13</key> - <value>0</value> - </param> - <param> - <key>ant13</key> - <value></value> - </param> - <param> - <key>bw13</key> - <value>0</value> - </param> - <param> - <key>center_freq14</key> - <value>0</value> - </param> - <param> - <key>gain14</key> - <value>0</value> - </param> - <param> - <key>ant14</key> - <value></value> - </param> - <param> - <key>bw14</key> - <value>0</value> - </param> - <param> - <key>center_freq15</key> - <value>0</value> - </param> - <param> - <key>gain15</key> - <value>0</value> - </param> - <param> - <key>ant15</key> - <value></value> - </param> - <param> - <key>bw15</key> - <value>0</value> - </param> - <param> - <key>center_freq16</key> - <value>0</value> - </param> - <param> - <key>gain16</key> - <value>0</value> - </param> - <param> - <key>ant16</key> - <value></value> - </param> - <param> - <key>bw16</key> - <value>0</value> - </param> - <param> - <key>center_freq17</key> - <value>0</value> - </param> - <param> - <key>gain17</key> - <value>0</value> - </param> - <param> - <key>ant17</key> - <value></value> - </param> - <param> - <key>bw17</key> - <value>0</value> - </param> - <param> - <key>center_freq18</key> - <value>0</value> - </param> - <param> - <key>gain18</key> - <value>0</value> - </param> - <param> - <key>ant18</key> - <value></value> - </param> - <param> - <key>bw18</key> - <value>0</value> - </param> - <param> - <key>center_freq19</key> - <value>0</value> - </param> - <param> - <key>gain19</key> - <value>0</value> - </param> - <param> - <key>ant19</key> - <value></value> - </param> - <param> - <key>bw19</key> - <value>0</value> - </param> - <param> - <key>center_freq20</key> - <value>0</value> - </param> - <param> - <key>gain20</key> - <value>0</value> - </param> - <param> - <key>ant20</key> - <value></value> - </param> - <param> - <key>bw20</key> - <value>0</value> - </param> - <param> - <key>center_freq21</key> - <value>0</value> - </param> - <param> - <key>gain21</key> - <value>0</value> - </param> - <param> - <key>ant21</key> - <value></value> - </param> - <param> - <key>bw21</key> - <value>0</value> - </param> - <param> - <key>center_freq22</key> - <value>0</value> - </param> - <param> - <key>gain22</key> - <value>0</value> - </param> - <param> - <key>ant22</key> - <value></value> - </param> - <param> - <key>bw22</key> - <value>0</value> - </param> - <param> - <key>center_freq23</key> - <value>0</value> - </param> - <param> - <key>gain23</key> - <value>0</value> - </param> - <param> - <key>ant23</key> - <value></value> - </param> - <param> - <key>bw23</key> - <value>0</value> - </param> - <param> - <key>center_freq24</key> - <value>0</value> - </param> - <param> - <key>gain24</key> - <value>0</value> - </param> - <param> - <key>ant24</key> - <value></value> - </param> - <param> - <key>bw24</key> - <value>0</value> - </param> - <param> - <key>center_freq25</key> - <value>0</value> - </param> - <param> - <key>gain25</key> - <value>0</value> - </param> - <param> - <key>ant25</key> - <value></value> - </param> - <param> - <key>bw25</key> - <value>0</value> - </param> - <param> - <key>center_freq26</key> - <value>0</value> - </param> - <param> - <key>gain26</key> - <value>0</value> - </param> - <param> - <key>ant26</key> - <value></value> - </param> - <param> - <key>bw26</key> - <value>0</value> - </param> - <param> - <key>center_freq27</key> - <value>0</value> - </param> - <param> - <key>gain27</key> - <value>0</value> - </param> - <param> - <key>ant27</key> - <value></value> - </param> - <param> - <key>bw27</key> - <value>0</value> - </param> - <param> - <key>center_freq28</key> - <value>0</value> - </param> - <param> - <key>gain28</key> - <value>0</value> - </param> - <param> - <key>ant28</key> - <value></value> - </param> - <param> - <key>bw28</key> - <value>0</value> - </param> - <param> - <key>center_freq29</key> - <value>0</value> - </param> - <param> - <key>gain29</key> - <value>0</value> - </param> - <param> - <key>ant29</key> - <value></value> - </param> - <param> - <key>bw29</key> - <value>0</value> - </param> - <param> - <key>center_freq30</key> - <value>0</value> - </param> - <param> - <key>gain30</key> - <value>0</value> - </param> - <param> - <key>ant30</key> - <value></value> - </param> - <param> - <key>bw30</key> - <value>0</value> - </param> - <param> - <key>center_freq31</key> - <value>0</value> - </param> - <param> - <key>gain31</key> - <value>0</value> - </param> - <param> - <key>ant31</key> - <value></value> - </param> - <param> - <key>bw31</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(14, 165)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>address</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>IP Address</value> - </param> - <param> - <key>value</key> - <value>addr=192.168.10.2</value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value>a</value> - </param> - <param> - <key>_coordinate</key> - <value>(199, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Sample Rate</value> - </param> - <param> - <key>value</key> - <value>400e3</value> - </param> - <param> - <key>type</key> - <value>eng_float</value> - </param> - <param> - <key>short_id</key> - <value>s</value> - </param> - <param> - <key>_coordinate</key> - <value>(352, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>parameter</key> - <param> - <key>id</key> - <value>audio_output</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Audio Output Device</value> - </param> - <param> - <key>value</key> - <value></value> - </param> - <param> - <key>type</key> - <value>string</value> - </param> - <param> - <key>short_id</key> - <value>O</value> - </param> - <param> - <key>_coordinate</key> - <value>(769, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>audio_sink</key> - <param> - <key>id</key> - <value>audio_sink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>samp_rate</key> - <value>int(samp_rate/audio_decim)</value> - </param> - <param> - <key>device_name</key> - <value>audio_output</value> - </param> - <param> - <key>ok_to_block</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1023, 161)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_wfm_rcv</key> - <param> - <key>id</key> - <value>blks2_wfm_rcv</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>quad_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>audio_decimation</key> - <value>audio_decim</value> - </param> - <param> - <key>_coordinate</key> - <value>(626, 153)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>low_pass_filter</key> - <param> - <key>id</key> - <value>low_pass_filter_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>fir_filter_ccf</value> - </param> - <param> - <key>decim</key> - <value>1</value> - </param> - <param> - <key>interp</key> - <value>1</value> - </param> - <param> - <key>gain</key> - <value>1</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>cutoff_freq</key> - <value>115e3</value> - </param> - <param> - <key>width</key> - <value>30e3</value> - </param> - <param> - <key>win</key> - <value>firdes.WIN_HANN</value> - </param> - <param> - <key>beta</key> - <value>6.76</value> - </param> - <param> - <key>_coordinate</key> - <value>(326, 141)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>audio_decim</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10</value> - </param> - <param> - <key>_coordinate</key> - <value>(19, 351)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>FFT Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>(freq+fine)</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>512</value> - </param> - <param> - <key>fft_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>2, 0, 2, 4</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(624, 278)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_multiply_const_vxx</source_block_id> - <sink_block_id>audio_sink</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_wfm_rcv</source_block_id> - <sink_block_id>gr_multiply_const_vxx</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>low_pass_filter_0</source_block_id> - <sink_block_id>blks2_wfm_rcv</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>low_pass_filter_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>low_pass_filter_0</source_block_id> - <sink_block_id>wxgui_fftsink2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-uhd/examples/python/CMakeLists.txt b/gr-uhd/examples/python/CMakeLists.txt deleted file mode 100644 index 7642b536b..000000000 --- a/gr-uhd/examples/python/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2011 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. - -include(GrPython) - -GR_PYTHON_INSTALL( - PROGRAMS - fm_tx4.py - fm_tx_2_daughterboards.py - max_power.py - usrp_am_mw_rcv.py - usrp_nbfm_ptt.py - usrp_nbfm_rcv.py - usrp_spectrum_sense.py - usrp_tv_rcv_nogui.py - usrp_tv_rcv.py - usrp_wfm_rcv2_nogui.py - usrp_wfm_rcv_fmdet.py - usrp_wfm_rcv_nogui.py - usrp_wfm_rcv_pll.py - usrp_wfm_rcv.py - usrp_wfm_rcv_sca.py - usrp_wxapt_rcv.py - DESTINATION ${GR_PKG_UHD_EXAMPLES_DIR} - COMPONENT "uhd_python" -) diff --git a/gr-uhd/examples/python/fm_tx4.py b/gr-uhd/examples/python/fm_tx4.py deleted file mode 100755 index f412ffb5d..000000000 --- a/gr-uhd/examples/python/fm_tx4.py +++ /dev/null @@ -1,208 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 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. -# - -""" -Transmit N simultaneous narrow band FM signals. - -They will be centered at the frequency specified on the command line, -and will spaced at 25kHz steps from there. - -The program opens N files with names audio-N.dat where N is in [0,7]. -These files should contain floating point audio samples in the range [-1,1] -sampled at 32kS/sec. You can create files like this using -audio_to_file.py -""" - -from gnuradio import gr, eng_notation -from gnuradio import uhd -from gnuradio import blks2 -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import math -import sys - -from gnuradio.wxgui import stdgui2, fftsink2 -import wx - - -######################################################## -# instantiate one transmit chain for each call - -class pipeline(gr.hier_block2): - def __init__(self, filename, lo_freq, audio_rate, if_rate): - - gr.hier_block2.__init__(self, "pipeline", - gr.io_signature(0, 0, 0), - gr.io_signature(1, 1, gr.sizeof_gr_complex)) - - try: - src = gr.file_source (gr.sizeof_float, filename, True) - except RuntimeError: - sys.stderr.write(("\nError: Could not open file '%s'\n\n" % \ - filename)) - sys.exit(1) - - print audio_rate, if_rate - fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3, tau=75e-6) - - # Local oscillator - lo = gr.sig_source_c (if_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - lo_freq, #frequency - 1.0, # amplitude - 0) # DC Offset - mixer = gr.multiply_cc () - - self.connect (src, fmtx, (mixer, 0)) - self.connect (lo, (mixer, 1)) - self.connect (mixer, self) - -class fm_tx_block(stdgui2.std_top_block): - def __init__(self, frame, panel, vbox, argv): - MAX_CHANNELS = 7 - stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv) - - parser = OptionParser (option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-s", "--samp-rate", type="eng_float", default=400e3, - help="set sample rate (bandwidth) [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-n", "--nchannels", type="int", default=4, - help="number of Tx channels [1,4]") - #parser.add_option("","--debug", action="store_true", default=False, - # help="Launch Tx debugger") - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.nchannels < 1 or options.nchannels > MAX_CHANNELS: - sys.stderr.write ("fm_tx4: nchannels out of range. Must be in [1,%d]\n" % MAX_CHANNELS) - sys.exit(1) - - if options.freq is None: - sys.stderr.write("fm_tx4: must specify frequency with -f FREQ\n") - parser.print_help() - sys.exit(1) - - # ---------------------------------------------------------------- - # Set up constants and parameters - - self.u = uhd.usrp_sink(device_addr=options.args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - self.usrp_rate = options.samp_rate - self.u.set_samp_rate(self.usrp_rate) - self.usrp_rate = self.u.get_samp_rate() - - self.sw_interp = 10 - self.audio_rate = self.usrp_rate / self.sw_interp # 32 kS/s - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2 - - self.set_gain(options.gain) - self.set_freq(options.freq) - - self.sum = gr.add_cc () - - # Instantiate N NBFM channels - step = 25e3 - offset = (0 * step, 1 * step, -1 * step, - 2 * step, -2 * step, 3 * step, -3 * step) - - for i in range (options.nchannels): - t = pipeline("audio-%d.dat" % (i % 4), offset[i], - self.audio_rate, self.usrp_rate) - self.connect(t, (self.sum, i)) - - self.gain = gr.multiply_const_cc (1.0 / options.nchannels) - - # connect it all - self.connect (self.sum, self.gain) - self.connect (self.gain, self.u) - - # plot an FFT to verify we are sending what we want - if 1: - post_mod = fftsink2.fft_sink_c(panel, title="Post Modulation", - fft_size=512, - sample_rate=self.usrp_rate, - y_per_div=20, - ref_level=40) - self.connect (self.gain, post_mod) - vbox.Add (post_mod.win, 1, wx.EXPAND) - - - #if options.debug: - # self.debugger = tx_debug_gui.tx_debug_gui(self.subdev) - # self.debugger.Show(True) - - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - - Tuning is a two step process. First we ask the front-end to - tune as close to the desired frequency as it can. Then we use - the result of that operation and our target_frequency to - determine the value for the digital up converter. Finally, we feed - any residual_freq to the s/w freq translater. - """ - - r = self.u.set_center_freq(target_freq, 0) - if r: - print "Frequency =", eng_notation.num_to_str(self.u.get_center_freq()) - return True - - return False - - def set_gain(self, gain): - self.u.set_gain(gain, 0) - - -def main (): - app = stdgui2.stdapp(fm_tx_block, "Multichannel FM Tx", nstatus=1) - app.MainLoop () - -if __name__ == '__main__': - main () diff --git a/gr-uhd/examples/python/fm_tx_2_daughterboards.py b/gr-uhd/examples/python/fm_tx_2_daughterboards.py deleted file mode 100755 index b5763e8e1..000000000 --- a/gr-uhd/examples/python/fm_tx_2_daughterboards.py +++ /dev/null @@ -1,212 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 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. -# - -""" -Transmit 2 signals, one out each daughterboard. - -Outputs SSB (USB) signals on side A and side B at frequencies -specified on command line. - -Side A is 600 Hz tone. -Side B is 350 + 440 Hz tones. -""" - -from gnuradio import gr, uhd, blks2 -from gnuradio.eng_notation import num_to_str, str_to_num -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import math -import sys - - -class example_signal_0(gr.hier_block2): - """ - Sinusoid at 600 Hz. - """ - def __init__(self, sample_rate): - gr.hier_block2.__init__(self, "example_signal_0", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - src = gr.sig_source_c (sample_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - 600, # frequency - 1.0, # amplitude - 0) # DC Offset - - self.connect(src, self) - - -class example_signal_1(gr.hier_block2): - """ - North American dial tone (350 + 440 Hz). - """ - def __init__(self, sample_rate): - gr.hier_block2.__init__(self, "example_signal_1", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - src0 = gr.sig_source_c (sample_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - 350, # frequency - 1.0, # amplitude - 0) # DC Offset - - src1 = gr.sig_source_c (sample_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - 440, # frequency - 1.0, # amplitude - 0) # DC Offset - sum = gr.add_cc() - self.connect(src0, (sum, 0)) - self.connect(src1, (sum, 1)) - self.connect(sum, self) - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - usage="%prog: [options] tx-freq0 tx-freq1" - parser = OptionParser (option_class=eng_option, usage=usage) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-s", "--samp-rate", type="eng_float", default=320e3, - help="set sample rate [default=%default]") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - (options, args) = parser.parse_args () - - if len(args) != 2: - parser.print_help() - raise SystemExit - else: - freq0 = str_to_num(args[0]) - freq1 = str_to_num(args[1]) - - # ---------------------------------------------------------------- - # Set up USRP to transmit on both daughterboards - - d = uhd.find_devices(uhd.device_addr(options.args)) - uhd_type = d[0].get('type') - - stream_args = uhd.stream_args('fc32', channels=range(2)) - self.u = uhd.usrp_sink(device_addr=options.args, stream_args=stream_args) - - # Set up USRP system based on type - if(uhd_type == "usrp"): - self.u.set_subdev_spec("A:0 B:0") - tr0 = uhd.tune_request(freq0) - tr1 = uhd.tune_request(freq1) - - else: - if abs(freq0 - freq1) > 5.5e6: - sys.stderr.write("\nError: When not using two separate d'boards, frequencies must bewithin 5.5MHz of each other.\n") - raise SystemExit - - self.u.set_subdev_spec("A:0 A:0") - - mid_freq = (freq0 + freq1)/2.0 - tr0 = uhd.tune_request(freq0, rf_freq=mid_freq, - rf_freq_policy=uhd.tune_request.POLICY_MANUAL) - - tr1 = uhd.tune_request(freq1, rf_freq=mid_freq, - rf_freq_policy=uhd.tune_request.POLICY_MANUAL) - - # Use the tune requests to tune each channel - self.set_freq(tr0, 0) - self.set_freq(tr1, 1) - - self.usrp_rate = options.samp_rate - - self.u.set_samp_rate(self.usrp_rate) - dev_rate = self.u.get_samp_rate() - - # ---------------------------------------------------------------- - # build two signal sources, interleave them, amplify and - # connect them to usrp - - sig0 = example_signal_0(self.usrp_rate) - sig1 = example_signal_1(self.usrp_rate) - - intl = gr.interleave(gr.sizeof_gr_complex) - self.connect(sig0, (intl, 0)) - self.connect(sig1, (intl, 1)) - - # Correct for any difference in requested and actual rates - rrate = self.usrp_rate / dev_rate - resamp = blks2.pfb_arb_resampler_ccf(rrate) - - # and wire them up - self.connect(intl, resamp, self.u) - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2.0 - - self.set_gain(options.gain, 0) - self.set_gain(options.gain, 1) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - self.u.set_antenna(options.antenna, 1) - - def set_freq(self, target_freq, chan): - """ - Set the center frequency we're interested in. - - @param side: 0 = side A, 1 = side B - @param target_freq: frequency in Hz - @rtype: bool - """ - - print "Tuning channel %s to %sHz" % \ - (chan, num_to_str(target_freq)) - - r = self.u.set_center_freq(target_freq, chan) - - if r: - return True - - else: - print " Set Frequency Failed!" - - return False - - def set_gain(self, gain, chan): - self.u.set_gain(gain, chan) - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-uhd/examples/python/max_power.py b/gr-uhd/examples/python/max_power.py deleted file mode 100755 index 5d23f16af..000000000 --- a/gr-uhd/examples/python/max_power.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2011 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. -# - -""" -Setup USRP for maximum power consumption. -""" - - -from gnuradio import gr -from gnuradio import uhd -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -from gnuradio import eng_notation - -n2s = eng_notation.num_to_str - -# Set this to a huge number; UHD will adjust to the -# maximum the USRP xxxx device can handle -MAX_RATE = 1000e6 - -class build_block(gr.top_block): - def __init__(self, args, tx_enable, rx_enable): - gr.top_block.__init__(self) - - d = uhd.find_devices(uhd.device_addr(args)) - uhd_type = d[0].get('type') - - print "\nFound '%s' at args '%s'" % \ - (uhd_type, args) - - # Test the type of USRP; if it's a USRP (v1), it has - # 2 channels; otherwise, it has 1 channel - if uhd_type == "usrp": - tx_nchan = 2 - rx_nchan = 2 - else: - tx_nchan = 1 - rx_nchan = 1 - - if tx_enable: - print "\nTRANSMIT CHAIN" - stream_args = uhd.stream_args('fc32', channels=range(tx_nchan)) - self.u_tx = uhd.usrp_sink(device_addr=args, stream_args=stream_args) - self.u_tx.set_samp_rate(MAX_RATE) - - self.tx_src0 = gr.sig_source_c(self.u_tx.get_samp_rate(), - gr.GR_CONST_WAVE, - 0, 1.0, 0) - - # Get dboard gain range and select maximum - tx_gain_range = self.u_tx.get_gain_range() - tx_gain = tx_gain_range.stop() - - # Get dboard freq range and select midpoint - tx_freq_range = self.u_tx.get_freq_range() - tx_freq_mid = (tx_freq_range.start() + tx_freq_range.stop())/2.0 - - for i in xrange(tx_nchan): - self.u_tx.set_center_freq (tx_freq_mid + i*1e6, i) - self.u_tx.set_gain(tx_gain, i) - - print "\nTx Sample Rate: %ssps" % (n2s(self.u_tx.get_samp_rate())) - for i in xrange(tx_nchan): - print "Tx Channel %d: " % (i) - print "\tFrequency = %sHz" % \ - (n2s(self.u_tx.get_center_freq(i))) - print "\tGain = %f dB" % (self.u_tx.get_gain(i)) - print "" - - self.connect (self.tx_src0, self.u_tx) - - if rx_enable: - print "\nRECEIVE CHAIN" - self.u_rx = uhd.usrp_source(device_addr=args, - io_type=uhd.io_type.COMPLEX_FLOAT32, - num_channels=rx_nchan) - self.rx_dst0 = gr.null_sink (gr.sizeof_gr_complex) - - self.u_rx.set_samp_rate(MAX_RATE) - - # Get dboard gain range and select maximum - rx_gain_range = self.u_rx.get_gain_range() - rx_gain = rx_gain_range.stop() - - # Get dboard freq range and select midpoint - rx_freq_range = self.u_rx.get_freq_range() - rx_freq_mid = (rx_freq_range.start() + rx_freq_range.stop())/2.0 - - for i in xrange(tx_nchan): - self.u_rx.set_center_freq (rx_freq_mid + i*1e6, i) - self.u_rx.set_gain(rx_gain, i) - - print "\nRx Sample Rate: %ssps" % (n2s(self.u_rx.get_samp_rate())) - for i in xrange(rx_nchan): - print "Rx Channel %d: " % (i) - print "\tFrequency = %sHz" % \ - (n2s(self.u_rx.get_center_freq(i))) - print "\tGain = %f dB" % (self.u_rx.get_gain(i)) - print "" - - self.connect (self.u_rx, self.rx_dst0) - -def main (): - parser = OptionParser (option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("-t", action="store_true", dest="tx_enable", - default=False, help="enable Tx path") - parser.add_option("-r", action="store_true", dest="rx_enable", - default=False, help="enable Rx path") - (options, args) = parser.parse_args () - - tb = build_block (options.args, options.tx_enable, options.rx_enable) - - tb.start () - raw_input ('Press Enter to quit: ') - tb.stop () - -if __name__ == '__main__': - main () diff --git a/gr-uhd/examples/python/usrp_am_mw_rcv.py b/gr-uhd/examples/python/usrp_am_mw_rcv.py deleted file mode 100755 index 02863b32f..000000000 --- a/gr-uhd/examples/python/usrp_am_mw_rcv.py +++ /dev/null @@ -1,313 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 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. -# - -from gnuradio import gr, eng_notation, optfir -from gnuradio import audio -from gnuradio import uhd -from gnuradio import blks2 -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import slider, powermate -from gnuradio.wxgui import stdgui2, fftsink2, form -from optparse import OptionParser -import sys -import math -import wx - -class wfm_rx_block (stdgui2.std_top_block): - def __init__(self, frame, panel, vbox, argv): - stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv) - - parser=OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6, - help="set sample rate (bandwidth) [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=1008.0e3, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-I", "--use-if-freq", action="store_true", default=False, - help="use intermediate freq (compensates DC problems in quadrature boards)" ) - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is maximum)") - parser.add_option("-V", "--volume", type="eng_float", default=None, - help="set volume (default is midpoint)") - parser.add_option("-O", "--audio-output", type="string", default="default", - help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - self.frame = frame - self.panel = panel - self.use_IF=options.use_if_freq - if self.use_IF: - self.IF_freq=64000.0 - else: - self.IF_freq=0.0 - - self.vol = 0 - self.state = "FREQ" - self.freq = 0 - - # build graph - self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - usrp_rate = 256e3 - demod_rate = 64e3 - audio_rate = 32e3 - chanfilt_decim = int(usrp_rate // demod_rate) - audio_decim = int(demod_rate // audio_rate) - - self.u.set_samp_rate(usrp_rate) - dev_rate = self.u.get_samp_rate() - - # Resample signal to exactly self.usrp_rate - # FIXME: make one of the follow-on filters an arb resampler - rrate = usrp_rate / dev_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate) - - chan_filt_coeffs = gr.firdes.low_pass_2 (1, # gain - usrp_rate, # sampling rate - 8e3, # passband cutoff - 4e3, # transition bw - 60) # stopband attenuation - - if self.use_IF: - # Turn If to baseband and filter. - self.chan_filt = gr.freq_xlating_fir_filter_ccf (chanfilt_decim, - chan_filt_coeffs, - self.IF_freq, - usrp_rate) - else: - self.chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs) - - self.agc = gr.agc_cc(0.1, 1, 1, 100000) - self.am_demod = gr.complex_to_mag() - self.volume_control = gr.multiply_const_ff(self.vol) - - audio_filt_coeffs = gr.firdes.low_pass_2 (1, # gain - demod_rate, # sampling rate - 8e3, # passband cutoff - 2e3, # transition bw - 60) # stopband attenuation - self.audio_filt=gr.fir_filter_fff(audio_decim, audio_filt_coeffs) - - # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), - options.audio_output, - False) # ok_to_block - - # now wire it all together - self.connect (self.u, self.resamp, self.chan_filt, self.agc, - self.am_demod, self.audio_filt, - self.volume_control, self.audio_sink) - - self._build_gui(vbox, usrp_rate, demod_rate, audio_rate) - - if options.gain is None: - g = self.u.get_gain_range() - # if no gain was specified, use the mid gain - options.gain = (g.start() + g.stop())/2.0 - - if options.volume is None: - v = self.volume_range() - options.volume = float(v[0]*3+v[1])/4.0 - - if abs(options.freq) < 1e3: - options.freq *= 1e3 - - # set initial values - - self.set_gain(options.gain) - self.set_vol(options.volume) - if not(self.set_freq(options.freq)): - self._set_status_msg("Failed to set initial frequency") - - def _set_status_msg(self, msg, which=0): - self.frame.GetStatusBar().SetStatusText(msg, which) - - - def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - - if 0: - self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP", - fft_size=512, sample_rate=usrp_rate, - ref_scale=32768.0, ref_level=0.0, y_divs=12) - self.connect (self.u, self.src_fft) - vbox.Add (self.src_fft.win, 4, wx.EXPAND) - - if 0: - self.post_filt_fft = fftsink2.fft_sink_c(self.panel, title="Post Channel filter", - fft_size=512, sample_rate=demod_rate) - self.connect (self.chan_filt, self.post_filt_fft) - vbox.Add (self.post_filt_fft.win, 4, wx.EXPAND) - - if 0: - post_demod_fft = fftsink2.fft_sink_f(self.panel, title="Post Demod", - fft_size=1024, sample_rate=demod_rate, - y_per_div=10, ref_level=0) - self.connect (self.am_demod, post_demod_fft) - vbox.Add (post_demod_fft.win, 4, wx.EXPAND) - - if 1: - audio_fft = fftsink2.fft_sink_f(self.panel, title="Audio", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=20) - self.connect (self.audio_filt, audio_fft) - vbox.Add (audio_fft.win, 4, wx.EXPAND) - - - # control area form at bottom - self.myform = myform = form.form() - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - myform['freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="Freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) - - hbox.Add((5,0), 0) - myform['freq_slider'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3, - range=(520.0e3, 1611.0e3, 1.0e3), - callback=self.set_freq) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - - myform['volume'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume", - weight=3, range=self.volume_range(), - callback=self.set_vol) - hbox.Add((5,0), 1) - - g = self.u.get_gain_range() - myform['gain'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain", - weight=3, range=(g.start(), g.stop(), g.step()), - callback=self.set_gain) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - try: - self.knob = powermate.powermate(self.frame) - self.rot = 0 - powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate) - powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button) - except: - print "FYI: No Powermate or Contour Knob found" - - - def on_rotate (self, event): - self.rot += event.delta - if (self.state == "FREQ"): - if self.rot >= 3: - self.set_freq(self.freq + .1e6) - self.rot -= 3 - elif self.rot <=-3: - self.set_freq(self.freq - .1e6) - self.rot += 3 - else: - step = self.volume_range()[2] - if self.rot >= 3: - self.set_vol(self.vol + step) - self.rot -= 3 - elif self.rot <=-3: - self.set_vol(self.vol - step) - self.rot += 3 - - def on_button (self, event): - if event.value == 0: # button up - return - self.rot = 0 - if self.state == "FREQ": - self.state = "VOL" - else: - self.state = "FREQ" - self.update_status_bar () - - - def set_vol (self, vol): - g = self.volume_range() - self.vol = max(g[0], min(g[1], vol)) - self.volume_control.set_k(10**(self.vol/10)) - self.myform['volume'].set_value(self.vol) - self.update_status_bar () - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - """ - r = self.u.set_center_freq(target_freq + self.IF_freq, 0) - - if r: - self.freq = target_freq - self.myform['freq'].set_value(target_freq) # update displayed value - self.myform['freq_slider'].set_value(target_freq) # update displayed value - self.update_status_bar() - self._set_status_msg("OK", 0) - return True - - self._set_status_msg("Failed", 0) - return False - - def set_gain(self, gain): - self.myform['gain'].set_value(gain) # update displayed value - self.u.set_gain(gain) - - def update_status_bar (self): - msg = "Volume:%r Setting:%s" % (self.vol, self.state) - self._set_status_msg(msg, 1) - try: - self.src_fft.set_baseband_freq(self.freq) - except: - None - - def volume_range(self): - return (-40.0, 0.0, 0.5) - - -if __name__ == '__main__': - app = stdgui2.stdapp (wfm_rx_block, "USRP Broadcast AM MW RX") - app.MainLoop () diff --git a/gr-uhd/examples/python/usrp_nbfm_ptt.py b/gr-uhd/examples/python/usrp_nbfm_ptt.py deleted file mode 100755 index 791b8cb99..000000000 --- a/gr-uhd/examples/python/usrp_nbfm_ptt.py +++ /dev/null @@ -1,489 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2007,2011 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. -# - -import math -import sys -import wx -from optparse import OptionParser - -from gnuradio import gr, audio, blks2, uhd -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import stdgui2, fftsink2, scopesink2, slider, form - -from numpy import convolve, array - -#import os -#print "pid =", os.getpid() -#raw_input('Press Enter to continue: ') - -# //////////////////////////////////////////////////////////////////////// -# Control Stuff -# //////////////////////////////////////////////////////////////////////// - -class ptt_block(stdgui2.std_top_block): - def __init__(self, frame, panel, vbox, argv): - stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv) - - self.frame = frame - self.space_bar_pressed = False - - parser = OptionParser (option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option ("-f", "--freq", type="eng_float", default=442.1e6, - help="set Tx and Rx frequency to FREQ", metavar="FREQ") - parser.add_option ("-g", "--rx-gain", type="eng_float", default=None, - help="set rx gain [default=midpoint in dB]") - parser.add_option ("", "--tx-gain", type="eng_float", default=None, - help="set tx gain [default=midpoint in dB]") - parser.add_option("-I", "--audio-input", type="string", default="default", - help="pcm input device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-O", "--audio-output", type="string", default="default", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option ("-N", "--no-gui", action="store_true", default=False) - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.freq < 1e6: - options.freq *= 1e6 - - self.txpath = transmit_path(options.args, options.spec, - options.antenna, options.tx_gain, - options.audio_input) - self.rxpath = receive_path(options.args, options.spec, - options.antenna, options.rx_gain, - options.audio_output) - self.connect(self.txpath) - self.connect(self.rxpath) - - self._build_gui(frame, panel, vbox, argv, options.no_gui) - - self.set_transmit(False) - self.set_freq(options.freq) - self.set_rx_gain(self.rxpath.gain) # update gui - self.set_volume(self.rxpath.volume) # update gui - self.set_squelch(self.rxpath.threshold()) # update gui - - - def set_transmit(self, enabled): - self.txpath.set_enable(enabled) - self.rxpath.set_enable(not(enabled)) - if enabled: - self.frame.SetStatusText ("Transmitter ON", 1) - else: - self.frame.SetStatusText ("Receiver ON", 1) - - - def set_rx_gain(self, gain): - self.myform['rx_gain'].set_value(gain) # update displayed value - self.rxpath.set_gain(gain) - - def set_tx_gain(self, gain): - self.txpath.set_gain(gain) - - def set_squelch(self, threshold): - self.rxpath.set_squelch(threshold) - self.myform['squelch'].set_value(self.rxpath.threshold()) - - def set_volume (self, vol): - self.rxpath.set_volume(vol) - self.myform['volume'].set_value(self.rxpath.volume) - #self.update_status_bar () - - def set_freq(self, freq): - r1 = self.txpath.set_freq(freq) - r2 = self.rxpath.set_freq(freq) - #print "txpath.set_freq =", r1 - #print "rxpath.set_freq =", r2 - if r1 and r2: - self.myform['freq'].set_value(freq) # update displayed value - return r1 and r2 - - def _build_gui(self, frame, panel, vbox, argv, no_gui): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - self.panel = panel - - # FIXME This REALLY needs to be replaced with a hand-crafted button - # that sends both button down and button up events - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((10,0), 1) - self.status_msg = wx.StaticText(panel, -1, "Press Space Bar to Transmit") - of = self.status_msg.GetFont() - self.status_msg.SetFont(wx.Font(15, of.GetFamily(), of.GetStyle(), of.GetWeight())) - hbox.Add(self.status_msg, 0, wx.ALIGN_CENTER) - hbox.Add((10,0), 1) - vbox.Add(hbox, 0, wx.EXPAND | wx.ALIGN_CENTER) - - panel.Bind(wx.EVT_KEY_DOWN, self._on_key_down) - panel.Bind(wx.EVT_KEY_UP, self._on_key_up) - panel.Bind(wx.EVT_KILL_FOCUS, self._on_kill_focus) - panel.SetFocus() - - if 1 and not(no_gui): - rx_fft = fftsink2.fft_sink_c(panel, title="Rx Input", fft_size=512, - sample_rate=self.rxpath.if_rate, - ref_level=80, y_per_div=20) - self.connect (self.rxpath.u, rx_fft) - vbox.Add (rx_fft.win, 1, wx.EXPAND) - - if 1 and not(no_gui): - rx_fft = fftsink2.fft_sink_c(panel, title="Post s/w Resampler", - fft_size=512, sample_rate=self.rxpath.quad_rate, - ref_level=80, y_per_div=20) - self.connect (self.rxpath.resamp, rx_fft) - vbox.Add (rx_fft.win, 1, wx.EXPAND) - - if 0 and not(no_gui): - foo = scopesink2.scope_sink_f(panel, title="Squelch", - sample_rate=32000) - self.connect (self.rxpath.fmrx.div, (foo,0)) - self.connect (self.rxpath.fmrx.gate, (foo,1)) - self.connect (self.rxpath.fmrx.squelch_lpf, (foo,2)) - vbox.Add (foo.win, 1, wx.EXPAND) - - if 0 and not(no_gui): - tx_fft = fftsink2.fft_sink_c(panel, title="Tx Output", - fft_size=512, sample_rate=self.txpath.usrp_rate) - self.connect (self.txpath.amp, tx_fft) - vbox.Add (tx_fft.win, 1, wx.EXPAND) - - - # add control area at the bottom - - self.myform = myform = form.form() - - # first row - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0, 0) - myform['freq'] = form.float_field( - parent=panel, sizer=hbox, label="Freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) - - hbox.Add((5,0), 0, 0) - vbox.Add(hbox, 0, wx.EXPAND) - - - # second row - hbox = wx.BoxSizer(wx.HORIZONTAL) - myform['volume'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume", - weight=3, range=self.rxpath.volume_range(), - callback=self.set_volume) - hbox.Add((5,0), 0) - myform['squelch'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Squelch", - weight=3, range=self.rxpath.squelch_range(), - callback=self.set_squelch) - - g = self.rxpath.u.get_gain_range() - hbox.Add((5,0), 0) - myform['rx_gain'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Rx Gain", - weight=3, range=(g.start(), g.stop(), g.step()), - callback=self.set_rx_gain) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - - self._build_subpanel(vbox) - - def _build_subpanel(self, vbox_arg): - # build a secondary information panel (sometimes hidden) - - # FIXME figure out how to have this be a subpanel that is always - # created, but has its visibility controlled by foo.Show(True/False) - - #if not(self.show_debug_info): - # return - - panel = self.panel - vbox = vbox_arg - myform = self.myform - - #panel = wx.Panel(self.panel, -1) - #vbox = wx.BoxSizer(wx.VERTICAL) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - #myform['decim'] = form.static_float_field( - # parent=panel, sizer=hbox, label="Decim") - - #hbox.Add((5,0), 1) - #myform['fs@usb'] = form.static_float_field( - # parent=panel, sizer=hbox, label="Fs@USB") - - #hbox.Add((5,0), 1) - #myform['dbname'] = form.static_text_field( - # parent=panel, sizer=hbox) - - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - - def _set_status_msg(self, msg, which=0): - self.frame.GetStatusBar().SetStatusText(msg, which) - - def _on_key_down(self, evt): - # print "key_down:", evt.m_keyCode - if evt.m_keyCode == wx.WXK_SPACE and not(self.space_bar_pressed): - self.space_bar_pressed = True - self.set_transmit(True) - - def _on_key_up(self, evt): - # print "key_up", evt.m_keyCode - if evt.m_keyCode == wx.WXK_SPACE: - self.space_bar_pressed = False - self.set_transmit(False) - - def _on_kill_focus(self, evt): - # if we lose the keyboard focus, turn off the transmitter - self.space_bar_pressed = False - self.set_transmit(False) - - -# //////////////////////////////////////////////////////////////////////// -# Transmit Path -# //////////////////////////////////////////////////////////////////////// - -class transmit_path(gr.hier_block2): - def __init__(self, args, spec, antenna, gain, audio_input): - gr.hier_block2.__init__(self, "transmit_path", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - - self.u = uhd.usrp_sink(device_addr=args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(spec): - self.u.set_subdev_spec(spec, 0) - - # Set the antenna - if(antenna): - self.u.set_antenna(antenna, 0) - - self.if_rate = 320e3 - self.audio_rate = 32e3 - - self.u.set_samp_rate(self.if_rate) - dev_rate = self.u.get_samp_rate() - - self.audio_gain = 10 - self.normal_gain = 32000 - - self.audio = audio.source(int(self.audio_rate), audio_input) - self.audio_amp = gr.multiply_const_ff(self.audio_gain) - - lpf = gr.firdes.low_pass (1, # gain - self.audio_rate, # sampling rate - 3800, # low pass cutoff freq - 300, # width of trans. band - gr.firdes.WIN_HANN) # filter type - - hpf = gr.firdes.high_pass (1, # gain - self.audio_rate, # sampling rate - 325, # low pass cutoff freq - 50, # width of trans. band - gr.firdes.WIN_HANN) # filter type - - audio_taps = convolve(array(lpf),array(hpf)) - self.audio_filt = gr.fir_filter_fff(1,audio_taps) - - self.pl = blks2.ctcss_gen_f(self.audio_rate,123.0) - self.add_pl = gr.add_ff() - self.connect(self.pl,(self.add_pl,1)) - - self.fmtx = blks2.nbfm_tx(self.audio_rate, self.if_rate) - self.amp = gr.multiply_const_cc (self.normal_gain) - - rrate = dev_rate / self.if_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate) - - self.connect(self.audio, self.audio_amp, self.audio_filt, - (self.add_pl,0), self.fmtx, self.amp, - self.resamp, self.u) - - if gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - gain = float(g.start() + g.stop())/2.0 - - self.set_gain(gain) - - self.set_enable(False) - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - """ - r = self.u.set_center_freq(target_freq) - if r: - return True - return False - - def set_gain(self, gain): - self.gain = gain - self.u.set_gain(gain) - - def set_enable(self, enable): - if enable: - self.amp.set_k (self.normal_gain) - else: - self.amp.set_k (0) - - - -# //////////////////////////////////////////////////////////////////////// -# Receive Path -# //////////////////////////////////////////////////////////////////////// - -class receive_path(gr.hier_block2): - def __init__(self, args, spec, antenna, gain, audio_output): - gr.hier_block2.__init__(self, "receive_path", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - - self.u = uhd.usrp_source(device_addr=args, - io_type=uhd.io_type.COMPLEX_FLOAT32, - num_channels=1) - - self.if_rate = 256e3 - self.quad_rate = 64e3 - self.audio_rate = 32e3 - - self.u.set_samp_rate(self.if_rate) - dev_rate = self.u.get_samp_rate() - - # Create filter to get actual channel we want - nfilts = 32 - chan_coeffs = gr.firdes.low_pass (nfilts, # gain - nfilts*dev_rate, # sampling rate - 13e3, # low pass cutoff freq - 4e3, # width of trans. band - gr.firdes.WIN_HANN) # filter type - - rrate = self.quad_rate / dev_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - - # instantiate the guts of the single channel receiver - self.fmrx = blks2.nbfm_rx(self.audio_rate, self.quad_rate) - - # standard squelch block - self.squelch = blks2.standard_squelch(self.audio_rate) - - # audio gain / mute block - self._audio_gain = gr.multiply_const_ff(1.0) - - # sound card as final sink - audio_sink = audio.sink (int(self.audio_rate), audio_output) - - # now wire it all together - self.connect (self.u, self.resamp, self.fmrx, self.squelch, - self._audio_gain, audio_sink) - - if gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - gain = float(g.start() + g.stop())/2.0 - - self.enabled = True - self.set_gain(gain) - v = self.volume_range() - self.set_volume((v[0]+v[1])/2) - s = self.squelch_range() - self.set_squelch((s[0]+s[1])/2) - - # Set the subdevice spec - if(spec): - self.u.set_subdev_spec(spec, 0) - - # Set the antenna - if(antenna): - self.u.set_antenna(antenna, 0) - - def volume_range(self): - return (-20.0, 0.0, 0.5) - - def set_volume (self, vol): - g = self.volume_range() - self.volume = max(g[0], min(g[1], vol)) - self._update_audio_gain() - - def set_enable(self, enable): - self.enabled = enable - self._update_audio_gain() - - def _update_audio_gain(self): - if self.enabled: - self._audio_gain.set_k(10**(self.volume/10)) - else: - self._audio_gain.set_k(0) - - def squelch_range(self): - return self.squelch.squelch_range() - - def set_squelch(self, threshold): - print "SQL =", threshold - self.squelch.set_threshold(threshold) - - def threshold(self): - return self.squelch.threshold() - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - """ - r = self.u.set_center_freq(target_freq) - if r: - return True - return False - - def set_gain(self, gain): - self.gain = gain - self.u.set_gain(gain) - - -# //////////////////////////////////////////////////////////////////////// -# Main -# //////////////////////////////////////////////////////////////////////// - -def main(): - app = stdgui2.stdapp(ptt_block, "NBFM Push to Talk") - app.MainLoop() - -if __name__ == '__main__': - main() diff --git a/gr-uhd/examples/python/usrp_nbfm_rcv.py b/gr-uhd/examples/python/usrp_nbfm_rcv.py deleted file mode 100755 index be890f02d..000000000 --- a/gr-uhd/examples/python/usrp_nbfm_rcv.py +++ /dev/null @@ -1,380 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2007,2011 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. -# - -from gnuradio import gr, audio, blks2, uhd -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import slider, powermate -from gnuradio.wxgui import stdgui2, fftsink2, form -from optparse import OptionParser -import sys -import math -import wx - -#//////////////////////////////////////////////////////////////////////// -# Control Stuff -#//////////////////////////////////////////////////////////////////////// - -class my_top_block (stdgui2.std_top_block): - def __init__(self,frame,panel,vbox,argv): - stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv) - - parser=OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-f", "--freq", type="eng_float", default=146.585e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-V", "--volume", type="eng_float", default=None, - help="set volume (default is midpoint)") - parser.add_option("-O", "--audio-output", type="string", default="default", - help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") - parser.add_option("-N", "--no-gui", action="store_true", default=False) - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.freq < 1e6: - options.freq *= 1e6 - - self.frame = frame - self.panel = panel - - self.state = "FREQ" - self.freq = 0 - self.freq_step = 25e3 - - self.rxpath = receive_path(options.args, options.spec, options.antenna, - options.gain, options.audio_output) - self.connect(self.rxpath) - - self._build_gui(vbox, options.no_gui) - - # set initial values - - if options.volume is not None: - self.set_volume(options.volume) - - if not(self.set_freq(options.freq)): - self._set_status_msg("Failed to set initial frequency") - - self.set_gain(self.rxpath.gain) # update gui - self.set_volume(self.rxpath.volume) # update gui - self.set_squelch(self.rxpath.threshold()) # update gui - - - def _set_status_msg(self, msg, which=0): - self.frame.GetStatusBar().SetStatusText(msg, which) - - - def _build_gui(self, vbox, no_gui): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - - self.src_fft = None - if 0 and not(no_gui): - self.src_fft = fftsink2.fft_sink_c(self.panel, - title="Data from USRP", - fft_size=512, - sample_rate=self.rxpath.if_rate, - ref_scale=32768.0, - ref_level=0, - y_per_div=10, - y_divs=12) - self.connect (self.rxpath.u, self.src_fft) - vbox.Add (self.src_fft.win, 4, wx.EXPAND) - if 1 and not(no_gui): - rx_fft = fftsink2.fft_sink_c(self.panel, - title="Post s/w Resampling", - fft_size=512, - sample_rate=self.rxpath.quad_rate, - ref_level=80, - y_per_div=20) - self.connect (self.rxpath.resamp, rx_fft) - vbox.Add (rx_fft.win, 4, wx.EXPAND) - - if 1 and not(no_gui): - post_deemph_fft = fftsink2.fft_sink_f(self.panel, - title="Post Deemph", - fft_size=512, - sample_rate=self.rxpath.audio_rate, - y_per_div=10, - ref_level=-40) - self.connect (self.rxpath.fmrx.deemph, post_deemph_fft) - vbox.Add (post_deemph_fft.win, 4, wx.EXPAND) - - if 0: - post_filt_fft = fftsink2.fft_sink_f(self.panel, - title="Post Filter", - fft_size=512, - sample_rate=audio_rate, - y_per_div=10, - ref_level=-40) - self.connect (self.guts.audio_filter, post_filt) - vbox.Add (fft_win4, 4, wx.EXPAND) - - # control area form at bottom - self.myform = myform = form.form() - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - myform['freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="Freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, - self._set_status_msg)) - - #hbox.Add((5,0), 0) - #myform['freq_slider'] = \ - # form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3, - # range=(87.9e6, 108.1e6, 0.1e6), - # callback=self.set_freq) - - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - - myform['volume'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume", - weight=3, range=self.volume_range(), - callback=self.set_volume) - hbox.Add((5,0), 0) - myform['squelch'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Squelch", - weight=3, range=self.rxpath.squelch_range(), - callback=self.set_squelch) - g = self.rxpath.u.get_gain_range() - hbox.Add((5,0), 0) - myform['gain'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain", - weight=3, range=(g.start(), g.stop(), g.step()), - callback=self.set_gain) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - try: - self.knob = powermate.powermate(self.frame) - self.rot = 0 - powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate) - powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button) - except: - print "FYI: No Powermate or Contour Knob found" - - - def on_rotate (self, event): - self.rot += event.delta - if (self.state == "FREQ"): - if self.rot >= 3: - self.set_freq(self.freq + self.freq_step) - self.rot -= 3 - elif self.rot <=-3: - self.set_freq(self.freq - self.freq_step) - self.rot += 3 - else: - step = self.volume_range()[2] - if self.rot >= 3: - self.set_volume(self.rxpath.volume + step) - self.rot -= 3 - elif self.rot <=-3: - self.set_volume(self.rxpath.volume - step) - self.rot += 3 - - def on_button (self, event): - if event.value == 0: # button up - return - self.rot = 0 - if self.state == "FREQ": - self.state = "VOL" - else: - self.state = "FREQ" - self.update_status_bar () - - - def set_squelch(self, threshold_in_db): - self.rxpath.set_squelch(threshold_in_db) - self.myform['squelch'].set_value(self.rxpath.threshold()) - - def set_volume (self, vol): - self.rxpath.set_volume(vol) - self.myform['volume'].set_value(self.rxpath.volume) - self.update_status_bar () - - def set_freq(self, target_freq): - r = self.rxpath.set_freq(target_freq) - if r: - self.freq = target_freq - self.myform['freq'].set_value(target_freq) # update displayed value - #self.myform['freq_slider'].set_value(target_freq) # update displayed value - self.update_status_bar() - self._set_status_msg("OK", 0) - return True - - self._set_status_msg("Failed", 0) - return False - - def set_gain(self, gain): - self.myform['gain'].set_value(gain) # update displayed value - self.rxpath.set_gain(gain) - - def update_status_bar (self): - msg = "Volume:%r Setting:%s" % (self.rxpath.volume, self.state) - self._set_status_msg(msg, 1) - if self.src_fft: - self.src_fft.set_baseband_freq(self.freq) - - def volume_range(self): - return (-20.0, 0.0, 0.5) - - -#//////////////////////////////////////////////////////////////////////// -# Receive Path -#//////////////////////////////////////////////////////////////////////// - -USE_SIMPLE_SQUELCH = False - -class receive_path(gr.hier_block2): - def __init__(self, args, spec, antenna, gain, audio_output): - gr.hier_block2.__init__(self, "receive_path", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - - self.u = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(spec): - self.u.set_subdev_spec(spec, 0) - - # Set the antenna - if(antenna): - self.u.set_antenna(antenna, 0) - - self.if_rate = 256e3 - self.quad_rate = 64e3 - self.audio_rate = 32e3 - - self.u.set_samp_rate(self.if_rate) - dev_rate = self.u.get_samp_rate() - - # Create filter to get actual channel we want - nfilts = 32 - chan_coeffs = gr.firdes.low_pass (nfilts, # gain - nfilts*dev_rate, # sampling rate - 8e3, # low pass cutoff freq - 2e3, # width of trans. band - gr.firdes.WIN_HANN) # filter type - rrate = self.quad_rate / dev_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - - if USE_SIMPLE_SQUELCH: - self.squelch = gr.simple_squelch_cc(20) - else: - self.squelch = blks2.standard_squelch(self.audio_rate) - - # instantiate the guts of the single channel receiver - self.fmrx = blks2.nbfm_rx(self.audio_rate, self.quad_rate) - - # audio gain / mute block - self._audio_gain = gr.multiply_const_ff(1.0) - - # sound card as final sink - audio_sink = audio.sink (int(self.audio_rate), audio_output) - - # now wire it all together - if USE_SIMPLE_SQUELCH: - self.connect (self.u, self.resamp, self.squelch, self.fmrx, - self._audio_gain, audio_sink) - else: - self.connect (self.u, self.resamp, self.fmrx, self.squelch, - self._audio_gain, audio_sink) - - if gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - gain = float(g.start()+g.stop())/2 - - self.set_gain(gain) - - v = self.volume_range() - self.set_volume((v[0]+v[1])/2) - - s = self.squelch_range() - self.set_squelch((s[0]+s[1])/2) - - def volume_range(self): - return (-20.0, 0.0, 0.5) - - def set_volume (self, vol): - g = self.volume_range() - self.volume = max(g[0], min(g[1], vol)) - self._update_audio_gain() - - def _update_audio_gain(self): - self._audio_gain.set_k(10**(self.volume/10)) - - def squelch_range(self): - r = self.squelch.squelch_range() - #print "squelch_range: ", r - return r - - def set_squelch(self, threshold): - #print "SQL =", threshold - self.squelch.set_threshold(threshold) - - def threshold(self): - t = self.squelch.threshold() - #print "t =", t - return t - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - """ - - r = self.u.set_center_freq(target_freq) - if r: - return True - return False - - def set_gain(self, gain): - self.gain = gain - self.u.set_gain(gain) - - -# //////////////////////////////////////////////////////////////////////// -# Main -# //////////////////////////////////////////////////////////////////////// - -if __name__ == '__main__': - app = stdgui2.stdapp (my_top_block, "USRP NBFM RX") - app.MainLoop () diff --git a/gr-uhd/examples/python/usrp_spectrum_sense.py b/gr-uhd/examples/python/usrp_spectrum_sense.py deleted file mode 100755 index 32980adbf..000000000 --- a/gr-uhd/examples/python/usrp_spectrum_sense.py +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2007,2011 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. -# - -from gnuradio import gr, eng_notation, window -from gnuradio import audio -from gnuradio import uhd -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys -import math -import struct -import threading - -sys.stderr.write("Warning: this may have issues on some machines+Python version combinations to seg fault due to the callback in bin_statitics.\n\n") - -class ThreadClass(threading.Thread): - def run(self): - return - -class tune(gr.feval_dd): - """ - This class allows C++ code to callback into python. - """ - def __init__(self, tb): - gr.feval_dd.__init__(self) - self.tb = tb - - def eval(self, ignore): - """ - This method is called from gr.bin_statistics_f when it wants - to change the center frequency. This method tunes the front - end to the new center frequency, and returns the new frequency - as its result. - """ - - try: - # We use this try block so that if something goes wrong - # from here down, at least we'll have a prayer of knowing - # what went wrong. Without this, you get a very - # mysterious: - # - # terminate called after throwing an instance of - # 'Swig::DirectorMethodException' Aborted - # - # message on stderr. Not exactly helpful ;) - - new_freq = self.tb.set_next_freq() - return new_freq - - except Exception, e: - print "tune: Exception: ", e - - -class parse_msg(object): - def __init__(self, msg): - self.center_freq = msg.arg1() - self.vlen = int(msg.arg2()) - assert(msg.length() == self.vlen * gr.sizeof_float) - - # FIXME consider using NumPy array - t = msg.to_string() - self.raw_data = t - self.data = struct.unpack('%df' % (self.vlen,), t) - - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - usage = "usage: %prog [options] min_freq max_freq" - parser = OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6, - help="set sample rate [default=%default]") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("", "--tune-delay", type="eng_float", - default=1e-3, metavar="SECS", - help="time to delay (in seconds) after changing frequency [default=%default]") - parser.add_option("", "--dwell-delay", type="eng_float", - default=10e-3, metavar="SECS", - help="time to dwell (in seconds) at a given frequncy [default=%default]") - parser.add_option("-F", "--fft-size", type="int", default=256, - help="specify number of FFT bins [default=%default]") - parser.add_option("", "--real-time", action="store_true", default=False, - help="Attempt to enable real-time scheduling") - - (options, args) = parser.parse_args() - if len(args) != 2: - parser.print_help() - sys.exit(1) - - self.min_freq = eng_notation.str_to_num(args[0]) - self.max_freq = eng_notation.str_to_num(args[1]) - - if self.min_freq > self.max_freq: - # swap them - self.min_freq, self.max_freq = self.max_freq, self.min_freq - - self.fft_size = options.fft_size - - if not options.real_time: - realtime = False - else: - # Attempt to enable realtime scheduling - r = gr.enable_realtime_scheduling() - if r == gr.RT_OK: - realtime = True - else: - realtime = False - print "Note: failed to enable realtime scheduling" - - # build graph - self.u = uhd.usrp_source(device_addr=options.args, - stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - usrp_rate = options.samp_rate - self.u.set_samp_rate(usrp_rate) - dev_rate = self.u.get_samp_rate() - - s2v = gr.stream_to_vector(gr.sizeof_gr_complex, self.fft_size) - - mywindow = window.blackmanharris(self.fft_size) - fft = gr.fft_vcc(self.fft_size, True, mywindow) - power = 0 - for tap in mywindow: - power += tap*tap - - c2mag = gr.complex_to_mag_squared(self.fft_size) - - # FIXME the log10 primitive is dog slow - log = gr.nlog10_ff(10, self.fft_size, - -20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size)) - - # Set the freq_step to 75% of the actual data throughput. - # This allows us to discard the bins on both ends of the spectrum. - - self.freq_step = 0.75 * usrp_rate - self.min_center_freq = self.min_freq + self.freq_step/2 - nsteps = math.ceil((self.max_freq - self.min_freq) / self.freq_step) - self.max_center_freq = self.min_center_freq + (nsteps * self.freq_step) - - self.next_freq = self.min_center_freq - - tune_delay = max(0, int(round(options.tune_delay * usrp_rate / self.fft_size))) # in fft_frames - dwell_delay = max(1, int(round(options.dwell_delay * usrp_rate / self.fft_size))) # in fft_frames - - self.msgq = gr.msg_queue(16) - self._tune_callback = tune(self) # hang on to this to keep it from being GC'd - stats = gr.bin_statistics_f(self.fft_size, self.msgq, - self._tune_callback, tune_delay, - dwell_delay) - - # FIXME leave out the log10 until we speed it up - #self.connect(self.u, s2v, fft, c2mag, log, stats) - self.connect(self.u, s2v, fft, c2mag, stats) - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2.0 - - self.set_gain(options.gain) - print "gain =", options.gain - - def set_next_freq(self): - target_freq = self.next_freq - self.next_freq = self.next_freq + self.freq_step - if self.next_freq >= self.max_center_freq: - self.next_freq = self.min_center_freq - - if not self.set_freq(target_freq): - print "Failed to set frequency to", target_freq - sys.exit(1) - - return target_freq - - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - """ - r = self.u.set_center_freq(target_freq) - if r: - return True - - return False - - def set_gain(self, gain): - self.u.set_gain(gain) - - -def main_loop(tb): - while 1: - - # Get the next message sent from the C++ code (blocking call). - # It contains the center frequency and the mag squared of the fft - m = parse_msg(tb.msgq.delete_head()) - - # Print center freq so we know that something is happening... - print m.center_freq - - # FIXME do something useful with the data... - - # m.data are the mag_squared of the fft output (they are in the - # standard order. I.e., bin 0 == DC.) - # You'll probably want to do the equivalent of "fftshift" on them - # m.raw_data is a string that contains the binary floats. - # You could write this as binary to a file. - - -if __name__ == '__main__': - t = ThreadClass() - t.start() - - tb = my_top_block() - try: - tb.start() - main_loop(tb) - - except KeyboardInterrupt: - pass diff --git a/gr-uhd/examples/python/usrp_tv_rcv.py b/gr-uhd/examples/python/usrp_tv_rcv.py deleted file mode 100755 index b49a5ea71..000000000 --- a/gr-uhd/examples/python/usrp_tv_rcv.py +++ /dev/null @@ -1,443 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 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. -# - -""" -Realtime capture and display of analog Tv stations. - -Can also use a file as source or sink - -When you use an output file you can show the results frame-by-frame -using ImageMagick - -When you want to use the realtime sdl display window you must first -install gr-video-sdl. - -When you use a file source, instead of the usrp, make sure you -capture interleaved shorts. (Use usrp_rx_file.py, or use -usrp_rx_cfile.py --output-shorts if you have a recent enough -usrp_rx_cfile.py) - -There is no synchronisation yet. The sync blocks are in development -but not yet in cvs. -""" - -from gnuradio import gr -try: - from gnuradio import video_sdl -except: - print "FYI: gr-video-sdl is not installed" - print "realtime SDL video output window will not be available" -from gnuradio import uhd -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import slider, powermate -from gnuradio.wxgui import stdgui2, fftsink2, form -from optparse import OptionParser -import sys -import wx - - -class tv_rx_block (stdgui2.std_top_block): - def __init__(self,frame,panel,vbox,argv): - stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv) - - usage="%prog: [options] [input_filename]. \n If you don't specify an input filename the usrp will be used as source\n " \ - "Make sure your input capture file containes interleaved shorts not complex floats" - parser=OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6, - help="set sample rate") - parser.add_option("-f", "--freq", type="eng_float", default=519.25e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-c", "--contrast", type="eng_float", default=1.0, - help="set contrast (default is 1.0)") - parser.add_option("-b", "--brightness", type="eng_float", default=0.0, - help="set brightness (default is 0)") - parser.add_option("-p", "--pal", action="store_true", default=False, - help="PAL video format (this is the default)") - parser.add_option("-n", "--ntsc", action="store_true", default=False, - help="NTSC video format") - parser.add_option("-o", "--out-filename", type="string", default="sdl", - help="For example out_raw_uchar.gray. If you don't specify an output filename you will get a video_sink_sdl realtime output window. You then need to have gr-video-sdl installed)") - parser.add_option("-r", "--repeat", action="store_false", default=True, - help="repeat file in a loop") - parser.add_option("", "--freq-min", type="eng_float", default=50.25e6, - help="Set a minimum frequency [default=%default]") - parser.add_option("", "--freq-max", type="eng_float", default=900.25e6, - help="Set a maximum frequency [default=%default]") - - (options, args) = parser.parse_args() - if not ((len(args) == 1) or (len(args) == 0)): - parser.print_help() - sys.exit(1) - - if len(args) == 1: - filename = args[0] - else: - filename = None - - self.frame = frame - self.panel = panel - - self.contrast = options.contrast - self.brightness = options.brightness - self.state = "FREQ" - self.freq = 0 - - self.tv_freq_min = options.freq_min - self.tv_freq_max = options.freq_max - - # build graph - self.u=None - - if not (options.out_filename=="sdl"): - options.repeat=False - - usrp_rate = options.samp_rate - - if not ((filename is None) or (filename=="usrp")): - # file is data source - self.filesource = gr.file_source(gr.sizeof_short,filename,options.repeat) - self.istoc = gr.interleaved_short_to_complex() - self.connect(self.filesource,self.istoc) - self.src=self.istoc - - options.gain=0.0 - self.gain=0.0 - - else: # use a UHD device - self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - self.u.set_samp_rate(usrp_rate) - dev_rate = self.u.get_samp_rate() - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2.0 - - self.src=self.u - - self.gain = options.gain - - f2uc=gr.float_to_uchar() - - # sdl window as final sink - if not (options.pal or options.ntsc): - options.pal=True #set default to PAL - - if options.pal: - lines_per_frame=625.0 - frames_per_sec=25.0 - show_width=768 - - elif options.ntsc: - lines_per_frame=525.0 - frames_per_sec=29.97002997 - show_width=640 - - width=int(usrp_rate/(lines_per_frame*frames_per_sec)) - height=int(lines_per_frame) - - if (options.out_filename=="sdl"): - #Here comes the tv screen, you have to build and install - #gr-video-sdl for this (subproject of gnuradio, only in cvs - #for now) - try: - video_sink = video_sdl.sink_uc ( frames_per_sec, width, height, 0, - show_width, height) - except: - print "gr-video-sdl is not installed" - print "realtime \"sdl\" video output window is not available" - raise SystemExit, 1 - self.dst=video_sink - else: - print "You can use the imagemagick display tool to show the resulting imagesequence" - print "use the following line to show the demodulated TV-signal:" - print "display -depth 8 -size " +str(width)+ "x" + str(height) \ - + " gray:" + options.out_filename - print "(Use the spacebar to advance to next frames)" - options.repeat=False - file_sink=gr.file_sink(gr.sizeof_char, options.out_filename) - self.dst =file_sink - - self.agc=gr.agc_cc(1e-7,1.0,1.0) #1e-7 - self.am_demod = gr.complex_to_mag () - self.set_blacklevel=gr.add_const_ff(0.0) - self.invert_and_scale = gr.multiply_const_ff (0.0) #-self.contrast *128.0*255.0/(200.0) - - # now wire it all together - #sample_rate=options.width*options.height*options.framerate - - process_type='do_no_sync' - if process_type=='do_no_sync': - self.connect (self.src, self.agc,self.am_demod, - self.invert_and_scale, self.set_blacklevel, - f2uc,self.dst) - elif process_type=='do_tv_sync_adv': - #defaults: gr.tv_sync_adv (double sampling_freq, unsigned - #int tv_format,bool output_active_video_only=false, bool - #do_invert=false, double wanted_black_level=0.0, double - #wanted_white_level=255.0, double avg_alpha=0.1, double - #initial_gain=1.0, double initial_offset=0.0,bool - #debug=false) - - #note, this block is not yet in cvs - self.tv_sync_adv=gr.tv_sync_adv(usrp_rate, 0, False, False, - 0.0, 255.0, 0.01, 1.0, 0.0, False) - self.connect (self.src, self.am_demod, self.invert_and_scale, - self.tv_sync_adv, s2f, f2uc, self.dst) - - elif process_type=='do_nullsink': - #self.connect (self.src, self.am_demod,self.invert_and_scale,f2uc,video_sink) - c2r=gr.complex_to_real() - nullsink=gr.null_sink(gr.sizeof_float) - self.connect (self.src, c2r,nullsink) #video_sink) - elif process_type=='do_tv_sync_corr': - frame_size=width*height #int(usrp_rate/25.0) - nframes=10# 32 - search_window=20*nframes - debug=False - video_alpha=0.3 #0.1 - corr_alpha=0.3 - - #Note: this block is not yet in cvs - tv_corr=gr.tv_correlator_ff(frame_size,nframes, search_window, - video_alpha, corr_alpha,debug) - shift=gr.add_const_ff(-0.7) - - self.connect (self.src, self.agc, self.am_demod, tv_corr, - self.invert_and_scale, self.set_blacklevel, - f2uc, self.dst) - else: # process_type=='do_test_image': - src_vertical_bars = gr.sig_source_f (usrp_rate, gr.GR_SIN_WAVE, - 10.0 *usrp_rate/320, 255,128) - self.connect(src_vertical_bars, f2uc, self.dst) - - self._build_gui(vbox, usrp_rate, usrp_rate, usrp_rate) - - - frange = self.u.get_freq_range() - if(frange.start() > self.tv_freq_max or frange.stop() < self.tv_freq_min): - sys.stderr.write("Radio does not support required frequency range.\n") - sys.exit(1) - if(options.freq < self.tv_freq_min or options.freq > self.tv_freq_max): - sys.stderr.write("Requested frequency is outside of required frequency range.\n") - sys.exit(1) - - # set initial values - self.set_gain(options.gain) - self.set_contrast(self.contrast) - self.set_brightness(options.brightness) - if not(self.set_freq(options.freq)): - self._set_status_msg("Failed to set initial frequency") - - - def _set_status_msg(self, msg, which=0): - self.frame.GetStatusBar().SetStatusText(msg, which) - - - def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - - if 0: - self.src_fft = fftsink.fft_sink_c (self, self.panel, title="Data from USRP", - fft_size=512, sample_rate=usrp_rate) - self.connect (self.src, self.src_fft) - vbox.Add (self.src_fft.win, 4, wx.EXPAND) - - if 0: - post_demod_fft = fftsink.fft_sink_f (self, self.panel, title="Post Demod", - fft_size=512, sample_rate=demod_rate, - y_per_div=10, ref_level=-40) - self.connect (self.am_demod, post_demod_fft) - vbox.Add (post_demod_fft.win, 4, wx.EXPAND) - - if 0: - post_filt_fft = fftsink.fft_sink_f (self, self.panel, title="Post Filter", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=-40) - self.connect (self.set_blacklevel, post_filt) - vbox.Add (fft_win4, 4, wx.EXPAND) - - - # control area form at bottom - self.myform = myform = form.form() - - if not (self.u is None): - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - myform['freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="Freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) - - hbox.Add((5,0), 0) - myform['freq_slider'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3, - range=(self.tv_freq_min, self.tv_freq_max, 0.25e6), - callback=self.set_freq) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - - myform['contrast'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Contrast", - weight=3, range=(-2.0, 2.0, 0.1), - callback=self.set_contrast) - hbox.Add((5,0), 1) - - myform['brightness'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Brightness", - weight=3, range=(-255.0, 255.0, 1.0), - callback=self.set_brightness) - hbox.Add((5,0), 0) - - if not (self.u is None): - g = self.u.get_gain_range() - myform['gain'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain", - weight=3, range=(g.start(), g.stop(), g.step()), - callback=self.set_gain) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - try: - self.knob = powermate.powermate(self.frame) - self.rot = 0 - powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate) - powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button) - except: - print "FYI: No Powermate or Contour Knob found" - - - def on_rotate (self, event): - self.rot += event.delta - if (self.state == "FREQ"): - if self.rot >= 3: - self.set_freq(self.freq + .1e6) - self.rot -= 3 - elif self.rot <=-3: - self.set_freq(self.freq - .1e6) - self.rot += 3 - elif (self.state == "CONTRAST"): - step = 0.1 - if self.rot >= 3: - self.set_contrast(self.contrast + step) - self.rot -= 3 - elif self.rot <=-3: - self.set_contrast(self.contrast - step) - self.rot += 3 - else: - step = 1 - if self.rot >= 3: - self.set_brightness(self.brightness + step) - self.rot -= 3 - elif self.rot <=-3: - self.set_brightness(self.brightness - step) - self.rot += 3 - - def on_button (self, event): - if event.value == 0: # button up - return - self.rot = 0 - if self.state == "FREQ": - self.state = "CONTRAST" - elif self.state == "CONTRAST": - self.state = "BRIGHTNESS" - else: - self.state = "FREQ" - self.update_status_bar () - - - def set_contrast (self, contrast): - self.contrast = contrast - self.invert_and_scale.set_k(-self.contrast *128.0*255.0/(200.0)) - self.myform['contrast'].set_value(self.contrast) - self.update_status_bar () - - def set_brightness (self, brightness): - self.brightness = brightness - self.set_blacklevel.set_k(self.brightness +255.0) - self.myform['brightness'].set_value(self.brightness) - self.update_status_bar () - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - - Tuning is a two step process. First we ask the front-end to - tune as close to the desired frequency as it can. Then we use - the result of that operation and our target_frequency to - determine the value for the digital down converter. - """ - if not (self.u is None): - r = self.u.set_center_freq(target_freq) - if r: - self.freq = target_freq - self.myform['freq'].set_value(target_freq) # update displayed value - self.myform['freq_slider'].set_value(target_freq) # update displayed value - self.update_status_bar() - self._set_status_msg("OK", 0) - return True - - self._set_status_msg("Failed", 0) - return False - - def set_gain(self, gain): - if not (self.u is None): - self.gain=gain - self.myform['gain'].set_value(gain) # update displayed value - self.u.set_gain(gain) - self.update_status_bar() - - def update_status_bar (self): - msg = "Setting:%s Contrast:%r Brightness:%r Gain: %r" % \ - (self.state, self.contrast,self.brightness,self.gain) - self._set_status_msg(msg, 1) - #self.src_fft.set_baseband_freq(self.freq) - - -if __name__ == '__main__': - app = stdgui2.stdapp (tv_rx_block, "USRP TV RX black-and-white") - app.MainLoop () diff --git a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py b/gr-uhd/examples/python/usrp_tv_rcv_nogui.py deleted file mode 100755 index cfb36222c..000000000 --- a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py +++ /dev/null @@ -1,214 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 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. -# - -""" -Reads from a file and generates PAL TV pictures in black and white -which can be displayed using ImageMagick or realtime using -gr-video-sdl (To capture the input file Use usrp_rx_file.py, or use -usrp_rx_cfile.py --output-shorts if you have a recent enough -usrp_rx_cfile.py) - -Can also use usrp directly as capture source, but then you need a -higher decimation factor (64) and thus get a lower horizontal -resulution. There is no synchronisation yet. The sync blocks are in -development but not yet in cvs. - -""" - -from gnuradio import gr, eng_notation -from gnuradio import audio -from gnuradio import uhd -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -try: - from gnuradio import video_sdl -except: - print "FYI: gr-video-sdl is not installed" - print "realtime \"sdl\" video output window will not be available" - - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - usage=("%prog: [options] output_filename.\nSpecial output_filename" + \ - "\"sdl\" will use video_sink_sdl as realtime output window. " + \ - "You then need to have gr-video-sdl installed.\n" +\ - "Make sure your input capture file containes interleaved " + \ - "shorts not complex floats") - parser = OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6, - help="set sample rate") - parser.add_option("-c", "--contrast", type="eng_float", default=1.0, - help="set contrast (default is 1.0)") - parser.add_option("-b", "--brightness", type="eng_float", default=0.0, - help="set brightness (default is 0)") - parser.add_option("-i", "--in-filename", type="string", default=None, - help="Use input file as source. samples must be " + \ - "interleaved shorts \n Use usrp_rx_file.py or " + \ - "usrp_rx_cfile.py --output-shorts.\n Special " + \ - "name \"usrp\" results in realtime capturing " + \ - "and processing using usrp.\n" + \ - "You then probably need a decimation factor of 64 or higher.") - parser.add_option("-f", "--freq", type="eng_float", default=519.25e6, - help="set frequency to FREQ.\nNote that the frequency of the video carrier is not at the middle of the TV channel", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-p", "--pal", action="store_true", default=False, - help="PAL video format (this is the default)") - parser.add_option("-n", "--ntsc", action="store_true", default=False, - help="NTSC video format") - parser.add_option("-r", "--repeat", action="store_false", default=True, - help="repeat in_file in a loop") - parser.add_option("-N", "--nframes", type="eng_float", default=None, - help="number of frames to collect [default=+inf]") - parser.add_option("", "--freq-min", type="eng_float", default=50.25e6, - help="Set a minimum frequency [default=%default]") - parser.add_option("", "--freq-max", type="eng_float", default=900.25e6, - help="Set a maximum frequency [default=%default]") - (options, args) = parser.parse_args () - if not (len(args) == 1): - parser.print_help() - sys.stderr.write('You must specify the output. FILENAME or sdl \n'); - sys.exit(1) - - filename = args[0] - - self.tv_freq_min = options.freq_min - self.tv_freq_max = options.freq_max - - if options.in_filename is None: - parser.print_help() - sys.stderr.write('You must specify the input -i FILENAME or -i usrp\n'); - raise SystemExit, 1 - - if not (filename=="sdl"): - options.repeat=False - - input_rate = options.samp_rate - print "video sample rate %s" % (eng_notation.num_to_str(input_rate)) - - if not (options.in_filename=="usrp"): - # file is data source, capture with usr_rx_csfile.py - self.filesource = gr.file_source(gr.sizeof_short, - options.in_filename, - options.repeat) - self.istoc = gr.interleaved_short_to_complex() - self.connect(self.filesource,self.istoc) - self.src=self.istoc - else: - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - # build the graph - self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - self.u.set_samp_rate(input_rate) - dev_rate = self.u.get_samp_rate() - - self.src=self.u - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2.0 - self.u.set_gain(options.gain) - - r = self.u.set_center_freq(options.freq) - if not r: - sys.stderr.write('Failed to set frequency\n') - raise SystemExit, 1 - - - self.agc = gr.agc_cc(1e-7,1.0,1.0) #1e-7 - self.am_demod = gr.complex_to_mag () - self.set_blacklevel = gr.add_const_ff(options.brightness +255.0) - self.invert_and_scale = gr.multiply_const_ff (-options.contrast *128.0*255.0/(200.0)) - self.f2uc = gr.float_to_uchar() - - # sdl window as final sink - if not (options.pal or options.ntsc): - options.pal=True #set default to PAL - if options.pal: - lines_per_frame=625.0 - frames_per_sec=25.0 - show_width=768 - elif options.ntsc: - lines_per_frame=525.0 - frames_per_sec=29.97002997 - show_width=640 - width=int(input_rate/(lines_per_frame*frames_per_sec)) - height=int(lines_per_frame) - - if filename=="sdl": - #Here comes the tv screen, you have to build and install - #gr-video-sdl for this (subproject of gnuradio, only in cvs - #for now) - try: - video_sink = video_sdl.sink_uc(frames_per_sec, width, height, 0, - show_width,height) - except: - print "gr-video-sdl is not installed" - print "realtime \"sdl\" video output window is not available" - raise SystemExit, 1 - self.dst=video_sink - else: - print "You can use the imagemagick display tool to show the resulting imagesequence" - print "use the following line to show the demodulated TV-signal:" - print "display -depth 8 -size " +str(width)+ "x" + str(height) + " gray:" +filename - print "(Use the spacebar to advance to next frames)" - file_sink=gr.file_sink(gr.sizeof_char, filename) - self.dst =file_sink - - if options.nframes is None: - self.connect(self.src, self.agc) - else: - self.head = gr.head(gr.sizeof_gr_complex, int(options.nframes*width*height)) - self.connect(self.src, self.head, self.agc) - - self.connect (self.agc, self.am_demod, self.invert_and_scale, - self.set_blacklevel, self.f2uc, self.dst) - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-uhd/examples/python/usrp_wfm_rcv.py b/gr-uhd/examples/python/usrp_wfm_rcv.py deleted file mode 100755 index 8ec08260a..000000000 --- a/gr-uhd/examples/python/usrp_wfm_rcv.py +++ /dev/null @@ -1,286 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2009,2011 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. -# - -from gnuradio import gr, optfir, audio, blks2, uhd -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import slider, powermate -from gnuradio.wxgui import stdgui2, fftsink2, form -from optparse import OptionParser -import sys -import wx - - -class wfm_rx_block (stdgui2.std_top_block): - def __init__(self,frame,panel,vbox,argv): - stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv) - - parser=OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-f", "--freq", type="eng_float", default=100.1e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-V", "--volume", type="eng_float", default=None, - help="set volume (default is midpoint)") - parser.add_option("-O", "--audio-output", type="string", default="default", - help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") - parser.add_option("", "--freq-min", type="eng_float", default=87.9e6, - help="Set a minimum frequency [default=%default]") - parser.add_option("", "--freq-max", type="eng_float", default=108.1e6, - help="Set a maximum frequency [default=%default]") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - self.frame = frame - self.panel = panel - - self.vol = 0 - self.state = "FREQ" - self.freq = 0 - - self.fm_freq_min = options.freq_min - self.fm_freq_max = options.freq_max - - # build graph - self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - usrp_rate = 320e3 - demod_rate = 320e3 - audio_rate = 32e3 - audio_decim = int(demod_rate / audio_rate) - - self.u.set_samp_rate(usrp_rate) - dev_rate = self.u.get_samp_rate() - - nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 80e3, # passband cutoff - 115e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation - rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - - self.guts = blks2.wfm_rcv (demod_rate, audio_decim) - - self.volume_control = gr.multiply_const_ff(self.vol) - - # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), - options.audio_output, - False) # ok_to_block - - # now wire it all together - self.connect (self.u, self.chan_filt, self.guts, - self.volume_control, self.audio_sink) - - self._build_gui(vbox, usrp_rate, demod_rate, audio_rate) - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2 - - if options.volume is None: - g = self.volume_range() - options.volume = float(g[0]+g[1])/2 - - frange = self.u.get_freq_range() - if(frange.start() > self.fm_freq_max or frange.stop() < self.fm_freq_min): - sys.stderr.write("Radio does not support required frequency range.\n") - sys.exit(1) - if(options.freq < self.fm_freq_min or options.freq > self.fm_freq_max): - sys.stderr.write("Requested frequency is outside of required frequency range.\n") - sys.exit(1) - - - # set initial values - - self.set_gain(options.gain) - self.set_vol(options.volume) - if not(self.set_freq(options.freq)): - self._set_status_msg("Failed to set initial frequency") - - def _set_status_msg(self, msg, which=0): - self.frame.GetStatusBar().SetStatusText(msg, which) - - - def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - - if 1: - self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP", - fft_size=512, sample_rate=usrp_rate, - ref_scale=32768.0, ref_level=0, y_divs=12) - self.connect (self.u, self.src_fft) - vbox.Add (self.src_fft.win, 4, wx.EXPAND) - - if 1: - post_filt_fft = fftsink2.fft_sink_f(self.panel, title="Post Demod", - fft_size=1024, sample_rate=usrp_rate, - y_per_div=10, ref_level=0) - self.connect (self.guts.fm_demod, post_filt_fft) - vbox.Add (post_filt_fft.win, 4, wx.EXPAND) - - if 0: - post_deemph_fft = fftsink2.fft_sink_f(self.panel, title="Post Deemph", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=-20) - self.connect (self.guts.deemph, post_deemph_fft) - vbox.Add (post_deemph_fft.win, 4, wx.EXPAND) - - - # control area form at bottom - self.myform = myform = form.form() - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - myform['freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="Freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) - - hbox.Add((5,0), 0) - myform['freq_slider'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3, - range=(self.fm_freq_min, self.fm_freq_max, 0.1e6), - callback=self.set_freq) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - - myform['volume'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume", - weight=3, range=self.volume_range(), - callback=self.set_vol) - hbox.Add((5,0), 1) - - g = self.u.get_gain_range() - myform['gain'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain", - weight=3, range=(g.start(), g.stop(), g.step()), - callback=self.set_gain) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - try: - self.knob = powermate.powermate(self.frame) - self.rot = 0 - powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate) - powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button) - except: - print "FYI: No Powermate or Contour Knob found" - - - def on_rotate (self, event): - self.rot += event.delta - if (self.state == "FREQ"): - if self.rot >= 3: - self.set_freq(self.freq + .1e6) - self.rot -= 3 - elif self.rot <=-3: - self.set_freq(self.freq - .1e6) - self.rot += 3 - else: - step = self.volume_range()[2] - if self.rot >= 3: - self.set_vol(self.vol + step) - self.rot -= 3 - elif self.rot <=-3: - self.set_vol(self.vol - step) - self.rot += 3 - - def on_button (self, event): - if event.value == 0: # button up - return - self.rot = 0 - if self.state == "FREQ": - self.state = "VOL" - else: - self.state = "FREQ" - self.update_status_bar () - - - def set_vol (self, vol): - g = self.volume_range() - self.vol = max(g[0], min(g[1], vol)) - self.volume_control.set_k(10**(self.vol/10)) - self.myform['volume'].set_value(self.vol) - self.update_status_bar () - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - """ - - r = self.u.set_center_freq(target_freq) - if r: - self.freq = target_freq - self.myform['freq'].set_value(target_freq) # update displayed value - self.myform['freq_slider'].set_value(target_freq) # update displayed value - self.update_status_bar() - self._set_status_msg("OK", 0) - return True - - self._set_status_msg("Failed", 0) - return False - - def set_gain(self, gain): - self.myform['gain'].set_value(gain) # update displayed value - self.u.set_gain(gain) - - def update_status_bar (self): - msg = "Volume:%r Setting:%s" % (self.vol, self.state) - self._set_status_msg(msg, 1) - self.src_fft.set_baseband_freq(self.freq) - - def volume_range(self): - return (-20.0, 0.0, 0.5) - - -if __name__ == '__main__': - app = stdgui2.stdapp (wfm_rx_block, "USRP WFM RX") - app.MainLoop () diff --git a/gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py b/gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py deleted file mode 100755 index 83f1726c4..000000000 --- a/gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 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. -# - -from gnuradio import gr, optfir, audio, blks2, uhd -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys -import math - -class wfm_rx_block (gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser=OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default="A:0 A:0", - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--f1", type="eng_float", default=100.7e6, - help="set 1st station frequency to FREQ", metavar="FREQ") - parser.add_option("", "--f2", type="eng_float", default=102.5e6, - help="set 2nd station freq to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-O", "--audio-output", type="string", default="default", - help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") - parser.add_option("", "--freq-min", type="eng_float", default=87.9e6, - help="Set a minimum frequency [default=%default]") - parser.add_option("", "--freq-max", type="eng_float", default=108.1e6, - help="Set a maximum frequency [default=%default]") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if abs(options.f1 - options.f2) > 5.5e6: - print "Sorry, two stations must be within 5.5MHz of each other" - raise SystemExit - - f = (options.f1, options.f2) - - self.vol = .1 - self.state = "FREQ" - - self.fm_freq_min = options.freq_min - self.fm_freq_max = options.freq_max - - # build graph - stream_args = uhd.stream_args('fc32', channels=range(2)) - self.u = uhd.usrp_source(device_addr=options.args, stream_args=stream_args) - - # Set front end channel mapping - self.u.set_subdev_spec(options.spec) - - usrp_rate = 320e3 - demod_rate = 320e3 - audio_rate = 32e3 - audio_decim = int(demod_rate / audio_rate) - - self.u.set_samp_rate(usrp_rate) - dev_rate = self.u.get_samp_rate() - - # Make sure dboard can suppor the required frequencies - frange = self.u.get_freq_range() - if(frange.start() > self.fm_freq_max or frange.stop() < self.fm_freq_min): - sys.stderr.write("Radio does not support required frequency range.\n") - sys.exit(1) - - # sound card as final sink - self.audio_sink = audio.sink(int(audio_rate), options.audio_output) - - # taps for channel filter - nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 80e3, # passband cutoff - 115e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation - rrate = usrp_rate / dev_rate - - # set front end PLL to middle frequency - mid_freq = (f[0] + f[1]) / 2.0 - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2.0 - - for n in range(2): - chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - guts = blks2.wfm_rcv (demod_rate, audio_decim) - volume_control = gr.multiply_const_ff(self.vol) - - #self.connect((self.di, n), chan_filt) - self.connect((self.u, n), chan_filt) - self.connect(chan_filt, guts, volume_control) - self.connect(volume_control, (self.audio_sink, n)) - - # Test the the requested frequencies are in range - if(f[n] < self.fm_freq_min or f[n] > self.fm_freq_max): - sys.stderr.write("Requested frequency is outside of required frequency range.\n") - sys.exit(1) - - # Tune each channel by setting the RF freq to mid_freq and the - # DDC freq to f[n]. - tr = uhd.tune_request(f[n], rf_freq=mid_freq, - rf_freq_policy=uhd.tune_request.POLICY_MANUAL) - self.u.set_center_freq(tr, n) - - # Set gain for each channel - self.set_gain(options.gain, n) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, n) - - def set_vol (self, vol): - self.vol = vol - self.volume_control.set_k(self.vol) - - - def set_gain(self, gain, n): - self.u.set_gain(gain, n) - -if __name__ == '__main__': - tb = wfm_rx_block() - try: - tb.run() - except KeyboardInterrupt: - pass diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py b/gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py deleted file mode 100755 index 967a3bd8f..000000000 --- a/gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py +++ /dev/null @@ -1,349 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 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. -# - -from gnuradio import gr, optfir, audio, blks2, uhd -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import slider, powermate -from gnuradio.wxgui import stdgui2, fftsink2, form, scopesink2 -from optparse import OptionParser -import sys -import wx - -class wfm_rx_block (stdgui2.std_top_block): - def __init__(self,frame,panel,vbox,argv): - stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv) - - parser=OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-f", "--freq", type="eng_float", default=100.1e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-s", "--squelch", type="eng_float", default=0, - help="set squelch level (default is 0)") - parser.add_option("-V", "--volume", type="eng_float", default=None, - help="set volume (default is midpoint)") - parser.add_option("-O", "--audio-output", type="string", default="default", - help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") - parser.add_option("", "--freq-min", type="eng_float", default=87.9e6, - help="Set a minimum frequency [default=%default]") - parser.add_option("", "--freq-max", type="eng_float", default=108.1e6, - help="Set a maximum frequency [default=%default]") - - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - self.frame = frame - self.panel = panel - - self.vol = 0 - self.state = "FREQ" - self.freq = 0 - - self.fm_freq_min = options.freq_min - self.fm_freq_max = options.freq_max - - # build graph - self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - usrp_rate = 320e3 - demod_rate = 320e3 - audio_rate = 48e3 - audio_decim = 10 - - self.u.set_samp_rate(usrp_rate) - dev_rate = self.u.get_samp_rate() - - nfilts = 32 - chan_coeffs = gr.firdes.low_pass_2(10*nfilts, # gain - nfilts*usrp_rate, # sampling rate - 90e3, # passband cutoff - 30e3, # transition bw - 70) # stopband attenuation - rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - - self.guts = blks2.wfm_rcv_fmdet (demod_rate, audio_decim) - - chan_rate = audio_rate / (demod_rate/audio_decim) - self.rchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) - self.lchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) - - # FIXME rework {add,multiply}_const_* to handle multiple streams - self.volume_control_l = gr.multiply_const_ff(self.vol) - self.volume_control_r = gr.multiply_const_ff(self.vol) - - # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), - options.audio_output, - False) # ok_to_block - - # now wire it all together - self.connect (self.u, self.chan_filt, self.guts) - self.connect((self.guts, 0), self.lchan_filt, - self.volume_control_l, (self.audio_sink,0)) - self.connect((self.guts, 1), self.rchan_filt, - self.volume_control_r, (self.audio_sink,1)) - - try: - self.guts.stereo_carrier_pll_recovery.squelch_enable(True) - except: - print "FYI: This implementation of the stereo_carrier_pll_recovery has no squelch implementation yet" - - - self._build_gui(vbox, usrp_rate, demod_rate, audio_rate) - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2.0 - - if options.volume is None: - g = self.volume_range() - options.volume = float(g[0]+g[1])/2 - - if abs(options.freq) < 1e6: - options.freq *= 1e6 - - frange = self.u.get_freq_range() - if(frange.start() > self.fm_freq_max or frange.stop() < self.fm_freq_min): - sys.stderr.write("Radio does not support required frequency range.\n") - sys.exit(1) - if(options.freq < self.fm_freq_min or options.freq > self.fm_freq_max): - sys.stderr.write("Requested frequency is outside of required frequency range.\n") - sys.exit(1) - - # set initial values - self.set_gain(options.gain) - self.set_vol(options.volume) - try: - self.guts.stereo_carrier_pll_recovery.set_lock_threshold(options.squelch) - except: - print "FYI: This implementation of the stereo_carrier_pll_recovery has no squelch implementation yet" - - if not(self.set_freq(options.freq)): - self._set_status_msg("Failed to set initial frequency") - - def _set_status_msg(self, msg, which=0): - self.frame.GetStatusBar().SetStatusText(msg, which) - - - def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - - if 1: - self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP", - fft_size=512, sample_rate=usrp_rate, - ref_scale=32768.0, ref_level=0, y_divs=12) - self.connect (self.u, self.src_fft) - vbox.Add (self.src_fft.win, 4, wx.EXPAND) - - if 1: - post_fm_demod_fft = fftsink2.fft_sink_f(self.panel, title="Post FM Demod", - fft_size=512, sample_rate=demod_rate, - y_per_div=10, ref_level=0) - self.connect (self.guts.fm_demod, post_fm_demod_fft) - vbox.Add (post_fm_demod_fft.win, 4, wx.EXPAND) - - if 0: - post_stereo_carrier_generator_fft = fftsink2.fft_sink_c (self.panel, title="Post Stereo_carrier_generator", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=0) - self.connect (self.guts.stereo_carrier_generator, post_stereo_carrier_generator_fft) - vbox.Add (post_stereo_carrier_generator_fft.win, 4, wx.EXPAND) - - if 0: - post_deemphasis_left = fftsink2.fft_sink_f (self.panel, title="Post_Deemphasis_Left", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=0) - self.connect (self.guts.deemph_Left, post_deemphasis_left) - vbox.Add (post_deemphasis_left.win, 4, wx.EXPAND) - - if 0: - post_deemphasis_right = fftsink2.fft_sink_f(self.panel, title="Post_Deemphasis_Right", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=-20) - self.connect (self.guts.deemph_Left, post_deemphasis_right) - vbox.Add (post_deemphasis_right.win, 4, wx.EXPAND) - - - if 0: - LmR_fft = fftsink2.fft_sink_f(self.panel, title="LmR", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=-20) - self.connect (self.guts.LmR_real,LmR_fft) - vbox.Add (LmR_fft.win, 4, wx.EXPAND) - - if 0: - self.scope = scopesink2.scope_sink_f(self.panel, sample_rate=demod_rate) - self.connect (self.guts.fm_demod,self.scope) - vbox.Add (self.scope.win,4,wx.EXPAND) - - # control area form at bottom - self.myform = myform = form.form() - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - myform['freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="Freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) - - hbox.Add((5,0), 0) - myform['freq_slider'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3, - range=(self.fm_freq_min, self.fm_freq_max, 0.1e6), - callback=self.set_freq) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - - myform['volume'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume", - weight=3, range=self.volume_range(), - callback=self.set_vol) - hbox.Add((5,0), 1) - - g = self.u.get_gain_range() - myform['gain'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain", - weight=3, range=(g.start(), g.stop(), g.step()), - callback=self.set_gain) - hbox.Add((5,0), 0) - - myform['sqlch_thrsh'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Stereo Squelch Threshold", - weight=3, range=(0.0,1.0,0.01), - callback=self.set_squelch) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - try: - self.knob = powermate.powermate(self.frame) - self.rot = 0 - powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate) - powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button) - except: - print "FYI: No Powermate or Contour Knob found" - - - def on_rotate (self, event): - self.rot += event.delta - if (self.state == "FREQ"): - if self.rot >= 3: - self.set_freq(self.freq + .1e6) - self.rot -= 3 - elif self.rot <=-3: - self.set_freq(self.freq - .1e6) - self.rot += 3 - else: - step = self.volume_range()[2] - if self.rot >= 3: - self.set_vol(self.vol + step) - self.rot -= 3 - elif self.rot <=-3: - self.set_vol(self.vol - step) - self.rot += 3 - - def on_button (self, event): - if event.value == 0: # button up - return - self.rot = 0 - if self.state == "FREQ": - self.state = "VOL" - else: - self.state = "FREQ" - self.update_status_bar () - - - def set_vol (self, vol): - g = self.volume_range() - self.vol = max(g[0], min(g[1], vol)) - self.volume_control_l.set_k(10**(self.vol/10)) - self.volume_control_r.set_k(10**(self.vol/10)) - self.myform['volume'].set_value(self.vol) - self.update_status_bar () - - def set_squelch(self,squelch_threshold): - try: - self.guts.stereo_carrier_pll_recovery.set_lock_threshold(squelch_threshold); - except: - print "FYI: This implementation of the stereo_carrier_pll_recovery has no squelch implementation yet" - - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - """ - - r = self.u.set_center_freq(target_freq) - - if r: - self.freq = target_freq - self.myform['freq'].set_value(target_freq) # update displayed value - self.myform['freq_slider'].set_value(target_freq) # update displayed value - self.update_status_bar() - self._set_status_msg("OK", 0) - return True - - self._set_status_msg("Failed", 0) - return False - - def set_gain(self, gain): - self.myform['gain'].set_value(gain) # update displayed value - self.u.set_gain(gain) - - def update_status_bar (self): - msg = "Volume:%r Setting:%s" % (self.vol, self.state) - self._set_status_msg(msg, 1) - self.src_fft.set_baseband_freq(self.freq) - - def volume_range(self): - return (-20.0, 0.0, 0.5) - - -if __name__ == '__main__': - app = stdgui2.stdapp (wfm_rx_block, "USRP WFM RX") - app.MainLoop () diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_nogui.py b/gr-uhd/examples/python/usrp_wfm_rcv_nogui.py deleted file mode 100755 index 9a7558dc7..000000000 --- a/gr-uhd/examples/python/usrp_wfm_rcv_nogui.py +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 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. -# - -from gnuradio import gr, optfir, audio, blks2, uhd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -class wfm_rx_block (gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser=OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-f", "--freq", type="eng_float", default=100.1e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-V", "--volume", type="eng_float", default=None, - help="set volume (default is midpoint)") - parser.add_option("-O", "--audio-output", type="string", default="default", - help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") - parser.add_option("", "--freq-min", type="eng_float", default=87.9e6, - help="Set a minimum frequency [default=%default]") - parser.add_option("", "--freq-max", type="eng_float", default=108.1e6, - help="Set a maximum frequency [default=%default]") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - self.state = "FREQ" - self.freq = 0 - - self.fm_freq_min = options.freq_min - self.fm_freq_max = options.freq_max - - # build graph - self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - usrp_rate = 320e3 - demod_rate = 320e3 - audio_rate = 32e3 - audio_decim = int(demod_rate / audio_rate) - - self.u.set_samp_rate(usrp_rate) - dev_rate = self.u.get_samp_rate() - - nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 80e3, # passband cutoff - 115e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation - rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - - self.guts = blks2.wfm_rcv (demod_rate, audio_decim) - - self.volume_control = gr.multiply_const_ff(1) - - # sound card as final sink - self.audio_sink = audio.sink(int(audio_rate), - options.audio_output, - False) # ok_to_block - - # now wire it all together - self.connect (self.u, self.chan_filt, self.guts, - self.volume_control, self.audio_sink) - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2.0 - - if options.volume is None: - g = self.volume_range() - options.volume = float(g[0]+g[1])/2 - - frange = self.u.get_freq_range() - if(frange.start() > self.fm_freq_max or frange.stop() < self.fm_freq_min): - sys.stderr.write("Radio does not support required frequency range.\n") - sys.exit(1) - if(options.freq < self.fm_freq_min or options.freq > self.fm_freq_max): - sys.stderr.write("Requested frequency is outside of required frequency range.\n") - sys.exit(1) - - # set initial values - self.set_gain(options.gain) - self.set_vol(options.volume) - if not(self.set_freq(options.freq)): - self._set_status_msg("Failed to set initial frequency") - - def set_vol (self, vol): - g = self.volume_range() - self.vol = max(g[0], min(g[1], vol)) - self.volume_control.set_k(10**(self.vol/10)) - self.update_status_bar () - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - """ - - r = self.u.set_center_freq(target_freq) - - if r: - self.freq = target_freq - self.update_status_bar() - self._set_status_msg("OK", 0) - return True - - self._set_status_msg("Failed", 0) - return False - - def set_gain(self, gain): - self.u.set_gain(gain) - - def update_status_bar (self): - msg = "Freq: %s Volume:%f Setting:%s" % ( - eng_notation.num_to_str(self.freq), self.vol, self.state) - self._set_status_msg(msg, 1) - - def _set_status_msg(self, msg, which=0): - print msg - - def volume_range(self): - return (-20.0, 0.0, 0.5) - - -if __name__ == '__main__': - tb = wfm_rx_block() - try: - tb.run() - except KeyboardInterrupt: - pass diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_pll.py b/gr-uhd/examples/python/usrp_wfm_rcv_pll.py deleted file mode 100755 index 874cab4a8..000000000 --- a/gr-uhd/examples/python/usrp_wfm_rcv_pll.py +++ /dev/null @@ -1,346 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 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. -# - -from gnuradio import gr, optfir, audio, blks2, uhd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import slider, powermate -from gnuradio.wxgui import stdgui2, fftsink2, form, scopesink2 -from optparse import OptionParser -import sys -import wx - -class wfm_rx_block (stdgui2.std_top_block): - def __init__(self,frame,panel,vbox,argv): - stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv) - - parser=OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-f", "--freq", type="eng_float", default=100.1e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-s", "--squelch", type="eng_float", default=0, - help="set squelch level (default is 0)") - parser.add_option("-V", "--volume", type="eng_float", default=None, - help="set volume (default is midpoint)") - parser.add_option("-O", "--audio-output", type="string", default="default", - help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") - parser.add_option("", "--freq-min", type="eng_float", default=87.9e6, - help="Set a minimum frequency [default=%default]") - parser.add_option("", "--freq-max", type="eng_float", default=108.1e6, - help="Set a maximum frequency [default=%default]") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - self.frame = frame - self.panel = panel - - self.vol = 0 - self.state = "FREQ" - self.freq = 0 - - self.fm_freq_min = options.freq_min - self.fm_freq_max = options.freq_max - - # build graph - self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - usrp_rate = 320e3 - demod_rate = 320e3 - audio_rate = 48e3 - audio_decim = 10 - - self.u.set_samp_rate(usrp_rate) - dev_rate = self.u.get_samp_rate() - - nfilts = 32 - chan_coeffs = gr.firdes.low_pass_2 (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 90e3, # passband cutoff - 30e3, # stopband cutoff - 70) # stopband attenuation - rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - - - self.guts = blks2.wfm_rcv_pll (demod_rate, audio_decim) - - chan_rate = audio_rate / (demod_rate/audio_decim) - self.rchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) - self.lchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) - - # FIXME rework {add,multiply}_const_* to handle multiple streams - self.volume_control_l = gr.multiply_const_ff(self.vol) - self.volume_control_r = gr.multiply_const_ff(self.vol) - - # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), - options.audio_output, - False) # ok_to_block - - # now wire it all together - self.connect (self.u, self.chan_filt, self.guts) - self.connect((self.guts, 0), self.lchan_filt, - self.volume_control_l, (self.audio_sink,0)) - self.connect((self.guts, 1), self.rchan_filt, - self.volume_control_r, (self.audio_sink,1)) - - try: - self.guts.stereo_carrier_pll_recovery.squelch_enable(True) - except: - print "FYI: This implementation of the stereo_carrier_pll_recovery has no squelch implementation yet" - - - self._build_gui(vbox, usrp_rate, demod_rate, audio_rate) - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2.0 - - if options.volume is None: - g = self.volume_range() - options.volume = float(g[0]+g[1])/2 - - frange = self.u.get_freq_range() - if(frange.start() > self.fm_freq_max or frange.stop() < self.fm_freq_min): - sys.stderr.write("Radio does not support required frequency range.\n") - sys.exit(1) - if(options.freq < self.fm_freq_min or options.freq > self.fm_freq_max): - sys.stderr.write("Requested frequency is outside of required frequency range.\n") - sys.exit(1) - - # set initial values - self.set_gain(options.gain) - self.set_vol(options.volume) - try: - self.guts.stereo_carrier_pll_recovery.set_lock_threshold(options.squelch) - except: - print "FYI: This implementation of the stereo_carrier_pll_recovery has no squelch implementation yet" - - if not(self.set_freq(options.freq)): - self._set_status_msg("Failed to set initial frequency") - - def _set_status_msg(self, msg, which=0): - self.frame.GetStatusBar().SetStatusText(msg, which) - - - def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - - if 1: - self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP", - fft_size=512, sample_rate=usrp_rate, - ref_scale=32768.0, ref_level=0, y_divs=12) - self.connect (self.u, self.src_fft) - vbox.Add (self.src_fft.win, 4, wx.EXPAND) - - if 1: - post_fm_demod_fft = fftsink2.fft_sink_f(self.panel, title="Post FM Demod", - fft_size=512, sample_rate=demod_rate, - y_per_div=10, ref_level=0) - self.connect (self.guts.fm_demod, post_fm_demod_fft) - vbox.Add (post_fm_demod_fft.win, 4, wx.EXPAND) - - if 0: - post_stereo_carrier_generator_fft = fftsink2.fft_sink_c (self.panel, title="Post Stereo_carrier_generator", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=0) - self.connect (self.guts.stereo_carrier_generator, post_stereo_carrier_generator_fft) - vbox.Add (post_stereo_carrier_generator_fft.win, 4, wx.EXPAND) - - if 0: - post_deemphasis_left = fftsink2.fft_sink_f (self.panel, title="Post_Deemphasis_Left", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=0) - self.connect (self.guts.deemph_Left, post_deemphasis_left) - vbox.Add (post_deemphasis_left.win, 4, wx.EXPAND) - - if 0: - post_deemphasis_right = fftsink2.fft_sink_f(self.panel, title="Post_Deemphasis_Right", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=-20) - self.connect (self.guts.deemph_Left, post_deemphasis_right) - vbox.Add (post_deemphasis_right.win, 4, wx.EXPAND) - - - if 0: - LmR_fft = fftsink2.fft_sink_f(self.panel, title="LmR", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=-20) - self.connect (self.guts.LmR_real,LmR_fft) - vbox.Add (LmR_fft.win, 4, wx.EXPAND) - - if 0: - self.scope = scopesink2.scope_sink_f(self.panel, sample_rate=demod_rate) - self.connect (self.guts.fm_demod,self.scope) - vbox.Add (self.scope.win,4,wx.EXPAND) - - # control area form at bottom - self.myform = myform = form.form() - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - myform['freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="Freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) - - hbox.Add((5,0), 0) - myform['freq_slider'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3, - range=(self.fm_freq_min, self.fm_freq_max, 0.1e6), - callback=self.set_freq) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - - myform['volume'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume", - weight=3, range=self.volume_range(), - callback=self.set_vol) - hbox.Add((5,0), 1) - - g = self.u.get_gain_range() - myform['gain'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain", - weight=3, range=(g.start(), g.stop(), g.step()), - callback=self.set_gain) - hbox.Add((5,0), 0) - - myform['sqlch_thrsh'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Stereo Squelch Threshold", - weight=3, range=(0.0,1.0,0.01), - callback=self.set_squelch) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - try: - self.knob = powermate.powermate(self.frame) - self.rot = 0 - powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate) - powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button) - except: - print "FYI: No Powermate or Contour Knob found" - - - def on_rotate (self, event): - self.rot += event.delta - if (self.state == "FREQ"): - if self.rot >= 3: - self.set_freq(self.freq + .1e6) - self.rot -= 3 - elif self.rot <=-3: - self.set_freq(self.freq - .1e6) - self.rot += 3 - else: - step = self.volume_range()[2] - if self.rot >= 3: - self.set_vol(self.vol + step) - self.rot -= 3 - elif self.rot <=-3: - self.set_vol(self.vol - step) - self.rot += 3 - - def on_button (self, event): - if event.value == 0: # button up - return - self.rot = 0 - if self.state == "FREQ": - self.state = "VOL" - else: - self.state = "FREQ" - self.update_status_bar () - - - def set_vol (self, vol): - g = self.volume_range() - self.vol = max(g[0], min(g[1], vol)) - self.volume_control_l.set_k(10**(self.vol/10)) - self.volume_control_r.set_k(10**(self.vol/10)) - self.myform['volume'].set_value(self.vol) - self.update_status_bar () - - def set_squelch(self,squelch_threshold): - try: - self.guts.stereo_carrier_pll_recovery.set_lock_threshold(squelch_threshold); - except: - print "FYI: This implementation of the stereo_carrier_pll_recovery has no squelch implementation yet" - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - """ - - r = self.u.set_center_freq(target_freq) - - if r: - self.freq = target_freq - self.myform['freq'].set_value(target_freq) # update displayed value - self.myform['freq_slider'].set_value(target_freq) # update displayed value - self.update_status_bar() - self._set_status_msg("OK", 0) - return True - - self._set_status_msg("Failed", 0) - return False - - def set_gain(self, gain): - self.myform['gain'].set_value(gain) # update displayed value - self.u.set_gain(gain) - - def update_status_bar (self): - msg = "Volume:%r Setting:%s" % (self.vol, self.state) - self._set_status_msg(msg, 1) - self.src_fft.set_baseband_freq(self.freq) - - def volume_range(self): - return (-20.0, 0.0, 0.5) - - -if __name__ == '__main__': - app = stdgui2.stdapp (wfm_rx_block, "USRP WFM RX") - app.MainLoop () diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_sca.py b/gr-uhd/examples/python/usrp_wfm_rcv_sca.py deleted file mode 100755 index 4c6aec23f..000000000 --- a/gr-uhd/examples/python/usrp_wfm_rcv_sca.py +++ /dev/null @@ -1,403 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2011 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 this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -""" -Here is a bit of code that will receive SCA analog subcarriers of FM -Broadcast Stations using the USRP. It is a modified version of -usrp_wfm_rcv.py. - -Common SCA frequencies are 67 kHz and 92 kHz. SCA is used for Reading -Services for the Blind, Background Music, Foreign Language Services, and -other services. Remember you may hear static when tuned to a FM station -because this code only outputs SCA audio. - -The USRP gain is critical for good decoding. Adjust for minimum noise. - I use the Post FM Demod FFT to check for SCA subcarriers and to adjust -the USRP gain for the lowest noise floor. The stereo pilot at 19 KHz, -the stereo difference signal around 38 KHz, and RDS at 57 KHz are also -displayed on the Post FM Demod FFT if present. - -The range below 67 kHz is used for SCA only when Stereo is not used. - -The SCA recieve range is not as far as the main FM carrier receive range -so tune in strong local stations first. - -I tried to comment the code with the various parameters. There seems to -be several choices for a couple of them. I coded the common ones I see -here. - -In the local area there are a couple of stations using digital SCA. -These look similar to narrow DRM signals and I wonder if they are using -OFDM. -""" - - -from gnuradio import gr, optfir, audio, blks2, uhd -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import slider, powermate -from gnuradio.wxgui import stdgui2, fftsink2, form -from optparse import OptionParser -import sys -import math -import wx - -class wfm_rx_sca_block (stdgui2.std_top_block): - def __init__(self,frame,panel,vbox,argv): - stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv) - - parser=OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-f", "--freq", type="eng_float", default=100.1e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-V", "--volume", type="eng_float", default=None, - help="set volume (default is midpoint)") - parser.add_option("-O", "--audio-output", type="string", default="default", - help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") - parser.add_option("", "--freq-min", type="eng_float", default=87.9e6, - help="Set a minimum frequency [default=%default]") - parser.add_option("", "--freq-max", type="eng_float", default=108.1e6, - help="Set a maximum frequency [default=%default]") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - self.frame = frame - self.panel = panel - - self.vol = 0 - self.state = "FREQ" - self.freq = 0 - - self.fm_freq_min = options.freq_min - self.fm_freq_max = options.freq_max - - # build graph - - self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - usrp_rate = 320e3 - demod_rate = 320e3 - audio_rate = 32e3 - sca_demod_rate = 64e3 - audio_decim = int(demod_rate / audio_rate) - sca_chanfilt_decim = int(demod_rate / sca_demod_rate) - - self.u.set_samp_rate(usrp_rate) - dev_rate = self.u.get_samp_rate() - - nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 100e3, # passband cutoff - 140e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation - rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - - #Create demodulator block for Main FM Channel - max_dev = 75e3 - fm_demod_gain = demod_rate/(2*math.pi*max_dev) - self.fm_demod = gr.quadrature_demod_cf (fm_demod_gain) - - # Note - deemphasis is not applied to the Main FM Channel as - # main audio is not decoded - - # SCA Devation is 10% of carrier but some references say 20% - # if mono with one SCA (6 KHz seems typical) - max_sca_dev = 6e3 - - # Create filter to get SCA channel we want - sca_chan_coeffs = gr.firdes.low_pass (1.0, # gain - demod_rate, # sampling rate - max_sca_dev, # cutoff freq - max_sca_dev/3, # trans. band - gr.firdes.WIN_HANN) # filter type - - self.ddc = gr.freq_xlating_fir_filter_fcf(sca_chanfilt_decim, # decim rate - sca_chan_coeffs, # taps - 0, # freq translation amount (Gets set by the UI) - demod_rate) # input sample rate - - #Create demodulator block for SCA Channel - sca_demod_gain = sca_demod_rate/(2*math.pi*max_sca_dev) - self.fm_demod_sca = gr.quadrature_demod_cf (sca_demod_gain) - - - # SCA analog audio is bandwidth limited to 5 KHz - max_sca_audio_freq = 5.0e3 - - # SCA analog deephasis is 150 uS (75 uS may be used) - sca_tau = 150e-6 - - # compute FIR filter taps for SCA audio filter - audio_coeffs = gr.firdes.low_pass (1.0, # gain - sca_demod_rate, # sampling rate - max_sca_audio_freq, # cutoff freq - max_sca_audio_freq/2.5, # trans. band - gr.firdes.WIN_HAMMING) - - # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decim, audio_coeffs) - - # Create deemphasis block that is applied after SCA demodulation - self.deemph = blks2.fm_deemph (audio_rate, sca_tau) - - self.volume_control = gr.multiply_const_ff(self.vol) - - # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), - options.audio_output, - False) # ok_to_block - - # now wire it all together - self.connect (self.u, self.chan_filt, self.fm_demod, - self.ddc, self.fm_demod_sca) - self.connect (self.fm_demod_sca, self.audio_filter, - self.deemph, self.volume_control, - self.audio_sink) - - self._build_gui(vbox, usrp_rate, demod_rate, sca_demod_rate, audio_rate) - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2 - - if options.volume is None: - g = self.volume_range() - options.volume = float(g[0]+g[1])/2 - - frange = self.u.get_freq_range() - if(frange.start() > self.fm_freq_max or frange.stop() < self.fm_freq_min): - sys.stderr.write("Radio does not support required frequency range.\n") - sys.exit(1) - if(options.freq < self.fm_freq_min or options.freq > self.fm_freq_max): - sys.stderr.write("Requested frequency is outside of required frequency range.\n") - sys.exit(1) - - # set initial values - - self.set_gain(options.gain) - self.set_vol(options.volume) - if not(self.set_freq(options.freq)): - self._set_status_msg("Failed to set initial frequency") - self.set_sca_freq(67000) # A common SCA Frequency - - def _set_status_msg(self, msg, which=0): - self.frame.GetStatusBar().SetStatusText(msg, which) - - - def _build_gui(self, vbox, usrp_rate, demod_rate, sca_demod_rate, audio_rate): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - def _form_set_sca_freq(kv): - return self.set_sca_freq(kv['sca_freq']) - - if 1: - self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP", - fft_size=512, sample_rate=usrp_rate, - ref_scale=32768.0, ref_level=0, y_divs=12) - self.connect (self.u, self.src_fft) - vbox.Add (self.src_fft.win, 4, wx.EXPAND) - - if 1: - post_demod_fft = fftsink2.fft_sink_f(self.panel, title="Post FM Demod", - fft_size=2048, sample_rate=demod_rate, - y_per_div=10, ref_level=0) - self.connect (self.fm_demod, post_demod_fft) - vbox.Add (post_demod_fft.win, 4, wx.EXPAND) - - if 0: - post_demod_sca_fft = fftsink2.fft_sink_f(self.panel, title="Post SCA Demod", - fft_size=1024, sample_rate=sca_demod_rate, - y_per_div=10, ref_level=0) - self.connect (self.fm_demod_sca, post_demod_sca_fft) - vbox.Add (post_demod_sca_fft.win, 4, wx.EXPAND) - - if 0: - post_deemph_fft = fftsink2.fft_sink_f (self.panel, title="Post SCA Deemph", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=-20) - self.connect (self.deemph, post_deemph_fft) - vbox.Add (post_deemph_fft.win, 4, wx.EXPAND) - - - # control area form at bottom - self.myform = myform = form.form() - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - myform['freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="Freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) - - hbox.Add((5,0), 0) - myform['freq_slider'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3, - range=(self.fm_freq_min, self.fm_freq_max, 0.1e6), - callback=self.set_freq) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - myform['sca_freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="SCA", weight=1, - callback=myform.check_input_and_call(_form_set_sca_freq, self._set_status_msg)) - - hbox.Add((5,0), 0) - myform['sca_freq_slider'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3, - range=(38e3, 100e3, 1.0e3), - callback=self.set_sca_freq) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - - myform['volume'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume", - weight=3, range=self.volume_range(), - callback=self.set_vol) - hbox.Add((5,0), 1) - - g = self.u.get_gain_range() - myform['gain'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain", - weight=3, range=(g.start(), g.stop(), g.step()), - callback=self.set_gain) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - try: - self.knob = powermate.powermate(self.frame) - self.rot = 0 - powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate) - powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button) - except: - print "FYI: No Powermate or Contour Knob found" - - - def on_rotate (self, event): - self.rot += event.delta - if (self.state == "FREQ"): - if self.rot >= 3: - self.set_freq(self.freq + .1e6) - self.rot -= 3 - elif self.rot <=-3: - self.set_freq(self.freq - .1e6) - self.rot += 3 - else: - step = self.volume_range()[2] - if self.rot >= 3: - self.set_vol(self.vol + step) - self.rot -= 3 - elif self.rot <=-3: - self.set_vol(self.vol - step) - self.rot += 3 - - def on_button (self, event): - if event.value == 0: # button up - return - self.rot = 0 - if self.state == "FREQ": - self.state = "VOL" - else: - self.state = "FREQ" - self.update_status_bar () - - - def set_vol (self, vol): - g = self.volume_range() - self.vol = max(g[0], min(g[1], vol)) - self.volume_control.set_k(10**(self.vol/10)) - self.myform['volume'].set_value(self.vol) - self.update_status_bar () - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - - Tuning is a two step process. First we ask the front-end to - tune as close to the desired frequency as it can. Then we use - the result of that operation and our target_frequency to - determine the value for the digital down converter. - """ - r = self.u.set_center_freq(target_freq) - if r: - self.freq = target_freq - self.myform['freq'].set_value(target_freq) # update displayed value - self.myform['freq_slider'].set_value(target_freq) # update displayed value - self.update_status_bar() - self._set_status_msg("OK", 0) - return True - self._set_status_msg("Failed", 0) - return False - - def set_sca_freq(self, target_sca_freq): - - self.ddc.set_center_freq(-target_sca_freq) - self.myform['sca_freq'].set_value(target_sca_freq) # update displayed value - self.myform['sca_freq_slider'].set_value(target_sca_freq) # update displayed value - self.update_status_bar() - self._set_status_msg("OK", 0) - return True - - def set_gain(self, gain): - self.myform['gain'].set_value(gain) # update displayed value - self.u.set_gain(gain) - - def update_status_bar (self): - msg = "Volume:%r Setting:%s" % (self.vol, self.state) - self._set_status_msg(msg, 1) - self.src_fft.set_baseband_freq(self.freq) - - def volume_range(self): - return (-20.0, 0.0, 0.5) - - -if __name__ == '__main__': - app = stdgui2.stdapp (wfm_rx_sca_block, "USRP WFM SCA RX") - app.MainLoop () diff --git a/gr-uhd/examples/python/usrp_wxapt_rcv.py b/gr-uhd/examples/python/usrp_wxapt_rcv.py deleted file mode 100755 index aaf297089..000000000 --- a/gr-uhd/examples/python/usrp_wxapt_rcv.py +++ /dev/null @@ -1,282 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 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. -# - -from gnuradio import gr, audio, blks2, uhd -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import slider, powermate -from gnuradio.wxgui import stdgui2, fftsink2, form -from optparse import OptionParser -import sys -import wx - - -class wxapt_rx_block (stdgui2.std_top_block): - def __init__(self,frame,panel,vbox,argv): - stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv) - - parser=OptionParser(option_class=eng_option) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args, [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-f", "--freq", type="eng_float", default=137.5e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-V", "--volume", type="eng_float", default=None, - help="set volume (default is midpoint)") - parser.add_option("-O", "--audio-output", type="string", default="default", - help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") - parser.add_option("", "--freq-min", type="eng_float", default=137e6, - help="Set a minimum frequency [default=%default]") - parser.add_option("", "--freq-max", type="eng_float", default=138e6, - help="Set a maximum frequency [default=%default]") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - self.frame = frame - self.panel = panel - - self.vol = 0 - self.state = "FREQ" - self.freq = 0 - - self.freq_min = options.freq_min - self.freq_max = options.freq_max - - # build graph - self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - - usrp_rate = 320e3 - demod_rate = 320e3 - audio_rate = 32e3 - audio_decim = int(demod_rate / audio_rate) - - self.u.set_samp_rate(usrp_rate) - dev_rate = self.u.get_samp_rate() - - nfilts = 32 - chan_coeffs = gr.firdes.low_pass_2 (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 40e3, # passband cutoff - 20e3, # transition bw - 60) # stopband attenuation - rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - - self.guts = blks2.wfm_rcv (demod_rate, audio_decim) - - self.volume_control = gr.multiply_const_ff(self.vol) - - # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), options.audio_output) - - # now wire it all together - self.connect (self.u, self.chan_filt, self.guts, - self.volume_control, self.audio_sink) - - self._build_gui(vbox, usrp_rate, demod_rate, audio_rate) - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - options.gain = float(g.start()+g.stop())/2.0 - - if options.volume is None: - g = self.volume_range() - options.volume = float(g[0]+g[1])/2 - - frange = self.u.get_freq_range() - if(frange.start() > self.freq_max or frange.stop() < self.freq_min): - sys.stderr.write("Radio does not support required frequency range.\n") - sys.exit(1) - if(options.freq < self.freq_min or options.freq > self.freq_max): - sys.stderr.write("Requested frequency is outside of required frequency range.\n") - sys.exit(1) - - # set initial values - self.set_gain(options.gain) - self.set_vol(options.volume) - if not(self.set_freq(options.freq)): - self._set_status_msg("Failed to set initial frequency") - - def _set_status_msg(self, msg, which=0): - self.frame.GetStatusBar().SetStatusText(msg, which) - - - def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - - if 1: - self.src_fft = fftsink2.fft_sink_c (self.panel, title="Data from USRP", - fft_size=512, sample_rate=usrp_rate, - ref_scale=32768.0, ref_level=0, y_divs=12) - self.connect (self.u, self.src_fft) - vbox.Add (self.src_fft.win, 4, wx.EXPAND) - - if 1: - post_deemph_fft = fftsink2.fft_sink_f (self.panel, title="Post Deemph", - fft_size=512, sample_rate=demod_rate, - y_per_div=10, ref_level=-20) - self.connect (self.guts.deemph, post_deemph_fft) - vbox.Add (post_deemph_fft.win, 4, wx.EXPAND) - - if 1: - post_filt_fft = fftsink2.fft_sink_f (self.panel, title="Post Filter", - fft_size=512, sample_rate=audio_rate, - y_per_div=10, ref_level=0) - self.connect (self.guts.audio_filter, post_filt_fft) - vbox.Add (post_filt_fft.win, 4, wx.EXPAND) - - - # control area form at bottom - self.myform = myform = form.form() - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - myform['freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="Freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) - - hbox.Add((5,0), 0) - myform['freq_slider'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3, - range=(self.freq_min, self.freq_max, 0.0005e6), - callback=self.set_freq) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - - myform['volume'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume", - weight=3, range=self.volume_range(), - callback=self.set_vol) - hbox.Add((5,0), 1) - - g = self.u.get_gain_range() - myform['gain'] = \ - form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain", - weight=3, range=(g.start(), g.start(), g.step()), - callback=self.set_gain) - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - try: - self.knob = powermate.powermate(self.frame) - self.rot = 0 - powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate) - powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button) - except: - print "FYI: No Powermate or Contour Knob found" - - - def on_rotate (self, event): - self.rot += event.delta - if (self.state == "FREQ"): - if self.rot >= 3: - self.set_freq(self.freq + .1e6) - self.rot -= 3 - elif self.rot <=-3: - self.set_freq(self.freq - .1e6) - self.rot += 3 - else: - step = self.volume_range()[2] - if self.rot >= 3: - self.set_vol(self.vol + step) - self.rot -= 3 - elif self.rot <=-3: - self.set_vol(self.vol - step) - self.rot += 3 - - def on_button (self, event): - if event.value == 0: # button up - return - self.rot = 0 - if self.state == "FREQ": - self.state = "VOL" - else: - self.state = "FREQ" - self.update_status_bar () - - - def set_vol (self, vol): - g = self.volume_range() - self.vol = max(g[0], min(g[1], vol)) - self.volume_control.set_k(10**(self.vol/10)) - self.myform['volume'].set_value(self.vol) - self.update_status_bar () - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - """ - - r = self.u.set_center_freq(target_freq) - - if r: - self.freq = target_freq - self.myform['freq'].set_value(target_freq) # update displayed value - self.myform['freq_slider'].set_value(target_freq) # update displayed value - self.update_status_bar() - self._set_status_msg("OK", 0) - return True - - self._set_status_msg("Failed", 0) - return False - - def set_gain(self, gain): - self.myform['gain'].set_value(gain) # update displayed value - self.u.set_gain(gain) - - def update_status_bar (self): - msg = "Volume:%r Setting:%s" % (self.vol, self.state) - self._set_status_msg(msg, 1) - self.src_fft.set_baseband_freq(self.freq) - - def volume_range(self): - return (-20.0, 0.0, 0.5) - - -if __name__ == '__main__': - app = stdgui2.stdapp (wxapt_rx_block, "USRP WXAPT RX") - app.MainLoop () diff --git a/gr-uhd/gnuradio-uhd.pc.in b/gr-uhd/gnuradio-uhd.pc.in deleted file mode 100644 index 721141c52..000000000 --- a/gr-uhd/gnuradio-uhd.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-uhd -Description: GNU Radio blocks for UHD -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-uhd -Cflags: -I${includedir} diff --git a/gr-uhd/grc/CMakeLists.txt b/gr-uhd/grc/CMakeLists.txt deleted file mode 100644 index 2d8f24aa3..000000000 --- a/gr-uhd/grc/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Rules for generating the source and sink xml wrappers -######################################################################## -include(GrPython) - -macro(GEN_BLOCK_XML _generator _xml_block) - set(generator ${CMAKE_CURRENT_SOURCE_DIR}/${_generator}) - set(xml_block ${CMAKE_CURRENT_BINARY_DIR}/${_xml_block}) - list(APPEND xml_blocks ${xml_block}) - add_custom_command( - DEPENDS ${generator} OUTPUT ${xml_block} - COMMAND ${PYTHON_EXECUTABLE} ${generator} ${xml_block} - ) -endmacro(GEN_BLOCK_XML) - -GEN_BLOCK_XML(gen_uhd_usrp_blocks.py uhd_usrp_source.xml) -GEN_BLOCK_XML(gen_uhd_usrp_blocks.py uhd_usrp_sink.xml) - -add_custom_target(uhd_grc_xml_blocks ALL DEPENDS ${xml_blocks}) - -install(FILES - ${xml_blocks} - uhd_amsg_source.xml - uhd_block_tree.xml - DESTINATION ${GRC_BLOCKS_DIR} - COMPONENT "uhd_python" -) diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py deleted file mode 100644 index 3b7602958..000000000 --- a/gr-uhd/grc/gen_uhd_usrp_blocks.py +++ /dev/null @@ -1,453 +0,0 @@ -""" -Copyright 2010-2011 Free Software Foundation, Inc. - -This file is part of GNU Radio - -GNU Radio Companion 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 2 -of the License, or (at your option) any later version. - -GNU Radio Companion 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, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -""" - -MAIN_TMPL = """\ -<?xml version="1.0"?> -<block> - <name>UHD: USRP $sourk.title()</name> - <key>uhd_usrp_$(sourk)</key> - <throttle>1</throttle> - <import>from gnuradio import uhd</import> - <import>import time</import> - <make>uhd.usrp_$(sourk)( - device_addr=\$dev_addr, - stream_args=uhd.stream_args( - cpu_format="\$type", - \#if \$otw() - otw_format=\$otw, - \#end if - \#if \$stream_args() - args=\$stream_args, - \#end if - \#if \$stream_chans() - channels=\$stream_chans, - \#else - channels=range(\$nchan), - \#end if - ), -) -\#if \$clock_rate() -self.\$(id).set_clock_rate(\$clock_rate, uhd.ALL_MBOARDS) -\#end if -#for $m in range($max_mboards) -######################################################################## -\#if \$num_mboards() > $m and \$clock_source$(m)() -self.\$(id).set_clock_source(\$clock_source$(m), $m) -\#end if -######################################################################## -\#if \$num_mboards() > $m and \$time_source$(m)() -self.\$(id).set_time_source(\$time_source$(m), $m) -\#end if -######################################################################## -\#if \$num_mboards() > $m and \$sd_spec$(m)() -self.\$(id).set_subdev_spec(\$sd_spec$(m), $m) -\#end if -######################################################################## -#end for -\#if \$sync() == 'sync' -self.\$(id).set_time_unknown_pps(uhd.time_spec()) -\#elif \$sync() == 'pc_clock' -self.\$(id).set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) -\#end if -self.\$(id).set_samp_rate(\$samp_rate) -#for $n in range($max_nchan) -\#if \$nchan() > $n -self.\$(id).set_center_freq(\$center_freq$(n), $n) -self.\$(id).set_gain(\$gain$(n), $n) - \#if \$ant$(n)() -self.\$(id).set_antenna(\$ant$(n), $n) - \#end if - \#if \$bw$(n)() -self.\$(id).set_bandwidth(\$bw$(n), $n) - \#end if -\#end if -#end for -</make> - <callback>set_samp_rate(\$samp_rate)</callback> - #for $n in range($max_nchan) - <callback>set_center_freq(\$center_freq$(n), $n)</callback> - <callback>set_gain(\$gain$(n), $n)</callback> - <callback>set_antenna(\$ant$(n), $n)</callback> - <callback>set_bandwidth(\$bw$(n), $n)</callback> - #end for - <param> - <name>$(direction.title())put Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex float32</name> - <key>fc32</key> - <opt>type:fc32</opt> - </option> - <option> - <name>Complex int16</name> - <key>sc16</key> - <opt>type:sc16</opt> - </option> - <option> - <name>VITA word32</name> - <key>item32</key> - <opt>type:s32</opt> - </option> - </param> - <param> - <name>Wire Format</name> - <key>otw</key> - <value></value> - <type>string</type> - <hide> - \#if \$otw() - none - \#else - part - \#end if - </hide> - <option> - <name>Automatic</name> - <key></key> - </option> - <option> - <name>Complex int16</name> - <key>sc16</key> - </option> - <option> - <name>Complex int8</name> - <key>sc8</key> - </option> - </param> - <param> - <name>Stream args</name> - <key>stream_args</key> - <value></value> - <type>string</type> - <hide> - \#if \$stream_args() - none - \#else - part - \#end if - </hide> - <option> - <name>scalar=1024</name> - <key>scalar=1024</key> - </option> - </param> - <param> - <name>Stream channels</name> - <key>stream_chans</key> - <value>[]</value> - <type>int_vector</type> - <hide> - \#if \$stream_chans() - none - \#else - part - \#end if - </hide> - </param> - <param> - <name>Device Addr</name> - <key>dev_addr</key> - <value></value> - <type>string</type> - <hide> - \#if \$dev_addr() - none - \#else - part - \#end if - </hide> - </param> - <param> - <name>Sync</name> - <key>sync</key> - <value></value> - <type>enum</type> - <hide>\#if \$sync() then 'none' else 'part'#</hide> - <option> - <name>unknown PPS</name> - <key>sync</key> - </option> - <option> - <name>PC Clock</name> - <key>pc_clock</key> - </option> - <option> - <name>don't sync</name> - <key></key> - </option> - </param> - <param> - <name>Clock Rate (Hz)</name> - <key>clock_rate</key> - <value>0.0</value> - <type>real</type> - <hide>\#if \$clock_rate() then 'none' else 'part'#</hide> - <option> - <name>Default</name> - <key>0.0</key> - </option> - </param> - <param> - <name>Num Mboards</name> - <key>num_mboards</key> - <value>1</value> - <type>int</type> - <hide>part</hide> - #for $m in range(1, $max_mboards+1) - <option> - <name>$(m)</name> - <key>$m</key> - </option> - #end for - </param> - #for $m in range($max_mboards) - <param> - <name>Mb$(m): Clock Source</name> - <key>clock_source$(m)</key> - <value></value> - <type>string</type> - <hide> - \#if not \$num_mboards() > $m - all - \#elif \$clock_source$(m)() - none - \#else - part - \#end if - </hide> - <option><name>Default</name><key></key></option> - <option><name>Internal</name><key>internal</key></option> - <option><name>External</name><key>external</key></option> - <option><name>MIMO Cable</name><key>mimo</key></option> - <option><name>O/B GPSDO</name><key>gpsdo</key></option> - </param> - <param> - <name>Mb$(m): Time Source</name> - <key>time_source$(m)</key> - <value></value> - <type>string</type> - <hide> - \#if not \$num_mboards() > $m - all - \#elif \$time_source$(m)() - none - \#else - part - \#end if - </hide> - <option><name>Default</name><key></key></option> - <option><name>External</name><key>external</key></option> - <option><name>MIMO Cable</name><key>mimo</key></option> - <option><name>O/B GPSDO</name><key>gpsdo</key></option> - </param> - <param> - <name>Mb$(m): Subdev Spec</name> - <key>sd_spec$(m)</key> - <value></value> - <type>string</type> - <hide> - \#if not \$num_mboards() > $m - all - \#elif \$sd_spec$(m)() - none - \#else - part - \#end if - </hide> - </param> - #end for - <param> - <name>Num Channels</name> - <key>nchan</key> - <value>1</value> - <type>int</type> - #for $n in range(1, $max_nchan+1) - <option> - <name>$(n)</name> - <key>$n</key> - </option> - #end for - </param> - <param> - <name>Samp Rate (Sps)</name> - <key>samp_rate</key> - <value>samp_rate</value> - <type>real</type> - </param> - $params - <check>$max_nchan >= \$nchan</check> - <check>\$nchan > 0</check> - <check>$max_mboards >= \$num_mboards</check> - <check>\$num_mboards > 0</check> - <check>\$nchan >= \$num_mboards</check> - <$sourk> - <name>$direction</name> - <type>\$type.type</type> - <nports>\$nchan</nports> - </$sourk> - <doc> -The UHD USRP $sourk.title() Block: - -Device Address: -The device address is a delimited string used to locate UHD devices on your system. \\ -If left blank, the first UHD device found will be used. \\ -Use the device address to specify a specific device or list of devices. -USRP1 Example: serial=12345678 -USRP2 Example: addr=192.168.10.2 -USRP2 Example: addr0=192.168.10.2, addr1=192.168.10.3 - -$(direction.title()) Type: -This parameter controls the data type of the stream in gnuradio. - -Wire Format: -This parameter controls the form of the data over the bus/network. \ -Complex bytes may be used to trade off precision for bandwidth. \ -Not all formats are supported on all devices. - -Stream Args: -Optional arguments to be passed in the UHD streamer object. \ -Streamer args is a list of key/value pairs; usage is determined by the implementation. -Ex: the scalar key affects the scaling between 16 and 8 bit integers in sc8 wire format. - -Num Motherboards: -Selects the number of USRP motherboards in this device configuration. - -Reference Source: -Where the motherboard should sync its time and clock references. -If source and sink blocks reference the same device, -it is only necessary to set the reference source on one of the blocks. - -Subdevice specification: -Each motherboard should have its own subdevice specification \\ -and all subdevice specifications should be the same length. \\ -Select the subdevice or subdevices for each channel using a markup string. \\ -The markup string consists of a list of dboard_slot:subdev_name pairs (one pair per channel). \\ -If left blank, the UHD will try to select the first subdevice on your system. \\ -See the application notes for further details. -Single channel example: :AB -Dual channel example: :A :B - -Num Channels: -Selects the total number of channels in this multi-USRP configuration. -Ex: 4 motherboards with 2 channels per board = 8 channels total - -Sample rate: -The sample rate is the number of samples per second input by this block. \\ -The UHD device driver will try its best to match the requested sample rate. \\ -If the requested rate is not possible, the UHD block will print an error at runtime. - -Center frequency: -The center frequency is the overall frequency of the RF chain. \\ -For greater control of how the UHD tunes elements in the RF chain, \\ -pass a tune_request object rather than a simple target frequency. -Tuning with an LO offset example: uhd.tune_request(freq, lo_off) -Tuning without DSP: uhd.tune_request(target_freq, dsp_freq=0, \\ -dsp_freq_policy=uhd.tune_request.POLICY_MANUAL) - -Antenna: -For subdevices with only one antenna, this may be left blank. \\ -Otherwise, the user should specify one of the possible antenna choices. \\ -See the daughterboard application notes for the possible antenna choices. - -Bandwidth: -To use the default bandwidth filter setting, this should be zero. \\ -Only certain subdevices have configurable bandwidth filters. \\ -See the daughterboard application notes for possible configurations. - -See the UHD manual for more detailed documentation: -http://code.ettus.com/redmine/ettus/projects/uhd/wiki - </doc> -</block> -""" - -PARAMS_TMPL = """ - <param> - <name>Ch$(n): Center Freq (Hz)</name> - <key>center_freq$(n)</key> - <value>0</value> - <type>real</type> - <hide>\#if \$nchan() > $n then 'none' else 'all'#</hide> - </param> - <param> - <name>Ch$(n): Gain (dB)</name> - <key>gain$(n)</key> - <value>0</value> - <type>real</type> - <hide>\#if \$nchan() > $n then 'none' else 'all'#</hide> - </param> - <param> - <name>Ch$(n): Antenna</name> - <key>ant$(n)</key> - <value></value> - <type>string</type> - <hide> - \#if not \$nchan() > $n - all - \#elif \$ant$(n)() - none - \#else - part - \#end if - </hide> - </param> - <param> - <name>Ch$(n): Bandwidth (Hz)</name> - <key>bw$(n)</key> - <value>0</value> - <type>real</type> - <hide> - \#if not \$nchan() > $n - all - \#elif \$bw$(n)() - none - \#else - part - \#end if - </hide> - </param> -""" - -def parse_tmpl(_tmpl, **kwargs): - from Cheetah import Template - return str(Template.Template(_tmpl, kwargs)) - -max_num_mboards = 8 -max_num_channels = max_num_mboards*4 - -if __name__ == '__main__': - import sys - for file in sys.argv[1:]: - if file.endswith ('source.xml'): - sourk = 'source' - direction = 'out' - elif file.endswith ('sink.xml'): - sourk = 'sink' - direction = 'in' - else: raise Exception, 'is %s a source or sink?'%file - - params = ''.join([parse_tmpl(PARAMS_TMPL, n=n) for n in range(max_num_channels)]) - open(file, 'w').write(parse_tmpl(MAIN_TMPL, - max_nchan=max_num_channels, - max_mboards=max_num_mboards, - params=params, - sourk=sourk, - direction=direction, - )) diff --git a/gr-uhd/grc/uhd_amsg_source.xml b/gr-uhd/grc/uhd_amsg_source.xml deleted file mode 100644 index 78c9d7b58..000000000 --- a/gr-uhd/grc/uhd_amsg_source.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0"?> -<block> - <name>UHD: USRP Async Msg Source</name> - <key>uhd_amsg_source</key> - <import>from gnuradio import uhd</import> - <make>uhd.amsg_source(device_addr=$dev_addr, msgq=$(id)_msgq_out)</make> - <param> - <name>Device Addr</name> - <key>dev_addr</key> - <value></value> - <type>string</type> - <hide> - #if $dev_addr() - none - #else - part - #end if - </hide> - </param> - <source> - <name>out</name> - <type>msg</type> - </source> -</block> diff --git a/gr-uhd/grc/uhd_block_tree.xml b/gr-uhd/grc/uhd_block_tree.xml deleted file mode 100644 index 5d3b49393..000000000 --- a/gr-uhd/grc/uhd_block_tree.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Block Tree for uhd blocks. -################################################### - --> -<cat> - <name></name> <!-- Blank for Root Name --> - <cat> - <name>UHD</name> - <block>uhd_usrp_source</block> - <block>uhd_usrp_sink</block> - <block>uhd_amsg_source</block> - </cat> -</cat> diff --git a/gr-uhd/include/CMakeLists.txt b/gr-uhd/include/CMakeLists.txt deleted file mode 100644 index 27d3d1d36..000000000 --- a/gr-uhd/include/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Install header files -######################################################################## -install(FILES - gr_uhd_api.h - gr_uhd_usrp_source.h - gr_uhd_usrp_sink.h - gr_uhd_amsg_source.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "uhd_devel" -) diff --git a/gr-uhd/include/gr_uhd_amsg_source.h b/gr-uhd/include/gr_uhd_amsg_source.h deleted file mode 100644 index f2f21c99f..000000000 --- a/gr-uhd/include/gr_uhd_amsg_source.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_GR_UHD_AMSG_SOURCE_H -#define INCLUDED_GR_UHD_AMSG_SOURCE_H - -#include <gr_uhd_api.h> -#include <uhd/usrp/multi_usrp.hpp> -#include <gr_msg_queue.h> - -class uhd_amsg_source; - -/*! - * \brief Make a new USRP asynchronous message-based source block. - * \ingroup uhd_blk - */ -GR_UHD_API boost::shared_ptr<uhd_amsg_source> uhd_make_amsg_source( - const uhd::device_addr_t &device_addr, - gr_msg_queue_sptr msgq -); - -class GR_UHD_API uhd_amsg_source{ -public: - /*! - * Convert a raw asynchronous message to an asynchronous metatdata object. - * \return The asynchronous metadata object. - */ - static uhd::async_metadata_t msg_to_async_metadata_t(const gr_message_sptr msg); - -}; - -#endif /* INCLUDED_GR_UHD_AMSG_SOURCE_H */ diff --git a/gr-uhd/include/gr_uhd_api.h b/gr-uhd/include/gr_uhd_api.h deleted file mode 100644 index 106acd8c7..000000000 --- a/gr-uhd/include/gr_uhd_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_GR_UHD_API_H -#define INCLUDED_GR_UHD_API_H - -#include <uhd/config.hpp> - -#ifdef gnuradio_uhd_EXPORTS -# define GR_UHD_API UHD_EXPORT -#else -# define GR_UHD_API UHD_IMPORT -#endif - -#endif /* INCLUDED_GR_UHD_API_H */ diff --git a/gr-uhd/include/gr_uhd_usrp_sink.h b/gr-uhd/include/gr_uhd_usrp_sink.h deleted file mode 100644 index 9cea6f3e2..000000000 --- a/gr-uhd/include/gr_uhd_usrp_sink.h +++ /dev/null @@ -1,506 +0,0 @@ -/* - * Copyright 2010-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 INCLUDED_GR_UHD_USRP_SINK_H -#define INCLUDED_GR_UHD_USRP_SINK_H - -#include <gr_uhd_api.h> -#include <gr_sync_block.h> -#include <uhd/usrp/multi_usrp.hpp> - -#ifndef INCLUDED_UHD_STREAM_HPP -namespace uhd{ - struct GR_UHD_API stream_args_t{ - stream_args_t( - const std::string &cpu = "", - const std::string &otw = "" - ){ - cpu_format = cpu; - otw_format = otw; - } - std::string cpu_format; - std::string otw_format; - device_addr_t args; - std::vector<size_t> channels; - }; -} -# define INCLUDED_UHD_STREAM_HPP -#else -# define GR_UHD_USE_STREAM_API -#endif - -class uhd_usrp_sink; - -/*! - * \brief Make a new USRP sink block. - * \ingroup uhd_blk - * - * The USRP sink block reads a stream and transmits the samples. - * The sink block also provides API calls for transmitter settings. - * - * TX Stream tagging: - * - * The following tag keys will be consumed by the work function: - * - pmt::pmt_string_to_symbol("tx_sob") - * - pmt::pmt_string_to_symbol("tx_eob") - * - pmt::pmt_string_to_symbol("tx_time") - * - * The sob and eob (start and end of burst) tag values are pmt booleans. - * When present, burst tags should be set to true (pmt::PMT_T). - * - * The timstamp tag value is a pmt tuple of the following: - * (uint64 seconds, and double fractional seconds). - * - * See the UHD manual for more detailed documentation: - * http://code.ettus.com/redmine/ettus/projects/uhd/wiki - * - * \param device_addr the address to identify the hardware - * \param io_type the desired input data type - * \param num_channels number of stream from the device - * \return a new USRP sink block object - */ -GR_UHD_API boost::shared_ptr<uhd_usrp_sink> uhd_make_usrp_sink( - const uhd::device_addr_t &device_addr, - const uhd::io_type_t &io_type, - size_t num_channels -); - -/*! - * \brief Make a new USRP sink block. - * - * The USRP sink block reads a stream and transmits the samples. - * The sink block also provides API calls for transmitter settings. - * - * TX Stream tagging: - * - * The following tag keys will be consumed by the work function: - * - pmt::pmt_string_to_symbol("tx_sob") - * - pmt::pmt_string_to_symbol("tx_eob") - * - pmt::pmt_string_to_symbol("tx_time") - * - * The sob and eob (start and end of burst) tag values are pmt booleans. - * When present, burst tags should be set to true (pmt::PMT_T). - * - * The timstamp tag value is a pmt tuple of the following: - * (uint64 seconds, and double fractional seconds). - * - * See the UHD manual for more detailed documentation: - * http://code.ettus.com/redmine/ettus/projects/uhd/wiki - * - * \param device_addr the address to identify the hardware - * \param stream_args the IO format and channel specification - * \return a new USRP sink block object - */ -GR_UHD_API boost::shared_ptr<uhd_usrp_sink> uhd_make_usrp_sink( - const uhd::device_addr_t &device_addr, - const uhd::stream_args_t &stream_args -); - -class GR_UHD_API uhd_usrp_sink : virtual public gr_sync_block{ -public: - - /*! - * Set the start time for outgoing samples. - * To control when samples are transmitted, - * set this value before starting the flow graph. - * The value is cleared after each run. - * When not specified, the start time will be: - * - Immediately for the one channel case - * - in the near future for multi-channel - * - * \param time the absolute time for transmission to begin - */ - virtual void set_start_time(const uhd::time_spec_t &time) = 0; - - /*! - * Returns identifying information about this USRP's configuration. - * Returns motherboard ID, name, and serial. - * Returns daughterboard TX ID, subdev name and spec, serial, and antenna. - * \param chan channel index 0 to N-1 - * \return TX info - */ - virtual uhd::dict<std::string, std::string> get_usrp_info(size_t chan = 0) = 0; - - /*! - * Set the frontend specification. - * \param spec the subdev spec markup string - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_subdev_spec(const std::string &spec, size_t mboard = 0) = 0; - - - /*! - * Get the TX frontend specification. - * \param mboard the motherboard index 0 to M-1 - * \return the frontend specification in use - */ - virtual std::string get_subdev_spec (size_t mboard = 0) = 0; - - /*! - * Set the sample rate for the usrp device. - * \param rate a new rate in Sps - */ - virtual void set_samp_rate(double rate) = 0; - - /*! - * Get the sample rate for the usrp device. - * This is the actual sample rate and may differ from the rate set. - * \return the actual rate in Sps - */ - virtual double get_samp_rate(void) = 0; - - /*! - * Get the possible sample rates for the usrp device. - * \return a range of rates in Sps - */ - virtual uhd::meta_range_t get_samp_rates(void) = 0; - - /*! - * Tune the usrp device to the desired center frequency. - * \param tune_request the tune request instructions - * \param chan the channel index 0 to N-1 - * \return a tune result with the actual frequencies - */ - virtual uhd::tune_result_t set_center_freq( - const uhd::tune_request_t tune_request, size_t chan = 0 - ) = 0; - - /*! - * Tune the usrp device to the desired center frequency. - * This is a wrapper around set center freq so that in this case, - * the user can pass a single frequency in the call through swig. - * \param freq the desired frequency in Hz - * \param chan the channel index 0 to N-1 - * \return a tune result with the actual frequencies - */ - uhd::tune_result_t set_center_freq(double freq, size_t chan = 0){ - return set_center_freq(uhd::tune_request_t(freq), chan); - } - - /*! - * Get the center frequency. - * \param chan the channel index 0 to N-1 - * \return the frequency in Hz - */ - virtual double get_center_freq(size_t chan = 0) = 0; - - /*! - * Get the tunable frequency range. - * \param chan the channel index 0 to N-1 - * \return the frequency range in Hz - */ - virtual uhd::freq_range_t get_freq_range(size_t chan = 0) = 0; - - /*! - * Set the gain for the dboard. - * \param gain the gain in dB - * \param chan the channel index 0 to N-1 - */ - virtual void set_gain(double gain, size_t chan = 0) = 0; - - /*! - * Set the named gain on the dboard. - * \param gain the gain in dB - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - */ - virtual void set_gain(double gain, const std::string &name, size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting. - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual double get_gain(size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting of named stage. - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual double get_gain(const std::string &name, size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting of named stage. - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual std::vector<std::string> get_gain_names(size_t chan = 0) = 0; - - /*! - * Get the settable gain range. - * \param chan the channel index 0 to N-1 - * \return the gain range in dB - */ - virtual uhd::gain_range_t get_gain_range(size_t chan = 0) = 0; - - /*! - * Get the settable gain range. - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - * \return the gain range in dB - */ - virtual uhd::gain_range_t get_gain_range(const std::string &name, size_t chan = 0) = 0; - - /*! - * Set the antenna to use. - * \param ant the antenna string - * \param chan the channel index 0 to N-1 - */ - virtual void set_antenna(const std::string &ant, size_t chan = 0) = 0; - - /*! - * Get the antenna in use. - * \param chan the channel index 0 to N-1 - * \return the antenna string - */ - virtual std::string get_antenna(size_t chan = 0) = 0; - - /*! - * Get a list of possible antennas. - * \param chan the channel index 0 to N-1 - * \return a vector of antenna strings - */ - virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0; - - /*! - * Set the bandpass filter on the RF frontend. - * \param chan the channel index 0 to N-1 - * \param bandwidth the filter bandwidth in Hz - */ - virtual void set_bandwidth(double bandwidth, size_t chan = 0) = 0; - - /*! - * Get the bandpass filter setting on the RF frontend. - * \param chan the channel index 0 to N-1 - * \return bandwidth of the filter in Hz - */ - virtual double get_bandwidth(size_t chan = 0) = 0; - - /*! - * Get the bandpass filter range of the RF frontend. - * \param chan the channel index 0 to N-1 - * \return the range of the filter bandwidth in Hz - */ - virtual uhd::freq_range_t get_bandwidth_range(size_t chan = 0) = 0; - - /*! - * Set a constant DC offset value. - * The value is complex to control both I and Q. - * \param offset the dc offset (1.0 is full-scale) - * \param chan the channel index 0 to N-1 - */ - virtual void set_dc_offset(const std::complex<double> &offset, size_t chan = 0) = 0; - - /*! - * Set the RX frontend IQ imbalance correction. - * Use this to adjust the magnitude and phase of I and Q. - * - * \param correction the complex correction (1.0 is full-scale) - * \param chan the channel index 0 to N-1 - */ - virtual void set_iq_balance(const std::complex<double> &correction, size_t chan = 0) = 0; - - /*! - * Get an RF frontend sensor value. - * \param name the name of the sensor - * \param chan the channel index 0 to N-1 - * \return a sensor value object - */ - virtual uhd::sensor_value_t get_sensor(const std::string &name, size_t chan = 0) = 0; - - /*! - * Get a list of possible RF frontend sensor names. - * \param chan the channel index 0 to N-1 - * \return a vector of sensor names - */ - virtual std::vector<std::string> get_sensor_names(size_t chan = 0) = 0; - - //! DEPRECATED use get_sensor - uhd::sensor_value_t get_dboard_sensor(const std::string &name, size_t chan = 0){ - return this->get_sensor(name, chan); - } - - //! DEPRECATED use get_sensor_names - std::vector<std::string> get_dboard_sensor_names(size_t chan = 0){ - return this->get_sensor_names(chan); - } - - /*! - * Get a motherboard sensor value. - * \param name the name of the sensor - * \param mboard the motherboard index 0 to M-1 - * \return a sensor value object - */ - virtual uhd::sensor_value_t get_mboard_sensor(const std::string &name, size_t mboard = 0) = 0; - - /*! - * Get a list of possible motherboard sensor names. - * \param mboard the motherboard index 0 to M-1 - * \return a vector of sensor names - */ - virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0; - - /*! - * Set the clock configuration. - * DEPRECATED for set_time/clock_source. - * \param clock_config the new configuration - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard = 0) = 0; - - /*! - * Set the time source for the usrp device. - * This sets the method of time synchronization, - * typically a pulse per second or an encoded time. - * Typical options for source: external, MIMO. - * \param source a string representing the time source - * \param mboard which motherboard to set the config - */ - virtual void set_time_source(const std::string &source, const size_t mboard = 0) = 0; - - /*! - * Get the currently set time source. - * \param mboard which motherboard to get the config - * \return the string representing the time source - */ - virtual std::string get_time_source(const size_t mboard) = 0; - - /*! - * Get a list of possible time sources. - * \param mboard which motherboard to get the list - * \return a vector of strings for possible settings - */ - virtual std::vector<std::string> get_time_sources(const size_t mboard) = 0; - - /*! - * Set the clock source for the usrp device. - * This sets the source for a 10 Mhz reference clock. - * Typical options for source: internal, external, MIMO. - * \param source a string representing the clock source - * \param mboard which motherboard to set the config - */ - virtual void set_clock_source(const std::string &source, const size_t mboard = 0) = 0; - - /*! - * Get the currently set clock source. - * \param mboard which motherboard to get the config - * \return the string representing the clock source - */ - virtual std::string get_clock_source(const size_t mboard) = 0; - - /*! - * Get a list of possible clock sources. - * \param mboard which motherboard to get the list - * \return a vector of strings for possible settings - */ - virtual std::vector<std::string> get_clock_sources(const size_t mboard) = 0; - - /*! - * Get the master clock rate. - * \param mboard the motherboard index 0 to M-1 - * \return the clock rate in Hz - */ - virtual double get_clock_rate(size_t mboard = 0) = 0; - - /*! - * Set the master clock rate. - * \param rate the new rate in Hz - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_clock_rate(double rate, size_t mboard = 0) = 0; - - /*! - * Get the current time registers. - * \param mboard the motherboard index 0 to M-1 - * \return the current usrp time - */ - virtual uhd::time_spec_t get_time_now(size_t mboard = 0) = 0; - - /*! - * Get the time when the last pps pulse occured. - * \param mboard the motherboard index 0 to M-1 - * \return the current usrp time - */ - virtual uhd::time_spec_t get_time_last_pps(size_t mboard = 0) = 0; - - /*! - * Sets the time registers immediately. - * \param time_spec the new time - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_time_now(const uhd::time_spec_t &time_spec, size_t mboard = 0) = 0; - - /*! - * Set the time registers at the next pps. - * \param time_spec the new time - */ - virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0; - - /*! - * Sync the time registers with an unknown pps edge. - * \param time_spec the new time - */ - virtual void set_time_unknown_pps(const uhd::time_spec_t &time_spec) = 0; - - /*! - * Set the time at which the control commands will take effect. - * - * A timed command will back-pressure all subsequent timed commands, - * assuming that the subsequent commands occur within the time-window. - * If the time spec is late, the command will be activated upon arrival. - * - * \param time_spec the time at which the next command will activate - * \param mboard which motherboard to set the config - */ - virtual void set_command_time(const uhd::time_spec_t &time_spec, size_t mboard = 0) = 0; - - /*! - * Clear the command time so future commands are sent ASAP. - * - * \param mboard which motherboard to set the config - */ - virtual void clear_command_time(size_t mboard = 0) = 0; - - /*! - * Get access to the underlying uhd dboard iface object. - * \return the dboard_iface object - */ - virtual uhd::usrp::dboard_iface::sptr get_dboard_iface(size_t chan = 0) = 0; - - /*! - * Get access to the underlying uhd device object. - * \return the multi usrp device object - */ - virtual uhd::usrp::multi_usrp::sptr get_device(void) = 0; - - /*! - * Perform write on the user configuration register bus. These only exist if - * the user has implemented custom setting registers in the device FPGA. - * \param addr 8-bit register address - * \param data 32-bit register value - * \param mboard which motherboard to set the user register - */ - virtual void set_user_register(const uint8_t addr, const uint32_t data, size_t mboard = 0) = 0; -}; - -#endif /* INCLUDED_GR_UHD_USRP_SINK_H */ diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h deleted file mode 100644 index 4d15bf160..000000000 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ /dev/null @@ -1,552 +0,0 @@ -/* - * Copyright 2010-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 INCLUDED_GR_UHD_USRP_SOURCE_H -#define INCLUDED_GR_UHD_USRP_SOURCE_H - -#include <gr_uhd_api.h> -#include <gr_sync_block.h> -#include <uhd/usrp/multi_usrp.hpp> - -#ifndef INCLUDED_UHD_STREAM_HPP -namespace uhd{ - struct GR_UHD_API stream_args_t{ - stream_args_t( - const std::string &cpu = "", - const std::string &otw = "" - ){ - cpu_format = cpu; - otw_format = otw; - } - std::string cpu_format; - std::string otw_format; - device_addr_t args; - std::vector<size_t> channels; - }; -} -# define INCLUDED_UHD_STREAM_HPP -#else -# define GR_UHD_USE_STREAM_API -#endif - -class uhd_usrp_source; - -/*! - * \brief Make a new USRP source block. - * \ingroup uhd_blk - * - * The USRP source block receives samples and writes to a stream. - * The source block also provides API calls for receiver settings. - * - * RX Stream tagging: - * - * The following tag keys will be produced by the work function: - * - pmt::pmt_string_to_symbol("rx_time") - * - pmt::pmt_string_to_symbol("rx_rate") - * - pmt::pmt_string_to_symbol("rx_freq") - * - * The timstamp tag value is a pmt tuple of the following: - * (uint64 seconds, and double fractional seconds). - * A timestamp tag is produced at start() and after overflows. - * - * The sample rate and center frequency tags are doubles, - * representing the sample rate in Sps and frequency in Hz. - * These tags are produced upon the user changing parameters. - * - * See the UHD manual for more detailed documentation: - * http://code.ettus.com/redmine/ettus/projects/uhd/wiki - * - * \param device_addr the address to identify the hardware - * \param io_type the desired output data type - * \param num_channels number of stream from the device - * \return a new USRP source block object - */ -GR_UHD_API boost::shared_ptr<uhd_usrp_source> uhd_make_usrp_source( - const uhd::device_addr_t &device_addr, - const uhd::io_type_t &io_type, - size_t num_channels -); - -/*! - * \brief Make a new USRP source block. - * - * The USRP source block receives samples and writes to a stream. - * The source block also provides API calls for receiver settings. - * - * RX Stream tagging: - * - * The following tag keys will be produced by the work function: - * - pmt::pmt_string_to_symbol("rx_time") - * - * The timstamp tag value is a pmt tuple of the following: - * (uint64 seconds, and double fractional seconds). - * A timestamp tag is produced at start() and after overflows. - * - * See the UHD manual for more detailed documentation: - * http://code.ettus.com/redmine/ettus/projects/uhd/wiki - * - * \param device_addr the address to identify the hardware - * \param stream_args the IO format and channel specification - * \return a new USRP source block object - */ -GR_UHD_API boost::shared_ptr<uhd_usrp_source> uhd_make_usrp_source( - const uhd::device_addr_t &device_addr, - const uhd::stream_args_t &stream_args -); - -class GR_UHD_API uhd_usrp_source : virtual public gr_sync_block{ -public: - - /*! - * Set the start time for incoming samples. - * To control when samples are received, - * set this value before starting the flow graph. - * The value is cleared after each run. - * When not specified, the start time will be: - * - Immediately for the one channel case - * - in the near future for multi-channel - * - * \param time the absolute time for reception to begin - */ - virtual void set_start_time(const uhd::time_spec_t &time) = 0; - - /*! - * *Advanced use only:* - * Issue a stream command to all channels in this source block. - * - * This method is intended to override the default "always on" behavior. - * After starting the flow graph, the user should call stop() on this block, - * then issue any desired arbitrary stream_cmd_t structs to the device. - * The USRP will be able to enqueue several stream commands in the FPGA. - * - * \param cmd the stream command to issue to all source channels - */ - virtual void issue_stream_cmd(const uhd::stream_cmd_t &cmd) = 0; - - /*! - * Returns identifying information about this USRP's configuration. - * Returns motherboard ID, name, and serial. - * Returns daughterboard RX ID, subdev name and spec, serial, and antenna. - * \param chan channel index 0 to N-1 - * \return RX info - */ - virtual uhd::dict<std::string, std::string> get_usrp_info(size_t chan = 0) = 0; - - /*! - * Set the frontend specification. - * \param spec the subdev spec markup string - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_subdev_spec(const std::string &spec, size_t mboard = 0) = 0; - - /*! - * Get the RX frontend specification. - * \param mboard the motherboard index 0 to M-1 - * \return the frontend specification in use - */ - virtual std::string get_subdev_spec(size_t mboard = 0) = 0; - - /*! - * Set the sample rate for the usrp device. - * \param rate a new rate in Sps - */ - virtual void set_samp_rate(double rate) = 0; - - /*! - * Get the sample rate for the usrp device. - * This is the actual sample rate and may differ from the rate set. - * \return the actual rate in Sps - */ - virtual double get_samp_rate(void) = 0; - - /*! - * Get the possible sample rates for the usrp device. - * \return a range of rates in Sps - */ - virtual uhd::meta_range_t get_samp_rates(void) = 0; - - /*! - * Tune the usrp device to the desired center frequency. - * \param tune_request the tune request instructions - * \param chan the channel index 0 to N-1 - * \return a tune result with the actual frequencies - */ - virtual uhd::tune_result_t set_center_freq( - const uhd::tune_request_t tune_request, size_t chan = 0 - ) = 0; - - /*! - * Tune the usrp device to the desired center frequency. - * This is a wrapper around set center freq so that in this case, - * the user can pass a single frequency in the call through swig. - * \param freq the desired frequency in Hz - * \param chan the channel index 0 to N-1 - * \return a tune result with the actual frequencies - */ - uhd::tune_result_t set_center_freq(double freq, size_t chan = 0){ - return set_center_freq(uhd::tune_request_t(freq), chan); - } - - /*! - * Get the center frequency. - * \param chan the channel index 0 to N-1 - * \return the frequency in Hz - */ - virtual double get_center_freq(size_t chan = 0) = 0; - - /*! - * Get the tunable frequency range. - * \param chan the channel index 0 to N-1 - * \return the frequency range in Hz - */ - virtual uhd::freq_range_t get_freq_range(size_t chan = 0) = 0; - - /*! - * Set the gain for the dboard. - * \param gain the gain in dB - * \param chan the channel index 0 to N-1 - */ - virtual void set_gain(double gain, size_t chan = 0) = 0; - - /*! - * Set the named gain on the dboard. - * \param gain the gain in dB - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - */ - virtual void set_gain(double gain, const std::string &name, size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting. - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual double get_gain(size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting of named stage. - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual double get_gain(const std::string &name, size_t chan = 0) = 0; - - /*! - * Get the actual dboard gain setting of named stage. - * \param chan the channel index 0 to N-1 - * \return the actual gain in dB - */ - virtual std::vector<std::string> get_gain_names(size_t chan = 0) = 0; - - /*! - * Get the settable gain range. - * \param chan the channel index 0 to N-1 - * \return the gain range in dB - */ - virtual uhd::gain_range_t get_gain_range(size_t chan = 0) = 0; - - /*! - * Get the settable gain range. - * \param name the name of the gain stage - * \param chan the channel index 0 to N-1 - * \return the gain range in dB - */ - virtual uhd::gain_range_t get_gain_range(const std::string &name, size_t chan = 0) = 0; - - /*! - * Set the antenna to use. - * \param ant the antenna string - * \param chan the channel index 0 to N-1 - */ - virtual void set_antenna(const std::string &ant, size_t chan = 0) = 0; - - /*! - * Get the antenna in use. - * \param chan the channel index 0 to N-1 - * \return the antenna string - */ - virtual std::string get_antenna(size_t chan = 0) = 0; - - /*! - * Get a list of possible antennas. - * \param chan the channel index 0 to N-1 - * \return a vector of antenna strings - */ - virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0; - - /*! - * Set the bandpass filter on the RF frontend. - * \param bandwidth the filter bandwidth in Hz - * \param chan the channel index 0 to N-1 - */ - virtual void set_bandwidth(double bandwidth, size_t chan = 0) = 0; - - /*! - * Get the bandpass filter setting on the RF frontend. - * \param chan the channel index 0 to N-1 - * \return bandwidth of the filter in Hz - */ - virtual double get_bandwidth(size_t chan = 0) = 0; - - /*! - * Get the bandpass filter range of the RF frontend. - * \param chan the channel index 0 to N-1 - * \return the range of the filter bandwidth in Hz - */ - virtual uhd::freq_range_t get_bandwidth_range(size_t chan = 0) = 0; - - /*! - * Enable/disable the automatic DC offset correction. - * The automatic correction subtracts out the long-run average. - * - * When disabled, the averaging option operation is halted. - * Once halted, the average value will be held constant - * until the user re-enables the automatic correction - * or overrides the value by manually setting the offset. - * - * \param enb true to enable automatic DC offset correction - * \param chan the channel index 0 to N-1 - */ - virtual void set_auto_dc_offset(const bool enb, size_t chan = 0) = 0; - - /*! - * Set a constant DC offset value. - * The value is complex to control both I and Q. - * Only set this when automatic correction is disabled. - * \param offset the dc offset (1.0 is full-scale) - * \param chan the channel index 0 to N-1 - */ - virtual void set_dc_offset(const std::complex<double> &offset, size_t chan = 0) = 0; - - /*! - * Set the RX frontend IQ imbalance correction. - * Use this to adjust the magnitude and phase of I and Q. - * - * \param correction the complex correction value - * \param chan the channel index 0 to N-1 - */ - virtual void set_iq_balance(const std::complex<double> &correction, size_t chan = 0) = 0; - - /*! - * Get a RF frontend sensor value. - * \param name the name of the sensor - * \param chan the channel index 0 to N-1 - * \return a sensor value object - */ - virtual uhd::sensor_value_t get_sensor(const std::string &name, size_t chan = 0) = 0; - - /*! - * Get a list of possible RF frontend sensor names. - * \param chan the channel index 0 to N-1 - * \return a vector of sensor names - */ - virtual std::vector<std::string> get_sensor_names(size_t chan = 0) = 0; - - //! DEPRECATED use get_sensor - uhd::sensor_value_t get_dboard_sensor(const std::string &name, size_t chan = 0){ - return this->get_sensor(name, chan); - } - - //! DEPRECATED use get_sensor_names - std::vector<std::string> get_dboard_sensor_names(size_t chan = 0){ - return this->get_sensor_names(chan); - } - - /*! - * Get a motherboard sensor value. - * \param name the name of the sensor - * \param mboard the motherboard index 0 to M-1 - * \return a sensor value object - */ - virtual uhd::sensor_value_t get_mboard_sensor(const std::string &name, size_t mboard = 0) = 0; - - /*! - * Get a list of possible motherboard sensor names. - * \param mboard the motherboard index 0 to M-1 - * \return a vector of sensor names - */ - virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0; - - /*! - * Set the clock configuration. - * DEPRECATED for set_time/clock_source. - * \param clock_config the new configuration - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard = 0) = 0; - - /*! - * Set the time source for the usrp device. - * This sets the method of time synchronization, - * typically a pulse per second or an encoded time. - * Typical options for source: external, MIMO. - * \param source a string representing the time source - * \param mboard which motherboard to set the config - */ - virtual void set_time_source(const std::string &source, const size_t mboard = 0) = 0; - - /*! - * Get the currently set time source. - * \param mboard which motherboard to get the config - * \return the string representing the time source - */ - virtual std::string get_time_source(const size_t mboard) = 0; - - /*! - * Get a list of possible time sources. - * \param mboard which motherboard to get the list - * \return a vector of strings for possible settings - */ - virtual std::vector<std::string> get_time_sources(const size_t mboard) = 0; - - /*! - * Set the clock source for the usrp device. - * This sets the source for a 10 Mhz reference clock. - * Typical options for source: internal, external, MIMO. - * \param source a string representing the clock source - * \param mboard which motherboard to set the config - */ - virtual void set_clock_source(const std::string &source, const size_t mboard = 0) = 0; - - /*! - * Get the currently set clock source. - * \param mboard which motherboard to get the config - * \return the string representing the clock source - */ - virtual std::string get_clock_source(const size_t mboard) = 0; - - /*! - * Get a list of possible clock sources. - * \param mboard which motherboard to get the list - * \return a vector of strings for possible settings - */ - virtual std::vector<std::string> get_clock_sources(const size_t mboard) = 0; - - /*! - * Get the master clock rate. - * \param mboard the motherboard index 0 to M-1 - * \return the clock rate in Hz - */ - virtual double get_clock_rate(size_t mboard = 0) = 0; - - /*! - * Set the master clock rate. - * \param rate the new rate in Hz - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_clock_rate(double rate, size_t mboard = 0) = 0; - - /*! - * Get the current time registers. - * \param mboard the motherboard index 0 to M-1 - * \return the current usrp time - */ - virtual uhd::time_spec_t get_time_now(size_t mboard = 0) = 0; - - /*! - * Get the time when the last pps pulse occured. - * \param mboard the motherboard index 0 to M-1 - * \return the current usrp time - */ - virtual uhd::time_spec_t get_time_last_pps(size_t mboard = 0) = 0; - - /*! - * Sets the time registers immediately. - * \param time_spec the new time - * \param mboard the motherboard index 0 to M-1 - */ - virtual void set_time_now(const uhd::time_spec_t &time_spec, size_t mboard = 0) = 0; - - /*! - * Set the time registers at the next pps. - * \param time_spec the new time - */ - virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0; - - /*! - * Sync the time registers with an unknown pps edge. - * \param time_spec the new time - */ - virtual void set_time_unknown_pps(const uhd::time_spec_t &time_spec) = 0; - - /*! - * Set the time at which the control commands will take effect. - * - * A timed command will back-pressure all subsequent timed commands, - * assuming that the subsequent commands occur within the time-window. - * If the time spec is late, the command will be activated upon arrival. - * - * \param time_spec the time at which the next command will activate - * \param mboard which motherboard to set the config - */ - virtual void set_command_time(const uhd::time_spec_t &time_spec, size_t mboard = 0) = 0; - - /*! - * Clear the command time so future commands are sent ASAP. - * - * \param mboard which motherboard to set the config - */ - virtual void clear_command_time(size_t mboard = 0) = 0; - - /*! - * Get access to the underlying uhd dboard iface object. - * \return the dboard_iface object - */ - virtual uhd::usrp::dboard_iface::sptr get_dboard_iface(size_t chan = 0) = 0; - - /*! - * Get access to the underlying uhd device object. - * \return the multi usrp device object - */ - virtual uhd::usrp::multi_usrp::sptr get_device(void) = 0; - - /*! - * Perform write on the user configuration register bus. These only exist if - * the user has implemented custom setting registers in the device FPGA. - * \param addr 8-bit register address - * \param data 32-bit register value - * \param mboard which motherboard to set the user register - */ - virtual void set_user_register(const uint8_t addr, const uint32_t data, size_t mboard = 0) = 0; - - /*! - * Convenience function for finite data acquisition. - * This is not to be used with the scheduler; rather, - * one can request samples from the USRP in python. - * //TODO assumes fc32 - * \param nsamps the number of samples - * \return a vector of complex float samples - */ - virtual std::vector<std::complex<float> > finite_acquisition(const size_t nsamps) = 0; - - /*! - * Convenience function for finite data acquisition. - * This is the multi-channel version of finite_acquisition; - * This is not to be used with the scheduler; rather, - * one can request samples from the USRP in python. - * //TODO assumes fc32 - * \param nsamps the number of samples per channel - * \return a vector of buffers, where each buffer represents a channel - */ - virtual std::vector<std::vector<std::complex<float> > > finite_acquisition_v(const size_t nsamps) = 0; -}; - -#endif /* INCLUDED_GR_UHD_USRP_SOURCE_H */ diff --git a/gr-uhd/lib/CMakeLists.txt b/gr-uhd/lib/CMakeLists.txt deleted file mode 100644 index c494fddad..000000000 --- a/gr-uhd/lib/CMakeLists.txt +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2011-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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${GR_UHD_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${UHD_INCLUDE_DIRS} -) - -link_directories( - ${UHD_LIBRARY_DIRS} - ${Boost_LIBRARY_DIRS} -) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_uhd_sources - gr_uhd_usrp_source.cc - gr_uhd_usrp_sink.cc - gr_uhd_amsg_source.cc -) - -list(APPEND uhd_libs - gnuradio-core - ${Boost_LIBRARIES} - ${UHD_LIBRARIES} -) - -add_library(gnuradio-uhd SHARED ${gr_uhd_sources}) -target_link_libraries(gnuradio-uhd ${uhd_libs}) -GR_LIBRARY_FOO(gnuradio-uhd RUNTIME_COMPONENT "uhd_runtime" DEVEL_COMPONENT "uhd_devel") diff --git a/gr-uhd/lib/gr_uhd_amsg_source.cc b/gr-uhd/lib/gr_uhd_amsg_source.cc deleted file mode 100644 index d2e2dd0bf..000000000 --- a/gr-uhd/lib/gr_uhd_amsg_source.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2011-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. - */ - -#include <gr_uhd_amsg_source.h> -#include <boost/bind.hpp> -#include <gruel/thread.h> -#include "gr_uhd_common.h" - -/*********************************************************************** - * UHD Asynchronous Message Source Impl - **********************************************************************/ -class uhd_amsg_source_impl : public uhd_amsg_source{ -public: - uhd_amsg_source_impl( - const uhd::device_addr_t &device_addr, - gr_msg_queue_sptr msgq - ): - _msgq(msgq), _running(true) - { - _dev = uhd::usrp::multi_usrp::make(device_addr); - _amsg_thread = - gruel::thread(boost::bind(&uhd_amsg_source_impl::recv_loop, this)); - } - - ~uhd_amsg_source_impl() - { - _running = false; - _amsg_thread.join(); - } - - void recv_loop() - { - gr_message_sptr msg; - uhd::async_metadata_t *md; - - while (_running) { - msg = gr_make_message(0, 0.0, 0.0, sizeof(uhd::async_metadata_t)); - md = (uhd::async_metadata_t *) msg->msg(); - - while (!_dev->get_device()->recv_async_msg(*md, 0.1)) { - if (!_running) - return; - } - - post(msg); - } - } - - void post(gr_message_sptr msg) - { - _msgq->insert_tail(msg); - } - -protected: - uhd::usrp::multi_usrp::sptr _dev; - gruel::thread _amsg_thread; - gr_msg_queue_sptr _msgq; - bool _running; -}; - -uhd::async_metadata_t uhd_amsg_source::msg_to_async_metadata_t(const gr_message_sptr msg) -{ - return *(uhd::async_metadata_t *)msg->msg(); -} - -/*********************************************************************** - * Make UHD Asynchronous Message Source - **********************************************************************/ -boost::shared_ptr<uhd_amsg_source> uhd_make_amsg_source( - const uhd::device_addr_t &device_addr, - gr_msg_queue_sptr msgq -){ - gr_uhd_check_abi(); - return boost::shared_ptr<uhd_amsg_source>( - new uhd_amsg_source_impl(device_addr, msgq) - ); -} diff --git a/gr-uhd/lib/gr_uhd_common.h b/gr-uhd/lib/gr_uhd_common.h deleted file mode 100644 index 2582cd68d..000000000 --- a/gr-uhd/lib/gr_uhd_common.h +++ /dev/null @@ -1,57 +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. - */ - -#ifndef INCLUDED_GR_UHD_COMMON_H -#define INCLUDED_GR_UHD_COMMON_H - -#include <uhd/version.hpp> -#include <boost/format.hpp> -#include <stdexcept> - -static inline void gr_uhd_check_abi(void){ - #ifdef UHD_VERSION_ABI_STRING - if (std::string(UHD_VERSION_ABI_STRING) == uhd::get_abi_string()) return; - throw std::runtime_error(str(boost::format( - "\nGR-UHD detected ABI compatibility mismatch with UHD library.\n" - "GR-UHD was build against ABI: %s,\n" - "but UHD library reports ABI: %s\n" - "Suggestion: install an ABI compatible version of UHD,\n" - "or rebuild GR-UHD component against this ABI version.\n" - ) % UHD_VERSION_ABI_STRING % uhd::get_abi_string())); - #endif -} - -/*! - * The stream args ensure function sanitizes random user input. - * We may extend this to handle more things in the future, - * but ATM it ensures that the channels are initialized. - */ -static inline uhd::stream_args_t stream_args_ensure(const uhd::stream_args_t &args) -{ - uhd::stream_args_t sanitized = args; - if (sanitized.channels.empty()) - { - sanitized.channels.push_back(0); - } - return sanitized; -} - -#endif /* INCLUDED_GR_UHD_COMMON_H */ diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc deleted file mode 100644 index b89f68b48..000000000 --- a/gr-uhd/lib/gr_uhd_usrp_sink.cc +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Copyright 2010-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. - */ - -#include <gr_uhd_usrp_sink.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <boost/make_shared.hpp> -#include "gr_uhd_common.h" - -static const pmt::pmt_t SOB_KEY = pmt::pmt_string_to_symbol("tx_sob"); -static const pmt::pmt_t EOB_KEY = pmt::pmt_string_to_symbol("tx_eob"); -static const pmt::pmt_t TIME_KEY = pmt::pmt_string_to_symbol("tx_time"); - -#include <uhd/convert.hpp> -inline gr_io_signature_sptr args_to_io_sig(const uhd::stream_args_t &args){ - const size_t nchan = std::max<size_t>(args.channels.size(), 1); - #ifdef GR_UHD_USE_STREAM_API - const size_t size = uhd::convert::get_bytes_per_item(args.cpu_format); - #else - size_t size = 0; - if (args.cpu_format == "fc32") size = 8; - if (args.cpu_format == "sc16") size = 4; - #endif - return gr_make_io_signature(nchan, nchan, size); -} - -/*********************************************************************** - * UHD Multi USRP Sink Impl - **********************************************************************/ -class uhd_usrp_sink_impl : public uhd_usrp_sink{ -public: - uhd_usrp_sink_impl( - const uhd::device_addr_t &device_addr, - const uhd::stream_args_t &stream_args - ): - gr_sync_block( - "gr uhd usrp sink", - args_to_io_sig(stream_args), - gr_make_io_signature(0, 0, 0) - ), - _stream_args(stream_args), - _nchan(stream_args.channels.size()), - _stream_now(_nchan == 1), - _start_time_set(false) - { - if (stream_args.cpu_format == "fc32") _type = boost::make_shared<uhd::io_type_t>(uhd::io_type_t::COMPLEX_FLOAT32); - if (stream_args.cpu_format == "sc16") _type = boost::make_shared<uhd::io_type_t>(uhd::io_type_t::COMPLEX_INT16); - _dev = uhd::usrp::multi_usrp::make(device_addr); - } - - uhd::dict<std::string, std::string> get_usrp_info(size_t chan){ - chan = _stream_args.channels[chan]; - #ifdef UHD_USRP_MULTI_USRP_GET_USRP_INFO_API - return _dev->get_usrp_tx_info(chan); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - void set_subdev_spec(const std::string &spec, size_t mboard){ - return _dev->set_tx_subdev_spec(spec, mboard); - } - - std::string get_subdev_spec(size_t mboard){ - return _dev->get_tx_subdev_spec(mboard).to_string(); - } - - void set_samp_rate(double rate){ - BOOST_FOREACH(const size_t chan, _stream_args.channels) - { - _dev->set_tx_rate(rate, chan); - } - _sample_rate = this->get_samp_rate(); - } - - double get_samp_rate(void){ - return _dev->get_tx_rate(_stream_args.channels[0]); - } - - uhd::meta_range_t get_samp_rates(void){ - #ifdef UHD_USRP_MULTI_USRP_GET_RATES_API - return _dev->get_tx_rates(_stream_args.channels[0]); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - uhd::tune_result_t set_center_freq( - const uhd::tune_request_t tune_request, size_t chan - ){ - chan = _stream_args.channels[chan]; - return _dev->set_tx_freq(tune_request, chan); - } - - double get_center_freq(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_freq(chan); - } - - uhd::freq_range_t get_freq_range(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_freq_range(chan); - } - - void set_gain(double gain, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->set_tx_gain(gain, chan); - } - - void set_gain(double gain, const std::string &name, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->set_tx_gain(gain, name, chan); - } - - double get_gain(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_gain(chan); - } - - double get_gain(const std::string &name, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_gain(name, chan); - } - - std::vector<std::string> get_gain_names(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_gain_names(chan); - } - - uhd::gain_range_t get_gain_range(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_gain_range(chan); - } - - uhd::gain_range_t get_gain_range(const std::string &name, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_gain_range(name, chan); - } - - void set_antenna(const std::string &ant, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->set_tx_antenna(ant, chan); - } - - std::string get_antenna(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_antenna(chan); - } - - std::vector<std::string> get_antennas(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_antennas(chan); - } - - void set_bandwidth(double bandwidth, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->set_tx_bandwidth(bandwidth, chan); - } - - double get_bandwidth(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_bandwidth(chan); - } - - uhd::freq_range_t get_bandwidth_range(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_bandwidth_range(chan); - } - - void set_dc_offset(const std::complex<double> &offset, size_t chan){ - #ifdef UHD_USRP_MULTI_USRP_FRONTEND_CAL_API - return _dev->set_tx_dc_offset(offset, chan); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - void set_iq_balance(const std::complex<double> &correction, size_t chan){ - chan = _stream_args.channels[chan]; - #ifdef UHD_USRP_MULTI_USRP_FRONTEND_CAL_API - return _dev->set_tx_iq_balance(correction, chan); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - uhd::sensor_value_t get_sensor(const std::string &name, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_sensor(name, chan); - } - - std::vector<std::string> get_sensor_names(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_sensor_names(chan); - } - - uhd::sensor_value_t get_mboard_sensor(const std::string &name, size_t mboard){ - return _dev->get_mboard_sensor(name, mboard); - } - - std::vector<std::string> get_mboard_sensor_names(size_t mboard){ - return _dev->get_mboard_sensor_names(mboard); - } - - void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard){ - return _dev->set_clock_config(clock_config, mboard); - } - - void set_time_source(const std::string &source, const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->set_time_source(source, mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - std::string get_time_source(const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->get_time_source(mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - std::vector<std::string> get_time_sources(const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->get_time_sources(mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - void set_clock_source(const std::string &source, const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->set_clock_source(source, mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - std::string get_clock_source(const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->get_clock_source(mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - std::vector<std::string> get_clock_sources(const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->get_clock_sources(mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - double get_clock_rate(size_t mboard){ - return _dev->get_master_clock_rate(mboard); - } - - void set_clock_rate(double rate, size_t mboard){ - return _dev->set_master_clock_rate(rate, mboard); - } - - uhd::time_spec_t get_time_now(size_t mboard = 0){ - return _dev->get_time_now(mboard); - } - - uhd::time_spec_t get_time_last_pps(size_t mboard){ - return _dev->get_time_last_pps(mboard); - } - - void set_time_now(const uhd::time_spec_t &time_spec, size_t mboard){ - return _dev->set_time_now(time_spec, mboard); - } - - void set_time_next_pps(const uhd::time_spec_t &time_spec){ - return _dev->set_time_next_pps(time_spec); - } - - void set_time_unknown_pps(const uhd::time_spec_t &time_spec){ - return _dev->set_time_unknown_pps(time_spec); - } - - void set_command_time(const uhd::time_spec_t &time_spec, size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_COMMAND_TIME_API - return _dev->set_command_time(time_spec, mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - void clear_command_time(size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_COMMAND_TIME_API - return _dev->clear_command_time(mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - uhd::usrp::dboard_iface::sptr get_dboard_iface(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_tx_dboard_iface(chan); - } - - uhd::usrp::multi_usrp::sptr get_device(void){ - return _dev; - } - - void set_user_register(const uint8_t addr, const uint32_t data, size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_USER_REGS_API - _dev->set_user_register(addr, data, mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - -/*********************************************************************** - * Work - **********************************************************************/ - int work( - int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ - int ninput_items = noutput_items; //cuz its a sync block - - //send a mid-burst packet with time spec - _metadata.start_of_burst = false; - _metadata.end_of_burst = false; - - //collect tags in this work() - const uint64_t samp0_count = nitems_read(0); - get_tags_in_range(_tags, 0, samp0_count, samp0_count + ninput_items); - if (not _tags.empty()) this->tag_work(ninput_items); - - #ifdef GR_UHD_USE_STREAM_API - //send all ninput_items with metadata - const size_t num_sent = _tx_stream->send( - input_items, ninput_items, _metadata, 1.0 - ); - #else - const size_t num_sent = _dev->get_device()->send( - input_items, ninput_items, _metadata, - *_type, uhd::device::SEND_MODE_FULL_BUFF, 1.0 - ); - #endif - - //increment the timespec by the number of samples sent - _metadata.time_spec += uhd::time_spec_t(0, num_sent, _sample_rate); - return num_sent; - } - -/*********************************************************************** - * Tag Work - **********************************************************************/ - inline void tag_work(int &ninput_items){ - //the for loop below assumes tags sorted by count low -> high - std::sort(_tags.begin(), _tags.end(), gr_tag_t::offset_compare); - - //extract absolute sample counts - const gr_tag_t &tag0 = _tags.front(); - const uint64_t tag0_count = tag0.offset; - const uint64_t samp0_count = this->nitems_read(0); - - //only transmit nsamples from 0 to the first tag - //this ensures that the next work starts on a tag - if (samp0_count != tag0_count){ - ninput_items = tag0_count - samp0_count; - return; - } - - //time will not be set unless a time tag is found - _metadata.has_time_spec = false; - - //process all of the tags found with the same count as tag0 - BOOST_FOREACH(const gr_tag_t &my_tag, _tags){ - const uint64_t my_tag_count = my_tag.offset; - const pmt::pmt_t &key = my_tag.key; - const pmt::pmt_t &value = my_tag.value; - - //determine how many samples to send... - //from zero until the next tag or end of work - if (my_tag_count != tag0_count){ - ninput_items = my_tag_count - samp0_count; - break; - } - - //handle end of burst with a mini end of burst packet - else if (pmt::pmt_equal(key, EOB_KEY)){ - _metadata.end_of_burst = pmt::pmt_to_bool(value); - ninput_items = 1; - return; - } - - //set the start of burst flag in the metadata - else if (pmt::pmt_equal(key, SOB_KEY)){ - _metadata.start_of_burst = pmt::pmt_to_bool(value); - } - - //set the time specification in the metadata - else if (pmt::pmt_equal(key, TIME_KEY)){ - _metadata.has_time_spec = true; - _metadata.time_spec = uhd::time_spec_t( - pmt::pmt_to_uint64(pmt::pmt_tuple_ref(value, 0)), - pmt::pmt_to_double(pmt::pmt_tuple_ref(value, 1)) - ); - } - } - } - - void set_start_time(const uhd::time_spec_t &time){ - _start_time = time; - _start_time_set = true; - _stream_now = false; - } - - //Send an empty start-of-burst packet to begin streaming. - //Set at a time in the near future to avoid late packets. - bool start(void){ - #ifdef GR_UHD_USE_STREAM_API - _tx_stream = _dev->get_tx_stream(_stream_args); - #endif - - _metadata.start_of_burst = true; - _metadata.end_of_burst = false; - _metadata.has_time_spec = not _stream_now; - if (_start_time_set){ - _start_time_set = false; //cleared for next run - _metadata.time_spec = _start_time; - } - else{ - _metadata.time_spec = get_time_now() + uhd::time_spec_t(0.01); - } - - #ifdef GR_UHD_USE_STREAM_API - _tx_stream->send( - gr_vector_const_void_star(_nchan), 0, _metadata, 1.0 - ); - #else - _dev->get_device()->send( - gr_vector_const_void_star(_nchan), 0, _metadata, - *_type, uhd::device::SEND_MODE_ONE_PACKET, 1.0 - ); - #endif - return true; - } - - //Send an empty end-of-burst packet to end streaming. - //Ending the burst avoids an underflow error on stop. - bool stop(void){ - _metadata.start_of_burst = false; - _metadata.end_of_burst = true; - _metadata.has_time_spec = false; - - #ifdef GR_UHD_USE_STREAM_API - _tx_stream->send(gr_vector_const_void_star(_nchan), 0, _metadata, 1.0); - #else - _dev->get_device()->send( - gr_vector_const_void_star(_nchan), 0, _metadata, - *_type, uhd::device::SEND_MODE_ONE_PACKET, 1.0 - ); - #endif - return true; - } - -private: - uhd::usrp::multi_usrp::sptr _dev; - const uhd::stream_args_t _stream_args; - boost::shared_ptr<uhd::io_type_t> _type; - #ifdef GR_UHD_USE_STREAM_API - uhd::tx_streamer::sptr _tx_stream; - #endif - size_t _nchan; - bool _stream_now; - uhd::tx_metadata_t _metadata; - double _sample_rate; - - uhd::time_spec_t _start_time; - bool _start_time_set; - - //stream tags related stuff - std::vector<gr_tag_t> _tags; -}; - -/*********************************************************************** - * Make UHD Multi USRP Sink - **********************************************************************/ -boost::shared_ptr<uhd_usrp_sink> uhd_make_usrp_sink( - const uhd::device_addr_t &device_addr, - const uhd::io_type_t &io_type, - size_t num_channels -){ - //fill in the streamer args - uhd::stream_args_t stream_args; - switch(io_type.tid){ - case uhd::io_type_t::COMPLEX_FLOAT32: stream_args.cpu_format = "fc32"; break; - case uhd::io_type_t::COMPLEX_INT16: stream_args.cpu_format = "sc16"; break; - default: throw std::runtime_error("only complex float and shorts known to work"); - } - stream_args.otw_format = "sc16"; //only sc16 known to work - for (size_t chan = 0; chan < num_channels; chan++) - stream_args.channels.push_back(chan); //linear mapping - - return uhd_make_usrp_sink(device_addr, stream_args); -} - -boost::shared_ptr<uhd_usrp_sink> uhd_make_usrp_sink( - const uhd::device_addr_t &device_addr, - const uhd::stream_args_t &stream_args -){ - gr_uhd_check_abi(); - return boost::shared_ptr<uhd_usrp_sink>( - new uhd_usrp_sink_impl(device_addr, stream_args_ensure(stream_args)) - ); -} diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc deleted file mode 100644 index 50164b4a8..000000000 --- a/gr-uhd/lib/gr_uhd_usrp_source.cc +++ /dev/null @@ -1,601 +0,0 @@ -/* - * Copyright 2010-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. - */ - -#include <gr_uhd_usrp_source.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> -#include <boost/format.hpp> -#include <boost/thread/thread.hpp> -#include <boost/make_shared.hpp> -#include "gr_uhd_common.h" - -static const pmt::pmt_t TIME_KEY = pmt::pmt_string_to_symbol("rx_time"); -static const pmt::pmt_t RATE_KEY = pmt::pmt_string_to_symbol("rx_rate"); -static const pmt::pmt_t FREQ_KEY = pmt::pmt_string_to_symbol("rx_freq"); - -#include <uhd/convert.hpp> -inline gr_io_signature_sptr args_to_io_sig(const uhd::stream_args_t &args){ - const size_t nchan = std::max<size_t>(args.channels.size(), 1); - #ifdef GR_UHD_USE_STREAM_API - const size_t size = uhd::convert::get_bytes_per_item(args.cpu_format); - #else - size_t size = 0; - if (args.cpu_format == "fc32") size = 8; - if (args.cpu_format == "sc16") size = 4; - #endif - return gr_make_io_signature(nchan, nchan, size); -} - -/*********************************************************************** - * UHD Multi USRP Source Impl - **********************************************************************/ -class uhd_usrp_source_impl : public uhd_usrp_source{ -public: - uhd_usrp_source_impl( - const uhd::device_addr_t &device_addr, - const uhd::stream_args_t &stream_args - ): - gr_sync_block( - "gr uhd usrp source", - gr_make_io_signature(0, 0, 0), - args_to_io_sig(stream_args) - ), - _stream_args(stream_args), - _nchan(stream_args.channels.size()), - _stream_now(_nchan == 1), - _tag_now(false), - _start_time_set(false) - { - if (stream_args.cpu_format == "fc32") _type = boost::make_shared<uhd::io_type_t>(uhd::io_type_t::COMPLEX_FLOAT32); - if (stream_args.cpu_format == "sc16") _type = boost::make_shared<uhd::io_type_t>(uhd::io_type_t::COMPLEX_INT16); - std::stringstream str; - str << name() << unique_id(); - _id = pmt::pmt_string_to_symbol(str.str()); - _dev = uhd::usrp::multi_usrp::make(device_addr); - } - - uhd::dict<std::string, std::string> get_usrp_info(size_t chan){ - chan = _stream_args.channels[chan]; - #ifdef UHD_USRP_MULTI_USRP_GET_USRP_INFO_API - return _dev->get_usrp_rx_info(chan); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - void set_subdev_spec(const std::string &spec, size_t mboard){ - return _dev->set_rx_subdev_spec(spec, mboard); - } - - std::string get_subdev_spec(size_t mboard){ - return _dev->get_rx_subdev_spec(mboard).to_string(); - } - - void set_samp_rate(double rate){ - BOOST_FOREACH(const size_t chan, _stream_args.channels) - { - _dev->set_rx_rate(rate, chan); - } - _samp_rate = this->get_samp_rate(); - _tag_now = true; - } - - double get_samp_rate(void){ - return _dev->get_rx_rate(_stream_args.channels[0]); - } - - uhd::meta_range_t get_samp_rates(void){ - #ifdef UHD_USRP_MULTI_USRP_GET_RATES_API - return _dev->get_rx_rates(_stream_args.channels[0]); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - uhd::tune_result_t set_center_freq( - const uhd::tune_request_t tune_request, size_t chan - ){ - const size_t user_chan = chan; - chan = _stream_args.channels[chan]; - const uhd::tune_result_t res = _dev->set_rx_freq(tune_request, chan); - _center_freq = this->get_center_freq(user_chan); - _tag_now = true; - return res; - } - - double get_center_freq(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_freq(chan); - } - - uhd::freq_range_t get_freq_range(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_freq_range(chan); - } - - void set_gain(double gain, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->set_rx_gain(gain, chan); - } - - void set_gain(double gain, const std::string &name, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->set_rx_gain(gain, name, chan); - } - - double get_gain(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_gain(chan); - } - - double get_gain(const std::string &name, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_gain(name, chan); - } - - std::vector<std::string> get_gain_names(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_gain_names(chan); - } - - uhd::gain_range_t get_gain_range(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_gain_range(chan); - } - - uhd::gain_range_t get_gain_range(const std::string &name, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_gain_range(name, chan); - } - - void set_antenna(const std::string &ant, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->set_rx_antenna(ant, chan); - } - - std::string get_antenna(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_antenna(chan); - } - - std::vector<std::string> get_antennas(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_antennas(chan); - } - - void set_bandwidth(double bandwidth, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->set_rx_bandwidth(bandwidth, chan); - } - - double get_bandwidth(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_bandwidth(chan); - } - - uhd::freq_range_t get_bandwidth_range(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_bandwidth_range(chan); - } - - void set_auto_dc_offset(const bool enable, size_t chan){ - chan = _stream_args.channels[chan]; - #ifdef UHD_USRP_MULTI_USRP_FRONTEND_CAL_API - return _dev->set_rx_dc_offset(enable, chan); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - void set_dc_offset(const std::complex<double> &offset, size_t chan){ - chan = _stream_args.channels[chan]; - #ifdef UHD_USRP_MULTI_USRP_FRONTEND_CAL_API - return _dev->set_rx_dc_offset(offset, chan); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - void set_iq_balance(const std::complex<double> &correction, size_t chan){ - chan = _stream_args.channels[chan]; - #ifdef UHD_USRP_MULTI_USRP_FRONTEND_CAL_API - return _dev->set_rx_iq_balance(correction, chan); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - uhd::sensor_value_t get_sensor(const std::string &name, size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_sensor(name, chan); - } - - std::vector<std::string> get_sensor_names(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_sensor_names(chan); - } - - uhd::sensor_value_t get_mboard_sensor(const std::string &name, size_t mboard){ - return _dev->get_mboard_sensor(name, mboard); - } - - std::vector<std::string> get_mboard_sensor_names(size_t mboard){ - return _dev->get_mboard_sensor_names(mboard); - } - - void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard){ - return _dev->set_clock_config(clock_config, mboard); - } - - void set_time_source(const std::string &source, const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->set_time_source(source, mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - std::string get_time_source(const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->get_time_source(mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - std::vector<std::string> get_time_sources(const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->get_time_sources(mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - void set_clock_source(const std::string &source, const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->set_clock_source(source, mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - std::string get_clock_source(const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->get_clock_source(mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - std::vector<std::string> get_clock_sources(const size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API - return _dev->get_clock_sources(mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - double get_clock_rate(size_t mboard){ - return _dev->get_master_clock_rate(mboard); - } - - void set_clock_rate(double rate, size_t mboard){ - return _dev->set_master_clock_rate(rate, mboard); - } - - uhd::time_spec_t get_time_now(size_t mboard = 0){ - return _dev->get_time_now(mboard); - } - - uhd::time_spec_t get_time_last_pps(size_t mboard){ - return _dev->get_time_last_pps(mboard); - } - - void set_time_now(const uhd::time_spec_t &time_spec, size_t mboard){ - return _dev->set_time_now(time_spec, mboard); - } - - void set_time_next_pps(const uhd::time_spec_t &time_spec){ - return _dev->set_time_next_pps(time_spec); - } - - void set_time_unknown_pps(const uhd::time_spec_t &time_spec){ - return _dev->set_time_unknown_pps(time_spec); - } - - void set_command_time(const uhd::time_spec_t &time_spec, size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_COMMAND_TIME_API - return _dev->set_command_time(time_spec, mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - void clear_command_time(size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_COMMAND_TIME_API - return _dev->clear_command_time(mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - - uhd::usrp::dboard_iface::sptr get_dboard_iface(size_t chan){ - chan = _stream_args.channels[chan]; - return _dev->get_rx_dboard_iface(chan); - } - - uhd::usrp::multi_usrp::sptr get_device(void){ - return _dev; - } - - void set_user_register(const uint8_t addr, const uint32_t data, size_t mboard){ - #ifdef UHD_USRP_MULTI_USRP_USER_REGS_API - _dev->set_user_register(addr, data, mboard); - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - -/*********************************************************************** - * Work - **********************************************************************/ - int work( - int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ - #ifdef GR_UHD_USE_STREAM_API - //In order to allow for low-latency: - //We receive all available packets without timeout. - //This call can timeout under regular operation... - size_t num_samps = _rx_stream->recv( - output_items, noutput_items, _metadata, 0.0 - ); - - //If receive resulted in a timeout condition: - //We now receive a single packet with a large timeout. - if (_metadata.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT) - { - num_samps = _rx_stream->recv( - output_items, noutput_items, _metadata, 0.1, true/*one pkt*/ - ); - } - #else - size_t num_samps = _dev->get_device()->recv( - output_items, noutput_items, _metadata, - *_type, uhd::device::RECV_MODE_FULL_BUFF, 0.0 - ); - if (_metadata.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT){ - num_samps = _dev->get_device()->recv( - output_items, noutput_items, _metadata, - *_type, uhd::device::RECV_MODE_ONE_PACKET, 1.0 - ); - } - #endif - - //handle possible errors conditions - switch(_metadata.error_code){ - case uhd::rx_metadata_t::ERROR_CODE_NONE: - if (_tag_now){ - _tag_now = false; - //create a timestamp pmt for the first sample - const pmt::pmt_t val = pmt::pmt_make_tuple( - pmt::pmt_from_uint64(_metadata.time_spec.get_full_secs()), - pmt::pmt_from_double(_metadata.time_spec.get_frac_secs()) - ); - //create a tag set for each channel - for (size_t i = 0; i < _nchan; i++){ - this->add_item_tag(i, nitems_written(0), TIME_KEY, val, _id); - this->add_item_tag(i, nitems_written(0), RATE_KEY, pmt::pmt_from_double(_samp_rate), _id); - this->add_item_tag(i, nitems_written(0), FREQ_KEY, pmt::pmt_from_double(_center_freq), _id); - } - } - break; - - case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: - //its ok to timeout, perhaps the user is doing finite streaming - return 0; - - case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: - _tag_now = true; - //ignore overflows and try work again - return work(noutput_items, input_items, output_items); - - default: - std::cout << boost::format( - "UHD source block got error code 0x%x" - ) % _metadata.error_code << std::endl; - return num_samps; - } - - return num_samps; - } - - void set_start_time(const uhd::time_spec_t &time){ - _start_time = time; - _start_time_set = true; - _stream_now = false; - } - - void issue_stream_cmd(const uhd::stream_cmd_t &cmd) - { - for (size_t i = 0; i < _stream_args.channels.size(); i++) - { - _dev->issue_stream_cmd(cmd, _stream_args.channels[i]); - } - } - - bool start(void){ - #ifdef GR_UHD_USE_STREAM_API - _rx_stream = _dev->get_rx_stream(_stream_args); - _samps_per_packet = _rx_stream->get_max_num_samps(); - #endif - //setup a stream command that starts streaming slightly in the future - static const double reasonable_delay = 0.1; //order of magnitude over RTT - uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); - stream_cmd.stream_now = _stream_now; - if (_start_time_set){ - _start_time_set = false; //cleared for next run - stream_cmd.time_spec = _start_time; - } - else{ - stream_cmd.time_spec = get_time_now() + uhd::time_spec_t(reasonable_delay); - } - this->issue_stream_cmd(stream_cmd); - _tag_now = true; - return true; - } - - void flush(void){ - const size_t nbytes = 4096; - gr_vector_void_star outputs; - std::vector<std::vector<char> > buffs(_nchan, std::vector<char>(nbytes)); - for (size_t i = 0; i < _nchan; i++){ - outputs.push_back(&buffs[i].front()); - } - while (true){ - #ifdef GR_UHD_USE_STREAM_API - const size_t bpi = uhd::convert::get_bytes_per_item(_stream_args.cpu_format); - _rx_stream->recv( - outputs, nbytes/bpi, _metadata, 0.0 - ); - #else - _dev->get_device()->recv( - outputs, nbytes/_type->size, _metadata, - *_type, uhd::device::RECV_MODE_FULL_BUFF, 0.0 - ); - #endif - if (_metadata.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT) break; - } - } - - bool stop(void){ - this->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS); - - this->flush(); - - return true; - } - - std::vector<std::complex<float> > finite_acquisition(const size_t nsamps){ - if (_nchan != 1) throw std::runtime_error("finite_acquisition: usrp source has multiple channels, call finite_acquisition_v"); - return finite_acquisition_v(nsamps).front(); - } - - std::vector<std::vector<std::complex<float> > > finite_acquisition_v(const size_t nsamps){ - #ifdef GR_UHD_USE_STREAM_API - - //kludgy way to ensure rx streamer exsists - if (!_rx_stream){ - this->start(); - this->stop(); - } - - //flush so there is no queued-up data - this->flush(); - - //create a multi-dimensional container to hold an array of sample buffers - std::vector<std::vector<std::complex<float> > > samps(_nchan, std::vector<std::complex<float> >(nsamps)); - - //load the void* vector of buffer pointers - std::vector<void *> buffs(_nchan); - for (size_t i = 0; i < _nchan; i++){ - buffs[i] = &samps[i].front(); - } - - //tell the device to stream a finite amount - uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE); - cmd.num_samps = nsamps; - cmd.stream_now = _stream_now; - static const double reasonable_delay = 0.1; //order of magnitude over RTT - cmd.time_spec = get_time_now() + uhd::time_spec_t(reasonable_delay); - this->issue_stream_cmd(cmd); - - //receive samples until timeout - const size_t actual_num_samps = _rx_stream->recv( - buffs, nsamps, _metadata, 1.0 - ); - - //resize the resulting sample buffers - for (size_t i = 0; i < _nchan; i++){ - samps[i].resize(actual_num_samps); - } - - return samps; - #else - throw std::runtime_error("not implemented in this version"); - #endif - } - -private: - uhd::usrp::multi_usrp::sptr _dev; - const uhd::stream_args_t _stream_args; - boost::shared_ptr<uhd::io_type_t> _type; - #ifdef GR_UHD_USE_STREAM_API - uhd::rx_streamer::sptr _rx_stream; - size_t _samps_per_packet; - #endif - size_t _nchan; - bool _stream_now, _tag_now; - uhd::rx_metadata_t _metadata; - pmt::pmt_t _id; - - uhd::time_spec_t _start_time; - bool _start_time_set; - - //tag shadows - double _samp_rate; - double _center_freq; -}; - - -/*********************************************************************** - * Make UHD Multi USRP Source - **********************************************************************/ -boost::shared_ptr<uhd_usrp_source> uhd_make_usrp_source( - const uhd::device_addr_t &device_addr, - const uhd::io_type_t &io_type, - size_t num_channels -){ - //fill in the streamer args - uhd::stream_args_t stream_args; - switch(io_type.tid){ - case uhd::io_type_t::COMPLEX_FLOAT32: stream_args.cpu_format = "fc32"; break; - case uhd::io_type_t::COMPLEX_INT16: stream_args.cpu_format = "sc16"; break; - default: throw std::runtime_error("only complex float and shorts known to work"); - } - stream_args.otw_format = "sc16"; //only sc16 known to work - for (size_t chan = 0; chan < num_channels; chan++) - stream_args.channels.push_back(chan); //linear mapping - - return uhd_make_usrp_source(device_addr, stream_args); -} - -boost::shared_ptr<uhd_usrp_source> uhd_make_usrp_source( - const uhd::device_addr_t &device_addr, - const uhd::stream_args_t &stream_args -){ - gr_uhd_check_abi(); - return boost::shared_ptr<uhd_usrp_source>( - new uhd_usrp_source_impl(device_addr, stream_args_ensure(stream_args)) - ); -} diff --git a/gr-uhd/swig/CMakeLists.txt b/gr-uhd/swig/CMakeLists.txt deleted file mode 100644 index 3a5132e7f..000000000 --- a/gr-uhd/swig/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_FLAGS -DGR_HAVE_UHD) #needed to parse uhd_swig.i - -set(GR_SWIG_INCLUDE_DIRS - ${GR_UHD_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${UHD_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/uhd_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include) - -link_directories(${UHD_LIBRARY_DIRS}) -set(GR_SWIG_LIBRARIES gnuradio-uhd ${UHD_LIBRARIES}) - -GR_SWIG_MAKE(uhd_swig uhd_swig.i) - -GR_SWIG_INSTALL( - TARGETS uhd_swig - DESTINATION ${GR_PYTHON_DIR}/gnuradio/uhd - COMPONENT "uhd_python" -) - -install( - FILES uhd_swig.i - ${CMAKE_CURRENT_BINARY_DIR}/uhd_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "uhd_swig" -) - -GR_PYTHON_INSTALL( - FILES __init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/uhd - COMPONENT "uhd_python" -) diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py deleted file mode 100644 index 54a058c45..000000000 --- a/gr-uhd/swig/__init__.py +++ /dev/null @@ -1,130 +0,0 @@ -# -# Copyright 2010-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 is the GNU Radio UHD package. It is the interface to the UHD -library to connect to and send and receive data between the Ettus -Research, LLC product line. -''' - -######################################################################## -# Prepare uhd swig module to make it more pythonic -######################################################################## -def _prepare_uhd_swig(): - import uhd_swig - - #some useful typedefs for the user - setattr(uhd_swig, 'freq_range_t', uhd_swig.meta_range_t) - setattr(uhd_swig, 'gain_range_t', uhd_swig.meta_range_t) - - #Make the python tune request object inherit from float - #so that it can be passed in GRC as a frequency parameter. - #The type checking in GRC will accept the tune request. - #Also use kwargs to construct individual struct elements. - class tune_request_t(uhd_swig.tune_request_t, float): - def __new__(self, *args, **kwargs): return float.__new__(self) - def __float__(self): return self.target_freq - def __init__(self, *args, **kwargs): - super(tune_request_t, self).__init__(*args) - for key, val in kwargs.iteritems(): setattr(self, key, val) - setattr(uhd_swig, 'tune_request_t', tune_request_t) - - #Make the python tune request object inherit from string - #so that it can be passed in GRC as a string parameter. - #The type checking in GRC will accept the device address. - #Define the set/get item special methods for dict access. - class device_addr_t(uhd_swig.device_addr_t, str): - def __new__(self, *args): return str.__new__(self) - def __getitem__(self, key): return self.get(key) - def __setitem__(self, key, val): self.set(key, val) - def __init__(self, *args, **kwargs): - super(device_addr_t, self).__init__(*args) - if args and isinstance(args[0], device_addr_t): - for key in args[0].keys(): self[key] = args[0][key] - setattr(uhd_swig, 'device_addr_t', device_addr_t) - - #make the streamer args take **kwargs on init - class stream_args_t(uhd_swig.stream_args_t): - def __init__(self, *args, **kwargs): - super(stream_args_t, self).__init__(*args) - for key, val in kwargs.iteritems(): - #for some reason, i cant assign a list in the constructor - #but what i can do is append the elements individually - if key == 'channels': - for v in val: self.channels.append(v) - elif key == 'args': - self.args = device_addr_t(val) - else: setattr(self, key, val) - setattr(uhd_swig, 'stream_args_t', stream_args_t) - - #handle general things on all uhd_swig attributes - #Install the __str__ and __repr__ handlers if applicable - #Create aliases for uhd swig attributes to avoid the "_t" - for attr in dir(uhd_swig): - myobj = getattr(uhd_swig, attr) - if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda o: o.to_string().strip() - if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda o: o.to_pp_string().strip() - if hasattr(myobj, 'to_bool'): myobj.__nonzero__ = lambda o: o.to_bool() - if hasattr(myobj, 'to_int'): myobj.__int__ = lambda o: o.to_int() - if hasattr(myobj, 'to_real'): myobj.__float__ = lambda o: o.to_real() - if attr.endswith('_t'): setattr(uhd_swig, attr[:-2], myobj) - - #make a new find devices that casts everything with the pythonized device_addr_t which has __str__ - def find_devices(*args, **kwargs): - def to_pythonized_dev_addr(dev_addr): - new_dev_addr = uhd_swig.device_addr_t() - for key in dev_addr.keys(): new_dev_addr[key] = dev_addr.get(key) - return new_dev_addr - return map(to_pythonized_dev_addr, uhd_swig.find_devices_raw(*args, **kwargs)) - setattr(uhd_swig, 'find_devices', find_devices) - - #Cast constructor args (FIXME swig handle overloads?) - for attr in ('usrp_source', 'usrp_sink', 'amsg_source'): - def constructor_factory(old_constructor): - def constructor_interceptor(*args, **kwargs): - args = list(args) - kwargs = dict(kwargs) - for index, key, cast in ( - (0, 'device_addr', device_addr), - (1, 'io_type', io_type), - ): - try: - if len(args) > index: args[index] = cast(args[index]) - if kwargs.has_key(key): kwargs[key] = cast(kwargs[key]) - except: pass - #dont pass kwargs, it confuses swig, map into args list: - for key in ('device_addr', 'stream_args', 'io_type', 'num_channels'): - if kwargs.has_key(key): args.append(kwargs[key]) - return old_constructor(*args) - return constructor_interceptor - setattr(uhd_swig, attr, constructor_factory(getattr(uhd_swig, attr))) - - #Aliases for deprecated constructors - setattr(uhd_swig, 'single_usrp_source', uhd_swig.usrp_source) - setattr(uhd_swig, 'single_usrp_sink', uhd_swig.usrp_sink) - setattr(uhd_swig, 'multi_usrp_source', uhd_swig.usrp_source) - setattr(uhd_swig, 'multi_usrp_sink', uhd_swig.usrp_sink) - -######################################################################## -# Initialize this module with the contents of uhd swig -######################################################################## -_prepare_uhd_swig() -from uhd_swig import * diff --git a/gr-uhd/swig/gnuradio/uhd.scm b/gr-uhd/swig/gnuradio/uhd.scm deleted file mode 100644 index 906aef2a6..000000000 --- a/gr-uhd/swig/gnuradio/uhd.scm +++ /dev/null @@ -1,27 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see <http://www.gnu.org/licenses/>. -;;; - -;;; Semi bogus module that just reexports the uhd_swig module - -(define-module (gnuradio uhd) - #:use-module (gnuradio export-safely) - #:use-module (gnuradio uhd_swig) - #:duplicates (merge-generics replace check)) - -(re-export-all '(gnuradio uhd_swig)) diff --git a/gr-uhd/swig/qa_uhd.py b/gr-uhd/swig/qa_uhd.py deleted file mode 100755 index 00757369f..000000000 --- a/gr-uhd/swig/qa_uhd.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2008,2010 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. -# - -from gnuradio import gr, gr_unittest -import uhd_swig - -class test_uhd(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_000_nop (self): - """Just see if we can import the module... - They may not have a UHD device connected, etc. Don't try to run anything""" - pass - -if __name__ == '__main__': - gr_unittest.run(test_uhd, "test_uhd.xml") diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i deleted file mode 100644 index 342b8279b..000000000 --- a/gr-uhd/swig/uhd_swig.i +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010-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. - */ - -%module uhd_swig - -// Defined during configure; avoids trying to locate -// header files if UHD was not installed. -#ifdef GR_HAVE_UHD - -#define GR_UHD_API - -//suppress 319. No access specifier given for base class name (ignored). -#pragma SWIG nowarn=319 - -//////////////////////////////////////////////////////////////////////// -// standard includes -//////////////////////////////////////////////////////////////////////// -%include "gnuradio.i" - -//load generated python docstrings -%include "uhd_swig_doc.i" - -//////////////////////////////////////////////////////////////////////// -// block headers -//////////////////////////////////////////////////////////////////////// -%{ -#include <gr_uhd_usrp_source.h> -#include <gr_uhd_usrp_sink.h> -#include <gr_uhd_amsg_source.h> -%} - -//////////////////////////////////////////////////////////////////////// -// used types -//////////////////////////////////////////////////////////////////////// -%template(string_vector_t) std::vector<std::string>; - -%template(size_vector_t) std::vector<size_t>; - -%include <uhd/config.hpp> - -%include <uhd/utils/pimpl.hpp> - -%ignore uhd::dict::operator[]; //ignore warnings about %extend -%include <uhd/types/dict.hpp> -%template(string_string_dict_t) uhd::dict<std::string, std::string>; //define after dict - -%include <uhd/types/device_addr.hpp> - -%include <uhd/types/io_type.hpp> - -%template(range_vector_t) std::vector<uhd::range_t>; //define before range -%include <uhd/types/ranges.hpp> - -%include <uhd/types/tune_request.hpp> - -%include <uhd/types/tune_result.hpp> - -%include <uhd/types/io_type.hpp> - -%include <uhd/types/time_spec.hpp> - -%include <uhd/types/stream_cmd.hpp> - -%include <uhd/types/clock_config.hpp> - -%include <uhd/types/metadata.hpp> - -%template(device_addr_vector_t) std::vector<uhd::device_addr_t>; - -%include <uhd/types/sensors.hpp> - -//////////////////////////////////////////////////////////////////////// -// swig dboard_iface for python access -//////////////////////////////////////////////////////////////////////// -%include stdint.i -%include <uhd/types/serial.hpp> -%template(byte_vector_t) std::vector<uint8_t>; -%include <uhd/usrp/dboard_iface.hpp> - -%template(dboard_iface_sptr) boost::shared_ptr<uhd::usrp::dboard_iface>; - -//////////////////////////////////////////////////////////////////////// -// block magic -//////////////////////////////////////////////////////////////////////// -GR_SWIG_BLOCK_MAGIC(uhd,usrp_source) -%include <gr_uhd_usrp_source.h> - -GR_SWIG_BLOCK_MAGIC(uhd,usrp_sink) -%include <gr_uhd_usrp_sink.h> - -GR_SWIG_BLOCK_MAGIC(uhd,amsg_source) -%include <gr_uhd_amsg_source.h> - -//////////////////////////////////////////////////////////////////////// -// device discovery (no need to %include device.hpp) -//////////////////////////////////////////////////////////////////////// -%{ -static uhd::device_addrs_t find_devices_raw(const uhd::device_addr_t &dev_addr = uhd::device_addr_t()){ - return uhd::device::find(dev_addr); -} -%} - -static uhd::device_addrs_t find_devices_raw(const uhd::device_addr_t &dev_addr = uhd::device_addr_t()); - -//////////////////////////////////////////////////////////////////////// -// helpful constants -//////////////////////////////////////////////////////////////////////// -%{ -static const size_t ALL_MBOARDS = uhd::usrp::multi_usrp::ALL_MBOARDS; -%} -static const size_t ALL_MBOARDS; - -%{ -#include <uhd/version.hpp> -std::string get_version_string(void){ - return uhd::get_version_string(); -} -%} -std::string get_version_string(void); - -#endif /* GR_HAVE_UHD */ diff --git a/gr-video-sdl/CMakeLists.txt b/gr-video-sdl/CMakeLists.txt deleted file mode 100644 index 57ffde894..000000000 --- a/gr-video-sdl/CMakeLists.txt +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -find_package(SDL) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) -GR_REGISTER_COMPONENT("gr-video-sdl" ENABLE_GR_VIDEO_SDL - SDL_FOUND - Boost_FOUND - ENABLE_GR_CORE -) - -GR_SET_GLOBAL(GR_VIDEO_SDL_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/src -) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_VIDEO_SDL) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_VIDEO_SDL_DESCRIPTION "GNU Radio Video SDL Blocks") - -CPACK_COMPONENT("video_sdl_runtime" - GROUP "Video SDL" - DISPLAY_NAME "Runtime" - DESCRIPTION "Runtime" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("video_sdl_devel" - GROUP "Video SDL" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("video_sdl_python" - GROUP "Video SDL" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime; GRC xml files" - DEPENDS "core_python;video_sdl_runtime" -) - -CPACK_COMPONENT("video_sdl_swig" - GROUP "Video SDL" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;video_sdl_python;video_sdl_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(src) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-video-sdl.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-video-sdl.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-video-sdl.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "video_sdl_devel" -) - -endif(ENABLE_GR_VIDEO_SDL) diff --git a/gr-video-sdl/gnuradio-video-sdl.pc.in b/gr-video-sdl/gnuradio-video-sdl.pc.in deleted file mode 100644 index ade9ba910..000000000 --- a/gr-video-sdl/gnuradio-video-sdl.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-video-sdl -Description: GNU Radio blocks for the SDL library -Requires: gnuradio-core sdl -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-video-sdl -Cflags: -I${includedir} diff --git a/gr-video-sdl/src/CMakeLists.txt b/gr-video-sdl/src/CMakeLists.txt deleted file mode 100644 index 3050926bd..000000000 --- a/gr-video-sdl/src/CMakeLists.txt +++ /dev/null @@ -1,114 +0,0 @@ -# Copyright 2011-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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${GR_VIDEO_SDL_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${SDL_INCLUDE_DIR} -) - -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_video_sdl_sources - video_sdl_sink_uc.cc - video_sdl_sink_s.cc -) - -list(APPEND video_sdl_libs - gnuradio-core - ${Boost_LIBRARIES} - ${SDL_LIBRARY} -) - -add_library(gnuradio-video-sdl SHARED ${gr_video_sdl_sources}) -target_link_libraries(gnuradio-video-sdl ${video_sdl_libs}) -GR_LIBRARY_FOO(gnuradio-video-sdl RUNTIME_COMPONENT "video_sdl_runtime" DEVEL_COMPONENT "video_sdl_devel") - -######################################################################## -# Install public header files -######################################################################## -install(FILES - video_sdl_api.h - video_sdl_sink_uc.h - video_sdl_sink_s.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "video_sdl_devel" -) - -######################################################################## -# Setup swig generation -######################################################################## -if(ENABLE_PYTHON) -include(GrPython) -include(GrSwig) - -set(GR_SWIG_INCLUDE_DIRS - ${GR_COMEDI_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/video_sdl_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) - -set(GR_SWIG_LIBRARIES gnuradio-video-sdl) - -GR_SWIG_MAKE(video_sdl video_sdl.i) - -GR_SWIG_INSTALL( - TARGETS video_sdl - DESTINATION ${GR_PYTHON_DIR}/gnuradio - COMPONENT "video_sdl_python" -) - -install( - FILES video_sdl.i - ${CMAKE_CURRENT_BINARY_DIR}/video_sdl_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "video_sdl_swig" -) - -endif(ENABLE_PYTHON) - -######################################################################## -# Handle the unit tests -######################################################################## -if(ENABLE_TESTING AND ENABLE_PYTHON) - -list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-video-sdl/src -) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-video-sdl) - -include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) -endif(ENABLE_TESTING AND ENABLE_PYTHON) diff --git a/gr-video-sdl/src/qa_video_sdl.py b/gr-video-sdl/src/qa_video_sdl.py deleted file mode 100755 index 9008d1513..000000000 --- a/gr-video-sdl/src/qa_video_sdl.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2010 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. -# - -from gnuradio import gr, gr_unittest -import video_sdl - -class test_video_sdl (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_000_nop (self): - """Just see if we can import the module... - They may not have video drivers, etc. Don't try to run anything""" - pass - -if __name__ == '__main__': - gr_unittest.run(test_video_sdl, "test_video_sdl.xml") diff --git a/gr-video-sdl/src/video_sdl.i b/gr-video-sdl/src/video_sdl.i deleted file mode 100644 index c06ad6c2e..000000000 --- a/gr-video-sdl/src/video_sdl.i +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009 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. - */ - -%include "gnuradio.i" // the common stuff - -//load generated python docstrings -%include "video_sdl_swig_doc.i" - -%{ -#include "video_sdl_sink_uc.h" -#include "video_sdl_sink_s.h" -%} - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(video_sdl,sink_uc) - -video_sdl_sink_uc_sptr -video_sdl_make_sink_uc ( double framerate,int width=640, int height=480,unsigned int format=0,int dst_width=-1,int dst_height=-1 - ) throw (std::runtime_error); - - -class video_sdl_sink_uc : public gr_sync_block { - protected: - video_sdl_sink_uc (double framerate,int width, int height,gr_uint32 format,int dst_width,int dst_height); - - public: - ~video_sdl_sink_uc (); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(video_sdl,sink_s) - -video_sdl_sink_s_sptr -video_sdl_make_sink_s ( double framerate,int width=640, int height=480,unsigned int format=0,int dst_width=-1,int dst_height=-1 - ) throw (std::runtime_error); - - -class video_sdl_sink_s : public gr_sync_block { - protected: - video_sdl_sink_s (double framerate,int width, int height,gr_uint32 format,int dst_width,int dst_height); - - public: - ~video_sdl_sink_s (); -}; diff --git a/gr-video-sdl/src/video_sdl_api.h b/gr-video-sdl/src/video_sdl_api.h deleted file mode 100644 index 5418f86f0..000000000 --- a/gr-video-sdl/src/video_sdl_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_VIDEO_SDL_API_H -#define INCLUDED_VIDEO_SDL_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_video_sdl_EXPORTS -# define VIDEO_SDL_API __GR_ATTR_EXPORT -#else -# define VIDEO_SDL_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_VIDEO_SDL_API_H */ diff --git a/gr-video-sdl/src/video_sdl_sink_s.cc b/gr-video-sdl/src/video_sdl_sink_s.cc deleted file mode 100644 index d9232043a..000000000 --- a/gr-video-sdl/src/video_sdl_sink_s.cc +++ /dev/null @@ -1,301 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <SDL.h> - -#include <video_sdl_sink_s.h> -#include <gr_io_signature.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdio.h> -#include <iostream> -#include <stdexcept> -#include <string.h> - - - -video_sdl_sink_s::video_sdl_sink_s (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height) - : gr_sync_block ("video_sdl_sink_s", - gr_make_io_signature (1, 3, sizeof (short)), - gr_make_io_signature (0, 0, 0)), - d_chunk_size (width*height), - d_framerate(framerate), - d_wanted_frametime_ms(0), - d_width(width), - d_height (height), - d_dst_width(dst_width), - d_dst_height(dst_height), - d_format(format), - d_current_line(0), - d_screen(NULL), - d_image(NULL), - d_avg_delay(0.0), - d_wanted_ticks(0) -{ - if(framerate<=0.0) - d_wanted_frametime_ms=0;//Go as fast as possible - else - d_wanted_frametime_ms=(int)(1000.0/framerate); - if(dst_width<0) d_dst_width=d_width; - if(dst_height<0) d_dst_height=d_height; - if(0==format) d_format=IMGFMT_YV12; - - atexit(SDL_Quit);//check if this is the way to do this - if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { - std::cerr << "video_sdl_sink_s: Couldn't initialize SDL:" << SDL_GetError() << " \n SDL_Init(SDL_INIT_VIDEO) failed\n"; - throw std::runtime_error ("video_sdl_sink_s"); - }; - - /* accept any depth */ - d_screen = SDL_SetVideoMode(dst_width, dst_height, 0, SDL_SWSURFACE|SDL_RESIZABLE|SDL_ANYFORMAT);//SDL_DOUBLEBUF |SDL_SWSURFACE| SDL_HWSURFACE||SDL_FULLSCREEN - if ( d_screen == NULL ) { - std::cerr << "Unable to set SDL video mode: " << SDL_GetError() <<"\n SDL_SetVideoMode() Failed \n"; - exit(1); - } - if ( d_image ) { - SDL_FreeYUVOverlay(d_image); - } - /* Initialize and create the YUV Overlay used for video out */ - if (!(d_image = SDL_CreateYUVOverlay (d_width, d_height, SDL_YV12_OVERLAY, d_screen))) { - std::cerr << "SDL: Couldn't create a YUV overlay: \n"<< SDL_GetError() <<"\n"; - throw std::runtime_error ("video_sdl_sink_s"); - } - - printf("SDL screen_mode %d bits-per-pixel\n", - d_screen->format->BitsPerPixel); - printf("SDL overlay_mode %i \n", - d_image->format); - d_chunk_size = std::min(1,16384/width); //width*16; - d_chunk_size = d_chunk_size*width; - //d_chunk_size = (int) (width); - set_output_multiple (d_chunk_size); - /* Set the default playback area */ - d_dst_rect.x = 0; - d_dst_rect.y = 0; - d_dst_rect.w = d_dst_width; - d_dst_rect.h = d_dst_height; - //clear the surface to grey - if ( SDL_LockYUVOverlay( d_image ) ) { - std::cerr << "SDL: Couldn't lock YUV overlay: \n"<< SDL_GetError() <<"\n"; - throw std::runtime_error ("video_sdl_sink_s"); - } - memset(d_image->pixels[0], 128, d_image->pitches[0]*d_height); - memset(d_image->pixels[1], 128, d_image->pitches[1]*d_height/2); - memset(d_image->pixels[2], 128, d_image->pitches[2]*d_height/2); - SDL_UnlockYUVOverlay( d_image ); -} - -video_sdl_sink_s::~video_sdl_sink_s () -{ - SDL_Quit(); -} - -video_sdl_sink_s_sptr -video_sdl_make_sink_s (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height) -{ - return gnuradio::get_initial_sptr(new video_sdl_sink_s (framerate, width, height,format,dst_width,dst_height)); -} - -void -video_sdl_sink_s::copy_line_pixel_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,const short * src_pixels,int src_width) -{ - for(int i=0;i<src_width;i++) - { - dst_pixels_u[i]=(unsigned char)src_pixels[i*2]; - dst_pixels_v[i]=(unsigned char)src_pixels[i*2+1]; - } - return; -} - -void -video_sdl_sink_s::copy_line_line_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,const short * src_pixels,int src_width) -{ - for(int i=0;i<src_width;i++) - { - dst_pixels_u[i]=(unsigned char)src_pixels[i]; - dst_pixels_v[i]=(unsigned char)src_pixels[i+src_width]; - } - for(int i=src_width;i<src_width*2;i++) - { - dst_pixels_v[i]=(unsigned char)src_pixels[i]; - } - return; -} -void -video_sdl_sink_s::copy_line_single_plane(unsigned char *dst_pixels,const short * src_pixels,int src_width) -{ - for(int i=0;i<src_width;i++) - { - dst_pixels[i]=(unsigned char)src_pixels[i]; - } - return; -} - -void -video_sdl_sink_s::copy_line_single_plane_dec2(unsigned char *dst_pixels,const short * src_pixels,int src_width) -{ - for(int i=0,j=0;i<src_width;i+=2,j++) - { - dst_pixels[j]=(unsigned char)src_pixels[i]; - } - return; -} - -int -video_sdl_sink_s::copy_plane_to_surface (int plane,int noutput_items, - const short * src_pixels) -{ - const int first_dst_plane=(12==plane ||1122==plane)?1:plane; - const int second_dst_plane=(12==plane ||1122==plane)?2:plane; - int current_line=(0==plane)?d_current_line:d_current_line/2; - unsigned char * dst_pixels = (unsigned char *)d_image->pixels[first_dst_plane]; - dst_pixels=&dst_pixels[current_line*d_image->pitches[first_dst_plane]]; - unsigned char * dst_pixels_2 = (unsigned char *)d_image->pixels[second_dst_plane]; - dst_pixels_2=&dst_pixels_2[current_line*d_image->pitches[second_dst_plane]]; - int src_width=(0==plane || 12==plane || 1122==plane)?d_width:d_width/2; - int noutput_items_produced=0; - int max_height=(0==plane)?d_height-1:d_height/2-1; - for (int i = 0; i < noutput_items; i += src_width){ - //output one line at a time - if(12==plane) - { - copy_line_pixel_interleaved(dst_pixels,dst_pixels_2,src_pixels,src_width); - dst_pixels_2 += d_image->pitches[second_dst_plane]; - } - else if (1122==plane) - { - copy_line_line_interleaved(dst_pixels,dst_pixels_2,src_pixels,src_width); - dst_pixels_2 += d_image->pitches[second_dst_plane]; - src_pixels += src_width; - } - else if (0==plane) - copy_line_single_plane(dst_pixels,src_pixels,src_width); - else /* 1==plane || 2==plane*/ - copy_line_single_plane_dec2(dst_pixels,src_pixels,src_width);//decimate by two horizontally - - src_pixels += src_width; - dst_pixels += d_image->pitches[first_dst_plane]; - noutput_items_produced+=src_width; - current_line++; - if (current_line>max_height) - { - //Start new frame - //TODO, do this all in a seperate thread - current_line=0; - dst_pixels=d_image->pixels[first_dst_plane]; - dst_pixels_2=d_image->pixels[second_dst_plane]; - if(0==plane) - { - SDL_DisplayYUVOverlay(d_image, &d_dst_rect); - //SDL_Flip(d_screen); - unsigned int ticks=SDL_GetTicks();//milliseconds - d_wanted_ticks+=d_wanted_frametime_ms; - float avg_alpha=0.1; - int time_diff=d_wanted_ticks-ticks; - d_avg_delay=time_diff*avg_alpha +d_avg_delay*(1.0-avg_alpha); - } - } - } - if(0==plane) d_current_line=current_line; - return noutput_items_produced; -} - -int -video_sdl_sink_s::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - short *src_pixels_0,*src_pixels_1,*src_pixels_2; - int noutput_items_produced=0; - int plane; - int delay=(int)d_avg_delay; - if(0==d_wanted_ticks) - d_wanted_ticks=SDL_GetTicks(); - if(delay>0) - SDL_Delay((unsigned int)delay);//compensate if running too fast - - if ( SDL_LockYUVOverlay( d_image ) ) { - return 0; - } - switch (input_items.size ()){ - case 3: // first channel=Y, second channel is U , third channel is V - src_pixels_0 = (short *) input_items[0]; - src_pixels_1 = (short *) input_items[1]; - src_pixels_2 = (short *) input_items[2]; - for (int i = 0; i < noutput_items; i += d_chunk_size){ - copy_plane_to_surface (1,d_chunk_size, src_pixels_1); - copy_plane_to_surface (2,d_chunk_size, src_pixels_2); - noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0); - src_pixels_0 += d_chunk_size; - src_pixels_1 += d_chunk_size; - src_pixels_2 += d_chunk_size; - } - break; - case 2: - if(1) //if(pixel_interleaved_uv) - { - // first channel=Y, second channel is alternating pixels U and V - src_pixels_0 = (short *) input_items[0]; - src_pixels_1 = (short *) input_items[1]; - for (int i = 0; i < noutput_items; i += d_chunk_size){ - copy_plane_to_surface (12,d_chunk_size/2, src_pixels_1); - noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0); - src_pixels_0 += d_chunk_size; - src_pixels_1 += d_chunk_size; - } - } else - { - // first channel=Y, second channel is alternating lines U and V - src_pixels_0 = (short *) input_items[0]; - src_pixels_1 = (short *) input_items[1]; - for (int i = 0; i < noutput_items; i += d_chunk_size){ - copy_plane_to_surface (1222,d_chunk_size/2, src_pixels_1); - noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0); - src_pixels_0 += d_chunk_size; - src_pixels_1 += d_chunk_size; - } - } - break; - case 1: // grey (Y) input - /* Y component */ - plane=0; - src_pixels_0 = (short *) input_items[plane]; - for (int i = 0; i < noutput_items; i += d_chunk_size){ - noutput_items_produced+=copy_plane_to_surface (plane,d_chunk_size, src_pixels_0); - src_pixels_0 += d_chunk_size; - } - break; - default: //0 or more then 3 channels - std::cerr << "video_sdl_sink_s: Wrong number of channels: "; - std::cerr <<"1, 2 or 3 channels are supported.\n Requested number of channels is "<< input_items.size () <<"\n"; - throw std::runtime_error ("video_sdl_sink_s"); - } - - SDL_UnlockYUVOverlay( d_image ); - return noutput_items_produced; -} diff --git a/gr-video-sdl/src/video_sdl_sink_s.h b/gr-video-sdl/src/video_sdl_sink_s.h deleted file mode 100644 index 64f5b5a6c..000000000 --- a/gr-video-sdl/src/video_sdl_sink_s.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_VIDEO_SDL_SINK_S_H -#define INCLUDED_VIDEO_SDL_SINK_S_H - -#include <video_sdl_api.h> -#include <gr_sync_block.h> -#include <string> -#include <SDL.h> - -/* fourcc (four character code) */ -#define vid_fourcc(a,b,c,d) (((unsigned)(a)<<0) | ((unsigned)(b)<<8) | ((unsigned)(c)<<16) | ((unsigned)(d)<<24)) -#define IMGFMT_YV12 vid_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ - -class video_sdl_sink_s; -typedef boost::shared_ptr<video_sdl_sink_s> video_sdl_sink_s_sptr; - -VIDEO_SDL_API video_sdl_sink_s_sptr -video_sdl_make_sink_s (double framerate,int width=640, int height=480,unsigned int format=IMGFMT_YV12,int dst_width=-1,int dst_height=-1); - -/*! - * \brief video sink using SDL - * - * input signature is one, two or three streams of signed short. - * One stream: stream is grey (Y) - * two streems: first is grey (Y), second is alternating U and V - * Three streams: first is grey (Y), second is U, third is V - * Input samples must be in the range [0,255]. - */ - -class VIDEO_SDL_API video_sdl_sink_s : public gr_sync_block { - friend VIDEO_SDL_API video_sdl_sink_s_sptr - video_sdl_make_sink_s (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height); - - int d_chunk_size; - - protected: - video_sdl_sink_s (double framerate,int width, int height,unsigned int format, - int dst_width,int dst_height); - void copy_line_pixel_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v, - const short * src_pixels,int src_width); - void copy_line_line_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v, - const short * src_pixels,int src_width); - void copy_line_single_plane(unsigned char *dst_pixels,const short * src_pixels,int src_width); - void copy_line_single_plane_dec2(unsigned char *dst_pixels,const short * src_pixels,int src_width); - int copy_plane_to_surface (int plane,int noutput_items, - const short * src_pixels); - float d_framerate; - int d_wanted_frametime_ms; - int d_width; - int d_height; - int d_dst_width; - int d_dst_height; - int d_format; - int d_current_line; - SDL_Surface *d_screen; - SDL_Overlay *d_image; - SDL_Rect d_dst_rect; - float d_avg_delay; - unsigned int d_wanted_ticks; - - - public: - ~video_sdl_sink_s (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VIDEO_SDL_SINK_S_H */ diff --git a/gr-video-sdl/src/video_sdl_sink_uc.cc b/gr-video-sdl/src/video_sdl_sink_uc.cc deleted file mode 100644 index 360df1109..000000000 --- a/gr-video-sdl/src/video_sdl_sink_uc.cc +++ /dev/null @@ -1,291 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <SDL.h> - -#include <video_sdl_sink_uc.h> -#include <gr_io_signature.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdio.h> -#include <iostream> -#include <stdexcept> -#include <string.h> - - - -video_sdl_sink_uc::video_sdl_sink_uc (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height) - : gr_sync_block ("video_sdl_sink_uc", - gr_make_io_signature (1, 3, sizeof (unsigned char)), - gr_make_io_signature (0, 0, 0)), - d_chunk_size (width*height), - d_framerate(framerate), - d_wanted_frametime_ms(0), - d_width(width), - d_height (height), - d_dst_width(dst_width), - d_dst_height(dst_height), - d_format(format), - d_current_line(0), - d_screen(NULL), - d_image(NULL), - d_avg_delay(0.0), - d_wanted_ticks(0) -{ - if(framerate<=0.0) - d_wanted_frametime_ms=0;//Go as fast as possible - else - d_wanted_frametime_ms=(int)(1000.0/framerate); - if(dst_width<0) d_dst_width=d_width; - if(dst_height<0) d_dst_height=d_height; - if(0==format) d_format=IMGFMT_YV12; - - atexit(SDL_Quit);//check if this is the way to do this - if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { - std::cerr << "video_sdl_sink_uc: Couldn't initialize SDL:" << SDL_GetError() << " \n SDL_Init(SDL_INIT_VIDEO) failed\n"; - throw std::runtime_error ("video_sdl_sink_uc"); - }; - - /* accept any depth */ - d_screen = SDL_SetVideoMode(dst_width, dst_height, 0, SDL_SWSURFACE|SDL_RESIZABLE|SDL_ANYFORMAT);//SDL_DOUBLEBUF |SDL_SWSURFACE| SDL_HWSURFACE||SDL_FULLSCREEN - if ( d_screen == NULL ) { - std::cerr << "Unable to set SDL video mode: " << SDL_GetError() <<"\n SDL_SetVideoMode() Failed \n"; - exit(1); - } - if ( d_image ) { - SDL_FreeYUVOverlay(d_image); - } - /* Initialize and create the YUV Overlay used for video out */ - if (!(d_image = SDL_CreateYUVOverlay (d_width, d_height, SDL_YV12_OVERLAY, d_screen))) { - std::cerr << "SDL: Couldn't create a YUV overlay: \n"<< SDL_GetError() <<"\n"; - throw std::runtime_error ("video_sdl_sink_uc"); - } - - printf("SDL screen_mode %d bits-per-pixel\n", - d_screen->format->BitsPerPixel); - printf("SDL overlay_mode %i \n", - d_image->format); - d_chunk_size = std::min(1,16384/width); //width*16; - d_chunk_size = d_chunk_size*width; - //d_chunk_size = (int) (width); - set_output_multiple (d_chunk_size); - /* Set the default playback area */ - d_dst_rect.x = 0; - d_dst_rect.y = 0; - d_dst_rect.w = d_dst_width; - d_dst_rect.h = d_dst_height; - //clear the surface to grey - if ( SDL_LockYUVOverlay( d_image ) ) { - std::cerr << "SDL: Couldn't lock YUV overlay: \n"<< SDL_GetError() <<"\n"; - throw std::runtime_error ("video_sdl_sink_uc"); - } - memset(d_image->pixels[0], 128, d_image->pitches[0]*d_height); - memset(d_image->pixels[1], 128, d_image->pitches[1]*d_height/2); - memset(d_image->pixels[2], 128, d_image->pitches[2]*d_height/2); - SDL_UnlockYUVOverlay( d_image ); -} - -video_sdl_sink_uc::~video_sdl_sink_uc () -{ - SDL_Quit(); -} - -video_sdl_sink_uc_sptr -video_sdl_make_sink_uc (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height) -{ - return gnuradio::get_initial_sptr(new video_sdl_sink_uc (framerate, width, height,format,dst_width,dst_height)); -} - -void -video_sdl_sink_uc::copy_line_pixel_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,const unsigned char * src_pixels,int src_width) -{ - for(int i=0;i<src_width;i++) - { - dst_pixels_u[i]=src_pixels[i*2]; - dst_pixels_v[i]=src_pixels[i*2+1]; - } - return; -} - -void -video_sdl_sink_uc::copy_line_line_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,const unsigned char * src_pixels,int src_width) -{ - memcpy(dst_pixels_u, src_pixels, src_width); - memcpy(dst_pixels_v, src_pixels+src_width, src_width); - return; -} - -void -video_sdl_sink_uc::copy_line_single_plane(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width) -{ - memcpy(dst_pixels, src_pixels, src_width); - return; -} - -void -video_sdl_sink_uc::copy_line_single_plane_dec2(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width) -{ - for(int i=0,j=0;i<src_width;i+=2,j++) - { - dst_pixels[j]=(unsigned char)src_pixels[i]; - } - return; -} - -int -video_sdl_sink_uc::copy_plane_to_surface (int plane,int noutput_items, - const unsigned char * src_pixels) -{ - const int first_dst_plane=(12==plane ||1122==plane)?1:plane; - const int second_dst_plane=(12==plane ||1122==plane)?2:plane; - int current_line=(0==plane)?d_current_line:d_current_line/2; - unsigned char * dst_pixels = (unsigned char *)d_image->pixels[first_dst_plane]; - dst_pixels=&dst_pixels[current_line*d_image->pitches[first_dst_plane]]; - unsigned char * dst_pixels_2 = (unsigned char *)d_image->pixels[second_dst_plane]; - dst_pixels_2=&dst_pixels_2[current_line*d_image->pitches[second_dst_plane]]; - int src_width=(0==plane || 12==plane || 1122==plane)?d_width:d_width/2; - int noutput_items_produced=0; - int max_height=(0==plane)?d_height-1:d_height/2-1; - for (int i = 0; i < noutput_items; i += src_width){ - //output one line at a time - if(12==plane) - { - copy_line_pixel_interleaved(dst_pixels,dst_pixels_2,src_pixels,src_width); - dst_pixels_2 += d_image->pitches[second_dst_plane]; - } - else if (1122==plane) - { - copy_line_line_interleaved(dst_pixels,dst_pixels_2,src_pixels,src_width); - dst_pixels_2 += d_image->pitches[second_dst_plane]; - src_pixels += src_width; - } - else if (0==plane) - copy_line_single_plane(dst_pixels,src_pixels,src_width); - else /* 1==plane || 2==plane*/ - copy_line_single_plane_dec2(dst_pixels,src_pixels,src_width);//decimate by two horizontally - src_pixels += src_width; - dst_pixels += d_image->pitches[first_dst_plane]; - noutput_items_produced+=src_width; - current_line++; - if (current_line>max_height) - { - //Start new frame - //TODO, do this all in a seperate thread - current_line=0; - dst_pixels=d_image->pixels[first_dst_plane]; - dst_pixels_2=d_image->pixels[second_dst_plane]; - if(0==plane) - { - SDL_DisplayYUVOverlay(d_image, &d_dst_rect); - //SDL_Flip(d_screen); - unsigned int ticks=SDL_GetTicks();//milliseconds - d_wanted_ticks+=d_wanted_frametime_ms; - float avg_alpha=0.1; - int time_diff=d_wanted_ticks-ticks; - d_avg_delay=time_diff*avg_alpha +d_avg_delay*(1.0-avg_alpha); - } - } - } - if(0==plane) d_current_line=current_line; - return noutput_items_produced; -} - -int -video_sdl_sink_uc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - unsigned char *src_pixels_0,*src_pixels_1,*src_pixels_2; - int noutput_items_produced=0; - int plane; - int delay=(int)d_avg_delay; - if(0==d_wanted_ticks) - d_wanted_ticks=SDL_GetTicks(); - if(delay>0) - SDL_Delay((unsigned int)delay);//compensate if running too fast - - if ( SDL_LockYUVOverlay( d_image ) ) { - return 0; - } - switch (input_items.size ()){ - case 3: // first channel=Y, second channel is U , third channel is V - src_pixels_0 = (unsigned char *) input_items[0]; - src_pixels_1 = (unsigned char *) input_items[1]; - src_pixels_2 = (unsigned char *) input_items[2]; - for (int i = 0; i < noutput_items; i += d_chunk_size){ - copy_plane_to_surface (1,d_chunk_size, src_pixels_1); - copy_plane_to_surface (2,d_chunk_size, src_pixels_2); - noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0); - src_pixels_0 += d_chunk_size; - src_pixels_1 += d_chunk_size; - src_pixels_2 += d_chunk_size; - } - break; - case 2: - if(1) //if(pixel_interleaved_uv) - { - // first channel=Y, second channel is alternating pixels U and V - src_pixels_0 = (unsigned char *) input_items[0]; - src_pixels_1 = (unsigned char *) input_items[1]; - for (int i = 0; i < noutput_items; i += d_chunk_size){ - copy_plane_to_surface (12,d_chunk_size/2, src_pixels_1); - noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0); - src_pixels_0 += d_chunk_size; - src_pixels_1 += d_chunk_size; - } - } else - { - // first channel=Y, second channel is alternating lines U and V - src_pixels_0 = (unsigned char *) input_items[0]; - src_pixels_1 = (unsigned char *) input_items[1]; - for (int i = 0; i < noutput_items; i += d_chunk_size){ - copy_plane_to_surface (1222,d_chunk_size/2, src_pixels_1); - noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0); - src_pixels_0 += d_chunk_size; - src_pixels_1 += d_chunk_size; - } - } - break; - case 1: // grey (Y) input - /* Y component */ - plane=0; - src_pixels_0 = (unsigned char *) input_items[plane]; - for (int i = 0; i < noutput_items; i += d_chunk_size){ - noutput_items_produced+=copy_plane_to_surface (plane,d_chunk_size, src_pixels_0); - src_pixels_0 += d_chunk_size; - } - break; - default: //0 or more then 3 channels - std::cerr << "video_sdl_sink_uc: Wrong number of channels: "; - std::cerr <<"1, 2 or 3 channels are supported.\n Requested number of channels is "<< input_items.size () <<"\n"; - throw std::runtime_error ("video_sdl_sink_uc"); - } - - SDL_UnlockYUVOverlay( d_image ); - return noutput_items_produced; -} diff --git a/gr-video-sdl/src/video_sdl_sink_uc.h b/gr-video-sdl/src/video_sdl_sink_uc.h deleted file mode 100644 index 6c071cf9d..000000000 --- a/gr-video-sdl/src/video_sdl_sink_uc.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 INCLUDED_VIDEO_SDL_SINK_UC_H -#define INCLUDED_VIDEO_SDL_SINK_UC_H - -#include <video_sdl_api.h> -#include <gr_sync_block.h> -#include <string> -#include <SDL.h> - -/* fourcc (four character code) */ -#define vid_fourcc(a,b,c,d) (((unsigned)(a)<<0) | ((unsigned)(b)<<8) | ((unsigned)(c)<<16) | ((unsigned)(d)<<24)) -#define IMGFMT_YV12 vid_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ - -class video_sdl_sink_uc; -typedef boost::shared_ptr<video_sdl_sink_uc> video_sdl_sink_uc_sptr; - -VIDEO_SDL_API video_sdl_sink_uc_sptr -video_sdl_make_sink_uc (double framerate,int width=640, int height=480,unsigned int format=IMGFMT_YV12,int dst_width=-1,int dst_height=-1); - -/*! - * \brief video sink using SDL - * - * input signature is one, two or three streams of uchar. - * One stream: stream is grey (Y) - * two streems: first is grey (Y), second is alternating U and V - * Three streams: first is grey (Y), second is U, third is V - * Input samples must be in the range [0,255]. - */ - -class VIDEO_SDL_API video_sdl_sink_uc : public gr_sync_block { - friend VIDEO_SDL_API video_sdl_sink_uc_sptr - video_sdl_make_sink_uc (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height); - - int d_chunk_size; - - protected: - video_sdl_sink_uc (double framerate,int width, int height,unsigned int format, - int dst_width,int dst_height); - void copy_line_pixel_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v, - const unsigned char * src_pixels,int src_width); - void copy_line_line_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v, - const unsigned char * src_pixels,int src_width); - void copy_line_single_plane(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width); - void copy_line_single_plane_dec2(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width); - int copy_plane_to_surface (int plane,int noutput_items, - const unsigned char * src_pixels); - float d_framerate; - int d_wanted_frametime_ms; - int d_width; - int d_height; - int d_dst_width; - int d_dst_height; - int d_format; - int d_current_line; - SDL_Surface *d_screen; - SDL_Overlay *d_image; - SDL_Rect d_dst_rect; - float d_avg_delay; - unsigned int d_wanted_ticks; - - - public: - ~video_sdl_sink_uc (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VIDEO_SDL_SINK_UC_H */ diff --git a/gr-vocoder/CMakeLists.txt b/gr-vocoder/CMakeLists.txt deleted file mode 100644 index 235054db6..000000000 --- a/gr-vocoder/CMakeLists.txt +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) -GR_REGISTER_COMPONENT("gr-vocoder" ENABLE_GR_VOCODER - Boost_FOUND - ENABLE_GR_CORE -) - -GR_SET_GLOBAL(GR_VOCODER_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/include -) - -SET(GR_PKG_VOCODER_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/vocoder) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_VOCODER) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_VOCODER_DESCRIPTION "GNU Radio Vocoder Blocks") - -CPACK_COMPONENT("vocoder_runtime" - GROUP "Vocoder" - DISPLAY_NAME "Runtime" - DESCRIPTION "Dynamic link libraries" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("vocoder_devel" - GROUP "Vocoder" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("vocoder_python" - GROUP "Vocoder" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime" - DEPENDS "core_python;vocoder_runtime" -) - -CPACK_COMPONENT("vocoder_examples" - GROUP "Vocoder" - DISPLAY_NAME "Examples" - DESCRIPTION "Python examples for vocoder" - DEPENDS "vocoder_python" -) - -CPACK_COMPONENT("vocoder_swig" - GROUP "Vocoder" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;vocoder_python;vocoder_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(lib) -add_subdirectory(include) -add_subdirectory(doc) -if(ENABLE_PYTHON) - add_subdirectory(swig) - add_subdirectory(python) - add_subdirectory(grc) - add_subdirectory(examples) -endif(ENABLE_PYTHON) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-vocoder.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-vocoder.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-vocoder.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "vocoder_devel" -) - -endif(ENABLE_GR_VOCODER) diff --git a/gr-vocoder/doc/CMakeLists.txt b/gr-vocoder/doc/CMakeLists.txt deleted file mode 100644 index 570c504e3..000000000 --- a/gr-vocoder/doc/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2011 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. - -install( - FILES README.vocoder - DESTINATION ${GR_PKG_DOC_DIR} -) diff --git a/gr-vocoder/doc/README.vocoder b/gr-vocoder/doc/README.vocoder deleted file mode 100644 index 2737063cc..000000000 --- a/gr-vocoder/doc/README.vocoder +++ /dev/null @@ -1,12 +0,0 @@ -This is the gr-vocoder package. This package includes the various -vocoder blocks in GNU Radio. To use the vocoder blocks, the Python -namespaces is in gnuradio.vocoder, which would be normally imported -as: - - from gnuradio import vocoder - -See the Doxygen documentation for details about the blocks available -in this package. A quick listing of the details can be found in Python -after importing by using: - - help(vocoder) diff --git a/gr-vocoder/doc/vocoder.dox b/gr-vocoder/doc/vocoder.dox deleted file mode 100644 index ff1c4b9dd..000000000 --- a/gr-vocoder/doc/vocoder.dox +++ /dev/null @@ -1,24 +0,0 @@ -/*! \page page_vocoder Voice Coders and Decoders (Vocoders) - -\section Introduction - -This is the gr-vocoder package. It contains all available vocoders in -GNU Radio. The Python namespaces is in gnuradio.vocoder, which would be -normally imported as: - -\code - from gnuradio import vocoder -\endcode - -See the Doxygen documentation for details about the blocks available -in this package. The relevant blocks are listed in the \ref -vocoder_blk group. - -A quick listing of the details can be found in Python after importing -by using: - -\code - help(vocoder) -\endcode - -*/ diff --git a/gr-vocoder/examples/CMakeLists.txt b/gr-vocoder/examples/CMakeLists.txt deleted file mode 100644 index 769ddf602..000000000 --- a/gr-vocoder/examples/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Install Examples -######################################################################## -include(GrPython) - -GR_PYTHON_INSTALL( - PROGRAMS - alaw_audio_loopback.py - codec2_audio_loopback.py - cvsd_audio_loopback.py - g721_audio_loopback.py - g723_24_audio_loopback.py - g723_40_audio_loopback.py - gsm_audio_loopback.py - ulaw_audio_loopback.py - DESTINATION ${GR_PKG_VOCODER_EXAMPLES_DIR} - COMPONENT "vocoder_examples" -) diff --git a/gr-vocoder/examples/alaw_audio_loopback.py b/gr-vocoder/examples/alaw_audio_loopback.py deleted file mode 100755 index ad686244b..000000000 --- a/gr-vocoder/examples/alaw_audio_loopback.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio import vocoder - -def build_graph(): - tb = gr.top_block() - src = audio.source(8000) - src_scale = gr.multiply_const_ff(32767) - f2s = gr.float_to_short () - enc = vocoder.alaw_encode_sb() - dec = vocoder.alaw_decode_bs() - s2f = gr.short_to_float () - sink_scale = gr.multiply_const_ff(1.0/32767.) - sink = audio.sink(8000) - tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) - return tb - -if __name__ == '__main__': - tb = build_graph() - tb.start() - raw_input ('Press Enter to exit: ') - tb.stop() - tb.wait() diff --git a/gr-vocoder/examples/codec2_audio_loopback.py b/gr-vocoder/examples/codec2_audio_loopback.py deleted file mode 100755 index f5da9c217..000000000 --- a/gr-vocoder/examples/codec2_audio_loopback.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2007,2011 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio import vocoder - -def build_graph(): - tb = gr.top_block() - src = audio.source(8000) - src_scale = gr.multiply_const_ff(32767) - f2s = gr.float_to_short () - enc = vocoder.codec2_encode_sp() - dec = vocoder.codec2_decode_ps() - s2f = gr.short_to_float () - sink_scale = gr.multiply_const_ff(1.0/32767.) - sink = audio.sink(8000) - tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) - return tb - -if __name__ == '__main__': - tb = build_graph() - tb.start() - raw_input ('Press Enter to exit: ') - tb.stop() - tb.wait() diff --git a/gr-vocoder/examples/cvsd_audio_loopback.py b/gr-vocoder/examples/cvsd_audio_loopback.py deleted file mode 100755 index f101fecb4..000000000 --- a/gr-vocoder/examples/cvsd_audio_loopback.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2011 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. -# - -from gnuradio import gr, blks2 -from gnuradio import audio -from gnuradio import vocoder - -def build_graph(): - sample_rate = 8000 - scale_factor = 32000 - - tb = gr.top_block() - src = audio.source(sample_rate, "plughw:0,0") - src_scale = gr.multiply_const_ff(scale_factor) - - interp = blks2.rational_resampler_fff(8, 1) - f2s = gr.float_to_short () - - enc = vocoder.cvsd_encode_sb() - dec = vocoder.cvsd_decode_bs() - - s2f = gr.short_to_float () - decim = blks2.rational_resampler_fff(1, 8) - - sink_scale = gr.multiply_const_ff(1.0/scale_factor) - sink = audio.sink(sample_rate, "plughw:0,0") - - tb.connect(src, src_scale, interp, f2s, enc) - tb.connect(enc, dec, s2f, decim, sink_scale, sink) - - if 0: # debug - tb.conect(src, gr.file_sink(gr.sizeof_float, "source.dat")) - tb.conect(src_scale, gr.file_sink(gr.sizeof_float, "src_scale.dat")) - tb.conect(interp, gr.file_sink(gr.sizeof_float, "interp.dat")) - tb.conect(f2s, gr.file_sink(gr.sizeof_short, "f2s.dat")) - tb.conect(enc, gr.file_sink(gr.sizeof_char, "enc.dat")) - tb.conect(dec, gr.file_sink(gr.sizeof_short, "dec.dat")) - tb.conect(s2f, gr.file_sink(gr.sizeof_float, "s2f.dat")) - tb.conect(decim, gr.file_sink(gr.sizeof_float, "decim.dat")) - tb.conect(sink_scale, gr.file_sink(gr.sizeof_float, "sink_scale.dat")) - - return tb - -if __name__ == '__main__': - tb = build_graph() - tb.start() - raw_input ('Press Enter to exit: ') - tb.stop() - tb.wait() diff --git a/gr-vocoder/examples/g721_audio_loopback.py b/gr-vocoder/examples/g721_audio_loopback.py deleted file mode 100755 index 339ea79ad..000000000 --- a/gr-vocoder/examples/g721_audio_loopback.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio import vocoder - -def build_graph(): - tb = gr.top_block() - src = audio.source(8000) - src_scale = gr.multiply_const_ff(32767) - f2s = gr.float_to_short () - enc = vocoder.g721_encode_sb() - dec = vocoder.g721_decode_bs() - s2f = gr.short_to_float () - sink_scale = gr.multiply_const_ff(1.0/32767.) - sink = audio.sink(8000) - tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) - return tb - -if __name__ == '__main__': - tb = build_graph() - tb.start() - raw_input ('Press Enter to exit: ') - tb.stop() - tb.wait() diff --git a/gr-vocoder/examples/g723_24_audio_loopback.py b/gr-vocoder/examples/g723_24_audio_loopback.py deleted file mode 100755 index 34d9ddd5d..000000000 --- a/gr-vocoder/examples/g723_24_audio_loopback.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio import vocoder - -def build_graph(): - tb = gr.top_block() - src = audio.source(8000) - src_scale = gr.multiply_const_ff(32767) - f2s = gr.float_to_short () - enc = vocoder.g723_24_encode_sb() - dec = vocoder.g723_24_decode_bs() - s2f = gr.short_to_float () - sink_scale = gr.multiply_const_ff(1.0/32767.) - sink = audio.sink(8000) - tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) - return tb - -if __name__ == '__main__': - tb = build_graph() - tb.start() - raw_input ('Press Enter to exit: ') - tb.stop() - tb.wait() diff --git a/gr-vocoder/examples/g723_40_audio_loopback.py b/gr-vocoder/examples/g723_40_audio_loopback.py deleted file mode 100755 index c636d82d1..000000000 --- a/gr-vocoder/examples/g723_40_audio_loopback.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio import vocoder - -def build_graph(): - tb = gr.top_block() - src = audio.source(8000) - src_scale = gr.multiply_const_ff(32767) - f2s = gr.float_to_short () - enc = vocoder.g723_40_encode_sb() - dec = vocoder.g723_40_decode_bs() - s2f = gr.short_to_float () - sink_scale = gr.multiply_const_ff(1.0/32767.) - sink = audio.sink(8000) - tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) - return tb - -if __name__ == '__main__': - tb = build_graph() - tb.start() - raw_input ('Press Enter to exit: ') - tb.stop() - tb.wait() diff --git a/gr-vocoder/examples/gsm_audio_loopback.py b/gr-vocoder/examples/gsm_audio_loopback.py deleted file mode 100755 index ba0fcb847..000000000 --- a/gr-vocoder/examples/gsm_audio_loopback.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2007,2011 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio import vocoder - -def build_graph(): - tb = gr.top_block() - src = audio.source(8000) - src_scale = gr.multiply_const_ff(32767) - f2s = gr.float_to_short () - enc = vocoder.gsm_fr_encode_sp() - dec = vocoder.gsm_fr_decode_ps() - s2f = gr.short_to_float () - sink_scale = gr.multiply_const_ff(1.0/32767.) - sink = audio.sink(8000) - tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) - return tb - -if __name__ == '__main__': - tb = build_graph() - tb.start() - raw_input ('Press Enter to exit: ') - tb.stop() - tb.wait() diff --git a/gr-vocoder/examples/ulaw_audio_loopback.py b/gr-vocoder/examples/ulaw_audio_loopback.py deleted file mode 100755 index e7a96d367..000000000 --- a/gr-vocoder/examples/ulaw_audio_loopback.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr -from gnuradio import audio -from gnuradio import vocoder - -def build_graph(): - tb = gr.top_block() - src = audio.source(8000) - src_scale = gr.multiply_const_ff(32767) - f2s = gr.float_to_short () - enc = vocoder.ulaw_encode_sb() - dec = vocoder.ulaw_decode_bs() - s2f = gr.short_to_float () - sink_scale = gr.multiply_const_ff(1.0/32767.) - sink = audio.sink(8000) - tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) - return tb - -if __name__ == '__main__': - tb = build_graph() - tb.start() - raw_input ('Press Enter to exit: ') - tb.stop() - tb.wait() diff --git a/gr-vocoder/gnuradio-vocoder.pc.in b/gr-vocoder/gnuradio-vocoder.pc.in deleted file mode 100644 index 7ff4420b6..000000000 --- a/gr-vocoder/gnuradio-vocoder.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-vocoder -Description: GNU Radio blocks implementing voice codecs -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-vocoder -Cflags: -I${includedir} diff --git a/gr-vocoder/grc/CMakeLists.txt b/gr-vocoder/grc/CMakeLists.txt deleted file mode 100644 index f8cf8231b..000000000 --- a/gr-vocoder/grc/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2011 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. - -install(FILES - vocoder_alaw_decode_bs.xml - vocoder_alaw_encode_sb.xml - vocoder_block_tree.xml - vocoder_codec2_decode_ps.xml - vocoder_codec2_encode_sp.xml - vocoder_cvsd_decode_bs.xml - vocoder_cvsd_decode.xml - vocoder_cvsd_encode_sb.xml - vocoder_cvsd_encode.xml - vocoder_g721_decode_bs.xml - vocoder_g721_encode_sb.xml - vocoder_g723_24_decode_bs.xml - vocoder_g723_24_encode_sb.xml - vocoder_g723_40_decode_bs.xml - vocoder_g723_40_encode_sb.xml - vocoder_gsm_fr_decode_ps.xml - vocoder_gsm_fr_encode_sp.xml - vocoder_ulaw_decode_bs.xml - vocoder_ulaw_encode_sb.xml - DESTINATION ${GRC_BLOCKS_DIR} - COMPONENT "vocoder_python" -) diff --git a/gr-vocoder/grc/vocoder_alaw_decode_bs.xml b/gr-vocoder/grc/vocoder_alaw_decode_bs.xml deleted file mode 100644 index 776187d4d..000000000 --- a/gr-vocoder/grc/vocoder_alaw_decode_bs.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Alaw audio decoder -################################################### - --> -<block> - <name>Alaw Audio Decoder</name> - <key>vocoder_alaw_decode_bs</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.alaw_decode_bs()</make> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>short</type> - </source> -</block> diff --git a/gr-vocoder/grc/vocoder_alaw_encode_sb.xml b/gr-vocoder/grc/vocoder_alaw_encode_sb.xml deleted file mode 100644 index 0ad8eca12..000000000 --- a/gr-vocoder/grc/vocoder_alaw_encode_sb.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Alaw audio encoder -################################################### - --> -<block> - <name>g711 alaw Audio Encoder</name> - <key>vocoder_alaw_encode_sb</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.alaw_encode_sb()</make> - <sink> - <name>in</name> - <type>short</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> - - diff --git a/gr-vocoder/grc/vocoder_block_tree.xml b/gr-vocoder/grc/vocoder_block_tree.xml deleted file mode 100644 index ed3338d44..000000000 --- a/gr-vocoder/grc/vocoder_block_tree.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0"?> - -<!-- - Copyright 2011 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. ---> - -<!-- -################################################### -##Block Tree for GR Digital blocks. -################################################### - --> -<cat> - <name></name> <!-- Blank for Root Name --> - <cat> - <name>Vocoders</name> - <block>vocoder_alaw_decode_bs</block> - <block>vocoder_alaw_encode_sb</block> - <block>vocoder_codec2_decode_ps</block> - <block>vocoder_codec2_encode_sp</block> - <block>vocoder_cvsd_decode_bs</block> - <block>vocoder_cvsd_encode_sb</block> - <block>vocoder_cvsd_decode_bf</block> - <block>vocoder_cvsd_encode_fb</block> - <block>vocoder_g721_decode_bs</block> - <block>vocoder_g721_encode_sb</block> - <block>vocoder_g723_24_decode_bs</block> - <block>vocoder_g723_24_encode_sb</block> - <block>vocoder_g723_40_decode_bs</block> - <block>vocoder_g723_40_encode_sb</block> - <block>vocoder_gsm_fr_decode_ps</block> - <block>vocoder_gsm_fr_encode_sp</block> - <block>vocoder_ulaw_decode_bs</block> - <block>vocoder_ulaw_encode_sb</block> - </cat> -</cat> diff --git a/gr-vocoder/grc/vocoder_codec2_decode_ps.xml b/gr-vocoder/grc/vocoder_codec2_decode_ps.xml deleted file mode 100644 index 708882151..000000000 --- a/gr-vocoder/grc/vocoder_codec2_decode_ps.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## CODEC2 audio decoder -################################################### - --> -<block> - <name>CODEC2 Audio Decoder</name> - <key>vocoder_codec2_decode_ps</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.codec2_decode_ps()</make> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>short</type> - </source> -</block> diff --git a/gr-vocoder/grc/vocoder_codec2_encode_sp.xml b/gr-vocoder/grc/vocoder_codec2_encode_sp.xml deleted file mode 100644 index 7a56ac633..000000000 --- a/gr-vocoder/grc/vocoder_codec2_encode_sp.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## CODEC2 audio encoder -################################################### - --> -<block> - <name>CODEC2 Audio Encoder</name> - <key>vocoder_codec2_encode_sp</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.codec2_encode_sp()</make> - <sink> - <name>in</name> - <type>short</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> - - diff --git a/gr-vocoder/grc/vocoder_cvsd_decode.xml b/gr-vocoder/grc/vocoder_cvsd_decode.xml deleted file mode 100644 index ce117c5d4..000000000 --- a/gr-vocoder/grc/vocoder_cvsd_decode.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## CVSD Encoder -################################################### - --> -<block> - <name>CVSD Decoder</name> - <key>vocoder_cvsd_decode_bf</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.cvsd_decode_bf($resample,$bw)</make> - <param> - <name>Resample</name> - <key>resample</key> - <value>8</value> - <type>int</type> - </param> - <param> - <name>Frac. Bandwidth</name> - <key>bw</key> - <value>0.5</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> -</block> diff --git a/gr-vocoder/grc/vocoder_cvsd_decode_bs.xml b/gr-vocoder/grc/vocoder_cvsd_decode_bs.xml deleted file mode 100644 index 40ddc04d4..000000000 --- a/gr-vocoder/grc/vocoder_cvsd_decode_bs.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## CVSD audio decoder -################################################### - --> -<block> - <name>CVSD Audio Decoder (Raw Bit-Level)</name> - <key>vocoder_cvsd_decode_bs</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.cvsd_decode_bs()</make> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>short</type> - </source> -</block> - diff --git a/gr-vocoder/grc/vocoder_cvsd_encode.xml b/gr-vocoder/grc/vocoder_cvsd_encode.xml deleted file mode 100644 index 12e73f602..000000000 --- a/gr-vocoder/grc/vocoder_cvsd_encode.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## CVSD Encoder -################################################### - --> -<block> - <name>CVSD Encoder</name> - <key>vocoder_cvsd_encode_fb</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.cvsd_encode_fb($resample,$bw)</make> - <param> - <name>Resample</name> - <key>resample</key> - <value>8</value> - <type>int</type> - </param> - <param> - <name>Frac. Bandwidth</name> - <key>bw</key> - <value>0.5</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-vocoder/grc/vocoder_cvsd_encode_sb.xml b/gr-vocoder/grc/vocoder_cvsd_encode_sb.xml deleted file mode 100644 index a92387a60..000000000 --- a/gr-vocoder/grc/vocoder_cvsd_encode_sb.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## CVSD audio encoder -################################################### - --> -<block> - <name>CVSD Audio Encoder (Raw Bit-Level)</name> - <key>vocoder_cvsd_encode_sb</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.cvsd_encode_sb()</make> - <sink> - <name>in</name> - <type>short</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> - - diff --git a/gr-vocoder/grc/vocoder_g721_decode_bs.xml b/gr-vocoder/grc/vocoder_g721_decode_bs.xml deleted file mode 100644 index d5c0291b7..000000000 --- a/gr-vocoder/grc/vocoder_g721_decode_bs.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## g271 audio decoder -################################################### - --> -<block> - <name>g721 Audio Decoder</name> - <key>vocoder_g721_decode_bs</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.g721_decode_bs()</make> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>short</type> - </source> -</block> diff --git a/gr-vocoder/grc/vocoder_g721_encode_sb.xml b/gr-vocoder/grc/vocoder_g721_encode_sb.xml deleted file mode 100644 index f105ff8ff..000000000 --- a/gr-vocoder/grc/vocoder_g721_encode_sb.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## g721 audio encoder -################################################### - --> -<block> - <name>g721 Audio Encoder</name> - <key>vocoder_g721_encode_sb</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.g721_encode_sb()</make> - <sink> - <name>in</name> - <type>short</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> - - diff --git a/gr-vocoder/grc/vocoder_g723_24_decode_bs.xml b/gr-vocoder/grc/vocoder_g723_24_decode_bs.xml deleted file mode 100644 index 939a7f91b..000000000 --- a/gr-vocoder/grc/vocoder_g723_24_decode_bs.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## g723_24 audio decoder -################################################### - --> -<block> - <name>g723_24 Audio Decoder</name> - <key>vocoder_g723_24_decode_bs</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.g723_24_decode_bs()</make> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>short</type> - </source> -</block> diff --git a/gr-vocoder/grc/vocoder_g723_24_encode_sb.xml b/gr-vocoder/grc/vocoder_g723_24_encode_sb.xml deleted file mode 100644 index 0e70ddedc..000000000 --- a/gr-vocoder/grc/vocoder_g723_24_encode_sb.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## g723_24 audio encoder -################################################### - --> -<block> - <name>g723_24 Audio Encoder</name> - <key>vocoder_g723_24_encode_sb</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.g723_24_encode_sb()</make> - <sink> - <name>in</name> - <type>short</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> - - diff --git a/gr-vocoder/grc/vocoder_g723_40_decode_bs.xml b/gr-vocoder/grc/vocoder_g723_40_decode_bs.xml deleted file mode 100644 index f3ba56e5b..000000000 --- a/gr-vocoder/grc/vocoder_g723_40_decode_bs.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## g723_40 audio decoder -################################################### - --> -<block> - <name>g723_40 Audio Decoder</name> - <key>vocoder_g723_40_decode_bs</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.g723_40_decode_bs()</make> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>short</type> - </source> -</block> diff --git a/gr-vocoder/grc/vocoder_g723_40_encode_sb.xml b/gr-vocoder/grc/vocoder_g723_40_encode_sb.xml deleted file mode 100644 index fbbf600ff..000000000 --- a/gr-vocoder/grc/vocoder_g723_40_encode_sb.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## g723_40 audio encoder -################################################### - --> -<block> - <name>g723_40 Audio Encoder</name> - <key>vocoder_g723_40_encode_sb</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.g723_40_encode_sb()</make> - <sink> - <name>in</name> - <type>short</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> - - diff --git a/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml b/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml deleted file mode 100644 index 44290f891..000000000 --- a/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## GSM full-rate audio decoder -################################################### - --> -<block> - <name>GSM full-rate Audio Decoder</name> - <key>vocoder_gsm_fr_decode_ps</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.gsm_fr_decode_ps()</make> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>short</type> - </source> -</block> diff --git a/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml b/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml deleted file mode 100644 index 13f6f3f2d..000000000 --- a/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## GSM full-rate audio encoder -################################################### - --> -<block> - <name>GSM full-rate Audio Encoder</name> - <key>vocoder_gsm_fr_encode_sp</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.gsm_fr_encode_sp()</make> - <sink> - <name>in</name> - <type>short</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> - - diff --git a/gr-vocoder/grc/vocoder_ulaw_decode_bs.xml b/gr-vocoder/grc/vocoder_ulaw_decode_bs.xml deleted file mode 100644 index 5a7ccbb0e..000000000 --- a/gr-vocoder/grc/vocoder_ulaw_decode_bs.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Ulaw audio decoder -################################################### - --> -<block> - <name>Ulaw Audio Decoder</name> - <key>vocoder_ulaw_decode_bs</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.ulaw_decode_bs()</make> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>short</type> - </source> -</block> diff --git a/gr-vocoder/grc/vocoder_ulaw_encode_sb.xml b/gr-vocoder/grc/vocoder_ulaw_encode_sb.xml deleted file mode 100644 index 8e76d8d08..000000000 --- a/gr-vocoder/grc/vocoder_ulaw_encode_sb.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## ulaw audio encoder -################################################### - --> -<block> - <name>ulaw Audio Encoder</name> - <key>vocoder_ulaw_encode_sb</key> - <import>from gnuradio import vocoder</import> - <make>vocoder.ulaw_encode_sb()</make> - <sink> - <name>in</name> - <type>short</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> - - diff --git a/gr-vocoder/include/CMakeLists.txt b/gr-vocoder/include/CMakeLists.txt deleted file mode 100644 index 719e99355..000000000 --- a/gr-vocoder/include/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Install header files -######################################################################## -install(FILES - vocoder_api.h - vocoder_alaw_decode_bs.h - vocoder_alaw_encode_sb.h - vocoder_codec2_decode_ps.h - vocoder_codec2_encode_sp.h - vocoder_cvsd_decode_bs.h - vocoder_cvsd_encode_sb.h - vocoder_g721_decode_bs.h - vocoder_g721_encode_sb.h - vocoder_g723_24_decode_bs.h - vocoder_g723_24_encode_sb.h - vocoder_g723_40_decode_bs.h - vocoder_g723_40_encode_sb.h - vocoder_gsm_fr_decode_ps.h - vocoder_gsm_fr_encode_sp.h - vocoder_ulaw_decode_bs.h - vocoder_ulaw_encode_sb.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "vocoder_devel" -) diff --git a/gr-vocoder/include/vocoder_alaw_decode_bs.h b/gr-vocoder/include/vocoder_alaw_decode_bs.h deleted file mode 100644 index 083be2100..000000000 --- a/gr-vocoder/include/vocoder_alaw_decode_bs.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_VOCODER_ALAW_DECODE_BS_H -#define INCLUDED_VOCODER_ALAW_DECODE_BS_H - -#include <vocoder_api.h> -#include <gr_sync_block.h> - -class vocoder_alaw_decode_bs; - -typedef boost::shared_ptr<vocoder_alaw_decode_bs> vocoder_alaw_decode_bs_sptr; - -VOCODER_API vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); - -/*! - * \brief This block performs alaw audio decoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_alaw_decode_bs : public gr_sync_block -{ -private: - friend VOCODER_API vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); - - vocoder_alaw_decode_bs(); - - public: - ~vocoder_alaw_decode_bs(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_ALAW_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_alaw_encode_sb.h b/gr-vocoder/include/vocoder_alaw_encode_sb.h deleted file mode 100644 index c2609a95c..000000000 --- a/gr-vocoder/include/vocoder_alaw_encode_sb.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_VOCODER_ALAW_ENCODER_SB_H -#define INCLUDED_VOCODER_ALAW_ENCODER_SB_H - -#include <vocoder_api.h> -#include <gr_sync_block.h> - -class vocoder_alaw_encode_sb; - -typedef boost::shared_ptr<vocoder_alaw_encode_sb> vocoder_alaw_encode_sb_sptr; - -VOCODER_API vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); - -/*! - * \brief This block performs g.711 alaw audio encoding. - * - * \ingroup vocoder_blk - */ -class VOCODER_API vocoder_alaw_encode_sb : public gr_sync_block -{ -private: - friend VOCODER_API vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); - - vocoder_alaw_encode_sb(); - - public: - ~vocoder_alaw_encode_sb(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_ALAW_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_api.h b/gr-vocoder/include/vocoder_api.h deleted file mode 100644 index 331cf5d0b..000000000 --- a/gr-vocoder/include/vocoder_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2011 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 INCLUDED_VOCODER_API_H -#define INCLUDED_VOCODER_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_vocoder_EXPORTS -# define VOCODER_API __GR_ATTR_EXPORT -#else -# define VOCODER_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_VOCODER_API_H */ diff --git a/gr-vocoder/include/vocoder_codec2_decode_ps.h b/gr-vocoder/include/vocoder_codec2_decode_ps.h deleted file mode 100644 index 9ceef7921..000000000 --- a/gr-vocoder/include/vocoder_codec2_decode_ps.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_VOCODER_CODEC2_DECODE_PS_H -#define INCLUDED_VOCODER_CODEC2_DECODE_PS_H - -#include <vocoder_api.h> -#include <gr_sync_interpolator.h> - -class vocoder_codec2_decode_ps; -typedef boost::shared_ptr<vocoder_codec2_decode_ps> vocoder_codec2_decode_ps_sptr; - -VOCODER_API vocoder_codec2_decode_ps_sptr vocoder_make_codec2_decode_ps (); - -/*! - * \brief CODEC2 Vocoder Decoder - * \ingroup vocoder_blk - */ -class VOCODER_API vocoder_codec2_decode_ps : public gr_sync_interpolator { - void *d_codec2; - - friend VOCODER_API vocoder_codec2_decode_ps_sptr vocoder_make_codec2_decode_ps (); - vocoder_codec2_decode_ps (); - -public: - ~vocoder_codec2_decode_ps (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_CODEC2_DECODE_PS_H */ diff --git a/gr-vocoder/include/vocoder_codec2_encode_sp.h b/gr-vocoder/include/vocoder_codec2_encode_sp.h deleted file mode 100644 index c24aca1c4..000000000 --- a/gr-vocoder/include/vocoder_codec2_encode_sp.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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 INCLUDED_VOCODER_CODEC2_ENCODE_SP_H -#define INCLUDED_VOCODER_CODEC2_ENCODE_SP_H - -#include <vocoder_api.h> -#include <gr_sync_decimator.h> - -class vocoder_codec2_encode_sp; -typedef boost::shared_ptr<vocoder_codec2_encode_sp> vocoder_codec2_encode_sp_sptr; - -VOCODER_API vocoder_codec2_encode_sp_sptr vocoder_make_codec2_encode_sp (); - -/*! - * \brief CODEC2 Vocoder Encoder - * \ingroup vocoder_blk - */ -class VOCODER_API vocoder_codec2_encode_sp : public gr_sync_decimator { - void *d_codec2; - - friend VOCODER_API vocoder_codec2_encode_sp_sptr vocoder_make_codec2_encode_sp (); - vocoder_codec2_encode_sp (); - -public: - ~vocoder_codec2_encode_sp (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_CODEC2_ENCODE_SP_H */ diff --git a/gr-vocoder/include/vocoder_cvsd_decode_bs.h b/gr-vocoder/include/vocoder_cvsd_decode_bs.h deleted file mode 100644 index ebafeeb4e..000000000 --- a/gr-vocoder/include/vocoder_cvsd_decode_bs.h +++ /dev/null @@ -1,174 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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 INCLUDED_VOCODER_CVSD_DECODE_BS_H -#define INCLUDED_VOCODER_CVSD_DECODE_BS_H - -#include <vocoder_api.h> -#include <gr_sync_interpolator.h> - -class vocoder_cvsd_decode_bs; - -typedef boost::shared_ptr<vocoder_cvsd_decode_bs> vocoder_cvsd_decode_bs_sptr; - - /*! - * \brief Constructor parameters to initialize the CVSD decoder. The default - * values are modeled after the Bluetooth standard and should not be changed, - * except by an advanced user - * - * \ingroup vocoder_blk - * - * \param min_step Minimum step size used to update the internal reference. Default: "10" - * \param max_step Maximum step size used to update the internal reference. Default: "1280" - * \param step_decay Decay factor applied to step size when there is not a run of J output 1s or 0s. Default: "0.9990234375" (i.e. 1-1/1024) - * \param accum_decay Decay factor applied to the internal reference during every interation of the codec. Default: "0.96875" (i.e. 1-1/32) - * \param K; Size of shift register; the number of output bits remembered by codec (must be less or equal to 32). Default: "32" - * \param J; Number of bits in the shift register that are equal; i.e. the size of a run of 1s, 0s. Default: "4" - * \param pos_accum_max Maximum integer value allowed for the internal reference. Default: "32767" (2^15 - 1 or MAXSHORT) - * \param neg_accum_max Minimum integer value allowed for the internal reference. Default: "-32767" (-2^15 + 1 or MINSHORT+1) - * - */ -VOCODER_API vocoder_cvsd_decode_bs_sptr vocoder_make_cvsd_decode_bs (short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); - -/*! - * \brief This block performs CVSD audio decoding. Its design and implementation - * is modeled after the CVSD encoder/decoder specifications defined in the - * Bluetooth standard. - * - * \ingroup vocoder_blk - * - * CVSD is a method for encoding speech that seeks to reduce the - * bandwidth required for digital voice transmission. CVSD takes - * advantage of strong correlation between samples, quantizing the - * difference in amplitude between two consecutive samples. This - * difference requires fewer quantization levels as compared to other - * methods that quantize the actual amplitude level, reducing the - * bandwidth. CVSD employs a two level quantizer (one bit) and an - * adaptive algorithm that allows for continuous step size adjustment. - * - * The coder can represent low amplitude signals with accuracy without - * sacrificing performance on large amplitude signals, a trade off that - * occurs in some non-adaptive modulations. - * - * The CVSD decoder effectively provides 1-to-8 decompression. More - * specifically, for each incoming input bit, the decoder outputs one - * audio sample. If the input is a "1" bit, the internal reference is - * increased appropriately and then outputted as the next estimated audio - * sample. If the input is a "0" bit, the internal reference is - * decreased appropriately and then likewise outputted as the next estimated - * audio sample. Grouping 8 input bits together, the encoder essentially - * produces 8 output audio samples for everyone one input byte. - * - * This decoder requires that output audio samples are 2-byte short signed - * integers. The result bandwidth conversion, therefore, is 1 byte of - * encoded audio data to 16 output bytes of raw audio data. - * - * The CVSD decoder module must be post-fixed by a down-converter to - * under-sample the audio data after decoding. The Bluetooth standard - * specifically calls for a 8-to-1 decimating down-converter. This is - * required so that so that output sampling rate equals the original input - * sampling rate present before the encoder. In all cases, the output - * down-converter rate must be the inverse of the input up-converter rate - * before the CVSD encoder. - * - * References: - * 1. Continuously Variable Slope Delta Modulation (CVSD) A Tutorial, - * Available: http://www.eetkorea.com/ARTICLES/2003AUG/A/2003AUG29_NTEK_RFD_AN02.PDF. - * 2. Specification of The Bluetooth System - * Available: http://grouper.ieee.org/groups/802/15/Bluetooth/core_10_b.pdf. - * 3. McGarrity, S., Bluetooth Full Duplex Voice and Data Transmission. 2002. - * Bluetooth Voice Simulink® Model, Available: - * http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html - * - */ - -class VOCODER_API vocoder_cvsd_decode_bs : public gr_sync_interpolator -{ -private: - friend VOCODER_API vocoder_cvsd_decode_bs_sptr vocoder_make_cvsd_decode_bs (short min_step, - short max_step, - double step_decay, - double accum_decay, - int K, - int J, - short pos_accum_max, - short neg_accum_max); - - vocoder_cvsd_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); - - //! Member functions required by the encoder/decoder - //! \brief Rounding function specific to CVSD - //! \return the input value rounded to the nearest integer - int cvsd_round(double input); - - //! \brief A power function specific to CVSD data formats - //! \return (radix)^power, where radix and power are short integers - unsigned int cvsd_pow (short radix, short power); - - //! \brief Sums number of 1's in the input - //! \return the number of 1s in the four bytes of an input unsigned integer - unsigned char cvsd_bitwise_sum (unsigned int input); - - short d_min_step; - short d_max_step; - double d_step_decay; - double d_accum_decay; - - int d_K; //!< \brief Size of shift register; the number of output bits remembered in shift register - int d_J; //!< \brief Number of bits in the shift register that are equal; size of run of 1s, 0s - - short d_pos_accum_max; - short d_neg_accum_max; - - int d_accum; //!< \brief Current value of internal reference - int d_loop_counter; //!< \brief Current value of the loop counter - unsigned int d_runner; //!< \brief Current value of the shift register - unsigned int d_runner_mask; //!< \brief Value of the mask to access the last J bits of the shift register - short d_stepsize; //!< \brief Current value of the step sizer - - public: - ~vocoder_cvsd_decode_bs (); // public destructor - - short min_step() { return d_min_step; } - short max_step() { return d_max_step; } - double step_decay() { return d_step_decay; } - double accum_decay() { return d_accum_decay; } - int K() { return d_K; } - int J() { return d_J; } - short pos_accum_max() { return d_pos_accum_max; } - short neg_accum_max() { return d_neg_accum_max; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_CVSD_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_cvsd_encode_sb.h b/gr-vocoder/include/vocoder_cvsd_encode_sb.h deleted file mode 100644 index 876fd96de..000000000 --- a/gr-vocoder/include/vocoder_cvsd_encode_sb.h +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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 INCLUDED_VOCODER_CVSD_ENCODER_SB_H -#define INCLUDED_VOCODER_CVSD_ENCODER_SB_H - -#include <vocoder_api.h> -#include <gr_sync_decimator.h> - -class vocoder_cvsd_encode_sb; - -typedef boost::shared_ptr<vocoder_cvsd_encode_sb> vocoder_cvsd_encode_sb_sptr; - - /*! - * \brief Constructor parameters to initialize the CVSD encoder. The - * default values are modeled after the Bluetooth standard and should - * not be changed except by an advanced user - * - * \ingroup vocoder_blk - * - * \param min_step Minimum step size used to update the internal reference. Default: "10" - * \param max_step Maximum step size used to update the internal reference. Default: "1280" - * \param step_decay Decay factor applied to step size when there is not a run of J output 1s or 0s. Default: "0.9990234375" (i.e. 1-1/1024) - * \param accum_decay Decay factor applied to the internal reference during every interation of the codec. Default: "0.96875" (i.e. 1-1/32) - * \param K; Size of shift register; the number of output bits remembered by codec (must be less or equal to 32). Default: "32" - * \param J; Number of bits in the shift register that are equal; i.e. the size of a run of 1s, 0s. Default: "4" - * \param pos_accum_max Maximum integer value allowed for the internal reference. Default: "32767" (2^15 - 1 or MAXSHORT) - * \param neg_accum_max Minimum integer value allowed for the internal reference. Default: "-32767" (-2^15 + 1 or MINSHORT+1) - * - */ - -VOCODER_API vocoder_cvsd_encode_sb_sptr vocoder_make_cvsd_encode_sb(short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); - -/*! - * \brief This block performs CVSD audio encoding. Its design and implementation - * is modeled after the CVSD encoder/decoder specifications defined in the - * Bluetooth standard. - * - * \ingroup vocoder_blk - * - * CVSD is a method for encoding speech that seeks to reduce the - * bandwidth required for digital voice transmission. CVSD takes - * advantage of strong correlation between samples, quantizing the - * difference in amplitude between two consecutive samples. This - * difference requires fewer quantization levels as compared to other - * methods that quantize the actual amplitude level, reducing the - * bandwidth. CVSD employs a two level quantizer (one bit) and an - * adaptive algorithm that allows for continuous step size adjustment. - * - * The coder can represent low amplitude signals with accuracy without - * sacrificing performance on large amplitude signals, a trade off that - * occurs in some non-adaptive modulations. - * - * The CVSD encoder effectively provides 8-to-1 compression. More - * specifically, each incoming audio sample is compared to an internal - * reference value. If the input is greater or equal to the reference, - * the encoder outputs a "1" bit. If the input is less than the reference, - * the encoder outputs a "0" bit. The reference value is then updated - * accordingly based on the frequency of outputted "1" or "0" bits. By - * grouping 8 outputs bits together, the encoder essentially produce one - * output byte for every 8 input audio samples. - * - * This encoder requires that input audio samples are 2-byte short signed - * integers. The result bandwidth conversion, therefore, is 16 input bytes - * of raw audio data to 1 output byte of encoded audio data. - * - * The CVSD encoder module must be prefixed by an up-converter to over-sample - * the audio data prior to encoding. The Bluetooth standard specifically - * calls for a 1-to-8 interpolating up-converter. While this reduces the - * overall compression of the codec, this is required so that the encoder - * can accurately compute the slope between adjacent audio samples and - * correctly update its internal reference value. - * - * References: - * - * 1. Continuously Variable Slope Delta Modulation (CVSD) A Tutorial, - * Available: http://www.eetkorea.com/ARTICLES/2003AUG/A/2003AUG29_NTEK_RFD_AN02.PDF. - * - * 2. Specification of The Bluetooth System - * Available: http://grouper.ieee.org/groups/802/15/Bluetooth/core_10_b.pdf. - * - * 3. McGarrity, S., Bluetooth Full Duplex Voice and Data Transmission. 2002. - * Bluetooth Voice Simulink® Model, Available: - * http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html - * - */ - -class VOCODER_API vocoder_cvsd_encode_sb : public gr_sync_decimator -{ -private: - friend VOCODER_API vocoder_cvsd_encode_sb_sptr vocoder_make_cvsd_encode_sb(short min_step, - short max_step, - double step_decay, - double accum_decay, - int K, - int J, - short pos_accum_max, - short neg_accum_max); - - vocoder_cvsd_encode_sb(short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); - - //! Member functions required by the encoder/decoder - //! \brief Rounding function specific to CVSD - //! \return the input value rounded to the nearest integer - int cvsd_round(double input); - - //! \brief A power function specific to CVSD data formats - //! \return (radix)^power, where radix and power are short integers - unsigned int cvsd_pow (short radix, short power); - - //! \brief Sums number of 1's in the input - //! \return the number of 1s in the four bytes of an input unsigned integer - unsigned char cvsd_bitwise_sum (unsigned int input); - - // Members variables related to the CVSD encoder use to update interal reference value - short d_min_step; - short d_max_step; - double d_step_decay; - double d_accum_decay; - - int d_K; //!< \brief Size of shift register; the number of output bits remembered in shift register - int d_J; //!< \brief Number of bits in the shift register that are equal; size of run of 1s, 0s - - short d_pos_accum_max; - short d_neg_accum_max; - - int d_accum; //!< \brief Current value of internal reference - int d_loop_counter; //!< \brief Current value of the loop counter - unsigned int d_runner; //!< \brief Current value of the shift register - short d_stepsize; //!< \brief Current value of the step sizer - - public: - ~vocoder_cvsd_encode_sb (); // public destructor - - short min_step() { return d_min_step; } - short max_step() { return d_max_step; } - double step_decay() { return d_step_decay; } - double accum_decay() { return d_accum_decay; } - int K() { return d_K; } - int J() { return d_J; } - short pos_accum_max() { return d_pos_accum_max; } - short neg_accum_max() { return d_neg_accum_max; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_CVSD_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_g721_decode_bs.h b/gr-vocoder/include/vocoder_g721_decode_bs.h deleted file mode 100644 index 61a386ffc..000000000 --- a/gr-vocoder/include/vocoder_g721_decode_bs.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_VOCODER_G721_DECODE_BS_H -#define INCLUDED_VOCODER_G721_DECODE_BS_H - -#include <vocoder_api.h> -#include <gr_sync_block.h> - -class vocoder_g721_decode_bs; - -typedef boost::shared_ptr<vocoder_g721_decode_bs> vocoder_g721_decode_bs_sptr; - -VOCODER_API vocoder_g721_decode_bs_sptr vocoder_make_g721_decode_bs(); - -/*! - * \brief This block performs g721 audio decoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g721_decode_bs : virtual public gr_sync_block -{ -}; - -#endif /* INCLUDED_VOCODER_G721_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_g721_encode_sb.h b/gr-vocoder/include/vocoder_g721_encode_sb.h deleted file mode 100644 index 694da92d6..000000000 --- a/gr-vocoder/include/vocoder_g721_encode_sb.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_VOCODER_G721_ENCODE_SB_H -#define INCLUDED_VOCODER_G721_ENCODE_SB_H - -#include <vocoder_api.h> -#include <gr_sync_block.h> - -class vocoder_g721_encode_sb; - -typedef boost::shared_ptr<vocoder_g721_encode_sb> vocoder_g721_encode_sb_sptr; - -VOCODER_API vocoder_g721_encode_sb_sptr vocoder_make_g721_encode_sb(); - -/*! - * \brief This block performs g721 audio encoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g721_encode_sb : virtual public gr_sync_block -{ -}; - -#endif /* INCLUDED_VOCODER_G721_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_g723_24_decode_bs.h b/gr-vocoder/include/vocoder_g723_24_decode_bs.h deleted file mode 100644 index 6c0f09838..000000000 --- a/gr-vocoder/include/vocoder_g723_24_decode_bs.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_VOCODER_G723_24_DECODE_BS_H -#define INCLUDED_VOCODER_G723_24_DECODE_BS_H - -#include <vocoder_api.h> -#include <gr_sync_block.h> - -class vocoder_g723_24_decode_bs; - -typedef boost::shared_ptr<vocoder_g723_24_decode_bs> vocoder_g723_24_decode_bs_sptr; - -VOCODER_API vocoder_g723_24_decode_bs_sptr vocoder_make_g723_24_decode_bs(); - -/*! - * \brief This block performs g723_24 audio decoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g723_24_decode_bs : virtual public gr_sync_block -{ -}; - -#endif /* INCLUDED_VOCODER_G723_24_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_g723_24_encode_sb.h b/gr-vocoder/include/vocoder_g723_24_encode_sb.h deleted file mode 100644 index 105897583..000000000 --- a/gr-vocoder/include/vocoder_g723_24_encode_sb.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_VOCODER_G723_24_ENCODE_SB_H -#define INCLUDED_VOCODER_G723_24_ENCODE_SB_H - -#include <vocoder_api.h> -#include <gr_sync_block.h> - -class vocoder_g723_24_encode_sb; - -typedef boost::shared_ptr<vocoder_g723_24_encode_sb> vocoder_g723_24_encode_sb_sptr; - -VOCODER_API vocoder_g723_24_encode_sb_sptr vocoder_make_g723_24_encode_sb(); - -/*! - * \brief This block performs g723_24 audio encoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g723_24_encode_sb : virtual public gr_sync_block -{ -}; - -#endif /* INCLUDED_VOCODER_G723_24_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_g723_40_decode_bs.h b/gr-vocoder/include/vocoder_g723_40_decode_bs.h deleted file mode 100644 index ce320a526..000000000 --- a/gr-vocoder/include/vocoder_g723_40_decode_bs.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_VOCODER_G723_40_DECODE_BS_H -#define INCLUDED_VOCODER_G723_40_DECODE_BS_H - -#include <vocoder_api.h> -#include <gr_sync_block.h> - -class vocoder_g723_40_decode_bs; - -typedef boost::shared_ptr<vocoder_g723_40_decode_bs> vocoder_g723_40_decode_bs_sptr; - -VOCODER_API vocoder_g723_40_decode_bs_sptr vocoder_make_g723_40_decode_bs(); - -/*! - * \brief This block performs g723_40 audio decoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g723_40_decode_bs : virtual public gr_sync_block -{ -}; - -#endif /* INCLUDED_VOCODER_G723_40_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_g723_40_encode_sb.h b/gr-vocoder/include/vocoder_g723_40_encode_sb.h deleted file mode 100644 index eb732e73e..000000000 --- a/gr-vocoder/include/vocoder_g723_40_encode_sb.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_VOCODER_G723_40_ENCODE_SB_H -#define INCLUDED_VOCODER_G723_40_ENCODE_SB_H - -#include <vocoder_api.h> -#include <gr_sync_block.h> - -class vocoder_g723_40_encode_sb; - -typedef boost::shared_ptr<vocoder_g723_40_encode_sb> vocoder_g723_40_encode_sb_sptr; - -VOCODER_API vocoder_g723_40_encode_sb_sptr vocoder_make_g723_40_encode_sb(); - -/*! - * \brief This block performs g723_40 audio encoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_g723_40_encode_sb : virtual public gr_sync_block -{ -}; - -#endif /* INCLUDED_VOCODER_G723_40_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_gsm_fr_decode_ps.h b/gr-vocoder/include/vocoder_gsm_fr_decode_ps.h deleted file mode 100644 index 3af249436..000000000 --- a/gr-vocoder/include/vocoder_gsm_fr_decode_ps.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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 INCLUDED_VOCODER_GSM_FR_DECODE_PS_H -#define INCLUDED_VOCODER_GSM_FR_DECODE_PS_H - -#include <vocoder_api.h> -#include <gr_sync_interpolator.h> - -class vocoder_gsm_fr_decode_ps; -typedef boost::shared_ptr<vocoder_gsm_fr_decode_ps> vocoder_gsm_fr_decode_ps_sptr; - -VOCODER_API vocoder_gsm_fr_decode_ps_sptr vocoder_make_gsm_fr_decode_ps (); - -/*! - * \brief GSM 06.10 Full Rate Vocoder Decoder - * \ingroup vocoder_blk - */ -class VOCODER_API vocoder_gsm_fr_decode_ps : public gr_sync_interpolator { - struct gsm_state *d_gsm; - - friend VOCODER_API vocoder_gsm_fr_decode_ps_sptr vocoder_make_gsm_fr_decode_ps (); - vocoder_gsm_fr_decode_ps (); - -public: - ~vocoder_gsm_fr_decode_ps (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_GSM_FR_DECODE_PS_H */ diff --git a/gr-vocoder/include/vocoder_gsm_fr_encode_sp.h b/gr-vocoder/include/vocoder_gsm_fr_encode_sp.h deleted file mode 100644 index 2b65b5b44..000000000 --- a/gr-vocoder/include/vocoder_gsm_fr_encode_sp.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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 INCLUDED_VOCODER_GSM_FR_ENCODE_SP_H -#define INCLUDED_VOCODER_GSM_FR_ENCODE_SP_H - -#include <vocoder_api.h> -#include <gr_sync_decimator.h> - -class vocoder_gsm_fr_encode_sp; -typedef boost::shared_ptr<vocoder_gsm_fr_encode_sp> vocoder_gsm_fr_encode_sp_sptr; - -VOCODER_API vocoder_gsm_fr_encode_sp_sptr vocoder_make_gsm_fr_encode_sp (); - -/*! - * \brief GSM 06.10 Full Rate Vocoder Encoder - * \ingroup vocoder_blk - * - * shorts in; 33 byte packets out - */ -class VOCODER_API vocoder_gsm_fr_encode_sp : public gr_sync_decimator { - struct gsm_state *d_gsm; - - friend VOCODER_API vocoder_gsm_fr_encode_sp_sptr vocoder_make_gsm_fr_encode_sp (); - vocoder_gsm_fr_encode_sp (); - -public: - ~vocoder_gsm_fr_encode_sp (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_GSM_FR_ENCODE_SP_H */ diff --git a/gr-vocoder/include/vocoder_ulaw_decode_bs.h b/gr-vocoder/include/vocoder_ulaw_decode_bs.h deleted file mode 100644 index e25e9cdcf..000000000 --- a/gr-vocoder/include/vocoder_ulaw_decode_bs.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_VOCODER_ULAW_DECODE_BS_H -#define INCLUDED_VOCODER_ULAW_DECODE_BS_H - -#include <vocoder_api.h> -#include <gr_sync_block.h> - -class vocoder_ulaw_decode_bs; - -typedef boost::shared_ptr<vocoder_ulaw_decode_bs> vocoder_ulaw_decode_bs_sptr; - -VOCODER_API vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); - -/*! - * \brief This block performs ulaw audio decoding. - * - * \ingroup vocoder_blk - */ - -class VOCODER_API vocoder_ulaw_decode_bs : public gr_sync_block -{ -private: - friend VOCODER_API vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); - - vocoder_ulaw_decode_bs(); - - public: - ~vocoder_ulaw_decode_bs(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_ULAW_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_ulaw_encode_sb.h b/gr-vocoder/include/vocoder_ulaw_encode_sb.h deleted file mode 100644 index 702017d42..000000000 --- a/gr-vocoder/include/vocoder_ulaw_encode_sb.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 INCLUDED_VOCODER_ULAW_ENCODER_SB_H -#define INCLUDED_VOCODER_ULAW_ENCODER_SB_H - -#include <vocoder_api.h> -#include <gr_sync_block.h> - -class vocoder_ulaw_encode_sb; - -typedef boost::shared_ptr<vocoder_ulaw_encode_sb> vocoder_ulaw_encode_sb_sptr; - -VOCODER_API vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); - -/*! - * \brief This block performs g.711 ulaw audio encoding. - * - * \ingroup vocoder_blk - */ -class VOCODER_API vocoder_ulaw_encode_sb : public gr_sync_block -{ -private: - friend VOCODER_API vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); - - vocoder_ulaw_encode_sb(); - - public: - ~vocoder_ulaw_encode_sb(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_VOCODER_ULAW_ENCODE_SB_H */ diff --git a/gr-vocoder/lib/CMakeLists.txt b/gr-vocoder/lib/CMakeLists.txt deleted file mode 100644 index 43a4156d0..000000000 --- a/gr-vocoder/lib/CMakeLists.txt +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${GR_VOCODER_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_vocoder_sources - vocoder_alaw_decode_bs.cc - vocoder_alaw_encode_sb.cc - vocoder_codec2_decode_ps.cc - vocoder_codec2_encode_sp.cc - vocoder_cvsd_decode_bs.cc - vocoder_cvsd_encode_sb.cc - vocoder_g721_decode_bs.cc - vocoder_g721_encode_sb.cc - vocoder_g723_24_decode_bs.cc - vocoder_g723_24_encode_sb.cc - vocoder_g723_40_decode_bs.cc - vocoder_g723_40_encode_sb.cc - vocoder_gsm_fr_decode_ps.cc - vocoder_gsm_fr_encode_sp.cc - vocoder_ulaw_decode_bs.cc - vocoder_ulaw_encode_sb.cc -) - -######################################################################## -# Include subdirs rather to populate to the sources lists. -######################################################################## -GR_INCLUDE_SUBDIRECTORY(codec2) -GR_INCLUDE_SUBDIRECTORY(g7xx) -GR_INCLUDE_SUBDIRECTORY(gsm) - -list(APPEND vocoder_libs - gnuradio-core - ${Boost_LIBRARIES} -) - -add_library(gnuradio-vocoder SHARED ${gr_vocoder_sources}) -target_link_libraries(gnuradio-vocoder ${vocoder_libs}) -GR_LIBRARY_FOO(gnuradio-vocoder RUNTIME_COMPONENT "vocoder_runtime" DEVEL_COMPONENT "vocoder_devel") diff --git a/gr-vocoder/lib/codec2/CMakeLists.txt b/gr-vocoder/lib/codec2/CMakeLists.txt deleted file mode 100644 index 95e9d256b..000000000 --- a/gr-vocoder/lib/codec2/CMakeLists.txt +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Create executable to generate other sources -# http://www.vtk.org/Wiki/CMake_Cross_Compiling#Using_executables_in_the_build_created_during_the_build -######################################################################## -if(NOT CMAKE_CROSSCOMPILING) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - add_executable(generate_codebook ${CMAKE_CURRENT_SOURCE_DIR}/generate_codebook.c) - target_link_libraries(generate_codebook -lm) - export(TARGETS generate_codebook APPEND FILE ${EXPORT_FILE}) -endif() - -######################################################################## -# Create codebook -######################################################################## -set(CODEBOOKS - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp1.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp2.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp3.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp4.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp5.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp6.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp7.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp8.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp9.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp10.txt -) - -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebook.c - DEPENDS generate_codebook ${CODEBOOKS} - COMMAND generate_codebook lsp_cb ${CODEBOOKS} > ${CMAKE_CURRENT_BINARY_DIR}/codebook.c -) - -######################################################################## -# Create codebookd -######################################################################## -set(CODEBOOKSD - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp1.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp2.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp3.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp4.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp5.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp6.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp7.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp8.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp9.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp10.txt -) - -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookd.c - DEPENDS generate_codebook ${CODEBOOKSD} - COMMAND generate_codebook lsp_cbd ${CODEBOOKSD} > ${CMAKE_CURRENT_BINARY_DIR}/codebookd.c -) - -######################################################################## -# Create codebookdvq -######################################################################## -set(CODEBOOKSDVQ - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp1.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp2.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp3.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp4.txt - ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp5.txt -) - -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookdvq.c - DEPENDS generate_codebook ${CODEBOOKSDVQ} - COMMAND generate_codebook lsp_cbdvq ${CODEBOOKSDVQ} > ${CMAKE_CURRENT_BINARY_DIR}/codebookdvq.c -) - -######################################################################## -# Append all sources in this dir -######################################################################## -list(APPEND gr_vocoder_sources - ${CMAKE_CURRENT_BINARY_DIR}/codebook.c - ${CMAKE_CURRENT_BINARY_DIR}/codebookd.c - ${CMAKE_CURRENT_BINARY_DIR}/codebookdvq.c - - ${CMAKE_CURRENT_SOURCE_DIR}/dump.c - ${CMAKE_CURRENT_SOURCE_DIR}/lpc.c - ${CMAKE_CURRENT_SOURCE_DIR}/nlp.c - ${CMAKE_CURRENT_SOURCE_DIR}/postfilter.c - ${CMAKE_CURRENT_SOURCE_DIR}/sine.c - ${CMAKE_CURRENT_SOURCE_DIR}/codec2.c - ${CMAKE_CURRENT_SOURCE_DIR}/fft.c - ${CMAKE_CURRENT_SOURCE_DIR}/kiss_fft.c - ${CMAKE_CURRENT_SOURCE_DIR}/interp.c - ${CMAKE_CURRENT_SOURCE_DIR}/lsp.c - ${CMAKE_CURRENT_SOURCE_DIR}/phase.c - ${CMAKE_CURRENT_SOURCE_DIR}/quantise.c - ${CMAKE_CURRENT_SOURCE_DIR}/pack.c -) diff --git a/gr-vocoder/lib/codec2/_kiss_fft_guts.h b/gr-vocoder/lib/codec2/_kiss_fft_guts.h deleted file mode 100644 index f008a7b50..000000000 --- a/gr-vocoder/lib/codec2/_kiss_fft_guts.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -Copyright (c) 2003-2010, Mark Borgerding - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* kiss_fft.h - defines kiss_fft_scalar as either short or a float type - and defines - typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */ -#include "kiss_fft.h" -#include <limits.h> - -#define MAXFACTORS 32 -/* e.g. an fft of length 128 has 4 factors - as far as kissfft is concerned - 4*4*4*2 - */ - -struct kiss_fft_state{ - int nfft; - int inverse; - int factors[2*MAXFACTORS]; - kiss_fft_cpx twiddles[1]; -}; - -/* - Explanation of macros dealing with complex math: - - C_MUL(m,a,b) : m = a*b - C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise - C_SUB( res, a,b) : res = a - b - C_SUBFROM( res , a) : res -= a - C_ADDTO( res , a) : res += a - * */ -#ifdef FIXED_POINT -#if (FIXED_POINT==32) -# define FRACBITS 31 -# define SAMPPROD int64_t -#define SAMP_MAX 2147483647 -#else -# define FRACBITS 15 -# define SAMPPROD int32_t -#define SAMP_MAX 32767 -#endif - -#define SAMP_MIN -SAMP_MAX - -#if defined(CHECK_OVERFLOW) -# define CHECK_OVERFLOW_OP(a,op,b) \ - if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \ - fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); } -#endif - - -# define smul(a,b) ( (SAMPPROD)(a)*(b) ) -# define sround( x ) (kiss_fft_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS ) - -# define S_MUL(a,b) sround( smul(a,b) ) - -# define C_MUL(m,a,b) \ - do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \ - (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0) - -# define DIVSCALAR(x,k) \ - (x) = sround( smul( x, SAMP_MAX/k ) ) - -# define C_FIXDIV(c,div) \ - do { DIVSCALAR( (c).r , div); \ - DIVSCALAR( (c).i , div); }while (0) - -# define C_MULBYSCALAR( c, s ) \ - do{ (c).r = sround( smul( (c).r , s ) ) ;\ - (c).i = sround( smul( (c).i , s ) ) ; }while(0) - -#else /* not FIXED_POINT*/ - -# define S_MUL(a,b) ( (a)*(b) ) -#define C_MUL(m,a,b) \ - do{ (m).r = (a).r*(b).r - (a).i*(b).i;\ - (m).i = (a).r*(b).i + (a).i*(b).r; }while(0) -# define C_FIXDIV(c,div) /* NOOP */ -# define C_MULBYSCALAR( c, s ) \ - do{ (c).r *= (s);\ - (c).i *= (s); }while(0) -#endif - -#ifndef CHECK_OVERFLOW_OP -# define CHECK_OVERFLOW_OP(a,op,b) /* noop */ -#endif - -#define C_ADD( res, a,b)\ - do { \ - CHECK_OVERFLOW_OP((a).r,+,(b).r)\ - CHECK_OVERFLOW_OP((a).i,+,(b).i)\ - (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \ - }while(0) -#define C_SUB( res, a,b)\ - do { \ - CHECK_OVERFLOW_OP((a).r,-,(b).r)\ - CHECK_OVERFLOW_OP((a).i,-,(b).i)\ - (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \ - }while(0) -#define C_ADDTO( res , a)\ - do { \ - CHECK_OVERFLOW_OP((res).r,+,(a).r)\ - CHECK_OVERFLOW_OP((res).i,+,(a).i)\ - (res).r += (a).r; (res).i += (a).i;\ - }while(0) - -#define C_SUBFROM( res , a)\ - do {\ - CHECK_OVERFLOW_OP((res).r,-,(a).r)\ - CHECK_OVERFLOW_OP((res).i,-,(a).i)\ - (res).r -= (a).r; (res).i -= (a).i; \ - }while(0) - - -#ifdef FIXED_POINT -# define KISS_FFT_COS(phase) floor(.5+SAMP_MAX * cos (phase)) -# define KISS_FFT_SIN(phase) floor(.5+SAMP_MAX * sin (phase)) -# define HALF_OF(x) ((x)>>1) -#elif defined(USE_SIMD) -# define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) ) -# define KISS_FFT_SIN(phase) _mm_set1_ps( sin(phase) ) -# define HALF_OF(x) ((x)*_mm_set1_ps(.5)) -#else -# define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase) -# define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase) -# define HALF_OF(x) ((x)*.5) -#endif - -#define kf_cexp(x,phase) \ - do{ \ - (x)->r = KISS_FFT_COS(phase);\ - (x)->i = KISS_FFT_SIN(phase);\ - }while(0) - - -/* a debugging function */ -#define pcpx(c)\ - fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) ) - - -#ifdef KISS_FFT_USE_ALLOCA -// define this to allow use of alloca instead of malloc for temporary buffers -// Temporary buffers are used in two case: -// 1. FFT sizes that have "bad" factors. i.e. not 2,3 and 5 -// 2. "in-place" FFTs. Notice the quotes, since kissfft does not really do an in-place transform. -#include <alloca.h> -#define KISS_FFT_TMP_ALLOC(nbytes) alloca(nbytes) -#define KISS_FFT_TMP_FREE(ptr) -#else -#define KISS_FFT_TMP_ALLOC(nbytes) KISS_FFT_MALLOC(nbytes) -#define KISS_FFT_TMP_FREE(ptr) KISS_FFT_FREE(ptr) -#endif diff --git a/gr-vocoder/lib/codec2/c2dec.c b/gr-vocoder/lib/codec2/c2dec.c deleted file mode 100644 index 3123e96fb..000000000 --- a/gr-vocoder/lib/codec2/c2dec.c +++ /dev/null @@ -1,82 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: c2dec.c - AUTHOR......: David Rowe - DATE CREATED: 23/8/2010 - - Decodes a file of bits to a file of raw speech samples using codec2. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2010 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "codec2.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#define BITS_SIZE ((CODEC2_BITS_PER_FRAME + 7) / 8) - -int main(int argc, char *argv[]) -{ - void *codec2; - FILE *fin; - FILE *fout; - short buf[CODEC2_SAMPLES_PER_FRAME]; - unsigned char bits[BITS_SIZE]; - - if (argc != 3) { - printf("usage: %s InputBitFile OutputRawSpeechFile\n", argv[0]); - exit(1); - } - - if (strcmp(argv[1], "-") == 0) fin = stdin; - else if ( (fin = fopen(argv[1],"rb")) == NULL ) { - fprintf(stderr, "Error opening input bit file: %s: %s.\n", - argv[1], strerror(errno)); - exit(1); - } - - if (strcmp(argv[2], "-") == 0) fout = stdout; - else if ( (fout = fopen(argv[2],"wb")) == NULL ) { - fprintf(stderr, "Error opening output speech file: %s: %s.\n", - argv[2], strerror(errno)); - exit(1); - } - - codec2 = codec2_create(); - - while(fread(bits, sizeof(char), BITS_SIZE, fin) == BITS_SIZE) { - codec2_decode(codec2, buf, bits); - fwrite(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fout); - //if this is in a pipeline, we probably don't want the usual - //buffering to occur - if (fout == stdout) fflush(stdout); - if (fin == stdin) fflush(stdin); - - } - - codec2_destroy(codec2); - - fclose(fin); - fclose(fout); - - return 0; -} diff --git a/gr-vocoder/lib/codec2/c2demo.c b/gr-vocoder/lib/codec2/c2demo.c deleted file mode 100644 index b9e17a78e..000000000 --- a/gr-vocoder/lib/codec2/c2demo.c +++ /dev/null @@ -1,86 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: c2demo.c - AUTHOR......: David Rowe - DATE CREATED: 15/11/2010 - - Encodes and decodes a file of raw speech samples using Codec 2. - Demonstrates use of Codec 2 function API. - - Note to convert a wave file to raw and vice-versa: - - $ sox file.wav -r 8000 -s -2 file.raw - $ sox -r 8000 -s -2 file.raw file.wav - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2010 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "codec2.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#define BITS_SIZE ((CODEC2_BITS_PER_FRAME + 7) / 8) - -int main(int argc, char *argv[]) -{ - void *codec2; - FILE *fin; - FILE *fout; - short buf[CODEC2_SAMPLES_PER_FRAME]; - unsigned char bits[BITS_SIZE]; - - if (argc != 3) { - printf("usage: %s InputRawSpeechFile OutputRawSpeechFile\n", argv[0]); - exit(1); - } - - if ( (fin = fopen(argv[1],"rb")) == NULL ) { - fprintf(stderr, "Error opening input speech file: %s: %s.\n", - argv[1], strerror(errno)); - exit(1); - } - - if ( (fout = fopen(argv[2],"wb")) == NULL ) { - fprintf(stderr, "Error opening output speech file: %s: %s.\n", - argv[2], strerror(errno)); - exit(1); - } - - /* Note only one set of Codec 2 states is required for an encoder - and decoder pair. */ - - codec2 = codec2_create(); - - while(fread(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fin) == - CODEC2_SAMPLES_PER_FRAME) { - codec2_encode(codec2, bits, buf); - codec2_decode(codec2, buf, bits); - fwrite(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fout); - } - - codec2_destroy(codec2); - - fclose(fin); - fclose(fout); - - return 0; -} diff --git a/gr-vocoder/lib/codec2/c2enc.c b/gr-vocoder/lib/codec2/c2enc.c deleted file mode 100644 index 0e5b26cfd..000000000 --- a/gr-vocoder/lib/codec2/c2enc.c +++ /dev/null @@ -1,83 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: c2enc.c - AUTHOR......: David Rowe - DATE CREATED: 23/8/2010 - - Encodes a file of raw speech samples using codec2 and outputs a file - of bits. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2010 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "codec2.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#define BITS_SIZE ((CODEC2_BITS_PER_FRAME + 7) / 8) - -int main(int argc, char *argv[]) -{ - void *codec2; - FILE *fin; - FILE *fout; - short buf[CODEC2_SAMPLES_PER_FRAME]; - unsigned char bits[BITS_SIZE]; - - if (argc != 3) { - printf("usage: %s InputRawspeechFile OutputBitFile\n", argv[0]); - exit(1); - } - - if (strcmp(argv[1], "-") == 0) fin = stdin; - else if ( (fin = fopen(argv[1],"rb")) == NULL ) { - fprintf(stderr, "Error opening input bit file: %s: %s.\n", - argv[1], strerror(errno)); - exit(1); - } - - if (strcmp(argv[2], "-") == 0) fout = stdout; - else if ( (fout = fopen(argv[2],"wb")) == NULL ) { - fprintf(stderr, "Error opening output speech file: %s: %s.\n", - argv[2], strerror(errno)); - exit(1); - } - - codec2 = codec2_create(); - - while(fread(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fin) == - CODEC2_SAMPLES_PER_FRAME) { - codec2_encode(codec2, bits, buf); - fwrite(bits, sizeof(char), BITS_SIZE, fout); - //if this is in a pipeline, we probably don't want the usual - //buffering to occur - if (fout == stdout) fflush(stdout); - if (fin == stdin) fflush(stdin); - } - - codec2_destroy(codec2); - - fclose(fin); - fclose(fout); - - return 0; -} diff --git a/gr-vocoder/lib/codec2/c2sim.c b/gr-vocoder/lib/codec2/c2sim.c deleted file mode 100644 index e335078b6..000000000 --- a/gr-vocoder/lib/codec2/c2sim.c +++ /dev/null @@ -1,469 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: c2sim.c - AUTHOR......: David Rowe - DATE CREATED: 20/8/2010 - - Codec2 simulation. Combines encoder and decoder and allows switching in - out various algorithms and quantisation steps. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include <math.h> - -#include "defines.h" -#include "sine.h" -#include "nlp.h" -#include "dump.h" -#include "lpc.h" -#include "lsp.h" -#include "quantise.h" -#include "phase.h" -#include "postfilter.h" -#include "interp.h" - -/*---------------------------------------------------------------------------*\ - - switch_present() - - Searches the command line arguments for a "switch". If the switch is - found, returns the command line argument where it ws found, else returns - NULL. - -\*---------------------------------------------------------------------------*/ - -int switch_present(sw,argc,argv) -register char sw[]; /* switch in string form */ -register int argc; /* number of command line arguments */ -register char *argv[]; /* array of command line arguments in string form */ -{ - register int i; /* loop variable */ - - for(i=1; i<argc; i++) - if (!strcmp(sw,argv[i])) - return(i); - - return 0; -} - -void synth_one_frame(short buf[], MODEL *model, float Sn_[], float Pn[]); - -/*---------------------------------------------------------------------------*\ - - MAIN - -\*---------------------------------------------------------------------------*/ - -int main(int argc, char *argv[]) -{ - FILE *fout; /* output speech file */ - FILE *fin; /* input speech file */ - short buf[N]; /* input/output buffer */ - float Sn[M]; /* float input speech samples */ - COMP Sw[FFT_ENC]; /* DFT of Sn[] */ - float w[M]; /* time domain hamming window */ - COMP W[FFT_ENC]; /* DFT of w[] */ - MODEL model; - float Pn[2*N]; /* trapezoidal synthesis window */ - float Sn_[2*N]; /* synthesised speech */ - int i; /* loop variable */ - int frames; - float prev_Wo; - float pitch; - int voiced1 = 0; - - char out_file[MAX_STR]; - int arg; - float snr; - float sum_snr; - - int lpc_model, order = LPC_ORD; - int lsp, lspd, lspdvq, lsp_quantiser; - float ak[LPC_MAX]; - COMP Sw_[FFT_ENC]; - COMP Ew[FFT_ENC]; - - int dump; - - int phase0; - float ex_phase[MAX_AMP+1]; - - int postfilt; - float bg_est; - - int hand_voicing; - FILE *fvoicing = 0; - - MODEL prev_model, interp_model; - int decimate; - float lsps[LPC_ORD]; - float prev_lsps[LPC_ORD]; - float e, prev_e; - float ak_interp[LPC_MAX]; - - void *nlp_states; - float hpf_states[2]; - int resample; - float AresdB_prev[MAX_AMP]; - - for(i=0; i<MAX_AMP; i++) - AresdB_prev[i] = 0.0; - - for(i=0; i<M; i++) - Sn[i] = 1.0; - for(i=0; i<2*N; i++) - Sn_[i] = 0; - - prev_Wo = TWO_PI/P_MAX; - - prev_model.Wo = TWO_PI/P_MIN; - prev_model.L = floor(PI/prev_model.Wo); - for(i=1; i<=prev_model.L; i++) { - prev_model.A[i] = 0.0; - prev_model.phi[i] = 0.0; - } - for(i=1; i<=MAX_AMP; i++) { - ex_phase[i] = 0.0; - } - for(i=0; i<LPC_ORD; i++) { - prev_lsps[i] = i*PI/(LPC_ORD+1); - } - e = prev_e = 1; - hpf_states[0] = hpf_states[1] = 0.0; - - nlp_states = nlp_create(); - - if (argc < 2) { - fprintf(stderr, "\nCodec2 - 2400 bit/s speech codec - Simulation Program\n" - "\thttp://rowetel.com/codec2.html\n\n" - "usage: %s InputFile [-o OutputFile]\n" - "\t[--lpc Order]\n" - "\t[--lsp]\n" - "\t[--lspd]\n" - "\t[--lspdvq]\n" - "\t[--phase0]\n" - "\t[--postfilter]\n" - "\t[--hand_voicing]\n" - "\t[--dec]\n" - "\t[--dump DumpFilePrefix]\n", argv[0]); - exit(1); - } - - /* Interpret command line arguments -------------------------------------*/ - - /* Input file */ - - if ((fin = fopen(argv[1],"rb")) == NULL) { - fprintf(stderr, "Error opening input speech file: %s: %s.\n", - argv[1], strerror(errno)); - exit(1); - } - - /* Output file */ - - if ((arg = switch_present("-o",argc,argv))) { - if ((fout = fopen(argv[arg+1],"wb")) == NULL) { - fprintf(stderr, "Error opening output speech file: %s: %s.\n", - argv[arg+1], strerror(errno)); - exit(1); - } - strcpy(out_file,argv[arg+1]); - } - else - fout = NULL; - - lpc_model = 0; - if ((arg = switch_present("--lpc",argc,argv))) { - lpc_model = 1; - order = atoi(argv[arg+1]); - if ((order < 4) || (order > 20)) { - fprintf(stderr, "Error in lpc order: %d\n", order); - exit(1); - } - } - - dump = switch_present("--dump",argc,argv); -#ifdef DUMP - if (dump) - dump_on(argv[dump+1]); -#endif - - lsp = switch_present("--lsp",argc,argv); - lsp_quantiser = 0; - if (lsp) - assert(order == LPC_ORD); - - lspd = switch_present("--lspd",argc,argv); - if (lspd) - assert(order == LPC_ORD); - - lspdvq = switch_present("--lspdvq",argc,argv); - if (lspdvq) - assert(order == LPC_ORD); - - phase0 = switch_present("--phase0",argc,argv); - if (phase0) { - ex_phase[0] = 0; - } - - hand_voicing = switch_present("--hand_voicing",argc,argv); - if (hand_voicing) { - fvoicing = fopen(argv[hand_voicing+1],"rt"); - assert(fvoicing != NULL); - } - - bg_est = 0.0; - postfilt = switch_present("--postfilter",argc,argv); - - decimate = switch_present("--dec",argc,argv); - - arg = switch_present("--resample",argc,argv); - resample = atoi(argv[arg+1]); - - /* Initialise ------------------------------------------------------------*/ - - make_analysis_window(w,W); - make_synthesis_window(Pn); - quantise_init(); - - /* Main loop ------------------------------------------------------------*/ - - frames = 0; - sum_snr = 0; - while(fread(buf,sizeof(short),N,fin)) { - frames++; - //printf("frame: %d", frames); - - /* Read input speech */ - - for(i=0; i<M-N; i++) - Sn[i] = Sn[i+N]; - for(i=0; i<N; i++) { - //Sn[i+M-N] = hpf((float)buf[i], hpf_states); - Sn[i+M-N] = (float)buf[i]; - } - - /* Estimate pitch */ - - nlp(nlp_states,Sn,N,M,P_MIN,P_MAX,&pitch,Sw,&prev_Wo); - model.Wo = TWO_PI/pitch; - - /* estimate model parameters */ - - dft_speech(Sw, Sn, w); - two_stage_pitch_refinement(&model, Sw); - estimate_amplitudes(&model, Sw, W); -#ifdef DUMP - dump_Sn(Sn); dump_Sw(Sw); dump_model(&model); -#endif - - /* optional zero-phase modelling */ - - if (phase0) { - float Wn[M]; /* windowed speech samples */ - float Rk[LPC_MAX+1]; /* autocorrelation coeffs */ - -#ifdef DUMP - dump_phase(&model.phi[0], model.L); -#endif - - /* find aks here, these are overwritten if LPC modelling is enabled */ - - for(i=0; i<M; i++) - Wn[i] = Sn[i]*w[i]; - autocorrelate(Wn,Rk,M,order); - levinson_durbin(Rk,ak,order); - -#ifdef DUMP - dump_ak(ak, LPC_ORD); -#endif - - /* determine voicing */ - - snr = est_voicing_mbe(&model, Sw, W, Sw_, Ew, prev_Wo); -#ifdef DUMP - dump_Sw_(Sw_); - dump_Ew(Ew); - dump_snr(snr); -#endif - - /* just to make sure we are not cheating - kill all phases */ - - for(i=0; i<MAX_AMP; i++) - model.phi[i] = 0; - - if (hand_voicing) { - fscanf(fvoicing,"%d\n",&model.voiced); - } - } - - /* optional LPC model amplitudes */ - - if (lpc_model) { - int lsp_indexes[LPC_MAX]; - - e = speech_to_uq_lsps(lsps, ak, Sn, w, order); - - if (lsp) { - encode_lsps(lsp_indexes, lsps, LPC_ORD); - decode_lsps(lsps, lsp_indexes, LPC_ORD); - bw_expand_lsps(lsps, LPC_ORD); - lsp_to_lpc(lsps, ak, LPC_ORD); - } - - if (lspd) { - float lsps_[LPC_ORD]; - - lspd_quantise(lsps, lsps_, LPC_ORD); - lsp_to_lpc(lsps_, ak, LPC_ORD); - } - - if (lspdvq) { - float lsps_[LPC_ORD]; - - lspdvq_quantise(lsps, lsps_, LPC_ORD); - lsp_to_lpc(lsps_, ak, LPC_ORD); - } - - e = decode_energy(encode_energy(e)); - model.Wo = decode_Wo(encode_Wo(model.Wo)); - - aks_to_M2(ak, order, &model, e, &snr, 1); - apply_lpc_correction(&model); - sum_snr += snr; -#ifdef DUMP - dump_quantised_model(&model); -#endif - } - - /* optional resampling of model amplitudes */ - - printf("frames=%d\n", frames); - if (resample) { - snr = resample_amp_nl(&model, resample, AresdB_prev); - sum_snr += snr; -#ifdef DUMP - dump_quantised_model(&model); -#endif - } - - /* option decimation to 20ms rate, which enables interpolation - routine to synthesise in between frame */ - - if (decimate) { - if (!phase0) { - printf("needs --phase0 to resample phase for interpolated Wo\n"); - exit(0); - } - if (!lpc_model) { - printf("needs --lpc 10 to resample amplitudes\n"); - exit(0); - } - - /* odd frame - interpolate */ - - if (frames%2) { - - interp_model.voiced = voiced1; - - #ifdef LOG_LIN_INTERP - interpolate(&interp_model, &prev_model, &model); - #else - interpolate_lsp(&interp_model, &prev_model, &model, - prev_lsps, prev_e, lsps, e, ak_interp); - apply_lpc_correction(&interp_model); - #endif - - if (phase0) - phase_synth_zero_order(&interp_model, ak_interp, ex_phase, - order); - if (postfilt) - postfilter(&interp_model, &bg_est); - synth_one_frame(buf, &interp_model, Sn_, Pn); - if (fout != NULL) fwrite(buf,sizeof(short),N,fout); - - if (phase0) - phase_synth_zero_order(&model, ak, ex_phase, order); - if (postfilt) - postfilter(&model, &bg_est); - synth_one_frame(buf, &model, Sn_, Pn); - if (fout != NULL) fwrite(buf,sizeof(short),N,fout); - - prev_model = model; - for(i=0; i<LPC_ORD; i++) - prev_lsps[i] = lsps[i]; - prev_e = e; - } - else { - voiced1 = model.voiced; - } - } - else { - if (phase0) - phase_synth_zero_order(&model, ak, ex_phase, order); - if (postfilt) - postfilter(&model, &bg_est); - synth_one_frame(buf, &model, Sn_, Pn); - if (fout != NULL) fwrite(buf,sizeof(short),N,fout); - } - prev_Wo = TWO_PI/pitch; - } - fclose(fin); - - if (fout != NULL) - fclose(fout); - - if (lpc_model || resample) - printf("SNR av = %5.2f dB\n", sum_snr/frames); - -#ifdef DUMP - if (dump) - dump_off(); -#endif - - if (hand_voicing) - fclose(fvoicing); - - nlp_destroy(nlp_states); - - return 0; -} - -void synth_one_frame(short buf[], MODEL *model, float Sn_[], float Pn[]) -{ - int i; - - synthesise(Sn_, model, Pn, 1); - - for(i=0; i<N; i++) { - if (Sn_[i] > 32767.0) - buf[i] = 32767; - else if (Sn_[i] < -32767.0) - buf[i] = -32767; - else - buf[i] = Sn_[i]; - } - -} diff --git a/gr-vocoder/lib/codec2/codebook/dlsp1.txt b/gr-vocoder/lib/codec2/codebook/dlsp1.txt deleted file mode 100644 index d126be771..000000000 --- a/gr-vocoder/lib/codec2/codebook/dlsp1.txt +++ /dev/null @@ -1,17 +0,0 @@ -1 16 -225 -250 -275 -300 -325 -350 -375 -400 -425 -450 -475 -500 -525 -550 -575 -600 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp10.txt b/gr-vocoder/lib/codec2/codebook/dlsp10.txt deleted file mode 100644 index dea9dd9d8..000000000 --- a/gr-vocoder/lib/codec2/codebook/dlsp10.txt +++ /dev/null @@ -1,9 +0,0 @@ -1 8 -50 -100 -200 -300 -425 -550 -675 -800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp2.txt b/gr-vocoder/lib/codec2/codebook/dlsp2.txt deleted file mode 100644 index 234bf2067..000000000 --- a/gr-vocoder/lib/codec2/codebook/dlsp2.txt +++ /dev/null @@ -1,17 +0,0 @@ -1 16 -25 -50 -75 -100 -125 -150 -175 -200 -225 -250 -275 -300 -325 -350 -375 -400 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp3.txt b/gr-vocoder/lib/codec2/codebook/dlsp3.txt deleted file mode 100644 index b2ee06da4..000000000 --- a/gr-vocoder/lib/codec2/codebook/dlsp3.txt +++ /dev/null @@ -1,9 +0,0 @@ -1 8 -50 -75 -100 -120 -150 -250 -350 -450 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp4.txt b/gr-vocoder/lib/codec2/codebook/dlsp4.txt deleted file mode 100644 index dea9dd9d8..000000000 --- a/gr-vocoder/lib/codec2/codebook/dlsp4.txt +++ /dev/null @@ -1,9 +0,0 @@ -1 8 -50 -100 -200 -300 -425 -550 -675 -800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp5.txt b/gr-vocoder/lib/codec2/codebook/dlsp5.txt deleted file mode 100644 index dea9dd9d8..000000000 --- a/gr-vocoder/lib/codec2/codebook/dlsp5.txt +++ /dev/null @@ -1,9 +0,0 @@ -1 8 -50 -100 -200 -300 -425 -550 -675 -800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp6.txt b/gr-vocoder/lib/codec2/codebook/dlsp6.txt deleted file mode 100644 index dea9dd9d8..000000000 --- a/gr-vocoder/lib/codec2/codebook/dlsp6.txt +++ /dev/null @@ -1,9 +0,0 @@ -1 8 -50 -100 -200 -300 -425 -550 -675 -800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp7.txt b/gr-vocoder/lib/codec2/codebook/dlsp7.txt deleted file mode 100644 index dea9dd9d8..000000000 --- a/gr-vocoder/lib/codec2/codebook/dlsp7.txt +++ /dev/null @@ -1,9 +0,0 @@ -1 8 -50 -100 -200 -300 -425 -550 -675 -800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp8.txt b/gr-vocoder/lib/codec2/codebook/dlsp8.txt deleted file mode 100644 index dea9dd9d8..000000000 --- a/gr-vocoder/lib/codec2/codebook/dlsp8.txt +++ /dev/null @@ -1,9 +0,0 @@ -1 8 -50 -100 -200 -300 -425 -550 -675 -800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp9.txt b/gr-vocoder/lib/codec2/codebook/dlsp9.txt deleted file mode 100644 index dea9dd9d8..000000000 --- a/gr-vocoder/lib/codec2/codebook/dlsp9.txt +++ /dev/null @@ -1,9 +0,0 @@ -1 8 -50 -100 -200 -300 -425 -550 -675 -800 diff --git a/gr-vocoder/lib/codec2/codebook/lsp1.txt b/gr-vocoder/lib/codec2/codebook/lsp1.txt deleted file mode 100644 index d126be771..000000000 --- a/gr-vocoder/lib/codec2/codebook/lsp1.txt +++ /dev/null @@ -1,17 +0,0 @@ -1 16 -225 -250 -275 -300 -325 -350 -375 -400 -425 -450 -475 -500 -525 -550 -575 -600 diff --git a/gr-vocoder/lib/codec2/codebook/lsp10.txt b/gr-vocoder/lib/codec2/codebook/lsp10.txt deleted file mode 100644 index 39aab7c56..000000000 --- a/gr-vocoder/lib/codec2/codebook/lsp10.txt +++ /dev/null @@ -1,6 +0,0 @@ -1 4 -2900 -3100 -3300 -3500 - diff --git a/gr-vocoder/lib/codec2/codebook/lsp2.txt b/gr-vocoder/lib/codec2/codebook/lsp2.txt deleted file mode 100644 index 597f14965..000000000 --- a/gr-vocoder/lib/codec2/codebook/lsp2.txt +++ /dev/null @@ -1,17 +0,0 @@ -1 16 -325 -350 -375 -400 -425 -450 -475 -500 -525 -550 -575 -600 -625 -650 -675 -700 diff --git a/gr-vocoder/lib/codec2/codebook/lsp3.txt b/gr-vocoder/lib/codec2/codebook/lsp3.txt deleted file mode 100644 index 36a64b158..000000000 --- a/gr-vocoder/lib/codec2/codebook/lsp3.txt +++ /dev/null @@ -1,17 +0,0 @@ -1 16 -500 -550 -600 -650 -700 -750 -800 -850 -900 -950 -1000 -1050 -1100 -1150 -1200 -1250 diff --git a/gr-vocoder/lib/codec2/codebook/lsp4.txt b/gr-vocoder/lib/codec2/codebook/lsp4.txt deleted file mode 100644 index 53a90bd8c..000000000 --- a/gr-vocoder/lib/codec2/codebook/lsp4.txt +++ /dev/null @@ -1,17 +0,0 @@ -1 16 -700 -800 -900 -1000 -1100 -1200 -1300 -1400 -1500 -1600 -1700 -1800 -1900 -2000 -2100 -2200 diff --git a/gr-vocoder/lib/codec2/codebook/lsp5.txt b/gr-vocoder/lib/codec2/codebook/lsp5.txt deleted file mode 100644 index 94739b56e..000000000 --- a/gr-vocoder/lib/codec2/codebook/lsp5.txt +++ /dev/null @@ -1,19 +0,0 @@ -1 16 - 950 -1050 -1150 -1250 -1350 -1450 -1550 -1650 -1750 -1850 -1950 -2050 -2150 -2250 -2350 -2450 - - diff --git a/gr-vocoder/lib/codec2/codebook/lsp6.txt b/gr-vocoder/lib/codec2/codebook/lsp6.txt deleted file mode 100644 index 992ea25c5..000000000 --- a/gr-vocoder/lib/codec2/codebook/lsp6.txt +++ /dev/null @@ -1,19 +0,0 @@ -1 16 -1100 -1200 -1300 -1400 -1500 -1600 -1700 -1800 -1900 -2000 -2100 -2200 -2300 -2400 -2500 -2600 - - diff --git a/gr-vocoder/lib/codec2/codebook/lsp7.txt b/gr-vocoder/lib/codec2/codebook/lsp7.txt deleted file mode 100644 index 839cbfdd5..000000000 --- a/gr-vocoder/lib/codec2/codebook/lsp7.txt +++ /dev/null @@ -1,19 +0,0 @@ -1 16 -1500 -1600 -1700 -1800 -1900 -2000 -2100 -2200 -2300 -2400 -2500 -2600 -2700 -2800 -2900 -3000 - - diff --git a/gr-vocoder/lib/codec2/codebook/lsp8.txt b/gr-vocoder/lib/codec2/codebook/lsp8.txt deleted file mode 100644 index d9880c94e..000000000 --- a/gr-vocoder/lib/codec2/codebook/lsp8.txt +++ /dev/null @@ -1,11 +0,0 @@ -1 8 -2300 -2400 -2500 -2600 -2700 -2800 -2900 -3000 - - diff --git a/gr-vocoder/lib/codec2/codebook/lsp8910.txt b/gr-vocoder/lib/codec2/codebook/lsp8910.txt deleted file mode 100644 index 759136bfe..000000000 --- a/gr-vocoder/lib/codec2/codebook/lsp8910.txt +++ /dev/null @@ -1,65 +0,0 @@ -3 64 -2.048073 2.534502 2.645915 -2.019670 2.269744 2.605462 -1.961101 2.329646 2.562857 -1.968573 2.532712 2.616918 -2.183480 2.514381 2.629582 -2.259379 2.516615 2.620410 -2.172791 2.462460 2.567064 -2.097666 2.303933 2.421685 -2.052990 2.353242 2.546992 -2.043642 2.232362 2.499262 -2.106151 2.393131 2.488401 -2.099167 2.437862 2.558655 -2.013877 2.422875 2.530071 -2.033848 2.483776 2.584598 -2.114474 2.516856 2.602372 -2.229214 2.584056 2.678855 -2.131151 2.584299 2.674845 -1.472721 2.477091 2.630241 -2.010907 2.598415 2.682989 -2.353653 2.524066 2.619773 -2.419897 2.623938 2.699605 -2.319080 2.602148 2.689044 -1.860342 2.503881 2.616576 -1.910517 2.386693 2.610126 -1.748689 2.371809 2.496542 -1.618495 2.403425 2.554956 -1.844073 2.437026 2.533443 -1.924810 2.388543 2.502698 -1.937227 2.258363 2.501697 -1.687554 2.209123 2.545239 -1.851950 2.278628 2.565632 -1.868154 2.330150 2.444883 -1.874180 2.213118 2.351940 -1.757311 2.030626 2.433836 -1.650306 2.152371 2.243421 -1.612794 1.884686 2.339313 -1.745431 2.278895 2.389449 -1.590923 2.304155 2.408510 -1.475982 2.275548 2.509897 -1.508695 2.045463 2.455520 -1.872054 2.061777 2.246202 -1.983947 2.159155 2.445535 -1.745180 2.483765 2.593698 -1.900116 2.079600 2.407479 -1.841672 2.167042 2.486827 -1.932912 2.148464 2.569850 -2.134174 2.363673 2.584252 -2.106094 2.450645 2.638417 -1.954135 2.460313 2.666512 -1.907634 2.573801 2.674025 -1.625579 2.539569 2.656363 -1.785866 2.572616 2.676082 -1.798447 2.376454 2.624298 -2.020033 2.397244 2.619868 -1.946581 2.468791 2.564185 -2.008920 2.342400 2.469132 -1.983846 2.271044 2.395408 -1.988039 2.154150 2.317920 -2.077197 2.216622 2.389101 -2.117255 2.283907 2.512242 -2.177233 2.334622 2.458268 -2.214655 2.425510 2.620013 -2.199931 2.390272 2.520731 -2.271755 2.448682 2.552649 diff --git a/gr-vocoder/lib/codec2/codebook/lsp9.txt b/gr-vocoder/lib/codec2/codebook/lsp9.txt deleted file mode 100644 index 7e159af2f..000000000 --- a/gr-vocoder/lib/codec2/codebook/lsp9.txt +++ /dev/null @@ -1,11 +0,0 @@ -1 8 -2500 -2600 -2700 -2800 -2900 -3000 -3100 -3200 - - diff --git a/gr-vocoder/lib/codec2/codec2.c b/gr-vocoder/lib/codec2/codec2.c deleted file mode 100644 index 93ea9208c..000000000 --- a/gr-vocoder/lib/codec2/codec2.c +++ /dev/null @@ -1,342 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: codec2.c - AUTHOR......: David Rowe - DATE CREATED: 21/8/2010 - - Codec2 fully quantised encoder and decoder functions. If you want use - codec2, the codec2_xxx functions are for you. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2010 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> - -#include "defines.h" -#include "sine.h" -#include "nlp.h" -#include "dump.h" -#include "lpc.h" -#include "quantise.h" -#include "phase.h" -#include "interp.h" -#include "postfilter.h" -#include "codec2.h" -#include "codec2_internal.h" - -/*---------------------------------------------------------------------------*\ - - FUNCTIONS - -\*---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: codec2_create - AUTHOR......: David Rowe - DATE CREATED: 21/8/2010 - - Create and initialise an instance of the codec. Returns a pointer - to the codec states or NULL on failure. One set of states is - sufficient for a full duuplex codec (i.e. an encoder and decoder). - You don't need separate states for encoders and decoders. See - c2enc.c and c2dec.c for examples. - -\*---------------------------------------------------------------------------*/ - -void *codec2_create() -{ - CODEC2 *c2; - int i,l; - - c2 = (CODEC2*)malloc(sizeof(CODEC2)); - if (c2 == NULL) - return NULL; - - for(i=0; i<M; i++) - c2->Sn[i] = 1.0; - c2->hpf_states[0] = c2->hpf_states[1] = 0.0; - for(i=0; i<2*N; i++) - c2->Sn_[i] = 0; - make_analysis_window(c2->w,c2->W); - make_synthesis_window(c2->Pn); - quantise_init(); - c2->prev_Wo = 0.0; - c2->bg_est = 0.0; - c2->ex_phase = 0.0; - - for(l=1; l<MAX_AMP; l++) - c2->prev_model.A[l] = 0.0; - c2->prev_model.Wo = TWO_PI/P_MAX; - c2->prev_model.L = PI/c2->prev_model.Wo; - c2->prev_model.voiced = 0; - - for(i=0; i<LPC_ORD; i++) { - c2->prev_lsps[i] = i*PI/(LPC_ORD+1); - } - c2->prev_energy = 1; - - c2->nlp = nlp_create(); - if (c2->nlp == NULL) { - free (c2); - return NULL; - } - - return (void*)c2; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: codec2_create - AUTHOR......: David Rowe - DATE CREATED: 21/8/2010 - - Destroy an instance of the codec. - -\*---------------------------------------------------------------------------*/ - -void codec2_destroy(void *codec2_state) -{ - CODEC2 *c2; - - assert(codec2_state != NULL); - c2 = (CODEC2*)codec2_state; - nlp_destroy(c2->nlp); - free(codec2_state); -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: codec2_encode - AUTHOR......: David Rowe - DATE CREATED: 21/8/2010 - - Encodes 160 speech samples (20ms of speech) into 51 bits. - - The codec2 algorithm actually operates internally on 10ms (80 - sample) frames, so we run the encoding algorithm twice. On the - first frame we just send the voicing bit. One the second frame we - send all model parameters. - - The bit allocation is: - - Parameter bits/frame - -------------------------------------- - Harmonic magnitudes (LSPs) 36 - Low frequency LPC correction 1 - Energy 5 - Wo (fundamental frequnecy) 7 - Voicing (10ms update) 2 - TOTAL 51 - -\*---------------------------------------------------------------------------*/ - -void codec2_encode(void *codec2_state, unsigned char * bits, short speech[]) -{ - CODEC2 *c2; - MODEL model; - int voiced1, voiced2; - int lsp_indexes[LPC_ORD]; - int energy_index; - int Wo_index; - int i; - unsigned int nbit = 0; - - assert(codec2_state != NULL); - c2 = (CODEC2*)codec2_state; - - /* first 10ms analysis frame - we just want voicing */ - - analyse_one_frame(c2, &model, speech); - voiced1 = model.voiced; - - /* second 10ms analysis frame */ - - analyse_one_frame(c2, &model, &speech[N]); - voiced2 = model.voiced; - - Wo_index = encode_Wo(model.Wo); - encode_amplitudes(lsp_indexes, - &energy_index, - &model, - c2->Sn, - c2->w); - memset(bits, '\0', ((CODEC2_BITS_PER_FRAME + 7) / 8)); - pack(bits, &nbit, Wo_index, WO_BITS); - for(i=0; i<LPC_ORD; i++) { - pack(bits, &nbit, lsp_indexes[i], lsp_bits(i)); - } - pack(bits, &nbit, energy_index, E_BITS); - pack(bits, &nbit, voiced1, 1); - pack(bits, &nbit, voiced2, 1); - - assert(nbit == CODEC2_BITS_PER_FRAME); -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: codec2_decode - AUTHOR......: David Rowe - DATE CREATED: 21/8/2010 - - Decodes frames of 51 bits into 160 samples (20ms) of speech. - -\*---------------------------------------------------------------------------*/ - -void codec2_decode(void *codec2_state, short speech[], - const unsigned char * bits) -{ - CODEC2 *c2; - MODEL model; - int voiced1, voiced2; - int lsp_indexes[LPC_ORD]; - float lsps[LPC_ORD]; - int energy_index; - float energy; - int Wo_index; - float ak[LPC_ORD+1]; - float ak_interp[LPC_ORD+1]; - int i; - unsigned int nbit = 0; - MODEL model_interp; - - assert(codec2_state != NULL); - c2 = (CODEC2*)codec2_state; - - /* unpack bit stream to integer codes */ - - Wo_index = unpack(bits, &nbit, WO_BITS); - for(i=0; i<LPC_ORD; i++) { - lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i)); - } - energy_index = unpack(bits, &nbit, E_BITS); - voiced1 = unpack(bits, &nbit, 1); - voiced2 = unpack(bits, &nbit, 1); - assert(nbit == CODEC2_BITS_PER_FRAME); - - /* decode integer codes to model parameters */ - - model.Wo = decode_Wo(Wo_index); - model.L = PI/model.Wo; - memset(&model.A, 0, (model.L+1)*sizeof(model.A[0])); - decode_amplitudes(&model, - ak, - lsp_indexes, - energy_index, - lsps, - &energy); - - model.voiced = voiced2; - model_interp.voiced = voiced1; - model_interp.Wo = P_MAX/2; - memset(&model_interp.A, 0, MAX_AMP*sizeof(model_interp.A[0])); - - /* interpolate middle frame's model parameters for adjacent frames */ - - interpolate_lsp(&model_interp, &c2->prev_model, &model, - c2->prev_lsps, c2->prev_energy, lsps, energy, ak_interp); - apply_lpc_correction(&model_interp); - - /* synthesis two 10ms frames */ - - synthesise_one_frame(c2, speech, &model_interp, ak_interp); - synthesise_one_frame(c2, &speech[N], &model, ak); - - /* update memories (decode states) for next time */ - - memcpy(&c2->prev_model, &model, sizeof(MODEL)); - memcpy(c2->prev_lsps, lsps, sizeof(lsps)); - c2->prev_energy = energy; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: synthesise_one_frame() - AUTHOR......: David Rowe - DATE CREATED: 23/8/2010 - - Synthesise 80 speech samples (10ms) from model parameters. - -\*---------------------------------------------------------------------------*/ - -void synthesise_one_frame(CODEC2 *c2, short speech[], MODEL *model, float ak[]) -{ - int i; - - phase_synth_zero_order(model, ak, &c2->ex_phase, LPC_ORD); - postfilter(model, &c2->bg_est); - synthesise(c2->Sn_, model, c2->Pn, 1); - - for(i=0; i<N; i++) { - if (c2->Sn_[i] > 32767.0) - speech[i] = 32767; - else if (c2->Sn_[i] < -32767.0) - speech[i] = -32767; - else - speech[i] = c2->Sn_[i]; - } - -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: analyse_one_frame() - AUTHOR......: David Rowe - DATE CREATED: 23/8/2010 - - Extract sinusoidal model parameters from 80 speech samples (10ms of - speech). - -\*---------------------------------------------------------------------------*/ - -void analyse_one_frame(CODEC2 *c2, MODEL *model, short speech[]) -{ - COMP Sw[FFT_ENC]; - COMP Sw_[FFT_ENC]; - COMP Ew[FFT_ENC]; - float pitch; - int i; - - /* Read input speech */ - - for(i=0; i<M-N; i++) - c2->Sn[i] = c2->Sn[i+N]; - for(i=0; i<N; i++) - c2->Sn[i+M-N] = speech[i]; - - dft_speech(Sw, c2->Sn, c2->w); - - /* Estimate pitch */ - - nlp(c2->nlp,c2->Sn,N,M,P_MIN,P_MAX,&pitch,Sw,&c2->prev_Wo); - model->Wo = TWO_PI/pitch; - model->L = PI/model->Wo; - - /* estimate model parameters */ - - two_stage_pitch_refinement(model, Sw); - estimate_amplitudes(model, Sw, c2->W); - est_voicing_mbe(model, Sw, c2->W, Sw_, Ew, c2->prev_Wo); - - c2->prev_Wo = model->Wo; -} diff --git a/gr-vocoder/lib/codec2/codec2.h b/gr-vocoder/lib/codec2/codec2.h deleted file mode 100644 index 88e68814f..000000000 --- a/gr-vocoder/lib/codec2/codec2.h +++ /dev/null @@ -1,41 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: codec2.h - AUTHOR......: David Rowe - DATE CREATED: 21/8/2010 - - Codec2 fully quantised encoder and decoder functions. If you want use - codec2, these are the functions you need to call. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2010 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __CODEC2__ -#define __CODEC2__ - -#define CODEC2_SAMPLES_PER_FRAME 160 -#define CODEC2_BITS_PER_FRAME 50 - -void *codec2_create(); -void codec2_destroy(void *codec2_state); -void codec2_encode(void *codec2_state, unsigned char * bits, short speech_in[]); -void codec2_decode(void *codec2_state, short speech_out[], - const unsigned char * bits); - -#endif diff --git a/gr-vocoder/lib/codec2/codec2_internal.h b/gr-vocoder/lib/codec2/codec2_internal.h deleted file mode 100644 index 3aa5300b1..000000000 --- a/gr-vocoder/lib/codec2/codec2_internal.h +++ /dev/null @@ -1,63 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: codec2_internal.h - AUTHOR......: David Rowe - DATE CREATED: 22 March 2011 - - Some internal structures and states broken out here as they are useful for - testing and development. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2011 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __CODEC2_INTERNAL__ -#define __CODEC2_INTERNAL__ - -/*---------------------------------------------------------------------------*\ - - STATES - -\*---------------------------------------------------------------------------*/ - -typedef struct { - float w[M]; /* time domain hamming window */ - COMP W[FFT_ENC]; /* DFT of w[] */ - float Pn[2*N]; /* trapezoidal synthesis window */ - float Sn[M]; /* input speech */ - float hpf_states[2]; /* high pass filter states */ - void *nlp; /* pitch predictor states */ - float Sn_[2*N]; /* synthesised output speech */ - float ex_phase; /* excitation model phase track */ - float bg_est; /* background noise estimate for post filter */ - float prev_Wo; /* previous frame's pitch estimate */ - MODEL prev_model; /* previous frame's model parameters */ - float prev_lsps[LPC_ORD]; /* previous frame's LSPs */ - float prev_energy; /* previous frame's LPC energy */ -} CODEC2; - -/*---------------------------------------------------------------------------*\ - - FUNCTION HEADERS - -\*---------------------------------------------------------------------------*/ - -void analyse_one_frame(CODEC2 *c2, MODEL *model, short speech[]); -void synthesise_one_frame(CODEC2 *c2, short speech[], MODEL *model,float ak[]); - -#endif diff --git a/gr-vocoder/lib/codec2/comp.h b/gr-vocoder/lib/codec2/comp.h deleted file mode 100644 index ffc20c163..000000000 --- a/gr-vocoder/lib/codec2/comp.h +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: comp.h - AUTHOR......: David Rowe - DATE CREATED: 24/08/09 - - Complex number definition. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __COMP__ -#define __COMP__ - -/* Complex number */ - -typedef struct { - float real; - float imag; -} COMP; - -#endif diff --git a/gr-vocoder/lib/codec2/defines.h b/gr-vocoder/lib/codec2/defines.h deleted file mode 100644 index 75064fae1..000000000 --- a/gr-vocoder/lib/codec2/defines.h +++ /dev/null @@ -1,88 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: defines.h - AUTHOR......: David Rowe - DATE CREATED: 23/4/93 - - Defines and structures used throughout the codec. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __DEFINES__ -#define __DEFINES__ - -/*---------------------------------------------------------------------------*\ - - DEFINES - -\*---------------------------------------------------------------------------*/ - -/* General defines */ - -#define N 80 /* number of samples per frame */ -#define MAX_AMP 80 /* maximum number of harmonics */ -#define PI 3.141592654 /* mathematical constant */ -#define TWO_PI 6.283185307 /* mathematical constant */ -#define FS 8000 /* sample rate in Hz */ -#define MAX_STR 256 /* maximum string size */ - -#define NW 279 /* analysis window size */ -#define FFT_ENC 512 /* size of FFT used for encoder */ -#define FFT_DEC 512 /* size of FFT used in decoder */ -#define TW 40 /* Trapezoidal synthesis window overlap */ -#define V_THRESH 6.0 /* voicing threshold in dB */ -#define LPC_MAX 20 /* maximum LPC order */ -#define LPC_ORD 10 /* phase modelling LPC order */ - -/* Pitch estimation defines */ - -#define M 320 /* pitch analysis frame size */ -#define P_MIN 20 /* minimum pitch */ -#define P_MAX 160 /* maximum pitch */ - -/*---------------------------------------------------------------------------*\ - - TYPEDEFS - -\*---------------------------------------------------------------------------*/ - -/* Structure to hold model parameters for one frame */ - -typedef struct { - float Wo; /* fundamental frequency estimate in radians */ - int L; /* number of harmonics */ - float A[MAX_AMP]; /* amplitiude of each harmonic */ - float phi[MAX_AMP]; /* phase of each harmonic */ - int voiced; /* non-zero if this frame is voiced */ -} MODEL; - -/* describes each codebook */ - -struct lsp_codebook { - int k; /* dimension of vector */ - int log2m; /* number of bits in m */ - int m; /* elements in codebook */ - const float * cb; /* The elements */ -}; -extern const struct lsp_codebook lsp_cb[]; -extern const struct lsp_codebook lsp_cbd[]; -extern const struct lsp_codebook lsp_cbdvq[]; - -#endif diff --git a/gr-vocoder/lib/codec2/dump.c b/gr-vocoder/lib/codec2/dump.c deleted file mode 100644 index 1dc34c858..000000000 --- a/gr-vocoder/lib/codec2/dump.c +++ /dev/null @@ -1,469 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: dump.c - AUTHOR......: David Rowe - DATE CREATED: 25/8/09 - - Routines to dump data to text files for Octave analysis. - -\*---------------------------------------------------------------------------*/ - -/* - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "defines.h" -#include "comp.h" -#include "dump.h" -#include <assert.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <math.h> - -#ifdef DUMP -static int dumpon = 0; - -static FILE *fsn = NULL; -static FILE *fsw = NULL; -static FILE *few = NULL; -static FILE *fsw_ = NULL; -static FILE *fmodel = NULL; -static FILE *fqmodel = NULL; -static FILE *fpw = NULL; -static FILE *flsp = NULL; -static FILE *fphase = NULL; -static FILE *fphase_ = NULL; -static FILE *ffw = NULL; -static FILE *fe = NULL; -static FILE *fsq = NULL; -static FILE *fdec = NULL; -static FILE *fsnr = NULL; -static FILE *fak = NULL; -static FILE *fbg = NULL; -static FILE *fE = NULL; -static FILE *frk = NULL; -static FILE *fres = NULL; - -static char prefix[MAX_STR]; - -void dump_on(char p[]) { - dumpon = 1; - strcpy(prefix, p); -} - -void dump_off(){ - if (fsn != NULL) - fclose(fsn); - if (fsw != NULL) - fclose(fsw); - if (fsw_ != NULL) - fclose(fsw_); - if (few != NULL) - fclose(few); - if (fmodel != NULL) - fclose(fmodel); - if (fqmodel != NULL) - fclose(fqmodel); - if (fpw != NULL) - fclose(fpw); - if (flsp != NULL) - fclose(flsp); - if (fphase != NULL) - fclose(fphase); - if (fphase_ != NULL) - fclose(fphase_); - if (ffw != NULL) - fclose(ffw); - if (fe != NULL) - fclose(fe); - if (fsq != NULL) - fclose(fsq); - if (fdec != NULL) - fclose(fdec); - if (fsnr != NULL) - fclose(fsnr); - if (fak != NULL) - fclose(fak); - if (fbg != NULL) - fclose(fbg); - if (fE != NULL) - fclose(fE); - if (frk != NULL) - fclose(frk); - if (fres != NULL) - fclose(fres); -} - -void dump_Sn(float Sn[]) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fsn == NULL) { - sprintf(s,"%s_sn.txt", prefix); - fsn = fopen(s, "wt"); - assert(fsn != NULL); - } - - /* split across two lines to avoid max line length problems */ - /* reconstruct in Octave */ - - for(i=0; i<M/2; i++) - fprintf(fsn,"%f\t",Sn[i]); - fprintf(fsn,"\n"); - for(i=M/2; i<M; i++) - fprintf(fsn,"%f\t",Sn[i]); - fprintf(fsn,"\n"); -} - -void dump_Sw(COMP Sw[]) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fsw == NULL) { - sprintf(s,"%s_sw.txt", prefix); - fsw = fopen(s, "wt"); - assert(fsw != NULL); - } - - for(i=0; i<FFT_ENC/2; i++) - fprintf(fsw,"%f\t", - 10.0*log10(Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag)); - fprintf(fsw,"\n"); -} - -void dump_Sw_(COMP Sw_[]) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fsw_ == NULL) { - sprintf(s,"%s_sw_.txt", prefix); - fsw_ = fopen(s, "wt"); - assert(fsw_ != NULL); - } - - for(i=0; i<FFT_ENC/2; i++) - fprintf(fsw_,"%f\t", - 10.0*log10(Sw_[i].real*Sw_[i].real + Sw_[i].imag*Sw_[i].imag)); - fprintf(fsw_,"\n"); -} - -void dump_Ew(COMP Ew[]) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (few == NULL) { - sprintf(s,"%s_ew.txt", prefix); - few = fopen(s, "wt"); - assert(few != NULL); - } - - for(i=0; i<FFT_ENC/2; i++) - fprintf(few,"%f\t", - 10.0*log10(Ew[i].real*Ew[i].real + Ew[i].imag*Ew[i].imag)); - fprintf(few,"\n"); -} - -void dump_model(MODEL *model) { - int l; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fmodel == NULL) { - sprintf(s,"%s_model.txt", prefix); - fmodel = fopen(s, "wt"); - assert(fmodel != NULL); - } - - fprintf(fmodel,"%f\t%d\t", model->Wo, model->L); - for(l=1; l<=model->L; l++) - fprintf(fmodel,"%f\t",model->A[l]); - for(l=model->L+1; l<MAX_AMP; l++) - fprintf(fmodel,"0.0\t"); - fprintf(fmodel,"%d\t",model->voiced); - fprintf(fmodel,"\n"); -} - -void dump_quantised_model(MODEL *model) { - int l; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fqmodel == NULL) { - sprintf(s,"%s_qmodel.txt", prefix); - fqmodel = fopen(s, "wt"); - assert(fqmodel != NULL); - } - - fprintf(fqmodel,"%f\t%d\t", model->Wo, model->L); - for(l=1; l<=model->L; l++) - fprintf(fqmodel,"%f\t",model->A[l]); - for(l=model->L+1; l<MAX_AMP; l++) - fprintf(fqmodel,"0.0\t"); - fprintf(fqmodel,"\n"); -} - -void dump_resample(float w[], float A[], int n) { - int l; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fres == NULL) { - sprintf(s,"%s_res.txt", prefix); - fres = fopen(s, "wt"); - assert(fres != NULL); - } - - fprintf(fres,"%d\t",n); - for(l=0; l<n; l++) - fprintf(fres,"%f\t",w[l]); - for(l=0; l<n; l++) - fprintf(fres,"%f\t",A[l]); - fprintf(fres,"\n"); -} - -void dump_phase(float phase[], int L) { - int l; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fphase == NULL) { - sprintf(s,"%s_phase.txt", prefix); - fphase = fopen(s, "wt"); - assert(fphase != NULL); - } - - for(l=1; l<=L; l++) - fprintf(fphase,"%f\t",phase[l]); - for(l=L+1; l<MAX_AMP; l++) - fprintf(fphase,"%f\t",0.0); - fprintf(fphase,"\n"); -} - -void dump_phase_(float phase_[], int L) { - int l; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fphase_ == NULL) { - sprintf(s,"%s_phase_.txt", prefix); - fphase_ = fopen(s, "wt"); - assert(fphase_ != NULL); - } - - for(l=1; l<=L; l++) - fprintf(fphase_,"%f\t",phase_[l]); - for(l=L+1; l<MAX_AMP; l++) - fprintf(fphase_,"%f\t",0.0); - fprintf(fphase_,"\n"); -} - -void dump_snr(float snr) { - char s[MAX_STR]; - - if (!dumpon) return; - - if (fsnr == NULL) { - sprintf(s,"%s_snr.txt", prefix); - fsnr = fopen(s, "wt"); - assert(fsnr != NULL); - } - - fprintf(fsnr,"%f\n",snr); -} - -void dump_Pw(COMP Pw[]) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fpw == NULL) { - sprintf(s,"%s_pw.txt", prefix); - fpw = fopen(s, "wt"); - assert(fpw != NULL); - } - - for(i=0; i<FFT_DEC/2; i++) - fprintf(fpw,"%f\t",Pw[i].real); - fprintf(fpw,"\n"); -} - -void dump_lsp(float lsp[]) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (flsp == NULL) { - sprintf(s,"%s_lsp.txt", prefix); - flsp = fopen(s, "wt"); - assert(flsp != NULL); - } - - for(i=0; i<10; i++) - fprintf(flsp,"%f\t",lsp[i]); - fprintf(flsp,"\n"); -} - -void dump_ak(float ak[], int order) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fak == NULL) { - sprintf(s,"%s_ak.txt", prefix); - fak = fopen(s, "wt"); - assert(fak != NULL); - } - - for(i=0; i<=order; i++) - fprintf(fak,"%f\t",ak[i]); - fprintf(fak,"\n"); -} - -void dump_Fw(COMP Fw[]) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (ffw == NULL) { - sprintf(s,"%s_fw.txt", prefix); - ffw = fopen(s, "wt"); - assert(ffw != NULL); - } - - for(i=0; i<256; i++) - fprintf(ffw,"%f\t",Fw[i].real); - fprintf(ffw,"\n"); -} - -void dump_e(float e_hz[]) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fe == NULL) { - sprintf(s,"%s_e.txt", prefix); - fe = fopen(s, "wt"); - assert(fe != NULL); - } - - for(i=0; i<500/2; i++) - fprintf(fe,"%f\t",e_hz[i]); - fprintf(fe,"\n"); - for(i=500/2; i<500; i++) - fprintf(fe,"%f\t",e_hz[i]); - fprintf(fe,"\n"); -} - -void dump_sq(float sq[]) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fsq == NULL) { - sprintf(s,"%s_sq.txt", prefix); - fsq = fopen(s, "wt"); - assert(fsq != NULL); - } - - for(i=0; i<M/2; i++) - fprintf(fsq,"%f\t",sq[i]); - fprintf(fsq,"\n"); - for(i=M/2; i<M; i++) - fprintf(fsq,"%f\t",sq[i]); - fprintf(fsq,"\n"); -} - -void dump_dec(COMP Fw[]) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (fdec == NULL) { - sprintf(s,"%s_dec.txt", prefix); - fdec = fopen(s, "wt"); - assert(fdec != NULL); - } - - for(i=0; i<320/5; i++) - fprintf(fdec,"%f\t",Fw[i].real); - fprintf(fdec,"\n"); -} - -void dump_bg(float e, float bg_est, float percent_uv) { - char s[MAX_STR]; - - if (!dumpon) return; - - if (fbg == NULL) { - sprintf(s,"%s_bg.txt", prefix); - fbg = fopen(s, "wt"); - assert(fbg != NULL); - } - - fprintf(fbg,"%f\t%f\t%f\n", e, bg_est, percent_uv); -} - -void dump_E(float E) { - char s[MAX_STR]; - - if (!dumpon) return; - - if (fE == NULL) { - sprintf(s,"%s_E.txt", prefix); - fE = fopen(s, "wt"); - assert(fE != NULL); - } - - fprintf(fE,"%f\n", 10.0*log10(E)); -} - -void dump_Rk(float Rk[]) { - int i; - char s[MAX_STR]; - - if (!dumpon) return; - - if (frk == NULL) { - sprintf(s,"%s_rk.txt", prefix); - frk = fopen(s, "wt"); - assert(frk != NULL); - } - - for(i=0; i<P_MAX; i++) - fprintf(frk,"%f\t",Rk[i]); - fprintf(frk,"\n"); -} - -#endif diff --git a/gr-vocoder/lib/codec2/dump.h b/gr-vocoder/lib/codec2/dump.h deleted file mode 100644 index 4b92d009d..000000000 --- a/gr-vocoder/lib/codec2/dump.h +++ /dev/null @@ -1,67 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: dump.h - AUTHOR......: David Rowe - DATE CREATED: 25/8/09 - - Routines to dump data to text files for Octave analysis. - -\*---------------------------------------------------------------------------*/ - -/* - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __DUMP__ -#define __DUMP__ - -#include "comp.h" - -void dump_on(char filename_prefix[]); -void dump_off(); - -void dump_Sn(float Sn[]); -void dump_Sw(COMP Sw[]); -void dump_Sw_(COMP Sw_[]); -void dump_Ew(COMP Ew[]); - -/* amplitude modelling */ - -void dump_model(MODEL *m); -void dump_quantised_model(MODEL *m); -void dump_Pw(COMP Pw[]); -void dump_lsp(float lsp[]); -void dump_ak(float ak[], int order); -void dump_E(float E); -void dump_resample(float w[], float A[], int n); - -/* phase modelling */ - -void dump_snr(float snr); -void dump_phase(float phase[], int L); -void dump_phase_(float phase[], int L); - -/* NLP states */ - -void dump_sq(float sq[]); -void dump_dec(COMP Fw[]); -void dump_Fw(COMP Fw[]); -void dump_e(float e_hz[]); -void dump_Rk(float Rk[]); - -/* post filter */ - -void dump_bg(float e, float bg_est, float percent_uv); - -#endif diff --git a/gr-vocoder/lib/codec2/fft.c b/gr-vocoder/lib/codec2/fft.c deleted file mode 100644 index 19f3141a8..000000000 --- a/gr-vocoder/lib/codec2/fft.c +++ /dev/null @@ -1,101 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: fft.c - AUTHOR......: Bruce Robertson - DATE CREATED: 20/11/2010 - - Bridging function to the kiss_fft package. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2010 Bruce Robertson - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include <assert.h> -#include "kiss_fft.h" - -/*---------------------------------------------------------------------------*\ - - GLOBALS - -\*---------------------------------------------------------------------------*/ - -kiss_fft_cpx *fin; -kiss_fft_cpx *fout; -kiss_fft_cfg cfg_forward; -kiss_fft_cfg cfg_reverse; - -/*---------------------------------------------------------------------------*\ - - initialize_fft(int n) - - Initialisation function for kiss_fft. This assumes that all calls to fft() - use the same datatypes and are one arrays of the same size. - -\*---------------------------------------------------------------------------*/ - -void -initialize_fft (int n) -{ - fin = KISS_FFT_MALLOC (n * sizeof (kiss_fft_cpx)); - assert(fin != NULL); - fout = KISS_FFT_MALLOC (n * sizeof (kiss_fft_cpx)); - assert(fout != NULL); - cfg_forward = kiss_fft_alloc (n, 0, NULL, NULL); - assert(cfg_forward != NULL); - cfg_reverse = kiss_fft_alloc (n, 1, NULL, NULL); - assert(cfg_reverse != NULL); -} - -/*---------------------------------------------------------------------------*\ - - fft(float x[], int n, int isign) - Function that calls kiss_fft with the signature of four1 from NRC. - -\*---------------------------------------------------------------------------*/ - - -void -fft (float x[], int n, int isign) -{ - //int isReverse = 0; // never used - int c; - kiss_fft_cfg cfg; - if (cfg_forward == NULL) - { - initialize_fft (n); - } - for (c = 0; c < n * 2; c += 2) - { - fin[c / 2].r = x[c]; - fin[c / 2].i = -x[c + 1]; - } - if (isign == -1) - { - cfg = cfg_reverse; - } - else - { - cfg = cfg_forward; - } - kiss_fft (cfg, fin, fout); - for (c = 0; c < n * 2; c += 2) - { - x[c] = fout[(c) / 2].r; - x[c + 1] = -fout[(c) / 2].i; - } -} diff --git a/gr-vocoder/lib/codec2/fft.h b/gr-vocoder/lib/codec2/fft.h deleted file mode 100644 index d5f83045e..000000000 --- a/gr-vocoder/lib/codec2/fft.h +++ /dev/null @@ -1,16 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: fft.h - AUTHOR......: Bruce Robertson - DATE CREATED: 29/11/2010 - - Bridge between existing code and kiss_fft. - -\*---------------------------------------------------------------------------*/ - -#ifndef __FFT__ -#define __FFT__ -void fft(float x[], int n, int isign); - -#endif /* __FFT__ */ - diff --git a/gr-vocoder/lib/codec2/fq20.sh b/gr-vocoder/lib/codec2/fq20.sh deleted file mode 100755 index 9ccf739dc..000000000 --- a/gr-vocoder/lib/codec2/fq20.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# fq20.shsh -# David Rowe 27 July 2010 -# -# Decode a file with fully quantised codec at 20ms frame rate - -../src/sinedec ../raw/$1.raw $1.mdl -o $1_phase0_lsp_20_EWo2.raw --phase 0 --lpc 10 --lsp --postfilter --dec - diff --git a/gr-vocoder/lib/codec2/generate_codebook.c b/gr-vocoder/lib/codec2/generate_codebook.c deleted file mode 100644 index 705f29d38..000000000 --- a/gr-vocoder/lib/codec2/generate_codebook.c +++ /dev/null @@ -1,179 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: generate_codebook.c - AUTHOR......: Bruce Perens - DATE CREATED: 29 Sep 2010 - - Generate header files containing LSP quantisers, runs at compile time. - -\*---------------------------------------------------------------------------*/ - -/* - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include <stdlib.h> -#include <stdio.h> -#include <ctype.h> -#include <math.h> - -static const char usage[] = -"Usage: %s filename array_name [filename ...]\n" -"\tCreate C code for codebook tables.\n"; - -static const char format[] = -"The table format must be:\n" -"\tTwo integers describing the dimensions of the codebook.\n" -"\tThen, enough numbers to fill the specified dimensions.\n"; - -static const char header[] = -"/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */\n\n" -"/*\n" -" * This intermediary file and the files that used to create it are under \n" -" * The LGPL. See the file COPYING.\n" -" */\n\n" -"#include \"defines.h\"\n\n"; - -struct codebook { - unsigned int k; - unsigned int log2m; - unsigned int m; - float * cb; -}; - -static void -dump_array(const struct codebook * b, int index) -{ - int limit = b->k * b->m; - int i; - - printf("static const float codes%d[] = {\n", index); - for ( i = 0; i < limit; i++ ) { - printf(" %g", b->cb[i]); - if ( i < limit - 1 ) - printf(","); - - /* organise VQs by rows, looks prettier */ - if ( ((i+1) % b->k) == 0 ) - printf("\n"); - } - printf("};\n"); -} - -static void -dump_structure(const struct codebook * b, int index) -{ - printf(" {\n"); - printf(" %d,\n", b->k); - printf(" %g,\n", log(b->m) / log(2)); - printf(" %d,\n", b->m); - printf(" codes%d\n", index); - printf(" }"); -} - -float -get_float(FILE * in, const char * name, char * * cursor, char * buffer, - int size) -{ - for ( ; ; ) { - char * s = *cursor; - char c; - - while ( (c = *s) != '\0' && !isdigit(c) && c != '-' && c != '.' ) - s++; - - /* Comments start with "#" and continue to the end of the line. */ - if ( c != '\0' && c != '#' ) { - char * end = 0; - float f = 0; - - f = strtod(s, &end); - - if ( end != s ) - *cursor = end; - return f; - } - - if ( fgets(buffer, size, in) == NULL ) { - fprintf(stderr, "%s: Format error. %s\n", name, format); - exit(1); - } - *cursor = buffer; - } -} - -static struct codebook * -load(FILE * file, const char * name) -{ - char line[1024]; - char * cursor = line; - struct codebook * b = malloc(sizeof(struct codebook)); - int i; - int size; - - *cursor = '\0'; - - b->k = (int)get_float(file, name, &cursor, line, sizeof(line)); - b->m = (int)get_float(file, name ,&cursor, line, sizeof(line)); - size = b->k * b->m; - - b->cb = (float *)malloc(size * sizeof(float)); - - for ( i = 0; i < size; i++ ) - b->cb[i] = get_float(file, name, &cursor, line, sizeof(line)); - - return b; -} - -int -main(int argc, char * * argv) -{ - struct codebook * * cb = malloc(argc * sizeof(struct codebook *)); - int i; - - if ( argc < 2 ) { - fprintf(stderr, usage, argv[0]); - fprintf(stderr, format); - exit(1); - } - - for ( i = 0; i < argc - 2; i++ ) { - FILE * in = fopen(argv[i + 2], "r"); - - if ( in == NULL ) { - perror(argv[i + 2]); - exit(1); - } - - cb[i] = load(in, argv[i + 2]); - - fclose(in); - } - - printf(header); - for ( i = 0; i < argc - 2; i++ ) { - printf(" /* %s */\n", argv[i + 2]); - dump_array(cb[i], i); - } - printf("\nconst struct lsp_codebook %s[] = {\n", argv[1]); - for ( i = 0; i < argc - 2; i++ ) { - printf(" /* %s */\n", argv[i + 2]); - dump_structure(cb[i], i); - printf(",\n"); - } - printf(" { 0, 0, 0, 0 }\n"); - printf("};\n"); - - return 0; -} diff --git a/gr-vocoder/lib/codec2/globals.c b/gr-vocoder/lib/codec2/globals.c deleted file mode 100644 index da2faf722..000000000 --- a/gr-vocoder/lib/codec2/globals.c +++ /dev/null @@ -1,49 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: globals.c - AUTHOR......: David Rowe - DATE CREATED: 11/5/94 - - Globals for sinusoidal speech coder. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "sine.h" /* global defines for coder */ - -/* Globals used in encoder and decoder */ - -int frames; /* number of frames processed so far */ -float Sn[M]; /* float input speech samples */ -MODEL model; /* model parameters for the current frame */ -int Nw; /* number of samples in analysis window */ -float sig; /* energy of current frame */ - -/* Globals used in encoder */ - -float w[M]; /* time domain hamming window */ -COMP W[FFT_ENC]; /* DFT of w[] */ -COMP Sw[FFT_ENC]; /* DFT of current frame */ - -/* Globals used in decoder */ - -COMP Sw_[FFT_ENC]; /* DFT of all voiced synthesised signal */ -float Sn_[AW_DEC]; /* synthesised speech */ -float Pn[AW_DEC]; /* time domain Parzen (trapezoidal) window */ - diff --git a/gr-vocoder/lib/codec2/globals.h b/gr-vocoder/lib/codec2/globals.h deleted file mode 100644 index d01e7b4e9..000000000 --- a/gr-vocoder/lib/codec2/globals.h +++ /dev/null @@ -1,47 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: globals.h - AUTHOR......: David Rowe - DATE CREATED: 1/11/94 - - Globals for sinusoidal speech coder. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -/* Globals used in encoder and decoder */ - -extern int frames; /* number of frames processed so far */ -extern float Sn[]; /* float input speech samples */ -extern MODEL model; /* model parameters for the current frame */ -extern int Nw; /* number of samples in analysis window */ -extern float sig; /* energy of current frame */ - -/* Globals used in encoder */ - -extern float w[]; /* time domain hamming window */ -extern COMP W[]; /* frequency domain hamming window */ -extern COMP Sw[]; /* DFT of current frame */ -extern COMP Sw_[]; /* DFT of all voiced synthesised signal */ - -/* Globals used in decoder */ - -extern float Sn_[]; /* output synthesised speech samples */ -extern float Pn[]; /* time domain Parzen (trapezoidal) window */ - diff --git a/gr-vocoder/lib/codec2/glottal.c b/gr-vocoder/lib/codec2/glottal.c deleted file mode 100644 index 8ac3ff4a9..000000000 --- a/gr-vocoder/lib/codec2/glottal.c +++ /dev/null @@ -1,257 +0,0 @@ -const float glottal[]={ - 0.000000, - -0.057687, - -0.115338, - -0.172917, - -0.230385, - -0.287707, - -0.344845, - -0.401762, - -0.458419, - -0.514781, - -0.570809, - -0.626467, - -0.681721, - -0.736537, - -0.790884, - -0.844733, - -0.898057, - -0.950834, - -1.003044, - -1.054670, - -1.105700, - -1.156124, - -1.205936, - -1.255132, - -1.303711, - -1.351675, - -1.399026, - -1.445769, - -1.491908, - -1.537448, - -1.582393, - -1.626747, - -1.670514, - -1.713693, - -1.756285, - -1.798288, - -1.839697, - -1.880507, - -1.920712, - -1.960302, - -1.999269, - -2.037603, - -2.075295, - -2.112335, - -2.148716, - -2.184430, - -2.219472, - -2.253839, - -2.287531, - -2.320550, - -2.352900, - -2.384588, - -2.415623, - -2.446019, - -2.475788, - -2.504946, - -2.533512, - -2.561501, - -2.588934, - -2.615827, - -2.642198, - -2.668064, - -2.693439, - -2.718337, - -2.742767, - -2.766738, - -2.790256, - -2.813322, - -2.835936, - -2.858094, - -2.879790, - -2.901016, - -2.921759, - -2.942008, - -2.961747, - -2.980961, - -2.999632, - -3.017745, - -3.035282, - -3.052228, - -3.068567, - -3.084285, - -3.099371, - -3.113813, - -3.127605, - -3.140738, - 3.129975, - 3.118167, - 3.107022, - 3.096537, - 3.086709, - 3.077531, - 3.068996, - 3.061096, - 3.053821, - 3.047159, - 3.041102, - 3.035636, - 3.030753, - 3.026441, - 3.022690, - 3.019491, - 3.016836, - 3.014718, - 3.013132, - 3.012072, - 3.011535, - 3.011521, - 3.012028, - 3.013057, - 3.014612, - 3.016695, - 3.019310, - 3.022463, - 3.026160, - 3.030407, - 3.035212, - 3.040580, - 3.046520, - 3.053038, - 3.060141, - 3.067836, - 3.076128, - 3.085023, - 3.094525, - 3.104639, - 3.115367, - 3.126712, - 3.138674, - -3.131930, - -3.118731, - -3.104915, - -3.090485, - -3.075444, - -3.059795, - -3.043543, - -3.026695, - -3.009254, - -2.991229, - -2.972625, - -2.953449, - -2.933710, - -2.913414, - -2.892567, - -2.871176, - -2.849248, - -2.826787, - -2.803798, - -2.780284, - -2.756247, - -2.731689, - -2.706609, - -2.681005, - -2.654875, - -2.628213, - -2.601015, - -2.573272, - -2.544977, - -2.516121, - -2.486694, - -2.456686, - -2.426084, - -2.394879, - -2.363060, - -2.330616, - -2.297538, - -2.263816, - -2.229444, - -2.194416, - -2.158727, - -2.122375, - -2.085359, - -2.047682, - -2.009347, - -1.970361, - -1.930732, - -1.890470, - -1.849587, - -1.808098, - -1.766017, - -1.723360, - -1.680145, - -1.636388, - -1.592105, - -1.547313, - -1.502025, - -1.456256, - -1.410016, - -1.363314, - -1.316157, - -1.268547, - -1.220486, - -1.171971, - -1.122997, - -1.073555, - -1.023636, - -0.973227, - -0.922312, - -0.870875, - -0.818899, - -0.766366, - -0.713257, - -0.659554, - -0.605242, - -0.550303, - -0.494723, - -0.438492, - -0.381598, - -0.324036, - -0.265800, - -0.206889, - -0.147303, - -0.087046, - -0.026121, - 0.035463, - 0.097698, - 0.160576, - 0.224087, - 0.288221, - 0.352969, - 0.418323, - 0.484276, - 0.550822, - 0.617958, - 0.685681, - 0.753991, - 0.822889, - 0.892378, - 0.962462, - 1.033144, - 1.104430, - 1.176325, - 1.248833, - 1.321956, - 1.395696, - 1.470051, - 1.545019, - 1.620593, - 1.696763, - 1.773516, - 1.850837, - 1.928705, - 2.007097, - 2.085987, - 2.165347, - 2.245145, - 2.325347, - 2.405919, - 2.486824, - 2.568025, - 2.649485, - 2.731167, - 2.813033, - 2.895045, - 2.977167, - 3.059362}; diff --git a/gr-vocoder/lib/codec2/interp.c b/gr-vocoder/lib/codec2/interp.c deleted file mode 100644 index 64372b050..000000000 --- a/gr-vocoder/lib/codec2/interp.c +++ /dev/null @@ -1,473 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: interp.c - AUTHOR......: David Rowe - DATE CREATED: 9/10/09 - - Interpolation of 20ms frames to 10ms frames. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include <assert.h> -#include <math.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -#include "defines.h" -#include "interp.h" -#include "lsp.h" -#include "quantise.h" -#include "dump.h" - -float sample_log_amp(MODEL *model, float w); - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: interp() - AUTHOR......: David Rowe - DATE CREATED: 22/8/10 - - Given two frames decribed by model parameters 20ms apart, determines - the model parameters of the 10ms frame between them. Assumes - voicing is available for middle (interpolated) frame. Outputs are - amplitudes and Wo for the interpolated frame. - - This version can interpolate the amplitudes between two frames of - different Wo and L. - - This version works by log linear interpolation, but listening tests - showed it creates problems in background noise, e.g. hts2a and mmt1. - When this function is used (--dec mode) bg noise appears to be - amplitude modulated, and gets louder. The interp_lsp() function - below seems to do a better job. - -\*---------------------------------------------------------------------------*/ - -void interpolate( - MODEL *interp, /* interpolated model params */ - MODEL *prev, /* previous frames model params */ - MODEL *next /* next frames model params */ -) -{ - int l; - float w,log_amp; - - /* Wo depends on voicing of this and adjacent frames */ - - if (interp->voiced) { - if (prev->voiced && next->voiced) - interp->Wo = (prev->Wo + next->Wo)/2.0; - if (!prev->voiced && next->voiced) - interp->Wo = next->Wo; - if (prev->voiced && !next->voiced) - interp->Wo = prev->Wo; - } - else { - interp->Wo = TWO_PI/P_MAX; - } - interp->L = PI/interp->Wo; - - /* Interpolate amplitudes using linear interpolation in log domain */ - - for(l=1; l<=interp->L; l++) { - w = l*interp->Wo; - log_amp = (sample_log_amp(prev, w) + sample_log_amp(next, w))/2.0; - interp->A[l] = pow(10.0, log_amp); - } -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: sample_log_amp() - AUTHOR......: David Rowe - DATE CREATED: 22/8/10 - - Samples the amplitude envelope at an arbitrary frequency w. Uses - linear interpolation in the log domain to sample between harmonic - amplitudes. - -\*---------------------------------------------------------------------------*/ - -float sample_log_amp(MODEL *model, float w) -{ - int m; - float f, log_amp; - - assert(w > 0.0); assert (w <= PI); - - m = 0; - while ((m+1)*model->Wo < w) m++; - f = (w - m*model->Wo)/model->Wo; - assert(f <= 1.0); - - if (m < 1) { - log_amp = f*log10(model->A[1] + 1E-6); - } - else if ((m+1) > model->L) { - log_amp = (1.0-f)*log10(model->A[model->L] + 1E-6); - } - else { - log_amp = (1.0-f)*log10(model->A[m] + 1E-6) + - f*log10(model->A[m+1] + 1E-6); - //printf("m=%d A[m] %f A[m+1] %f x %f %f %f\n", m, model->A[m], - // model->A[m+1], pow(10.0, log_amp), - // (1-f), f); - } - - return log_amp; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: sample_log_amp_quad() - AUTHOR......: David Rowe - DATE CREATED: 9 March 2011 - - Samples the amplitude envelope at an arbitrary frequency w. Uses - quadratic interpolation in the log domain to sample between harmonic - amplitudes. - - y(x) = ax*x + bx + c - - We assume three points are x=-1, x=0, x=1, which we map to m-1,m,m+1 - - c = y(0) - b = (y(1) - y(-1))/2 - a = y(-1) + b - y(0) - -\*---------------------------------------------------------------------------*/ - -float sample_log_amp_quad(MODEL *model, float w) -{ - int m; - float a,b,c,x, log_amp; - - assert(w > 0.0); assert (w <= PI); - - m = floor(w/model->Wo + 0.5); - if (m < 2) m = 2; - if (m > (model->L-1)) m = model->L-1; - c = log10(model->A[m]+1E-6); - b = (log10(model->A[m+1]+1E-6) - log10(model->A[m-1]+1E-6))/2.0; - a = log10(model->A[m-1]+1E-6) + b - c; - x = (w - m*model->Wo)/model->Wo; - - log_amp = a*x*x + b*x + c; - //printf("m=%d A[m-1] %f A[m] %f A[m+1] %f w %f x %f log_amp %f\n", m, - // model->A[m-1], - // model->A[m], model->A[m+1], w, x, pow(10.0, log_amp)); - return log_amp; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: sample_log_amp_quad_nl() - AUTHOR......: David Rowe - DATE CREATED: 10 March 2011 - - Samples the amplitude envelope at an arbitrary frequency w. Uses - quadratic interpolation in the log domain to sample between harmonic - amplitudes. This version can handle non-linear steps along a freq - axis defined by arbitrary steps. - - y(x) = ax*x + bx + c - - We assume three points are (x_1,y_1), (0,y0) and (x1,y1). - -\*---------------------------------------------------------------------------*/ - -float sample_log_amp_quad_nl( - float w[], /* frequency points */ - float A[], /* for these amplitude samples */ - int np, /* number of frequency points */ - float w_sample /* frequency of new samples */ -) -{ - int m,i; - float a,b,c,x, log_amp, best_dist; - float x_1, x1; - float y_1, y0, y1; - - //printf("w_sample %f\n", w_sample); - assert(w_sample >= 0.0); assert (w_sample <= 1.1*PI); - - /* find closest point to centre quadratic interpolator */ - - best_dist = 1E32; - for (i=0; i<np; i++) - if (fabs(w[i] - w_sample) < best_dist) { - best_dist = fabs(w[i] - w_sample); - m = i; - } - - /* stay one point away from edge of array */ - - if (m < 1) m = 1; - if (m > (np-2)) m = np - 2; - - /* find polynomial coeffs */ - - x_1 = w[m-1]- w[m]; x1 = w[m+1] - w[m]; - y_1 = log10(A[m-1]+1E-6); - y0 = log10(A[m]+1E-6); - y1 = log10(A[m+1]+1E-6); - - c = y0; - a = (y_1*x1 - y1*x_1 + c*x_1 - c*x1)/(x_1*x_1*x1 - x1*x1*x_1); - b = (y1 -a*x1*x1 - c)/x1; - x = w_sample - w[m]; - - //printf("%f %f %f\n", w[0], w[1], w[2]); - //printf("%f %f %f %f %f %f\n", x_1, y_1, 0.0, y0, x1, y1); - log_amp = a*x*x + b*x + c; - //printf("a %f b %f c %f\n", a, b, c); - //printf("m=%d A[m-1] %f A[m] %f A[m+1] %f w_sample %f w[m] %f x %f log_amp %f\n", m, - // A[m-1], - // A[m], A[m+1], w_sample, w[m], x, log_amp); - //exit(0); - return log_amp; -} - -#define M_MAX 40 - -float fres[] = {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, - 1200, 1400, 1600, 1850, 2100, 2350, 2600, 2900, 3400, 3800}; - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: resample_amp_nl() - AUTHOR......: David Rowe - DATE CREATED: 7 March 2011 - - Converts the current model with L {Am} samples spaced Wo apart to - RES_POINTS samples spaced Wo/RES_POINTS apart. Then subtracts - from the previous frames samples to get the delta. - -\*---------------------------------------------------------------------------*/ - -void resample_amp_fixed(MODEL *model, - float w[], float A[], - float wres[], float Ares[], - float AresdB_prev[], - float AresdB[], - float deltat[]) -{ - int i; - - for(i=1; i<=model->L; i++) { - w[i-1] = i*model->Wo; - A[i-1] = model->A[i]; - } - - for(i=0; i<RES_POINTS; i++) { - wres[i] = fres[i]*PI/4000.0; - } - - for(i=0; i<RES_POINTS; i++) { - Ares[i] = pow(10.0,sample_log_amp_quad_nl(w, A, model->L, wres[i])); - } - - /* work out delta T vector for this frame */ - - for(i=0; i<RES_POINTS; i++) { - AresdB[i] = 20.0*log10(Ares[i]); - deltat[i] = AresdB[i] - AresdB_prev[i]; - } - -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: resample_amp_nl() - AUTHOR......: David Rowe - DATE CREATED: 7 March 2011 - - Converts the current model with L {Am} samples spaced Wo apart to M - samples spaced Wo/M apart. Then converts back to L {Am} samples. - used to prototype constant rate Amplitude encoding ideas. - - Returns the SNR in dB. - -\*---------------------------------------------------------------------------*/ - -float resample_amp_nl(MODEL *model, int m, float AresdB_prev[]) -{ - int i; - float w[MAX_AMP], A[MAX_AMP]; - float wres[MAX_AMP], Ares[MAX_AMP], AresdB[MAX_AMP]; - float signal, noise, snr; - float new_A; - float deltat[MAX_AMP], deltat_q[MAX_AMP], AresdB_q[MAX_AMP]; - - resample_amp_fixed(model, w, A, wres, Ares, AresdB_prev, AresdB, deltat); - - /* quantise delta T vector */ - - for(i=0; i<RES_POINTS; i++) { - noise = 3.0*(1.0 - 2.0*rand()/RAND_MAX); - //noise = 0.0; - deltat_q[i] = deltat[i] + noise; - } - - /* recover Ares vector */ - - for(i=0; i<RES_POINTS; i++) { - AresdB_q[i] = AresdB_prev[i] + deltat_q[i]; - Ares[i] = pow(10.0, AresdB_q[i]/20.0); - //printf("%d %f %f\n", i, AresdB[i], AresdB_q[i]); - } - - /* update memory based on version at decoder */ - - for(i=0; i<RES_POINTS; i++) { - AresdB_prev[i] = AresdB_q[i]; - } - -#ifdef DUMP - dump_resample(wres,Ares,M_MAX); -#endif - - signal = noise = 0.0; - - for(i=1; i<model->L; i++) { - new_A = pow(10.0,sample_log_amp_quad_nl(wres, Ares, RES_POINTS, model->Wo*i)); - signal += pow(model->A[i], 2.0); - noise += pow(model->A[i] - new_A, 2.0); - //printf("%f %f\n", model->A[i], new_A); - model->A[i] = new_A; - } - - snr = 10.0*log10(signal/noise); - printf("snr = %3.2f\n", snr); - //exit(0); - return snr; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: resample_amp() - AUTHOR......: David Rowe - DATE CREATED: 10 March 2011 - - Converts the current model with L {Am} samples spaced Wo apart to M - samples with a non-linear spacing. Then converts back to L {Am} - samples. used to prototype constant rate Amplitude encoding ideas. - - Returns the SNR in dB. - -\*---------------------------------------------------------------------------*/ - -float resample_amp(MODEL *model, int m) -{ - int i; - MODEL model_m; - float new_A, signal, noise, snr, log_amp_dB; - float n_db = 0.0; - - model_m.Wo = PI/(float)m; - model_m.L = PI/model_m.Wo; - - for(i=1; i<=model_m.L; i++) { - log_amp_dB = 20.0*sample_log_amp_quad(model, i*model_m.Wo); - log_amp_dB += n_db*(1.0 - 2.0*rand()/RAND_MAX); - model_m.A[i] = pow(10,log_amp_dB/20.0); - } - - //dump_resample(&model_m); - - signal = noise = 0.0; - - for(i=1; i<model->L/4; i++) { - new_A = pow(10,sample_log_amp_quad(&model_m, i*model->Wo)); - signal += pow(model->A[i], 2.0); - noise += pow(model->A[i] - new_A, 2.0); - //printf("%f %f\n", model->A[i], new_A); - model->A[i] = new_A; - } - - snr = 10.0*log10(signal/noise); - //printf("snr = %3.2f\n", snr); - //exit(0); - return snr; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: interp_lsp() - AUTHOR......: David Rowe - DATE CREATED: 10 Nov 2010 - - Given two frames decribed by model parameters 20ms apart, determines - the model parameters of the 10ms frame between them. Assumes - voicing is available for middle (interpolated) frame. Outputs are - amplitudes and Wo for the interpolated frame. - - This version uses interpolation of LSPs, seems to do a better job - with bg noise. - -\*---------------------------------------------------------------------------*/ - -void interpolate_lsp( - MODEL *interp, /* interpolated model params */ - MODEL *prev, /* previous frames model params */ - MODEL *next, /* next frames model params */ - float *prev_lsps, /* previous frames LSPs */ - float prev_e, /* previous frames LPC energy */ - float *next_lsps, /* next frames LSPs */ - float next_e, /* next frames LPC energy */ - float *ak_interp /* interpolated aks for this frame */ - ) -{ - //int l,i; - int i; - float lsps[LPC_ORD],e; - float snr; - - /* Wo depends on voicing of this and adjacent frames */ - - if (interp->voiced) { - if (prev->voiced && next->voiced) - interp->Wo = (prev->Wo + next->Wo)/2.0; - if (!prev->voiced && next->voiced) - interp->Wo = next->Wo; - if (prev->voiced && !next->voiced) - interp->Wo = prev->Wo; - } - else { - interp->Wo = TWO_PI/P_MAX; - } - interp->L = PI/interp->Wo; - - /* interpolate LSPs */ - - for(i=0; i<LPC_ORD; i++) { - lsps[i] = (prev_lsps[i] + next_lsps[i])/2.0; - } - - /* Interpolate LPC energy in log domain */ - - e = pow(10.0, (log10(prev_e) + log10(next_e))/2.0); - - /* convert back to amplitudes */ - - lsp_to_lpc(lsps, ak_interp, LPC_ORD); - aks_to_M2(ak_interp, LPC_ORD, interp, e, &snr, 0); -} diff --git a/gr-vocoder/lib/codec2/interp.h b/gr-vocoder/lib/codec2/interp.h deleted file mode 100644 index d50972614..000000000 --- a/gr-vocoder/lib/codec2/interp.h +++ /dev/null @@ -1,41 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: interp.h - AUTHOR......: David Rowe - DATE CREATED: 9/10/09 - - Interpolation of 20ms frames to 10ms frames. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __INTERP__ -#define __INTERP__ - -#define RES_POINTS 20 - -void interpolate(MODEL *interp, MODEL *prev, MODEL *next); -void interpolate_lsp(MODEL *interp, MODEL *prev, MODEL *next, - float *prev_lsps, float prev_e, - float *next_lsps, float next_e, - float *ak_interp); -float resample_amp(MODEL *model, int m); -float resample_amp_nl(MODEL *model, int m, float Ares_prev[]); - -#endif diff --git a/gr-vocoder/lib/codec2/kiss_fft.c b/gr-vocoder/lib/codec2/kiss_fft.c deleted file mode 100644 index 17b4e7211..000000000 --- a/gr-vocoder/lib/codec2/kiss_fft.c +++ /dev/null @@ -1,408 +0,0 @@ -/* -Copyright (c) 2003-2010, Mark Borgerding - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include "_kiss_fft_guts.h" -/* The guts header contains all the multiplication and addition macros that are defined for - fixed or floating point complex numbers. It also delares the kf_ internal functions. - */ - -static void kf_bfly2( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m - ) -{ - kiss_fft_cpx * Fout2; - kiss_fft_cpx * tw1 = st->twiddles; - kiss_fft_cpx t; - Fout2 = Fout + m; - do{ - C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2); - - C_MUL (t, *Fout2 , *tw1); - tw1 += fstride; - C_SUB( *Fout2 , *Fout , t ); - C_ADDTO( *Fout , t ); - ++Fout2; - ++Fout; - }while (--m); -} - -static void kf_bfly4( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - const size_t m - ) -{ - kiss_fft_cpx *tw1,*tw2,*tw3; - kiss_fft_cpx scratch[6]; - size_t k=m; - const size_t m2=2*m; - const size_t m3=3*m; - - - tw3 = tw2 = tw1 = st->twiddles; - - do { - C_FIXDIV(*Fout,4); C_FIXDIV(Fout[m],4); C_FIXDIV(Fout[m2],4); C_FIXDIV(Fout[m3],4); - - C_MUL(scratch[0],Fout[m] , *tw1 ); - C_MUL(scratch[1],Fout[m2] , *tw2 ); - C_MUL(scratch[2],Fout[m3] , *tw3 ); - - C_SUB( scratch[5] , *Fout, scratch[1] ); - C_ADDTO(*Fout, scratch[1]); - C_ADD( scratch[3] , scratch[0] , scratch[2] ); - C_SUB( scratch[4] , scratch[0] , scratch[2] ); - C_SUB( Fout[m2], *Fout, scratch[3] ); - tw1 += fstride; - tw2 += fstride*2; - tw3 += fstride*3; - C_ADDTO( *Fout , scratch[3] ); - - if(st->inverse) { - Fout[m].r = scratch[5].r - scratch[4].i; - Fout[m].i = scratch[5].i + scratch[4].r; - Fout[m3].r = scratch[5].r + scratch[4].i; - Fout[m3].i = scratch[5].i - scratch[4].r; - }else{ - Fout[m].r = scratch[5].r + scratch[4].i; - Fout[m].i = scratch[5].i - scratch[4].r; - Fout[m3].r = scratch[5].r - scratch[4].i; - Fout[m3].i = scratch[5].i + scratch[4].r; - } - ++Fout; - }while(--k); -} - -static void kf_bfly3( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - size_t m - ) -{ - size_t k=m; - const size_t m2 = 2*m; - kiss_fft_cpx *tw1,*tw2; - kiss_fft_cpx scratch[5]; - kiss_fft_cpx epi3; - epi3 = st->twiddles[fstride*m]; - - tw1=tw2=st->twiddles; - - do{ - C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); - - C_MUL(scratch[1],Fout[m] , *tw1); - C_MUL(scratch[2],Fout[m2] , *tw2); - - C_ADD(scratch[3],scratch[1],scratch[2]); - C_SUB(scratch[0],scratch[1],scratch[2]); - tw1 += fstride; - tw2 += fstride*2; - - Fout[m].r = Fout->r - HALF_OF(scratch[3].r); - Fout[m].i = Fout->i - HALF_OF(scratch[3].i); - - C_MULBYSCALAR( scratch[0] , epi3.i ); - - C_ADDTO(*Fout,scratch[3]); - - Fout[m2].r = Fout[m].r + scratch[0].i; - Fout[m2].i = Fout[m].i - scratch[0].r; - - Fout[m].r -= scratch[0].i; - Fout[m].i += scratch[0].r; - - ++Fout; - }while(--k); -} - -static void kf_bfly5( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m - ) -{ - kiss_fft_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4; - int u; - kiss_fft_cpx scratch[13]; - kiss_fft_cpx * twiddles = st->twiddles; - kiss_fft_cpx *tw; - kiss_fft_cpx ya,yb; - ya = twiddles[fstride*m]; - yb = twiddles[fstride*2*m]; - - Fout0=Fout; - Fout1=Fout0+m; - Fout2=Fout0+2*m; - Fout3=Fout0+3*m; - Fout4=Fout0+4*m; - - tw=st->twiddles; - for ( u=0; u<m; ++u ) { - C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5); - scratch[0] = *Fout0; - - C_MUL(scratch[1] ,*Fout1, tw[u*fstride]); - C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]); - C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]); - C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]); - - C_ADD( scratch[7],scratch[1],scratch[4]); - C_SUB( scratch[10],scratch[1],scratch[4]); - C_ADD( scratch[8],scratch[2],scratch[3]); - C_SUB( scratch[9],scratch[2],scratch[3]); - - Fout0->r += scratch[7].r + scratch[8].r; - Fout0->i += scratch[7].i + scratch[8].i; - - scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r); - scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r); - - scratch[6].r = S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i); - scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i); - - C_SUB(*Fout1,scratch[5],scratch[6]); - C_ADD(*Fout4,scratch[5],scratch[6]); - - scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r); - scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r); - scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i); - scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i); - - C_ADD(*Fout2,scratch[11],scratch[12]); - C_SUB(*Fout3,scratch[11],scratch[12]); - - ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4; - } -} - -/* perform the butterfly for one stage of a mixed radix FFT */ -static void kf_bfly_generic( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m, - int p - ) -{ - int u,k,q1,q; - kiss_fft_cpx * twiddles = st->twiddles; - kiss_fft_cpx t; - int Norig = st->nfft; - - kiss_fft_cpx * scratch = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC(sizeof(kiss_fft_cpx)*p); - - for ( u=0; u<m; ++u ) { - k=u; - for ( q1=0 ; q1<p ; ++q1 ) { - scratch[q1] = Fout[ k ]; - C_FIXDIV(scratch[q1],p); - k += m; - } - - k=u; - for ( q1=0 ; q1<p ; ++q1 ) { - int twidx=0; - Fout[ k ] = scratch[0]; - for (q=1;q<p;++q ) { - twidx += fstride * k; - if (twidx>=Norig) twidx-=Norig; - C_MUL(t,scratch[q] , twiddles[twidx] ); - C_ADDTO( Fout[ k ] ,t); - } - k += m; - } - } - KISS_FFT_TMP_FREE(scratch); -} - -static -void kf_work( - kiss_fft_cpx * Fout, - const kiss_fft_cpx * f, - const size_t fstride, - int in_stride, - int * factors, - const kiss_fft_cfg st - ) -{ - kiss_fft_cpx * Fout_beg=Fout; - const int p=*factors++; /* the radix */ - const int m=*factors++; /* stage's fft length/p */ - const kiss_fft_cpx * Fout_end = Fout + p*m; - -#ifdef _OPENMP - // use openmp extensions at the - // top-level (not recursive) - if (fstride==1 && p<=5) - { - int k; - - // execute the p different work units in different threads -# pragma omp parallel for - for (k=0;k<p;++k) - kf_work( Fout +k*m, f+ fstride*in_stride*k,fstride*p,in_stride,factors,st); - // all threads have joined by this point - - switch (p) { - case 2: kf_bfly2(Fout,fstride,st,m); break; - case 3: kf_bfly3(Fout,fstride,st,m); break; - case 4: kf_bfly4(Fout,fstride,st,m); break; - case 5: kf_bfly5(Fout,fstride,st,m); break; - default: kf_bfly_generic(Fout,fstride,st,m,p); break; - } - return; - } -#endif - - if (m==1) { - do{ - *Fout = *f; - f += fstride*in_stride; - }while(++Fout != Fout_end ); - }else{ - do{ - // recursive call: - // DFT of size m*p performed by doing - // p instances of smaller DFTs of size m, - // each one takes a decimated version of the input - kf_work( Fout , f, fstride*p, in_stride, factors,st); - f += fstride*in_stride; - }while( (Fout += m) != Fout_end ); - } - - Fout=Fout_beg; - - // recombine the p smaller DFTs - switch (p) { - case 2: kf_bfly2(Fout,fstride,st,m); break; - case 3: kf_bfly3(Fout,fstride,st,m); break; - case 4: kf_bfly4(Fout,fstride,st,m); break; - case 5: kf_bfly5(Fout,fstride,st,m); break; - default: kf_bfly_generic(Fout,fstride,st,m,p); break; - } -} - -/* facbuf is populated by p1,m1,p2,m2, ... - where - p[i] * m[i] = m[i-1] - m0 = n */ -static -void kf_factor(int n,int * facbuf) -{ - int p=4; - double floor_sqrt; - floor_sqrt = floor( sqrt((double)n) ); - - /*factor out powers of 4, powers of 2, then any remaining primes */ - do { - while (n % p) { - switch (p) { - case 4: p = 2; break; - case 2: p = 3; break; - default: p += 2; break; - } - if (p > floor_sqrt) - p = n; /* no more factors, skip to end */ - } - n /= p; - *facbuf++ = p; - *facbuf++ = n; - } while (n > 1); -} - -/* - * - * User-callable function to allocate all necessary storage space for the fft. - * - * The return value is a contiguous block of memory, allocated with malloc. As such, - * It can be freed with free(), rather than a kiss_fft-specific function. - * */ -kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem ) -{ - kiss_fft_cfg st=NULL; - size_t memneeded = sizeof(struct kiss_fft_state) - + sizeof(kiss_fft_cpx)*(nfft-1); /* twiddle factors*/ - - if ( lenmem==NULL ) { - st = ( kiss_fft_cfg)KISS_FFT_MALLOC( memneeded ); - }else{ - if (mem != NULL && *lenmem >= memneeded) - st = (kiss_fft_cfg)mem; - *lenmem = memneeded; - } - if (st) { - int i; - st->nfft=nfft; - st->inverse = inverse_fft; - - for (i=0;i<nfft;++i) { - const double pi=3.141592653589793238462643383279502884197169399375105820974944; - double phase = -2*pi*i / nfft; - if (st->inverse) - phase *= -1; - kf_cexp(st->twiddles+i, phase ); - } - - kf_factor(nfft,st->factors); - } - return st; -} - - -void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride) -{ - if (fin == fout) { - //NOTE: this is not really an in-place FFT algorithm. - //It just performs an out-of-place FFT into a temp buffer - kiss_fft_cpx * tmpbuf = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC( sizeof(kiss_fft_cpx)*st->nfft); - kf_work(tmpbuf,fin,1,in_stride, st->factors,st); - memcpy(fout,tmpbuf,sizeof(kiss_fft_cpx)*st->nfft); - KISS_FFT_TMP_FREE(tmpbuf); - }else{ - kf_work( fout, fin, 1,in_stride, st->factors,st ); - } -} - -void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout) -{ - kiss_fft_stride(cfg,fin,fout,1); -} - - -void kiss_fft_cleanup(void) -{ - // nothing needed any more -} - -int kiss_fft_next_fast_size(int n) -{ - while(1) { - int m=n; - while ( (m%2) == 0 ) m/=2; - while ( (m%3) == 0 ) m/=3; - while ( (m%5) == 0 ) m/=5; - if (m<=1) - break; /* n is completely factorable by twos, threes, and fives */ - n++; - } - return n; -} diff --git a/gr-vocoder/lib/codec2/kiss_fft.h b/gr-vocoder/lib/codec2/kiss_fft.h deleted file mode 100644 index c01722cad..000000000 --- a/gr-vocoder/lib/codec2/kiss_fft.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef KISS_FFT_H -#define KISS_FFT_H - -#include <stdlib.h> -#include <stdio.h> -#include <math.h> -#include <string.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - ATTENTION! - If you would like a : - -- a utility that will handle the caching of fft objects - -- real-only (no imaginary time component ) FFT - -- a multi-dimensional FFT - -- a command-line utility to perform ffts - -- a command-line utility to perform fast-convolution filtering - - Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c - in the tools/ directory. -*/ - -#ifdef USE_SIMD -# include <xmmintrin.h> -# define kiss_fft_scalar __m128 -#define KISS_FFT_MALLOC(nbytes) _mm_malloc(nbytes,16) -#define KISS_FFT_FREE _mm_free -#else -#define KISS_FFT_MALLOC malloc -#define KISS_FFT_FREE free -#endif - - -#ifdef FIXED_POINT -#include <sys/types.h> -# if (FIXED_POINT == 32) -# define kiss_fft_scalar int32_t -# else -# define kiss_fft_scalar int16_t -# endif -#else -# ifndef kiss_fft_scalar -/* default is float */ -# define kiss_fft_scalar float -# endif -#endif - -typedef struct { - kiss_fft_scalar r; - kiss_fft_scalar i; -}kiss_fft_cpx; - -typedef struct kiss_fft_state* kiss_fft_cfg; - -/* - * kiss_fft_alloc - * - * Initialize a FFT (or IFFT) algorithm's cfg/state buffer. - * - * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL); - * - * The return value from fft_alloc is a cfg buffer used internally - * by the fft routine or NULL. - * - * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc. - * The returned value should be free()d when done to avoid memory leaks. - * - * The state can be placed in a user supplied buffer 'mem': - * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, - * then the function places the cfg in mem and the size used in *lenmem - * and returns mem. - * - * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough), - * then the function returns NULL and places the minimum cfg - * buffer size in *lenmem. - * */ - -kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); - -/* - * kiss_fft(cfg,in_out_buf) - * - * Perform an FFT on a complex input buffer. - * for a forward FFT, - * fin should be f[0] , f[1] , ... ,f[nfft-1] - * fout will be F[0] , F[1] , ... ,F[nfft-1] - * Note that each element is complex and can be accessed like - f[k].r and f[k].i - * */ -void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); - -/* - A more generic version of the above function. It reads its input from every Nth sample. - * */ -void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride); - -/* If kiss_fft_alloc allocated a buffer, it is one contiguous - buffer and can be simply free()d when no longer needed*/ -#define kiss_fft_free free - -/* - Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up - your compiler output to call this before you exit. -*/ -void kiss_fft_cleanup(void); - - -/* - * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5) - */ -int kiss_fft_next_fast_size(int n); - -/* for real ffts, we need an even size */ -#define kiss_fftr_next_fast_size_real(n) \ - (kiss_fft_next_fast_size( ((n)+1)>>1)<<1) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/gr-vocoder/lib/codec2/listensim.sh b/gr-vocoder/lib/codec2/listensim.sh deleted file mode 100755 index 0b27a1b0c..000000000 --- a/gr-vocoder/lib/codec2/listensim.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# listensim.sh -# David Rowe 10 Sep 2009 -# -# Listen to files processed with sim.sh - -../script/menu.sh ../raw/$1.raw $1_uq.raw $1_phase0.raw $1_lpc10.raw $1_phase0_lpc10.raw $1_phase0_lpc10_dec.raw $1_phase0_lsp_dec.raw $2 $3 - - diff --git a/gr-vocoder/lib/codec2/lpc.c b/gr-vocoder/lib/codec2/lpc.c deleted file mode 100644 index 1784f75ca..000000000 --- a/gr-vocoder/lib/codec2/lpc.c +++ /dev/null @@ -1,279 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: lpc.c - AUTHOR......: David Rowe - DATE CREATED: 30/9/90 - - Linear Prediction functions written in C. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#define LPC_MAX_N 512 /* maximum no. of samples in frame */ -#define PI 3.141592654 /* mathematical constant */ - -#include <assert.h> -#include <math.h> -#include "defines.h" -#include "lpc.h" - -/*---------------------------------------------------------------------------*\ - - hanning_window() - - Hanning windows a frame of speech samples. - -\*---------------------------------------------------------------------------*/ - -void hanning_window( - float Sn[], /* input frame of speech samples */ - float Wn[], /* output frame of windowed samples */ - int Nsam /* number of samples */ -) -{ - int i; /* loop variable */ - - for(i=0; i<Nsam; i++) - Wn[i] = Sn[i]*(0.5 - 0.5*cos(2*PI*(float)i/(Nsam-1))); -} - -/*---------------------------------------------------------------------------*\ - - autocorrelate() - - Finds the first P autocorrelation values of an array of windowed speech - samples Sn[]. - -\*---------------------------------------------------------------------------*/ - -void autocorrelate( - float Sn[], /* frame of Nsam windowed speech samples */ - float Rn[], /* array of P+1 autocorrelation coefficients */ - int Nsam, /* number of windowed samples to use */ - int order /* order of LPC analysis */ -) -{ - int i,j; /* loop variables */ - - for(j=0; j<order+1; j++) { - Rn[j] = 0.0; - for(i=0; i<Nsam-j; i++) - Rn[j] += Sn[i]*Sn[i+j]; - } -} - -/*---------------------------------------------------------------------------*\ - - autocorrelate_freq() - - Finds the first P autocorrelation values from an array of frequency domain - power samples. - -\*---------------------------------------------------------------------------*/ - -void autocorrelate_freq( - float Pw[], /* Nsam frequency domain power spectrum samples */ - float w[], /* frequency of each sample in Pw[] */ - float R[], /* array of order+1 autocorrelation coefficients */ - int Nsam, /* number of windowed samples to use */ - int order /* order of LPC analysis */ -) -{ - int i,j; /* loop variables */ - - for(j=0; j<order+1; j++) { - R[j] = 0.0; - for(i=0; i<Nsam; i++) - R[j] += Pw[i]*cos(j*w[i]); - } - R[j] /= Nsam; -} - -/*---------------------------------------------------------------------------*\ - - levinson_durbin() - - Given P+1 autocorrelation coefficients, finds P Linear Prediction Coeff. - (LPCs) where P is the order of the LPC all-pole model. The Levinson-Durbin - algorithm is used, and is described in: - - J. Makhoul - "Linear prediction, a tutorial review" - Proceedings of the IEEE - Vol-63, No. 4, April 1975 - -\*---------------------------------------------------------------------------*/ - -void levinson_durbin( - float R[], /* order+1 autocorrelation coeff */ - float lpcs[], /* order+1 LPC's */ - int order /* order of the LPC analysis */ -) -{ - float E[LPC_MAX+1]; - float k[LPC_MAX+1]; - float a[LPC_MAX+1][LPC_MAX+1]; - float sum; - int i,j; /* loop variables */ - - E[0] = R[0]; /* Equation 38a, Makhoul */ - - for(i=1; i<=order; i++) { - sum = 0.0; - for(j=1; j<=i-1; j++) - sum += a[i-1][j]*R[i-j]; - k[i] = -1.0*(R[i] + sum)/E[i-1]; /* Equation 38b, Makhoul */ - if (fabs(k[i]) > 1.0) - k[i] = 0.0; - - a[i][i] = k[i]; - - for(j=1; j<=i-1; j++) - a[i][j] = a[i-1][j] + k[i]*a[i-1][i-j]; /* Equation 38c, Makhoul */ - - E[i] = (1-k[i]*k[i])*E[i-1]; /* Equation 38d, Makhoul */ - } - - for(i=1; i<=order; i++) - lpcs[i] = a[order][i]; - lpcs[0] = 1.0; -} - -/*---------------------------------------------------------------------------*\ - - inverse_filter() - - Inverse Filter, A(z). Produces an array of residual samples from an array - of input samples and linear prediction coefficients. - - The filter memory is stored in the first order samples of the input array. - -\*---------------------------------------------------------------------------*/ - -void inverse_filter( - float Sn[], /* Nsam input samples */ - float a[], /* LPCs for this frame of samples */ - int Nsam, /* number of samples */ - float res[], /* Nsam residual samples */ - int order /* order of LPC */ -) -{ - int i,j; /* loop variables */ - - for(i=0; i<Nsam; i++) { - res[i] = 0.0; - for(j=0; j<=order; j++) - res[i] += Sn[i-j]*a[j]; - } -} - -/*---------------------------------------------------------------------------*\ - - synthesis_filter() - - C version of the Speech Synthesis Filter, 1/A(z). Given an array of - residual or excitation samples, and the the LP filter coefficients, this - function will produce an array of speech samples. This filter structure is - IIR. - - The synthesis filter has memory as well, this is treated in the same way - as the memory for the inverse filter (see inverse_filter() notes above). - The difference is that the memory for the synthesis filter is stored in - the output array, wheras the memory of the inverse filter is stored in the - input array. - - Note: the calling function must update the filter memory. - -\*---------------------------------------------------------------------------*/ - -void synthesis_filter( - float res[], /* Nsam input residual (excitation) samples */ - float a[], /* LPCs for this frame of speech samples */ - int Nsam, /* number of speech samples */ - int order, /* LPC order */ - float Sn_[] /* Nsam output synthesised speech samples */ -) -{ - int i,j; /* loop variables */ - - /* Filter Nsam samples */ - - for(i=0; i<Nsam; i++) { - Sn_[i] = res[i]*a[0]; - for(j=1; j<=order; j++) - Sn_[i] -= Sn_[i-j]*a[j]; - } -} - -/*---------------------------------------------------------------------------*\ - - find_aks() - - This function takes a frame of samples, and determines the linear - prediction coefficients for that frame of samples. - -\*---------------------------------------------------------------------------*/ - -void find_aks( - float Sn[], /* Nsam samples with order sample memory */ - float a[], /* order+1 LPCs with first coeff 1.0 */ - int Nsam, /* number of input speech samples */ - int order, /* order of the LPC analysis */ - float *E /* residual energy */ -) -{ - float Wn[LPC_MAX_N]; /* windowed frame of Nsam speech samples */ - float R[LPC_MAX+1]; /* order+1 autocorrelation values of Sn[] */ - int i; - - assert(order < LPC_MAX); - assert(Nsam < LPC_MAX_N); - - hanning_window(Sn,Wn,Nsam); - autocorrelate(Wn,R,Nsam,order); - levinson_durbin(R,a,order); - - *E = 0.0; - for(i=0; i<=order; i++) - *E += a[i]*R[i]; - if (*E < 0.0) - *E = 1E-12; -} - -/*---------------------------------------------------------------------------*\ - - weight() - - Weights a vector of LPCs. - -\*---------------------------------------------------------------------------*/ - -void weight( - float ak[], /* vector of order+1 LPCs */ - float gamma, /* weighting factor */ - int order, /* num LPCs (excluding leading 1.0) */ - float akw[] /* weighted vector of order+1 LPCs */ -) -{ - int i; - - for(i=1; i<=order; i++) - akw[i] = ak[i]*pow(gamma,(float)i); -} - diff --git a/gr-vocoder/lib/codec2/lpc.h b/gr-vocoder/lib/codec2/lpc.h deleted file mode 100644 index 9125189d1..000000000 --- a/gr-vocoder/lib/codec2/lpc.h +++ /dev/null @@ -1,42 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: lpc.h - AUTHOR......: David Rowe - DATE CREATED: 24/8/09 - - Linear Prediction functions written in C. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __LPC__ -#define __LPC__ - -#define LPC_MAX_ORDER 20 - -void hanning_window(float Sn[], float Wn[], int Nsam); -void autocorrelate(float Sn[], float Rn[], int Nsam, int order); -void autocorrelate_freq(float Pw[], float w[], float R[], int Nsam, int order); -void levinson_durbin(float R[], float lpcs[], int order); -void inverse_filter(float Sn[], float a[], int Nsam, float res[], int order); -void synthesis_filter(float res[], float a[], int Nsam, int order, float Sn_[]); -void find_aks(float Sn[], float a[], int Nsam, int order, float *E); -void weight(float ak[], float gamma, int order, float akw[]); - -#endif diff --git a/gr-vocoder/lib/codec2/lsp.c b/gr-vocoder/lib/codec2/lsp.c deleted file mode 100644 index b57507bb4..000000000 --- a/gr-vocoder/lib/codec2/lsp.c +++ /dev/null @@ -1,325 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: lsp.c - AUTHOR......: David Rowe - DATE CREATED: 24/2/93 - - - This file contains functions for LPC to LSP conversion and LSP to - LPC conversion. Note that the LSP coefficients are not in radians - format but in the x domain of the unit circle. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "defines.h" -#include "lsp.h" -#include <math.h> -#include <stdio.h> -#include <stdlib.h> - -/* Only 10 gets used, so far. */ -#define LSP_MAX_ORDER 20 - -/*---------------------------------------------------------------------------*\ - - Introduction to Line Spectrum Pairs (LSPs) - ------------------------------------------ - - LSPs are used to encode the LPC filter coefficients {ak} for - transmission over the channel. LSPs have several properties (like - less sensitivity to quantisation noise) that make them superior to - direct quantisation of {ak}. - - A(z) is a polynomial of order lpcrdr with {ak} as the coefficients. - - A(z) is transformed to P(z) and Q(z) (using a substitution and some - algebra), to obtain something like: - - A(z) = 0.5[P(z)(z+z^-1) + Q(z)(z-z^-1)] (1) - - As you can imagine A(z) has complex zeros all over the z-plane. P(z) - and Q(z) have the very neat property of only having zeros _on_ the - unit circle. So to find them we take a test point z=exp(jw) and - evaluate P (exp(jw)) and Q(exp(jw)) using a grid of points between 0 - and pi. - - The zeros (roots) of P(z) also happen to alternate, which is why we - swap coefficients as we find roots. So the process of finding the - LSP frequencies is basically finding the roots of 5th order - polynomials. - - The root so P(z) and Q(z) occur in symmetrical pairs at +/-w, hence - the name Line Spectrum Pairs (LSPs). - - To convert back to ak we just evaluate (1), "clocking" an impulse - thru it lpcrdr times gives us the impulse response of A(z) which is - {ak}. - -\*---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: cheb_poly_eva() - AUTHOR......: David Rowe - DATE CREATED: 24/2/93 - - This function evalutes a series of chebyshev polynomials - - FIXME: performing memory allocation at run time is very inefficient, - replace with stack variables of MAX_P size. - -\*---------------------------------------------------------------------------*/ - - -static float -cheb_poly_eva(float *coef,float x,int m) -/* float coef[] coefficients of the polynomial to be evaluated */ -/* float x the point where polynomial is to be evaluated */ -/* int m order of the polynomial */ -{ - int i; - float *t,*u,*v,sum; - float T[(LSP_MAX_ORDER / 2) + 1]; - - /* Initialise pointers */ - - t = T; /* T[i-2] */ - *t++ = 1.0; - u = t--; /* T[i-1] */ - *u++ = x; - v = u--; /* T[i] */ - - /* Evaluate chebyshev series formulation using iterative approach */ - - for(i=2;i<=m/2;i++) - *v++ = (2*x)*(*u++) - *t++; /* T[i] = 2*x*T[i-1] - T[i-2] */ - - sum=0.0; /* initialise sum to zero */ - t = T; /* reset pointer */ - - /* Evaluate polynomial and return value also free memory space */ - - for(i=0;i<=m/2;i++) - sum+=coef[(m/2)-i]**t++; - - return sum; -} - - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: lpc_to_lsp() - AUTHOR......: David Rowe - DATE CREATED: 24/2/93 - - This function converts LPC coefficients to LSP coefficients. - -\*---------------------------------------------------------------------------*/ - -int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta) -/* float *a lpc coefficients */ -/* int lpcrdr order of LPC coefficients (10) */ -/* float *freq LSP frequencies in radians */ -/* int nb number of sub-intervals (4) */ -/* float delta grid spacing interval (0.02) */ -{ - float psuml,psumr,psumm,temp_xr,xl,xr,xm = 0; - float temp_psumr; - int i,j,m,flag,k; - float *px; /* ptrs of respective P'(z) & Q'(z) */ - float *qx; - float *p; - float *q; - float *pt; /* ptr used for cheb_poly_eval() - whether P' or Q' */ - int roots=0; /* number of roots found */ - float Q[LSP_MAX_ORDER + 1]; - float P[LSP_MAX_ORDER + 1]; - - flag = 1; - m = lpcrdr/2; /* order of P'(z) & Q'(z) polynimials */ - - /* Allocate memory space for polynomials */ - - /* determine P'(z)'s and Q'(z)'s coefficients where - P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */ - - px = P; /* initilaise ptrs */ - qx = Q; - p = px; - q = qx; - *px++ = 1.0; - *qx++ = 1.0; - for(i=1;i<=m;i++){ - *px++ = a[i]+a[lpcrdr+1-i]-*p++; - *qx++ = a[i]-a[lpcrdr+1-i]+*q++; - } - px = P; - qx = Q; - for(i=0;i<m;i++){ - *px = 2**px; - *qx = 2**qx; - px++; - qx++; - } - px = P; /* re-initialise ptrs */ - qx = Q; - - /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z). - Keep alternating between the two polynomials as each zero is found */ - - xr = 0; /* initialise xr to zero */ - xl = 1.0; /* start at point xl = 1 */ - - - for(j=0;j<lpcrdr;j++){ - if(j%2) /* determines whether P' or Q' is eval. */ - pt = qx; - else - pt = px; - - psuml = cheb_poly_eva(pt,xl,lpcrdr); /* evals poly. at xl */ - flag = 1; - while(flag && (xr >= -1.0)){ - xr = xl - delta ; /* interval spacing */ - psumr = cheb_poly_eva(pt,xr,lpcrdr);/* poly(xl-delta_x) */ - temp_psumr = psumr; - temp_xr = xr; - - /* if no sign change increment xr and re-evaluate - poly(xr). Repeat til sign change. if a sign change has - occurred the interval is bisected and then checked again - for a sign change which determines in which interval the - zero lies in. If there is no sign change between poly(xm) - and poly(xl) set interval between xm and xr else set - interval between xl and xr and repeat till root is located - within the specified limits */ - - if((psumr*psuml)<0.0){ - roots++; - - psumm=psuml; - for(k=0;k<=nb;k++){ - xm = (xl+xr)/2; /* bisect the interval */ - psumm=cheb_poly_eva(pt,xm,lpcrdr); - if(psumm*psuml>0.){ - psuml=psumm; - xl=xm; - } - else{ - psumr=psumm; - xr=xm; - } - } - - /* once zero is found, reset initial interval to xr */ - freq[j] = (xm); - xl = xm; - flag = 0; /* reset flag for next search */ - } - else{ - psuml=temp_psumr; - xl=temp_xr; - } - } - } - - /* convert from x domain to radians */ - - for(i=0; i<lpcrdr; i++) { - freq[i] = acos(freq[i]); - } - - return(roots); -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: lsp_to_lpc() - AUTHOR......: David Rowe - DATE CREATED: 24/2/93 - - This function converts LSP coefficients to LPC coefficients. In the - Speex code we worked out a way to simplify this significantly. - -\*---------------------------------------------------------------------------*/ - -void lsp_to_lpc(float *lsp, float *ak, int lpcrdr) -/* float *freq array of LSP frequencies in radians */ -/* float *ak array of LPC coefficients */ -/* int lpcrdr order of LPC coefficients */ - - -{ - int i,j; - float xout1,xout2,xin1,xin2; - float *pw,*n1,*n2,*n3,*n4 = 0; - int m = lpcrdr/2; - float freq[LSP_MAX_ORDER]; - float Wp[(LSP_MAX_ORDER * 4) + 2]; - - /* convert from radians to the x=cos(w) domain */ - - for(i=0; i<lpcrdr; i++) - freq[i] = cos(lsp[i]); - - pw = Wp; - - /* initialise contents of array */ - - for(i=0;i<=4*m+1;i++){ /* set contents of buffer to 0 */ - *pw++ = 0.0; - } - - /* Set pointers up */ - - pw = Wp; - xin1 = 1.0; - xin2 = 1.0; - - /* reconstruct P(z) and Q(z) by cascading second order polynomials - in form 1 - 2xz(-1) +z(-2), where x is the LSP coefficient */ - - for(j=0;j<=lpcrdr;j++){ - for(i=0;i<m;i++){ - n1 = pw+(i*4); - n2 = n1 + 1; - n3 = n2 + 1; - n4 = n3 + 1; - xout1 = xin1 - 2*(freq[2*i]) * *n1 + *n2; - xout2 = xin2 - 2*(freq[2*i+1]) * *n3 + *n4; - *n2 = *n1; - *n4 = *n3; - *n1 = xin1; - *n3 = xin2; - xin1 = xout1; - xin2 = xout2; - } - xout1 = xin1 + *(n4+1); - xout2 = xin2 - *(n4+2); - ak[j] = (xout1 + xout2)*0.5; - *(n4+1) = xin1; - *(n4+2) = xin2; - - xin1 = 0.0; - xin2 = 0.0; - } -} - diff --git a/gr-vocoder/lib/codec2/lsp.h b/gr-vocoder/lib/codec2/lsp.h deleted file mode 100644 index 5acef0184..000000000 --- a/gr-vocoder/lib/codec2/lsp.h +++ /dev/null @@ -1,37 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: lsp.c - AUTHOR......: David Rowe - DATE CREATED: 24/2/93 - - - This file contains functions for LPC to LSP conversion and LSP to - LPC conversion. Note that the LSP coefficients are not in radians - format but in the x domain of the unit circle. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __LSP__ -#define __LSP__ - -int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta); -void lsp_to_lpc(float *freq, float *ak, int lpcrdr); - -#endif diff --git a/gr-vocoder/lib/codec2/nlp.c b/gr-vocoder/lib/codec2/nlp.c deleted file mode 100644 index 0d5e530ce..000000000 --- a/gr-vocoder/lib/codec2/nlp.c +++ /dev/null @@ -1,364 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: nlp.c - AUTHOR......: David Rowe - DATE CREATED: 23/3/93 - - Non Linear Pitch (NLP) estimation functions. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "defines.h" -#include "nlp.h" -#include "dump.h" -#include "fft.h" - -#include <assert.h> -#include <math.h> -#include <stdlib.h> - -/*---------------------------------------------------------------------------*\ - - DEFINES - -\*---------------------------------------------------------------------------*/ - -#define PMAX_M 600 /* maximum NLP analysis window size */ -#define COEFF 0.95 /* notch filter parameter */ -#define PE_FFT_SIZE 512 /* DFT size for pitch estimation */ -#define DEC 5 /* decimation factor */ -#define SAMPLE_RATE 8000 -#define PI 3.141592654 /* mathematical constant */ -#define T 0.1 /* threshold for local minima candidate */ -#define F0_MAX 500 -#define CNLP 0.3 /* post processor constant */ -#define NLP_NTAP 48 /* Decimation LPF order */ - -/*---------------------------------------------------------------------------*\ - - GLOBALS - -\*---------------------------------------------------------------------------*/ - -/* 48 tap 600Hz low pass FIR filter coefficients */ - -const float nlp_fir[] = { - -1.0818124e-03, - -1.1008344e-03, - -9.2768838e-04, - -4.2289438e-04, - 5.5034190e-04, - 2.0029849e-03, - 3.7058509e-03, - 5.1449415e-03, - 5.5924666e-03, - 4.3036754e-03, - 8.0284511e-04, - -4.8204610e-03, - -1.1705810e-02, - -1.8199275e-02, - -2.2065282e-02, - -2.0920610e-02, - -1.2808831e-02, - 3.2204775e-03, - 2.6683811e-02, - 5.5520624e-02, - 8.6305944e-02, - 1.1480192e-01, - 1.3674206e-01, - 1.4867556e-01, - 1.4867556e-01, - 1.3674206e-01, - 1.1480192e-01, - 8.6305944e-02, - 5.5520624e-02, - 2.6683811e-02, - 3.2204775e-03, - -1.2808831e-02, - -2.0920610e-02, - -2.2065282e-02, - -1.8199275e-02, - -1.1705810e-02, - -4.8204610e-03, - 8.0284511e-04, - 4.3036754e-03, - 5.5924666e-03, - 5.1449415e-03, - 3.7058509e-03, - 2.0029849e-03, - 5.5034190e-04, - -4.2289438e-04, - -9.2768838e-04, - -1.1008344e-03, - -1.0818124e-03 -}; - -typedef struct { - float sq[PMAX_M]; /* squared speech samples */ - float mem_x,mem_y; /* memory for notch filter */ - float mem_fir[NLP_NTAP]; /* decimation FIR filter memory */ -} NLP; - -float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax); -float post_process_sub_multiples(COMP Fw[], - int pmin, int pmax, float gmax, int gmax_bin, - float *prev_Wo); - -/*---------------------------------------------------------------------------*\ - - nlp_create() - - Initialisation function for NLP pitch estimator. - -\*---------------------------------------------------------------------------*/ - -void *nlp_create() -{ - NLP *nlp; - int i; - - nlp = (NLP*)malloc(sizeof(NLP)); - if (nlp == NULL) - return NULL; - - for(i=0; i<PMAX_M; i++) - nlp->sq[i] = 0.0; - nlp->mem_x = 0.0; - nlp->mem_y = 0.0; - for(i=0; i<NLP_NTAP; i++) - nlp->mem_fir[i] = 0.0; - - return (void*)nlp; -} - -/*---------------------------------------------------------------------------*\ - - nlp_destory() - - Initialisation function for NLP pitch estimator. - -\*---------------------------------------------------------------------------*/ - -void nlp_destroy(void *nlp_state) -{ - assert(nlp_state != NULL); - free(nlp_state); -} - -/*---------------------------------------------------------------------------*\ - - nlp() - - Determines the pitch in samples using the Non Linear Pitch (NLP) - algorithm [1]. Returns the fundamental in Hz. Note that the actual - pitch estimate is for the centre of the M sample Sn[] vector, not - the current N sample input vector. This is (I think) a delay of 2.5 - frames with N=80 samples. You should align further analysis using - this pitch estimate to be centred on the middle of Sn[]. - - Two post processors have been tried, the MBE version (as discussed - in [1]), and a post processor that checks sub-multiples. Both - suffer occasional gross pitch errors (i.e. neither are perfect). In - the presence of background noise the sub-multiple algorithm tends - towards low F0 which leads to better sounding background noise than - the MBE post processor. - - A good way to test and develop the NLP pitch estimator is using the - tnlp (codec2/unittest) and the codec2/octave/plnlp.m Octave script. - - A pitch tracker searching a few frames forward and backward in time - would be a useful addition. - - References: - - [1] http://www.itr.unisa.edu.au/~steven/thesis/dgr.pdf Chapter 4 - -\*---------------------------------------------------------------------------*/ - -float nlp( - void *nlp_state, - float Sn[], /* input speech vector */ - int n, /* frames shift (no. new samples in Sn[]) */ - int m, /* analysis window size */ - int pmin, /* minimum pitch value */ - int pmax, /* maximum pitch value */ - float *pitch, /* estimated pitch period in samples */ - COMP Sw[], /* Freq domain version of Sn[] */ - float *prev_Wo -) -{ - NLP *nlp; - float notch; /* current notch filter output */ - COMP Fw[PE_FFT_SIZE]; /* DFT of squared signal */ - float gmax; - int gmax_bin; - int i,j; - float best_f0; - - assert(nlp_state != NULL); - nlp = (NLP*)nlp_state; - - /* Square, notch filter at DC, and LP filter vector */ - - for(i=m-n; i<M; i++) /* square latest speech samples */ - nlp->sq[i] = Sn[i]*Sn[i]; - - for(i=m-n; i<m; i++) { /* notch filter at DC */ - notch = nlp->sq[i] - nlp->mem_x; - notch += COEFF*nlp->mem_y; - nlp->mem_x = nlp->sq[i]; - nlp->mem_y = notch; - nlp->sq[i] = notch; - } - - for(i=m-n; i<m; i++) { /* FIR filter vector */ - - for(j=0; j<NLP_NTAP-1; j++) - nlp->mem_fir[j] = nlp->mem_fir[j+1]; - nlp->mem_fir[NLP_NTAP-1] = nlp->sq[i]; - - nlp->sq[i] = 0.0; - for(j=0; j<NLP_NTAP; j++) - nlp->sq[i] += nlp->mem_fir[j]*nlp_fir[j]; - } - - /* Decimate and DFT */ - - for(i=0; i<PE_FFT_SIZE; i++) { - Fw[i].real = 0.0; - Fw[i].imag = 0.0; - } - for(i=0; i<m/DEC; i++) { - Fw[i].real = nlp->sq[i*DEC]*(0.5 - 0.5*cos(2*PI*i/(m/DEC-1))); - } -#ifdef DUMP - dump_dec(Fw); -#endif - fft(&Fw[0].real,PE_FFT_SIZE,1); - for(i=0; i<PE_FFT_SIZE; i++) - Fw[i].real = Fw[i].real*Fw[i].real + Fw[i].imag*Fw[i].imag; - -#ifdef DUMP - dump_sq(nlp->sq); - dump_Fw(Fw); -#endif - - /* find global peak */ - - gmax = 0.0; - gmax_bin = PE_FFT_SIZE*DEC/pmax; - for(i=PE_FFT_SIZE*DEC/pmax; i<=PE_FFT_SIZE*DEC/pmin; i++) { - if (Fw[i].real > gmax) { - gmax = Fw[i].real; - gmax_bin = i; - } - } - - best_f0 = post_process_sub_multiples(Fw, pmin, pmax, gmax, gmax_bin, - prev_Wo); - - /* Shift samples in buffer to make room for new samples */ - - for(i=0; i<m-n; i++) - nlp->sq[i] = nlp->sq[i+n]; - - /* return pitch and F0 estimate */ - - *pitch = (float)SAMPLE_RATE/best_f0; - return(best_f0); -} - -/*---------------------------------------------------------------------------*\ - - post_process_sub_multiples() - - Given the global maximma of Fw[] we search interger submultiples for - local maxima. If local maxima exist and they are above an - experimentally derived threshold (OK a magic number I pulled out of - the air) we choose the submultiple as the F0 estimate. - - The rational for this is that the lowest frequency peak of Fw[] - should be F0, as Fw[] can be considered the autocorrelation function - of Sw[] (the speech spectrum). However sometimes due to phase - effects the lowest frequency maxima may not be the global maxima. - - This works OK in practice and favours low F0 values in the presence - of background noise which means the sinusoidal codec does an OK job - of synthesising the background noise. High F0 in background noise - tends to sound more periodic introducing annoying artifacts. - -\*---------------------------------------------------------------------------*/ - -float post_process_sub_multiples(COMP Fw[], - int pmin, int pmax, float gmax, int gmax_bin, - float *prev_Wo) -{ - int min_bin, cmax_bin; - int mult; - float thresh, best_f0; - int b, bmin, bmax, lmax_bin; - float lmax, cmax; - int prev_f0_bin; - - /* post process estimate by searching submultiples */ - - mult = 2; - min_bin = PE_FFT_SIZE*DEC/pmax; - cmax_bin = gmax_bin; - prev_f0_bin = *prev_Wo*(4000.0/PI)*(PE_FFT_SIZE*DEC)/SAMPLE_RATE; - - while(gmax_bin/mult >= min_bin) { - - b = gmax_bin/mult; /* determine search interval */ - bmin = 0.8*b; - bmax = 1.2*b; - if (bmin < min_bin) - bmin = min_bin; - - /* lower threshold to favour previous frames pitch estimate, - this is a form of pitch tracking */ - - if ((prev_f0_bin > bmin) && (prev_f0_bin < bmax)) - thresh = CNLP*0.5*gmax; - else - thresh = CNLP*gmax; - - lmax = 0; - lmax_bin = bmin; - for (b=bmin; b<=bmax; b++) /* look for maximum in interval */ - if (Fw[b].real > lmax) { - lmax = Fw[b].real; - lmax_bin = b; - } - - if (lmax > thresh) - if ((lmax > Fw[lmax_bin-1].real) && (lmax > Fw[lmax_bin+1].real)) { - cmax = lmax; - cmax_bin = lmax_bin; - } - - mult++; - } - - best_f0 = (float)cmax_bin*SAMPLE_RATE/(PE_FFT_SIZE*DEC); - - return best_f0; -} - diff --git a/gr-vocoder/lib/codec2/nlp.h b/gr-vocoder/lib/codec2/nlp.h deleted file mode 100644 index 5e11f1186..000000000 --- a/gr-vocoder/lib/codec2/nlp.h +++ /dev/null @@ -1,39 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: nlp.c - AUTHOR......: David Rowe - DATE CREATED: 23/3/93 - - Non Linear Pitch (NLP) estimation functions. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __NLP__ -#define __NLP__ - -#include "comp.h" - -void *nlp_create(); -void nlp_destroy(void *nlp_state); -float nlp(void *nlp_state, float Sn[], int n, int m, int pmin, int pmax, - float *pitch, COMP Sw[], float *prev_Wo); -float test_candidate_mbe(COMP Sw[], float f0, COMP Sw_[]); - -#endif diff --git a/gr-vocoder/lib/codec2/pack.c b/gr-vocoder/lib/codec2/pack.c deleted file mode 100644 index e04c9378c..000000000 --- a/gr-vocoder/lib/codec2/pack.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright (C) 2010 Perens LLC <bruce@perens.com> - - 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/>. - - */ -#include "defines.h" -#include "quantise.h" -#include <stdio.h> - -/* Compile-time constants */ -/* Size of unsigned char in bits. Assumes 8 bits-per-char. */ -static const unsigned int WordSize = 8; - -/* Mask to pick the bit component out of bitIndex. */ -static const unsigned int IndexMask = 0x7; - -/* Used to pick the word component out of bitIndex. */ -static const unsigned int ShiftRight = 3; - -/** Pack a bit field into a bit string, encoding the field in Gray code. - * - * The output is an array of unsigned char data. The fields are efficiently - * packed into the bit string. The Gray coding is a naive attempt to reduce - * the effect of single-bit errors, we expect to do a better job as the - * codec develops. - * - * This code would be simpler if it just set one bit at a time in the string, - * but would hit the same cache line more often. I'm not sure the complexity - * gains us anything here. - * - * Although field is currently of int type rather than unsigned for - * compatibility with the rest of the code, indices are always expected to - * be >= 0. - */ -void -pack( - unsigned char * bitArray, /* The output bit string. */ - unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/ - int field, /* The bit field to be packed. */ - unsigned int fieldWidth/* Width of the field in BITS, not bytes. */ - ) -{ - /* Convert the field to Gray code */ - field = (field >> 1) ^ field; - - do { - unsigned int bI = *bitIndex; - unsigned int bitsLeft = WordSize - (bI & IndexMask); - unsigned int sliceWidth = - bitsLeft < fieldWidth ? bitsLeft : fieldWidth; - unsigned int wordIndex = bI >> ShiftRight; - - bitArray[wordIndex] |= - ((unsigned char)((field >> (fieldWidth - sliceWidth)) - << (bitsLeft - sliceWidth))); - - *bitIndex = bI + sliceWidth; - fieldWidth -= sliceWidth; - } while ( fieldWidth != 0 ); -} - -/** Unpack a field from a bit string, converting from Gray code to binary. - * - */ -int -unpack( - const unsigned char * bitArray, /* The input bit string. */ - unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/ - unsigned int fieldWidth/* Width of the field in BITS, not bytes. */ - ) -{ - unsigned int field = 0; - unsigned int t; - - do { - unsigned int bI = *bitIndex; - unsigned int bitsLeft = WordSize - (bI & IndexMask); - unsigned int sliceWidth = - bitsLeft < fieldWidth ? bitsLeft : fieldWidth; - - field |= (((bitArray[bI >> ShiftRight] >> (bitsLeft - sliceWidth)) & ((1 << sliceWidth) - 1)) << (fieldWidth - sliceWidth)); - - *bitIndex = bI + sliceWidth; - fieldWidth -= sliceWidth; - } while ( fieldWidth != 0 ); - - /* Convert from Gray code to binary. Works for maximum 8-bit fields. */ - t = field ^ (field >> 8); - t ^= (t >> 4); - t ^= (t >> 2); - t ^= (t >> 1); - return t; -} diff --git a/gr-vocoder/lib/codec2/phase.c b/gr-vocoder/lib/codec2/phase.c deleted file mode 100644 index 69cc6697f..000000000 --- a/gr-vocoder/lib/codec2/phase.c +++ /dev/null @@ -1,262 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: phase.c - AUTHOR......: David Rowe - DATE CREATED: 1/2/09 - - Functions for modelling and synthesising phase. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not,see <http://www.gnu.org/licenses/>. -*/ - -#include "defines.h" -#include "phase.h" -#include "fft.h" -#include "comp.h" -#include "glottal.c" - -#include <assert.h> -#include <math.h> -#include <string.h> -#include <stdlib.h> - -#define GLOTTAL_FFT_SIZE 512 - -/*---------------------------------------------------------------------------*\ - - aks_to_H() - - Samples the complex LPC synthesis filter spectrum at the harmonic - frequencies. - -\*---------------------------------------------------------------------------*/ - -void aks_to_H( - MODEL *model, /* model parameters */ - float aks[], /* LPC's */ - float G, /* energy term */ - COMP H[], /* complex LPC spectral samples */ - int order -) -{ - COMP Pw[FFT_DEC]; /* power spectrum */ - int i,m; /* loop variables */ - int am,bm; /* limits of current band */ - float r; /* no. rads/bin */ - float Em; /* energy in band */ - float Am; /* spectral amplitude sample */ - int b; /* centre bin of harmonic */ - float phi_; /* phase of LPC spectra */ - - r = TWO_PI/(FFT_DEC); - - /* Determine DFT of A(exp(jw)) ------------------------------------------*/ - - for(i=0; i<FFT_DEC; i++) { - Pw[i].real = 0.0; - Pw[i].imag = 0.0; - } - - for(i=0; i<=order; i++) - Pw[i].real = aks[i]; - - fft(&Pw[0].real,FFT_DEC,-1); - - /* Sample magnitude and phase at harmonics */ - - for(m=1; m<=model->L; m++) { - am = floor((m - 0.5)*model->Wo/r + 0.5); - bm = floor((m + 0.5)*model->Wo/r + 0.5); - b = floor(m*model->Wo/r + 0.5); - - Em = 0.0; - for(i=am; i<bm; i++) - Em += G/(Pw[i].real*Pw[i].real + Pw[i].imag*Pw[i].imag); - Am = sqrt(fabs(Em/(bm-am))); - - phi_ = -atan2(Pw[b].imag,Pw[b].real); - H[m].real = Am*cos(phi_); - H[m].imag = Am*sin(phi_); - } -} - - -/*---------------------------------------------------------------------------*\ - - phase_synth_zero_order() - - Synthesises phases based on SNR and a rule based approach. No phase - parameters are required apart from the SNR (which can be reduced to a - 1 bit V/UV decision per frame). - - The phase of each harmonic is modelled as the phase of a LPC - synthesis filter excited by an impulse. Unlike the first order - model the position of the impulse is not transmitted, so we create - an excitation pulse train using a rule based approach. - - Consider a pulse train with a pulse starting time n=0, with pulses - repeated at a rate of Wo, the fundamental frequency. A pulse train - in the time domain is equivalent to harmonics in the frequency - domain. We can make an excitation pulse train using a sum of - sinsusoids: - - for(m=1; m<=L; m++) - ex[n] = cos(m*Wo*n) - - Note: the Octave script ../octave/phase.m is an example of this if - you would like to try making a pulse train. - - The phase of each excitation harmonic is: - - arg(E[m]) = mWo - - where E[m] are the complex excitation (freq domain) samples, - arg(x), just returns the phase of a complex sample x. - - As we don't transmit the pulse position for this model, we need to - synthesise it. Now the excitation pulses occur at a rate of Wo. - This means the phase of the first harmonic advances by N samples - over a synthesis frame of N samples. For example if Wo is pi/20 - (200 Hz), then over a 10ms frame (N=80 samples), the phase of the - first harmonic would advance (pi/20)*80 = 4*pi or two complete - cycles. - - We generate the excitation phase of the fundamental (first - harmonic): - - arg[E[1]] = Wo*N; - - We then relate the phase of the m-th excitation harmonic to the - phase of the fundamental as: - - arg(E[m]) = m*arg(E[1]) - - This E[m] then gets passed through the LPC synthesis filter to - determine the final harmonic phase. - - Comparing to speech synthesised using original phases: - - - Through headphones speech synthesised with this model is not as - good. Through a loudspeaker it is very close to original phases. - - - If there are voicing errors, the speech can sound clicky or - staticy. If V speech is mistakenly declared UV, this model tends to - synthesise impulses or clicks, as there is usually very little shift or - dispersion through the LPC filter. - - - When combined with LPC amplitude modelling there is an additional - drop in quality. I am not sure why, theory is interformant energy - is raised making any phase errors more obvious. - - NOTES: - - 1/ This synthesis model is effectively the same as a simple LPC-10 - vocoders, and yet sounds much better. Why? Conventional wisdom - (AMBE, MELP) says mixed voicing is required for high quality - speech. - - 2/ I am pretty sure the Lincoln Lab sinusoidal coding guys (like xMBE - also from MIT) first described this zero phase model, I need to look - up the paper. - - 3/ Note that this approach could cause some discontinuities in - the phase at the edge of synthesis frames, as no attempt is made - to make sure that the phase tracks are continuous (the excitation - phases are continuous, but not the final phases after filtering - by the LPC spectra). Technically this is a bad thing. However - this may actually be a good thing, disturbing the phase tracks a - bit. More research needed, e.g. test a synthesis model that adds - a small delta-W to make phase tracks line up for voiced - harmonics. - -\*---------------------------------------------------------------------------*/ - -void phase_synth_zero_order( - MODEL *model, - float aks[], - float *ex_phase, /* excitation phase of fundamental */ - int order -) -{ - int m; - float new_phi; - COMP Ex[MAX_AMP]; /* excitation samples */ - COMP A_[MAX_AMP]; /* synthesised harmonic samples */ - COMP H[MAX_AMP]; /* LPC freq domain samples */ - float G; - float jitter = 0.0; - float r; - int b; - - G = 1.0; - aks_to_H(model, aks, G, H, order); - - /* - Update excitation fundamental phase track, this sets the position - of each pitch pulse during voiced speech. After much experiment - I found that using just this frame's Wo improved quality for UV - sounds compared to interpolating two frames Wo like this: - - ex_phase[0] += (*prev_Wo+mode->Wo)*N/2; - */ - - ex_phase[0] += (model->Wo)*N; - ex_phase[0] -= TWO_PI*floor(ex_phase[0]/TWO_PI + 0.5); - r = TWO_PI/GLOTTAL_FFT_SIZE; - - for(m=1; m<=model->L; m++) { - - /* generate excitation */ - - if (model->voiced) { - /* I think adding a little jitter helps improve low pitch - males like hts1a. This moves the onset of each harmonic - over at +/- 0.25 of a sample. - */ - jitter = 0.25*(1.0 - 2.0*rand()/RAND_MAX); - b = floor(m*model->Wo/r + 0.5); - if (b > ((GLOTTAL_FFT_SIZE/2)-1)) { - b = (GLOTTAL_FFT_SIZE/2)-1; - } - Ex[m].real = cos(ex_phase[0]*m - jitter*model->Wo*m + glottal[b]); - Ex[m].imag = sin(ex_phase[0]*m - jitter*model->Wo*m + glottal[b]); - } - else { - - /* When a few samples were tested I found that LPC filter - phase is not needed in the unvoiced case, but no harm in - keeping it. - */ - float phi = TWO_PI*(float)rand()/RAND_MAX; - Ex[m].real = cos(phi); - Ex[m].imag = sin(phi); - } - - /* filter using LPC filter */ - - A_[m].real = H[m].real*Ex[m].real - H[m].imag*Ex[m].imag; - A_[m].imag = H[m].imag*Ex[m].real + H[m].real*Ex[m].imag; - - /* modify sinusoidal phase */ - - new_phi = atan2(A_[m].imag, A_[m].real+1E-12); - model->phi[m] = new_phi; - } - -} diff --git a/gr-vocoder/lib/codec2/phase.h b/gr-vocoder/lib/codec2/phase.h deleted file mode 100644 index 4f1a62089..000000000 --- a/gr-vocoder/lib/codec2/phase.h +++ /dev/null @@ -1,34 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: phase.h - AUTHOR......: David Rowe - DATE CREATED: 1/2/09 - - Functions for modelling phase. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __PHASE__ -#define __PHASE__ - -void phase_synth_zero_order(MODEL *model, float aks[], float *ex_phase, - int order); - -#endif diff --git a/gr-vocoder/lib/codec2/postfilter.c b/gr-vocoder/lib/codec2/postfilter.c deleted file mode 100644 index 05d77c845..000000000 --- a/gr-vocoder/lib/codec2/postfilter.c +++ /dev/null @@ -1,133 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: postfilter.c - AUTHOR......: David Rowe - DATE CREATED: 13/09/09 - - Postfilter to improve sound quality for speech with high levels of - background noise. Unlike mixed-excitation models requires no bits - to be transmitted to handle background noise. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include <stdlib.h> -#include <stdio.h> -#include <math.h> - -#include "defines.h" -#include "comp.h" -#include "dump.h" -#include "postfilter.h" - -/*---------------------------------------------------------------------------*\ - - DEFINES - -\*---------------------------------------------------------------------------*/ - -#define BG_THRESH 40.0 /* only consider low levels signals for bg_est */ -#define BG_BETA 0.1 /* averaging filter constant */ - -/*---------------------------------------------------------------------------*\ - - postfilter() - - The post filter is designed to help with speech corrupted by - background noise. The zero phase model tends to make speech with - background noise sound "clicky". With high levels of background - noise the low level inter-formant parts of the spectrum will contain - noise rather than speech harmonics, so modelling them as voiced - (i.e. a continuous, non-random phase track) is inaccurate. - - Some codecs (like MBE) have a mixed voicing model that breaks the - spectrum into voiced and unvoiced regions. Several bits/frame - (5-12) are required to transmit the frequency selective voicing - information. Mixed excitation also requires accurate voicing - estimation (parameter estimators always break occasionally under - exceptional condition). - - In our case we use a post filter approach which requires no - additional bits to be transmitted. The decoder measures the average - level of the background noise during unvoiced frames. If a harmonic - is less than this level it is made unvoiced by randomising it's - phases. - - This idea is rather experimental. Some potential problems that may - happen: - - 1/ If someone says "aaaaaaaahhhhhhhhh" will background estimator track - up to speech level? This would be a bad thing. - - 2/ If background noise suddenly dissapears from the source speech does - estimate drop quickly? What is noise suddenly re-appears? - - 3/ Background noise with a non-flat sepctrum. Current algorithm just - comsiders scpetrum as a whole, but this could be broken up into - bands, each with their own estimator. - - 4/ Males and females with the same level of background noise. Check - performance the same. Changing Wo affects width of each band, may - affect bg energy estimates. - - 5/ Not sure what happens during long periods of voiced speech - e.g. "sshhhhhhh" - -\*---------------------------------------------------------------------------*/ - -void postfilter( - MODEL *model, - float *bg_est -) -{ - int m, uv; - float e; - - /* determine average energy across spectrum */ - - e = 0.0; - for(m=1; m<=model->L; m++) - e += model->A[m]*model->A[m]; - - e = 10.0*log10(e/model->L); - - /* If beneath threhold, update bg estimate. The idea - of the threshold is to prevent updating during high level - speech. */ - - if ((e < BG_THRESH) && !model->voiced) - *bg_est = *bg_est*(1.0 - BG_BETA) + e*BG_BETA; - - /* now mess with phases during voiced frames to make any harmonics - less then our background estimate unvoiced. - */ - - uv = 0; - if (model->voiced) - for(m=1; m<=model->L; m++) - if (20.0*log10(model->A[m]) < *bg_est) { - model->phi[m] = TWO_PI*(float)rand()/RAND_MAX; - uv++; - } - -#ifdef DUMP - dump_bg(e, *bg_est, 100.0*uv/model->L); -#endif - -} diff --git a/gr-vocoder/lib/codec2/postfilter.h b/gr-vocoder/lib/codec2/postfilter.h deleted file mode 100644 index 156714e54..000000000 --- a/gr-vocoder/lib/codec2/postfilter.h +++ /dev/null @@ -1,33 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: postfilter.h - AUTHOR......: David Rowe - DATE CREATED: 13/09/09 - - Postfilter header file. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __POSTFILTER__ -#define __POSTFILTER__ - -void postfilter(MODEL *model, float *bg_est); - -#endif diff --git a/gr-vocoder/lib/codec2/quantise.c b/gr-vocoder/lib/codec2/quantise.c deleted file mode 100644 index c09803099..000000000 --- a/gr-vocoder/lib/codec2/quantise.c +++ /dev/null @@ -1,851 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: quantise.c - AUTHOR......: David Rowe - DATE CREATED: 31/5/92 - - Quantisation functions for the sinusoidal coder. - -\*---------------------------------------------------------------------------*/ - -/* - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. - -*/ - -#include <assert.h> -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> - -#include "defines.h" -#include "dump.h" -#include "quantise.h" -#include "lpc.h" -#include "lsp.h" -#include "fft.h" - -#define LSP_DELTA1 0.01 /* grid spacing for LSP root searches */ - -/*---------------------------------------------------------------------------*\ - - FUNCTION HEADERS - -\*---------------------------------------------------------------------------*/ - -float speech_to_uq_lsps(float lsp[], float ak[], float Sn[], float w[], - int order); - -/*---------------------------------------------------------------------------*\ - - FUNCTIONS - -\*---------------------------------------------------------------------------*/ - -int lsp_bits(int i) { - return lsp_cb[i].log2m; -} - -#if VECTOR_QUANTISATION -/*---------------------------------------------------------------------------*\ - - quantise_uniform - - Simulates uniform quantising of a float. - -\*---------------------------------------------------------------------------*/ - -void quantise_uniform(float *val, float min, float max, int bits) -{ - int levels = 1 << (bits-1); - float norm; - int index; - - /* hard limit to quantiser range */ - - printf("min: %f max: %f val: %f ", min, max, val[0]); - if (val[0] < min) val[0] = min; - if (val[0] > max) val[0] = max; - - norm = (*val - min)/(max-min); - printf("%f norm: %f ", val[0], norm); - index = fabs(levels*norm + 0.5); - - *val = min + index*(max-min)/levels; - - printf("index %d val_: %f\n", index, val[0]); -} - -#endif - -/*---------------------------------------------------------------------------*\ - - quantise_init - - Loads the entire LSP quantiser comprised of several vector quantisers - (codebooks). - -\*---------------------------------------------------------------------------*/ - -void quantise_init() -{ -} - -/*---------------------------------------------------------------------------*\ - - quantise - - Quantises vec by choosing the nearest vector in codebook cb, and - returns the vector index. The squared error of the quantised vector - is added to se. - -\*---------------------------------------------------------------------------*/ - -long quantise(const float * cb, float vec[], float w[], int k, int m, float *se) -/* float cb[][K]; current VQ codebook */ -/* float vec[]; vector to quantise */ -/* float w[]; weighting vector */ -/* int k; dimension of vectors */ -/* int m; size of codebook */ -/* float *se; accumulated squared error */ -{ - float e; /* current error */ - long besti; /* best index so far */ - float beste; /* best error so far */ - long j; - int i; - - besti = 0; - beste = 1E32; - for(j=0; j<m; j++) { - e = 0.0; - for(i=0; i<k; i++) - e += pow((cb[j*k+i]-vec[i])*w[i],2.0); - if (e < beste) { - beste = e; - besti = j; - } - } - - *se += beste; - - return(besti); -} - -/*---------------------------------------------------------------------------*\ - - lspd_quantise - - Scalar lsp difference quantiser. - -\*---------------------------------------------------------------------------*/ - -void lspd_quantise( - float lsp[], - float lsp_[], - int order -) -{ - int i,k,m; - float lsp_hz[LPC_MAX]; - float lsp__hz[LPC_MAX]; - float dlsp[LPC_MAX]; - float dlsp_[LPC_MAX]; - float wt[1]; - const float *cb; - float se; - int indexes[LPC_MAX]; - - /* convert from radians to Hz so we can use human readable - frequencies */ - - for(i=0; i<order; i++) - lsp_hz[i] = (4000.0/PI)*lsp[i]; - - dlsp[0] = lsp_hz[0]; - for(i=1; i<order; i++) - dlsp[i] = lsp_hz[i] - lsp_hz[i-1]; - - /* simple uniform scalar quantisers */ - - wt[0] = 1.0; - for(i=0; i<order; i++) { - if (i) - dlsp[i] = lsp_hz[i] - lsp__hz[i-1]; - else - dlsp[0] = lsp_hz[0]; - - k = lsp_cbd[i].k; - m = lsp_cbd[i].m; - cb = lsp_cbd[i].cb; - indexes[i] = quantise(cb, &dlsp[i], wt, k, m, &se); - dlsp_[i] = cb[indexes[i]*k]; - - if (i) - lsp__hz[i] = lsp__hz[i-1] + dlsp_[i]; - else - lsp__hz[0] = dlsp_[0]; - } - for(; i<order; i++) - lsp__hz[i] = lsp__hz[i-1] + dlsp[i]; - - /* convert back to radians */ - - for(i=0; i<order; i++) - lsp_[i] = (PI/4000.0)*lsp__hz[i]; -} - -/*---------------------------------------------------------------------------*\ - - lspd_vq_quantise - - Vector lsp difference quantiser. - -\*---------------------------------------------------------------------------*/ - -void lspdvq_quantise( - float lsp[], - float lsp_[], - int order -) -{ - int i,k,m,ncb, nlsp; - float dlsp[LPC_MAX]; - float dlsp_[LPC_MAX]; - float wt[LPC_ORD]; - const float *cb; - float se; - int index; - - dlsp[0] = lsp[0]; - for(i=1; i<order; i++) - dlsp[i] = lsp[i] - lsp[i-1]; - - for(i=0; i<order; i++) - dlsp_[i] = dlsp[i]; - - for(i=0; i<order; i++) - wt[i] = 1.0; - - /* scalar quantise dLSPs 1,2,3,4,5 */ - - for(i=0; i<5; i++) { - if (i) - dlsp[i] = (lsp[i] - lsp_[i-1])*4000.0/PI; - else - dlsp[0] = lsp[0]*4000.0/PI; - - k = lsp_cbdvq[i].k; - m = lsp_cbdvq[i].m; - cb = lsp_cbdvq[i].cb; - index = quantise(cb, &dlsp[i], wt, k, m, &se); - dlsp_[i] = cb[index*k]*PI/4000.0; - - if (i) - lsp_[i] = lsp_[i-1] + dlsp_[i]; - else - lsp_[0] = dlsp_[0]; - } - dlsp[i] = lsp[i] - lsp_[i-1]; - dlsp_[i] = dlsp[i]; - - //printf("lsp[0] %f lsp_[0] %f\n", lsp[0], lsp_[0]); - //printf("lsp[1] %f lsp_[1] %f\n", lsp[1], lsp_[1]); - -#ifdef TT - /* VQ dLSPs 3,4,5 */ - - ncb = 2; - nlsp = 2; - k = lsp_cbdvq[ncb].k; - m = lsp_cbdvq[ncb].m; - cb = lsp_cbdvq[ncb].cb; - index = quantise(cb, &dlsp[nlsp], wt, k, m, &se); - dlsp_[nlsp] = cb[index*k]; - dlsp_[nlsp+1] = cb[index*k+1]; - dlsp_[nlsp+2] = cb[index*k+2]; - - lsp_[0] = dlsp_[0]; - for(i=1; i<5; i++) - lsp_[i] = lsp_[i-1] + dlsp_[i]; - dlsp[i] = lsp[i] - lsp_[i-1]; - dlsp_[i] = dlsp[i]; -#endif - /* VQ dLSPs 6,7,8,9,10 */ - - ncb = 5; - nlsp = 5; - k = lsp_cbdvq[ncb].k; - m = lsp_cbdvq[ncb].m; - cb = lsp_cbdvq[ncb].cb; - index = quantise(cb, &dlsp[nlsp], wt, k, m, &se); - dlsp_[nlsp] = cb[index*k]; - dlsp_[nlsp+1] = cb[index*k+1]; - dlsp_[nlsp+2] = cb[index*k+2]; - dlsp_[nlsp+3] = cb[index*k+3]; - dlsp_[nlsp+4] = cb[index*k+4]; - - /* rebuild LSPs for dLSPs */ - - lsp_[0] = dlsp_[0]; - for(i=1; i<order; i++) - lsp_[i] = lsp_[i-1] + dlsp_[i]; -} - -void check_lsp_order(float lsp[], int lpc_order) -{ - int i; - float tmp; - - for(i=1; i<lpc_order; i++) - if (lsp[i] < lsp[i-1]) { - printf("swap %d\n",i); - tmp = lsp[i-1]; - lsp[i-1] = lsp[i]-0.05; - lsp[i] = tmp+0.05; - } -} - -void force_min_lsp_dist(float lsp[], int lpc_order) -{ - int i; - - for(i=1; i<lpc_order; i++) - if ((lsp[i]-lsp[i-1]) < 0.01) { - lsp[i] += 0.01; - } -} - -/*---------------------------------------------------------------------------*\ - - lpc_model_amplitudes - - Derive a LPC model for amplitude samples then estimate amplitude samples - from this model with optional LSP quantisation. - - Returns the spectral distortion for this frame. - -\*---------------------------------------------------------------------------*/ - -float lpc_model_amplitudes( - float Sn[], /* Input frame of speech samples */ - float w[], - MODEL *model, /* sinusoidal model parameters */ - int order, /* LPC model order */ - int lsp_quant, /* optional LSP quantisation if non-zero */ - float ak[] /* output aks */ -) -{ - float Wn[M]; - float R[LPC_MAX+1]; - float E; - int i,j; - float snr; - float lsp[LPC_MAX]; - float lsp_hz[LPC_MAX]; - float lsp_[LPC_MAX]; - int roots; /* number of LSP roots found */ - int index; - float se; - int k,m; - const float * cb; - float wt[LPC_MAX]; - - for(i=0; i<M; i++) - Wn[i] = Sn[i]*w[i]; - autocorrelate(Wn,R,M,order); - levinson_durbin(R,ak,order); - - E = 0.0; - for(i=0; i<=order; i++) - E += ak[i]*R[i]; - - for(i=0; i<order; i++) - wt[i] = 1.0; - - if (lsp_quant) { - roots = lpc_to_lsp(ak, order, lsp, 5, LSP_DELTA1); - if (roots != order) - printf("LSP roots not found\n"); - - /* convert from radians to Hz to make quantisers more - human readable */ - - for(i=0; i<order; i++) - lsp_hz[i] = (4000.0/PI)*lsp[i]; - - /* simple uniform scalar quantisers */ - - for(i=0; i<10; i++) { - k = lsp_cb[i].k; - m = lsp_cb[i].m; - cb = lsp_cb[i].cb; - index = quantise(cb, &lsp_hz[i], wt, k, m, &se); - lsp_hz[i] = cb[index*k]; - } - - /* experiment: simulating uniform quantisation error - for(i=0; i<order; i++) - lsp[i] += PI*(12.5/4000.0)*(1.0 - 2.0*(float)rand()/RAND_MAX); - */ - - for(i=0; i<order; i++) - lsp[i] = (PI/4000.0)*lsp_hz[i]; - - /* Bandwidth Expansion (BW). Prevents any two LSPs getting too - close together after quantisation. We know from experiment - that LSP quantisation errors < 12.5Hz (25Hz setp size) are - inaudible so we use that as the minimum LSP separation. - */ - - for(i=1; i<5; i++) { - if (lsp[i] - lsp[i-1] < PI*(12.5/4000.0)) - lsp[i] = lsp[i-1] + PI*(12.5/4000.0); - } - - /* as quantiser gaps increased, larger BW expansion was required - to prevent twinkly noises */ - - for(i=5; i<8; i++) { - if (lsp[i] - lsp[i-1] < PI*(25.0/4000.0)) - lsp[i] = lsp[i-1] + PI*(25.0/4000.0); - } - for(i=8; i<order; i++) { - if (lsp[i] - lsp[i-1] < PI*(75.0/4000.0)) - lsp[i] = lsp[i-1] + PI*(75.0/4000.0); - } - - for(j=0; j<order; j++) - lsp_[j] = lsp[j]; - - lsp_to_lpc(lsp_, ak, order); -#ifdef DUMP - dump_lsp(lsp); -#endif - } - -#ifdef DUMP - dump_E(E); -#endif - #ifdef SIM_QUANT - /* simulated LPC energy quantisation */ - { - float e = 10.0*log10(E); - e += 2.0*(1.0 - 2.0*(float)rand()/RAND_MAX); - E = pow(10.0,e/10.0); - } - #endif - - aks_to_M2(ak,order,model,E,&snr, 1); /* {ak} -> {Am} LPC decode */ - - return snr; -} - -/*---------------------------------------------------------------------------*\ - - aks_to_M2() - - Transforms the linear prediction coefficients to spectral amplitude - samples. This function determines A(m) from the average energy per - band using an FFT. - -\*---------------------------------------------------------------------------*/ - -void aks_to_M2( - float ak[], /* LPC's */ - int order, - MODEL *model, /* sinusoidal model parameters for this frame */ - float E, /* energy term */ - float *snr, /* signal to noise ratio for this frame in dB */ - int dump /* true to dump sample to dump file */ -) -{ - COMP Pw[FFT_DEC]; /* power spectrum */ - int i,m; /* loop variables */ - int am,bm; /* limits of current band */ - float r; /* no. rads/bin */ - float Em; /* energy in band */ - float Am; /* spectral amplitude sample */ - float signal, noise; - - r = TWO_PI/(FFT_DEC); - - /* Determine DFT of A(exp(jw)) --------------------------------------------*/ - - for(i=0; i<FFT_DEC; i++) { - Pw[i].real = 0.0; - Pw[i].imag = 0.0; - } - - for(i=0; i<=order; i++) - Pw[i].real = ak[i]; - fft(&Pw[0].real,FFT_DEC,1); - - /* Determine power spectrum P(w) = E/(A(exp(jw))^2 ------------------------*/ - - for(i=0; i<FFT_DEC/2; i++) - Pw[i].real = E/(Pw[i].real*Pw[i].real + Pw[i].imag*Pw[i].imag); -#ifdef DUMP - if (dump) - dump_Pw(Pw); -#endif - - /* Determine magnitudes by linear interpolation of P(w) -------------------*/ - - signal = noise = 0.0; - for(m=1; m<=model->L; m++) { - am = floor((m - 0.5)*model->Wo/r + 0.5); - bm = floor((m + 0.5)*model->Wo/r + 0.5); - Em = 0.0; - - for(i=am; i<bm; i++) - Em += Pw[i].real; - Am = sqrt(Em); - - signal += pow(model->A[m],2.0); - noise += pow(model->A[m] - Am,2.0); - model->A[m] = Am; - } - *snr = 10.0*log10(signal/noise); -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: encode_Wo() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - Encodes Wo using a WO_LEVELS quantiser. - -\*---------------------------------------------------------------------------*/ - -int encode_Wo(float Wo) -{ - int index; - float Wo_min = TWO_PI/P_MAX; - float Wo_max = TWO_PI/P_MIN; - float norm; - - norm = (Wo - Wo_min)/(Wo_max - Wo_min); - index = floor(WO_LEVELS * norm + 0.5); - if (index < 0 ) index = 0; - if (index > (WO_LEVELS-1)) index = WO_LEVELS-1; - - return index; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: decode_Wo() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - Decodes Wo using a WO_LEVELS quantiser. - -\*---------------------------------------------------------------------------*/ - -float decode_Wo(int index) -{ - float Wo_min = TWO_PI/P_MAX; - float Wo_max = TWO_PI/P_MIN; - float step; - float Wo; - - step = (Wo_max - Wo_min)/WO_LEVELS; - Wo = Wo_min + step*(index); - - return Wo; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: speech_to_uq_lsps() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - Analyse a windowed frame of time domain speech to determine LPCs - which are the converted to LSPs for quantisation and transmission - over the channel. - -\*---------------------------------------------------------------------------*/ - -float speech_to_uq_lsps(float lsp[], - float ak[], - float Sn[], - float w[], - int order -) -{ - int i, roots; - float Wn[M]; - float R[LPC_MAX+1]; - float E; - - for(i=0; i<M; i++) - Wn[i] = Sn[i]*w[i]; - autocorrelate(Wn, R, M, order); - levinson_durbin(R, ak, order); - - E = 0.0; - for(i=0; i<=order; i++) - E += ak[i]*R[i]; - - roots = lpc_to_lsp(ak, order, lsp, 5, LSP_DELTA1); - if (roots != order) { - /* for some reason LSP roots could not be found */ - /* some alpha testers are reporting this condition */ - fprintf(stderr, "LSP roots not found!\nroots = %d\n", roots); - for(i=0; i<=order; i++) - fprintf(stderr, "a[%d] = %f\n", i, ak[i]); - - /* some benign LSP values we can use instead */ - for(i=0; i<order; i++) - lsp[i] = (PI/order)*(float)i; - } - - return E; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: encode_lsps() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - From a vector of unquantised (floating point) LSPs finds the quantised - LSP indexes. - -\*---------------------------------------------------------------------------*/ - -void encode_lsps(int indexes[], float lsp[], int order) -{ - int i,k,m; - float wt[1]; - float lsp_hz[LPC_MAX]; - const float * cb; - float se; - - /* convert from radians to Hz so we can use human readable - frequencies */ - - for(i=0; i<order; i++) - lsp_hz[i] = (4000.0/PI)*lsp[i]; - - /* simple uniform scalar quantisers */ - - wt[0] = 1.0; - for(i=0; i<order; i++) { - k = lsp_cb[i].k; - m = lsp_cb[i].m; - cb = lsp_cb[i].cb; - indexes[i] = quantise(cb, &lsp_hz[i], wt, k, m, &se); - } -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: decode_lsps() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - From a vector of quantised LSP indexes, returns the quantised - (floating point) LSPs. - -\*---------------------------------------------------------------------------*/ - -void decode_lsps(float lsp[], int indexes[], int order) -{ - int i,k; - float lsp_hz[LPC_MAX]; - const float * cb; - - for(i=0; i<order; i++) { - k = lsp_cb[i].k; - cb = lsp_cb[i].cb; - lsp_hz[i] = cb[indexes[i]*k]; - } - - /* convert back to radians */ - - for(i=0; i<order; i++) - lsp[i] = (PI/4000.0)*lsp_hz[i]; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: bw_expand_lsps() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - Applies Bandwidth Expansion (BW) to a vector of LSPs. Prevents any - two LSPs getting too close together after quantisation. We know - from experiment that LSP quantisation errors < 12.5Hz (25Hz setp - size) are inaudible so we use that as the minimum LSP separation. - -\*---------------------------------------------------------------------------*/ - -void bw_expand_lsps(float lsp[], - int order -) -{ - int i; - - for(i=1; i<5; i++) { - if (lsp[i] - lsp[i-1] < PI*(12.5/4000.0)) - lsp[i] = lsp[i-1] + PI*(12.5/4000.0); - } - - /* As quantiser gaps increased, larger BW expansion was required - to prevent twinkly noises. This may need more experiment for - different quanstisers. - */ - - for(i=5; i<8; i++) { - if (lsp[i] - lsp[i-1] < PI*(25.0/4000.0)) - lsp[i] = lsp[i-1] + PI*(25.0/4000.0); - } - for(i=8; i<order; i++) { - if (lsp[i] - lsp[i-1] < PI*(75.0/4000.0)) - lsp[i] = lsp[i-1] + PI*(75.0/4000.0); - } -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: apply_lpc_correction() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - Apply first harmonic LPC correction at decoder. This helps improve - low pitch males after LPC modelling, like hts1a and morig. - -\*---------------------------------------------------------------------------*/ - -void apply_lpc_correction(MODEL *model) -{ - if (model->Wo < (PI*150.0/4000)) { - model->A[1] *= 0.032; - } -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: encode_energy() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - Encodes LPC energy using an E_LEVELS quantiser. - -\*---------------------------------------------------------------------------*/ - -int encode_energy(float e) -{ - int index; - float e_min = E_MIN_DB; - float e_max = E_MAX_DB; - float norm; - - e = 10.0*log10(e); - norm = (e - e_min)/(e_max - e_min); - index = floor(E_LEVELS * norm + 0.5); - if (index < 0 ) index = 0; - if (index > (E_LEVELS-1)) index = E_LEVELS-1; - - return index; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: decode_energy() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - Decodes energy using a WO_BITS quantiser. - -\*---------------------------------------------------------------------------*/ - -float decode_energy(int index) -{ - float e_min = E_MIN_DB; - float e_max = E_MAX_DB; - float step; - float e; - - step = (e_max - e_min)/E_LEVELS; - e = e_min + step*(index); - e = pow(10.0,e/10.0); - - return e; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: encode_amplitudes() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - Time domain LPC is used model the amplitudes which are then - converted to LSPs and quantised. So we don't actually encode the - amplitudes directly, rather we derive an equivalent representation - from the time domain speech. - -\*---------------------------------------------------------------------------*/ - -void encode_amplitudes(int lsp_indexes[], - int *energy_index, - MODEL *model, - float Sn[], - float w[]) -{ - float lsps[LPC_ORD]; - float ak[LPC_ORD+1]; - float e; - - e = speech_to_uq_lsps(lsps, ak, Sn, w, LPC_ORD); - encode_lsps(lsp_indexes, lsps, LPC_ORD); - *energy_index = encode_energy(e); -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: decode_amplitudes() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - Given the amplitude quantiser indexes recovers the harmonic - amplitudes. - -\*---------------------------------------------------------------------------*/ - -float decode_amplitudes(MODEL *model, - float ak[], - int lsp_indexes[], - int energy_index, - float lsps[], - float *e -) -{ - float snr; - - decode_lsps(lsps, lsp_indexes, LPC_ORD); - bw_expand_lsps(lsps, LPC_ORD); - lsp_to_lpc(lsps, ak, LPC_ORD); - *e = decode_energy(energy_index); - aks_to_M2(ak, LPC_ORD, model, *e, &snr, 1); - apply_lpc_correction(model); - - return snr; -} diff --git a/gr-vocoder/lib/codec2/quantise.h b/gr-vocoder/lib/codec2/quantise.h deleted file mode 100644 index 42b05f43b..000000000 --- a/gr-vocoder/lib/codec2/quantise.h +++ /dev/null @@ -1,83 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: quantise.h - AUTHOR......: David Rowe - DATE CREATED: 31/5/92 - - Quantisation functions for the sinusoidal coder. - -\*---------------------------------------------------------------------------*/ - -/* - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __QUANTISE__ -#define __QUANTISE__ - -#define WO_BITS 7 -#define WO_LEVELS (1<<WO_BITS) -#define E_BITS 5 -#define E_LEVELS (1<<E_BITS) -#define E_MIN_DB -10.0 -#define E_MAX_DB 40.0 - -void quantise_init(); -float lpc_model_amplitudes(float Sn[], float w[], MODEL *model, int order, - int lsp,float ak[]); -void aks_to_M2(float ak[], int order, MODEL *model, float E, float *snr, - int dump); - -int encode_Wo(float Wo); -float decode_Wo(int index); - -void encode_lsps(int indexes[], float lsp[], int order); -void decode_lsps(float lsp[], int indexes[], int order); -void lspd_quantise(float lsp[], float lsp_[], int order); -void lspdvq_quantise(float lsp[], float lsp_[], int order); - -int encode_energy(float e); -float decode_energy(int index); - -void encode_amplitudes(int lsp_indexes[], - int *energy_index, - MODEL *model, - float Sn[], - float w[]); - -float decode_amplitudes(MODEL *model, - float ak[], - int lsp_indexes[], - int energy_index, - float lsps[], - float *e); - -void pack(unsigned char * bits, unsigned int *nbit, int index, unsigned int index_bits); -int unpack(const unsigned char * bits, unsigned int *nbit, unsigned int index_bits); - -int lsp_bits(int i); - -void apply_lpc_correction(MODEL *model); -float speech_to_uq_lsps(float lsp[], - float ak[], - float Sn[], - float w[], - int order - ); -void bw_expand_lsps(float lsp[], - int order - ); -void decode_lsps(float lsp[], int indexes[], int order); - -#endif diff --git a/gr-vocoder/lib/codec2/sim.sh b/gr-vocoder/lib/codec2/sim.sh deleted file mode 100755 index 10152d979..000000000 --- a/gr-vocoder/lib/codec2/sim.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# sim.sh -# David Rowe 10 Sep 2009 - -# Process a source file using the codec 2 simulation. An output -# speech file is generated for each major processing step, from the -# unquantised siusoidal model to fully quantised. This way we can -# listen to the effect of each processing step. Use listensim.sh to -# test the output files. - -../src/c2sim ../raw/$1.raw -o $1_uq.raw -../src/c2sim ../raw/$1.raw --phase0 -o $1_phase0.raw --postfilter -../src/c2sim ../raw/$1.raw --lpc 10 -o $1_lpc10.raw --postfilter -../src/c2sim ../raw/$1.raw --phase0 --lpc 10 -o $1_phase0_lpc10.raw --postfilter -../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --dec -o $1_phase0_lpc10_dec.raw --postfilter -../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp --dec -o $1_phase0_lsp_dec.raw --postfilter - -#../src/c2sim ../raw/$1.raw --lpc 10 --lsp -o $1_lsp.raw -#../src/c2sim ../raw/$1.raw --phase0 --lpc 10 -o $1_phase0_lpc10.raw --postfilter -#../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp.raw --postfilter -#../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp_dec.raw --postfilter --dec - diff --git a/gr-vocoder/lib/codec2/sine.c b/gr-vocoder/lib/codec2/sine.c deleted file mode 100644 index b30f9abad..000000000 --- a/gr-vocoder/lib/codec2/sine.c +++ /dev/null @@ -1,638 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: sine.c - AUTHOR......: David Rowe - DATE CREATED: 19/8/2010 - - Sinusoidal analysis and synthesis functions. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 1990-2010 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -/*---------------------------------------------------------------------------*\ - - INCLUDES - -\*---------------------------------------------------------------------------*/ - -#include <stdlib.h> -#include <stdio.h> -#include <math.h> - -#include "defines.h" -#include "sine.h" -#include "fft.h" - -#define HPF_BETA 0.125 - -/*---------------------------------------------------------------------------*\ - - HEADERS - -\*---------------------------------------------------------------------------*/ - -void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, - float pstep); - -/*---------------------------------------------------------------------------*\ - - FUNCTIONS - -\*---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: make_analysis_window - AUTHOR......: David Rowe - DATE CREATED: 11/5/94 - - Init function that generates the time domain analysis window and it's DFT. - -\*---------------------------------------------------------------------------*/ - -void make_analysis_window(float w[],COMP W[]) -{ - float m; - COMP temp; - int i,j; - - /* - Generate Hamming window centered on M-sample pitch analysis window - - 0 M/2 M-1 - |-------------|-------------| - |-------|-------| - NW samples - - All our analysis/synthsis is centred on the M/2 sample. - */ - - m = 0.0; - for(i=0; i<M/2-NW/2; i++) - w[i] = 0.0; - for(i=M/2-NW/2,j=0; i<M/2+NW/2; i++,j++) { - w[i] = 0.5 - 0.5*cos(TWO_PI*j/(NW-1)); - m += w[i]*w[i]; - } - for(i=M/2+NW/2; i<M; i++) - w[i] = 0.0; - - /* Normalise - makes freq domain amplitude estimation straight - forward */ - - m = 1.0/sqrt(m*FFT_ENC); - for(i=0; i<M; i++) { - w[i] *= m; - } - - /* - Generate DFT of analysis window, used for later processing. Note - we modulo FFT_ENC shift the time domain window w[], this makes the - imaginary part of the DFT W[] equal to zero as the shifted w[] is - even about the n=0 time axis if NW is odd. Having the imag part - of the DFT W[] makes computation easier. - - 0 FFT_ENC-1 - |-------------------------| - - ----\ /---- - \ / - \ / <- shifted version of window w[n] - \ / - \ / - ------- - - |---------| |---------| - NW/2 NW/2 - */ - - for(i=0; i<FFT_ENC; i++) { - W[i].real = 0.0; - W[i].imag = 0.0; - } - for(i=0; i<NW/2; i++) - W[i].real = w[i+M/2]; - for(i=FFT_ENC-NW/2,j=M/2-NW/2; i<FFT_ENC; i++,j++) - W[i].real = w[j]; - - fft(&W[0].real,FFT_ENC,-1); /* "Numerical Recipes in C" FFT */ - - /* - Re-arrange W[] to be symmetrical about FFT_ENC/2. Makes later - analysis convenient. - - Before: - - - 0 FFT_ENC-1 - |----------|---------| - __ _ - \ / - \_______________/ - - After: - - 0 FFT_ENC-1 - |----------|---------| - ___ - / \ - ________/ \_______ - - */ - - - for(i=0; i<FFT_ENC/2; i++) { - temp.real = W[i].real; - temp.imag = W[i].imag; - W[i].real = W[i+FFT_ENC/2].real; - W[i].imag = W[i+FFT_ENC/2].imag; - W[i+FFT_ENC/2].real = temp.real; - W[i+FFT_ENC/2].imag = temp.imag; - } - -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: hpf - AUTHOR......: David Rowe - DATE CREATED: 16 Nov 2010 - - High pass filter with a -3dB point of about 160Hz. - - y(n) = -HPF_BETA*y(n-1) + x(n) - x(n-1) - -\*---------------------------------------------------------------------------*/ - -float hpf(float x, float states[]) -{ - states[0] += -HPF_BETA*states[0] + x - states[1]; - states[1] = x; - - return states[0]; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: dft_speech - AUTHOR......: David Rowe - DATE CREATED: 27/5/94 - - Finds the DFT of the current speech input speech frame. - -\*---------------------------------------------------------------------------*/ - -void dft_speech(COMP Sw[], float Sn[], float w[]) -{ - int i; - - for(i=0; i<FFT_ENC; i++) { - Sw[i].real = 0.0; - Sw[i].imag = 0.0; - } - - /* Centre analysis window on time axis, we need to arrange input - to FFT this way to make FFT phases correct */ - - /* move 2nd half to start of FFT input vector */ - - for(i=0; i<NW/2; i++) - Sw[i].real = Sn[i+M/2]*w[i+M/2]; - - /* move 1st half to end of FFT input vector */ - - for(i=0; i<NW/2; i++) - Sw[FFT_ENC-NW/2+i].real = Sn[i+M/2-NW/2]*w[i+M/2-NW/2]; - - fft(&Sw[0].real,FFT_ENC,-1); -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: two_stage_pitch_refinement - AUTHOR......: David Rowe - DATE CREATED: 27/5/94 - - Refines the current pitch estimate using the harmonic sum pitch - estimation technique. - -\*---------------------------------------------------------------------------*/ - -void two_stage_pitch_refinement(MODEL *model, COMP Sw[]) -{ - float pmin,pmax,pstep; /* pitch refinment minimum, maximum and step */ - - /* Coarse refinement */ - - pmax = TWO_PI/model->Wo + 5; - pmin = TWO_PI/model->Wo - 5; - pstep = 1.0; - hs_pitch_refinement(model,Sw,pmin,pmax,pstep); - - /* Fine refinement */ - - pmax = TWO_PI/model->Wo + 1; - pmin = TWO_PI/model->Wo - 1; - pstep = 0.25; - hs_pitch_refinement(model,Sw,pmin,pmax,pstep); - - /* Limit range */ - - if (model->Wo < TWO_PI/P_MAX) - model->Wo = TWO_PI/P_MAX; - if (model->Wo > TWO_PI/P_MIN) - model->Wo = TWO_PI/P_MIN; - - model->L = floor(PI/model->Wo); -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: hs_pitch_refinement - AUTHOR......: David Rowe - DATE CREATED: 27/5/94 - - Harmonic sum pitch refinement function. - - pmin pitch search range minimum - pmax pitch search range maximum - step pitch search step size - model current pitch estimate in model.Wo - - model refined pitch estimate in model.Wo - -\*---------------------------------------------------------------------------*/ - -void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float pstep) -{ - int m; /* loop variable */ - int b; /* bin for current harmonic centre */ - float E; /* energy for current pitch*/ - float Wo; /* current "test" fundamental freq. */ - float Wom; /* Wo that maximises E */ - float Em; /* mamimum energy */ - float r; /* number of rads/bin */ - float p; /* current pitch */ - - /* Initialisation */ - - model->L = PI/model->Wo; /* use initial pitch est. for L */ - Wom = model->Wo; - Em = 0.0; - r = TWO_PI/FFT_ENC; - - /* Determine harmonic sum for a range of Wo values */ - - for(p=pmin; p<=pmax; p+=pstep) { - E = 0.0; - Wo = TWO_PI/p; - - /* Sum harmonic magnitudes */ - - for(m=1; m<=model->L; m++) { - b = floor(m*Wo/r + 0.5); - E += Sw[b].real*Sw[b].real + Sw[b].imag*Sw[b].imag; - } - - /* Compare to see if this is a maximum */ - - if (E > Em) { - Em = E; - Wom = Wo; - } - } - - model->Wo = Wom; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: estimate_amplitudes - AUTHOR......: David Rowe - DATE CREATED: 27/5/94 - - Estimates the complex amplitudes of the harmonics. - -\*---------------------------------------------------------------------------*/ - -void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[]) -{ - int i,m; /* loop variables */ - int am,bm; /* bounds of current harmonic */ - int b; /* DFT bin of centre of current harmonic */ - float den; /* denominator of amplitude expression */ - float r; /* number of rads/bin */ - int offset; - COMP Am; - - r = TWO_PI/FFT_ENC; - - for(m=1; m<=model->L; m++) { - den = 0.0; - am = floor((m - 0.5)*model->Wo/r + 0.5); - bm = floor((m + 0.5)*model->Wo/r + 0.5); - b = floor(m*model->Wo/r + 0.5); - - /* Estimate ampltude of harmonic */ - - den = 0.0; - Am.real = Am.imag = 0.0; - for(i=am; i<bm; i++) { - den += Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag; - offset = i + FFT_ENC/2 - floor(m*model->Wo/r + 0.5); - Am.real += Sw[i].real*W[offset].real; - Am.imag += Sw[i].imag*W[offset].real; - } - - model->A[m] = sqrt(den); - - /* Estimate phase of harmonic */ - - model->phi[m] = atan2(Sw[b].imag,Sw[b].real); - } -} - -/*---------------------------------------------------------------------------*\ - - est_voicing_mbe() - - Returns the error of the MBE cost function for a fiven F0. - - Note: I think a lot of the operations below can be simplified as - W[].imag = 0 and has been normalised such that den always equals 1. - -\*---------------------------------------------------------------------------*/ - -float est_voicing_mbe( - MODEL *model, - COMP Sw[], - COMP W[], - COMP Sw_[], /* DFT of all voiced synthesised signal */ - /* useful for debugging/dump file */ - COMP Ew[], /* DFT of error */ - float prev_Wo) -{ - int i,l,al,bl,m; /* loop variables */ - COMP Am; /* amplitude sample for this band */ - int offset; /* centers Hw[] about current harmonic */ - float den; /* denominator of Am expression */ - float error; /* accumulated error between original and synthesised */ - float Wo; - float sig, snr; - float elow, ehigh, eratio; - float dF0, sixty; - - sig = 0.0; - for(l=1; l<=model->L/4; l++) { - sig += model->A[l]*model->A[l]; - } - for(i=0; i<FFT_ENC; i++) { - Sw_[i].real = 0.0; - Sw_[i].imag = 0.0; - Ew[i].real = 0.0; - Ew[i].imag = 0.0; - } - - Wo = model->Wo; - error = 0.0; - - /* Just test across the harmonics in the first 1000 Hz (L/4) */ - - for(l=1; l<=model->L/4; l++) { - Am.real = 0.0; - Am.imag = 0.0; - den = 0.0; - al = ceil((l - 0.5)*Wo*FFT_ENC/TWO_PI); - bl = ceil((l + 0.5)*Wo*FFT_ENC/TWO_PI); - - /* Estimate amplitude of harmonic assuming harmonic is totally voiced */ - - for(m=al; m<bl; m++) { - offset = FFT_ENC/2 + m - l*Wo*FFT_ENC/TWO_PI + 0.5; - Am.real += Sw[m].real*W[offset].real + Sw[m].imag*W[offset].imag; - Am.imag += Sw[m].imag*W[offset].real - Sw[m].real*W[offset].imag; - den += W[offset].real*W[offset].real + W[offset].imag*W[offset].imag; - } - - Am.real = Am.real/den; - Am.imag = Am.imag/den; - - /* Determine error between estimated harmonic and original */ - - for(m=al; m<bl; m++) { - offset = FFT_ENC/2 + m - l*Wo*FFT_ENC/TWO_PI + 0.5; - Sw_[m].real = Am.real*W[offset].real - Am.imag*W[offset].imag; - Sw_[m].imag = Am.real*W[offset].imag + Am.imag*W[offset].real; - Ew[m].real = Sw[m].real - Sw_[m].real; - Ew[m].imag = Sw[m].imag - Sw_[m].imag; - error += Ew[m].real*Ew[m].real; - error += Ew[m].imag*Ew[m].imag; - } - } - - snr = 10.0*log10(sig/error); - if (snr > V_THRESH) - model->voiced = 1; - else - model->voiced = 0; - - /* post processing, helps clean up some voicing errors ------------------*/ - - /* - Determine the ratio of low freancy to high frequency energy, - voiced speech tends to be dominated by low frequency energy, - unvoiced by high frequency. This measure can be used to - determine if we have made any gross errors. - */ - - elow = ehigh = 0.0; - for(l=1; l<=model->L/2; l++) { - elow += model->A[l]*model->A[l]; - } - for(l=model->L/2; l<=model->L; l++) { - ehigh += model->A[l]*model->A[l]; - } - eratio = 10.0*log10(elow/ehigh); - dF0 = 0.0; - - /* Look for Type 1 errors, strongly V speech that has been - accidentally declared UV */ - - if (model->voiced == 0) - if (eratio > 10.0) - model->voiced = 1; - - /* Look for Type 2 errors, strongly UV speech that has been - accidentally declared V */ - - if (model->voiced == 1) { - if (eratio < -10.0) - model->voiced = 0; - - /* If pitch is jumping about it's likely this is UV */ - - dF0 = (model->Wo - prev_Wo)*FS/TWO_PI; - if (fabs(dF0) > 15.0) - model->voiced = 0; - - /* A common source of Type 2 errors is the pitch estimator - gives a low (50Hz) estimate for UV speech, which gives a - good match with noise due to the close harmoonic spacing. - These errors are much more common than people with 50Hz - pitch, so we have just a small eratio threshold. */ - - sixty = 60.0*TWO_PI/FS; - if ((eratio < -4.0) && (model->Wo <= sixty)) - model->voiced = 0; - } - //printf(" v: %d snr: %f eratio: %3.2f %f\n",model->voiced,snr,eratio,dF0); - - return snr; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: make_synthesis_window - AUTHOR......: David Rowe - DATE CREATED: 11/5/94 - - Init function that generates the trapezoidal (Parzen) sythesis window. - -\*---------------------------------------------------------------------------*/ - -void make_synthesis_window(float Pn[]) -{ - int i; - float win; - - /* Generate Parzen window in time domain */ - - win = 0.0; - for(i=0; i<N/2-TW; i++) - Pn[i] = 0.0; - win = 0.0; - for(i=N/2-TW; i<N/2+TW; win+=1.0/(2*TW), i++ ) - Pn[i] = win; - for(i=N/2+TW; i<3*N/2-TW; i++) - Pn[i] = 1.0; - win = 1.0; - for(i=3*N/2-TW; i<3*N/2+TW; win-=1.0/(2*TW), i++) - Pn[i] = win; - for(i=3*N/2+TW; i<2*N; i++) - Pn[i] = 0.0; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: synthesise - AUTHOR......: David Rowe - DATE CREATED: 20/2/95 - - Synthesise a speech signal in the frequency domain from the - sinusodal model parameters. Uses overlap-add with a trapezoidal - window to smoothly interpolate betwen frames. - -\*---------------------------------------------------------------------------*/ - -void synthesise( - float Sn_[], /* time domain synthesised signal */ - MODEL *model, /* ptr to model parameters for this frame */ - float Pn[], /* time domain Parzen window */ - int shift /* flag used to handle transition frames */ -) -{ - int i,l,j,b; /* loop variables */ - COMP Sw_[FFT_DEC]; /* DFT of synthesised signal */ - - if (shift) { - /* Update memories */ - - for(i=0; i<N-1; i++) { - Sn_[i] = Sn_[i+N]; - } - Sn_[N-1] = 0.0; - } - - for(i=0; i<FFT_DEC; i++) { - Sw_[i].real = 0.0; - Sw_[i].imag = 0.0; - } - - /* - Nov 2010 - found that synthesis using time domain cos() functions - gives better results for synthesis frames greater than 10ms. Inverse - FFT synthesis using a 512 pt FFT works well for 10ms window. I think - (but am not sure) that the problem is realted to the quantisation of - the harmonic frequencies to the FFT bin size, e.g. there is a - 8000/512 Hz step between FFT bins. For some reason this makes - the speech from longer frame > 10ms sound poor. The effect can also - be seen when synthesising test signals like single sine waves, some - sort of amplitude modulation at the frame rate. - - Another possibility is using a larger FFT size (1024 or 2048). - */ - -#define FFT_SYNTHESIS -#ifdef FFT_SYNTHESIS - /* Now set up frequency domain synthesised speech */ - for(l=1; l<=model->L; l++) { - b = floor(l*model->Wo*FFT_DEC/TWO_PI + 0.5); - if (b > ((FFT_DEC/2)-1)) { - b = (FFT_DEC/2)-1; - } - Sw_[b].real = model->A[l]*cos(model->phi[l]); - Sw_[b].imag = model->A[l]*sin(model->phi[l]); - Sw_[FFT_DEC-b].real = Sw_[b].real; - Sw_[FFT_DEC-b].imag = -Sw_[b].imag; - } - - /* Perform inverse DFT */ - - fft(&Sw_[0].real,FFT_DEC,1); -#else - /* - Direct time domain synthesis using the cos() function. Works - well at 10ms and 20ms frames rates. Note synthesis window is - still used to handle overlap-add between adjacent frames. This - could be simplified as we don't need to synthesise where Pn[] - is zero. - */ - for(l=1; l<=model->L; l++) { - for(i=0,j=-N+1; i<N-1; i++,j++) { - Sw_[FFT_DEC-N+1+i].real += 2.0*model->A[l]*cos(j*model->Wo*l + model->phi[l]); - } - for(i=N-1,j=0; i<2*N; i++,j++) - Sw_[j].real += 2.0*model->A[l]*cos(j*model->Wo*l + model->phi[l]); - } -#endif - - /* Overlap add to previous samples */ - - for(i=0; i<N-1; i++) { - Sn_[i] += Sw_[FFT_DEC-N+1+i].real*Pn[i]; - } - - if (shift) - for(i=N-1,j=0; i<2*N; i++,j++) - Sn_[i] = Sw_[j].real*Pn[i]; - else - for(i=N-1,j=0; i<2*N; i++,j++) - Sn_[i] += Sw_[j].real*Pn[i]; -} - diff --git a/gr-vocoder/lib/codec2/sine.h b/gr-vocoder/lib/codec2/sine.h deleted file mode 100644 index f223e2afc..000000000 --- a/gr-vocoder/lib/codec2/sine.h +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: sine.h - AUTHOR......: David Rowe - DATE CREATED: 1/11/94 - - Header file for sinusoidal analysis and synthesis functions. - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2009 David Rowe - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. 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 Lesser General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __SINE__ -#define __SINE__ - -#include "defines.h" -#include "comp.h" - -void make_analysis_window(float w[], COMP W[]); -float hpf(float x, float states[]); -void dft_speech(COMP Sw[], float Sn[], float w[]); -void two_stage_pitch_refinement(MODEL *model, COMP Sw[]); -void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[]); -float est_voicing_mbe(MODEL *model, COMP Sw[], COMP W[], COMP Sw_[],COMP Ew[], - float prev_Wo); -void make_synthesis_window(float Pn[]); -void synthesise(float Sn_[], MODEL *model, float Pn[], int shift); - -#endif diff --git a/gr-vocoder/lib/g7xx/CMakeLists.txt b/gr-vocoder/lib/g7xx/CMakeLists.txt deleted file mode 100644 index bde7538d2..000000000 --- a/gr-vocoder/lib/g7xx/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Append all sources in this dir -######################################################################## -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -list(APPEND gr_vocoder_sources - ${CMAKE_CURRENT_SOURCE_DIR}/g711.c - ${CMAKE_CURRENT_SOURCE_DIR}/g72x.c - ${CMAKE_CURRENT_SOURCE_DIR}/g721.c - ${CMAKE_CURRENT_SOURCE_DIR}/g723_24.c - ${CMAKE_CURRENT_SOURCE_DIR}/g723_40.c -) diff --git a/gr-vocoder/lib/g7xx/README b/gr-vocoder/lib/g7xx/README deleted file mode 100644 index 23b0e7dd5..000000000 --- a/gr-vocoder/lib/g7xx/README +++ /dev/null @@ -1,94 +0,0 @@ -The files in this directory comprise ANSI-C language reference implementations -of the CCITT (International Telegraph and Telephone Consultative Committee) -G.711, G.721 and G.723 voice compressions. They have been tested on Sun -SPARCstations and passed 82 out of 84 test vectors published by CCITT -(Dec. 20, 1988) for G.721 and G.723. [The two remaining test vectors, -which the G.721 decoder implementation for u-law samples did not pass, -may be in error because they are identical to two other vectors for G.723_40.] - -This source code is released by Sun Microsystems, Inc. to the public domain. -Please give your acknowledgement in product literature if this code is used -in your product implementation. - -Sun Microsystems supports some CCITT audio formats in Solaris 2.0 system -software. However, Sun's implementations have been optimized for higher -performance on SPARCstations. - - -The source files for CCITT conversion routines in this directory are: - - g72x.h header file for g721.c, g723_24.c and g723_40.c - g711.c CCITT G.711 u-law and A-law compression - g72x.c common denominator of G.721 and G.723 ADPCM codes - g721.c CCITT G.721 32Kbps ADPCM coder (with g72x.c) - g723_24.c CCITT G.723 24Kbps ADPCM coder (with g72x.c) - g723_40.c CCITT G.723 40Kbps ADPCM coder (with g72x.c) - - -Simple conversions between u-law, A-law, and 16-bit linear PCM are invoked -as follows: - - unsigned char ucode, acode; - short pcm_val; - - ucode = linear2ulaw(pcm_val); - ucode = alaw2ulaw(acode); - - acode = linear2alaw(pcm_val); - acode = ulaw2alaw(ucode); - - pcm_val = ulaw2linear(ucode); - pcm_val = alaw2linear(acode); - - -The other CCITT compression routines are invoked as follows: - - #include "g72x.h" - - struct g72x_state state; - int sample, code; - - g72x_init_state(&state); - code = {g721,g723_24,g723_40}_encoder(sample, coding, &state); - sample = {g721,g723_24,g723_40}_decoder(code, coding, &state); - -where - coding = AUDIO_ENCODING_ULAW for 8-bit u-law samples - AUDIO_ENCODING_ALAW for 8-bit A-law samples - AUDIO_ENCODING_LINEAR for 16-bit linear PCM samples - - - -This directory also includes the following sample programs: - - encode.c CCITT ADPCM encoder - decode.c CCITT ADPCM decoder - Makefile makefile for the sample programs - - -The sample programs contain examples of how to call the various compression -routines and pack/unpack the bits. The sample programs read byte streams from -stdin and write to stdout. The input/output data is raw data (no file header -or other identifying information is embedded). The sample programs are -invoked as follows: - - encode [-3|4|5] [-a|u|l] <infile >outfile - decode [-3|4|5] [-a|u|l] <infile >outfile -where: - -3 encode to (decode from) G.723 24kbps (3-bit) data - -4 encode to (decode from) G.721 32kbps (4-bit) data [the default] - -5 encode to (decode from) G.723 40kbps (5-bit) data - -a encode from (decode to) A-law data - -u encode from (decode to) u-law data [the default] - -l encode from (decode to) 16-bit linear data - -Examples: - # Read 16-bit linear and output G.721 - encode -4 -l <pcmfile >g721file - - # Read 40Kbps G.723 and output A-law - decode -5 -a <g723file >alawfile - - # Compress and then decompress u-law data using 24Kbps G.723 - encode -3 <ulawin | deoced -3 >ulawout - diff --git a/gr-vocoder/lib/g7xx/decode.c b/gr-vocoder/lib/g7xx/decode.c deleted file mode 100644 index cf8c739c5..000000000 --- a/gr-vocoder/lib/g7xx/decode.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * decode.c - * - * CCITT ADPCM decoder - * - * Usage : decode [-3|4|5] [-a|u|l] < infile > outfile - */ -#include <stdio.h> -#include "g72x.h" - - -/* - * Unpack input codes and pass them back as bytes. - * Returns 1 if there is residual input, returns -1 if eof, else returns 0. - */ -int -unpack_input( - unsigned char *code, - int bits) -{ - static unsigned int in_buffer = 0; - static int in_bits = 0; - unsigned char in_byte; - - if (in_bits < bits) { - if (fread(&in_byte, sizeof (char), 1, stdin) != 1) { - *code = 0; - return (-1); - } - in_buffer |= (in_byte << in_bits); - in_bits += 8; - } - *code = in_buffer & ((1 << bits) - 1); - in_buffer >>= bits; - in_bits -= bits; - return (in_bits > 0); -} - - -main( - int argc, - char **argv) -{ - short sample; - unsigned char code; - int n; - struct g72x_state state; - int out_coding; - int out_size; - int (*dec_routine)(); - int dec_bits; - - g72x_init_state(&state); - out_coding = AUDIO_ENCODING_ULAW; - out_size = sizeof (char); - dec_routine = g721_decoder; - dec_bits = 4; - - /* Process encoding argument, if any */ - while ((argc > 1) && (argv[1][0] == '-')) { - switch (argv[1][1]) { - case '3': - dec_routine = g723_24_decoder; - dec_bits = 3; - break; - case '4': - dec_routine = g721_decoder; - dec_bits = 4; - break; - case '5': - dec_routine = g723_40_decoder; - dec_bits = 5; - break; - case 'u': - out_coding = AUDIO_ENCODING_ULAW; - out_size = sizeof (char); - break; - case 'a': - out_coding = AUDIO_ENCODING_ALAW; - out_size = sizeof (char); - break; - case 'l': - out_coding = AUDIO_ENCODING_LINEAR; - out_size = sizeof (short); - break; - default: -fprintf(stderr, "CCITT ADPCM Decoder -- usage:\n"); -fprintf(stderr, "\tdecode [-3|4|5] [-a|u|l] < infile > outfile\n"); -fprintf(stderr, "where:\n"); -fprintf(stderr, "\t-3\tProcess G.723 24kbps (3-bit) input data\n"); -fprintf(stderr, "\t-4\tProcess G.721 32kbps (4-bit) input data [default]\n"); -fprintf(stderr, "\t-5\tProcess G.723 40kbps (5-bit) input data\n"); -fprintf(stderr, "\t-a\tGenerate 8-bit A-law data\n"); -fprintf(stderr, "\t-u\tGenerate 8-bit u-law data [default]\n"); -fprintf(stderr, "\t-l\tGenerate 16-bit linear PCM data\n"); - exit(1); - } - argc--; - argv++; - } - - /* Read and unpack input codes and process them */ - while (unpack_input(&code, dec_bits) >= 0) { - sample = (*dec_routine)(code, out_coding, &state); - if (out_size == 2) { - fwrite(&sample, out_size, 1, stdout); - } else { - code = (unsigned char)sample; - fwrite(&code, out_size, 1, stdout); - } - } - fclose(stdout); -} diff --git a/gr-vocoder/lib/g7xx/encode.c b/gr-vocoder/lib/g7xx/encode.c deleted file mode 100644 index e74482869..000000000 --- a/gr-vocoder/lib/g7xx/encode.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * encode.c - * - * CCITT ADPCM encoder - * - * Usage : encode [-3|4|5] [-a|u|l] < infile > outfile - */ -#include <stdio.h> -#include "g72x.h" - - -/* - * Pack output codes into bytes and write them to stdout. - * Returns 1 if there is residual output, else returns 0. - */ -int -pack_output( - unsigned code, - int bits) -{ - static unsigned int out_buffer = 0; - static int out_bits = 0; - unsigned char out_byte; - - out_buffer |= (code << out_bits); - out_bits += bits; - if (out_bits >= 8) { - out_byte = out_buffer & 0xff; - out_bits -= 8; - out_buffer >>= 8; - fwrite(&out_byte, sizeof (char), 1, stdout); - } - return (out_bits > 0); -} - - -main( - int argc, - char **argv) -{ - struct g72x_state state; - unsigned char sample_char; - short sample_short; - unsigned char code; - int resid; - int in_coding; - int in_size; - unsigned *in_buf; - int (*enc_routine)(); - int enc_bits; - - g72x_init_state(&state); - - /* Set defaults to u-law input, G.721 output */ - in_coding = AUDIO_ENCODING_ULAW; - in_size = sizeof (char); - in_buf = (unsigned *)&sample_char; - enc_routine = g721_encoder; - enc_bits = 4; - - /* Process encoding argument, if any */ - while ((argc > 1) && (argv[1][0] == '-')) { - switch (argv[1][1]) { - case '3': - enc_routine = g723_24_encoder; - enc_bits = 3; - break; - case '4': - enc_routine = g721_encoder; - enc_bits = 4; - break; - case '5': - enc_routine = g723_40_encoder; - enc_bits = 5; - break; - case 'u': - in_coding = AUDIO_ENCODING_ULAW; - in_size = sizeof (char); - in_buf = (unsigned *)&sample_char; - break; - case 'a': - in_coding = AUDIO_ENCODING_ALAW; - in_size = sizeof (char); - in_buf = (unsigned *)&sample_char; - break; - case 'l': - in_coding = AUDIO_ENCODING_LINEAR; - in_size = sizeof (short); - in_buf = (unsigned *)&sample_short; - break; - default: -fprintf(stderr, "CCITT ADPCM Encoder -- usage:\n"); -fprintf(stderr, "\tencode [-3|4|5] [-a|u|l] < infile > outfile\n"); -fprintf(stderr, "where:\n"); -fprintf(stderr, "\t-3\tGenerate G.723 24kbps (3-bit) data\n"); -fprintf(stderr, "\t-4\tGenerate G.721 32kbps (4-bit) data [default]\n"); -fprintf(stderr, "\t-5\tGenerate G.723 40kbps (5-bit) data\n"); -fprintf(stderr, "\t-a\tProcess 8-bit A-law input data\n"); -fprintf(stderr, "\t-u\tProcess 8-bit u-law input data [default]\n"); -fprintf(stderr, "\t-l\tProcess 16-bit linear PCM input data\n"); - exit(1); - } - argc--; - argv++; - } - - /* Read input file and process */ - while (fread(in_buf, in_size, 1, stdin) == 1) { - code = (*enc_routine)(in_size == 2 ? sample_short : sample_char, - in_coding, &state); - resid = pack_output(code, enc_bits); - } - - /* Write zero codes until all residual codes are written out */ - while (resid) { - resid = pack_output(0, enc_bits); - } - fclose(stdout); -} diff --git a/gr-vocoder/lib/g7xx/g711.c b/gr-vocoder/lib/g7xx/g711.c deleted file mode 100644 index d4d60a5c2..000000000 --- a/gr-vocoder/lib/g7xx/g711.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * This source code is a product of Sun Microsystems, Inc. and is provided - * for unrestricted use. Users may copy or modify this source code without - * charge. - * - * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING - * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun source code is provided with no support and without any obligation on - * the part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * g711.c - * - * u-law, A-law and linear PCM conversions. - */ -#define SIGN_BIT (0x80) /* Sign bit for a A-law byte. */ -#define QUANT_MASK (0xf) /* Quantization field mask. */ -#define NSEGS (8) /* Number of A-law segments. */ -#define SEG_SHIFT (4) /* Left shift for segment number. */ -#define SEG_MASK (0x70) /* Segment field mask. */ - -static short seg_end[8] = {0xFF, 0x1FF, 0x3FF, 0x7FF, - 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF}; - -/* copy from CCITT G.711 specifications */ -unsigned char _u2a[128] = { /* u- to A-law conversions */ - 1, 1, 2, 2, 3, 3, 4, 4, - 5, 5, 6, 6, 7, 7, 8, 8, - 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, - 25, 27, 29, 31, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, - 46, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, - 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, - 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128}; - -unsigned char _a2u[128] = { /* A- to u-law conversions */ - 1, 3, 5, 7, 9, 11, 13, 15, - 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, - 32, 32, 33, 33, 34, 34, 35, 35, - 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 48, 49, 49, - 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 64, - 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 79, - 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127}; - -static int -search( - int val, - short *table, - int size) -{ - int i; - - for (i = 0; i < size; i++) { - if (val <= *table++) - return (i); - } - return (size); -} - -/* - * linear2alaw() - Convert a 16-bit linear PCM value to 8-bit A-law - * - * linear2alaw() accepts an 16-bit integer and encodes it as A-law data. - * - * Linear Input Code Compressed Code - * ------------------------ --------------- - * 0000000wxyza 000wxyz - * 0000001wxyza 001wxyz - * 000001wxyzab 010wxyz - * 00001wxyzabc 011wxyz - * 0001wxyzabcd 100wxyz - * 001wxyzabcde 101wxyz - * 01wxyzabcdef 110wxyz - * 1wxyzabcdefg 111wxyz - * - * For further information see John C. Bellamy's Digital Telephony, 1982, - * John Wiley & Sons, pps 98-111 and 472-476. - */ -unsigned char -linear2alaw( - int pcm_val) /* 2's complement (16-bit range) */ -{ - int mask; - int seg; - unsigned char aval; - - if (pcm_val >= 0) { - mask = 0xD5; /* sign (7th) bit = 1 */ - } else { - mask = 0x55; /* sign bit = 0 */ - pcm_val = -pcm_val - 8; - } - - /* Convert the scaled magnitude to segment number. */ - seg = search(pcm_val, seg_end, 8); - - /* Combine the sign, segment, and quantization bits. */ - - if (seg >= 8) /* out of range, return maximum value. */ - return (0x7F ^ mask); - else { - aval = seg << SEG_SHIFT; - if (seg < 2) - aval |= (pcm_val >> 4) & QUANT_MASK; - else - aval |= (pcm_val >> (seg + 3)) & QUANT_MASK; - return (aval ^ mask); - } -} - -/* - * alaw2linear() - Convert an A-law value to 16-bit linear PCM - * - */ -int -alaw2linear( - unsigned char a_val) -{ - int t; - int seg; - - a_val ^= 0x55; - - t = (a_val & QUANT_MASK) << 4; - seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT; - switch (seg) { - case 0: - t += 8; - break; - case 1: - t += 0x108; - break; - default: - t += 0x108; - t <<= seg - 1; - } - return ((a_val & SIGN_BIT) ? t : -t); -} - -#define BIAS (0x84) /* Bias for linear code. */ - -/* - * linear2ulaw() - Convert a linear PCM value to u-law - * - * In order to simplify the encoding process, the original linear magnitude - * is biased by adding 33 which shifts the encoding range from (0 - 8158) to - * (33 - 8191). The result can be seen in the following encoding table: - * - * Biased Linear Input Code Compressed Code - * ------------------------ --------------- - * 00000001wxyza 000wxyz - * 0000001wxyzab 001wxyz - * 000001wxyzabc 010wxyz - * 00001wxyzabcd 011wxyz - * 0001wxyzabcde 100wxyz - * 001wxyzabcdef 101wxyz - * 01wxyzabcdefg 110wxyz - * 1wxyzabcdefgh 111wxyz - * - * Each biased linear code has a leading 1 which identifies the segment - * number. The value of the segment number is equal to 7 minus the number - * of leading 0's. The quantization interval is directly available as the - * four bits wxyz. * The trailing bits (a - h) are ignored. - * - * Ordinarily the complement of the resulting code word is used for - * transmission, and so the code word is complemented before it is returned. - * - * For further information see John C. Bellamy's Digital Telephony, 1982, - * John Wiley & Sons, pps 98-111 and 472-476. - */ -unsigned char -linear2ulaw( - int pcm_val) /* 2's complement (16-bit range) */ -{ - int mask; - int seg; - unsigned char uval; - - /* Get the sign and the magnitude of the value. */ - if (pcm_val < 0) { - pcm_val = BIAS - pcm_val; - mask = 0x7F; - } else { - pcm_val += BIAS; - mask = 0xFF; - } - - /* Convert the scaled magnitude to segment number. */ - seg = search(pcm_val, seg_end, 8); - - /* - * Combine the sign, segment, quantization bits; - * and complement the code word. - */ - if (seg >= 8) /* out of range, return maximum value. */ - return (0x7F ^ mask); - else { - uval = (seg << 4) | ((pcm_val >> (seg + 3)) & 0xF); - return (uval ^ mask); - } - -} - -/* - * ulaw2linear() - Convert a u-law value to 16-bit linear PCM - * - * First, a biased linear code is derived from the code word. An unbiased - * output can then be obtained by subtracting 33 from the biased code. - * - * Note that this function expects to be passed the complement of the - * original code word. This is in keeping with ISDN conventions. - */ -int -ulaw2linear( - unsigned char u_val) -{ - int t; - - /* Complement to obtain normal u-law value. */ - u_val = ~u_val; - - /* - * Extract and bias the quantization bits. Then - * shift up by the segment number and subtract out the bias. - */ - t = ((u_val & QUANT_MASK) << 3) + BIAS; - t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT; - - return ((u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS)); -} - -/* A-law to u-law conversion */ -unsigned char -alaw2ulaw( - unsigned char aval) -{ - aval &= 0xff; - return ((aval & 0x80) ? (0xFF ^ _a2u[aval ^ 0xD5]) : - (0x7F ^ _a2u[aval ^ 0x55])); -} - -/* u-law to A-law conversion */ -unsigned char -ulaw2alaw( - unsigned char uval) -{ - uval &= 0xff; - return ((uval & 0x80) ? (0xD5 ^ (_u2a[0xFF ^ uval] - 1)) : - (0x55 ^ (_u2a[0x7F ^ uval] - 1))); -} diff --git a/gr-vocoder/lib/g7xx/g721.c b/gr-vocoder/lib/g7xx/g721.c deleted file mode 100644 index 445f177e8..000000000 --- a/gr-vocoder/lib/g7xx/g721.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * This source code is a product of Sun Microsystems, Inc. and is provided - * for unrestricted use. Users may copy or modify this source code without - * charge. - * - * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING - * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun source code is provided with no support and without any obligation on - * the part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * g721.c - * - * Description: - * - * g721_encoder(), g721_decoder() - * - * These routines comprise an implementation of the CCITT G.721 ADPCM - * coding algorithm. Essentially, this implementation is identical to - * the bit level description except for a few deviations which - * take advantage of work station attributes, such as hardware 2's - * complement arithmetic and large memory. Specifically, certain time - * consuming operations such as multiplications are replaced - * with lookup tables and software 2's complement operations are - * replaced with hardware 2's complement. - * - * The deviation from the bit level specification (lookup tables) - * preserves the bit level performance specifications. - * - * As outlined in the G.721 Recommendation, the algorithm is broken - * down into modules. Each section of code below is preceded by - * the name of the module which it is implementing. - * - */ -#include "g72x.h" - -static short qtab_721[7] = {-124, 80, 178, 246, 300, 349, 400}; -/* - * Maps G.721 code word to reconstructed scale factor normalized log - * magnitude values. - */ -static short _dqlntab[16] = {-2048, 4, 135, 213, 273, 323, 373, 425, - 425, 373, 323, 273, 213, 135, 4, -2048}; - -/* Maps G.721 code word to log of scale factor multiplier. */ -static short _witab[16] = {-12, 18, 41, 64, 112, 198, 355, 1122, - 1122, 355, 198, 112, 64, 41, 18, -12}; -/* - * Maps G.721 code words to a set of values whose long and short - * term averages are computed and then compared to give an indication - * how stationary (steady state) the signal is. - */ -static short _fitab[16] = {0, 0, 0, 0x200, 0x200, 0x200, 0x600, 0xE00, - 0xE00, 0x600, 0x200, 0x200, 0x200, 0, 0, 0}; - -/* - * g721_encoder() - * - * Encodes the input vale of linear PCM, A-law or u-law data sl and returns - * the resulting code. -1 is returned for unknown input coding value. - */ -int -g721_encoder( - int sl, - int in_coding, - struct g72x_state *state_ptr) -{ - short sezi, se, sez; /* ACCUM */ - short d; /* SUBTA */ - short sr; /* ADDB */ - short y; /* MIX */ - short dqsez; /* ADDC */ - short dq, i; - - switch (in_coding) { /* linearize input sample to 14-bit PCM */ - case AUDIO_ENCODING_ALAW: - sl = alaw2linear(sl) >> 2; - break; - case AUDIO_ENCODING_ULAW: - sl = ulaw2linear(sl) >> 2; - break; - case AUDIO_ENCODING_LINEAR: - sl >>= 2; /* 14-bit dynamic range */ - break; - default: - return (-1); - } - - sezi = predictor_zero(state_ptr); - sez = sezi >> 1; - se = (sezi + predictor_pole(state_ptr)) >> 1; /* estimated signal */ - - d = sl - se; /* estimation difference */ - - /* quantize the prediction difference */ - y = step_size(state_ptr); /* quantizer step size */ - i = quantize(d, y, qtab_721, 7); /* i = ADPCM code */ - - dq = reconstruct(i & 8, _dqlntab[i], y); /* quantized est diff */ - - sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconst. signal */ - - dqsez = sr + sez - se; /* pole prediction diff. */ - - update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr); - - return (i); -} - -/* - * g721_decoder() - * - * Description: - * - * Decodes a 4-bit code of G.721 encoded data of i and - * returns the resulting linear PCM, A-law or u-law value. - * return -1 for unknown out_coding value. - */ -int -g721_decoder( - int i, - int out_coding, - struct g72x_state *state_ptr) -{ - short sezi, sei, sez, se; /* ACCUM */ - short y; /* MIX */ - short sr; /* ADDB */ - short dq; - short dqsez; - - i &= 0x0f; /* mask to get proper bits */ - sezi = predictor_zero(state_ptr); - sez = sezi >> 1; - sei = sezi + predictor_pole(state_ptr); - se = sei >> 1; /* se = estimated signal */ - - y = step_size(state_ptr); /* dynamic quantizer step size */ - - dq = reconstruct(i & 0x08, _dqlntab[i], y); /* quantized diff. */ - - sr = (dq < 0) ? (se - (dq & 0x3FFF)) : se + dq; /* reconst. signal */ - - dqsez = sr - se + sez; /* pole prediction diff. */ - - update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr); - - switch (out_coding) { - case AUDIO_ENCODING_ALAW: - return (tandem_adjust_alaw(sr, se, y, i, 8, qtab_721)); - case AUDIO_ENCODING_ULAW: - return (tandem_adjust_ulaw(sr, se, y, i, 8, qtab_721)); - case AUDIO_ENCODING_LINEAR: - return (sr << 2); /* sr was 14-bit dynamic range */ - default: - return (-1); - } -} diff --git a/gr-vocoder/lib/g7xx/g723_24.c b/gr-vocoder/lib/g7xx/g723_24.c deleted file mode 100644 index 452f4daeb..000000000 --- a/gr-vocoder/lib/g7xx/g723_24.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * This source code is a product of Sun Microsystems, Inc. and is provided - * for unrestricted use. Users may copy or modify this source code without - * charge. - * - * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING - * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun source code is provided with no support and without any obligation on - * the part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * g723_24.c - * - * Description: - * - * g723_24_encoder(), g723_24_decoder() - * - * These routines comprise an implementation of the CCITT G.723 24 Kbps - * ADPCM coding algorithm. Essentially, this implementation is identical to - * the bit level description except for a few deviations which take advantage - * of workstation attributes, such as hardware 2's complement arithmetic. - * - */ -#include "g72x.h" - -/* - * Maps G.723_24 code word to reconstructed scale factor normalized log - * magnitude values. - */ -static short _dqlntab[8] = {-2048, 135, 273, 373, 373, 273, 135, -2048}; - -/* Maps G.723_24 code word to log of scale factor multiplier. */ -static short _witab[8] = {-128, 960, 4384, 18624, 18624, 4384, 960, -128}; - -/* - * Maps G.723_24 code words to a set of values whose long and short - * term averages are computed and then compared to give an indication - * how stationary (steady state) the signal is. - */ -static short _fitab[8] = {0, 0x200, 0x400, 0xE00, 0xE00, 0x400, 0x200, 0}; - -static short qtab_723_24[3] = {8, 218, 331}; - -/* - * g723_24_encoder() - * - * Encodes a linear PCM, A-law or u-law input sample and returns its 3-bit code. - * Returns -1 if invalid input coding value. - */ -int -g723_24_encoder( - int sl, - int in_coding, - struct g72x_state *state_ptr) -{ - short sei, sezi, se, sez; /* ACCUM */ - short d; /* SUBTA */ - short y; /* MIX */ - short sr; /* ADDB */ - short dqsez; /* ADDC */ - short dq, i; - - switch (in_coding) { /* linearize input sample to 14-bit PCM */ - case AUDIO_ENCODING_ALAW: - sl = alaw2linear(sl) >> 2; - break; - case AUDIO_ENCODING_ULAW: - sl = ulaw2linear(sl) >> 2; - break; - case AUDIO_ENCODING_LINEAR: - sl >>= 2; /* sl of 14-bit dynamic range */ - break; - default: - return (-1); - } - - sezi = predictor_zero(state_ptr); - sez = sezi >> 1; - sei = sezi + predictor_pole(state_ptr); - se = sei >> 1; /* se = estimated signal */ - - d = sl - se; /* d = estimation diff. */ - - /* quantize prediction difference d */ - y = step_size(state_ptr); /* quantizer step size */ - i = quantize(d, y, qtab_723_24, 3); /* i = ADPCM code */ - dq = reconstruct(i & 4, _dqlntab[i], y); /* quantized diff. */ - - sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconstructed signal */ - - dqsez = sr + sez - se; /* pole prediction diff. */ - - update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); - - return (i); -} - -/* - * g723_24_decoder() - * - * Decodes a 3-bit CCITT G.723_24 ADPCM code and returns - * the resulting 16-bit linear PCM, A-law or u-law sample value. - * -1 is returned if the output coding is unknown. - */ -int -g723_24_decoder( - int i, - int out_coding, - struct g72x_state *state_ptr) -{ - short sezi, sei, sez, se; /* ACCUM */ - short y; /* MIX */ - short sr; /* ADDB */ - short dq; - short dqsez; - - i &= 0x07; /* mask to get proper bits */ - sezi = predictor_zero(state_ptr); - sez = sezi >> 1; - sei = sezi + predictor_pole(state_ptr); - se = sei >> 1; /* se = estimated signal */ - - y = step_size(state_ptr); /* adaptive quantizer step size */ - dq = reconstruct(i & 0x04, _dqlntab[i], y); /* unquantize pred diff */ - - sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); /* reconst. signal */ - - dqsez = sr - se + sez; /* pole prediction diff. */ - - update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); - - switch (out_coding) { - case AUDIO_ENCODING_ALAW: - return (tandem_adjust_alaw(sr, se, y, i, 4, qtab_723_24)); - case AUDIO_ENCODING_ULAW: - return (tandem_adjust_ulaw(sr, se, y, i, 4, qtab_723_24)); - case AUDIO_ENCODING_LINEAR: - return (sr << 2); /* sr was of 14-bit dynamic range */ - default: - return (-1); - } -} diff --git a/gr-vocoder/lib/g7xx/g723_40.c b/gr-vocoder/lib/g7xx/g723_40.c deleted file mode 100644 index 4858baf40..000000000 --- a/gr-vocoder/lib/g7xx/g723_40.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * This source code is a product of Sun Microsystems, Inc. and is provided - * for unrestricted use. Users may copy or modify this source code without - * charge. - * - * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING - * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun source code is provided with no support and without any obligation on - * the part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * g723_40.c - * - * Description: - * - * g723_40_encoder(), g723_40_decoder() - * - * These routines comprise an implementation of the CCITT G.723 40Kbps - * ADPCM coding algorithm. Essentially, this implementation is identical to - * the bit level description except for a few deviations which - * take advantage of workstation attributes, such as hardware 2's - * complement arithmetic. - * - * The deviation from the bit level specification (lookup tables), - * preserves the bit level performance specifications. - * - * As outlined in the G.723 Recommendation, the algorithm is broken - * down into modules. Each section of code below is preceded by - * the name of the module which it is implementing. - * - */ -#include "g72x.h" - -/* - * Maps G.723_40 code word to ructeconstructed scale factor normalized log - * magnitude values. - */ -static short _dqlntab[32] = {-2048, -66, 28, 104, 169, 224, 274, 318, - 358, 395, 429, 459, 488, 514, 539, 566, - 566, 539, 514, 488, 459, 429, 395, 358, - 318, 274, 224, 169, 104, 28, -66, -2048}; - -/* Maps G.723_40 code word to log of scale factor multiplier. */ -static short _witab[32] = {448, 448, 768, 1248, 1280, 1312, 1856, 3200, - 4512, 5728, 7008, 8960, 11456, 14080, 16928, 22272, - 22272, 16928, 14080, 11456, 8960, 7008, 5728, 4512, - 3200, 1856, 1312, 1280, 1248, 768, 448, 448}; - -/* - * Maps G.723_40 code words to a set of values whose long and short - * term averages are computed and then compared to give an indication - * how stationary (steady state) the signal is. - */ -static short _fitab[32] = {0, 0, 0, 0, 0, 0x200, 0x200, 0x200, - 0x200, 0x200, 0x400, 0x600, 0x800, 0xA00, 0xC00, 0xC00, - 0xC00, 0xC00, 0xA00, 0x800, 0x600, 0x400, 0x200, 0x200, - 0x200, 0x200, 0x200, 0, 0, 0, 0, 0}; - -static short qtab_723_40[15] = {-122, -16, 68, 139, 198, 250, 298, 339, - 378, 413, 445, 475, 502, 528, 553}; - -/* - * g723_40_encoder() - * - * Encodes a 16-bit linear PCM, A-law or u-law input sample and retuens - * the resulting 5-bit CCITT G.723 40Kbps code. - * Returns -1 if the input coding value is invalid. - */ -int -g723_40_encoder( - int sl, - int in_coding, - struct g72x_state *state_ptr) -{ - short sei, sezi, se, sez; /* ACCUM */ - short d; /* SUBTA */ - short y; /* MIX */ - short sr; /* ADDB */ - short dqsez; /* ADDC */ - short dq, i; - - switch (in_coding) { /* linearize input sample to 14-bit PCM */ - case AUDIO_ENCODING_ALAW: - sl = alaw2linear(sl) >> 2; - break; - case AUDIO_ENCODING_ULAW: - sl = ulaw2linear(sl) >> 2; - break; - case AUDIO_ENCODING_LINEAR: - sl >>= 2; /* sl of 14-bit dynamic range */ - break; - default: - return (-1); - } - - sezi = predictor_zero(state_ptr); - sez = sezi >> 1; - sei = sezi + predictor_pole(state_ptr); - se = sei >> 1; /* se = estimated signal */ - - d = sl - se; /* d = estimation difference */ - - /* quantize prediction difference */ - y = step_size(state_ptr); /* adaptive quantizer step size */ - i = quantize(d, y, qtab_723_40, 15); /* i = ADPCM code */ - - dq = reconstruct(i & 0x10, _dqlntab[i], y); /* quantized diff */ - - sr = (dq < 0) ? se - (dq & 0x7FFF) : se + dq; /* reconstructed signal */ - - dqsez = sr + sez - se; /* dqsez = pole prediction diff. */ - - update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); - - return (i); -} - -/* - * g723_40_decoder() - * - * Decodes a 5-bit CCITT G.723 40Kbps code and returns - * the resulting 16-bit linear PCM, A-law or u-law sample value. - * -1 is returned if the output coding is unknown. - */ -int -g723_40_decoder( - int i, - int out_coding, - struct g72x_state *state_ptr) -{ - short sezi, sei, sez, se; /* ACCUM */ - short y; /* MIX */ - short sr; /* ADDB */ - short dq; - short dqsez; - - i &= 0x1f; /* mask to get proper bits */ - sezi = predictor_zero(state_ptr); - sez = sezi >> 1; - sei = sezi + predictor_pole(state_ptr); - se = sei >> 1; /* se = estimated signal */ - - y = step_size(state_ptr); /* adaptive quantizer step size */ - dq = reconstruct(i & 0x10, _dqlntab[i], y); /* estimation diff. */ - - sr = (dq < 0) ? (se - (dq & 0x7FFF)) : (se + dq); /* reconst. signal */ - - dqsez = sr - se + sez; /* pole prediction diff. */ - - update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); - - switch (out_coding) { - case AUDIO_ENCODING_ALAW: - return (tandem_adjust_alaw(sr, se, y, i, 0x10, qtab_723_40)); - case AUDIO_ENCODING_ULAW: - return (tandem_adjust_ulaw(sr, se, y, i, 0x10, qtab_723_40)); - case AUDIO_ENCODING_LINEAR: - return (sr << 2); /* sr was of 14-bit dynamic range */ - default: - return (-1); - } -} diff --git a/gr-vocoder/lib/g7xx/g72x.c b/gr-vocoder/lib/g7xx/g72x.c deleted file mode 100644 index 9a823c755..000000000 --- a/gr-vocoder/lib/g7xx/g72x.c +++ /dev/null @@ -1,576 +0,0 @@ -/* - * This source code is a product of Sun Microsystems, Inc. and is provided - * for unrestricted use. Users may copy or modify this source code without - * charge. - * - * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING - * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun source code is provided with no support and without any obligation on - * the part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#include <stdlib.h> -/* - * g72x.c - * - * Common routines for G.721 and G.723 conversions. - */ - -#include "g72x.h" - -static short power2[15] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80, - 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000}; - -/* - * quan() - * - * quantizes the input val against the table of size short integers. - * It returns i if table[i - 1] <= val < table[i]. - * - * Using linear search for simple coding. - */ -static int -quan( - int val, - short *table, - int size) -{ - int i; - - for (i = 0; i < size; i++) - if (val < *table++) - break; - return (i); -} - -/* - * fmult() - * - * returns the integer product of the 14-bit integer "an" and - * "floating point" representation (4-bit exponent, 6-bit mantessa) "srn". - */ -static int -fmult( - int an, - int srn) -{ - short anmag, anexp, anmant; - short wanexp, wanmant; - short retval; - - anmag = (an > 0) ? an : ((-an) & 0x1FFF); - anexp = quan(anmag, power2, 15) - 6; - anmant = (anmag == 0) ? 32 : - (anexp >= 0) ? anmag >> anexp : anmag << -anexp; - wanexp = anexp + ((srn >> 6) & 0xF) - 13; - - wanmant = (anmant * (srn & 077) + 0x30) >> 4; - retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) : - (wanmant >> -wanexp); - - return (((an ^ srn) < 0) ? -retval : retval); -} - -/* - * g72x_init_state() - * - * This routine initializes and/or resets the g72x_state structure - * pointed to by 'state_ptr'. - * All the initial state values are specified in the CCITT G.721 document. - */ -void -g72x_init_state( - struct g72x_state *state_ptr) -{ - int cnta; - - state_ptr->yl = 34816; - state_ptr->yu = 544; - state_ptr->dms = 0; - state_ptr->dml = 0; - state_ptr->ap = 0; - for (cnta = 0; cnta < 2; cnta++) { - state_ptr->a[cnta] = 0; - state_ptr->pk[cnta] = 0; - state_ptr->sr[cnta] = 32; - } - for (cnta = 0; cnta < 6; cnta++) { - state_ptr->b[cnta] = 0; - state_ptr->dq[cnta] = 32; - } - state_ptr->td = 0; -} - -/* - * predictor_zero() - * - * computes the estimated signal from 6-zero predictor. - * - */ -int -predictor_zero( - struct g72x_state *state_ptr) -{ - int i; - int sezi; - - sezi = fmult(state_ptr->b[0] >> 2, state_ptr->dq[0]); - for (i = 1; i < 6; i++) /* ACCUM */ - sezi += fmult(state_ptr->b[i] >> 2, state_ptr->dq[i]); - return (sezi); -} -/* - * predictor_pole() - * - * computes the estimated signal from 2-pole predictor. - * - */ -int -predictor_pole( - struct g72x_state *state_ptr) -{ - return (fmult(state_ptr->a[1] >> 2, state_ptr->sr[1]) + - fmult(state_ptr->a[0] >> 2, state_ptr->sr[0])); -} -/* - * step_size() - * - * computes the quantization step size of the adaptive quantizer. - * - */ -int -step_size( - struct g72x_state *state_ptr) -{ - int y; - int dif; - int al; - - if (state_ptr->ap >= 256) - return (state_ptr->yu); - else { - y = state_ptr->yl >> 6; - dif = state_ptr->yu - y; - al = state_ptr->ap >> 2; - if (dif > 0) - y += (dif * al) >> 6; - else if (dif < 0) - y += (dif * al + 0x3F) >> 6; - return (y); - } -} - -/* - * quantize() - * - * Given a raw sample, 'd', of the difference signal and a - * quantization step size scale factor, 'y', this routine returns the - * ADPCM codeword to which that sample gets quantized. The step - * size scale factor division operation is done in the log base 2 domain - * as a subtraction. - */ -int -quantize( - int d, /* Raw difference signal sample */ - int y, /* Step size multiplier */ - short *table, /* quantization table */ - int size) /* table size of short integers */ -{ - short dqm; /* Magnitude of 'd' */ - short exp; /* Integer part of base 2 log of 'd' */ - short mant; /* Fractional part of base 2 log */ - short dl; /* Log of magnitude of 'd' */ - short dln; /* Step size scale factor normalized log */ - int i; - - /* - * LOG - * - * Compute base 2 log of 'd', and store in 'dl'. - */ - dqm = abs(d); - exp = quan(dqm >> 1, power2, 15); - mant = ((dqm << 7) >> exp) & 0x7F; /* Fractional portion. */ - dl = (exp << 7) + mant; - - /* - * SUBTB - * - * "Divide" by step size multiplier. - */ - dln = dl - (y >> 2); - - /* - * QUAN - * - * Obtain codword i for 'd'. - */ - i = quan(dln, table, size); - if (d < 0) /* take 1's complement of i */ - return ((size << 1) + 1 - i); - else if (i == 0) /* take 1's complement of 0 */ - return ((size << 1) + 1); /* new in 1988 */ - else - return (i); -} -/* - * reconstruct() - * - * Returns reconstructed difference signal 'dq' obtained from - * codeword 'i' and quantization step size scale factor 'y'. - * Multiplication is performed in log base 2 domain as addition. - */ -int -reconstruct( - int sign, /* 0 for non-negative value */ - int dqln, /* G.72x codeword */ - int y) /* Step size multiplier */ -{ - short dql; /* Log of 'dq' magnitude */ - short dex; /* Integer part of log */ - short dqt; - short dq; /* Reconstructed difference signal sample */ - - dql = dqln + (y >> 2); /* ADDA */ - - if (dql < 0) { - return ((sign) ? -0x8000 : 0); - } else { /* ANTILOG */ - dex = (dql >> 7) & 15; - dqt = 128 + (dql & 127); - dq = (dqt << 7) >> (14 - dex); - return ((sign) ? (dq - 0x8000) : dq); - } -} - - -/* - * update() - * - * updates the state variables for each output code - */ -void -update( - int code_size, /* distinguish 723_40 with others */ - int y, /* quantizer step size */ - int wi, /* scale factor multiplier */ - int fi, /* for long/short term energies */ - int dq, /* quantized prediction difference */ - int sr, /* reconstructed signal */ - int dqsez, /* difference from 2-pole predictor */ - struct g72x_state *state_ptr) /* coder state pointer */ -{ - int cnt; - short mag, exp; /* Adaptive predictor, FLOAT A */ - short a2p = 0; /* LIMC */ - short a1ul; /* UPA1 */ - short pks1; /* UPA2 */ - short fa1; - char tr; /* tone/transition detector */ - short ylint, thr2, dqthr; - short ylfrac, thr1; - short pk0; - - pk0 = (dqsez < 0) ? 1 : 0; /* needed in updating predictor poles */ - - mag = dq & 0x7FFF; /* prediction difference magnitude */ - /* TRANS */ - ylint = state_ptr->yl >> 15; /* exponent part of yl */ - ylfrac = (state_ptr->yl >> 10) & 0x1F; /* fractional part of yl */ - thr1 = (32 + ylfrac) << ylint; /* threshold */ - thr2 = (ylint > 9) ? 31 << 10 : thr1; /* limit thr2 to 31 << 10 */ - dqthr = (thr2 + (thr2 >> 1)) >> 1; /* dqthr = 0.75 * thr2 */ - if (state_ptr->td == 0) /* signal supposed voice */ - tr = 0; - else if (mag <= dqthr) /* supposed data, but small mag */ - tr = 0; /* treated as voice */ - else /* signal is data (modem) */ - tr = 1; - - /* - * Quantizer scale factor adaptation. - */ - - /* FUNCTW & FILTD & DELAY */ - /* update non-steady state step size multiplier */ - state_ptr->yu = y + ((wi - y) >> 5); - - /* LIMB */ - if (state_ptr->yu < 544) /* 544 <= yu <= 5120 */ - state_ptr->yu = 544; - else if (state_ptr->yu > 5120) - state_ptr->yu = 5120; - - /* FILTE & DELAY */ - /* update steady state step size multiplier */ - state_ptr->yl += state_ptr->yu + ((-state_ptr->yl) >> 6); - - /* - * Adaptive predictor coefficients. - */ - if (tr == 1) { /* reset a's and b's for modem signal */ - state_ptr->a[0] = 0; - state_ptr->a[1] = 0; - state_ptr->b[0] = 0; - state_ptr->b[1] = 0; - state_ptr->b[2] = 0; - state_ptr->b[3] = 0; - state_ptr->b[4] = 0; - state_ptr->b[5] = 0; - } else { /* update a's and b's */ - pks1 = pk0 ^ state_ptr->pk[0]; /* UPA2 */ - - /* update predictor pole a[1] */ - a2p = state_ptr->a[1] - (state_ptr->a[1] >> 7); - if (dqsez != 0) { - fa1 = (pks1) ? state_ptr->a[0] : -state_ptr->a[0]; - if (fa1 < -8191) /* a2p = function of fa1 */ - a2p -= 0x100; - else if (fa1 > 8191) - a2p += 0xFF; - else - a2p += fa1 >> 5; - - if (pk0 ^ state_ptr->pk[1]) - /* LIMC */ - if (a2p <= -12160) - a2p = -12288; - else if (a2p >= 12416) - a2p = 12288; - else - a2p -= 0x80; - else if (a2p <= -12416) - a2p = -12288; - else if (a2p >= 12160) - a2p = 12288; - else - a2p += 0x80; - } - - /* TRIGB & DELAY */ - state_ptr->a[1] = a2p; - - /* UPA1 */ - /* update predictor pole a[0] */ - state_ptr->a[0] -= state_ptr->a[0] >> 8; - if (dqsez != 0){ - if (pks1 == 0) - state_ptr->a[0] += 192; - else - state_ptr->a[0] -= 192; - } - - /* LIMD */ - a1ul = 15360 - a2p; - if (state_ptr->a[0] < -a1ul) - state_ptr->a[0] = -a1ul; - else if (state_ptr->a[0] > a1ul) - state_ptr->a[0] = a1ul; - - /* UPB : update predictor zeros b[6] */ - for (cnt = 0; cnt < 6; cnt++) { - if (code_size == 5) /* for 40Kbps G.723 */ - state_ptr->b[cnt] -= state_ptr->b[cnt] >> 9; - else /* for G.721 and 24Kbps G.723 */ - state_ptr->b[cnt] -= state_ptr->b[cnt] >> 8; - if (dq & 0x7FFF) { /* XOR */ - if ((dq ^ state_ptr->dq[cnt]) >= 0) - state_ptr->b[cnt] += 128; - else - state_ptr->b[cnt] -= 128; - } - } - } - - for (cnt = 5; cnt > 0; cnt--) - state_ptr->dq[cnt] = state_ptr->dq[cnt-1]; - /* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */ - if (mag == 0) { - state_ptr->dq[0] = (dq >= 0) ? 0x20 : 0xFC20; - } else { - exp = quan(mag, power2, 15); - state_ptr->dq[0] = (dq >= 0) ? - (exp << 6) + ((mag << 6) >> exp) : - (exp << 6) + ((mag << 6) >> exp) - 0x400; - } - - state_ptr->sr[1] = state_ptr->sr[0]; - /* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */ - if (sr == 0) { - state_ptr->sr[0] = 0x20; - } else if (sr > 0) { - exp = quan(sr, power2, 15); - state_ptr->sr[0] = (exp << 6) + ((sr << 6) >> exp); - } else if (sr > -32768) { - mag = -sr; - exp = quan(mag, power2, 15); - state_ptr->sr[0] = (exp << 6) + ((mag << 6) >> exp) - 0x400; - } else - state_ptr->sr[0] = 0xFC20; - - /* DELAY A */ - state_ptr->pk[1] = state_ptr->pk[0]; - state_ptr->pk[0] = pk0; - - /* TONE */ - if (tr == 1) /* this sample has been treated as data */ - state_ptr->td = 0; /* next one will be treated as voice */ - else if (a2p < -11776) /* small sample-to-sample correlation */ - state_ptr->td = 1; /* signal may be data */ - else /* signal is voice */ - state_ptr->td = 0; - - /* - * Adaptation speed control. - */ - state_ptr->dms += (fi - state_ptr->dms) >> 5; /* FILTA */ - state_ptr->dml += (((fi << 2) - state_ptr->dml) >> 7); /* FILTB */ - - if (tr == 1) - state_ptr->ap = 256; - else if (y < 1536) /* SUBTC */ - state_ptr->ap += (0x200 - state_ptr->ap) >> 4; - else if (state_ptr->td == 1) - state_ptr->ap += (0x200 - state_ptr->ap) >> 4; - else if (abs((state_ptr->dms << 2) - state_ptr->dml) >= - (state_ptr->dml >> 3)) - state_ptr->ap += (0x200 - state_ptr->ap) >> 4; - else - state_ptr->ap += (-state_ptr->ap) >> 4; -} - -/* - * tandem_adjust(sr, se, y, i, sign) - * - * At the end of ADPCM decoding, it simulates an encoder which may be receiving - * the output of this decoder as a tandem process. If the output of the - * simulated encoder differs from the input to this decoder, the decoder output - * is adjusted by one level of A-law or u-law codes. - * - * Input: - * sr decoder output linear PCM sample, - * se predictor estimate sample, - * y quantizer step size, - * i decoder input code, - * sign sign bit of code i - * - * Return: - * adjusted A-law or u-law compressed sample. - */ -int -tandem_adjust_alaw( - int sr, /* decoder output linear PCM sample */ - int se, /* predictor estimate sample */ - int y, /* quantizer step size */ - int i, /* decoder input code */ - int sign, - short *qtab) -{ - unsigned char sp; /* A-law compressed 8-bit code */ - short dx; /* prediction error */ - char id; /* quantized prediction error */ - int sd; /* adjusted A-law decoded sample value */ - int im; /* biased magnitude of i */ - int imx; /* biased magnitude of id */ - - if (sr <= -32768) - sr = -1; - sp = linear2alaw((sr >> 1) << 3); /* short to A-law compression */ - dx = (alaw2linear(sp) >> 2) - se; /* 16-bit prediction error */ - id = quantize(dx, y, qtab, sign - 1); - - if (id == i) { /* no adjustment on sp */ - return (sp); - } else { /* sp adjustment needed */ - /* ADPCM codes : 8, 9, ... F, 0, 1, ... , 6, 7 */ - im = i ^ sign; /* 2's complement to biased unsigned */ - imx = id ^ sign; - - if (imx > im) { /* sp adjusted to next lower value */ - if (sp & 0x80) { - sd = (sp == 0xD5) ? 0x55 : - ((sp ^ 0x55) - 1) ^ 0x55; - } else { - sd = (sp == 0x2A) ? 0x2A : - ((sp ^ 0x55) + 1) ^ 0x55; - } - } else { /* sp adjusted to next higher value */ - if (sp & 0x80) - sd = (sp == 0xAA) ? 0xAA : - ((sp ^ 0x55) + 1) ^ 0x55; - else - sd = (sp == 0x55) ? 0xD5 : - ((sp ^ 0x55) - 1) ^ 0x55; - } - return (sd); - } -} - -int -tandem_adjust_ulaw( - int sr, /* decoder output linear PCM sample */ - int se, /* predictor estimate sample */ - int y, /* quantizer step size */ - int i, /* decoder input code */ - int sign, - short *qtab) -{ - unsigned char sp; /* u-law compressed 8-bit code */ - short dx; /* prediction error */ - char id; /* quantized prediction error */ - int sd; /* adjusted u-law decoded sample value */ - int im; /* biased magnitude of i */ - int imx; /* biased magnitude of id */ - - if (sr <= -32768) - sr = 0; - sp = linear2ulaw(sr << 2); /* short to u-law compression */ - dx = (ulaw2linear(sp) >> 2) - se; /* 16-bit prediction error */ - id = quantize(dx, y, qtab, sign - 1); - if (id == i) { - return (sp); - } else { - /* ADPCM codes : 8, 9, ... F, 0, 1, ... , 6, 7 */ - im = i ^ sign; /* 2's complement to biased unsigned */ - imx = id ^ sign; - if (imx > im) { /* sp adjusted to next lower value */ - if (sp & 0x80) - sd = (sp == 0xFF) ? 0x7E : sp + 1; - else - sd = (sp == 0) ? 0 : sp - 1; - - } else { /* sp adjusted to next higher value */ - if (sp & 0x80) - sd = (sp == 0x80) ? 0x80 : sp - 1; - else - sd = (sp == 0x7F) ? 0xFE : sp + 1; - } - return (sd); - } -} - - - - - - - - - - - - diff --git a/gr-vocoder/lib/g7xx/g72x.h b/gr-vocoder/lib/g7xx/g72x.h deleted file mode 100644 index 9d906cae7..000000000 --- a/gr-vocoder/lib/g7xx/g72x.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * This source code is a product of Sun Microsystems, Inc. and is provided - * for unrestricted use. Users may copy or modify this source code without - * charge. - * - * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING - * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun source code is provided with no support and without any obligation on - * the part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * g72x.h - * - * Header file for CCITT conversion routines. - * - */ -#ifndef _G72X_H -#define _G72X_H - -#define AUDIO_ENCODING_ULAW (1) /* ISDN u-law */ -#define AUDIO_ENCODING_ALAW (2) /* ISDN A-law */ -#define AUDIO_ENCODING_LINEAR (3) /* PCM 2's-complement (0-center) */ - -/* - * The following is the definition of the state structure - * used by the G.721/G.723 encoder and decoder to preserve their internal - * state between successive calls. The meanings of the majority - * of the state structure fields are explained in detail in the - * CCITT Recommendation G.721. The field names are essentially indentical - * to variable names in the bit level description of the coding algorithm - * included in this Recommendation. - */ -struct g72x_state { - long yl; /* Locked or steady state step size multiplier. */ - short yu; /* Unlocked or non-steady state step size multiplier. */ - short dms; /* Short term energy estimate. */ - short dml; /* Long term energy estimate. */ - short ap; /* Linear weighting coefficient of 'yl' and 'yu'. */ - - short a[2]; /* Coefficients of pole portion of prediction filter. */ - short b[6]; /* Coefficients of zero portion of prediction filter. */ - short pk[2]; /* - * Signs of previous two samples of a partially - * reconstructed signal. - */ - short dq[6]; /* - * Previous 6 samples of the quantized difference - * signal represented in an internal floating point - * format. - */ - short sr[2]; /* - * Previous 2 samples of the quantized difference - * signal represented in an internal floating point - * format. - */ - char td; /* delayed tone detect, new in 1988 version */ -}; - -/* External function definitions. */ - -extern void g72x_init_state(struct g72x_state *); -extern int g721_encoder( - int sample, - int in_coding, - struct g72x_state *state_ptr); -extern int g721_decoder( - int code, - int out_coding, - struct g72x_state *state_ptr); -extern int g723_24_encoder( - int sample, - int in_coding, - struct g72x_state *state_ptr); -extern int g723_24_decoder( - int code, - int out_coding, - struct g72x_state *state_ptr); -extern int g723_40_encoder( - int sample, - int in_coding, - struct g72x_state *state_ptr); -extern int g723_40_decoder( - int code, - int out_coding, - struct g72x_state *state_ptr); - - -extern int -quantize( - int d, - int y, - short *table, - int size); -extern int reconstruct(int,int,int);void - -extern update( - int code_size, - int y, - int wi, - int fi, - int dq, - int sr, - int dqsez, - struct g72x_state *state_ptr); -extern int -tandem_adjust_alaw( - int sr, - int se, - int y, - int i, - int sign, - short *qtab); - -extern int -tandem_adjust_ulaw( - int sr, - int se, - int y, - int i, - int sign, - short *qtab); - -extern unsigned char -linear2alaw( - int pcm_val); - -extern int -alaw2linear( - unsigned char a_val); - -extern unsigned char -linear2ulaw(int pcm_val); - -extern int ulaw2linear( unsigned char u_val); - -extern int predictor_zero(struct g72x_state *state_ptr); - -extern int predictor_pole( struct g72x_state *state_ptr); -extern int step_size( struct g72x_state *state_ptr); -#endif /* !_G72X_H */ diff --git a/gr-vocoder/lib/gsm/CMakeLists.txt b/gr-vocoder/lib/gsm/CMakeLists.txt deleted file mode 100644 index 8a4813a4f..000000000 --- a/gr-vocoder/lib/gsm/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Append all sources in this dir -######################################################################## -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -set(gsm_sources - ${CMAKE_CURRENT_SOURCE_DIR}/add.c - ${CMAKE_CURRENT_SOURCE_DIR}/code.c - ${CMAKE_CURRENT_SOURCE_DIR}/debug.c - ${CMAKE_CURRENT_SOURCE_DIR}/decode.c - ${CMAKE_CURRENT_SOURCE_DIR}/gsm_create.c - ${CMAKE_CURRENT_SOURCE_DIR}/gsm_decode.c - ${CMAKE_CURRENT_SOURCE_DIR}/gsm_destroy.c - ${CMAKE_CURRENT_SOURCE_DIR}/gsm_encode.c - ${CMAKE_CURRENT_SOURCE_DIR}/gsm_explode.c - ${CMAKE_CURRENT_SOURCE_DIR}/gsm_implode.c - ${CMAKE_CURRENT_SOURCE_DIR}/gsm_option.c - ${CMAKE_CURRENT_SOURCE_DIR}/gsm_print.c - ${CMAKE_CURRENT_SOURCE_DIR}/long_term.c - ${CMAKE_CURRENT_SOURCE_DIR}/lpc.c - ${CMAKE_CURRENT_SOURCE_DIR}/preprocess.c - ${CMAKE_CURRENT_SOURCE_DIR}/rpe.c - ${CMAKE_CURRENT_SOURCE_DIR}/short_term.c - ${CMAKE_CURRENT_SOURCE_DIR}/table.c -) - -set_source_files_properties(${gsm_sources} - PROPERTIES COMPILE_DEFINITION "NeedFunctionPrototypes=1" -) -list(APPEND gr_vocoder_sources ${gsm_sources}) diff --git a/gr-vocoder/lib/gsm/COPYRIGHT b/gr-vocoder/lib/gsm/COPYRIGHT deleted file mode 100644 index eba0e523b..000000000 --- a/gr-vocoder/lib/gsm/COPYRIGHT +++ /dev/null @@ -1,16 +0,0 @@ -Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, -Technische Universitaet Berlin - -Any use of this software is permitted provided that this notice is not -removed and that neither the authors nor the Technische Universitaet Berlin -are deemed to have made any representations as to the suitability of this -software for any purpose nor are held responsible for any defects of -this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - -As a matter of courtesy, the authors request to be informed about uses -this software has found, about bugs in this software, and about any -improvements that may be of general interest. - -Berlin, 28.11.1994 -Jutta Degener -Carsten Bormann diff --git a/gr-vocoder/lib/gsm/README b/gr-vocoder/lib/gsm/README deleted file mode 100644 index 1927d878a..000000000 --- a/gr-vocoder/lib/gsm/README +++ /dev/null @@ -1,4 +0,0 @@ -This code was extracted from gsm-1.0-pl10.tar.gz -See COPYRIGHT for the copyright. - -See http://kbs.cs.tu-berlin.de/~jutta/toast.html for docs. diff --git a/gr-vocoder/lib/gsm/README.gsm b/gr-vocoder/lib/gsm/README.gsm deleted file mode 100644 index 10470e04e..000000000 --- a/gr-vocoder/lib/gsm/README.gsm +++ /dev/null @@ -1,37 +0,0 @@ - -GSM 06.10 13 kbit/s RPE/LTP speech compression available --------------------------------------------------------- - -The Communications and Operating Systems Research Group (KBS) at the -Technische Universitaet Berlin is currently working on a set of -UNIX-based tools for computer-mediated telecooperation that will be -made freely available. - -As part of this effort we are publishing an implementation of the -European GSM 06.10 provisional standard for full-rate speech -transcoding, prI-ETS 300 036, which uses RPE/LTP (residual pulse -excitation/long term prediction) coding at 13 kbit/s. - -GSM 06.10 compresses frames of 160 13-bit samples (8 kHz sampling -rate, i.e. a frame rate of 50 Hz) into 260 bits; for compatibility -with typical UNIX applications, our implementation turns frames of 160 -16-bit linear samples into 33-byte frames (1650 Bytes/s). -The quality of the algorithm is good enough for reliable speaker -recognition; even music often survives transcoding in recognizable -form (given the bandwidth limitations of 8 kHz sampling rate). - -The interfaces offered are a front end modelled after compress(1), and -a library API. Compression and decompression run faster than realtime -on most SPARCstations. The implementation has been verified against the -ETSI standard test patterns. - -Jutta Degener (jutta@cs.tu-berlin.de) -Carsten Bormann (cabo@cs.tu-berlin.de) - -Communications and Operating Systems Research Group, TU Berlin -Fax: +49.30.31425156, Phone: +49.30.31424315 - --- -Copyright 1992 by Jutta Degener and Carsten Bormann, Technische -Universitaet Berlin. See the accompanying file "COPYRIGHT" for -details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. diff --git a/gr-vocoder/lib/gsm/add.c b/gr-vocoder/lib/gsm/add.c deleted file mode 100644 index 4118107b1..000000000 --- a/gr-vocoder/lib/gsm/add.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -/* - * See private.h for the more commonly used macro versions. - */ - -#include <stdio.h> -#include <assert.h> - -#include "private.h" -#include "gsm.h" -#include "proto.h" - -#define saturate(x) \ - ((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x)) - -word gsm_add P2((a,b), word a, word b) -{ - longword sum = (longword)a + (longword)b; - return saturate(sum); -} - -word gsm_sub P2((a,b), word a, word b) -{ - longword diff = (longword)a - (longword)b; - return saturate(diff); -} - -word gsm_mult P2((a,b), word a, word b) -{ - if (a == MIN_WORD && b == MIN_WORD) return MAX_WORD; - else return SASR( (longword)a * (longword)b, 15 ); -} - -word gsm_mult_r P2((a,b), word a, word b) -{ - if (b == MIN_WORD && a == MIN_WORD) return MAX_WORD; - else { - longword prod = (longword)a * (longword)b + 16384; - prod >>= 15; - return prod & 0xFFFF; - } -} - -word gsm_abs P1((a), word a) -{ - return a < 0 ? (a == MIN_WORD ? MAX_WORD : -a) : a; -} - -longword gsm_L_mult P2((a,b),word a, word b) -{ - assert( a != MIN_WORD || b != MIN_WORD ); - return ((longword)a * (longword)b) << 1; -} - -longword gsm_L_add P2((a,b), longword a, longword b) -{ - if (a < 0) { - if (b >= 0) return a + b; - else { - ulongword A = (ulongword)-(a + 1) + (ulongword)-(b + 1); - return A >= MAX_LONGWORD ? MIN_LONGWORD :-(longword)A-2; - } - } - else if (b <= 0) return a + b; - else { - ulongword A = (ulongword)a + (ulongword)b; - return A > MAX_LONGWORD ? MAX_LONGWORD : A; - } -} - -longword gsm_L_sub P2((a,b), longword a, longword b) -{ - if (a >= 0) { - if (b >= 0) return a - b; - else { - /* a>=0, b<0 */ - - ulongword A = (ulongword)a + -(b + 1); - return A >= MAX_LONGWORD ? MAX_LONGWORD : (A + 1); - } - } - else if (b <= 0) return a - b; - else { - /* a<0, b>0 */ - - ulongword A = (ulongword)-(a + 1) + b; - return A >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)A - 1; - } -} - -static unsigned char const bitoff[ 256 ] = { - 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -word gsm_norm P1((a), longword a ) -/* - * the number of left shifts needed to normalize the 32 bit - * variable L_var1 for positive values on the interval - * - * with minimum of - * minimum of 1073741824 (01000000000000000000000000000000) and - * maximum of 2147483647 (01111111111111111111111111111111) - * - * - * and for negative values on the interval with - * minimum of -2147483648 (-10000000000000000000000000000000) and - * maximum of -1073741824 ( -1000000000000000000000000000000). - * - * in order to normalize the result, the following - * operation must be done: L_norm_var1 = L_var1 << norm( L_var1 ); - * - * (That's 'ffs', only from the left, not the right..) - */ -{ - assert(a != 0); - - if (a < 0) { - if (a <= -1073741824) return 0; - a = ~a; - } - - return a & 0xffff0000 - ? ( a & 0xff000000 - ? -1 + bitoff[ 0xFF & (a >> 24) ] - : 7 + bitoff[ 0xFF & (a >> 16) ] ) - : ( a & 0xff00 - ? 15 + bitoff[ 0xFF & (a >> 8) ] - : 23 + bitoff[ 0xFF & a ] ); -} - -longword gsm_L_asl P2((a,n), longword a, int n) -{ - if (n >= 32) return 0; - if (n <= -32) return -(a < 0); - if (n < 0) return gsm_L_asr(a, -n); - return a << n; -} - -word gsm_asl P2((a,n), word a, int n) -{ - if (n >= 16) return 0; - if (n <= -16) return -(a < 0); - if (n < 0) return gsm_asr(a, -n); - return a << n; -} - -longword gsm_L_asr P2((a,n), longword a, int n) -{ - if (n >= 32) return -(a < 0); - if (n <= -32) return 0; - if (n < 0) return a << -n; - -# ifdef SASR - return a >> n; -# else - if (a >= 0) return a >> n; - else return -(longword)( -(ulongword)a >> n ); -# endif -} - -word gsm_asr P2((a,n), word a, int n) -{ - if (n >= 16) return -(a < 0); - if (n <= -16) return 0; - if (n < 0) return a << -n; - -# ifdef SASR - return a >> n; -# else - if (a >= 0) return a >> n; - else return -(word)( -(uword)a >> n ); -# endif -} - -/* - * (From p. 46, end of section 4.2.5) - * - * NOTE: The following lines gives [sic] one correct implementation - * of the div(num, denum) arithmetic operation. Compute div - * which is the integer division of num by denum: with denum - * >= num > 0 - */ - -word gsm_div P2((num,denum), word num, word denum) -{ - longword L_num = num; - longword L_denum = denum; - word div = 0; - int k = 15; - - /* The parameter num sometimes becomes zero. - * Although this is explicitly guarded against in 4.2.5, - * we assume that the result should then be zero as well. - */ - - /* assert(num != 0); */ - - assert(num >= 0 && denum >= num); - if (num == 0) - return 0; - - while (k--) { - div <<= 1; - L_num <<= 1; - - if (L_num >= L_denum) { - L_num -= L_denum; - div++; - } - } - - return div; -} diff --git a/gr-vocoder/lib/gsm/code.c b/gr-vocoder/lib/gsm/code.c deleted file mode 100644 index 68ea05226..000000000 --- a/gr-vocoder/lib/gsm/code.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include "config.h" - - -#ifdef HAS_STDLIB_H -#include <stdlib.h> -#else -# include "proto.h" - extern char * memcpy P((char *, char *, int)); -#endif - -#include "private.h" -#include "gsm.h" -#include "proto.h" -#include <string.h> - -/* - * 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER - */ - -void Gsm_Coder P8((S,s,LARc,Nc,bc,Mc,xmaxc,xMc), - - struct gsm_state * S, - - word * s, /* [0..159] samples IN */ - -/* - * The RPE-LTD coder works on a frame by frame basis. The length of - * the frame is equal to 160 samples. Some computations are done - * once per frame to produce at the output of the coder the - * LARc[1..8] parameters which are the coded LAR coefficients and - * also to realize the inverse filtering operation for the entire - * frame (160 samples of signal d[0..159]). These parts produce at - * the output of the coder: - */ - - word * LARc, /* [0..7] LAR coefficients OUT */ - -/* - * Procedure 4.2.11 to 4.2.18 are to be executed four times per - * frame. That means once for each sub-segment RPE-LTP analysis of - * 40 samples. These parts produce at the output of the coder: - */ - - word * Nc, /* [0..3] LTP lag OUT */ - word * bc, /* [0..3] coded LTP gain OUT */ - word * Mc, /* [0..3] RPE grid selection OUT */ - word * xmaxc,/* [0..3] Coded maximum amplitude OUT */ - word * xMc /* [13*4] normalized RPE samples OUT */ -) -{ - int k; - word * dp = S->dp0 + 120; /* [ -120...-1 ] */ - word * dpp = dp; /* [ 0...39 ] */ - - static word e[50]; - - word so[160]; - - Gsm_Preprocess (S, s, so); - Gsm_LPC_Analysis (S, so, LARc); - Gsm_Short_Term_Analysis_Filter (S, LARc, so); - - for (k = 0; k <= 3; k++, xMc += 13) { - - Gsm_Long_Term_Predictor ( S, - so+k*40, /* d [0..39] IN */ - dp, /* dp [-120..-1] IN */ - e + 5, /* e [0..39] OUT */ - dpp, /* dpp [0..39] OUT */ - Nc++, - bc++); - - Gsm_RPE_Encoding ( S, - e + 5, /* e ][0..39][ IN/OUT */ - xmaxc++, Mc++, xMc ); - /* - * Gsm_Update_of_reconstructed_short_time_residual_signal - * ( dpp, e + 5, dp ); - */ - - { register int i; - register longword ltmp; - for (i = 0; i <= 39; i++) - dp[ i ] = GSM_ADD( e[5 + i], dpp[i] ); - } - dp += 40; - dpp += 40; - - } - (void)memcpy( (char *)S->dp0, (char *)(S->dp0 + 160), - 120 * sizeof(*S->dp0) ); -} diff --git a/gr-vocoder/lib/gsm/config.h b/gr-vocoder/lib/gsm/config.h deleted file mode 100644 index 2a962ac7d..000000000 --- a/gr-vocoder/lib/gsm/config.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/*$Header$*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#undef SIGHANDLER_T /* signal handlers are void */ -#undef HAS_SYSV_SIGNAL /* sigs not blocked/reset? */ - -#define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */ -#undef HAS_LIMITS_H /* /usr/include/limits.h */ -#define HAS_FCNTL_H 1 /* /usr/include/fcntl.h */ -#undef HAS_ERRNO_DECL /* errno.h declares errno */ - -#define HAS_FSTAT 1 /* fstat syscall */ -#define HAS_FCHMOD 1 /* fchmod syscall */ -#define HAS_CHMOD 1 /* chmod syscall */ -#define HAS_FCHOWN 1 /* fchown syscall */ -#define HAS_CHOWN 1 /* chown syscall */ -#undef HAS__FSETMODE /* _fsetmode -- set file mode */ - -#define HAS_STRING_H 1 /* /usr/include/string.h */ -#undef HAS_STRINGS_H /* /usr/include/strings.h */ - -#define HAS_UNISTD_H 1 /* /usr/include/unistd.h */ -#define HAS_UTIME 1 /* POSIX utime(path, times) */ -#undef HAS_UTIMES /* use utimes() syscall instead */ -#define HAS_UTIME_H 1 /* UTIME header file */ -#undef HAS_UTIMBUF /* struct utimbuf */ -#undef HAS_UTIMEUSEC /* microseconds in utimbuf? */ - -#endif /* CONFIG_H */ diff --git a/gr-vocoder/lib/gsm/debug.c b/gr-vocoder/lib/gsm/debug.c deleted file mode 100644 index 58d1dbcac..000000000 --- a/gr-vocoder/lib/gsm/debug.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include "private.h" - -#ifndef NDEBUG - -/* If NDEBUG _is_ defined and no debugging should be performed, - * calls to functions in this module are #defined to nothing - * in private.h. - */ - -#include <stdio.h> -#include "proto.h" - -void gsm_debug_words P4( (name, from, to, ptr), - char * name, - int from, - int to, - word * ptr) -{ - int nprinted = 0; - - fprintf( stderr, "%s [%d .. %d]: ", name, from, to ); - while (from <= to) { - fprintf(stderr, "%d ", ptr[ from ] ); - from++; - if (nprinted++ >= 7) { - nprinted = 0; - if (from < to) putc('\n', stderr); - } - } - putc('\n', stderr); -} - -void gsm_debug_longwords P4( (name, from, to, ptr), - char * name, - int from, - int to, - longword * ptr) -{ - int nprinted = 0; - - fprintf( stderr, "%s [%d .. %d]: ", name, from, to ); - while (from <= to) { - - fprintf(stderr, "%ld ", ptr[ from ] ); - from++; - if (nprinted++ >= 7) { - nprinted = 0; - if (from < to) putc('\n', stderr); - } - } - putc('\n', stderr); -} - -void gsm_debug_longword P2( (name, value), - char * name, - longword value ) -{ - fprintf(stderr, "%s: %ld\n", name, (long)value ); -} - -void gsm_debug_word P2( (name, value), - char * name, - word value ) -{ - fprintf(stderr, "%s: %ld\n", name, (long)value); -} - -#endif diff --git a/gr-vocoder/lib/gsm/decode.c b/gr-vocoder/lib/gsm/decode.c deleted file mode 100644 index 34e558663..000000000 --- a/gr-vocoder/lib/gsm/decode.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include <stdio.h> - -#include "private.h" -#include "gsm.h" -#include "proto.h" - -/* - * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER - */ - -static void Postprocessing P2((S,s), - struct gsm_state * S, - register word * s) -{ - register int k; - register word msr = S->msr; - register longword ltmp; /* for GSM_ADD */ - register word tmp; - - for (k = 160; k--; s++) { - tmp = GSM_MULT_R( msr, 28180 ); - msr = GSM_ADD(*s, tmp); /* Deemphasis */ - *s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */ - } - S->msr = msr; -} - -void Gsm_Decoder P8((S,LARcr, Ncr,bcr,Mcr,xmaxcr,xMcr,s), - struct gsm_state * S, - - word * LARcr, /* [0..7] IN */ - - word * Ncr, /* [0..3] IN */ - word * bcr, /* [0..3] IN */ - word * Mcr, /* [0..3] IN */ - word * xmaxcr, /* [0..3] IN */ - word * xMcr, /* [0..13*4] IN */ - - word * s) /* [0..159] OUT */ -{ - int j, k; - word erp[40], wt[160]; - word * drp = S->dp0 + 120; - - for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) { - - Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp ); - Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp ); - - for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ]; - } - - Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s ); - Postprocessing(S, s); -} diff --git a/gr-vocoder/lib/gsm/gsm.h b/gr-vocoder/lib/gsm/gsm.h deleted file mode 100644 index a6d5e4705..000000000 --- a/gr-vocoder/lib/gsm/gsm.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/*$Header$*/ - -#ifndef GSM_H -#define GSM_H - -#ifdef __cplusplus -# define NeedFunctionPrototypes 1 -#endif - -#if __STDC__ -# define NeedFunctionPrototypes 1 -#endif - -#ifdef _NO_PROTO -# undef NeedFunctionPrototypes -#endif - -#ifdef NeedFunctionPrototypes -# include <stdio.h> /* for FILE * */ -#endif - -#undef GSM_P -#if NeedFunctionPrototypes -# define GSM_P( protos ) protos -#else -# define GSM_P( protos ) ( /* protos */ ) -#endif - -/* - * Interface - */ - -typedef struct gsm_state * gsm; -typedef short gsm_signal; /* signed 16 bit */ -typedef unsigned char gsm_byte; -typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */ - -#define GSM_MAGIC 0xD /* 13 kbit/s RPE-LTP */ - -#define GSM_PATCHLEVEL 10 -#define GSM_MINOR 0 -#define GSM_MAJOR 1 - -#define GSM_OPT_VERBOSE 1 -#define GSM_OPT_FAST 2 -#define GSM_OPT_LTP_CUT 3 -#define GSM_OPT_WAV49 4 -#define GSM_OPT_FRAME_INDEX 5 -#define GSM_OPT_FRAME_CHAIN 6 - -#define GSM_SAMPLES_PER_FRAME 160 - -extern gsm gsm_create GSM_P((void)); -extern void gsm_destroy GSM_P((gsm)); - -extern int gsm_print GSM_P((FILE *, gsm, gsm_byte *)); -extern int gsm_option GSM_P((gsm, int, int *)); - -extern void gsm_encode GSM_P((gsm, gsm_signal *, gsm_byte *)); -extern int gsm_decode GSM_P((gsm, gsm_byte *, gsm_signal *)); - -extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *)); -extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *)); - -#undef GSM_P - -#endif /* GSM_H */ diff --git a/gr-vocoder/lib/gsm/gsm_create.c b/gr-vocoder/lib/gsm/gsm_create.c deleted file mode 100644 index a59aa2f2a..000000000 --- a/gr-vocoder/lib/gsm/gsm_create.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -static char const ident[] = "$Header$"; - -#include "config.h" - -#ifdef HAS_STRING_H -#include <string.h> -#else -# include "proto.h" - extern char * memset P((char *, int, int)); -#endif - -#ifdef HAS_STDLIB_H -# include <stdlib.h> -#else -# ifdef HAS_MALLOC_H -# include <malloc.h> -# else - extern char * malloc(); -# endif -#endif - -#include <stdio.h> - -#include "gsm.h" -#include "private.h" -#include "proto.h" - -gsm gsm_create P0() -{ - gsm r; - - r = (gsm)malloc(sizeof(struct gsm_state)); - if (!r) return r; - - memset((char *)r, 0, sizeof(*r)); - r->nrp = 40; - - return r; -} diff --git a/gr-vocoder/lib/gsm/gsm_decode.c b/gr-vocoder/lib/gsm/gsm_decode.c deleted file mode 100644 index 7ebf35dd0..000000000 --- a/gr-vocoder/lib/gsm/gsm_decode.c +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include "private.h" - -#include "gsm.h" -#include "proto.h" - -int gsm_decode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target) -{ - word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; - -#ifdef WAV49 - if (s->wav_fmt) { - - uword sr = 0; - - s->frame_index = !s->frame_index; - if (s->frame_index) { - - sr = *c++; - LARc[0] = sr & 0x3f; sr >>= 6; - sr |= (uword)*c++ << 2; - LARc[1] = sr & 0x3f; sr >>= 6; - sr |= (uword)*c++ << 4; - LARc[2] = sr & 0x1f; sr >>= 5; - LARc[3] = sr & 0x1f; sr >>= 5; - sr |= (uword)*c++ << 2; - LARc[4] = sr & 0xf; sr >>= 4; - LARc[5] = sr & 0xf; sr >>= 4; - sr |= (uword)*c++ << 2; /* 5 */ - LARc[6] = sr & 0x7; sr >>= 3; - LARc[7] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[0] = sr & 0x7f; sr >>= 7; - bc[0] = sr & 0x3; sr >>= 2; - Mc[0] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[0] = sr & 0x3f; sr >>= 6; - xmc[0] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[1] = sr & 0x7; sr >>= 3; - xmc[2] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[3] = sr & 0x7; sr >>= 3; - xmc[4] = sr & 0x7; sr >>= 3; - xmc[5] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 10 */ - xmc[6] = sr & 0x7; sr >>= 3; - xmc[7] = sr & 0x7; sr >>= 3; - xmc[8] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[9] = sr & 0x7; sr >>= 3; - xmc[10] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[11] = sr & 0x7; sr >>= 3; - xmc[12] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[1] = sr & 0x7f; sr >>= 7; - bc[1] = sr & 0x3; sr >>= 2; - Mc[1] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[1] = sr & 0x3f; sr >>= 6; - xmc[13] = sr & 0x7; sr >>= 3; - sr = *c++; /* 15 */ - xmc[14] = sr & 0x7; sr >>= 3; - xmc[15] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[16] = sr & 0x7; sr >>= 3; - xmc[17] = sr & 0x7; sr >>= 3; - xmc[18] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[19] = sr & 0x7; sr >>= 3; - xmc[20] = sr & 0x7; sr >>= 3; - xmc[21] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[22] = sr & 0x7; sr >>= 3; - xmc[23] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[24] = sr & 0x7; sr >>= 3; - xmc[25] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; /* 20 */ - Nc[2] = sr & 0x7f; sr >>= 7; - bc[2] = sr & 0x3; sr >>= 2; - Mc[2] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[2] = sr & 0x3f; sr >>= 6; - xmc[26] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[27] = sr & 0x7; sr >>= 3; - xmc[28] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[29] = sr & 0x7; sr >>= 3; - xmc[30] = sr & 0x7; sr >>= 3; - xmc[31] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[32] = sr & 0x7; sr >>= 3; - xmc[33] = sr & 0x7; sr >>= 3; - xmc[34] = sr & 0x7; sr >>= 3; - sr = *c++; /* 25 */ - xmc[35] = sr & 0x7; sr >>= 3; - xmc[36] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[37] = sr & 0x7; sr >>= 3; - xmc[38] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[3] = sr & 0x7f; sr >>= 7; - bc[3] = sr & 0x3; sr >>= 2; - Mc[3] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[3] = sr & 0x3f; sr >>= 6; - xmc[39] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[40] = sr & 0x7; sr >>= 3; - xmc[41] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; /* 30 */ - xmc[42] = sr & 0x7; sr >>= 3; - xmc[43] = sr & 0x7; sr >>= 3; - xmc[44] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[45] = sr & 0x7; sr >>= 3; - xmc[46] = sr & 0x7; sr >>= 3; - xmc[47] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[48] = sr & 0x7; sr >>= 3; - xmc[49] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[50] = sr & 0x7; sr >>= 3; - xmc[51] = sr & 0x7; sr >>= 3; - - s->frame_chain = sr & 0xf; - } - else { - sr = s->frame_chain; - sr |= (uword)*c++ << 4; /* 1 */ - LARc[0] = sr & 0x3f; sr >>= 6; - LARc[1] = sr & 0x3f; sr >>= 6; - sr = *c++; - LARc[2] = sr & 0x1f; sr >>= 5; - sr |= (uword)*c++ << 3; - LARc[3] = sr & 0x1f; sr >>= 5; - LARc[4] = sr & 0xf; sr >>= 4; - sr |= (uword)*c++ << 2; - LARc[5] = sr & 0xf; sr >>= 4; - LARc[6] = sr & 0x7; sr >>= 3; - LARc[7] = sr & 0x7; sr >>= 3; - sr = *c++; /* 5 */ - Nc[0] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[0] = sr & 0x3; sr >>= 2; - Mc[0] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[0] = sr & 0x3f; sr >>= 6; - xmc[0] = sr & 0x7; sr >>= 3; - xmc[1] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[2] = sr & 0x7; sr >>= 3; - xmc[3] = sr & 0x7; sr >>= 3; - xmc[4] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[5] = sr & 0x7; sr >>= 3; - xmc[6] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; /* 10 */ - xmc[7] = sr & 0x7; sr >>= 3; - xmc[8] = sr & 0x7; sr >>= 3; - xmc[9] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[10] = sr & 0x7; sr >>= 3; - xmc[11] = sr & 0x7; sr >>= 3; - xmc[12] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[1] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[1] = sr & 0x3; sr >>= 2; - Mc[1] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[1] = sr & 0x3f; sr >>= 6; - xmc[13] = sr & 0x7; sr >>= 3; - xmc[14] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 15 */ - xmc[15] = sr & 0x7; sr >>= 3; - xmc[16] = sr & 0x7; sr >>= 3; - xmc[17] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[18] = sr & 0x7; sr >>= 3; - xmc[19] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[20] = sr & 0x7; sr >>= 3; - xmc[21] = sr & 0x7; sr >>= 3; - xmc[22] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[23] = sr & 0x7; sr >>= 3; - xmc[24] = sr & 0x7; sr >>= 3; - xmc[25] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[2] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; /* 20 */ - bc[2] = sr & 0x3; sr >>= 2; - Mc[2] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[2] = sr & 0x3f; sr >>= 6; - xmc[26] = sr & 0x7; sr >>= 3; - xmc[27] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[28] = sr & 0x7; sr >>= 3; - xmc[29] = sr & 0x7; sr >>= 3; - xmc[30] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[31] = sr & 0x7; sr >>= 3; - xmc[32] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[33] = sr & 0x7; sr >>= 3; - xmc[34] = sr & 0x7; sr >>= 3; - xmc[35] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 25 */ - xmc[36] = sr & 0x7; sr >>= 3; - xmc[37] = sr & 0x7; sr >>= 3; - xmc[38] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[3] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[3] = sr & 0x3; sr >>= 2; - Mc[3] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[3] = sr & 0x3f; sr >>= 6; - xmc[39] = sr & 0x7; sr >>= 3; - xmc[40] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[41] = sr & 0x7; sr >>= 3; - xmc[42] = sr & 0x7; sr >>= 3; - xmc[43] = sr & 0x7; sr >>= 3; - sr = *c++; /* 30 */ - xmc[44] = sr & 0x7; sr >>= 3; - xmc[45] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[46] = sr & 0x7; sr >>= 3; - xmc[47] = sr & 0x7; sr >>= 3; - xmc[48] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[49] = sr & 0x7; sr >>= 3; - xmc[50] = sr & 0x7; sr >>= 3; - xmc[51] = sr & 0x7; sr >>= 3; - } - } - else -#endif - { - /* GSM_MAGIC = (*c >> 4) & 0xF; */ - - if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1; - - LARc[0] = (*c++ & 0xF) << 2; /* 1 */ - LARc[0] |= (*c >> 6) & 0x3; - LARc[1] = *c++ & 0x3F; - LARc[2] = (*c >> 3) & 0x1F; - LARc[3] = (*c++ & 0x7) << 2; - LARc[3] |= (*c >> 6) & 0x3; - LARc[4] = (*c >> 2) & 0xF; - LARc[5] = (*c++ & 0x3) << 2; - LARc[5] |= (*c >> 6) & 0x3; - LARc[6] = (*c >> 3) & 0x7; - LARc[7] = *c++ & 0x7; - Nc[0] = (*c >> 1) & 0x7F; - bc[0] = (*c++ & 0x1) << 1; - bc[0] |= (*c >> 7) & 0x1; - Mc[0] = (*c >> 5) & 0x3; - xmaxc[0] = (*c++ & 0x1F) << 1; - xmaxc[0] |= (*c >> 7) & 0x1; - xmc[0] = (*c >> 4) & 0x7; - xmc[1] = (*c >> 1) & 0x7; - xmc[2] = (*c++ & 0x1) << 2; - xmc[2] |= (*c >> 6) & 0x3; - xmc[3] = (*c >> 3) & 0x7; - xmc[4] = *c++ & 0x7; - xmc[5] = (*c >> 5) & 0x7; - xmc[6] = (*c >> 2) & 0x7; - xmc[7] = (*c++ & 0x3) << 1; /* 10 */ - xmc[7] |= (*c >> 7) & 0x1; - xmc[8] = (*c >> 4) & 0x7; - xmc[9] = (*c >> 1) & 0x7; - xmc[10] = (*c++ & 0x1) << 2; - xmc[10] |= (*c >> 6) & 0x3; - xmc[11] = (*c >> 3) & 0x7; - xmc[12] = *c++ & 0x7; - Nc[1] = (*c >> 1) & 0x7F; - bc[1] = (*c++ & 0x1) << 1; - bc[1] |= (*c >> 7) & 0x1; - Mc[1] = (*c >> 5) & 0x3; - xmaxc[1] = (*c++ & 0x1F) << 1; - xmaxc[1] |= (*c >> 7) & 0x1; - xmc[13] = (*c >> 4) & 0x7; - xmc[14] = (*c >> 1) & 0x7; - xmc[15] = (*c++ & 0x1) << 2; - xmc[15] |= (*c >> 6) & 0x3; - xmc[16] = (*c >> 3) & 0x7; - xmc[17] = *c++ & 0x7; - xmc[18] = (*c >> 5) & 0x7; - xmc[19] = (*c >> 2) & 0x7; - xmc[20] = (*c++ & 0x3) << 1; - xmc[20] |= (*c >> 7) & 0x1; - xmc[21] = (*c >> 4) & 0x7; - xmc[22] = (*c >> 1) & 0x7; - xmc[23] = (*c++ & 0x1) << 2; - xmc[23] |= (*c >> 6) & 0x3; - xmc[24] = (*c >> 3) & 0x7; - xmc[25] = *c++ & 0x7; - Nc[2] = (*c >> 1) & 0x7F; - bc[2] = (*c++ & 0x1) << 1; /* 20 */ - bc[2] |= (*c >> 7) & 0x1; - Mc[2] = (*c >> 5) & 0x3; - xmaxc[2] = (*c++ & 0x1F) << 1; - xmaxc[2] |= (*c >> 7) & 0x1; - xmc[26] = (*c >> 4) & 0x7; - xmc[27] = (*c >> 1) & 0x7; - xmc[28] = (*c++ & 0x1) << 2; - xmc[28] |= (*c >> 6) & 0x3; - xmc[29] = (*c >> 3) & 0x7; - xmc[30] = *c++ & 0x7; - xmc[31] = (*c >> 5) & 0x7; - xmc[32] = (*c >> 2) & 0x7; - xmc[33] = (*c++ & 0x3) << 1; - xmc[33] |= (*c >> 7) & 0x1; - xmc[34] = (*c >> 4) & 0x7; - xmc[35] = (*c >> 1) & 0x7; - xmc[36] = (*c++ & 0x1) << 2; - xmc[36] |= (*c >> 6) & 0x3; - xmc[37] = (*c >> 3) & 0x7; - xmc[38] = *c++ & 0x7; - Nc[3] = (*c >> 1) & 0x7F; - bc[3] = (*c++ & 0x1) << 1; - bc[3] |= (*c >> 7) & 0x1; - Mc[3] = (*c >> 5) & 0x3; - xmaxc[3] = (*c++ & 0x1F) << 1; - xmaxc[3] |= (*c >> 7) & 0x1; - xmc[39] = (*c >> 4) & 0x7; - xmc[40] = (*c >> 1) & 0x7; - xmc[41] = (*c++ & 0x1) << 2; - xmc[41] |= (*c >> 6) & 0x3; - xmc[42] = (*c >> 3) & 0x7; - xmc[43] = *c++ & 0x7; /* 30 */ - xmc[44] = (*c >> 5) & 0x7; - xmc[45] = (*c >> 2) & 0x7; - xmc[46] = (*c++ & 0x3) << 1; - xmc[46] |= (*c >> 7) & 0x1; - xmc[47] = (*c >> 4) & 0x7; - xmc[48] = (*c >> 1) & 0x7; - xmc[49] = (*c++ & 0x1) << 2; - xmc[49] |= (*c >> 6) & 0x3; - xmc[50] = (*c >> 3) & 0x7; - xmc[51] = *c & 0x7; /* 33 */ - } - - Gsm_Decoder(s, LARc, Nc, bc, Mc, xmaxc, xmc, target); - - return 0; -} diff --git a/gr-vocoder/lib/gsm/gsm_destroy.c b/gr-vocoder/lib/gsm/gsm_destroy.c deleted file mode 100644 index 4807c0acd..000000000 --- a/gr-vocoder/lib/gsm/gsm_destroy.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include "gsm.h" -#include "config.h" -#include "proto.h" - -#ifdef HAS_STDLIB_H -# include <stdlib.h> -#else -# ifdef HAS_MALLOC_H -# include <malloc.h> -# else - extern void free(); -# endif -#endif - -void gsm_destroy P1((S), gsm S) -{ - if (S) free((char *)S); -} diff --git a/gr-vocoder/lib/gsm/gsm_encode.c b/gr-vocoder/lib/gsm/gsm_encode.c deleted file mode 100644 index 62338300e..000000000 --- a/gr-vocoder/lib/gsm/gsm_encode.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include "private.h" -#include "gsm.h" -#include "proto.h" - -void gsm_encode P3((s, source, c), gsm s, gsm_signal * source, gsm_byte * c) -{ - word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; - - Gsm_Coder(s, source, LARc, Nc, bc, Mc, xmaxc, xmc); - - - /* variable size - - GSM_MAGIC 4 - - LARc[0] 6 - LARc[1] 6 - LARc[2] 5 - LARc[3] 5 - LARc[4] 4 - LARc[5] 4 - LARc[6] 3 - LARc[7] 3 - - Nc[0] 7 - bc[0] 2 - Mc[0] 2 - xmaxc[0] 6 - xmc[0] 3 - xmc[1] 3 - xmc[2] 3 - xmc[3] 3 - xmc[4] 3 - xmc[5] 3 - xmc[6] 3 - xmc[7] 3 - xmc[8] 3 - xmc[9] 3 - xmc[10] 3 - xmc[11] 3 - xmc[12] 3 - - Nc[1] 7 - bc[1] 2 - Mc[1] 2 - xmaxc[1] 6 - xmc[13] 3 - xmc[14] 3 - xmc[15] 3 - xmc[16] 3 - xmc[17] 3 - xmc[18] 3 - xmc[19] 3 - xmc[20] 3 - xmc[21] 3 - xmc[22] 3 - xmc[23] 3 - xmc[24] 3 - xmc[25] 3 - - Nc[2] 7 - bc[2] 2 - Mc[2] 2 - xmaxc[2] 6 - xmc[26] 3 - xmc[27] 3 - xmc[28] 3 - xmc[29] 3 - xmc[30] 3 - xmc[31] 3 - xmc[32] 3 - xmc[33] 3 - xmc[34] 3 - xmc[35] 3 - xmc[36] 3 - xmc[37] 3 - xmc[38] 3 - - Nc[3] 7 - bc[3] 2 - Mc[3] 2 - xmaxc[3] 6 - xmc[39] 3 - xmc[40] 3 - xmc[41] 3 - xmc[42] 3 - xmc[43] 3 - xmc[44] 3 - xmc[45] 3 - xmc[46] 3 - xmc[47] 3 - xmc[48] 3 - xmc[49] 3 - xmc[50] 3 - xmc[51] 3 - */ - -#ifdef WAV49 - - if (s->wav_fmt) { - s->frame_index = !s->frame_index; - if (s->frame_index) { - - uword sr; - - sr = 0; - sr = sr >> 6 | LARc[0] << 10; - sr = sr >> 6 | LARc[1] << 10; - *c++ = sr >> 4; - sr = sr >> 5 | LARc[2] << 11; - *c++ = sr >> 7; - sr = sr >> 5 | LARc[3] << 11; - sr = sr >> 4 | LARc[4] << 12; - *c++ = sr >> 6; - sr = sr >> 4 | LARc[5] << 12; - sr = sr >> 3 | LARc[6] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | LARc[7] << 13; - sr = sr >> 7 | Nc[0] << 9; - *c++ = sr >> 5; - sr = sr >> 2 | bc[0] << 14; - sr = sr >> 2 | Mc[0] << 14; - sr = sr >> 6 | xmaxc[0] << 10; - *c++ = sr >> 3; - sr = sr >> 3 | xmc[0] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[1] << 13; - sr = sr >> 3 | xmc[2] << 13; - sr = sr >> 3 | xmc[3] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[4] << 13; - sr = sr >> 3 | xmc[5] << 13; - sr = sr >> 3 | xmc[6] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[7] << 13; - sr = sr >> 3 | xmc[8] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[9] << 13; - sr = sr >> 3 | xmc[10] << 13; - sr = sr >> 3 | xmc[11] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[12] << 13; - sr = sr >> 7 | Nc[1] << 9; - *c++ = sr >> 5; - sr = sr >> 2 | bc[1] << 14; - sr = sr >> 2 | Mc[1] << 14; - sr = sr >> 6 | xmaxc[1] << 10; - *c++ = sr >> 3; - sr = sr >> 3 | xmc[13] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[14] << 13; - sr = sr >> 3 | xmc[15] << 13; - sr = sr >> 3 | xmc[16] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[17] << 13; - sr = sr >> 3 | xmc[18] << 13; - sr = sr >> 3 | xmc[19] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[20] << 13; - sr = sr >> 3 | xmc[21] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[22] << 13; - sr = sr >> 3 | xmc[23] << 13; - sr = sr >> 3 | xmc[24] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[25] << 13; - sr = sr >> 7 | Nc[2] << 9; - *c++ = sr >> 5; - sr = sr >> 2 | bc[2] << 14; - sr = sr >> 2 | Mc[2] << 14; - sr = sr >> 6 | xmaxc[2] << 10; - *c++ = sr >> 3; - sr = sr >> 3 | xmc[26] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[27] << 13; - sr = sr >> 3 | xmc[28] << 13; - sr = sr >> 3 | xmc[29] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[30] << 13; - sr = sr >> 3 | xmc[31] << 13; - sr = sr >> 3 | xmc[32] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[33] << 13; - sr = sr >> 3 | xmc[34] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[35] << 13; - sr = sr >> 3 | xmc[36] << 13; - sr = sr >> 3 | xmc[37] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[38] << 13; - sr = sr >> 7 | Nc[3] << 9; - *c++ = sr >> 5; - sr = sr >> 2 | bc[3] << 14; - sr = sr >> 2 | Mc[3] << 14; - sr = sr >> 6 | xmaxc[3] << 10; - *c++ = sr >> 3; - sr = sr >> 3 | xmc[39] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[40] << 13; - sr = sr >> 3 | xmc[41] << 13; - sr = sr >> 3 | xmc[42] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[43] << 13; - sr = sr >> 3 | xmc[44] << 13; - sr = sr >> 3 | xmc[45] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[46] << 13; - sr = sr >> 3 | xmc[47] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[48] << 13; - sr = sr >> 3 | xmc[49] << 13; - sr = sr >> 3 | xmc[50] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[51] << 13; - sr = sr >> 4; - *c = sr >> 8; - s->frame_chain = *c; - } - else { - uword sr; - - sr = 0; - sr = sr >> 4 | s->frame_chain << 12; - sr = sr >> 6 | LARc[0] << 10; - *c++ = sr >> 6; - sr = sr >> 6 | LARc[1] << 10; - *c++ = sr >> 8; - sr = sr >> 5 | LARc[2] << 11; - sr = sr >> 5 | LARc[3] << 11; - *c++ = sr >> 6; - sr = sr >> 4 | LARc[4] << 12; - sr = sr >> 4 | LARc[5] << 12; - *c++ = sr >> 6; - sr = sr >> 3 | LARc[6] << 13; - sr = sr >> 3 | LARc[7] << 13; - *c++ = sr >> 8; - sr = sr >> 7 | Nc[0] << 9; - sr = sr >> 2 | bc[0] << 14; - *c++ = sr >> 7; - sr = sr >> 2 | Mc[0] << 14; - sr = sr >> 6 | xmaxc[0] << 10; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[0] << 13; - sr = sr >> 3 | xmc[1] << 13; - sr = sr >> 3 | xmc[2] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[3] << 13; - sr = sr >> 3 | xmc[4] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[5] << 13; - sr = sr >> 3 | xmc[6] << 13; - sr = sr >> 3 | xmc[7] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[8] << 13; - sr = sr >> 3 | xmc[9] << 13; - sr = sr >> 3 | xmc[10] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[11] << 13; - sr = sr >> 3 | xmc[12] << 13; - *c++ = sr >> 8; - sr = sr >> 7 | Nc[1] << 9; - sr = sr >> 2 | bc[1] << 14; - *c++ = sr >> 7; - sr = sr >> 2 | Mc[1] << 14; - sr = sr >> 6 | xmaxc[1] << 10; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[13] << 13; - sr = sr >> 3 | xmc[14] << 13; - sr = sr >> 3 | xmc[15] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[16] << 13; - sr = sr >> 3 | xmc[17] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[18] << 13; - sr = sr >> 3 | xmc[19] << 13; - sr = sr >> 3 | xmc[20] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[21] << 13; - sr = sr >> 3 | xmc[22] << 13; - sr = sr >> 3 | xmc[23] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[24] << 13; - sr = sr >> 3 | xmc[25] << 13; - *c++ = sr >> 8; - sr = sr >> 7 | Nc[2] << 9; - sr = sr >> 2 | bc[2] << 14; - *c++ = sr >> 7; - sr = sr >> 2 | Mc[2] << 14; - sr = sr >> 6 | xmaxc[2] << 10; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[26] << 13; - sr = sr >> 3 | xmc[27] << 13; - sr = sr >> 3 | xmc[28] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[29] << 13; - sr = sr >> 3 | xmc[30] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[31] << 13; - sr = sr >> 3 | xmc[32] << 13; - sr = sr >> 3 | xmc[33] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[34] << 13; - sr = sr >> 3 | xmc[35] << 13; - sr = sr >> 3 | xmc[36] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[37] << 13; - sr = sr >> 3 | xmc[38] << 13; - *c++ = sr >> 8; - sr = sr >> 7 | Nc[3] << 9; - sr = sr >> 2 | bc[3] << 14; - *c++ = sr >> 7; - sr = sr >> 2 | Mc[3] << 14; - sr = sr >> 6 | xmaxc[3] << 10; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[39] << 13; - sr = sr >> 3 | xmc[40] << 13; - sr = sr >> 3 | xmc[41] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[42] << 13; - sr = sr >> 3 | xmc[43] << 13; - *c++ = sr >> 8; - sr = sr >> 3 | xmc[44] << 13; - sr = sr >> 3 | xmc[45] << 13; - sr = sr >> 3 | xmc[46] << 13; - *c++ = sr >> 7; - sr = sr >> 3 | xmc[47] << 13; - sr = sr >> 3 | xmc[48] << 13; - sr = sr >> 3 | xmc[49] << 13; - *c++ = sr >> 6; - sr = sr >> 3 | xmc[50] << 13; - sr = sr >> 3 | xmc[51] << 13; - *c++ = sr >> 8; - } - } - - else - -#endif /* WAV49 */ - { - - *c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */ - | ((LARc[0] >> 2) & 0xF); - *c++ = ((LARc[0] & 0x3) << 6) - | (LARc[1] & 0x3F); - *c++ = ((LARc[2] & 0x1F) << 3) - | ((LARc[3] >> 2) & 0x7); - *c++ = ((LARc[3] & 0x3) << 6) - | ((LARc[4] & 0xF) << 2) - | ((LARc[5] >> 2) & 0x3); - *c++ = ((LARc[5] & 0x3) << 6) - | ((LARc[6] & 0x7) << 3) - | (LARc[7] & 0x7); - *c++ = ((Nc[0] & 0x7F) << 1) - | ((bc[0] >> 1) & 0x1); - *c++ = ((bc[0] & 0x1) << 7) - | ((Mc[0] & 0x3) << 5) - | ((xmaxc[0] >> 1) & 0x1F); - *c++ = ((xmaxc[0] & 0x1) << 7) - | ((xmc[0] & 0x7) << 4) - | ((xmc[1] & 0x7) << 1) - | ((xmc[2] >> 2) & 0x1); - *c++ = ((xmc[2] & 0x3) << 6) - | ((xmc[3] & 0x7) << 3) - | (xmc[4] & 0x7); - *c++ = ((xmc[5] & 0x7) << 5) /* 10 */ - | ((xmc[6] & 0x7) << 2) - | ((xmc[7] >> 1) & 0x3); - *c++ = ((xmc[7] & 0x1) << 7) - | ((xmc[8] & 0x7) << 4) - | ((xmc[9] & 0x7) << 1) - | ((xmc[10] >> 2) & 0x1); - *c++ = ((xmc[10] & 0x3) << 6) - | ((xmc[11] & 0x7) << 3) - | (xmc[12] & 0x7); - *c++ = ((Nc[1] & 0x7F) << 1) - | ((bc[1] >> 1) & 0x1); - *c++ = ((bc[1] & 0x1) << 7) - | ((Mc[1] & 0x3) << 5) - | ((xmaxc[1] >> 1) & 0x1F); - *c++ = ((xmaxc[1] & 0x1) << 7) - | ((xmc[13] & 0x7) << 4) - | ((xmc[14] & 0x7) << 1) - | ((xmc[15] >> 2) & 0x1); - *c++ = ((xmc[15] & 0x3) << 6) - | ((xmc[16] & 0x7) << 3) - | (xmc[17] & 0x7); - *c++ = ((xmc[18] & 0x7) << 5) - | ((xmc[19] & 0x7) << 2) - | ((xmc[20] >> 1) & 0x3); - *c++ = ((xmc[20] & 0x1) << 7) - | ((xmc[21] & 0x7) << 4) - | ((xmc[22] & 0x7) << 1) - | ((xmc[23] >> 2) & 0x1); - *c++ = ((xmc[23] & 0x3) << 6) - | ((xmc[24] & 0x7) << 3) - | (xmc[25] & 0x7); - *c++ = ((Nc[2] & 0x7F) << 1) /* 20 */ - | ((bc[2] >> 1) & 0x1); - *c++ = ((bc[2] & 0x1) << 7) - | ((Mc[2] & 0x3) << 5) - | ((xmaxc[2] >> 1) & 0x1F); - *c++ = ((xmaxc[2] & 0x1) << 7) - | ((xmc[26] & 0x7) << 4) - | ((xmc[27] & 0x7) << 1) - | ((xmc[28] >> 2) & 0x1); - *c++ = ((xmc[28] & 0x3) << 6) - | ((xmc[29] & 0x7) << 3) - | (xmc[30] & 0x7); - *c++ = ((xmc[31] & 0x7) << 5) - | ((xmc[32] & 0x7) << 2) - | ((xmc[33] >> 1) & 0x3); - *c++ = ((xmc[33] & 0x1) << 7) - | ((xmc[34] & 0x7) << 4) - | ((xmc[35] & 0x7) << 1) - | ((xmc[36] >> 2) & 0x1); - *c++ = ((xmc[36] & 0x3) << 6) - | ((xmc[37] & 0x7) << 3) - | (xmc[38] & 0x7); - *c++ = ((Nc[3] & 0x7F) << 1) - | ((bc[3] >> 1) & 0x1); - *c++ = ((bc[3] & 0x1) << 7) - | ((Mc[3] & 0x3) << 5) - | ((xmaxc[3] >> 1) & 0x1F); - *c++ = ((xmaxc[3] & 0x1) << 7) - | ((xmc[39] & 0x7) << 4) - | ((xmc[40] & 0x7) << 1) - | ((xmc[41] >> 2) & 0x1); - *c++ = ((xmc[41] & 0x3) << 6) /* 30 */ - | ((xmc[42] & 0x7) << 3) - | (xmc[43] & 0x7); - *c++ = ((xmc[44] & 0x7) << 5) - | ((xmc[45] & 0x7) << 2) - | ((xmc[46] >> 1) & 0x3); - *c++ = ((xmc[46] & 0x1) << 7) - | ((xmc[47] & 0x7) << 4) - | ((xmc[48] & 0x7) << 1) - | ((xmc[49] >> 2) & 0x1); - *c++ = ((xmc[49] & 0x3) << 6) - | ((xmc[50] & 0x7) << 3) - | (xmc[51] & 0x7); - - } -} diff --git a/gr-vocoder/lib/gsm/gsm_explode.c b/gr-vocoder/lib/gsm/gsm_explode.c deleted file mode 100644 index 744ded5af..000000000 --- a/gr-vocoder/lib/gsm/gsm_explode.c +++ /dev/null @@ -1,417 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include "private.h" -#include "gsm.h" -#include "proto.h" - -int gsm_explode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target) -{ -# define LARc target -# define Nc *((gsm_signal (*) [17])(target + 8)) -# define bc *((gsm_signal (*) [17])(target + 9)) -# define Mc *((gsm_signal (*) [17])(target + 10)) -# define xmaxc *((gsm_signal (*) [17])(target + 11)) - - -#ifdef WAV49 - if (s->wav_fmt) { - - uword sr = 0; - - if (s->frame_index == 1) { - - sr = *c++; - LARc[0] = sr & 0x3f; sr >>= 6; - sr |= (uword)*c++ << 2; - LARc[1] = sr & 0x3f; sr >>= 6; - sr |= (uword)*c++ << 4; - LARc[2] = sr & 0x1f; sr >>= 5; - LARc[3] = sr & 0x1f; sr >>= 5; - sr |= (uword)*c++ << 2; - LARc[4] = sr & 0xf; sr >>= 4; - LARc[5] = sr & 0xf; sr >>= 4; - sr |= (uword)*c++ << 2; /* 5 */ - LARc[6] = sr & 0x7; sr >>= 3; - LARc[7] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[0] = sr & 0x7f; sr >>= 7; - bc[0] = sr & 0x3; sr >>= 2; - Mc[0] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[0] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (target + 12) - xmc[0] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[1] = sr & 0x7; sr >>= 3; - xmc[2] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[3] = sr & 0x7; sr >>= 3; - xmc[4] = sr & 0x7; sr >>= 3; - xmc[5] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 10 */ - xmc[6] = sr & 0x7; sr >>= 3; - xmc[7] = sr & 0x7; sr >>= 3; - xmc[8] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[9] = sr & 0x7; sr >>= 3; - xmc[10] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[11] = sr & 0x7; sr >>= 3; - xmc[12] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[1] = sr & 0x7f; sr >>= 7; - bc[1] = sr & 0x3; sr >>= 2; - Mc[1] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[1] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (target + 29 - 13) - - xmc[13] = sr & 0x7; sr >>= 3; - sr = *c++; /* 15 */ - xmc[14] = sr & 0x7; sr >>= 3; - xmc[15] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[16] = sr & 0x7; sr >>= 3; - xmc[17] = sr & 0x7; sr >>= 3; - xmc[18] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[19] = sr & 0x7; sr >>= 3; - xmc[20] = sr & 0x7; sr >>= 3; - xmc[21] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[22] = sr & 0x7; sr >>= 3; - xmc[23] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[24] = sr & 0x7; sr >>= 3; - xmc[25] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; /* 20 */ - Nc[2] = sr & 0x7f; sr >>= 7; - bc[2] = sr & 0x3; sr >>= 2; - Mc[2] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[2] = sr & 0x3f; sr >>= 6; - -#undef xmc -#define xmc (target + 46 - 26) - - xmc[26] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[27] = sr & 0x7; sr >>= 3; - xmc[28] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[29] = sr & 0x7; sr >>= 3; - xmc[30] = sr & 0x7; sr >>= 3; - xmc[31] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[32] = sr & 0x7; sr >>= 3; - xmc[33] = sr & 0x7; sr >>= 3; - xmc[34] = sr & 0x7; sr >>= 3; - sr = *c++; /* 25 */ - xmc[35] = sr & 0x7; sr >>= 3; - xmc[36] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[37] = sr & 0x7; sr >>= 3; - xmc[38] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[3] = sr & 0x7f; sr >>= 7; - bc[3] = sr & 0x3; sr >>= 2; - Mc[3] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[3] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (target + 63 - 39) - - xmc[39] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[40] = sr & 0x7; sr >>= 3; - xmc[41] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; /* 30 */ - xmc[42] = sr & 0x7; sr >>= 3; - xmc[43] = sr & 0x7; sr >>= 3; - xmc[44] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[45] = sr & 0x7; sr >>= 3; - xmc[46] = sr & 0x7; sr >>= 3; - xmc[47] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[48] = sr & 0x7; sr >>= 3; - xmc[49] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[50] = sr & 0x7; sr >>= 3; - xmc[51] = sr & 0x7; sr >>= 3; - - s->frame_chain = sr & 0xf; - } - else { - sr = s->frame_chain; - sr |= (uword)*c++ << 4; /* 1 */ - LARc[0] = sr & 0x3f; sr >>= 6; - LARc[1] = sr & 0x3f; sr >>= 6; - sr = *c++; - LARc[2] = sr & 0x1f; sr >>= 5; - sr |= (uword)*c++ << 3; - LARc[3] = sr & 0x1f; sr >>= 5; - LARc[4] = sr & 0xf; sr >>= 4; - sr |= (uword)*c++ << 2; - LARc[5] = sr & 0xf; sr >>= 4; - LARc[6] = sr & 0x7; sr >>= 3; - LARc[7] = sr & 0x7; sr >>= 3; - sr = *c++; /* 5 */ - Nc[0] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[0] = sr & 0x3; sr >>= 2; - Mc[0] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[0] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (target + 12) - xmc[0] = sr & 0x7; sr >>= 3; - xmc[1] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[2] = sr & 0x7; sr >>= 3; - xmc[3] = sr & 0x7; sr >>= 3; - xmc[4] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[5] = sr & 0x7; sr >>= 3; - xmc[6] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; /* 10 */ - xmc[7] = sr & 0x7; sr >>= 3; - xmc[8] = sr & 0x7; sr >>= 3; - xmc[9] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[10] = sr & 0x7; sr >>= 3; - xmc[11] = sr & 0x7; sr >>= 3; - xmc[12] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[1] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[1] = sr & 0x3; sr >>= 2; - Mc[1] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[1] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (target + 29 - 13) - - xmc[13] = sr & 0x7; sr >>= 3; - xmc[14] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 15 */ - xmc[15] = sr & 0x7; sr >>= 3; - xmc[16] = sr & 0x7; sr >>= 3; - xmc[17] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[18] = sr & 0x7; sr >>= 3; - xmc[19] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[20] = sr & 0x7; sr >>= 3; - xmc[21] = sr & 0x7; sr >>= 3; - xmc[22] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[23] = sr & 0x7; sr >>= 3; - xmc[24] = sr & 0x7; sr >>= 3; - xmc[25] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[2] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; /* 20 */ - bc[2] = sr & 0x3; sr >>= 2; - Mc[2] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[2] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (target + 46 - 26) - xmc[26] = sr & 0x7; sr >>= 3; - xmc[27] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[28] = sr & 0x7; sr >>= 3; - xmc[29] = sr & 0x7; sr >>= 3; - xmc[30] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[31] = sr & 0x7; sr >>= 3; - xmc[32] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[33] = sr & 0x7; sr >>= 3; - xmc[34] = sr & 0x7; sr >>= 3; - xmc[35] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 25 */ - xmc[36] = sr & 0x7; sr >>= 3; - xmc[37] = sr & 0x7; sr >>= 3; - xmc[38] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[3] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[3] = sr & 0x3; sr >>= 2; - Mc[3] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[3] = sr & 0x3f; sr >>= 6; - -#undef xmc -#define xmc (target + 63 - 39) - - xmc[39] = sr & 0x7; sr >>= 3; - xmc[40] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[41] = sr & 0x7; sr >>= 3; - xmc[42] = sr & 0x7; sr >>= 3; - xmc[43] = sr & 0x7; sr >>= 3; - sr = *c++; /* 30 */ - xmc[44] = sr & 0x7; sr >>= 3; - xmc[45] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[46] = sr & 0x7; sr >>= 3; - xmc[47] = sr & 0x7; sr >>= 3; - xmc[48] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[49] = sr & 0x7; sr >>= 3; - xmc[50] = sr & 0x7; sr >>= 3; - xmc[51] = sr & 0x7; sr >>= 3; - } - } - else -#endif - { - /* GSM_MAGIC = (*c >> 4) & 0xF; */ - - if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1; - - LARc[0] = (*c++ & 0xF) << 2; /* 1 */ - LARc[0] |= (*c >> 6) & 0x3; - LARc[1] = *c++ & 0x3F; - LARc[2] = (*c >> 3) & 0x1F; - LARc[3] = (*c++ & 0x7) << 2; - LARc[3] |= (*c >> 6) & 0x3; - LARc[4] = (*c >> 2) & 0xF; - LARc[5] = (*c++ & 0x3) << 2; - LARc[5] |= (*c >> 6) & 0x3; - LARc[6] = (*c >> 3) & 0x7; - LARc[7] = *c++ & 0x7; - - Nc[0] = (*c >> 1) & 0x7F; - - bc[0] = (*c++ & 0x1) << 1; - bc[0] |= (*c >> 7) & 0x1; - - Mc[0] = (*c >> 5) & 0x3; - - xmaxc[0] = (*c++ & 0x1F) << 1; - xmaxc[0] |= (*c >> 7) & 0x1; - -#undef xmc -#define xmc (target + 12) - - xmc[0] = (*c >> 4) & 0x7; - xmc[1] = (*c >> 1) & 0x7; - xmc[2] = (*c++ & 0x1) << 2; - xmc[2] |= (*c >> 6) & 0x3; - xmc[3] = (*c >> 3) & 0x7; - xmc[4] = *c++ & 0x7; - xmc[5] = (*c >> 5) & 0x7; - xmc[6] = (*c >> 2) & 0x7; - xmc[7] = (*c++ & 0x3) << 1; /* 10 */ - xmc[7] |= (*c >> 7) & 0x1; - xmc[8] = (*c >> 4) & 0x7; - xmc[9] = (*c >> 1) & 0x7; - xmc[10] = (*c++ & 0x1) << 2; - xmc[10] |= (*c >> 6) & 0x3; - xmc[11] = (*c >> 3) & 0x7; - xmc[12] = *c++ & 0x7; - - Nc[1] = (*c >> 1) & 0x7F; - - bc[1] = (*c++ & 0x1) << 1; - bc[1] |= (*c >> 7) & 0x1; - - Mc[1] = (*c >> 5) & 0x3; - - xmaxc[1] = (*c++ & 0x1F) << 1; - xmaxc[1] |= (*c >> 7) & 0x1; - -#undef xmc -#define xmc (target + 29 - 13) - - xmc[13] = (*c >> 4) & 0x7; - xmc[14] = (*c >> 1) & 0x7; - xmc[15] = (*c++ & 0x1) << 2; - xmc[15] |= (*c >> 6) & 0x3; - xmc[16] = (*c >> 3) & 0x7; - xmc[17] = *c++ & 0x7; - xmc[18] = (*c >> 5) & 0x7; - xmc[19] = (*c >> 2) & 0x7; - xmc[20] = (*c++ & 0x3) << 1; - xmc[20] |= (*c >> 7) & 0x1; - xmc[21] = (*c >> 4) & 0x7; - xmc[22] = (*c >> 1) & 0x7; - xmc[23] = (*c++ & 0x1) << 2; - xmc[23] |= (*c >> 6) & 0x3; - xmc[24] = (*c >> 3) & 0x7; - xmc[25] = *c++ & 0x7; - - Nc[2] = (*c >> 1) & 0x7F; - - bc[2] = (*c++ & 0x1) << 1; /* 20 */ - bc[2] |= (*c >> 7) & 0x1; - - Mc[2] = (*c >> 5) & 0x3; - - xmaxc[2] = (*c++ & 0x1F) << 1; - xmaxc[2] |= (*c >> 7) & 0x1; - -#undef xmc -#define xmc (target + 46 - 26) - - xmc[26] = (*c >> 4) & 0x7; - xmc[27] = (*c >> 1) & 0x7; - xmc[28] = (*c++ & 0x1) << 2; - xmc[28] |= (*c >> 6) & 0x3; - xmc[29] = (*c >> 3) & 0x7; - xmc[30] = *c++ & 0x7; - xmc[31] = (*c >> 5) & 0x7; - xmc[32] = (*c >> 2) & 0x7; - xmc[33] = (*c++ & 0x3) << 1; - xmc[33] |= (*c >> 7) & 0x1; - xmc[34] = (*c >> 4) & 0x7; - xmc[35] = (*c >> 1) & 0x7; - xmc[36] = (*c++ & 0x1) << 2; - xmc[36] |= (*c >> 6) & 0x3; - xmc[37] = (*c >> 3) & 0x7; - xmc[38] = *c++ & 0x7; - - Nc[3] = (*c >> 1) & 0x7F; - - bc[3] = (*c++ & 0x1) << 1; - bc[3] |= (*c >> 7) & 0x1; - - Mc[3] = (*c >> 5) & 0x3; - - xmaxc[3] = (*c++ & 0x1F) << 1; - xmaxc[3] |= (*c >> 7) & 0x1; - -#undef xmc -#define xmc (target + 63 - 39) - - xmc[39] = (*c >> 4) & 0x7; - xmc[40] = (*c >> 1) & 0x7; - xmc[41] = (*c++ & 0x1) << 2; - xmc[41] |= (*c >> 6) & 0x3; - xmc[42] = (*c >> 3) & 0x7; - xmc[43] = *c++ & 0x7; /* 30 */ - xmc[44] = (*c >> 5) & 0x7; - xmc[45] = (*c >> 2) & 0x7; - xmc[46] = (*c++ & 0x3) << 1; - xmc[46] |= (*c >> 7) & 0x1; - xmc[47] = (*c >> 4) & 0x7; - xmc[48] = (*c >> 1) & 0x7; - xmc[49] = (*c++ & 0x1) << 2; - xmc[49] |= (*c >> 6) & 0x3; - xmc[50] = (*c >> 3) & 0x7; - xmc[51] = *c & 0x7; /* 33 */ - } - - return 0; -} diff --git a/gr-vocoder/lib/gsm/gsm_implode.c b/gr-vocoder/lib/gsm/gsm_implode.c deleted file mode 100644 index 08ebf5853..000000000 --- a/gr-vocoder/lib/gsm/gsm_implode.c +++ /dev/null @@ -1,515 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include "private.h" - -#include "gsm.h" -#include "proto.h" - -void gsm_implode P3((s, source, c), gsm s, gsm_signal * source, gsm_byte * c) -{ - /* variable size index - - GSM_MAGIC 4 - - - LARc[0] 6 0 - LARc[1] 6 1 - LARc[2] 5 2 - LARc[3] 5 3 - LARc[4] 4 4 - LARc[5] 4 5 - LARc[6] 3 6 - LARc[7] 3 7 - - Nc[0] 7 8 - bc[0] 2 9 - Mc[0] 2 10 - xmaxc[0] 6 11 - xmc[0] 3 12 - xmc[1] 3 13 - xmc[2] 3 14 - xmc[3] 3 15 - xmc[4] 3 16 - xmc[5] 3 17 - xmc[6] 3 18 - xmc[7] 3 19 - xmc[8] 3 20 - xmc[9] 3 21 - xmc[10] 3 22 - xmc[11] 3 23 - xmc[12] 3 24 - - Nc[1] 7 25 - bc[1] 2 26 - Mc[1] 2 27 - xmaxc[1] 6 28 - xmc[13] 3 29 - xmc[14] 3 30 - xmc[15] 3 31 - xmc[16] 3 32 - xmc[17] 3 33 - xmc[18] 3 34 - xmc[19] 3 35 - xmc[20] 3 36 - xmc[21] 3 37 - xmc[22] 3 38 - xmc[23] 3 39 - xmc[24] 3 40 - xmc[25] 3 41 - - Nc[2] 7 42 - bc[2] 2 43 - Mc[2] 2 44 - xmaxc[2] 6 45 - xmc[26] 3 46 - xmc[27] 3 47 - xmc[28] 3 48 - xmc[29] 3 49 - xmc[30] 3 50 - xmc[31] 3 51 - xmc[32] 3 52 - xmc[33] 3 53 - xmc[34] 3 54 - xmc[35] 3 55 - xmc[36] 3 56 - xmc[37] 3 57 - xmc[38] 3 58 - - Nc[3] 7 59 - bc[3] 2 60 - Mc[3] 2 61 - xmaxc[3] 6 62 - xmc[39] 3 63 - xmc[40] 3 64 - xmc[41] 3 65 - xmc[42] 3 66 - xmc[43] 3 67 - xmc[44] 3 68 - xmc[45] 3 69 - xmc[46] 3 70 - xmc[47] 3 71 - xmc[48] 3 72 - xmc[49] 3 73 - xmc[50] 3 74 - xmc[51] 3 75 - */ - - /* There are 76 parameters per frame. The first eight are - * unique. The remaining 68 are four identical subframes of - * 17 parameters each. gsm_implode converts from a representation - * of these parameters as values in one array of signed words - * to the "packed" version of a GSM frame. - */ - -# define LARc source -# define Nc *((gsm_signal (*) [17])(source + 8)) -# define bc *((gsm_signal (*) [17])(source + 9)) -# define Mc *((gsm_signal (*) [17])(source + 10)) -# define xmaxc *((gsm_signal (*) [17])(source + 11)) - -#ifdef WAV49 - if (s->wav_fmt) { - - uword sr = 0; - if (s->frame_index == 0) { - - sr = *c++; - LARc[0] = sr & 0x3f; sr >>= 6; - sr |= (uword)*c++ << 2; - LARc[1] = sr & 0x3f; sr >>= 6; - sr |= (uword)*c++ << 4; - LARc[2] = sr & 0x1f; sr >>= 5; - LARc[3] = sr & 0x1f; sr >>= 5; - sr |= (uword)*c++ << 2; - LARc[4] = sr & 0xf; sr >>= 4; - LARc[5] = sr & 0xf; sr >>= 4; - sr |= (uword)*c++ << 2; /* 5 */ - LARc[6] = sr & 0x7; sr >>= 3; - LARc[7] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[0] = sr & 0x7f; sr >>= 7; - bc[0] = sr & 0x3; sr >>= 2; - Mc[0] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[0] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (source + 12) - xmc[0] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[1] = sr & 0x7; sr >>= 3; - xmc[2] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[3] = sr & 0x7; sr >>= 3; - xmc[4] = sr & 0x7; sr >>= 3; - xmc[5] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 10 */ - xmc[6] = sr & 0x7; sr >>= 3; - xmc[7] = sr & 0x7; sr >>= 3; - xmc[8] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[9] = sr & 0x7; sr >>= 3; - xmc[10] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[11] = sr & 0x7; sr >>= 3; - xmc[12] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[1] = sr & 0x7f; sr >>= 7; - bc[1] = sr & 0x3; sr >>= 2; - Mc[1] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[1] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (source + 29 - 13) - xmc[13] = sr & 0x7; sr >>= 3; - sr = *c++; /* 15 */ - xmc[14] = sr & 0x7; sr >>= 3; - xmc[15] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[16] = sr & 0x7; sr >>= 3; - xmc[17] = sr & 0x7; sr >>= 3; - xmc[18] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[19] = sr & 0x7; sr >>= 3; - xmc[20] = sr & 0x7; sr >>= 3; - xmc[21] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[22] = sr & 0x7; sr >>= 3; - xmc[23] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[24] = sr & 0x7; sr >>= 3; - xmc[25] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; /* 20 */ - Nc[2] = sr & 0x7f; sr >>= 7; - bc[2] = sr & 0x3; sr >>= 2; - Mc[2] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[2] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (source + 46 - 26) - xmc[26] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[27] = sr & 0x7; sr >>= 3; - xmc[28] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[29] = sr & 0x7; sr >>= 3; - xmc[30] = sr & 0x7; sr >>= 3; - xmc[31] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[32] = sr & 0x7; sr >>= 3; - xmc[33] = sr & 0x7; sr >>= 3; - xmc[34] = sr & 0x7; sr >>= 3; - sr = *c++; /* 25 */ - xmc[35] = sr & 0x7; sr >>= 3; - xmc[36] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[37] = sr & 0x7; sr >>= 3; - xmc[38] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 4; - Nc[3] = sr & 0x7f; sr >>= 7; - bc[3] = sr & 0x3; sr >>= 2; - Mc[3] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 1; - xmaxc[3] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (source + 63 - 39) - - xmc[39] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[40] = sr & 0x7; sr >>= 3; - xmc[41] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; /* 30 */ - xmc[42] = sr & 0x7; sr >>= 3; - xmc[43] = sr & 0x7; sr >>= 3; - xmc[44] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[45] = sr & 0x7; sr >>= 3; - xmc[46] = sr & 0x7; sr >>= 3; - xmc[47] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[48] = sr & 0x7; sr >>= 3; - xmc[49] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[50] = sr & 0x7; sr >>= 3; - xmc[51] = sr & 0x7; sr >>= 3; - - s->frame_chain = sr & 0xf; - } - else { - sr = s->frame_chain; - sr |= (uword)*c++ << 4; /* 1 */ - LARc[0] = sr & 0x3f; sr >>= 6; - LARc[1] = sr & 0x3f; sr >>= 6; - sr = *c++; - LARc[2] = sr & 0x1f; sr >>= 5; - sr |= (uword)*c++ << 3; - LARc[3] = sr & 0x1f; sr >>= 5; - LARc[4] = sr & 0xf; sr >>= 4; - sr |= (uword)*c++ << 2; - LARc[5] = sr & 0xf; sr >>= 4; - LARc[6] = sr & 0x7; sr >>= 3; - LARc[7] = sr & 0x7; sr >>= 3; - sr = *c++; /* 5 */ - Nc[0] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[0] = sr & 0x3; sr >>= 2; - Mc[0] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[0] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (source + 12) - xmc[0] = sr & 0x7; sr >>= 3; - xmc[1] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[2] = sr & 0x7; sr >>= 3; - xmc[3] = sr & 0x7; sr >>= 3; - xmc[4] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[5] = sr & 0x7; sr >>= 3; - xmc[6] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; /* 10 */ - xmc[7] = sr & 0x7; sr >>= 3; - xmc[8] = sr & 0x7; sr >>= 3; - xmc[9] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[10] = sr & 0x7; sr >>= 3; - xmc[11] = sr & 0x7; sr >>= 3; - xmc[12] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[1] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[1] = sr & 0x3; sr >>= 2; - Mc[1] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[1] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (source + 29 - 13) - xmc[13] = sr & 0x7; sr >>= 3; - xmc[14] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 15 */ - xmc[15] = sr & 0x7; sr >>= 3; - xmc[16] = sr & 0x7; sr >>= 3; - xmc[17] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[18] = sr & 0x7; sr >>= 3; - xmc[19] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[20] = sr & 0x7; sr >>= 3; - xmc[21] = sr & 0x7; sr >>= 3; - xmc[22] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[23] = sr & 0x7; sr >>= 3; - xmc[24] = sr & 0x7; sr >>= 3; - xmc[25] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[2] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; /* 20 */ - bc[2] = sr & 0x3; sr >>= 2; - Mc[2] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[2] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (source + 46 - 26) - xmc[26] = sr & 0x7; sr >>= 3; - xmc[27] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[28] = sr & 0x7; sr >>= 3; - xmc[29] = sr & 0x7; sr >>= 3; - xmc[30] = sr & 0x7; sr >>= 3; - sr = *c++; - xmc[31] = sr & 0x7; sr >>= 3; - xmc[32] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[33] = sr & 0x7; sr >>= 3; - xmc[34] = sr & 0x7; sr >>= 3; - xmc[35] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; /* 25 */ - xmc[36] = sr & 0x7; sr >>= 3; - xmc[37] = sr & 0x7; sr >>= 3; - xmc[38] = sr & 0x7; sr >>= 3; - sr = *c++; - Nc[3] = sr & 0x7f; sr >>= 7; - sr |= (uword)*c++ << 1; - bc[3] = sr & 0x3; sr >>= 2; - Mc[3] = sr & 0x3; sr >>= 2; - sr |= (uword)*c++ << 5; - xmaxc[3] = sr & 0x3f; sr >>= 6; -#undef xmc -#define xmc (source + 63 - 39) - - xmc[39] = sr & 0x7; sr >>= 3; - xmc[40] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[41] = sr & 0x7; sr >>= 3; - xmc[42] = sr & 0x7; sr >>= 3; - xmc[43] = sr & 0x7; sr >>= 3; - sr = *c++; /* 30 */ - xmc[44] = sr & 0x7; sr >>= 3; - xmc[45] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 2; - xmc[46] = sr & 0x7; sr >>= 3; - xmc[47] = sr & 0x7; sr >>= 3; - xmc[48] = sr & 0x7; sr >>= 3; - sr |= (uword)*c++ << 1; - xmc[49] = sr & 0x7; sr >>= 3; - xmc[50] = sr & 0x7; sr >>= 3; - xmc[51] = sr & 0x7; sr >>= 3; - } - } - else -#endif - { - - *c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */ - | ((LARc[0] >> 2) & 0xF); - *c++ = ((LARc[0] & 0x3) << 6) - | (LARc[1] & 0x3F); - *c++ = ((LARc[2] & 0x1F) << 3) - | ((LARc[3] >> 2) & 0x7); - *c++ = ((LARc[3] & 0x3) << 6) - | ((LARc[4] & 0xF) << 2) - | ((LARc[5] >> 2) & 0x3); - *c++ = ((LARc[5] & 0x3) << 6) - | ((LARc[6] & 0x7) << 3) - | (LARc[7] & 0x7); - - - *c++ = ((Nc[0] & 0x7F) << 1) - - - | ((bc[0] >> 1) & 0x1); - *c++ = ((bc[0] & 0x1) << 7) - - - | ((Mc[0] & 0x3) << 5) - - | ((xmaxc[0] >> 1) & 0x1F); - *c++ = ((xmaxc[0] & 0x1) << 7) - -#undef xmc -#define xmc (source + 12) - - | ((xmc[0] & 0x7) << 4) - | ((xmc[1] & 0x7) << 1) - | ((xmc[2] >> 2) & 0x1); - *c++ = ((xmc[2] & 0x3) << 6) - | ((xmc[3] & 0x7) << 3) - | (xmc[4] & 0x7); - *c++ = ((xmc[5] & 0x7) << 5) /* 10 */ - | ((xmc[6] & 0x7) << 2) - | ((xmc[7] >> 1) & 0x3); - *c++ = ((xmc[7] & 0x1) << 7) - | ((xmc[8] & 0x7) << 4) - | ((xmc[9] & 0x7) << 1) - | ((xmc[10] >> 2) & 0x1); - *c++ = ((xmc[10] & 0x3) << 6) - | ((xmc[11] & 0x7) << 3) - | (xmc[12] & 0x7); - - - *c++ = ((Nc[1] & 0x7F) << 1) - - - | ((bc[1] >> 1) & 0x1); - *c++ = ((bc[1] & 0x1) << 7) - - - | ((Mc[1] & 0x3) << 5) - - - | ((xmaxc[1] >> 1) & 0x1F); - *c++ = ((xmaxc[1] & 0x1) << 7) - -#undef xmc -#define xmc (source + 29 - 13) - - | ((xmc[13] & 0x7) << 4) - | ((xmc[14] & 0x7) << 1) - | ((xmc[15] >> 2) & 0x1); - *c++ = ((xmc[15] & 0x3) << 6) - | ((xmc[16] & 0x7) << 3) - | (xmc[17] & 0x7); - *c++ = ((xmc[18] & 0x7) << 5) - | ((xmc[19] & 0x7) << 2) - | ((xmc[20] >> 1) & 0x3); - *c++ = ((xmc[20] & 0x1) << 7) - | ((xmc[21] & 0x7) << 4) - | ((xmc[22] & 0x7) << 1) - | ((xmc[23] >> 2) & 0x1); - *c++ = ((xmc[23] & 0x3) << 6) - | ((xmc[24] & 0x7) << 3) - | (xmc[25] & 0x7); - - - *c++ = ((Nc[2] & 0x7F) << 1) /* 20 */ - - - | ((bc[2] >> 1) & 0x1); - *c++ = ((bc[2] & 0x1) << 7) - - - | ((Mc[2] & 0x3) << 5) - - - | ((xmaxc[2] >> 1) & 0x1F); - *c++ = ((xmaxc[2] & 0x1) << 7) - -#undef xmc -#define xmc (source + 46 - 26) - - | ((xmc[26] & 0x7) << 4) - | ((xmc[27] & 0x7) << 1) - | ((xmc[28] >> 2) & 0x1); - *c++ = ((xmc[28] & 0x3) << 6) - | ((xmc[29] & 0x7) << 3) - | (xmc[30] & 0x7); - *c++ = ((xmc[31] & 0x7) << 5) - | ((xmc[32] & 0x7) << 2) - | ((xmc[33] >> 1) & 0x3); - *c++ = ((xmc[33] & 0x1) << 7) - | ((xmc[34] & 0x7) << 4) - | ((xmc[35] & 0x7) << 1) - | ((xmc[36] >> 2) & 0x1); - *c++ = ((xmc[36] & 0x3) << 6) - | ((xmc[37] & 0x7) << 3) - | (xmc[38] & 0x7); - - - *c++ = ((Nc[3] & 0x7F) << 1) - - - | ((bc[3] >> 1) & 0x1); - *c++ = ((bc[3] & 0x1) << 7) - - - | ((Mc[3] & 0x3) << 5) - - - | ((xmaxc[3] >> 1) & 0x1F); - *c++ = ((xmaxc[3] & 0x1) << 7) - -#undef xmc -#define xmc (source + 63 - 39) - - | ((xmc[39] & 0x7) << 4) - | ((xmc[40] & 0x7) << 1) - | ((xmc[41] >> 2) & 0x1); - *c++ = ((xmc[41] & 0x3) << 6) /* 30 */ - | ((xmc[42] & 0x7) << 3) - | (xmc[43] & 0x7); - *c++ = ((xmc[44] & 0x7) << 5) - | ((xmc[45] & 0x7) << 2) - | ((xmc[46] >> 1) & 0x3); - *c++ = ((xmc[46] & 0x1) << 7) - | ((xmc[47] & 0x7) << 4) - | ((xmc[48] & 0x7) << 1) - | ((xmc[49] >> 2) & 0x1); - *c++ = ((xmc[49] & 0x3) << 6) - | ((xmc[50] & 0x7) << 3) - | (xmc[51] & 0x7); - } -} diff --git a/gr-vocoder/lib/gsm/gsm_option.c b/gr-vocoder/lib/gsm/gsm_option.c deleted file mode 100644 index 303170a9c..000000000 --- a/gr-vocoder/lib/gsm/gsm_option.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include "private.h" - -#include "gsm.h" -#include "proto.h" - -int gsm_option P3((r, opt, val), gsm r, int opt, int * val) -{ - int result = -1; - - switch (opt) { - case GSM_OPT_LTP_CUT: -#ifdef LTP_CUT - result = r->ltp_cut; - if (val) r->ltp_cut = *val; -#endif - break; - - case GSM_OPT_VERBOSE: -#ifndef NDEBUG - result = r->verbose; - if (val) r->verbose = *val; -#endif - break; - - case GSM_OPT_FAST: - -#if defined(FAST) && defined(USE_FLOAT_MUL) - result = r->fast; - if (val) r->fast = !!*val; -#endif - break; - - case GSM_OPT_FRAME_CHAIN: - -#ifdef WAV49 - result = r->frame_chain; - if (val) r->frame_chain = *val; -#endif - break; - - case GSM_OPT_FRAME_INDEX: - -#ifdef WAV49 - result = r->frame_index; - if (val) r->frame_index = *val; -#endif - break; - - case GSM_OPT_WAV49: - -#ifdef WAV49 - result = r->wav_fmt; - if (val) r->wav_fmt = !!*val; -#endif - break; - - default: - break; - } - return result; -} diff --git a/gr-vocoder/lib/gsm/gsm_print.c b/gr-vocoder/lib/gsm/gsm_print.c deleted file mode 100644 index af745bc48..000000000 --- a/gr-vocoder/lib/gsm/gsm_print.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include <stdio.h> - -#include "private.h" - -#include "gsm.h" -#include "proto.h" - -int gsm_print P3((f, s, c), FILE * f, gsm s, gsm_byte * c) -{ - word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; - - /* GSM_MAGIC = (*c >> 4) & 0xF; */ - - if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1; - - LARc[0] = (*c++ & 0xF) << 2; /* 1 */ - LARc[0] |= (*c >> 6) & 0x3; - LARc[1] = *c++ & 0x3F; - LARc[2] = (*c >> 3) & 0x1F; - LARc[3] = (*c++ & 0x7) << 2; - LARc[3] |= (*c >> 6) & 0x3; - LARc[4] = (*c >> 2) & 0xF; - LARc[5] = (*c++ & 0x3) << 2; - LARc[5] |= (*c >> 6) & 0x3; - LARc[6] = (*c >> 3) & 0x7; - LARc[7] = *c++ & 0x7; - - - Nc[0] = (*c >> 1) & 0x7F; - bc[0] = (*c++ & 0x1) << 1; - bc[0] |= (*c >> 7) & 0x1; - Mc[0] = (*c >> 5) & 0x3; - xmaxc[0] = (*c++ & 0x1F) << 1; - xmaxc[0] |= (*c >> 7) & 0x1; - xmc[0] = (*c >> 4) & 0x7; - xmc[1] = (*c >> 1) & 0x7; - xmc[2] = (*c++ & 0x1) << 2; - xmc[2] |= (*c >> 6) & 0x3; - xmc[3] = (*c >> 3) & 0x7; - xmc[4] = *c++ & 0x7; - xmc[5] = (*c >> 5) & 0x7; - xmc[6] = (*c >> 2) & 0x7; - xmc[7] = (*c++ & 0x3) << 1; /* 10 */ - xmc[7] |= (*c >> 7) & 0x1; - xmc[8] = (*c >> 4) & 0x7; - xmc[9] = (*c >> 1) & 0x7; - xmc[10] = (*c++ & 0x1) << 2; - xmc[10] |= (*c >> 6) & 0x3; - xmc[11] = (*c >> 3) & 0x7; - xmc[12] = *c++ & 0x7; - - Nc[1] = (*c >> 1) & 0x7F; - bc[1] = (*c++ & 0x1) << 1; - bc[1] |= (*c >> 7) & 0x1; - Mc[1] = (*c >> 5) & 0x3; - xmaxc[1] = (*c++ & 0x1F) << 1; - xmaxc[1] |= (*c >> 7) & 0x1; - xmc[13] = (*c >> 4) & 0x7; - xmc[14] = (*c >> 1) & 0x7; - xmc[15] = (*c++ & 0x1) << 2; - xmc[15] |= (*c >> 6) & 0x3; - xmc[16] = (*c >> 3) & 0x7; - xmc[17] = *c++ & 0x7; - xmc[18] = (*c >> 5) & 0x7; - xmc[19] = (*c >> 2) & 0x7; - xmc[20] = (*c++ & 0x3) << 1; - xmc[20] |= (*c >> 7) & 0x1; - xmc[21] = (*c >> 4) & 0x7; - xmc[22] = (*c >> 1) & 0x7; - xmc[23] = (*c++ & 0x1) << 2; - xmc[23] |= (*c >> 6) & 0x3; - xmc[24] = (*c >> 3) & 0x7; - xmc[25] = *c++ & 0x7; - - - Nc[2] = (*c >> 1) & 0x7F; - bc[2] = (*c++ & 0x1) << 1; /* 20 */ - bc[2] |= (*c >> 7) & 0x1; - Mc[2] = (*c >> 5) & 0x3; - xmaxc[2] = (*c++ & 0x1F) << 1; - xmaxc[2] |= (*c >> 7) & 0x1; - xmc[26] = (*c >> 4) & 0x7; - xmc[27] = (*c >> 1) & 0x7; - xmc[28] = (*c++ & 0x1) << 2; - xmc[28] |= (*c >> 6) & 0x3; - xmc[29] = (*c >> 3) & 0x7; - xmc[30] = *c++ & 0x7; - xmc[31] = (*c >> 5) & 0x7; - xmc[32] = (*c >> 2) & 0x7; - xmc[33] = (*c++ & 0x3) << 1; - xmc[33] |= (*c >> 7) & 0x1; - xmc[34] = (*c >> 4) & 0x7; - xmc[35] = (*c >> 1) & 0x7; - xmc[36] = (*c++ & 0x1) << 2; - xmc[36] |= (*c >> 6) & 0x3; - xmc[37] = (*c >> 3) & 0x7; - xmc[38] = *c++ & 0x7; - - Nc[3] = (*c >> 1) & 0x7F; - bc[3] = (*c++ & 0x1) << 1; - bc[3] |= (*c >> 7) & 0x1; - Mc[3] = (*c >> 5) & 0x3; - xmaxc[3] = (*c++ & 0x1F) << 1; - xmaxc[3] |= (*c >> 7) & 0x1; - - xmc[39] = (*c >> 4) & 0x7; - xmc[40] = (*c >> 1) & 0x7; - xmc[41] = (*c++ & 0x1) << 2; - xmc[41] |= (*c >> 6) & 0x3; - xmc[42] = (*c >> 3) & 0x7; - xmc[43] = *c++ & 0x7; /* 30 */ - xmc[44] = (*c >> 5) & 0x7; - xmc[45] = (*c >> 2) & 0x7; - xmc[46] = (*c++ & 0x3) << 1; - xmc[46] |= (*c >> 7) & 0x1; - xmc[47] = (*c >> 4) & 0x7; - xmc[48] = (*c >> 1) & 0x7; - xmc[49] = (*c++ & 0x1) << 2; - xmc[49] |= (*c >> 6) & 0x3; - xmc[50] = (*c >> 3) & 0x7; - xmc[51] = *c & 0x7; /* 33 */ - - fprintf(f, - "LARc:\t%2.2d %2.2d %2.2d %2.2d %2.2d %2.2d %2.2d %2.2d\n", - LARc[0],LARc[1],LARc[2],LARc[3],LARc[4],LARc[5],LARc[6],LARc[7]); - - fprintf(f, "#1: Nc %4.4d bc %d Mc %d xmaxc %d\n", - Nc[0], bc[0], Mc[0], xmaxc[0]); - fprintf(f, -"\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n", - xmc[0],xmc[1],xmc[2],xmc[3],xmc[4],xmc[5],xmc[6], - xmc[7],xmc[8],xmc[9],xmc[10],xmc[11],xmc[12] ); - - fprintf(f, "#2: Nc %4.4d bc %d Mc %d xmaxc %d\n", - Nc[1], bc[1], Mc[1], xmaxc[1]); - fprintf(f, -"\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n", - xmc[13+0],xmc[13+1],xmc[13+2],xmc[13+3],xmc[13+4],xmc[13+5], - xmc[13+6], xmc[13+7],xmc[13+8],xmc[13+9],xmc[13+10],xmc[13+11], - xmc[13+12] ); - - fprintf(f, "#3: Nc %4.4d bc %d Mc %d xmaxc %d\n", - Nc[2], bc[2], Mc[2], xmaxc[2]); - fprintf(f, -"\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n", - xmc[26+0],xmc[26+1],xmc[26+2],xmc[26+3],xmc[26+4],xmc[26+5], - xmc[26+6], xmc[26+7],xmc[26+8],xmc[26+9],xmc[26+10],xmc[26+11], - xmc[26+12] ); - - fprintf(f, "#4: Nc %4.4d bc %d Mc %d xmaxc %d\n", - Nc[3], bc[3], Mc[3], xmaxc[3]); - fprintf(f, -"\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n", - xmc[39+0],xmc[39+1],xmc[39+2],xmc[39+3],xmc[39+4],xmc[39+5], - xmc[39+6], xmc[39+7],xmc[39+8],xmc[39+9],xmc[39+10],xmc[39+11], - xmc[39+12] ); - - return 0; -} diff --git a/gr-vocoder/lib/gsm/long_term.c b/gr-vocoder/lib/gsm/long_term.c deleted file mode 100644 index 7dd9631e0..000000000 --- a/gr-vocoder/lib/gsm/long_term.c +++ /dev/null @@ -1,949 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include <stdio.h> -#include <assert.h> - -#include "private.h" - -#include "gsm.h" -#include "proto.h" - -/* - * 4.2.11 .. 4.2.12 LONG TERM PREDICTOR (LTP) SECTION - */ - - -/* - * This module computes the LTP gain (bc) and the LTP lag (Nc) - * for the long term analysis filter. This is done by calculating a - * maximum of the cross-correlation function between the current - * sub-segment short term residual signal d[0..39] (output of - * the short term analysis filter; for simplification the index - * of this array begins at 0 and ends at 39 for each sub-segment of the - * RPE-LTP analysis) and the previous reconstructed short term - * residual signal dp[ -120 .. -1 ]. A dynamic scaling must be - * performed to avoid overflow. - */ - - /* The next procedure exists in six versions. First two integer - * version (if USE_FLOAT_MUL is not defined); then four floating - * point versions, twice with proper scaling (USE_FLOAT_MUL defined), - * once without (USE_FLOAT_MUL and FAST defined, and fast run-time - * option used). Every pair has first a Cut version (see the -C - * option to toast or the LTP_CUT option to gsm_option()), then the - * uncut one. (For a detailed explanation of why this is altogether - * a bad idea, see Henry Spencer and Geoff Collyer, ``#ifdef Considered - * Harmful''.) - */ - -#ifndef USE_FLOAT_MUL - -#ifdef LTP_CUT - -static void Cut_Calculation_of_the_LTP_parameters P5((st, d,dp,bc_out,Nc_out), - - struct gsm_state * st, - - register word * d, /* [0..39] IN */ - register word * dp, /* [-120..-1] IN */ - word * bc_out, /* OUT */ - word * Nc_out /* OUT */ -) -{ - register int k, lambda; - word Nc, bc; - word wt[40]; - - longword L_result; - longword L_max, L_power; - word R, S, dmax, scal, best_k; - word ltp_cut; - - register word temp, wt_k; - - /* Search of the optimum scaling of d[0..39]. - */ - dmax = 0; - for (k = 0; k <= 39; k++) { - temp = d[k]; - temp = GSM_ABS( temp ); - if (temp > dmax) { - dmax = temp; - best_k = k; - } - } - temp = 0; - if (dmax == 0) scal = 0; - else { - assert(dmax > 0); - temp = gsm_norm( (longword)dmax << 16 ); - } - if (temp > 6) scal = 0; - else scal = 6 - temp; - assert(scal >= 0); - - /* Search for the maximum cross-correlation and coding of the LTP lag - */ - L_max = 0; - Nc = 40; /* index for the maximum cross-correlation */ - wt_k = SASR(d[best_k], scal); - - for (lambda = 40; lambda <= 120; lambda++) { - L_result = (longword)wt_k * dp[best_k - lambda]; - if (L_result > L_max) { - Nc = lambda; - L_max = L_result; - } - } - *Nc_out = Nc; - L_max <<= 1; - - /* Rescaling of L_max - */ - assert(scal <= 100 && scal >= -100); - L_max = L_max >> (6 - scal); /* sub(6, scal) */ - - assert( Nc <= 120 && Nc >= 40); - - /* Compute the power of the reconstructed short term residual - * signal dp[..] - */ - L_power = 0; - for (k = 0; k <= 39; k++) { - - register longword L_temp; - - L_temp = SASR( dp[k - Nc], 3 ); - L_power += L_temp * L_temp; - } - L_power <<= 1; /* from L_MULT */ - - /* Normalization of L_max and L_power - */ - - if (L_max <= 0) { - *bc_out = 0; - return; - } - if (L_max >= L_power) { - *bc_out = 3; - return; - } - - temp = gsm_norm( L_power ); - - R = SASR( L_max << temp, 16 ); - S = SASR( L_power << temp, 16 ); - - /* Coding of the LTP gain - */ - - /* Table 4.3a must be used to obtain the level DLB[i] for the - * quantization of the LTP gain b to get the coded version bc. - */ - for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break; - *bc_out = bc; -} - -#endif /* LTP_CUT */ - -static void Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out), - register word * d, /* [0..39] IN */ - register word * dp, /* [-120..-1] IN */ - word * bc_out, /* OUT */ - word * Nc_out /* OUT */ -) -{ - register int k, lambda; - word Nc, bc; - word wt[40]; - - longword L_max, L_power; - word R, S, dmax, scal; - register word temp; - - /* Search of the optimum scaling of d[0..39]. - */ - dmax = 0; - - for (k = 0; k <= 39; k++) { - temp = d[k]; - temp = GSM_ABS( temp ); - if (temp > dmax) dmax = temp; - } - - temp = 0; - if (dmax == 0) scal = 0; - else { - assert(dmax > 0); - temp = gsm_norm( (longword)dmax << 16 ); - } - - if (temp > 6) scal = 0; - else scal = 6 - temp; - - assert(scal >= 0); - - /* Initialization of a working array wt - */ - - for (k = 0; k <= 39; k++) wt[k] = SASR( d[k], scal ); - - /* Search for the maximum cross-correlation and coding of the LTP lag - */ - L_max = 0; - Nc = 40; /* index for the maximum cross-correlation */ - - for (lambda = 40; lambda <= 120; lambda++) { - -# undef STEP -# define STEP(k) (longword)wt[k] * dp[k - lambda] - - register longword L_result; - - L_result = STEP(0) ; L_result += STEP(1) ; - L_result += STEP(2) ; L_result += STEP(3) ; - L_result += STEP(4) ; L_result += STEP(5) ; - L_result += STEP(6) ; L_result += STEP(7) ; - L_result += STEP(8) ; L_result += STEP(9) ; - L_result += STEP(10) ; L_result += STEP(11) ; - L_result += STEP(12) ; L_result += STEP(13) ; - L_result += STEP(14) ; L_result += STEP(15) ; - L_result += STEP(16) ; L_result += STEP(17) ; - L_result += STEP(18) ; L_result += STEP(19) ; - L_result += STEP(20) ; L_result += STEP(21) ; - L_result += STEP(22) ; L_result += STEP(23) ; - L_result += STEP(24) ; L_result += STEP(25) ; - L_result += STEP(26) ; L_result += STEP(27) ; - L_result += STEP(28) ; L_result += STEP(29) ; - L_result += STEP(30) ; L_result += STEP(31) ; - L_result += STEP(32) ; L_result += STEP(33) ; - L_result += STEP(34) ; L_result += STEP(35) ; - L_result += STEP(36) ; L_result += STEP(37) ; - L_result += STEP(38) ; L_result += STEP(39) ; - - if (L_result > L_max) { - - Nc = lambda; - L_max = L_result; - } - } - - *Nc_out = Nc; - - L_max <<= 1; - - /* Rescaling of L_max - */ - assert(scal <= 100 && scal >= -100); - L_max = L_max >> (6 - scal); /* sub(6, scal) */ - - assert( Nc <= 120 && Nc >= 40); - - /* Compute the power of the reconstructed short term residual - * signal dp[..] - */ - L_power = 0; - for (k = 0; k <= 39; k++) { - - register longword L_temp; - - L_temp = SASR( dp[k - Nc], 3 ); - L_power += L_temp * L_temp; - } - L_power <<= 1; /* from L_MULT */ - - /* Normalization of L_max and L_power - */ - - if (L_max <= 0) { - *bc_out = 0; - return; - } - if (L_max >= L_power) { - *bc_out = 3; - return; - } - - temp = gsm_norm( L_power ); - - R = SASR( L_max << temp, 16 ); - S = SASR( L_power << temp, 16 ); - - /* Coding of the LTP gain - */ - - /* Table 4.3a must be used to obtain the level DLB[i] for the - * quantization of the LTP gain b to get the coded version bc. - */ - for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break; - *bc_out = bc; -} - -#else /* USE_FLOAT_MUL */ - -#ifdef LTP_CUT - -static void Cut_Calculation_of_the_LTP_parameters P5((st, d,dp,bc_out,Nc_out), - struct gsm_state * st, /* IN */ - register word * d, /* [0..39] IN */ - register word * dp, /* [-120..-1] IN */ - word * bc_out, /* OUT */ - word * Nc_out /* OUT */ -) -{ - register int k, lambda; - word Nc, bc; - word ltp_cut; - - float wt_float[40]; - float dp_float_base[120], * dp_float = dp_float_base + 120; - - longword L_max, L_power; - word R, S, dmax, scal; - register word temp; - - /* Search of the optimum scaling of d[0..39]. - */ - dmax = 0; - - for (k = 0; k <= 39; k++) { - temp = d[k]; - temp = GSM_ABS( temp ); - if (temp > dmax) dmax = temp; - } - - temp = 0; - if (dmax == 0) scal = 0; - else { - assert(dmax > 0); - temp = gsm_norm( (longword)dmax << 16 ); - } - - if (temp > 6) scal = 0; - else scal = 6 - temp; - - assert(scal >= 0); - ltp_cut = (longword)SASR(dmax, scal) * st->ltp_cut / 100; - - - /* Initialization of a working array wt - */ - - for (k = 0; k < 40; k++) { - register word w = SASR( d[k], scal ); - if (w < 0 ? w > -ltp_cut : w < ltp_cut) { - wt_float[k] = 0.0; - } - else { - wt_float[k] = w; - } - } - for (k = -120; k < 0; k++) dp_float[k] = dp[k]; - - /* Search for the maximum cross-correlation and coding of the LTP lag - */ - L_max = 0; - Nc = 40; /* index for the maximum cross-correlation */ - - for (lambda = 40; lambda <= 120; lambda += 9) { - - /* Calculate L_result for l = lambda .. lambda + 9. - */ - register float *lp = dp_float - lambda; - - register float W; - register float a = lp[-8], b = lp[-7], c = lp[-6], - d = lp[-5], e = lp[-4], f = lp[-3], - g = lp[-2], h = lp[-1]; - register float E; - register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0, - S5 = 0, S6 = 0, S7 = 0, S8 = 0; - -# undef STEP -# define STEP(K, a, b, c, d, e, f, g, h) \ - if ((W = wt_float[K]) != 0.0) { \ - E = W * a; S8 += E; \ - E = W * b; S7 += E; \ - E = W * c; S6 += E; \ - E = W * d; S5 += E; \ - E = W * e; S4 += E; \ - E = W * f; S3 += E; \ - E = W * g; S2 += E; \ - E = W * h; S1 += E; \ - a = lp[K]; \ - E = W * a; S0 += E; } else (a = lp[K]) - -# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h) -# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a) -# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b) -# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c) -# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d) -# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e) -# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f) -# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g) - - STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3); - STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7); - - STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11); - STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15); - - STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19); - STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23); - - STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27); - STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31); - - STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35); - STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39); - - if (S0 > L_max) { L_max = S0; Nc = lambda; } - if (S1 > L_max) { L_max = S1; Nc = lambda + 1; } - if (S2 > L_max) { L_max = S2; Nc = lambda + 2; } - if (S3 > L_max) { L_max = S3; Nc = lambda + 3; } - if (S4 > L_max) { L_max = S4; Nc = lambda + 4; } - if (S5 > L_max) { L_max = S5; Nc = lambda + 5; } - if (S6 > L_max) { L_max = S6; Nc = lambda + 6; } - if (S7 > L_max) { L_max = S7; Nc = lambda + 7; } - if (S8 > L_max) { L_max = S8; Nc = lambda + 8; } - - } - *Nc_out = Nc; - - L_max <<= 1; - - /* Rescaling of L_max - */ - assert(scal <= 100 && scal >= -100); - L_max = L_max >> (6 - scal); /* sub(6, scal) */ - - assert( Nc <= 120 && Nc >= 40); - - /* Compute the power of the reconstructed short term residual - * signal dp[..] - */ - L_power = 0; - for (k = 0; k <= 39; k++) { - - register longword L_temp; - - L_temp = SASR( dp[k - Nc], 3 ); - L_power += L_temp * L_temp; - } - L_power <<= 1; /* from L_MULT */ - - /* Normalization of L_max and L_power - */ - - if (L_max <= 0) { - *bc_out = 0; - return; - } - if (L_max >= L_power) { - *bc_out = 3; - return; - } - - temp = gsm_norm( L_power ); - - R = SASR( L_max << temp, 16 ); - S = SASR( L_power << temp, 16 ); - - /* Coding of the LTP gain - */ - - /* Table 4.3a must be used to obtain the level DLB[i] for the - * quantization of the LTP gain b to get the coded version bc. - */ - for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break; - *bc_out = bc; -} - -#endif /* LTP_CUT */ - -static void Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out), - register word * d, /* [0..39] IN */ - register word * dp, /* [-120..-1] IN */ - word * bc_out, /* OUT */ - word * Nc_out /* OUT */ -) -{ - register int k, lambda; - word Nc, bc; - - float wt_float[40]; - float dp_float_base[120], * dp_float = dp_float_base + 120; - - longword L_max, L_power; - word R, S, dmax, scal; - register word temp; - - /* Search of the optimum scaling of d[0..39]. - */ - dmax = 0; - - for (k = 0; k <= 39; k++) { - temp = d[k]; - temp = GSM_ABS( temp ); - if (temp > dmax) dmax = temp; - } - - temp = 0; - if (dmax == 0) scal = 0; - else { - assert(dmax > 0); - temp = gsm_norm( (longword)dmax << 16 ); - } - - if (temp > 6) scal = 0; - else scal = 6 - temp; - - assert(scal >= 0); - - /* Initialization of a working array wt - */ - - for (k = 0; k < 40; k++) wt_float[k] = SASR( d[k], scal ); - for (k = -120; k < 0; k++) dp_float[k] = dp[k]; - - /* Search for the maximum cross-correlation and coding of the LTP lag - */ - L_max = 0; - Nc = 40; /* index for the maximum cross-correlation */ - - for (lambda = 40; lambda <= 120; lambda += 9) { - - /* Calculate L_result for l = lambda .. lambda + 9. - */ - register float *lp = dp_float - lambda; - - register float W; - register float a = lp[-8], b = lp[-7], c = lp[-6], - d = lp[-5], e = lp[-4], f = lp[-3], - g = lp[-2], h = lp[-1]; - register float E; - register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0, - S5 = 0, S6 = 0, S7 = 0, S8 = 0; - -# undef STEP -# define STEP(K, a, b, c, d, e, f, g, h) \ - W = wt_float[K]; \ - E = W * a; S8 += E; \ - E = W * b; S7 += E; \ - E = W * c; S6 += E; \ - E = W * d; S5 += E; \ - E = W * e; S4 += E; \ - E = W * f; S3 += E; \ - E = W * g; S2 += E; \ - E = W * h; S1 += E; \ - a = lp[K]; \ - E = W * a; S0 += E - -# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h) -# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a) -# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b) -# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c) -# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d) -# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e) -# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f) -# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g) - - STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3); - STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7); - - STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11); - STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15); - - STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19); - STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23); - - STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27); - STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31); - - STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35); - STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39); - - if (S0 > L_max) { L_max = S0; Nc = lambda; } - if (S1 > L_max) { L_max = S1; Nc = lambda + 1; } - if (S2 > L_max) { L_max = S2; Nc = lambda + 2; } - if (S3 > L_max) { L_max = S3; Nc = lambda + 3; } - if (S4 > L_max) { L_max = S4; Nc = lambda + 4; } - if (S5 > L_max) { L_max = S5; Nc = lambda + 5; } - if (S6 > L_max) { L_max = S6; Nc = lambda + 6; } - if (S7 > L_max) { L_max = S7; Nc = lambda + 7; } - if (S8 > L_max) { L_max = S8; Nc = lambda + 8; } - } - *Nc_out = Nc; - - L_max <<= 1; - - /* Rescaling of L_max - */ - assert(scal <= 100 && scal >= -100); - L_max = L_max >> (6 - scal); /* sub(6, scal) */ - - assert( Nc <= 120 && Nc >= 40); - - /* Compute the power of the reconstructed short term residual - * signal dp[..] - */ - L_power = 0; - for (k = 0; k <= 39; k++) { - - register longword L_temp; - - L_temp = SASR( dp[k - Nc], 3 ); - L_power += L_temp * L_temp; - } - L_power <<= 1; /* from L_MULT */ - - /* Normalization of L_max and L_power - */ - - if (L_max <= 0) { - *bc_out = 0; - return; - } - if (L_max >= L_power) { - *bc_out = 3; - return; - } - - temp = gsm_norm( L_power ); - - R = SASR( L_max << temp, 16 ); - S = SASR( L_power << temp, 16 ); - - /* Coding of the LTP gain - */ - - /* Table 4.3a must be used to obtain the level DLB[i] for the - * quantization of the LTP gain b to get the coded version bc. - */ - for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break; - *bc_out = bc; -} - -#ifdef FAST -#ifdef LTP_CUT - -static void Cut_Fast_Calculation_of_the_LTP_parameters P5((st, - d,dp,bc_out,Nc_out), - struct gsm_state * st, /* IN */ - register word * d, /* [0..39] IN */ - register word * dp, /* [-120..-1] IN */ - word * bc_out, /* OUT */ - word * Nc_out /* OUT */ -) -{ - register int k, lambda; - register float wt_float; - word Nc, bc; - word wt_max, best_k, ltp_cut; - - float dp_float_base[120], * dp_float = dp_float_base + 120; - - register float L_result, L_max, L_power; - - wt_max = 0; - - for (k = 0; k < 40; ++k) { - if ( d[k] > wt_max) wt_max = d[best_k = k]; - else if (-d[k] > wt_max) wt_max = -d[best_k = k]; - } - - assert(wt_max >= 0); - wt_float = (float)wt_max; - - for (k = -120; k < 0; ++k) dp_float[k] = (float)dp[k]; - - /* Search for the maximum cross-correlation and coding of the LTP lag - */ - L_max = 0; - Nc = 40; /* index for the maximum cross-correlation */ - - for (lambda = 40; lambda <= 120; lambda++) { - L_result = wt_float * dp_float[best_k - lambda]; - if (L_result > L_max) { - Nc = lambda; - L_max = L_result; - } - } - - *Nc_out = Nc; - if (L_max <= 0.) { - *bc_out = 0; - return; - } - - /* Compute the power of the reconstructed short term residual - * signal dp[..] - */ - dp_float -= Nc; - L_power = 0; - for (k = 0; k < 40; ++k) { - register float f = dp_float[k]; - L_power += f * f; - } - - if (L_max >= L_power) { - *bc_out = 3; - return; - } - - /* Coding of the LTP gain - * Table 4.3a must be used to obtain the level DLB[i] for the - * quantization of the LTP gain b to get the coded version bc. - */ - lambda = L_max / L_power * 32768.; - for (bc = 0; bc <= 2; ++bc) if (lambda <= gsm_DLB[bc]) break; - *bc_out = bc; -} - -#endif /* LTP_CUT */ - -static void Fast_Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out), - register word * d, /* [0..39] IN */ - register word * dp, /* [-120..-1] IN */ - word * bc_out, /* OUT */ - word * Nc_out /* OUT */ -) -{ - register int k, lambda; - word Nc, bc; - - float wt_float[40]; - float dp_float_base[120], * dp_float = dp_float_base + 120; - - register float L_max, L_power; - - for (k = 0; k < 40; ++k) wt_float[k] = (float)d[k]; - for (k = -120; k < 0; ++k) dp_float[k] = (float)dp[k]; - - /* Search for the maximum cross-correlation and coding of the LTP lag - */ - L_max = 0; - Nc = 40; /* index for the maximum cross-correlation */ - - for (lambda = 40; lambda <= 120; lambda += 9) { - - /* Calculate L_result for l = lambda .. lambda + 9. - */ - register float *lp = dp_float - lambda; - - register float W; - register float a = lp[-8], b = lp[-7], c = lp[-6], - d = lp[-5], e = lp[-4], f = lp[-3], - g = lp[-2], h = lp[-1]; - register float E; - register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0, - S5 = 0, S6 = 0, S7 = 0, S8 = 0; - -# undef STEP -# define STEP(K, a, b, c, d, e, f, g, h) \ - W = wt_float[K]; \ - E = W * a; S8 += E; \ - E = W * b; S7 += E; \ - E = W * c; S6 += E; \ - E = W * d; S5 += E; \ - E = W * e; S4 += E; \ - E = W * f; S3 += E; \ - E = W * g; S2 += E; \ - E = W * h; S1 += E; \ - a = lp[K]; \ - E = W * a; S0 += E - -# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h) -# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a) -# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b) -# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c) -# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d) -# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e) -# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f) -# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g) - - STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3); - STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7); - - STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11); - STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15); - - STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19); - STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23); - - STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27); - STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31); - - STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35); - STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39); - - if (S0 > L_max) { L_max = S0; Nc = lambda; } - if (S1 > L_max) { L_max = S1; Nc = lambda + 1; } - if (S2 > L_max) { L_max = S2; Nc = lambda + 2; } - if (S3 > L_max) { L_max = S3; Nc = lambda + 3; } - if (S4 > L_max) { L_max = S4; Nc = lambda + 4; } - if (S5 > L_max) { L_max = S5; Nc = lambda + 5; } - if (S6 > L_max) { L_max = S6; Nc = lambda + 6; } - if (S7 > L_max) { L_max = S7; Nc = lambda + 7; } - if (S8 > L_max) { L_max = S8; Nc = lambda + 8; } - } - *Nc_out = Nc; - - if (L_max <= 0.) { - *bc_out = 0; - return; - } - - /* Compute the power of the reconstructed short term residual - * signal dp[..] - */ - dp_float -= Nc; - L_power = 0; - for (k = 0; k < 40; ++k) { - register float f = dp_float[k]; - L_power += f * f; - } - - if (L_max >= L_power) { - *bc_out = 3; - return; - } - - /* Coding of the LTP gain - * Table 4.3a must be used to obtain the level DLB[i] for the - * quantization of the LTP gain b to get the coded version bc. - */ - lambda = L_max / L_power * 32768.; - for (bc = 0; bc <= 2; ++bc) if (lambda <= gsm_DLB[bc]) break; - *bc_out = bc; -} - -#endif /* FAST */ -#endif /* USE_FLOAT_MUL */ - - -/* 4.2.12 */ - -static void Long_term_analysis_filtering P6((bc,Nc,dp,d,dpp,e), - word bc, /* IN */ - word Nc, /* IN */ - register word * dp, /* previous d [-120..-1] IN */ - register word * d, /* d [0..39] IN */ - register word * dpp, /* estimate [0..39] OUT */ - register word * e /* long term res. signal [0..39] OUT */ -) -/* - * In this part, we have to decode the bc parameter to compute - * the samples of the estimate dpp[0..39]. The decoding of bc needs the - * use of table 4.3b. The long term residual signal e[0..39] - * is then calculated to be fed to the RPE encoding section. - */ -{ - register int k; - register longword ltmp; - -# undef STEP -# define STEP(BP) \ - for (k = 0; k <= 39; k++) { \ - dpp[k] = GSM_MULT_R( BP, dp[k - Nc]); \ - e[k] = GSM_SUB( d[k], dpp[k] ); \ - } - - switch (bc) { - case 0: STEP( 3277 ); break; - case 1: STEP( 11469 ); break; - case 2: STEP( 21299 ); break; - case 3: STEP( 32767 ); break; - } -} - -void Gsm_Long_Term_Predictor P7((S,d,dp,e,dpp,Nc,bc), /* 4x for 160 samples */ - - struct gsm_state * S, - - word * d, /* [0..39] residual signal IN */ - word * dp, /* [-120..-1] d' IN */ - - word * e, /* [0..39] OUT */ - word * dpp, /* [0..39] OUT */ - word * Nc, /* correlation lag OUT */ - word * bc /* gain factor OUT */ -) -{ - assert( d ); assert( dp ); assert( e ); - assert( dpp); assert( Nc ); assert( bc ); - -#if defined(FAST) && defined(USE_FLOAT_MUL) - if (S->fast) -#if defined (LTP_CUT) - if (S->ltp_cut) - Cut_Fast_Calculation_of_the_LTP_parameters(S, - d, dp, bc, Nc); - else -#endif /* LTP_CUT */ - Fast_Calculation_of_the_LTP_parameters(d, dp, bc, Nc ); - else -#endif /* FAST & USE_FLOAT_MUL */ -#ifdef LTP_CUT - if (S->ltp_cut) - Cut_Calculation_of_the_LTP_parameters(S, d, dp, bc, Nc); - else -#endif - Calculation_of_the_LTP_parameters(d, dp, bc, Nc); - - Long_term_analysis_filtering( *bc, *Nc, dp, d, dpp, e ); -} - -/* 4.3.2 */ -void Gsm_Long_Term_Synthesis_Filtering P5((S,Ncr,bcr,erp,drp), - struct gsm_state * S, - - word Ncr, - word bcr, - register word * erp, /* [0..39] IN */ - register word * drp /* [-120..-1] IN, [-120..40] OUT */ -) -/* - * This procedure uses the bcr and Ncr parameter to realize the - * long term synthesis filtering. The decoding of bcr needs - * table 4.3b. - */ -{ - register longword ltmp; /* for ADD */ - register int k; - word brp, drpp, Nr; - - /* Check the limits of Nr. - */ - Nr = Ncr < 40 || Ncr > 120 ? S->nrp : Ncr; - S->nrp = Nr; - assert(Nr >= 40 && Nr <= 120); - - /* Decoding of the LTP gain bcr - */ - brp = gsm_QLB[ bcr ]; - - /* Computation of the reconstructed short term residual - * signal drp[0..39] - */ - assert(brp != MIN_WORD); - - for (k = 0; k <= 39; k++) { - drpp = GSM_MULT_R( brp, drp[ k - Nr ] ); - drp[k] = GSM_ADD( erp[k], drpp ); - } - - /* - * Update of the reconstructed short term residual signal - * drp[ -1..-120 ] - */ - - for (k = 0; k <= 119; k++) drp[ -120 + k ] = drp[ -80 + k ]; -} diff --git a/gr-vocoder/lib/gsm/lpc.c b/gr-vocoder/lib/gsm/lpc.c deleted file mode 100644 index bc1695c41..000000000 --- a/gr-vocoder/lib/gsm/lpc.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include <stdio.h> -#include <assert.h> - -#include "private.h" - -#include "gsm.h" -#include "proto.h" - -#undef P - -/* - * 4.2.4 .. 4.2.7 LPC ANALYSIS SECTION - */ - -/* 4.2.4 */ - - -static void Autocorrelation P2((s, L_ACF), - word * s, /* [0..159] IN/OUT */ - longword * L_ACF) /* [0..8] OUT */ -/* - * The goal is to compute the array L_ACF[k]. The signal s[i] must - * be scaled in order to avoid an overflow situation. - */ -{ - register int k, i; - - word temp, smax, scalauto; - -#ifdef USE_FLOAT_MUL - float float_s[160]; -#endif - - /* Dynamic scaling of the array s[0..159] - */ - - /* Search for the maximum. - */ - smax = 0; - for (k = 0; k <= 159; k++) { - temp = GSM_ABS( s[k] ); - if (temp > smax) smax = temp; - } - - /* Computation of the scaling factor. - */ - if (smax == 0) scalauto = 0; - else { - assert(smax > 0); - scalauto = 4 - gsm_norm( (longword)smax << 16 );/* sub(4,..) */ - } - - /* Scaling of the array s[0...159] - */ - - if (scalauto > 0) { - -# ifdef USE_FLOAT_MUL -# define SCALE(n) \ - case n: for (k = 0; k <= 159; k++) \ - float_s[k] = (float) \ - (s[k] = GSM_MULT_R(s[k], 16384 >> (n-1)));\ - break; -# else -# define SCALE(n) \ - case n: for (k = 0; k <= 159; k++) \ - s[k] = GSM_MULT_R( s[k], 16384 >> (n-1) );\ - break; -# endif /* USE_FLOAT_MUL */ - - switch (scalauto) { - SCALE(1) - SCALE(2) - SCALE(3) - SCALE(4) - } -# undef SCALE - } -# ifdef USE_FLOAT_MUL - else for (k = 0; k <= 159; k++) float_s[k] = (float) s[k]; -# endif - - /* Compute the L_ACF[..]. - */ - { -# ifdef USE_FLOAT_MUL - register float * sp = float_s; - register float sl = *sp; - -# define STEP(k) L_ACF[k] += (longword)(sl * sp[ -(k) ]); -# else - word * sp = s; - word sl = *sp; - -# define STEP(k) L_ACF[k] += ((longword)sl * sp[ -(k) ]); -# endif - -# define NEXTI sl = *++sp - - - for (k = 9; k--; L_ACF[k] = 0) ; - - STEP (0); - NEXTI; - STEP(0); STEP(1); - NEXTI; - STEP(0); STEP(1); STEP(2); - NEXTI; - STEP(0); STEP(1); STEP(2); STEP(3); - NEXTI; - STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); - NEXTI; - STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); - NEXTI; - STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6); - NEXTI; - STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6); STEP(7); - - for (i = 8; i <= 159; i++) { - - NEXTI; - - STEP(0); - STEP(1); STEP(2); STEP(3); STEP(4); - STEP(5); STEP(6); STEP(7); STEP(8); - } - - for (k = 9; k--; L_ACF[k] <<= 1) ; - - } - /* Rescaling of the array s[0..159] - */ - if (scalauto > 0) { - assert(scalauto <= 4); - for (k = 160; k--; *s++ <<= scalauto) ; - } -} - -#if defined(USE_FLOAT_MUL) && defined(FAST) - -static void Fast_Autocorrelation P2((s, L_ACF), - word * s, /* [0..159] IN/OUT */ - longword * L_ACF) /* [0..8] OUT */ -{ - register int k, i; - float f_L_ACF[9]; - float scale; - - float s_f[160]; - register float *sf = s_f; - - for (i = 0; i < 160; ++i) sf[i] = s[i]; - for (k = 0; k <= 8; k++) { - register float L_temp2 = 0; - register float *sfl = sf - k; - for (i = k; i < 160; ++i) L_temp2 += sf[i] * sfl[i]; - f_L_ACF[k] = L_temp2; - } - scale = MAX_LONGWORD / f_L_ACF[0]; - - for (k = 0; k <= 8; k++) { - L_ACF[k] = f_L_ACF[k] * scale; - } -} -#endif /* defined (USE_FLOAT_MUL) && defined (FAST) */ - -/* 4.2.5 */ - -static void Reflection_coefficients P2( (L_ACF, r), - longword * L_ACF, /* 0...8 IN */ - register word * r /* 0...7 OUT */ -) -{ - register int i, m, n; - register word temp; - register longword ltmp; - word ACF[9]; /* 0..8 */ - word P[ 9]; /* 0..8 */ - word K[ 9]; /* 2..8 */ - - /* Schur recursion with 16 bits arithmetic. - */ - - if (L_ACF[0] == 0) { - for (i = 8; i--; *r++ = 0) ; - return; - } - - assert( L_ACF[0] != 0 ); - temp = gsm_norm( L_ACF[0] ); - - assert(temp >= 0 && temp < 32); - - /* ? overflow ? */ - for (i = 0; i <= 8; i++) ACF[i] = SASR( L_ACF[i] << temp, 16 ); - - /* Initialize array P[..] and K[..] for the recursion. - */ - - for (i = 1; i <= 7; i++) K[ i ] = ACF[ i ]; - for (i = 0; i <= 8; i++) P[ i ] = ACF[ i ]; - - /* Compute reflection coefficients - */ - for (n = 1; n <= 8; n++, r++) { - - temp = P[1]; - temp = GSM_ABS(temp); - if (P[0] < temp) { - for (i = n; i <= 8; i++) *r++ = 0; - return; - } - - *r = gsm_div( temp, P[0] ); - - assert(*r >= 0); - if (P[1] > 0) *r = -*r; /* r[n] = sub(0, r[n]) */ - assert (*r != MIN_WORD); - if (n == 8) return; - - /* Schur recursion - */ - temp = GSM_MULT_R( P[1], *r ); - P[0] = GSM_ADD( P[0], temp ); - - for (m = 1; m <= 8 - n; m++) { - temp = GSM_MULT_R( K[ m ], *r ); - P[m] = GSM_ADD( P[ m+1 ], temp ); - - temp = GSM_MULT_R( P[ m+1 ], *r ); - K[m] = GSM_ADD( K[ m ], temp ); - } - } -} - -/* 4.2.6 */ - -static void Transformation_to_Log_Area_Ratios P1((r), - register word * r /* 0..7 IN/OUT */ -) -/* - * The following scaling for r[..] and LAR[..] has been used: - * - * r[..] = integer( real_r[..]*32768. ); -1 <= real_r < 1. - * LAR[..] = integer( real_LAR[..] * 16384 ); - * with -1.625 <= real_LAR <= 1.625 - */ -{ - register word temp; - register int i; - - - /* Computation of the LAR[0..7] from the r[0..7] - */ - for (i = 1; i <= 8; i++, r++) { - - temp = *r; - temp = GSM_ABS(temp); - assert(temp >= 0); - - if (temp < 22118) { - temp >>= 1; - } else if (temp < 31130) { - assert( temp >= 11059 ); - temp -= 11059; - } else { - assert( temp >= 26112 ); - temp -= 26112; - temp <<= 2; - } - - *r = *r < 0 ? -temp : temp; - assert( *r != MIN_WORD ); - } -} - -/* 4.2.7 */ - -static void Quantization_and_coding P1((LAR), - register word * LAR /* [0..7] IN/OUT */ -) -{ - register word temp; - longword ltmp; - - - /* This procedure needs four tables; the following equations - * give the optimum scaling for the constants: - * - * A[0..7] = integer( real_A[0..7] * 1024 ) - * B[0..7] = integer( real_B[0..7] * 512 ) - * MAC[0..7] = maximum of the LARc[0..7] - * MIC[0..7] = minimum of the LARc[0..7] - */ - -# undef STEP -# define STEP( A, B, MAC, MIC ) \ - temp = GSM_MULT( A, *LAR ); \ - temp = GSM_ADD( temp, B ); \ - temp = GSM_ADD( temp, 256 ); \ - temp = SASR( temp, 9 ); \ - *LAR = temp>MAC ? MAC - MIC : (temp<MIC ? 0 : temp - MIC); \ - LAR++; - - STEP( 20480, 0, 31, -32 ); - STEP( 20480, 0, 31, -32 ); - STEP( 20480, 2048, 15, -16 ); - STEP( 20480, -2560, 15, -16 ); - - STEP( 13964, 94, 7, -8 ); - STEP( 15360, -1792, 7, -8 ); - STEP( 8534, -341, 3, -4 ); - STEP( 9036, -1144, 3, -4 ); - -# undef STEP -} - -void Gsm_LPC_Analysis P3((S, s,LARc), - struct gsm_state *S, - word * s, /* 0..159 signals IN/OUT */ - word * LARc) /* 0..7 LARc's OUT */ -{ - longword L_ACF[9]; - -#if defined(USE_FLOAT_MUL) && defined(FAST) - if (S->fast) Fast_Autocorrelation (s, L_ACF ); - else -#endif - Autocorrelation (s, L_ACF ); - Reflection_coefficients (L_ACF, LARc ); - Transformation_to_Log_Area_Ratios (LARc); - Quantization_and_coding (LARc); -} diff --git a/gr-vocoder/lib/gsm/preprocess.c b/gr-vocoder/lib/gsm/preprocess.c deleted file mode 100644 index abc47c72b..000000000 --- a/gr-vocoder/lib/gsm/preprocess.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include <stdio.h> -#include <assert.h> - -#include "private.h" - -#include "gsm.h" -#include "proto.h" - -/* 4.2.0 .. 4.2.3 PREPROCESSING SECTION - * - * After A-law to linear conversion (or directly from the - * Ato D converter) the following scaling is assumed for - * input to the RPE-LTP algorithm: - * - * in: 0.1.....................12 - * S.v.v.v.v.v.v.v.v.v.v.v.v.*.*.* - * - * Where S is the sign bit, v a valid bit, and * a "don't care" bit. - * The original signal is called sop[..] - * - * out: 0.1................... 12 - * S.S.v.v.v.v.v.v.v.v.v.v.v.v.0.0 - */ - - -void Gsm_Preprocess P3((S, s, so), - struct gsm_state * S, - word * s, - word * so ) /* [0..159] IN/OUT */ -{ - - word z1 = S->z1; - longword L_z2 = S->L_z2; - word mp = S->mp; - - word s1; - longword L_s2; - - longword L_temp; - - word msp, lsp; - word SO; - - longword ltmp; /* for ADD */ - ulongword utmp; /* for L_ADD */ - - register int k = 160; - - while (k--) { - - /* 4.2.1 Downscaling of the input signal - */ - SO = SASR( *s, 3 ) << 2; - s++; - - assert (SO >= -0x4000); /* downscaled by */ - assert (SO <= 0x3FFC); /* previous routine. */ - - - /* 4.2.2 Offset compensation - * - * This part implements a high-pass filter and requires extended - * arithmetic precision for the recursive part of this filter. - * The input of this procedure is the array so[0...159] and the - * output the array sof[ 0...159 ]. - */ - /* Compute the non-recursive part - */ - - s1 = SO - z1; /* s1 = gsm_sub( *so, z1 ); */ - z1 = SO; - - assert(s1 != MIN_WORD); - - /* Compute the recursive part - */ - L_s2 = s1; - L_s2 <<= 15; - - /* Execution of a 31 bv 16 bits multiplication - */ - - msp = SASR( L_z2, 15 ); - lsp = L_z2-((longword)msp<<15); /* gsm_L_sub(L_z2,(msp<<15)); */ - - L_s2 += GSM_MULT_R( lsp, 32735 ); - L_temp = (longword)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/ - L_z2 = GSM_L_ADD( (ulongword)L_temp, (ulongword)L_s2 ); - - /* Compute sof[k] with rounding - */ - L_temp = GSM_L_ADD( (ulongword)L_z2, 16384 ); - - /* 4.2.3 Preemphasis - */ - - msp = GSM_MULT_R( mp, -28180 ); - mp = SASR( L_temp, 15 ); - *so++ = GSM_ADD( mp, msp ); - } - - S->z1 = z1; - S->L_z2 = L_z2; - S->mp = mp; -} diff --git a/gr-vocoder/lib/gsm/private.h b/gr-vocoder/lib/gsm/private.h deleted file mode 100644 index ca42cd537..000000000 --- a/gr-vocoder/lib/gsm/private.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/*$Header$*/ - -#ifndef PRIVATE_H -#define PRIVATE_H - -typedef short word; /* 16 bit signed int */ -typedef long longword; /* 32 bit signed int */ - -typedef unsigned short uword; /* unsigned word */ -typedef unsigned long ulongword; /* unsigned longword */ - -struct gsm_state { - - word dp0[ 280 ]; - - word z1; /* preprocessing.c, Offset_com. */ - longword L_z2; /* Offset_com. */ - int mp; /* Preemphasis */ - - word u[8]; /* short_term_aly_filter.c */ - word LARpp[2][8]; /* */ - word j; /* */ - - word ltp_cut; /* long_term.c, LTP crosscorr. */ - word nrp; /* 40 */ /* long_term.c, synthesis */ - word v[9]; /* short_term.c, synthesis */ - word msr; /* decoder.c, Postprocessing */ - - char verbose; /* only used if !NDEBUG */ - char fast; /* only used if FAST */ - - char wav_fmt; /* only used if WAV49 defined */ - unsigned char frame_index; /* odd/even chaining */ - unsigned char frame_chain; /* half-byte to carry forward */ -}; - - -#define MIN_WORD (-32767 - 1) -#define MAX_WORD 32767 - -#define MIN_LONGWORD (-2147483647 - 1) -#define MAX_LONGWORD 2147483647 - -#ifdef SASR /* flag: >> is a signed arithmetic shift right */ -#undef SASR -#define SASR(x, by) ((x) >> (by)) -#else -#define SASR(x, by) ((x) >= 0 ? (x) >> (by) : (~(-((x) + 1) >> (by)))) -#endif /* SASR */ - -#include "proto.h" - -/* - * Prototypes from add.c - */ -extern word gsm_mult P((word a, word b)); -extern longword gsm_L_mult P((word a, word b)); -extern word gsm_mult_r P((word a, word b)); - -extern word gsm_div P((word num, word denum)); - -extern word gsm_add P(( word a, word b )); -extern longword gsm_L_add P(( longword a, longword b )); - -extern word gsm_sub P((word a, word b)); -extern longword gsm_L_sub P((longword a, longword b)); - -extern word gsm_abs P((word a)); - -extern word gsm_norm P(( longword a )); - -extern longword gsm_L_asl P((longword a, int n)); -extern word gsm_asl P((word a, int n)); - -extern longword gsm_L_asr P((longword a, int n)); -extern word gsm_asr P((word a, int n)); - -/* - * Inlined functions from add.h - */ - -/* - * #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \ - * (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15)) - */ -#define GSM_MULT_R(a, b) /* word a, word b, !(a == b == MIN_WORD) */ \ - (SASR( ((longword)(a) * (longword)(b) + 16384), 15 )) - -# define GSM_MULT(a,b) /* word a, word b, !(a == b == MIN_WORD) */ \ - (SASR( ((longword)(a) * (longword)(b)), 15 )) - -# define GSM_L_MULT(a, b) /* word a, word b */ \ - (((longword)(a) * (longword)(b)) << 1) - -# define GSM_L_ADD(a, b) \ - ( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \ - : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \ - >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \ - : ((b) <= 0 ? (a) + (b) \ - : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \ - ? MAX_LONGWORD : utmp)) - -/* - * # define GSM_ADD(a, b) \ - * ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \ - * ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) - */ -/* Nonportable, but faster: */ - -#define GSM_ADD(a, b) \ - ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \ - MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp) - -# define GSM_SUB(a, b) \ - ((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \ - ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) - -# define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a)) - -/* Use these if necessary: - -# define GSM_MULT_R(a, b) gsm_mult_r(a, b) -# define GSM_MULT(a, b) gsm_mult(a, b) -# define GSM_L_MULT(a, b) gsm_L_mult(a, b) - -# define GSM_L_ADD(a, b) gsm_L_add(a, b) -# define GSM_ADD(a, b) gsm_add(a, b) -# define GSM_SUB(a, b) gsm_sub(a, b) - -# define GSM_ABS(a) gsm_abs(a) - -*/ - -/* - * More prototypes from implementations.. - */ -extern void Gsm_Coder P(( - struct gsm_state * S, - word * s, /* [0..159] samples IN */ - word * LARc, /* [0..7] LAR coefficients OUT */ - word * Nc, /* [0..3] LTP lag OUT */ - word * bc, /* [0..3] coded LTP gain OUT */ - word * Mc, /* [0..3] RPE grid selection OUT */ - word * xmaxc,/* [0..3] Coded maximum amplitude OUT */ - word * xMc /* [13*4] normalized RPE samples OUT */)); - -extern void Gsm_Long_Term_Predictor P(( /* 4x for 160 samples */ - struct gsm_state * S, - word * d, /* [0..39] residual signal IN */ - word * dp, /* [-120..-1] d' IN */ - word * e, /* [0..40] OUT */ - word * dpp, /* [0..40] OUT */ - word * Nc, /* correlation lag OUT */ - word * bc /* gain factor OUT */)); - -extern void Gsm_LPC_Analysis P(( - struct gsm_state * S, - word * s, /* 0..159 signals IN/OUT */ - word * LARc)); /* 0..7 LARc's OUT */ - -extern void Gsm_Preprocess P(( - struct gsm_state * S, - word * s, word * so)); - -extern void Gsm_Encoding P(( - struct gsm_state * S, - word * e, - word * ep, - word * xmaxc, - word * Mc, - word * xMc)); - -extern void Gsm_Short_Term_Analysis_Filter P(( - struct gsm_state * S, - word * LARc, /* coded log area ratio [0..7] IN */ - word * d /* st res. signal [0..159] IN/OUT */)); - -extern void Gsm_Decoder P(( - struct gsm_state * S, - word * LARcr, /* [0..7] IN */ - word * Ncr, /* [0..3] IN */ - word * bcr, /* [0..3] IN */ - word * Mcr, /* [0..3] IN */ - word * xmaxcr, /* [0..3] IN */ - word * xMcr, /* [0..13*4] IN */ - word * s)); /* [0..159] OUT */ - -extern void Gsm_Decoding P(( - struct gsm_state * S, - word xmaxcr, - word Mcr, - word * xMcr, /* [0..12] IN */ - word * erp)); /* [0..39] OUT */ - -extern void Gsm_Long_Term_Synthesis_Filtering P(( - struct gsm_state* S, - word Ncr, - word bcr, - word * erp, /* [0..39] IN */ - word * drp)); /* [-120..-1] IN, [0..40] OUT */ - -void Gsm_RPE_Decoding P(( - struct gsm_state *S, - word xmaxcr, - word Mcr, - word * xMcr, /* [0..12], 3 bits IN */ - word * erp)); /* [0..39] OUT */ - -void Gsm_RPE_Encoding P(( - struct gsm_state * S, - word * e, /* -5..-1][0..39][40..44 IN/OUT */ - word * xmaxc, /* OUT */ - word * Mc, /* OUT */ - word * xMc)); /* [0..12] OUT */ - -extern void Gsm_Short_Term_Synthesis_Filter P(( - struct gsm_state * S, - word * LARcr, /* log area ratios [0..7] IN */ - word * drp, /* received d [0...39] IN */ - word * s)); /* signal s [0..159] OUT */ - -extern void Gsm_Update_of_reconstructed_short_time_residual_signal P(( - word * dpp, /* [0...39] IN */ - word * ep, /* [0...39] IN */ - word * dp)); /* [-120...-1] IN/OUT */ - -/* - * Tables from table.c - */ -#ifndef GSM_TABLE_C - -extern word gsm_A[8], gsm_B[8], gsm_MIC[8], gsm_MAC[8]; -extern word gsm_INVA[8]; -extern word gsm_DLB[4], gsm_QLB[4]; -extern word gsm_H[11]; -extern word gsm_NRFAC[8]; -extern word gsm_FAC[8]; - -#endif /* GSM_TABLE_C */ - -/* - * Debugging - */ -#ifdef NDEBUG - -# define gsm_debug_words(a, b, c, d) /* nil */ -# define gsm_debug_longwords(a, b, c, d) /* nil */ -# define gsm_debug_word(a, b) /* nil */ -# define gsm_debug_longword(a, b) /* nil */ - -#else /* !NDEBUG => DEBUG */ - - extern void gsm_debug_words P((char * name, int, int, word *)); - extern void gsm_debug_longwords P((char * name, int, int, longword *)); - extern void gsm_debug_longword P((char * name, longword)); - extern void gsm_debug_word P((char * name, word)); - -#endif /* !NDEBUG */ - -#include "unproto.h" - -#endif /* PRIVATE_H */ diff --git a/gr-vocoder/lib/gsm/proto.h b/gr-vocoder/lib/gsm/proto.h deleted file mode 100644 index ea60abfe7..000000000 --- a/gr-vocoder/lib/gsm/proto.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/*$Header$*/ - -#ifndef PROTO_H -#define PROTO_H - -#if __cplusplus -# define NeedFunctionPrototypes 1 -#endif - -#if __STDC__ -# define NeedFunctionPrototypes 1 -#endif - -#ifdef _NO_PROTO -# undef NeedFunctionPrototypes -#endif - -#undef P /* gnu stdio.h actually defines this... */ -#undef P0 -#undef P1 -#undef P2 -#undef P3 -#undef P4 -#undef P5 -#undef P6 -#undef P7 -#undef P8 - -#if NeedFunctionPrototypes - -# define P( protos ) protos - -# define P0() (void) -# define P1(x, a) (a) -# define P2(x, a, b) (a, b) -# define P3(x, a, b, c) (a, b, c) -# define P4(x, a, b, c, d) (a, b, c, d) -# define P5(x, a, b, c, d, e) (a, b, c, d, e) -# define P6(x, a, b, c, d, e, f) (a, b, c, d, e, f) -# define P7(x, a, b, c, d, e, f, g) (a, b, c, d, e, f, g) -# define P8(x, a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g, h) - -#else /* !NeedFunctionPrototypes */ - -# define P( protos ) ( /* protos */ ) - -# define P0() () -# define P1(x, a) x a; -# define P2(x, a, b) x a; b; -# define P3(x, a, b, c) x a; b; c; -# define P4(x, a, b, c, d) x a; b; c; d; -# define P5(x, a, b, c, d, e) x a; b; c; d; e; -# define P6(x, a, b, c, d, e, f) x a; b; c; d; e; f; -# define P7(x, a, b, c, d, e, f, g) x a; b; c; d; e; f; g; -# define P8(x, a, b, c, d, e, f, g, h) x a; b; c; d; e; f; g; h; - -#endif /* !NeedFunctionPrototypes */ - -#endif /* PROTO_H */ diff --git a/gr-vocoder/lib/gsm/rpe.c b/gr-vocoder/lib/gsm/rpe.c deleted file mode 100644 index bdc78910e..000000000 --- a/gr-vocoder/lib/gsm/rpe.c +++ /dev/null @@ -1,488 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include <stdio.h> -#include <assert.h> - -#include "private.h" - -#include "gsm.h" -#include "proto.h" - -/* 4.2.13 .. 4.2.17 RPE ENCODING SECTION - */ - -/* 4.2.13 */ - -static void Weighting_filter P2((e, x), - register word * e, /* signal [-5..0.39.44] IN */ - word * x /* signal [0..39] OUT */ -) -/* - * The coefficients of the weighting filter are stored in a table - * (see table 4.4). The following scaling is used: - * - * H[0..10] = integer( real_H[ 0..10] * 8192 ); - */ -{ - /* word wt[ 50 ]; */ - - register longword L_result; - register int k /* , i */ ; - - /* Initialization of a temporary working array wt[0...49] - */ - - /* for (k = 0; k <= 4; k++) wt[k] = 0; - * for (k = 5; k <= 44; k++) wt[k] = *e++; - * for (k = 45; k <= 49; k++) wt[k] = 0; - * - * (e[-5..-1] and e[40..44] are allocated by the caller, - * are initially zero and are not written anywhere.) - */ - e -= 5; - - /* Compute the signal x[0..39] - */ - for (k = 0; k <= 39; k++) { - - L_result = 8192 >> 1; - - /* for (i = 0; i <= 10; i++) { - * L_temp = GSM_L_MULT( wt[k+i], gsm_H[i] ); - * L_result = GSM_L_ADD( L_result, L_temp ); - * } - */ - -#undef STEP -#define STEP( i, H ) (e[ k + i ] * (longword)H) - - /* Every one of these multiplications is done twice -- - * but I don't see an elegant way to optimize this. - * Do you? - */ - -#ifdef STUPID_COMPILER - L_result += STEP( 0, -134 ) ; - L_result += STEP( 1, -374 ) ; - /* + STEP( 2, 0 ) */ - L_result += STEP( 3, 2054 ) ; - L_result += STEP( 4, 5741 ) ; - L_result += STEP( 5, 8192 ) ; - L_result += STEP( 6, 5741 ) ; - L_result += STEP( 7, 2054 ) ; - /* + STEP( 8, 0 ) */ - L_result += STEP( 9, -374 ) ; - L_result += STEP( 10, -134 ) ; -#else - L_result += - STEP( 0, -134 ) - + STEP( 1, -374 ) - /* + STEP( 2, 0 ) */ - + STEP( 3, 2054 ) - + STEP( 4, 5741 ) - + STEP( 5, 8192 ) - + STEP( 6, 5741 ) - + STEP( 7, 2054 ) - /* + STEP( 8, 0 ) */ - + STEP( 9, -374 ) - + STEP(10, -134 ) - ; -#endif - - /* L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x2) *) - * L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x4) *) - * - * x[k] = SASR( L_result, 16 ); - */ - - /* 2 adds vs. >>16 => 14, minus one shift to compensate for - * those we lost when replacing L_MULT by '*'. - */ - - L_result = SASR( L_result, 13 ); - x[k] = ( L_result < MIN_WORD ? MIN_WORD - : (L_result > MAX_WORD ? MAX_WORD : L_result )); - } -} - -/* 4.2.14 */ - -static void RPE_grid_selection P3((x,xM,Mc_out), - word * x, /* [0..39] IN */ - word * xM, /* [0..12] OUT */ - word * Mc_out /* OUT */ -) -/* - * The signal x[0..39] is used to select the RPE grid which is - * represented by Mc. - */ -{ - /* register word temp1; */ - register int /* m, */ i; - register longword L_result, L_temp; - longword EM; /* xxx should be L_EM? */ - word Mc; - - longword L_common_0_3; - - EM = 0; - Mc = 0; - - /* for (m = 0; m <= 3; m++) { - * L_result = 0; - * - * - * for (i = 0; i <= 12; i++) { - * - * temp1 = SASR( x[m + 3*i], 2 ); - * - * assert(temp1 != MIN_WORD); - * - * L_temp = GSM_L_MULT( temp1, temp1 ); - * L_result = GSM_L_ADD( L_temp, L_result ); - * } - * - * if (L_result > EM) { - * Mc = m; - * EM = L_result; - * } - * } - */ - -#undef STEP -#define STEP( m, i ) L_temp = SASR( x[m + 3 * i], 2 ); \ - L_result += L_temp * L_temp; - - /* common part of 0 and 3 */ - - L_result = 0; - STEP( 0, 1 ); STEP( 0, 2 ); STEP( 0, 3 ); STEP( 0, 4 ); - STEP( 0, 5 ); STEP( 0, 6 ); STEP( 0, 7 ); STEP( 0, 8 ); - STEP( 0, 9 ); STEP( 0, 10); STEP( 0, 11); STEP( 0, 12); - L_common_0_3 = L_result; - - /* i = 0 */ - - STEP( 0, 0 ); - L_result <<= 1; /* implicit in L_MULT */ - EM = L_result; - - /* i = 1 */ - - L_result = 0; - STEP( 1, 0 ); - STEP( 1, 1 ); STEP( 1, 2 ); STEP( 1, 3 ); STEP( 1, 4 ); - STEP( 1, 5 ); STEP( 1, 6 ); STEP( 1, 7 ); STEP( 1, 8 ); - STEP( 1, 9 ); STEP( 1, 10); STEP( 1, 11); STEP( 1, 12); - L_result <<= 1; - if (L_result > EM) { - Mc = 1; - EM = L_result; - } - - /* i = 2 */ - - L_result = 0; - STEP( 2, 0 ); - STEP( 2, 1 ); STEP( 2, 2 ); STEP( 2, 3 ); STEP( 2, 4 ); - STEP( 2, 5 ); STEP( 2, 6 ); STEP( 2, 7 ); STEP( 2, 8 ); - STEP( 2, 9 ); STEP( 2, 10); STEP( 2, 11); STEP( 2, 12); - L_result <<= 1; - if (L_result > EM) { - Mc = 2; - EM = L_result; - } - - /* i = 3 */ - - L_result = L_common_0_3; - STEP( 3, 12 ); - L_result <<= 1; - if (L_result > EM) { - Mc = 3; - EM = L_result; - } - - /**/ - - /* Down-sampling by a factor 3 to get the selected xM[0..12] - * RPE sequence. - */ - for (i = 0; i <= 12; i ++) xM[i] = x[Mc + 3*i]; - *Mc_out = Mc; -} - -/* 4.12.15 */ - -static void APCM_quantization_xmaxc_to_exp_mant P3((xmaxc,exp_out,mant_out), - word xmaxc, /* IN */ - word * exp_out, /* OUT */ - word * mant_out ) /* OUT */ -{ - word exp, mant; - - /* Compute exponent and mantissa of the decoded version of xmaxc - */ - - exp = 0; - if (xmaxc > 15) exp = SASR(xmaxc, 3) - 1; - mant = xmaxc - (exp << 3); - - if (mant == 0) { - exp = -4; - mant = 7; - } - else { - while (mant <= 7) { - mant = mant << 1 | 1; - exp--; - } - mant -= 8; - } - - assert( exp >= -4 && exp <= 6 ); - assert( mant >= 0 && mant <= 7 ); - - *exp_out = exp; - *mant_out = mant; -} - -static void APCM_quantization P5((xM,xMc,mant_out,exp_out,xmaxc_out), - word * xM, /* [0..12] IN */ - - word * xMc, /* [0..12] OUT */ - word * mant_out, /* OUT */ - word * exp_out, /* OUT */ - word * xmaxc_out /* OUT */ -) -{ - int i, itest; - - word xmax, xmaxc, temp, temp1, temp2; - word exp, mant; - - - /* Find the maximum absolute value xmax of xM[0..12]. - */ - - xmax = 0; - for (i = 0; i <= 12; i++) { - temp = xM[i]; - temp = GSM_ABS(temp); - if (temp > xmax) xmax = temp; - } - - /* Qantizing and coding of xmax to get xmaxc. - */ - - exp = 0; - temp = SASR( xmax, 9 ); - itest = 0; - - for (i = 0; i <= 5; i++) { - - itest |= (temp <= 0); - temp = SASR( temp, 1 ); - - assert(exp <= 5); - if (itest == 0) exp++; /* exp = add (exp, 1) */ - } - - assert(exp <= 6 && exp >= 0); - temp = exp + 5; - - assert(temp <= 11 && temp >= 0); - xmaxc = gsm_add( SASR(xmax, temp), exp << 3 ); - - /* Quantizing and coding of the xM[0..12] RPE sequence - * to get the xMc[0..12] - */ - - APCM_quantization_xmaxc_to_exp_mant( xmaxc, &exp, &mant ); - - /* This computation uses the fact that the decoded version of xmaxc - * can be calculated by using the exponent and the mantissa part of - * xmaxc (logarithmic table). - * So, this method avoids any division and uses only a scaling - * of the RPE samples by a function of the exponent. A direct - * multiplication by the inverse of the mantissa (NRFAC[0..7] - * found in table 4.5) gives the 3 bit coded version xMc[0..12] - * of the RPE samples. - */ - - - /* Direct computation of xMc[0..12] using table 4.5 - */ - - assert( exp <= 4096 && exp >= -4096); - assert( mant >= 0 && mant <= 7 ); - - temp1 = 6 - exp; /* normalization by the exponent */ - temp2 = gsm_NRFAC[ mant ]; /* inverse mantissa */ - - for (i = 0; i <= 12; i++) { - - assert(temp1 >= 0 && temp1 < 16); - - temp = xM[i] << temp1; - temp = GSM_MULT( temp, temp2 ); - temp = SASR(temp, 12); - xMc[i] = temp + 4; /* see note below */ - } - - /* NOTE: This equation is used to make all the xMc[i] positive. - */ - - *mant_out = mant; - *exp_out = exp; - *xmaxc_out = xmaxc; -} - -/* 4.2.16 */ - -static void APCM_inverse_quantization P4((xMc,mant,exp,xMp), - register word * xMc, /* [0..12] IN */ - word mant, - word exp, - register word * xMp) /* [0..12] OUT */ -/* - * This part is for decoding the RPE sequence of coded xMc[0..12] - * samples to obtain the xMp[0..12] array. Table 4.6 is used to get - * the mantissa of xmaxc (FAC[0..7]). - */ -{ - int i; - word temp, temp1, temp2, temp3; - longword ltmp; - - assert( mant >= 0 && mant <= 7 ); - - temp1 = gsm_FAC[ mant ]; /* see 4.2-15 for mant */ - temp2 = gsm_sub( 6, exp ); /* see 4.2-15 for exp */ - temp3 = gsm_asl( 1, gsm_sub( temp2, 1 )); - - for (i = 13; i--;) { - - assert( *xMc <= 7 && *xMc >= 0 ); /* 3 bit unsigned */ - - /* temp = gsm_sub( *xMc++ << 1, 7 ); */ - temp = (*xMc++ << 1) - 7; /* restore sign */ - assert( temp <= 7 && temp >= -7 ); /* 4 bit signed */ - - temp <<= 12; /* 16 bit signed */ - temp = GSM_MULT_R( temp1, temp ); - temp = GSM_ADD( temp, temp3 ); - *xMp++ = gsm_asr( temp, temp2 ); - } -} - -/* 4.2.17 */ - -static void RPE_grid_positioning P3((Mc,xMp,ep), - word Mc, /* grid position IN */ - register word * xMp, /* [0..12] IN */ - register word * ep /* [0..39] OUT */ -) -/* - * This procedure computes the reconstructed long term residual signal - * ep[0..39] for the LTP analysis filter. The inputs are the Mc - * which is the grid position selection and the xMp[0..12] decoded - * RPE samples which are upsampled by a factor of 3 by inserting zero - * values. - */ -{ - int i = 13; - - assert(0 <= Mc && Mc <= 3); - - switch (Mc) { - case 3: *ep++ = 0; - case 2: do { - *ep++ = 0; - case 1: *ep++ = 0; - case 0: *ep++ = *xMp++; - } while (--i); - } - while (++Mc < 4) *ep++ = 0; - - /* - - int i, k; - for (k = 0; k <= 39; k++) ep[k] = 0; - for (i = 0; i <= 12; i++) { - ep[ Mc + (3*i) ] = xMp[i]; - } - */ -} - -/* 4.2.18 */ - -/* This procedure adds the reconstructed long term residual signal - * ep[0..39] to the estimated signal dpp[0..39] from the long term - * analysis filter to compute the reconstructed short term residual - * signal dp[-40..-1]; also the reconstructed short term residual - * array dp[-120..-41] is updated. - */ - -#if 0 /* Has been inlined in code.c */ -void Gsm_Update_of_reconstructed_short_time_residual_signal P3((dpp, ep, dp), - word * dpp, /* [0...39] IN */ - word * ep, /* [0...39] IN */ - word * dp) /* [-120...-1] IN/OUT */ -{ - int k; - - for (k = 0; k <= 79; k++) - dp[ -120 + k ] = dp[ -80 + k ]; - - for (k = 0; k <= 39; k++) - dp[ -40 + k ] = gsm_add( ep[k], dpp[k] ); -} -#endif /* Has been inlined in code.c */ - -void Gsm_RPE_Encoding P5((S,e,xmaxc,Mc,xMc), - - struct gsm_state * S, - - word * e, /* -5..-1][0..39][40..44 IN/OUT */ - word * xmaxc, /* OUT */ - word * Mc, /* OUT */ - word * xMc) /* [0..12] OUT */ -{ - word x[40]; - word xM[13], xMp[13]; - word mant, exp; - - Weighting_filter(e, x); - RPE_grid_selection(x, xM, Mc); - - APCM_quantization( xM, xMc, &mant, &exp, xmaxc); - APCM_inverse_quantization( xMc, mant, exp, xMp); - - RPE_grid_positioning( *Mc, xMp, e ); - -} - -void Gsm_RPE_Decoding P5((S, xmaxcr, Mcr, xMcr, erp), - struct gsm_state * S, - - word xmaxcr, - word Mcr, - word * xMcr, /* [0..12], 3 bits IN */ - word * erp /* [0..39] OUT */ -) -{ - word exp, mant; - word xMp[ 13 ]; - - APCM_quantization_xmaxc_to_exp_mant( xmaxcr, &exp, &mant ); - APCM_inverse_quantization( xMcr, mant, exp, xMp ); - RPE_grid_positioning( Mcr, xMp, erp ); - -} diff --git a/gr-vocoder/lib/gsm/short_term.c b/gr-vocoder/lib/gsm/short_term.c deleted file mode 100644 index 68aabe5bb..000000000 --- a/gr-vocoder/lib/gsm/short_term.c +++ /dev/null @@ -1,429 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -#include <stdio.h> -#include <assert.h> - -#include "private.h" - -#include "gsm.h" -#include "proto.h" - -/* - * SHORT TERM ANALYSIS FILTERING SECTION - */ - -/* 4.2.8 */ - -static void Decoding_of_the_coded_Log_Area_Ratios P2((LARc,LARpp), - word * LARc, /* coded log area ratio [0..7] IN */ - word * LARpp) /* out: decoded .. */ -{ - register word temp1 /* , temp2 */; - register long ltmp; /* for GSM_ADD */ - - /* This procedure requires for efficient implementation - * two tables. - * - * INVA[1..8] = integer( (32768 * 8) / real_A[1..8]) - * MIC[1..8] = minimum value of the LARc[1..8] - */ - - /* Compute the LARpp[1..8] - */ - - /* for (i = 1; i <= 8; i++, B++, MIC++, INVA++, LARc++, LARpp++) { - * - * temp1 = GSM_ADD( *LARc, *MIC ) << 10; - * temp2 = *B << 1; - * temp1 = GSM_SUB( temp1, temp2 ); - * - * assert(*INVA != MIN_WORD); - * - * temp1 = GSM_MULT_R( *INVA, temp1 ); - * *LARpp = GSM_ADD( temp1, temp1 ); - * } - */ - -#undef STEP -#define STEP( B, MIC, INVA ) \ - temp1 = GSM_ADD( *LARc++, MIC ) << 10; \ - temp1 = GSM_SUB( temp1, B << 1 ); \ - temp1 = GSM_MULT_R( INVA, temp1 ); \ - *LARpp++ = GSM_ADD( temp1, temp1 ); - - STEP( 0, -32, 13107 ); - STEP( 0, -32, 13107 ); - STEP( 2048, -16, 13107 ); - STEP( -2560, -16, 13107 ); - - STEP( 94, -8, 19223 ); - STEP( -1792, -8, 17476 ); - STEP( -341, -4, 31454 ); - STEP( -1144, -4, 29708 ); - - /* NOTE: the addition of *MIC is used to restore - * the sign of *LARc. - */ -} - -/* 4.2.9 */ -/* Computation of the quantized reflection coefficients - */ - -/* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8] - */ - -/* - * Within each frame of 160 analyzed speech samples the short term - * analysis and synthesis filters operate with four different sets of - * coefficients, derived from the previous set of decoded LARs(LARpp(j-1)) - * and the actual set of decoded LARs (LARpp(j)) - * - * (Initial value: LARpp(j-1)[1..8] = 0.) - */ - -static void Coefficients_0_12 P3((LARpp_j_1, LARpp_j, LARp), - register word * LARpp_j_1, - register word * LARpp_j, - register word * LARp) -{ - register int i; - register longword ltmp; - - for (i = 1; i <= 8; i++, LARp++, LARpp_j_1++, LARpp_j++) { - *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 )); - *LARp = GSM_ADD( *LARp, SASR( *LARpp_j_1, 1)); - } -} - -static void Coefficients_13_26 P3((LARpp_j_1, LARpp_j, LARp), - register word * LARpp_j_1, - register word * LARpp_j, - register word * LARp) -{ - register int i; - register longword ltmp; - for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) { - *LARp = GSM_ADD( SASR( *LARpp_j_1, 1), SASR( *LARpp_j, 1 )); - } -} - -static void Coefficients_27_39 P3((LARpp_j_1, LARpp_j, LARp), - register word * LARpp_j_1, - register word * LARpp_j, - register word * LARp) -{ - register int i; - register longword ltmp; - - for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) { - *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 )); - *LARp = GSM_ADD( *LARp, SASR( *LARpp_j, 1 )); - } -} - - -static void Coefficients_40_159 P2((LARpp_j, LARp), - register word * LARpp_j, - register word * LARp) -{ - register int i; - - for (i = 1; i <= 8; i++, LARp++, LARpp_j++) - *LARp = *LARpp_j; -} - -/* 4.2.9.2 */ - -static void LARp_to_rp P1((LARp), - register word * LARp) /* [0..7] IN/OUT */ -/* - * The input of this procedure is the interpolated LARp[0..7] array. - * The reflection coefficients, rp[i], are used in the analysis - * filter and in the synthesis filter. - */ -{ - register int i; - register word temp; - register longword ltmp; - - for (i = 1; i <= 8; i++, LARp++) { - - /* temp = GSM_ABS( *LARp ); - * - * if (temp < 11059) temp <<= 1; - * else if (temp < 20070) temp += 11059; - * else temp = GSM_ADD( temp >> 2, 26112 ); - * - * *LARp = *LARp < 0 ? -temp : temp; - */ - - if (*LARp < 0) { - temp = *LARp == MIN_WORD ? MAX_WORD : -(*LARp); - *LARp = - ((temp < 11059) ? temp << 1 - : ((temp < 20070) ? temp + 11059 - : GSM_ADD( temp >> 2, 26112 ))); - } else { - temp = *LARp; - *LARp = (temp < 11059) ? temp << 1 - : ((temp < 20070) ? temp + 11059 - : GSM_ADD( temp >> 2, 26112 )); - } - } -} - - -/* 4.2.10 */ -static void Short_term_analysis_filtering P4((S,rp,k_n,s), - struct gsm_state * S, - register word * rp, /* [0..7] IN */ - register int k_n, /* k_end - k_start */ - register word * s /* [0..n-1] IN/OUT */ -) -/* - * This procedure computes the short term residual signal d[..] to be fed - * to the RPE-LTP loop from the s[..] signal and from the local rp[..] - * array (quantized reflection coefficients). As the call of this - * procedure can be done in many ways (see the interpolation of the LAR - * coefficient), it is assumed that the computation begins with index - * k_start (for arrays d[..] and s[..]) and stops with index k_end - * (k_start and k_end are defined in 4.2.9.1). This procedure also - * needs to keep the array u[0..7] in memory for each call. - */ -{ - register word * u = S->u; - register int i; - register word di, zzz, ui, sav, rpi; - register longword ltmp; - - for (; k_n--; s++) { - - di = sav = *s; - - for (i = 0; i < 8; i++) { /* YYY */ - - ui = u[i]; - rpi = rp[i]; - u[i] = sav; - - zzz = GSM_MULT_R(rpi, di); - sav = GSM_ADD( ui, zzz); - - zzz = GSM_MULT_R(rpi, ui); - di = GSM_ADD( di, zzz ); - } - - *s = di; - } -} - -#if defined(USE_FLOAT_MUL) && defined(FAST) - -static void Fast_Short_term_analysis_filtering P4((S,rp,k_n,s), - struct gsm_state * S, - register word * rp, /* [0..7] IN */ - register int k_n, /* k_end - k_start */ - register word * s /* [0..n-1] IN/OUT */ -) -{ - register word * u = S->u; - register int i; - - float uf[8], - rpf[8]; - - register float scalef = 3.0517578125e-5; - register float sav, di, temp; - - for (i = 0; i < 8; ++i) { - uf[i] = u[i]; - rpf[i] = rp[i] * scalef; - } - for (; k_n--; s++) { - sav = di = *s; - for (i = 0; i < 8; ++i) { - register float rpfi = rpf[i]; - register float ufi = uf[i]; - - uf[i] = sav; - temp = rpfi * di + ufi; - di += rpfi * ufi; - sav = temp; - } - *s = di; - } - for (i = 0; i < 8; ++i) u[i] = uf[i]; -} -#endif /* ! (defined (USE_FLOAT_MUL) && defined (FAST)) */ - -static void Short_term_synthesis_filtering P5((S,rrp,k,wt,sr), - struct gsm_state * S, - register word * rrp, /* [0..7] IN */ - register int k, /* k_end - k_start */ - register word * wt, /* [0..k-1] IN */ - register word * sr /* [0..k-1] OUT */ -) -{ - register word * v = S->v; - register int i; - register word sri, tmp1, tmp2; - register longword ltmp; /* for GSM_ADD & GSM_SUB */ - - while (k--) { - sri = *wt++; - for (i = 8; i--;) { - - /* sri = GSM_SUB( sri, gsm_mult_r( rrp[i], v[i] ) ); - */ - tmp1 = rrp[i]; - tmp2 = v[i]; - tmp2 = ( tmp1 == MIN_WORD && tmp2 == MIN_WORD - ? MAX_WORD - : 0x0FFFF & (( (longword)tmp1 * (longword)tmp2 - + 16384) >> 15)) ; - - sri = GSM_SUB( sri, tmp2 ); - - /* v[i+1] = GSM_ADD( v[i], gsm_mult_r( rrp[i], sri ) ); - */ - tmp1 = ( tmp1 == MIN_WORD && sri == MIN_WORD - ? MAX_WORD - : 0x0FFFF & (( (longword)tmp1 * (longword)sri - + 16384) >> 15)) ; - - v[i+1] = GSM_ADD( v[i], tmp1); - } - *sr++ = v[0] = sri; - } -} - - -#if defined(FAST) && defined(USE_FLOAT_MUL) - -static void Fast_Short_term_synthesis_filtering P5((S,rrp,k,wt,sr), - struct gsm_state * S, - register word * rrp, /* [0..7] IN */ - register int k, /* k_end - k_start */ - register word * wt, /* [0..k-1] IN */ - register word * sr /* [0..k-1] OUT */ -) -{ - register word * v = S->v; - register int i; - - float va[9], rrpa[8]; - register float scalef = 3.0517578125e-5, temp; - - for (i = 0; i < 8; ++i) { - va[i] = v[i]; - rrpa[i] = (float)rrp[i] * scalef; - } - while (k--) { - register float sri = *wt++; - for (i = 8; i--;) { - sri -= rrpa[i] * va[i]; - if (sri < -32768.) sri = -32768.; - else if (sri > 32767.) sri = 32767.; - - temp = va[i] + rrpa[i] * sri; - if (temp < -32768.) temp = -32768.; - else if (temp > 32767.) temp = 32767.; - va[i+1] = temp; - } - *sr++ = va[0] = sri; - } - for (i = 0; i < 9; ++i) v[i] = va[i]; -} - -#endif /* defined(FAST) && defined(USE_FLOAT_MUL) */ - -void Gsm_Short_Term_Analysis_Filter P3((S,LARc,s), - - struct gsm_state * S, - - word * LARc, /* coded log area ratio [0..7] IN */ - word * s /* signal [0..159] IN/OUT */ -) -{ - word * LARpp_j = S->LARpp[ S->j ]; - word * LARpp_j_1 = S->LARpp[ S->j ^= 1 ]; - - word LARp[8]; - -#undef FILTER -#if defined(FAST) && defined(USE_FLOAT_MUL) -# define FILTER (* (S->fast \ - ? Fast_Short_term_analysis_filtering \ - : Short_term_analysis_filtering )) - -#else -# define FILTER Short_term_analysis_filtering -#endif - - Decoding_of_the_coded_Log_Area_Ratios( LARc, LARpp_j ); - - Coefficients_0_12( LARpp_j_1, LARpp_j, LARp ); - LARp_to_rp( LARp ); - FILTER( S, LARp, 13, s); - - Coefficients_13_26( LARpp_j_1, LARpp_j, LARp); - LARp_to_rp( LARp ); - FILTER( S, LARp, 14, s + 13); - - Coefficients_27_39( LARpp_j_1, LARpp_j, LARp); - LARp_to_rp( LARp ); - FILTER( S, LARp, 13, s + 27); - - Coefficients_40_159( LARpp_j, LARp); - LARp_to_rp( LARp ); - FILTER( S, LARp, 120, s + 40); -} - -void Gsm_Short_Term_Synthesis_Filter P4((S, LARcr, wt, s), - struct gsm_state * S, - - word * LARcr, /* received log area ratios [0..7] IN */ - word * wt, /* received d [0..159] IN */ - - word * s /* signal s [0..159] OUT */ -) -{ - word * LARpp_j = S->LARpp[ S->j ]; - word * LARpp_j_1 = S->LARpp[ S->j ^=1 ]; - - word LARp[8]; - -#undef FILTER -#if defined(FAST) && defined(USE_FLOAT_MUL) - -# define FILTER (* (S->fast \ - ? Fast_Short_term_synthesis_filtering \ - : Short_term_synthesis_filtering )) -#else -# define FILTER Short_term_synthesis_filtering -#endif - - Decoding_of_the_coded_Log_Area_Ratios( LARcr, LARpp_j ); - - Coefficients_0_12( LARpp_j_1, LARpp_j, LARp ); - LARp_to_rp( LARp ); - FILTER( S, LARp, 13, wt, s ); - - Coefficients_13_26( LARpp_j_1, LARpp_j, LARp); - LARp_to_rp( LARp ); - FILTER( S, LARp, 14, wt + 13, s + 13 ); - - Coefficients_27_39( LARpp_j_1, LARpp_j, LARp); - LARp_to_rp( LARp ); - FILTER( S, LARp, 13, wt + 27, s + 27 ); - - Coefficients_40_159( LARpp_j, LARp ); - LARp_to_rp( LARp ); - FILTER(S, LARp, 120, wt + 40, s + 40); -} diff --git a/gr-vocoder/lib/gsm/table.c b/gr-vocoder/lib/gsm/table.c deleted file mode 100644 index d8366931e..000000000 --- a/gr-vocoder/lib/gsm/table.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/* $Header$ */ - -/* Most of these tables are inlined at their point of use. - */ - -/* 4.4 TABLES USED IN THE FIXED POINT IMPLEMENTATION OF THE RPE-LTP - * CODER AND DECODER - * - * (Most of them inlined, so watch out.) - */ - -#define GSM_TABLE_C -#include "private.h" -#include "gsm.h" - -/* Table 4.1 Quantization of the Log.-Area Ratios - */ -/* i 1 2 3 4 5 6 7 8 */ -word gsm_A[8] = {20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036}; -word gsm_B[8] = { 0, 0, 2048, -2560, 94, -1792, -341, -1144}; -word gsm_MIC[8] = { -32, -32, -16, -16, -8, -8, -4, -4 }; -word gsm_MAC[8] = { 31, 31, 15, 15, 7, 7, 3, 3 }; - - -/* Table 4.2 Tabulation of 1/A[1..8] - */ -word gsm_INVA[8]={ 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708 }; - - -/* Table 4.3a Decision level of the LTP gain quantizer - */ -/* bc 0 1 2 3 */ -word gsm_DLB[4] = { 6554, 16384, 26214, 32767 }; - - -/* Table 4.3b Quantization levels of the LTP gain quantizer - */ -/* bc 0 1 2 3 */ -word gsm_QLB[4] = { 3277, 11469, 21299, 32767 }; - - -/* Table 4.4 Coefficients of the weighting filter - */ -/* i 0 1 2 3 4 5 6 7 8 9 10 */ -word gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 }; - - -/* Table 4.5 Normalized inverse mantissa used to compute xM/xmax - */ -/* i 0 1 2 3 4 5 6 7 */ -word gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 }; - - -/* Table 4.6 Normalized direct mantissa used to compute xM/xmax - */ -/* i 0 1 2 3 4 5 6 7 */ -word gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 }; diff --git a/gr-vocoder/lib/gsm/unproto.h b/gr-vocoder/lib/gsm/unproto.h deleted file mode 100644 index ccd565109..000000000 --- a/gr-vocoder/lib/gsm/unproto.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische - * Universitaet Berlin. See the accompanying file "COPYRIGHT" for - * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. - */ - -/*$Header$*/ - -#ifdef PROTO_H /* sic */ -#undef PROTO_H - -#undef P -#undef P0 -#undef P1 -#undef P2 -#undef P3 -#undef P4 -#undef P5 -#undef P6 -#undef P7 -#undef P8 - -#endif /* PROTO_H */ diff --git a/gr-vocoder/lib/vocoder_alaw_decode_bs.cc b/gr-vocoder/lib/vocoder_alaw_decode_bs.cc deleted file mode 100644 index 33c119e05..000000000 --- a/gr-vocoder/lib/vocoder_alaw_decode_bs.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <vocoder_alaw_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs() -{ - return gnuradio::get_initial_sptr(new vocoder_alaw_decode_bs()); -} - -vocoder_alaw_decode_bs::vocoder_alaw_decode_bs() - : gr_sync_block("vocoder_alaw_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short))) -{ -} - -vocoder_alaw_decode_bs::~vocoder_alaw_decode_bs() -{ -} - - - -int -vocoder_alaw_decode_bs::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - short *out = (short *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = alaw2linear(in[i]); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_alaw_encode_sb.cc b/gr-vocoder/lib/vocoder_alaw_encode_sb.cc deleted file mode 100644 index ebb953c34..000000000 --- a/gr-vocoder/lib/vocoder_alaw_encode_sb.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <vocoder_alaw_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb() -{ - return gnuradio::get_initial_sptr(new vocoder_alaw_encode_sb()); -} - -vocoder_alaw_encode_sb::vocoder_alaw_encode_sb() - : gr_sync_block("vocoder_alaw_encode_sb", - gr_make_io_signature (1, 1, sizeof(short)), - gr_make_io_signature (1, 1, sizeof(unsigned char))) -{ -} - -vocoder_alaw_encode_sb::~vocoder_alaw_encode_sb() -{ -} - -int -vocoder_alaw_encode_sb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = linear2alaw(in[i]); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_codec2_decode_ps.cc b/gr-vocoder/lib/vocoder_codec2_decode_ps.cc deleted file mode 100644 index 8e95c75dd..000000000 --- a/gr-vocoder/lib/vocoder_codec2_decode_ps.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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 "vocoder_codec2_decode_ps.h" - -extern "C" { -#include "codec2/codec2.h" -} - -#include <gr_io_signature.h> -#include <stdexcept> -#include <assert.h> - -vocoder_codec2_decode_ps_sptr -vocoder_make_codec2_decode_ps () -{ - return gnuradio::get_initial_sptr(new vocoder_codec2_decode_ps ()); -} - -vocoder_codec2_decode_ps::vocoder_codec2_decode_ps () - : gr_sync_interpolator ("vocoder_codec2_decode_ps", - gr_make_io_signature (1, 1, CODEC2_BITS_PER_FRAME * sizeof (char)), - gr_make_io_signature (1, 1, sizeof (short)), - CODEC2_SAMPLES_PER_FRAME) -{ - if ((d_codec2 = codec2_create ()) == 0) - throw std::runtime_error ("vocoder_codec2_decode_ps: codec2_create failed"); -} - -vocoder_codec2_decode_ps::~vocoder_codec2_decode_ps () -{ - codec2_destroy(d_codec2); -} - -int -vocoder_codec2_decode_ps::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - short *out = (short *) output_items[0]; - - assert ((noutput_items % CODEC2_SAMPLES_PER_FRAME) == 0); - - for (int i = 0; i < noutput_items; i += CODEC2_SAMPLES_PER_FRAME){ - codec2_decode (d_codec2, out, const_cast<unsigned char*>(in)); - in += CODEC2_BITS_PER_FRAME * sizeof (char); - out += CODEC2_SAMPLES_PER_FRAME; - } - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_codec2_encode_sp.cc b/gr-vocoder/lib/vocoder_codec2_encode_sp.cc deleted file mode 100644 index da1c59c43..000000000 --- a/gr-vocoder/lib/vocoder_codec2_encode_sp.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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 "vocoder_codec2_encode_sp.h" - -extern "C" { -#include "codec2/codec2.h" -} - -#include <gr_io_signature.h> -#include <stdexcept> - -vocoder_codec2_encode_sp_sptr -vocoder_make_codec2_encode_sp () -{ - return gnuradio::get_initial_sptr(new vocoder_codec2_encode_sp ()); -} - -vocoder_codec2_encode_sp::vocoder_codec2_encode_sp () - : gr_sync_decimator ("vocoder_codec2_encode_sp", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, CODEC2_BITS_PER_FRAME * sizeof (char)), - CODEC2_SAMPLES_PER_FRAME) -{ - if ((d_codec2 = codec2_create ()) == 0) - throw std::runtime_error ("vocoder_codec2_encode_sp: codec2_create failed"); -} - -vocoder_codec2_encode_sp::~vocoder_codec2_encode_sp () -{ - codec2_destroy(d_codec2); -} - -int -vocoder_codec2_encode_sp::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - codec2_encode (d_codec2, out, const_cast<short*>(in)); - in += CODEC2_SAMPLES_PER_FRAME; - out += CODEC2_BITS_PER_FRAME * sizeof (char); - } - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc b/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc deleted file mode 100644 index 8202ec36c..000000000 --- a/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc +++ /dev/null @@ -1,193 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010,2011 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. - */ - -/* - * config.h is generated by configure. It contains the results - * of probing for features, options etc. It should be the first - * file included in your .cc file. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_cvsd_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -/* - * Create a new instance of vocoder_cvsd_decode_bs and return - * a boost shared_ptr. This is effectively the public constructor. - */ -vocoder_cvsd_decode_bs_sptr -vocoder_make_cvsd_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) -{ - return gnuradio::get_initial_sptr(new vocoder_cvsd_decode_bs (min_step, max_step, - step_decay, accum_decay, K, J, - pos_accum_max, neg_accum_max)); -} - -vocoder_cvsd_decode_bs::vocoder_cvsd_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) - : gr_sync_interpolator ("vocoder_cvsd_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short)), - 8), - d_min_step (min_step), d_max_step(max_step), d_step_decay(step_decay), - d_accum_decay(accum_decay), d_K(K), d_J(J), - d_pos_accum_max(pos_accum_max), d_neg_accum_max(neg_accum_max), - d_accum(0), - d_loop_counter(1), - d_runner(0), - d_runner_mask(0), - d_stepsize(min_step) - -{ - assert(d_K <= 32); - assert(d_J <= d_K); -} - - -vocoder_cvsd_decode_bs::~vocoder_cvsd_decode_bs () -{ - // nothing else required in this example -} - -unsigned char vocoder_cvsd_decode_bs::cvsd_bitwise_sum (unsigned int input) -{ - unsigned int temp=input; - unsigned char bits=0; - - while(temp) { - temp=temp&(temp-1); - bits++; - } - return bits; -} - -int vocoder_cvsd_decode_bs::cvsd_round (double input) -{ - double temp; - temp=input+0.5; - temp=floor(temp); - - return (int)temp; -} - -unsigned int vocoder_cvsd_decode_bs::cvsd_pow (short radix, short power) -{ - double d_radix = (double) radix; - int i_power = (int) power; - double output; - - output=pow(d_radix,i_power); - return ( (unsigned int) cvsd_round(output)); -} - - -int -vocoder_cvsd_decode_bs::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - - - const unsigned char *in = (const unsigned char *) input_items[0]; - short *out = (short *) output_items[0]; - - int i=0; - short output_short=0; // 2 bytes 0 .. 65,535 - unsigned char bit_count=0; // 1 byte, 0 .. 255 - unsigned int mask=0; // 4 bytes, 0 .. 4,294,967,295 - unsigned char input_byte=0; // 1 bytes - unsigned char input_bit=0; // 1 byte, 0 .. 255 - - // Loop through each input data point - for(i = 0; i < noutput_items/8.0; i++) { - - input_byte = in[i]; - // Initiliaze bit counter - bit_count=0; - - while(bit_count<8) { - // Compute the Appropriate Mask - mask=cvsd_pow(2,7-bit_count); - - // Pull off the corresponding bit - input_bit = input_byte & mask; - - // Update the bit counter - bit_count++; - - // Update runner with the next input bit - // Runner is a shift-register; shift left, add on newest output bit - d_runner = (d_runner<<1) | ((unsigned int) input_bit); - - // Run this only if you have >= J bits in your shift register - if (d_loop_counter>=d_J) { - // Update Step Size - d_runner_mask=(cvsd_pow(2,d_J)-1); - if ((cvsd_bitwise_sum(d_runner & d_runner_mask)>=d_J)||(cvsd_bitwise_sum((~d_runner) & d_runner_mask)>=d_J)) { - // Runs of 1s and 0s - d_stepsize = std::min( (short) (d_stepsize + d_min_step), d_max_step); - } - else { - // No runs of 1s and 0s - d_stepsize = std::max( (short) cvsd_round(d_stepsize*d_step_decay), d_min_step); - } - } - - // Update Accum (i.e. the reference value) - if (input_bit) { - d_accum=d_accum+d_stepsize; - } - else { - d_accum=d_accum-d_stepsize; - } - - // Multiply by Accum_Decay - d_accum=(cvsd_round(d_accum*d_accum_decay)); - - // Check for overflow - if (d_accum >=((int) d_pos_accum_max)) { - d_accum=(int)d_pos_accum_max; - } - else if (d_accum <=((int) d_neg_accum_max)) { - d_accum=(int)d_neg_accum_max; - } - - // Find the output short to write to the file - output_short=((short) d_accum); - - if (d_loop_counter <= d_K) { - d_loop_counter++; - } - - *(out++) = output_short; - } // while () - - } // for() - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc b/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc deleted file mode 100644 index e15882c22..000000000 --- a/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc +++ /dev/null @@ -1,189 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010,2011 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. - */ - -/* - * config.h is generated by configure. It contains the results - * of probing for features, options etc. It should be the first - * file included in your .cc file. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vocoder_cvsd_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -/* - * Create a new instance of vocoder_cvsd_encode_sb and return - * a boost shared_ptr. This is effectively the public constructor. - */ -vocoder_cvsd_encode_sb_sptr -vocoder_make_cvsd_encode_sb (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) -{ - return gnuradio::get_initial_sptr(new vocoder_cvsd_encode_sb (min_step, max_step, - step_decay, accum_decay, K, J, - pos_accum_max, neg_accum_max)); -} - -vocoder_cvsd_encode_sb::vocoder_cvsd_encode_sb (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) - : gr_sync_decimator ("vocoder_cvsd_encode_sb", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (unsigned char)), - 8), - d_min_step (min_step), d_max_step(max_step), d_step_decay(step_decay), - d_accum_decay(accum_decay), d_K(K), d_J(J), - d_pos_accum_max(pos_accum_max), d_neg_accum_max(neg_accum_max), - d_accum(0), - d_loop_counter(1), - d_runner(0), - d_stepsize(min_step) - -{ - assert(d_K <= 32); - assert(d_J <= d_K); -} - - -vocoder_cvsd_encode_sb::~vocoder_cvsd_encode_sb () -{ - // nothing else required in this example -} - -unsigned char vocoder_cvsd_encode_sb::cvsd_bitwise_sum (unsigned int input) -{ - unsigned int temp=input; - unsigned char bits=0; - - while(temp) { - temp=temp&(temp-1); - bits++; - } - return bits; -} - -int vocoder_cvsd_encode_sb::cvsd_round (double input) -{ - double temp; - temp=input+0.5; - temp=floor(temp); - - return (int)temp; -} - -unsigned int vocoder_cvsd_encode_sb::cvsd_pow (short radix, short power) -{ - double d_radix = (double) radix; - int i_power = (int) power; - double output; - - output=pow(d_radix,i_power); - return ( (unsigned int) cvsd_round(output)); -} - -int -vocoder_cvsd_encode_sb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - unsigned short i=0; // 2 bytes, 0 .. 65,535 - unsigned char output_bit=0; // 1 byte, 0 .. 255 - unsigned char output_byte=0; // 1 bytes 0.255 - unsigned char bit_count=0; // 1 byte, 0 .. 255 - unsigned int mask=0; // 4 bytes, 0 .. 4,294,967,295 - - // Loop through each input data point - for(i = 0; i < noutput_items*8; i++) { - if((int)in[i] >= d_accum) { // Note: sign((data(n)-accum)) - output_bit=1; - } - else { - output_bit=0; - } - - // Update Accum (i.e. the reference value) - if (output_bit) { - d_accum=d_accum+d_stepsize; - //printf("Addding %d to the accum; the result is: %d.\n", d_stepsize, d_accum); - } - else { - d_accum=d_accum-d_stepsize; - //printf("Subtracting %d to the accum; the result is: %d.\n", d_stepsize, d_accum); - } - - // Multiply by Accum_Decay - d_accum=(cvsd_round(d_accum*d_accum_decay)); - - // Check for overflow - if (d_accum >= ((int)d_pos_accum_max)) { - d_accum = (int)d_pos_accum_max; - } - else if(d_accum <= ((int) d_neg_accum_max)) { - d_accum = (int) d_neg_accum_max; - } - - // Update runner with the last output bit - // Update Step Size - if (d_loop_counter >= d_J) { // Run this only if you have >= J bits in your shift register - mask=(cvsd_pow(2, d_J) - 1); - if ((cvsd_bitwise_sum(d_runner & mask) >= d_J) || (cvsd_bitwise_sum((~d_runner) & mask) >= d_J)) { - // Runs of 1s and 0s - d_stepsize = std::min( (short)(d_stepsize + d_min_step), d_max_step); - } - else { - // No runs of 1s and 0s - d_stepsize = std::max( (short)cvsd_round(d_stepsize*d_step_decay), d_min_step); - } - } - - // Runner is a shift-register; shift left, add on newest output bit - d_runner = (d_runner<<1) | ((unsigned int) output_bit); - - // Update the ouput type; shift left, add on newest output bit - // If you have put in 8 bits, output it as a byte - output_byte = (output_byte<<1) | output_bit; - bit_count++; - - if (d_loop_counter <= d_K) { - d_loop_counter++; - } - - // If you have put 8 bits, output and clear. - if (bit_count==8) { - // Read in short from the file - *(out++) = output_byte; - - // Reset the bit_count - bit_count=0; - output_byte=0; - } - } // While - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g721_decode_bs.cc b/gr-vocoder/lib/vocoder_g721_decode_bs.cc deleted file mode 100644 index d5b737d1c..000000000 --- a/gr-vocoder/lib/vocoder_g721_decode_bs.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <vocoder_g721_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g721_decode_bs_impl : public vocoder_g721_decode_bs -{ -public: - - vocoder_g721_decode_bs_impl(); - ~vocoder_g721_decode_bs_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g721_decode_bs_sptr vocoder_make_g721_decode_bs() -{ - return gnuradio::get_initial_sptr(new vocoder_g721_decode_bs_impl()); -} - -vocoder_g721_decode_bs_impl::vocoder_g721_decode_bs_impl() - : gr_sync_block("vocoder_g721_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short))) -{ - g72x_init_state(&d_state); -} - -vocoder_g721_decode_bs_impl::~vocoder_g721_decode_bs_impl() -{ -} - -int -vocoder_g721_decode_bs_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - short *out = (short *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g721_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g721_encode_sb.cc b/gr-vocoder/lib/vocoder_g721_encode_sb.cc deleted file mode 100644 index 1e33613a5..000000000 --- a/gr-vocoder/lib/vocoder_g721_encode_sb.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <vocoder_g721_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g721_encode_sb_impl : public vocoder_g721_encode_sb -{ -public: - - vocoder_g721_encode_sb_impl(); - ~vocoder_g721_encode_sb_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g721_encode_sb_sptr vocoder_make_g721_encode_sb() -{ - return gnuradio::get_initial_sptr(new vocoder_g721_encode_sb_impl()); -} - -vocoder_g721_encode_sb_impl::vocoder_g721_encode_sb_impl() - : gr_sync_block("vocoder_g721_encode_sb", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ - g72x_init_state(&d_state); -} - -vocoder_g721_encode_sb_impl::~vocoder_g721_encode_sb_impl() -{ -} - -int -vocoder_g721_encode_sb_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g721_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc b/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc deleted file mode 100644 index 0bedfe4ca..000000000 --- a/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <vocoder_g723_24_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g723_24_decode_bs_impl : public vocoder_g723_24_decode_bs -{ -public: - - vocoder_g723_24_decode_bs_impl(); - ~vocoder_g723_24_decode_bs_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g723_24_decode_bs_sptr vocoder_make_g723_24_decode_bs() -{ - return gnuradio::get_initial_sptr(new vocoder_g723_24_decode_bs_impl()); -} - -vocoder_g723_24_decode_bs_impl::vocoder_g723_24_decode_bs_impl() - : gr_sync_block("vocoder_g723_24_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short))) -{ - g72x_init_state(&d_state); -} - -vocoder_g723_24_decode_bs_impl::~vocoder_g723_24_decode_bs_impl() -{ -} - -int -vocoder_g723_24_decode_bs_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - short *out = (short *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g723_24_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc b/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc deleted file mode 100644 index 1b61de79f..000000000 --- a/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <vocoder_g723_24_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g723_24_encode_sb_impl : public vocoder_g723_24_encode_sb -{ -public: - - vocoder_g723_24_encode_sb_impl(); - ~vocoder_g723_24_encode_sb_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g723_24_encode_sb_sptr vocoder_make_g723_24_encode_sb() -{ - return gnuradio::get_initial_sptr(new vocoder_g723_24_encode_sb_impl()); -} - -vocoder_g723_24_encode_sb_impl::vocoder_g723_24_encode_sb_impl() - : gr_sync_block("vocoder_g723_24_encode_sb", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ - g72x_init_state(&d_state); -} - -vocoder_g723_24_encode_sb_impl::~vocoder_g723_24_encode_sb_impl() -{ -} - -int -vocoder_g723_24_encode_sb_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g723_24_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc b/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc deleted file mode 100644 index cdc152896..000000000 --- a/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <vocoder_g723_40_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g723_40_decode_bs_impl : public vocoder_g723_40_decode_bs -{ -public: - - vocoder_g723_40_decode_bs_impl(); - ~vocoder_g723_40_decode_bs_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g723_40_decode_bs_sptr vocoder_make_g723_40_decode_bs() -{ - return gnuradio::get_initial_sptr(new vocoder_g723_40_decode_bs_impl()); -} - -vocoder_g723_40_decode_bs_impl::vocoder_g723_40_decode_bs_impl() - : gr_sync_block("vocoder_g723_40_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short))) -{ - g72x_init_state(&d_state); -} - -vocoder_g723_40_decode_bs_impl::~vocoder_g723_40_decode_bs_impl() -{ -} - -int -vocoder_g723_40_decode_bs_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - short *out = (short *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g723_40_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc b/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc deleted file mode 100644 index 083aaf97a..000000000 --- a/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <vocoder_g723_40_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -class vocoder_g723_40_encode_sb_impl : public vocoder_g723_40_encode_sb -{ -public: - - vocoder_g723_40_encode_sb_impl(); - ~vocoder_g723_40_encode_sb_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -private: - - g72x_state d_state; - -}; - -vocoder_g723_40_encode_sb_sptr vocoder_make_g723_40_encode_sb() -{ - return gnuradio::get_initial_sptr(new vocoder_g723_40_encode_sb_impl()); -} - -vocoder_g723_40_encode_sb_impl::vocoder_g723_40_encode_sb_impl() - : gr_sync_block("vocoder_g723_40_encode_sb", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ - g72x_init_state(&d_state); -} - -vocoder_g723_40_encode_sb_impl::~vocoder_g723_40_encode_sb_impl() -{ -} - -int -vocoder_g723_40_encode_sb_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = g723_40_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc b/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc deleted file mode 100644 index 146ddf63c..000000000 --- a/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 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 "vocoder_gsm_fr_decode_ps.h" -extern "C"{ -#include "gsm/gsm.h" -} -#include <gr_io_signature.h> -#include <stdexcept> -#include <assert.h> - -vocoder_gsm_fr_decode_ps_sptr -vocoder_make_gsm_fr_decode_ps () -{ - return gnuradio::get_initial_sptr(new vocoder_gsm_fr_decode_ps ()); -} - -vocoder_gsm_fr_decode_ps::vocoder_gsm_fr_decode_ps () - : gr_sync_interpolator ("vocoder_gsm_fr_decode_ps", - gr_make_io_signature (1, 1, sizeof (gsm_frame)), - gr_make_io_signature (1, 1, sizeof (short)), - GSM_SAMPLES_PER_FRAME) -{ - if ((d_gsm = gsm_create ()) == 0) - throw std::runtime_error ("vocoder_gsm_fr_decode_ps: gsm_create failed"); -} - -vocoder_gsm_fr_decode_ps::~vocoder_gsm_fr_decode_ps () -{ - gsm_destroy (d_gsm); -} - -int -vocoder_gsm_fr_decode_ps::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - short *out = (short *) output_items[0]; - - assert ((noutput_items % GSM_SAMPLES_PER_FRAME) == 0); - - for (int i = 0; i < noutput_items; i += GSM_SAMPLES_PER_FRAME){ - gsm_decode (d_gsm, const_cast<unsigned char*>(in), out); - in += sizeof (gsm_frame); - out += GSM_SAMPLES_PER_FRAME; - } - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc b/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc deleted file mode 100644 index 5abb3a457..000000000 --- a/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 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 "vocoder_gsm_fr_encode_sp.h" -extern "C"{ -#include "gsm/gsm.h" -} -#include <gr_io_signature.h> -#include <stdexcept> - -vocoder_gsm_fr_encode_sp_sptr -vocoder_make_gsm_fr_encode_sp () -{ - return gnuradio::get_initial_sptr(new vocoder_gsm_fr_encode_sp ()); -} - -vocoder_gsm_fr_encode_sp::vocoder_gsm_fr_encode_sp () - : gr_sync_decimator ("vocoder_gsm_fr_encode_sp", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (gsm_frame)), - GSM_SAMPLES_PER_FRAME) -{ - if ((d_gsm = gsm_create ()) == 0) - throw std::runtime_error ("vocoder_gsm_fr_encode_sp: gsm_create failed"); -} - -vocoder_gsm_fr_encode_sp::~vocoder_gsm_fr_encode_sp () -{ - gsm_destroy (d_gsm); -} - -int -vocoder_gsm_fr_encode_sp::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - gsm_encode (d_gsm, const_cast<short*>(in), out); - in += GSM_SAMPLES_PER_FRAME; - out += sizeof (gsm_frame); - } - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc b/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc deleted file mode 100644 index 5abec77f8..000000000 --- a/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <vocoder_ulaw_decode_bs.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs() -{ - return gnuradio::get_initial_sptr(new vocoder_ulaw_decode_bs()); -} - -vocoder_ulaw_decode_bs::vocoder_ulaw_decode_bs() - : gr_sync_block("vocoder_ulaw_decode_bs", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (short))) -{ -} - -vocoder_ulaw_decode_bs::~vocoder_ulaw_decode_bs() -{ -} - - - -int -vocoder_ulaw_decode_bs::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - short *out = (short *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = ulaw2linear(in[i]); - - return noutput_items; -} diff --git a/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc b/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc deleted file mode 100644 index 3fabd7ad8..000000000 --- a/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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 <vocoder_ulaw_encode_sb.h> -#include <gr_io_signature.h> -#include <limits.h> - -extern "C" { -#include "g7xx/g72x.h" -} - -vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb() -{ - return gnuradio::get_initial_sptr(new vocoder_ulaw_encode_sb()); -} - -vocoder_ulaw_encode_sb::vocoder_ulaw_encode_sb() - : gr_sync_block("vocoder_ulaw_encode_sb", - gr_make_io_signature (1, 1, sizeof(short)), - gr_make_io_signature (1, 1, sizeof(unsigned char))) -{ -} - -vocoder_ulaw_encode_sb::~vocoder_ulaw_encode_sb() -{ -} - -int -vocoder_ulaw_encode_sb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const short *in = (const short *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) - out[i] = linear2ulaw(in[i]); - - return noutput_items; -} diff --git a/gr-vocoder/python/CMakeLists.txt b/gr-vocoder/python/CMakeLists.txt deleted file mode 100644 index 9152ee133..000000000 --- a/gr-vocoder/python/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup python install -######################################################################## -include(GrPython) - -GR_PYTHON_INSTALL( - FILES - __init__.py - cvsd.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/vocoder - COMPONENT "vocoder_python" -) - -######################################################################## -# Handle the unit tests -######################################################################## -if(ENABLE_TESTING) - -list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-vocoder/python - ${CMAKE_BINARY_DIR}/gr-vocoder/swig -) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-vocoder) - -include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) -endif(ENABLE_TESTING) diff --git a/gr-vocoder/python/__init__.py b/gr-vocoder/python/__init__.py deleted file mode 100644 index ba5862f8d..000000000 --- a/gr-vocoder/python/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2011 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 is the gr-vocoder package. This package includes the various -vocoder blocks in GNU Radio. -''' - -from vocoder_swig import * -from cvsd import * diff --git a/gr-vocoder/python/cvsd.py b/gr-vocoder/python/cvsd.py deleted file mode 100644 index e9b3ee305..000000000 --- a/gr-vocoder/python/cvsd.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2011 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. -# - -from gnuradio import gr -import vocoder_swig - -class cvsd_encode_fb(gr.hier_block2): - ''' - This is a wrapper for the CVSD encoder that performs interpolation and filtering - necessary to work with the vocoding. It converts an incoming float (+-1) to a short, scales - it (to 32000; slightly below the maximum value), interpolates it, and then vocodes it. - - The incoming sampling rate can be anything, though, of course, the higher the sampling rate and the - higher the interpolation rate are, the better the sound quality. - ''' - - def __init__(self, resample=8, bw=0.5): - ''' - When using the CVSD vocoder, appropriate sampling rates are from 8k to 64k with resampling rates - from 1 to 8. A rate of 8k with a resampling rate of 8 provides a good quality signal. - ''' - - gr.hier_block2.__init__(self, "cvsd_encode", - gr.io_signature(1, 1, gr.sizeof_float), # Input signature - gr.io_signature(1, 1, gr.sizeof_char)) # Output signature - - scale_factor = 32000.0 - self.interp = resample - - src_scale = gr.multiply_const_ff(scale_factor) - taps = gr.firdes.low_pass(self.interp, self.interp, bw, 2*bw) - interp = gr.interp_fir_filter_fff(self.interp, taps) - f2s = gr.float_to_short() - enc = vocoder_swig.cvsd_encode_sb() - - self.connect(self, src_scale, interp, f2s, enc, self) - - -class cvsd_decode_bf(gr.hier_block2): - ''' - This is a wrapper for the CVSD decoder that performs decimation and filtering - necessary to work with the vocoding. It converts an incoming CVSD-encoded short to a float, decodes it - to a float, decimates it, and scales it (by 32000; slightly below the maximum value to avoid clipping). - - The sampling rate can be anything, though, of course, the higher the sampling rate and the - higher the interpolation rate are, the better the sound quality. - ''' - - def __init__(self, resample=8, bw=0.5): - ''' - When using the CVSD vocoder, appropriate sampling rates are from 8k to 64k with resampling rates - from 1 to 8. A rate of 8k with a resampling rate of 8 provides a good quality signal. - ''' - gr.hier_block2.__init__(self, "cvsd_decode", - gr.io_signature(1, 1, gr.sizeof_char), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - scale_factor = 32000.0 - self.decim = resample - - dec = vocoder_swig.cvsd_decode_bs() - s2f = gr.short_to_float() - taps = gr.firdes.low_pass(1, 1, bw, 2*bw) - decim = gr.fir_filter_fff(self.decim, taps) - sink_scale = gr.multiply_const_ff(1.0/scale_factor) - - self.connect(self, dec, s2f, decim, sink_scale, self) diff --git a/gr-vocoder/python/qa_alaw_vocoder.py b/gr-vocoder/python/qa_alaw_vocoder.py deleted file mode 100755 index 07d0feb58..000000000 --- a/gr-vocoder/python/qa_alaw_vocoder.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -from vocoder_swig import * - -class test_alaw_vocoder (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test001_module_load (self): - enc = alaw_encode_sb(); - dec = alaw_decode_bs(); - -if __name__ == '__main__': - gr_unittest.run(test_alaw_vocoder, "test_alaw_vocoder.xml") diff --git a/gr-vocoder/python/qa_codec2_vocoder.py b/gr-vocoder/python/qa_codec2_vocoder.py deleted file mode 100755 index 2f707b311..000000000 --- a/gr-vocoder/python/qa_codec2_vocoder.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -from vocoder_swig import * - -class test_codec2_vocoder (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test001_module_load (self): - raw_enc = codec2_encode_sp(); - raw_dec = codec2_decode_ps(); - -if __name__ == '__main__': - gr_unittest.run(test_codec2_vocoder, "test_codec2_vocoder.xml") diff --git a/gr-vocoder/python/qa_cvsd_vocoder.py b/gr-vocoder/python/qa_cvsd_vocoder.py deleted file mode 100755 index 573e6a130..000000000 --- a/gr-vocoder/python/qa_cvsd_vocoder.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2010,2011 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. -# - -from gnuradio import gr, gr_unittest -from vocoder_swig import * -from cvsd import * - -class test_cvsd_vocoder (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test001_module_load (self): - raw_enc = cvsd_encode_sb(); - raw_dec = cvsd_decode_bs(); - hb_enc = cvsd_encode_fb(); - hb_dec = cvsd_decode_bf(); - - - """ Disable for now - def test01(self): - sample_rate = 8000 - scale_factor = 32000 - - expected_data = (6.9670547250243192e-21, -2.4088578356895596e-05, - -5.1261918997624889e-05, 7.2410854045301676e-05, - 8.444241393590346e-05, -1.2537107068055775e-05, - 0.00024186755763366818, -0.00060463894624263048, - 0.00064864184241741896, 0.010409165173768997, - 0.0087582804262638092, 0.017965050414204597, - 0.010722399689257145, 0.006602009292691946, - 0.02213001623749733, 0.0079685859382152557, - 0.033707316964864731, 0.027021972462534904, - 0.0086071854457259178, 0.0081678871065378189, - 0.039343506097793579, 0.030671956017613411, - 0.029626710340380669, 0.020126519724726677, - 0.023636780679225922, 0.0064640454947948456, - -0.0038861562497913837, 0.0021134600974619389, - -0.0088051930069923401, -0.00023228264763019979, - -0.033737499266862869, -0.033141419291496277, - -0.037145044654607773, -0.0080892946571111679, - -0.077117636799812317, -0.078382067382335663, - -0.055503919720649719, -0.019355267286300659, - -0.022441385313868523, -0.073706060647964478, - -0.054677654057741165, -0.047119375318288803, - -0.044418536126613617, -0.036084383726119995, - -0.0206278245896101, -0.031200021505355835, - -0.0004070434661116451, 0.0006594572332687676, - -0.016584658995270729, 0.07387717068195343, - -0.0063191778026521206, 0.051200628280639648, - -0.029480356723070145, 0.05176771804690361, - 0.038578659296035767, 0.026550088077783585, - 0.067103870213031769, 0.001888439292088151, - 0.28141644597053528, 0.49543789029121399, - 0.6626054048538208, 0.79180729389190674, - 0.89210402965545654, 0.96999943256378174, - 1.0261462926864624, 1.0267977714538574, - 1.0251555442810059, 1.0265737771987915, - 1.0278496742248535, 1.0208886861801147, - 1.0325057506561279, 0.91415292024612427, - 0.83941859006881714, 0.67373806238174438, - 0.51683622598648071, 0.38949671387672424, - 0.16016888618469238, 0.049505095928907394, - -0.16699212789535522, -0.26886492967605591, - -0.49256673455238342, -0.59178370237350464, - -0.73317724466323853, -0.78922677040100098, - -0.88782668113708496, -0.96708977222442627, - -0.96490746736526489, -0.94962418079376221, - -0.94716215133666992, -0.93755108118057251, - -0.84852480888366699, -0.80485564470291138, - -0.69762390851974487, -0.58398681879043579, - -0.45891636610031128, -0.29681697487831116, - -0.16035343706607819, 0.014823081903159618, - 0.16282452642917633, 0.33802291750907898) - - src = gr.sig_source_f(sample_rate, gr.GR_SIN_WAVE, 200, 1, 0) - head = gr.head(gr.sizeof_float, 100) - src_scale = gr.multiply_const_ff(scale_factor) - - interp = blks2.rational_resampler_fff(8, 1) - f2s = gr.float_to_short () - - enc = cvsd_vocoder.encode_sb() - dec = cvsd_vocoder.decode_bs() - - s2f = gr.short_to_float () - decim = blks2.rational_resampler_fff(1, 8) - - sink_scale = gr.multiply_const_ff(1.0/scale_factor) - sink = gr.vector_sink_f() - - self.tb.connect(src, src_scale, interp, f2s, enc) - self.tb.connect(enc, dec, s2f, decim, sink_scale, head, sink) - self.tb.run() - print sink.data() - - self.assertFloatTuplesAlmostEqual (expected_data, sink.data(), 5) - """ - -if __name__ == '__main__': - gr_unittest.run(test_cvsd_vocoder, "test_cvsd_vocoder.xml") diff --git a/gr-vocoder/python/qa_g721_vocoder.py b/gr-vocoder/python/qa_g721_vocoder.py deleted file mode 100755 index 26fcea789..000000000 --- a/gr-vocoder/python/qa_g721_vocoder.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -from vocoder_swig import * - -class test_g721_vocoder (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test001_module_load (self): - enc = g721_encode_sb(); - dec = g721_decode_bs(); - -if __name__ == '__main__': - gr_unittest.run(test_g721_vocoder, "test_g721_vocoder.xml") diff --git a/gr-vocoder/python/qa_g723_24_vocoder.py b/gr-vocoder/python/qa_g723_24_vocoder.py deleted file mode 100755 index be95a8d94..000000000 --- a/gr-vocoder/python/qa_g723_24_vocoder.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -from vocoder_swig import * - -class test_g723_24_vocoder (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test001_module_load (self): - enc = g723_24_encode_sb(); - dec = g723_24_decode_bs(); - -if __name__ == '__main__': - gr_unittest.run(test_g723_24_vocoder, "test_g723_24_vocoder.xml") diff --git a/gr-vocoder/python/qa_g723_40_vocoder.py b/gr-vocoder/python/qa_g723_40_vocoder.py deleted file mode 100755 index abbb4079a..000000000 --- a/gr-vocoder/python/qa_g723_40_vocoder.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -from vocoder_swig import * - -class test_g723_40_vocoder (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test001_module_load (self): - enc = g723_40_encode_sb(); - dec = g723_40_decode_bs(); - -if __name__ == '__main__': - gr_unittest.run(test_g723_40_vocoder, "test_g723_40_vocoder.xml") diff --git a/gr-vocoder/python/qa_gsm_full_rate.py b/gr-vocoder/python/qa_gsm_full_rate.py deleted file mode 100755 index 2e551e193..000000000 --- a/gr-vocoder/python/qa_gsm_full_rate.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010 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. -# - -from gnuradio import gr, gr_unittest -import vocoder_swig - -class test_gsm_vocoder (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test001_module_load (self): - enc = vocoder_swig.gsm_fr_encode_sp(); - dec = vocoder_swig.gsm_fr_decode_ps(); - -if __name__ == '__main__': - gr_unittest.run(test_gsm_vocoder, "test_gsm_vocoder.xml") diff --git a/gr-vocoder/python/qa_ulaw_vocoder.py b/gr-vocoder/python/qa_ulaw_vocoder.py deleted file mode 100755 index 2bc638567..000000000 --- a/gr-vocoder/python/qa_ulaw_vocoder.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 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. -# - -from gnuradio import gr, gr_unittest -from vocoder_swig import * - -class test_ulaw_vocoder (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test001_module_load (self): - enc = ulaw_encode_sb(); - dec = ulaw_decode_bs(); - -if __name__ == '__main__': - gr_unittest.run(test_ulaw_vocoder, "test_ulaw_vocoder.xml") diff --git a/gr-vocoder/swig/CMakeLists.txt b/gr-vocoder/swig/CMakeLists.txt deleted file mode 100644 index 8417823c4..000000000 --- a/gr-vocoder/swig/CMakeLists.txt +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_INCLUDE_DIRS - ${GR_VOCODER_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/vocoder_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include) - -set(GR_SWIG_LIBRARIES gnuradio-vocoder) - -GR_SWIG_MAKE(vocoder_swig vocoder_swig.i) - -GR_SWIG_INSTALL( - TARGETS vocoder_swig - DESTINATION ${GR_PYTHON_DIR}/gnuradio/vocoder - COMPONENT "vocoder_python" -) - -install( - FILES - vocoder_swig.i - vocoder_alaw_decode_bs.i - vocoder_alaw_encode_sb.i - vocoder_codec2_decode_ps.i - vocoder_codec2_encode_sp.i - vocoder_cvsd_decode_bs.i - vocoder_cvsd_encode_sb.i - vocoder_g721_decode_bs.i - vocoder_g721_encode_sb.i - vocoder_g723_24_decode_bs.i - vocoder_g723_24_encode_sb.i - vocoder_g723_40_decode_bs.i - vocoder_g723_40_encode_sb.i - vocoder_gsm_fr_encode_sp.i - vocoder_gsm_fr_decode_ps.i - vocoder_ulaw_decode_bs.i - vocoder_ulaw_encode_sb.i - ${CMAKE_CURRENT_BINARY_DIR}/vocoder_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "vocoder_swig" -) diff --git a/gr-vocoder/swig/vocoder_alaw_decode_bs.i b/gr-vocoder/swig/vocoder_alaw_decode_bs.i deleted file mode 100644 index 6c51f5edd..000000000 --- a/gr-vocoder/swig/vocoder_alaw_decode_bs.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_alaw_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,alaw_decode_bs); - -vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); - -class vocoder_alaw_decode_bs : public gr_sync_block -{ -private: - vocoder_alaw_decode_bs(); -}; diff --git a/gr-vocoder/swig/vocoder_alaw_encode_sb.i b/gr-vocoder/swig/vocoder_alaw_encode_sb.i deleted file mode 100644 index 0769829a0..000000000 --- a/gr-vocoder/swig/vocoder_alaw_encode_sb.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_alaw_encode_sb.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,alaw_encode_sb); - -vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); - -class vocoder_alaw_encode_sb : public gr_sync_block -{ -private: - vocoder_alaw_encode_sb(); -}; diff --git a/gr-vocoder/swig/vocoder_codec2_decode_ps.i b/gr-vocoder/swig/vocoder_codec2_decode_ps.i deleted file mode 100644 index a2035febe..000000000 --- a/gr-vocoder/swig/vocoder_codec2_decode_ps.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_codec2_decode_ps.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,codec2_decode_ps); - -vocoder_codec2_decode_ps_sptr vocoder_make_codec2_decode_ps (); - -class vocoder_codec2_decode_ps : public gr_sync_interpolator { -public: - ~vocoder_codec2_decode_ps (); -}; diff --git a/gr-vocoder/swig/vocoder_codec2_encode_sp.i b/gr-vocoder/swig/vocoder_codec2_encode_sp.i deleted file mode 100644 index 07acfdfa4..000000000 --- a/gr-vocoder/swig/vocoder_codec2_encode_sp.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_codec2_encode_sp.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,codec2_encode_sp); - -vocoder_codec2_encode_sp_sptr vocoder_make_codec2_encode_sp (); - -class vocoder_codec2_encode_sp : public gr_sync_decimator { -public: - ~vocoder_codec2_encode_sp (); -}; diff --git a/gr-vocoder/swig/vocoder_cvsd_decode_bs.i b/gr-vocoder/swig/vocoder_cvsd_decode_bs.i deleted file mode 100644 index ff2c89e5d..000000000 --- a/gr-vocoder/swig/vocoder_cvsd_decode_bs.i +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2009,2011 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. - */ - -%{ -#include "vocoder_cvsd_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,cvsd_decode_bs); - -vocoder_cvsd_decode_bs_sptr vocoder_make_cvsd_decode_bs (short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); - -class vocoder_cvsd_decode_bs : public gr_sync_interpolator -{ -private: - vocoder_cvsd_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); -}; diff --git a/gr-vocoder/swig/vocoder_cvsd_encode_sb.i b/gr-vocoder/swig/vocoder_cvsd_encode_sb.i deleted file mode 100644 index e0a7db5df..000000000 --- a/gr-vocoder/swig/vocoder_cvsd_encode_sb.i +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2009,2011 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. - */ - -%{ -#include "vocoder_cvsd_encode_sb.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,cvsd_encode_sb); - -vocoder_cvsd_encode_sb_sptr vocoder_make_cvsd_encode_sb (short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); - -class vocoder_cvsd_encode_sb : public gr_sync_decimator -{ -private: - vocoder_cvsd_encode_sb (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); -}; diff --git a/gr-vocoder/swig/vocoder_g721_decode_bs.i b/gr-vocoder/swig/vocoder_g721_decode_bs.i deleted file mode 100644 index beefd375e..000000000 --- a/gr-vocoder/swig/vocoder_g721_decode_bs.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_g721_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,g721_decode_bs); - -vocoder_g721_decode_bs_sptr vocoder_make_g721_decode_bs(); - -class vocoder_g721_decode_bs : public gr_sync_block -{ -}; diff --git a/gr-vocoder/swig/vocoder_g721_encode_sb.i b/gr-vocoder/swig/vocoder_g721_encode_sb.i deleted file mode 100644 index 38c231e8d..000000000 --- a/gr-vocoder/swig/vocoder_g721_encode_sb.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_g721_encode_sb.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,g721_encode_sb); - -vocoder_g721_encode_sb_sptr vocoder_make_g721_encode_sb(); - -class vocoder_g721_encode_sb : public gr_sync_block -{ -}; diff --git a/gr-vocoder/swig/vocoder_g723_24_decode_bs.i b/gr-vocoder/swig/vocoder_g723_24_decode_bs.i deleted file mode 100644 index 33f6e88b9..000000000 --- a/gr-vocoder/swig/vocoder_g723_24_decode_bs.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_g723_24_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,g723_24_decode_bs); - -vocoder_g723_24_decode_bs_sptr vocoder_make_g723_24_decode_bs(); - -class vocoder_g723_24_decode_bs : public gr_sync_block -{ -}; diff --git a/gr-vocoder/swig/vocoder_g723_24_encode_sb.i b/gr-vocoder/swig/vocoder_g723_24_encode_sb.i deleted file mode 100644 index a362554ab..000000000 --- a/gr-vocoder/swig/vocoder_g723_24_encode_sb.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_g723_24_encode_sb.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,g723_24_encode_sb); - -vocoder_g723_24_encode_sb_sptr vocoder_make_g723_24_encode_sb(); - -class vocoder_g723_24_encode_sb : public gr_sync_block -{ -}; diff --git a/gr-vocoder/swig/vocoder_g723_40_decode_bs.i b/gr-vocoder/swig/vocoder_g723_40_decode_bs.i deleted file mode 100644 index a23b1c0e4..000000000 --- a/gr-vocoder/swig/vocoder_g723_40_decode_bs.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_g723_40_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,g723_40_decode_bs); - -vocoder_g723_40_decode_bs_sptr vocoder_make_g723_40_decode_bs(); - -class vocoder_g723_40_decode_bs : public gr_sync_block -{ -}; diff --git a/gr-vocoder/swig/vocoder_g723_40_encode_sb.i b/gr-vocoder/swig/vocoder_g723_40_encode_sb.i deleted file mode 100644 index 8fd438c66..000000000 --- a/gr-vocoder/swig/vocoder_g723_40_encode_sb.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_g723_40_encode_sb.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,g723_40_encode_sb); - -vocoder_g723_40_encode_sb_sptr vocoder_make_g723_40_encode_sb(); - -class vocoder_g723_40_encode_sb : public gr_sync_block -{ -}; diff --git a/gr-vocoder/swig/vocoder_gsm_fr_decode_ps.i b/gr-vocoder/swig/vocoder_gsm_fr_decode_ps.i deleted file mode 100644 index 3ad4e45fa..000000000 --- a/gr-vocoder/swig/vocoder_gsm_fr_decode_ps.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_gsm_fr_decode_ps.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,gsm_fr_decode_ps); - -vocoder_gsm_fr_decode_ps_sptr vocoder_make_gsm_fr_decode_ps(); - -class vocoder_gsm_fr_decode_ps : public gr_sync_interpolator -{ -public: - ~vocoder_gsm_fr_decode_ps(); -}; diff --git a/gr-vocoder/swig/vocoder_gsm_fr_encode_sp.i b/gr-vocoder/swig/vocoder_gsm_fr_encode_sp.i deleted file mode 100644 index 348f8d15d..000000000 --- a/gr-vocoder/swig/vocoder_gsm_fr_encode_sp.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_gsm_fr_encode_sp.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,gsm_fr_encode_sp); - -vocoder_gsm_fr_encode_sp_sptr vocoder_make_gsm_fr_encode_sp(); - -class vocoder_gsm_fr_encode_sp : public gr_sync_decimator -{ -public: - ~vocoder_gsm_fr_encode_sp(); -}; diff --git a/gr-vocoder/swig/vocoder_swig.i b/gr-vocoder/swig/vocoder_swig.i deleted file mode 100644 index 524e035ce..000000000 --- a/gr-vocoder/swig/vocoder_swig.i +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%include "gnuradio.i" - -//load generated python docstrings -%include "vocoder_swig_doc.i" - -%include "vocoder_alaw_decode_bs.i" -%include "vocoder_alaw_encode_sb.i" -%include "vocoder_codec2_decode_ps.i" -%include "vocoder_codec2_encode_sp.i" -%include "vocoder_cvsd_decode_bs.i" -%include "vocoder_cvsd_encode_sb.i" -%include "vocoder_g721_decode_bs.i" -%include "vocoder_g721_encode_sb.i" -%include "vocoder_g723_24_decode_bs.i" -%include "vocoder_g723_24_encode_sb.i" -%include "vocoder_g723_40_decode_bs.i" -%include "vocoder_g723_40_encode_sb.i" -%include "vocoder_gsm_fr_decode_ps.i" -%include "vocoder_gsm_fr_encode_sp.i" -%include "vocoder_ulaw_decode_bs.i" -%include "vocoder_ulaw_encode_sb.i" diff --git a/gr-vocoder/swig/vocoder_ulaw_decode_bs.i b/gr-vocoder/swig/vocoder_ulaw_decode_bs.i deleted file mode 100644 index 23363ca5c..000000000 --- a/gr-vocoder/swig/vocoder_ulaw_decode_bs.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_ulaw_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,ulaw_decode_bs); - -vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); - -class vocoder_ulaw_decode_bs : public gr_sync_block -{ -private: - vocoder_ulaw_decode_bs(); -}; diff --git a/gr-vocoder/swig/vocoder_ulaw_encode_sb.i b/gr-vocoder/swig/vocoder_ulaw_encode_sb.i deleted file mode 100644 index 393b8ff3f..000000000 --- a/gr-vocoder/swig/vocoder_ulaw_encode_sb.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 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. - */ - -%{ -#include "vocoder_ulaw_encode_sb.h" -%} - -GR_SWIG_BLOCK_MAGIC(vocoder,ulaw_encode_sb); - -vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); - -class vocoder_ulaw_encode_sb : public gr_sync_block -{ -private: - vocoder_ulaw_encode_sb(); -}; diff --git a/gr-wavelet/CMakeLists.txt b/gr-wavelet/CMakeLists.txt deleted file mode 100644 index 555c326d1..000000000 --- a/gr-wavelet/CMakeLists.txt +++ /dev/null @@ -1,109 +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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -find_package(GSL) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) - -GR_REGISTER_COMPONENT("gr-wavelet" ENABLE_GR_WAVELET - Boost_FOUND - ENABLE_GR_CORE - GSL_FOUND -) - -GR_SET_GLOBAL(GR_WAVELET_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/lib - ${CMAKE_CURRENT_SOURCE_DIR}/include/wavelet -) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_WAVELET) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_WAVELET_DESCRIPTION "GNU Radio Wavelet Blocks") - -CPACK_COMPONENT("wavelet_runtime" - GROUP "WAVELET" - DISPLAY_NAME "Runtime" - DESCRIPTION "Runtime" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("wavelet_devel" - GROUP "WAVELET" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("wavelet_python" - GROUP "WAVELET" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime; GRC xml files" - DEPENDS "core_python;wavelet_runtime" -) - -CPACK_COMPONENT("wavelet_swig" - GROUP "WAVELET" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;wavelet_python;wavelet_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(include/wavelet) -add_subdirectory(lib) -if(ENABLE_PYTHON) - add_subdirectory(swig) - add_subdirectory(python) -# add_subdirectory(grc) -endif(ENABLE_PYTHON) -#add_subdirectory(examples) -#add_subdirectory(doc) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-wavelet.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-wavelet.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-wavelet.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "wavelet_devel" -) - -endif(ENABLE_GR_WAVELET) diff --git a/gr-wavelet/gnuradio-wavelet.pc.in b/gr-wavelet/gnuradio-wavelet.pc.in deleted file mode 100644 index 998ae9056..000000000 --- a/gr-wavelet/gnuradio-wavelet.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-wavelet -Description: Wavelet signal processing blocks for GNU Radio -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-wavelet -Cflags: -I${includedir} diff --git a/gr-wavelet/include/wavelet/CMakeLists.txt b/gr-wavelet/include/wavelet/CMakeLists.txt deleted file mode 100644 index a37a3b0cd..000000000 --- a/gr-wavelet/include/wavelet/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Install header files -######################################################################## -install(FILES - wavelet_api.h - wavelet_squash_ff.h - wavelet_wavelet_ff.h - wavelet_wvps_ff.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "wavelet_devel" -) - diff --git a/gr-wavelet/include/wavelet/wavelet_api.h b/gr-wavelet/include/wavelet/wavelet_api.h deleted file mode 100644 index 68b2c04d7..000000000 --- a/gr-wavelet/include/wavelet/wavelet_api.h +++ /dev/null @@ -1,33 +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. - */ - -#ifndef INCLUDED_WAVELET_API_H -#define INCLUDED_WAVELET_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_wavelet_EXPORTS -# define WAVELET_API __GR_ATTR_EXPORT -#else -# define WAVELET_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_WAVELET_API_H */ diff --git a/gr-wavelet/include/wavelet/wavelet_squash_ff.h b/gr-wavelet/include/wavelet/wavelet_squash_ff.h deleted file mode 100644 index 582496916..000000000 --- a/gr-wavelet/include/wavelet/wavelet_squash_ff.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 INCLUDED_WAVELET_SQUASH_FF_H -#define INCLUDED_WAVELET_SQUASH_FF_H - -#include <wavelet_api.h> -#include <gr_sync_block.h> - -/*! - * \brief implements cheap resampling of spectrum directly from - * spectral points, using gsl interpolation - * \ingroup misc - */ -class wavelet_squash_ff; -typedef boost::shared_ptr<wavelet_squash_ff> wavelet_squash_ff_sptr; - -WAVELET_API wavelet_squash_ff_sptr wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - -class WAVELET_API wavelet_squash_ff : virtual public gr_sync_block -{ - // No public API methods visible -}; - -#endif diff --git a/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h b/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h deleted file mode 100644 index 7d60dbdad..000000000 --- a/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 INCLUDED_WAVELET_WAVELET_FF_H -#define INCLUDED_WAVELET_WAVELET_FF_H - -#include <wavelet_api.h> -#include <gr_sync_block.h> - -class wavelet_wavelet_ff; -typedef boost::shared_ptr<wavelet_wavelet_ff> wavelet_wavelet_ff_sptr; - -WAVELET_API wavelet_wavelet_ff_sptr -wavelet_make_wavelet_ff(int size = 1024, - int order = 20, - bool forward = true); - -/*! - * \brief compute wavelet transform using gsl routines - * \ingroup wavelet_blk - */ - -class WAVELET_API wavelet_wavelet_ff : virtual public gr_sync_block -{ - // No public API methods visible -}; - -#endif /* INCLUDED_WAVELET_WAVELET_FF_H */ diff --git a/gr-wavelet/include/wavelet/wavelet_wvps_ff.h b/gr-wavelet/include/wavelet/wavelet_wvps_ff.h deleted file mode 100644 index 4e2889b52..000000000 --- a/gr-wavelet/include/wavelet/wavelet_wvps_ff.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 INCLUDED_WAVELET_WVPS_FF_H -#define INCLUDED_WAVELET_WVPS_FF_H - -#include <wavelet_api.h> -#include <gr_sync_decimator.h> - -class wavelet_wvps_ff; -typedef boost::shared_ptr<wavelet_wvps_ff> wavelet_wvps_ff_sptr; - -WAVELET_API wavelet_wvps_ff_sptr -wavelet_make_wvps_ff(int ilen); - -/*! - * \brief computes the Wavelet Power Spectrum from a set of wavelet coefficients - * \ingroup wavelet_blk - */ -class WAVELET_API wavelet_wvps_ff : virtual public gr_sync_block -{ - // No public API methods visible -}; - -#endif /* INCLUDED_WAVELET_WVPS_FF_H */ diff --git a/gr-wavelet/lib/CMakeLists.txt b/gr-wavelet/lib/CMakeLists.txt deleted file mode 100644 index f446adb9c..000000000 --- a/gr-wavelet/lib/CMakeLists.txt +++ /dev/null @@ -1,56 +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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${GR_WAVELET_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${GSL_INCLUDE_DIRS} -) - -link_directories(${WAVELET_LIBRARY_DIRS}) -link_directories(${Boost_LIBRARY_DIRS}) -link_directories(${GSL_LIBRARY_DIRS}) -add_definitions(${GSL_DEFINITIONS}) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_wavelet_sources - wavelet_squash_ff_impl.cc - wavelet_wavelet_ff_impl.cc - wavelet_wvps_ff_impl.cc -) - -list(APPEND wavelet_libs - gnuradio-core - ${Boost_LIBRARIES} - ${WAVELET_LIBRARIES} - ${GSL_LIBRARIES} -) - -add_library(gnuradio-wavelet SHARED ${gr_wavelet_sources}) -target_link_libraries(gnuradio-wavelet ${wavelet_libs}) -GR_LIBRARY_FOO(gnuradio-wavelet RUNTIME_COMPONENT "wavelet_runtime" DEVEL_COMPONENT "wavelet_devel") diff --git a/gr-wavelet/lib/wavelet_squash_ff_impl.cc b/gr-wavelet/lib/wavelet_squash_ff_impl.cc deleted file mode 100644 index 89494a9c3..000000000 --- a/gr-wavelet/lib/wavelet_squash_ff_impl.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,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 <stdexcept> -#include <wavelet_squash_ff_impl.h> -#include <gr_io_signature.h> - -// expect input vector of igrid.size y-values, -// produce output vector of ogrid.size y-values - -wavelet_squash_ff_sptr -wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid) -{ - return gnuradio::get_initial_sptr(new wavelet_squash_ff_impl(igrid, ogrid)); -} - -wavelet_squash_ff_impl::wavelet_squash_ff_impl(const std::vector<float> &igrid, - const std::vector<float> &ogrid) - : gr_sync_block("squash_ff", - gr_make_io_signature(1, 1, sizeof(float) * igrid.size()), - gr_make_io_signature(1, 1, sizeof(float) * ogrid.size())) -{ - d_inum = igrid.size(); - d_onum = ogrid.size(); - d_igrid = (double *) malloc(d_inum * sizeof(double)); - d_iwork = (double *) malloc(d_inum * sizeof(double)); - d_ogrid = (double *) malloc(d_onum * sizeof(double)); - for (unsigned int i = 0; i < d_inum; i++) - d_igrid[i] = igrid[i]; - for (unsigned int i = 0; i < d_onum; i++) - d_ogrid[i] = ogrid[i]; - - d_accel = gsl_interp_accel_alloc(); - d_spline = gsl_spline_alloc(gsl_interp_cspline, d_inum); // FIXME check w/ Frank -} - -wavelet_squash_ff_impl::~wavelet_squash_ff_impl() -{ - free((char *) d_igrid); - free((char *) d_iwork); - free((char *) d_ogrid); - gsl_interp_accel_free(d_accel); - gsl_spline_free(d_spline); -} - -int -wavelet_squash_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 count = 0; count < noutput_items; count++) { - - for (unsigned int i = 0; i < d_inum; i++) - d_iwork[i] = in[i]; - - gsl_spline_init(d_spline, d_igrid, d_iwork, d_inum); - - for (unsigned int i = 0; i < d_onum; i++) - out[i] = gsl_spline_eval(d_spline, d_ogrid[i], d_accel); - - in += d_inum; - out += d_onum; - } - - return noutput_items; -} diff --git a/gr-wavelet/lib/wavelet_squash_ff_impl.h b/gr-wavelet/lib/wavelet_squash_ff_impl.h deleted file mode 100644 index dac50ddf2..000000000 --- a/gr-wavelet/lib/wavelet_squash_ff_impl.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 INCLUDED_WAVELET_SQUASH_FF_IMPL_H -#define INCLUDED_WAVELET_SQUASH_FF_IMPL_H - -#include <wavelet_api.h> -#include <wavelet_squash_ff.h> -#include <gsl/gsl_errno.h> -#include <gsl/gsl_interp.h> -#include <gsl/gsl_spline.h> - -class WAVELET_API wavelet_squash_ff_impl : public wavelet_squash_ff -{ - size_t d_inum; - size_t d_onum; - double *d_igrid; - double *d_iwork; - double *d_ogrid; - - gsl_interp_accel *d_accel; - gsl_spline *d_spline; - - wavelet_squash_ff_impl(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - - friend WAVELET_API wavelet_squash_ff_sptr - wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - - public: - ~wavelet_squash_ff_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_WAVELET_WAVELET_FF_IMPL_H */ diff --git a/gr-wavelet/lib/wavelet_wavelet_ff_impl.cc b/gr-wavelet/lib/wavelet_wavelet_ff_impl.cc deleted file mode 100644 index ccc1a6d8f..000000000 --- a/gr-wavelet/lib/wavelet_wavelet_ff_impl.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,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 tewavelet 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 <stdexcept> -#include <wavelet_wavelet_ff_impl.h> -#include <gr_io_signature.h> - -#include <stdio.h> - -// NB in this version, only Daubechies wavelets -// order is wavelet length, even, 2...20 - -wavelet_wavelet_ff_sptr -wavelet_make_wavelet_ff(int size, - int order, - bool forward) -{ - return gnuradio::get_initial_sptr(new wavelet_wavelet_ff_impl(size, order, forward)); -} - -wavelet_wavelet_ff_impl::wavelet_wavelet_ff_impl(int size, int order, bool forward) - : gr_sync_block("wavelet_ff", - gr_make_io_signature(1, 1, size * sizeof(float)), - gr_make_io_signature(1, 1, size * sizeof(float))), - d_size(size), - d_order(order), - d_forward(forward) -{ - d_wavelet = gsl_wavelet_alloc(gsl_wavelet_daubechies, d_order); - if (d_wavelet == NULL) - throw std::runtime_error("can't allocate wavelet"); - d_workspace = gsl_wavelet_workspace_alloc(d_size); - if (d_workspace == NULL) - throw std::runtime_error("can't allocate wavelet workspace"); - d_temp = (double *) malloc(d_size*sizeof(double)); - if (d_workspace == NULL) - throw std::runtime_error("can't allocate wavelet double conversion temp"); -} - -wavelet_wavelet_ff_impl::~wavelet_wavelet_ff_impl() -{ - gsl_wavelet_free(d_wavelet); - gsl_wavelet_workspace_free(d_workspace); - free((char *) d_temp); -} - -int -wavelet_wavelet_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 count = 0; count < noutput_items; count++) { - for (int i = 0; i < d_size; i++) - d_temp[i] = in[i]; - - if (d_forward) - gsl_wavelet_transform_forward(d_wavelet, - d_temp, - 1, - d_size, - d_workspace); - else - gsl_wavelet_transform_inverse(d_wavelet, - d_temp, - 1, - d_size, - d_workspace); - - for (int i = 0; i < d_size; i++) - out[i] = d_temp[i]; - - in += d_size; - out += d_size; - } - - return noutput_items; -} diff --git a/gr-wavelet/lib/wavelet_wavelet_ff_impl.h b/gr-wavelet/lib/wavelet_wavelet_ff_impl.h deleted file mode 100644 index dc33a4184..000000000 --- a/gr-wavelet/lib/wavelet_wavelet_ff_impl.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 INCLUDED_WAVELET_WAVELET_FF_IMPL_H -#define INCLUDED_WAVELET_WAVELET_FF_IMPL_H - -#include <wavelet_wavelet_ff.h> -#include <gsl/gsl_errno.h> -#include <gsl/gsl_wavelet.h> - -class WAVELET_API wavelet_wavelet_ff_impl : public wavelet_wavelet_ff -{ - int d_size; - int d_order; - bool d_forward; - gsl_wavelet *d_wavelet; - gsl_wavelet_workspace *d_workspace; - double *d_temp; - - friend WAVELET_API wavelet_wavelet_ff_sptr - wavelet_make_wavelet_ff(int size, - int order, - bool forward); - - wavelet_wavelet_ff_impl(int size, - int order, - bool forward); - -public: - ~wavelet_wavelet_ff_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_WAVELET_WAVELET_FF_IMPL_H */ diff --git a/gr-wavelet/lib/wavelet_wvps_ff_impl.cc b/gr-wavelet/lib/wavelet_wvps_ff_impl.cc deleted file mode 100644 index b86859b0a..000000000 --- a/gr-wavelet/lib/wavelet_wvps_ff_impl.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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 <wavelet_wvps_ff_impl.h> -#include <gr_io_signature.h> -#include <string.h> - -static int -ceil_log2(int k) -{ - int m = 0; - for (int n = k-1; n > 0; n >>= 1) m++; - return m; -} - -wavelet_wvps_ff_sptr -wavelet_make_wvps_ff(int ilen) -{ - return gnuradio::get_initial_sptr(new wavelet_wvps_ff_impl(ilen)); -} - -wavelet_wvps_ff_impl::wavelet_wvps_ff_impl(int ilen) - : gr_sync_block("wvps_ff", - gr_make_io_signature(1, 1, sizeof(float) * ilen), - gr_make_io_signature(1, 1, sizeof(float) * ceil_log2(ilen))), - d_ilen(ilen), d_olen(ceil_log2(ilen)) -{ -} - -// input vector assumed to be output from gsl wavelet computation - -int -wavelet_wvps_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 count = 0; count < noutput_items; count++) { - - // any power? - - if (in[0] == 0.0) { - for (int i = 0; i < d_olen; i++) - out[i] = 0.0; - - } else { - - // get power normalization from 0-th wavelet coefficient - - float scl = 1.0/(in[0]*in[0]); - int k = 1; - - // sum powers over sequences of bins, - // sequence lengths in increasing powers of 2 - - for (int e = 0; e < d_olen; e++) { - int m = 01<<e; - float sum = 0.0; - - for (int l = 0; l < m; l++) - sum += (in[k+l]*in[k+l]); - - out[e] = scl*sum; - k += m; - } - } - - in += d_ilen; - out += d_olen; - } - - return noutput_items; -} diff --git a/gr-wavelet/lib/wavelet_wvps_ff_impl.h b/gr-wavelet/lib/wavelet_wvps_ff_impl.h deleted file mode 100644 index 553469fde..000000000 --- a/gr-wavelet/lib/wavelet_wvps_ff_impl.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 INCLUDED_WAVELET_WVPS_FF_IMPL_H -#define INCLUDED_WAVELET_WVPS_FF_IMPL_H - -#include <wavelet_wvps_ff.h> - -class WAVELET_API wavelet_wvps_ff_impl : public wavelet_wvps_ff -{ - int d_ilen; - int d_olen; - - friend WAVELET_API wavelet_wvps_ff_sptr - wavelet_make_wvps_ff(int ilen); - - wavelet_wvps_ff_impl(int ilen); - - public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_WAVELET_WVPS_FF_IMPL_H */ diff --git a/gr-wavelet/python/CMakeLists.txt b/gr-wavelet/python/CMakeLists.txt deleted file mode 100644 index 7f4d3a7af..000000000 --- a/gr-wavelet/python/CMakeLists.txt +++ /dev/null @@ -1,47 +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. - -######################################################################## -include(GrPython) - -GR_PYTHON_INSTALL( - FILES - __init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/wavelet - COMPONENT "wavelet_python" -) - -######################################################################## -# Handle the unit tests -######################################################################## -if(ENABLE_TESTING) - -list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-wavelet/python - ${CMAKE_BINARY_DIR}/gr-wavelet/swig -) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-wavelet) - -include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) -endif(ENABLE_TESTING) diff --git a/gr-wavelet/python/__init__.py b/gr-wavelet/python/__init__.py deleted file mode 100644 index 77e2ac7c2..000000000 --- a/gr-wavelet/python/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2011 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 is the gr-wavelet package. This package provides GNU Radio -processing blocks for wavelet transforms. -''' - -from wavelet_swig import * - diff --git a/gr-wavelet/python/qa_classify.py b/gr-wavelet/python/qa_classify.py deleted file mode 100755 index 5701bce8c..000000000 --- a/gr-wavelet/python/qa_classify.py +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008,2010 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. -# - -import numpy -from gnuradio import gr, gr_unittest -import copy -#import pygsl.wavelet as wavelet # FIXME: pygsl not checked for in config -import math -import wavelet_swig - -def sqr(x): - return x*x - -def np2(k): - m = 0 - n = k - 1 - while n > 0: - m += 1 - return m - - -class test_classify(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - -# def test_000_(self): -# src_data = numpy.zeros(10) -# trg_data = numpy.zeros(10) -# src = gr.vector_source_f(src_data) -# dst = gr.vector_sink_f() -# self.tb.connect(src, dst) -# self.tb.run() -# rsl_data = dst.data() -# sum = 0 -# for (u,v) in zip(trg_data, rsl_data): -# w = u - v -# sum += w * w -# sum /= float(len(trg_data)) -# assert sum < 1e-6 - - def test_001_(self): - src_data = numpy.array([-1.0, 1.0, -1.0, 1.0]) - trg_data = src_data * 0.5 - src = gr.vector_source_f(src_data) - dst = gr.vector_sink_f() - rail = gr.rail_ff(-0.5, 0.5) - self.tb.connect(src, rail) - self.tb.connect(rail, dst) - self.tb.run() - rsl_data = dst.data() - sum = 0 - for (u, v) in zip(trg_data, rsl_data): - w = u - v - sum += w * w - sum /= float(len(trg_data)) - assert sum < 1e-6 - - def test_002_(self): - src_data = numpy.array([-1.0, - -1.0/2.0, - -1.0/3.0, - -1.0/4.0, - -1.0/5.0]) - trg_data = copy.deepcopy(src_data) - - src = gr.vector_source_f(src_data, False, len(src_data)) - st = gr.stretch_ff(-1.0/5.0, len(src_data)) - dst = gr.vector_sink_f(len(src_data)) - self.tb.connect(src, st) - self.tb.connect(st, dst) - self.tb.run() - rsl_data = dst.data() - sum = 0 - for (u, v) in zip(trg_data, rsl_data): - w = u - v - sum += w * w - sum /= float(len(trg_data)) - assert sum < 1e-6 - - def test_003_(self): - src_grid = (0.0, 1.0, 2.0, 3.0, 4.0) - trg_grid = copy.deepcopy(src_grid) - src_data = (0.0, 1.0, 0.0, 1.0, 0.0) - - src = gr.vector_source_f(src_data, False, len(src_grid)) - sq = wavelet_swig.squash_ff(src_grid, trg_grid) - dst = gr.vector_sink_f(len(trg_grid)) - self.tb.connect(src, sq) - self.tb.connect(sq, dst) - self.tb.run() - rsl_data = dst.data() - sum = 0 - for (u, v) in zip(src_data, rsl_data): - w = u - v - sum += w * w - sum /= float(len(src_data)) - assert sum < 1e-6 - -# def test_004_(self): # FIXME: requires pygsl -# -# n = 256 -# o = 4 -# ws = wavelet.workspace(n) -# w = wavelet.daubechies(o) -# -# a = numpy.arange(n) -# b = numpy.sin(a*numpy.pi/16.0) -# c = w.transform_forward(b, ws) -# d = w.transform_inverse(c, ws) -# -# src = gr.vector_source_f(b, False, n) -# wv = wavelet_swig.wavelet_ff(n, o, True) -# -# dst = gr.vector_sink_f(n) -# self.tb.connect(src, wv) -# self.tb.connect(wv, dst) -# self.tb.run() -# e = dst.data() -# -# sum = 0 -# for (u, v) in zip(c, e): -# w = u - v -# sum += w * w -# sum /= float(len(c)) -# assert sum < 1e-6 - - def test_005_(self): - - src_data = (1.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0) - - dwav = numpy.array(src_data) - wvps = numpy.zeros(3) - # wavelet power spectrum - scl = 1.0/sqr(dwav[0]) - k = 1 - for e in range(len(wvps)): - wvps[e] = scl*sqr(dwav[k:k+(01<<e)]).sum() - k += 01<<e - - src = gr.vector_source_f(src_data, False, len(src_data)) - kon = wavelet_swig.wvps_ff(len(src_data)) - dst = gr.vector_sink_f(int(math.ceil(math.log(len(src_data), 2)))) - - self.tb.connect(src, kon) - self.tb.connect(kon, dst) - - self.tb.run() - snk_data = dst.data() - - sum = 0 - for (u,v) in zip(snk_data, wvps): - w = u - v - sum += w * w - sum /= float(len(snk_data)) - assert sum < 1e-6 - -if __name__ == '__main__': - gr_unittest.run(test_classify, "test_classify.xml") diff --git a/gr-wavelet/swig/CMakeLists.txt b/gr-wavelet/swig/CMakeLists.txt deleted file mode 100644 index ea7a24b24..000000000 --- a/gr-wavelet/swig/CMakeLists.txt +++ /dev/null @@ -1,53 +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. - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_INCLUDE_DIRS - ${GR_WAVELET_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${GSL_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/wavelet_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/wavelet) - -set(GR_SWIG_LIBRARIES gnuradio-wavelet ${GSL_LDFLAGS}) - -GR_SWIG_MAKE(wavelet_swig wavelet_swig.i) - -GR_SWIG_INSTALL( - TARGETS wavelet_swig - DESTINATION ${GR_PYTHON_DIR}/gnuradio/wavelet - COMPONENT "wavelet_python" -) - -install( - FILES - wavelet_swig.i - ${CMAKE_CURRENT_BINARY_DIR}/wavelet_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "wavelet_swig" -) diff --git a/gr-wavelet/swig/wavelet_swig.i b/gr-wavelet/swig/wavelet_swig.i deleted file mode 100644 index b04efc508..000000000 --- a/gr-wavelet/swig/wavelet_swig.i +++ /dev/null @@ -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. - */ - -#define WAVELET_API - -%include "gnuradio.i" - -//load generated python docstrings -%include "wavelet_swig_doc.i" - -%{ -#include "wavelet_squash_ff.h" -#include "wavelet_wavelet_ff.h" -#include "wavelet_wvps_ff.h" -%} - -%include "wavelet_squash_ff.h" -%include "wavelet_wavelet_ff.h" -%include "wavelet_wvps_ff.h" - -GR_SWIG_BLOCK_MAGIC(wavelet,squash_ff); -wavelet_squash_ff_sptr wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - -GR_SWIG_BLOCK_MAGIC(wavelet,wavelet_ff); -wavelet_wavelet_ff_sptr wavelet_make_wavelet_ff(int size, int order, bool forward); - -GR_SWIG_BLOCK_MAGIC(wavelet,wvps_ff); -wavelet_wvps_ff_sptr wavelet_make_wvps_ff(int ilen); |