diff options
Diffstat (limited to 'gnuradio-core')
833 files changed, 7305 insertions, 61823 deletions
diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt index b277103547..7c7884bbf8 100644 --- a/gnuradio-core/CMakeLists.txt +++ b/gnuradio-core/CMakeLists.txt @@ -53,8 +53,6 @@ GR_SET_GLOBAL(GNURADIO_CORE_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/src/lib/filter ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/filter ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/missing - ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/reed-solomon - ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/viterbi ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/io ${CMAKE_CURRENT_BINARY_DIR}/src/lib/swig ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/swig @@ -69,6 +67,32 @@ GR_SET_GLOBAL(GNURADIO_CORE_SWIG_INCLUDE_DIRS ) ######################################################################## +# Register controlport component +######################################################################## + +FIND_PACKAGE(ICE) +FIND_PACKAGE(SWIG) + +if(SWIG_FOUND) + set(SWIG_VERSION_CHECK FALSE) + if("${SWIG_VERSION}" VERSION_GREATER "2.0.0") + set(SWIG_VERSION_CHECK TRUE) + else("${SWIG_VERSION}" VERSION_GREATER "2.0.0") + message(STATUS "") + message(STATUS "Ctrlport requires SWIG version >= 2.0") + endif() +endif(SWIG_FOUND) + +GR_REGISTER_COMPONENT("gr-ctrlport" ENABLE_GR_CTRLPORT + Boost_FOUND + SWIG_FOUND + SWIG_VERSION_CHECK + ICE_FOUND + ENABLE_GRUEL + ENABLE_GR_CORE +) + +######################################################################## # Begin conditional configuration ######################################################################## if(ENABLE_GR_CORE) @@ -140,4 +164,29 @@ install( COMPONENT "core_devel" ) + +######################################################################## +# Setup ControlPort preferences file and installation information +######################################################################## +if(ENABLE_GR_CTRLPORT) + +SET(GR_PKG_CTRL_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/ctrlport) + +SET(GR_PKG_CTRL_SLICE_DIR ${GR_PKG_DATA_DIR}/ctrlport) +file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${GR_PKG_CTRL_SLICE_DIR} slicedir) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport.conf.in + ${CMAKE_CURRENT_BINARY_DIR}/ctrlport.conf +@ONLY) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/ctrlport.conf + DESTINATION ${GR_PREFSDIR} + COMPONENT "core_runtime" +) + +endif(ENABLE_GR_CTRLPORT) + + endif(ENABLE_GR_CORE) diff --git a/gnuradio-core/ctrlport.conf.in b/gnuradio-core/ctrlport.conf.in new file mode 100644 index 0000000000..5c31a04516 --- /dev/null +++ b/gnuradio-core/ctrlport.conf.in @@ -0,0 +1,6 @@ +# 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 + +[ctrlport] +ice_directory=@slicedir@ diff --git a/gnuradio-core/src/examples/CMakeLists.txt b/gnuradio-core/src/examples/CMakeLists.txt index 01d9eb83e0..24ed5e881f 100644 --- a/gnuradio-core/src/examples/CMakeLists.txt +++ b/gnuradio-core/src/examples/CMakeLists.txt @@ -20,6 +20,10 @@ add_subdirectory(mp-sched) add_subdirectory(msg_passing) add_subdirectory(network) -add_subdirectory(pfb) add_subdirectory(tags) -add_subdirectory(volk_benchmark)
\ No newline at end of file +add_subdirectory(volk_benchmark) + +if(ENABLE_GR_CTRLPORT) +add_subdirectory(ctrlport) +endif(ENABLE_GR_CTRLPORT) + diff --git a/gnuradio-core/src/python/gnuradio/blks2/CMakeLists.txt b/gnuradio-core/src/examples/ctrlport/CMakeLists.txt index 83d11dd831..47ef4c225e 100644 --- a/gnuradio-core/src/python/gnuradio/blks2/CMakeLists.txt +++ b/gnuradio-core/src/examples/ctrlport/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. +# Copyright 2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,8 +19,7 @@ include(GrPython) -GR_PYTHON_INSTALL( - FILES __init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/blks2 +GR_PYTHON_INSTALL(PROGRAMS + DESTINATION ${GR_PKG_CTRLPORT_EXAMPLES_DIR} COMPONENT "core_python" ) diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc new file mode 100644 index 0000000000..2dadddb6df --- /dev/null +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc @@ -0,0 +1,772 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Wed Feb 6 17:01:06 2013</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>pfb_sync_test_qt</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>qt_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>graymap</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>[[3,1,0,2]]</value> + </param> + <param> + <key>_coordinate</key> + <value>(32, 387)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>amps</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>[1]</value> + </param> + <param> + <key>_coordinate</key> + <value>(32, 451)</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>(99, 451)</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>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>(623, 64)</value> + </param> + <param> + <key>_rotation</key> + <value>0</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>/dev/urandom</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(228, 56)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_packed_to_unpacked_xx</key> + <param> + <key>id</key> + <value>gr_packed_to_unpacked_xx_0</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>8</value> + </param> + <param> + <key>endianness</key> + <value>gr.GR_MSB_FIRST</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(408, 56)</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>2</value> + </param> + <param> + <key>_coordinate</key> + <value>(105, 126)</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>300000</value> + </param> + <param> + <key>_coordinate</key> + <value>(14, 124)</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 random, math, cmath</value> + </param> + <param> + <key>_coordinate</key> + <value>(14, 77)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_qtgui_range</key> + <param> + <key>id</key> + <value>phase</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Phase</value> + </param> + <param> + <key>value</key> + <value>0.5</value> + </param> + <param> + <key>start</key> + <value>0</value> + </param> + <param> + <key>stop</key> + <value>2</value> + </param> + <param> + <key>step</key> + <value>0.01</value> + </param> + <param> + <key>widget</key> + <value>counter_slider</value> + </param> + <param> + <key>orient</key> + <value>Qt.Horizontal</value> + </param> + <param> + <key>min_len</key> + <value>200</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(175, 387)</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>complex</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(939, 313)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_qtgui_range</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>0.050</value> + </param> + <param> + <key>start</key> + <value>0.0001</value> + </param> + <param> + <key>stop</key> + <value>2</value> + </param> + <param> + <key>step</key> + <value>0.01</value> + </param> + <param> + <key>widget</key> + <value>counter_slider</value> + </param> + <param> + <key>orient</key> + <value>Qt.Horizontal</value> + </param> + <param> + <key>min_len</key> + <value>200</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(316, 389)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>qtgui_const_sink_x</key> + <param> + <key>id</key> + <value>qtgui_const_sink_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>name</key> + <value>QT GUI Plot</value> + </param> + <param> + <key>size</key> + <value>1024</value> + </param> + <param> + <key>ymin</key> + <value>-2</value> + </param> + <param> + <key>ymax</key> + <value>2</value> + </param> + <param> + <key>xmin</key> + <value>-2</value> + </param> + <param> + <key>xmax</key> + <value>2</value> + </param> + <param> + <key>nconnections</key> + <value>2</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(949, 232)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_pfb_clock_sync_xxx</key> + <param> + <key>id</key> + <value>digital_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>sps</value> + </param> + <param> + <key>loop_bw</key> + <value>2*3.14/100.0</value> + </param> + <param> + <key>taps</key> + <value>firdes.root_raised_cosine(nfilts, nfilts,1.0/sps, 0.35, int(22*sps*nfilts))</value> + </param> + <param> + <key>filter_size</key> + <value>nfilts</value> + </param> + <param> + <key>init_phase</key> + <value>nfilts/2</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>(322, 231)</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>4</value> + </param> + <param> + <key>mod_code</key> + <value>"gray"</value> + </param> + <param> + <key>differential</key> + <value>True</value> + </param> + <param> + <key>samples_per_symbol</key> + <value>sps</value> + </param> + <param> + <key>excess_bw</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>(846, 32)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>channels_channel_model</key> + <param> + <key>id</key> + <value>channels_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>0.0</value> + </param> + <param> + <key>epsilon</key> + <value>1.0</value> + </param> + <param> + <key>taps</key> + <value>cmath.exp(1j*noise)</value> + </param> + <param> + <key>seed</key> + <value>0</value> + </param> + <param> + <key>_coordinate</key> + <value>(80, 247)</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>6.28/100.0</value> + </param> + <param> + <key>order</key> + <value>4</value> + </param> + <param> + <key>_coordinate</key> + <value>(641, 313)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_ctrlport_probe2_c</key> + <param> + <key>id</key> + <value>probe2_c_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>name</key> + <value>constellation</value> + </param> + <param> + <key>desc</key> + <value>Constellation Points</value> + </param> + <param> + <key>len</key> + <value>1024</value> + </param> + <param> + <key>_coordinate</key> + <value>(936, 396)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>ctrlport_monitor</key> + <param> + <key>id</key> + <value>ctrlport_monitor_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>en</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(228, 9)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>gr_packed_to_unpacked_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>digital_psk_mod_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_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>gr_file_source_0</source_block_id> + <sink_block_id>gr_packed_to_unpacked_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id> + <sink_block_id>qtgui_const_sink_x_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>qtgui_const_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>digital_costas_loop_cc_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>channels_channel_model_0</source_block_id> + <sink_block_id>digital_pfb_clock_sync_xxx_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>channels_channel_model_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>probe2_c_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gnuradio-core/src/examples/pfb/resampler_demo.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc index 468636a5cf..0e470a619d 100644 --- a/gnuradio-core/src/examples/pfb/resampler_demo.grc +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc @@ -1,11 +1,11 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sun Aug 23 11:39:47 2009</timestamp> + <timestamp>Wed Feb 6 17:02:42 2013</timestamp> <block> <key>options</key> <param> <key>id</key> - <value>resampler_demo</value> + <value>pfb_sync_test</value> </param> <param> <key>_enabled</key> @@ -36,10 +36,18 @@ <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> @@ -64,11 +72,11 @@ </param> <param> <key>import</key> - <value>import math</value> + <value>import random, math, cmath</value> </param> <param> <key>_coordinate</key> - <value>(11, 59)</value> + <value>(14, 77)</value> </param> <param> <key>_rotation</key> @@ -79,7 +87,7 @@ <key>variable</key> <param> <key>id</key> - <value>rs_taps</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> @@ -87,11 +95,11 @@ </param> <param> <key>value</key> - <value>firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw)</value> + <value>300000</value> </param> <param> <key>_coordinate</key> - <value>(273, 154)</value> + <value>(14, 124)</value> </param> <param> <key>_rotation</key> @@ -99,30 +107,22 @@ </param> </block> <block> - <key>gr_add_const_vxx</key> + <key>variable</key> <param> <key>id</key> - <value>adder</value> + <value>graymap</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>const</key> - <value>-1.0</value> - </param> - <param> - <key>vlen</key> - <value>1</value> + <key>value</key> + <value>[[3,1,0,2]]</value> </param> <param> <key>_coordinate</key> - <value>(227, 303)</value> + <value>(32, 387)</value> </param> <param> <key>_rotation</key> @@ -130,30 +130,22 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>variable</key> <param> <key>id</key> - <value>throttle</value> + <value>amps</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> + <key>value</key> + <value>[1]</value> </param> <param> <key>_coordinate</key> - <value>(227, 493)</value> + <value>(32, 451)</value> </param> <param> <key>_rotation</key> @@ -161,85 +153,83 @@ </param> </block> <block> - <key>wxgui_fftsink2</key> + <key>variable</key> <param> <key>id</key> - <value>orig_fft</value> + <value>nfilts</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Original Spectrum</value> + <key>value</key> + <value>32</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>_coordinate</key> + <value>(99, 451)</value> </param> <param> - <key>baseband_freq</key> + <key>_rotation</key> <value>0</value> </param> + </block> + <block> + <key>digital_costas_loop_cc</key> <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> + <key>id</key> + <value>digital_costas_loop_cc_0</value> </param> <param> - <key>ref_level</key> - <value>30</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>fft_size</key> - <value>1024</value> + <key>w</key> + <value>6.28/100.0</value> </param> <param> - <key>fft_rate</key> - <value>30</value> + <key>order</key> + <value>4</value> </param> <param> - <key>peak_hold</key> - <value>False</value> + <key>_coordinate</key> + <value>(626, 223)</value> </param> <param> - <key>average</key> - <value>False</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable</key> <param> - <key>avg_alpha</key> - <value>0</value> + <key>id</key> + <value>sps</value> </param> <param> - <key>grid_pos</key> - <value>1, 0, 1, 3</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>notebook</key> - <value></value> + <key>value</key> + <value>2</value> </param> <param> <key>_coordinate</key> - <value>(409, 289)</value> + <value>(105, 126)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <block> - <key>wxgui_fftsink2</key> + <key>gr_null_sink</key> <param> <key>id</key> - <value>resamp_fft</value> + <value>gr_null_sink_0</value> </param> <param> <key>_enabled</key> @@ -250,52 +240,59 @@ <value>complex</value> </param> <param> - <key>title</key> - <value>Resampled Spectrum</value> + <key>vlen</key> + <value>1</value> </param> <param> - <key>samp_rate</key> - <value>new_rate</value> + <key>_coordinate</key> + <value>(964, 200)</value> </param> <param> - <key>baseband_freq</key> + <key>_rotation</key> <value>0</value> </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>noise</value> + </param> <param> - <key>y_per_div</key> - <value>10</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>y_divs</key> - <value>10</value> + <key>label</key> + <value></value> </param> <param> - <key>ref_level</key> - <value>30</value> + <key>value</key> + <value>0.05</value> </param> <param> - <key>fft_size</key> - <value>1024</value> + <key>min</key> + <value>0.00000001</value> </param> <param> - <key>fft_rate</key> - <value>30</value> + <key>max</key> + <value>2</value> </param> <param> - <key>peak_hold</key> - <value>True</value> + <key>num_steps</key> + <value>100</value> </param> <param> - <key>average</key> - <value>False</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>avg_alpha</key> - <value>0</value> + <key>converver</key> + <value>float_converter</value> </param> <param> <key>grid_pos</key> - <value>2, 0, 1, 3</value> + <value></value> </param> <param> <key>notebook</key> @@ -303,50 +300,62 @@ </param> <param> <key>_coordinate</key> - <value>(640, 256)</value> + <value>(281, 406)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <block> - <key>gr_sig_source_x</key> + <key>variable_slider</key> <param> <key>id</key> - <value>tri_source</value> + <value>phase</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> + <key>label</key> + <value></value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>value</key> + <value>0</value> </param> <param> - <key>waveform</key> - <value>gr.GR_TRI_WAVE</value> + <key>min</key> + <value>0</value> </param> <param> - <key>freq</key> - <value>0.05</value> + <key>max</key> + <value>2</value> </param> <param> - <key>amp</key> - <value>2.0</value> + <key>num_steps</key> + <value>100</value> </param> <param> - <key>offset</key> - <value>0</value> + <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>(21, 271)</value> + <value>(167, 405)</value> </param> <param> <key>_rotation</key> @@ -354,22 +363,34 @@ </param> </block> <block> - <key>gr_frequency_modulator_fc</key> + <key>gr_file_source</key> <param> <key>id</key> - <value>fm_mod</value> + <value>gr_file_source_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>sensitivity</key> - <value>math.pi</value> + <key>file</key> + <value>/dev/urandom</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(411, 493)</value> + <value>(228, 56)</value> </param> <param> <key>_rotation</key> @@ -377,30 +398,34 @@ </param> </block> <block> - <key>blks2_pfb_arb_resampler_ccf</key> + <key>gr_packed_to_unpacked_xx</key> <param> <key>id</key> - <value>resampler</value> + <value>gr_packed_to_unpacked_xx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>rate</key> - <value>float(new_rate)/samp_rate</value> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>bits_per_chunk</key> + <value>8</value> </param> <param> - <key>taps</key> - <value>rs_taps</value> + <key>endianness</key> + <value>gr.GR_MSB_FIRST</value> </param> <param> - <key>size</key> - <value>nphases</value> + <key>num_ports</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(641, 477)</value> + <value>(408, 56)</value> </param> <param> <key>_rotation</key> @@ -408,22 +433,30 @@ </param> </block> <block> - <key>variable</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>nphases</value> + <value>gr_throttle_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>32</value> + <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>(185, 153)</value> + <value>(623, 64)</value> </param> <param> <key>_rotation</key> @@ -431,42 +464,50 @@ </param> </block> <block> - <key>variable_static_text</key> + <key>digital_pfb_clock_sync_xxx</key> <param> <key>id</key> - <value>samp_rate</value> + <value>digital_pfb_clock_sync_xxx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Sample Rate</value> + <key>type</key> + <value>ccf</value> </param> <param> - <key>value</key> - <value>44100</value> + <key>sps</key> + <value>sps</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>loop_bw</key> + <value>2*3.14/100.0</value> </param> <param> - <key>formatter</key> - <value>None</value> + <key>taps</key> + <value>firdes.root_raised_cosine(nfilts, nfilts,1.0/sps, 0.35, int(22*sps*nfilts))</value> </param> <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> + <key>filter_size</key> + <value>nfilts</value> </param> <param> - <key>notebook</key> - <value></value> + <key>init_phase</key> + <value>nfilts/2</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>(179, 14)</value> + <value>(322, 231)</value> </param> <param> <key>_rotation</key> @@ -474,42 +515,46 @@ </param> </block> <block> - <key>variable_static_text</key> + <key>digital_psk_mod</key> <param> <key>id</key> - <value>new_rate</value> + <value>digital_psk_mod_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Resampled Rate</value> + <key>constellation_points</key> + <value>4</value> </param> <param> - <key>value</key> - <value>48000</value> + <key>mod_code</key> + <value>"gray"</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>differential</key> + <value>True</value> </param> <param> - <key>formatter</key> - <value>None</value> + <key>samples_per_symbol</key> + <value>sps</value> </param> <param> - <key>grid_pos</key> - <value>0, 1, 1, 1</value> + <key>excess_bw</key> + <value>0.35</value> </param> <param> - <key>notebook</key> - <value></value> + <key>verbose</key> + <value>False</value> + </param> + <param> + <key>log</key> + <value>False</value> </param> <param> <key>_coordinate</key> - <value>(328, 15)</value> + <value>(846, 32)</value> </param> <param> <key>_rotation</key> @@ -517,42 +562,61 @@ </param> </block> <block> - <key>variable_static_text</key> + <key>channels_channel_model</key> <param> <key>id</key> - <value>frac_bw</value> + <value>channels_channel_model_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Fractional Bandwidth</value> + <key>noise_voltage</key> + <value>noise</value> </param> <param> - <key>value</key> - <value>0.45</value> + <key>freq_offset</key> + <value>0.0</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>epsilon</key> + <value>1.0</value> </param> <param> - <key>formatter</key> - <value>lambda x: "%0.2f"%x</value> + <key>taps</key> + <value>cmath.exp(1j*phase)</value> </param> <param> - <key>grid_pos</key> - <value>0,2,1,1</value> + <key>seed</key> + <value>0</value> </param> <param> - <key>notebook</key> - <value></value> + <key>_coordinate</key> + <value>(73, 247)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>ctrlport_monitor</key> + <param> + <key>id</key> + <value>ctrlport_monitor_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>en</key> + <value>True</value> </param> <param> <key>_coordinate</key> - <value>(473, 14)</value> + <value>(228, 5)</value> </param> <param> <key>_rotation</key> @@ -560,38 +624,44 @@ </param> </block> <connection> - <source_block_id>tri_source</source_block_id> - <sink_block_id>adder</sink_block_id> + <source_block_id>gr_packed_to_unpacked_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_file_source_0</source_block_id> + <sink_block_id>gr_packed_to_unpacked_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>adder</source_block_id> - <sink_block_id>throttle</sink_block_id> + <source_block_id>gr_throttle_0</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>resampler</source_block_id> - <sink_block_id>resamp_fft</sink_block_id> + <source_block_id>digital_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>fm_mod</source_block_id> - <sink_block_id>resampler</sink_block_id> + <source_block_id>digital_costas_loop_cc_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>fm_mod</source_block_id> - <sink_block_id>orig_fft</sink_block_id> + <source_block_id>channels_channel_model_0</source_block_id> + <sink_block_id>digital_pfb_clock_sync_xxx_0</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>fm_mod</sink_block_id> + <source_block_id>digital_psk_mod_0</source_block_id> + <sink_block_id>channels_channel_model_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py b/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py index 81613922b8..ac060c0cce 100755 --- a/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py +++ b/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py @@ -22,7 +22,8 @@ from gnuradio import gr, gru, eng_notation, optfir from gnuradio import audio -from gnuradio import blks2 +from gnuradio import analog +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import sys @@ -70,12 +71,12 @@ class wfm_rx_block (gr.top_block): chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs) - #self.guts = blks2.wfm_rcv (demod_rate, audio_decimation) - self.guts = blks2.wfm_rcv_pll (demod_rate, audio_decimation) + #self.guts = analog.wfm_rcv (demod_rate, audio_decimation) + self.guts = analog.wfm_rcv_pll (demod_rate, audio_decimation) # 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) + self.volume_control_l = blocks.multiply_const_ff(self.vol) + self.volume_control_r = blocks.multiply_const_ff(self.vol) # wave file as final sink if 1: diff --git a/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier.grc b/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier.grc index 0faed49bc7..0f25597666 100644 --- a/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier.grc +++ b/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier.grc @@ -142,7 +142,7 @@ </param> <param> <key>msg</key> - <value>pmt.pmt_cons(pmt.PMT_NIL, pmt.pmt_make_u8vector(16,0x77))</value> + <value>pmt.cons(pmt.PMT_NIL, pmt.make_u8vector(16,0x77))</value> </param> <param> <key>period</key> @@ -204,7 +204,7 @@ </param> <param> <key>msg</key> - <value>pmt.pmt_intern("OUTPUT2")</value> + <value>pmt.intern("OUTPUT2")</value> </param> <param> <key>period</key> diff --git a/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier_topblock.grc b/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier_topblock.grc index f440b06b39..d9d9e62c38 100644 --- a/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier_topblock.grc +++ b/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier_topblock.grc @@ -72,7 +72,7 @@ </param> <param> <key>msg</key> - <value>pmt.pmt_intern("UPDATED2")</value> + <value>pmt.intern("UPDATED2")</value> </param> <param> <key>period</key> @@ -99,7 +99,7 @@ </param> <param> <key>msg</key> - <value>pmt.pmt_intern("UPDATED")</value> + <value>pmt.intern("UPDATED")</value> </param> <param> <key>period</key> diff --git a/gnuradio-core/src/examples/msg_passing/strobe.grc b/gnuradio-core/src/examples/msg_passing/strobe.grc index 7e7e8c345e..78c1786e21 100644 --- a/gnuradio-core/src/examples/msg_passing/strobe.grc +++ b/gnuradio-core/src/examples/msg_passing/strobe.grc @@ -132,7 +132,7 @@ </param> <param> <key>msg</key> - <value>pmt.pmt_intern("TEST")</value> + <value>pmt.intern("TEST")</value> </param> <param> <key>period</key> @@ -159,7 +159,7 @@ </param> <param> <key>msg</key> - <value>pmt.pmt_cons( pmt.PMT_NIL, pmt.pmt_make_u8vector(512,0) )</value> + <value>pmt.pmtcons( pmt.PMT_NIL, pmt.make_u8vector(512,0) )</value> </param> <param> <key>period</key> diff --git a/gnuradio-core/src/examples/network/dial_tone_source.py b/gnuradio-core/src/examples/network/dial_tone_source.py index 232a06de80..a8d85c4c57 100755 --- a/gnuradio-core/src/examples/network/dial_tone_source.py +++ b/gnuradio-core/src/examples/network/dial_tone_source.py @@ -23,15 +23,26 @@ from gnuradio import gr from gnuradio.eng_option import eng_option from optparse import OptionParser +import sys + +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("This example requires gr-analog.\n") + +try: + from gnuradio import blocks +except ImportError: + sys.stderr.write("This example requires gr-blocks.\n") class dial_tone_source(gr.top_block): def __init__(self, host, port, pkt_size, sample_rate, eof): gr.top_block.__init__(self, "dial_tone_source") amplitude = 0.3 - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, amplitude) - src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, amplitude) - add = gr.add_ff() + src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 350, amplitude) + src1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 440, amplitude) + add = blocks.add_ff() # Throttle needed here to account for the other side's audio card sampling rate thr = gr.throttle(gr.sizeof_float, sample_rate) diff --git a/gnuradio-core/src/examples/pfb/CMakeLists.txt b/gnuradio-core/src/examples/pfb/CMakeLists.txt deleted file mode 100644 index 090b2401d0..0000000000 --- a/gnuradio-core/src/examples/pfb/CMakeLists.txt +++ /dev/null @@ -1,41 +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 - channelize.py - chirp_channelize.py - decimate.py - fmtest.py - interpolate.py - resampler.py - synth_filter.py - synth_to_chan.py - reconstruction.py - DESTINATION ${GR_PKG_DATA_DIR}/examples/pfb - COMPONENT "core_python" -) - -install( - FILES - resampler_demo.grc - DESTINATION ${GR_PKG_DATA_DIR}/examples/pfb - COMPONENT "core_python" -) diff --git a/gnuradio-core/src/examples/pfb/channelize.py b/gnuradio-core/src/examples/pfb/channelize.py deleted file mode 100755 index 442f263f47..0000000000 --- a/gnuradio-core/src/examples/pfb/channelize.py +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, blks2 -import sys, time - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab - from pylab import mlab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -class pfb_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - self._N = 2000000 # number of samples to use - self._fs = 9000 # initial sampling rate - self._M = 9 # Number of channels to channelize - - # Create a set of taps for the PFB channelizer - self._taps = gr.firdes.low_pass_2(1, self._fs, 475.50, 50, - attenuation_dB=100, window=gr.firdes.WIN_BLACKMAN_hARRIS) - - # Calculate the number of taps per channel for our own information - tpc = scipy.ceil(float(len(self._taps)) / float(self._M)) - print "Number of taps: ", len(self._taps) - print "Number of channels: ", self._M - print "Taps per channel: ", tpc - - # Create a set of signals at different frequencies - # freqs lists the frequencies of the signals that get stored - # in the list "signals", which then get summed together - self.signals = list() - self.add = gr.add_cc() - freqs = [-4070, -3050, -2030, -1010, 10, 1020, 2040, 3060, 4080] - for i in xrange(len(freqs)): - self.signals.append(gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freqs[i], 1)) - self.connect(self.signals[i], (self.add,i)) - - self.head = gr.head(gr.sizeof_gr_complex, self._N) - - # Construct the channelizer filter - self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps, 1) - - # Construct a vector sink for the input signal to the channelizer - self.snk_i = gr.vector_sink_c() - - # Connect the blocks - self.connect(self.add, self.head, self.pfb) - self.connect(self.add, self.snk_i) - - # Use this to play with the channel mapping - #self.pfb.set_channel_map([5,6,7,8,0,1,2,3,4]) - - # Create a vector sink for each of M output channels of the filter and connect it - self.snks = list() - for i in xrange(self._M): - self.snks.append(gr.vector_sink_c()) - self.connect((self.pfb, i), self.snks[i]) - - -def main(): - tstart = time.time() - - tb = pfb_top_block() - tb.run() - - tend = time.time() - print "Run time: %f" % (tend - tstart) - - if 1: - fig_in = pylab.figure(1, figsize=(16,9), facecolor="w") - fig1 = pylab.figure(2, figsize=(16,9), facecolor="w") - fig2 = pylab.figure(3, figsize=(16,9), facecolor="w") - - Ns = 1000 - Ne = 10000 - - fftlen = 8192 - winfunc = scipy.blackman - fs = tb._fs - - # Plot the input signal on its own figure - d = tb.snk_i.data()[Ns:Ne] - spin_f = fig_in.add_subplot(2, 1, 1) - - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_in = 10.0*scipy.log10(abs(X)) - f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) - pin_f = spin_f.plot(f_in, X_in, "b") - spin_f.set_xlim([min(f_in), max(f_in)+1]) - spin_f.set_ylim([-200.0, 50.0]) - - spin_f.set_title("Input Signal", weight="bold") - spin_f.set_xlabel("Frequency (Hz)") - spin_f.set_ylabel("Power (dBW)") - - - Ts = 1.0/fs - Tmax = len(d)*Ts - - t_in = scipy.arange(0, Tmax, Ts) - x_in = scipy.array(d) - spin_t = fig_in.add_subplot(2, 1, 2) - pin_t = spin_t.plot(t_in, x_in.real, "b") - pin_t = spin_t.plot(t_in, x_in.imag, "r") - - spin_t.set_xlabel("Time (s)") - spin_t.set_ylabel("Amplitude") - - Ncols = int(scipy.floor(scipy.sqrt(tb._M))) - Nrows = int(scipy.floor(tb._M / Ncols)) - if(tb._M % Ncols != 0): - Nrows += 1 - - # Plot each of the channels outputs. Frequencies on Figure 2 and - # time signals on Figure 3 - fs_o = tb._fs / tb._M - Ts_o = 1.0/fs_o - Tmax_o = len(d)*Ts_o - for i in xrange(len(tb.snks)): - # remove issues with the transients at the beginning - # also remove some corruption at the end of the stream - # this is a bug, probably due to the corner cases - d = tb.snks[i].data()[Ns:Ne] - - sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i) - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_o = 10.0*scipy.log10(abs(X)) - f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size)) - p2_f = sp1_f.plot(f_o, X_o, "b") - sp1_f.set_xlim([min(f_o), max(f_o)+1]) - sp1_f.set_ylim([-200.0, 50.0]) - - sp1_f.set_title(("Channel %d" % i), weight="bold") - sp1_f.set_xlabel("Frequency (Hz)") - sp1_f.set_ylabel("Power (dBW)") - - x_o = scipy.array(d) - t_o = scipy.arange(0, Tmax_o, Ts_o) - sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i) - p2_o = sp2_o.plot(t_o, x_o.real, "b") - p2_o = sp2_o.plot(t_o, x_o.imag, "r") - sp2_o.set_xlim([min(t_o), max(t_o)+1]) - sp2_o.set_ylim([-2, 2]) - - sp2_o.set_title(("Channel %d" % i), weight="bold") - sp2_o.set_xlabel("Time (s)") - sp2_o.set_ylabel("Amplitude") - - pylab.show() - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gnuradio-core/src/examples/pfb/chirp_channelize.py b/gnuradio-core/src/examples/pfb/chirp_channelize.py deleted file mode 100755 index 1c485ea9dd..0000000000 --- a/gnuradio-core/src/examples/pfb/chirp_channelize.py +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, blks2 -import sys, time - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab - from pylab import mlab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -class pfb_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - self._N = 200000 # number of samples to use - self._fs = 9000 # initial sampling rate - self._M = 9 # Number of channels to channelize - - # Create a set of taps for the PFB channelizer - self._taps = gr.firdes.low_pass_2(1, self._fs, 500, 20, - attenuation_dB=10, window=gr.firdes.WIN_BLACKMAN_hARRIS) - - # Calculate the number of taps per channel for our own information - tpc = scipy.ceil(float(len(self._taps)) / float(self._M)) - print "Number of taps: ", len(self._taps) - print "Number of channels: ", self._M - print "Taps per channel: ", tpc - - repeated = True - if(repeated): - self.vco_input = gr.sig_source_f(self._fs, gr.GR_SIN_WAVE, 0.25, 110) - else: - amp = 100 - data = scipy.arange(0, amp, amp/float(self._N)) - self.vco_input = gr.vector_source_f(data, False) - - # Build a VCO controlled by either the sinusoid or single chirp tone - # Then convert this to a complex signal - self.vco = gr.vco_f(self._fs, 225, 1) - self.f2c = gr.float_to_complex() - - self.head = gr.head(gr.sizeof_gr_complex, self._N) - - # Construct the channelizer filter - self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps) - - # Construct a vector sink for the input signal to the channelizer - self.snk_i = gr.vector_sink_c() - - # Connect the blocks - self.connect(self.vco_input, self.vco, self.f2c) - self.connect(self.f2c, self.head, self.pfb) - self.connect(self.f2c, self.snk_i) - - # Create a vector sink for each of M output channels of the filter and connect it - self.snks = list() - for i in xrange(self._M): - self.snks.append(gr.vector_sink_c()) - self.connect((self.pfb, i), self.snks[i]) - - -def main(): - tstart = time.time() - - tb = pfb_top_block() - tb.run() - - tend = time.time() - print "Run time: %f" % (tend - tstart) - - if 1: - fig_in = pylab.figure(1, figsize=(16,9), facecolor="w") - fig1 = pylab.figure(2, figsize=(16,9), facecolor="w") - fig2 = pylab.figure(3, figsize=(16,9), facecolor="w") - fig3 = pylab.figure(4, figsize=(16,9), facecolor="w") - - Ns = 650 - Ne = 20000 - - fftlen = 8192 - winfunc = scipy.blackman - fs = tb._fs - - # Plot the input signal on its own figure - d = tb.snk_i.data()[Ns:Ne] - spin_f = fig_in.add_subplot(2, 1, 1) - - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) - pin_f = spin_f.plot(f_in, X_in, "b") - spin_f.set_xlim([min(f_in), max(f_in)+1]) - spin_f.set_ylim([-200.0, 50.0]) - - spin_f.set_title("Input Signal", weight="bold") - spin_f.set_xlabel("Frequency (Hz)") - spin_f.set_ylabel("Power (dBW)") - - - Ts = 1.0/fs - Tmax = len(d)*Ts - - t_in = scipy.arange(0, Tmax, Ts) - x_in = scipy.array(d) - spin_t = fig_in.add_subplot(2, 1, 2) - pin_t = spin_t.plot(t_in, x_in.real, "b") - pin_t = spin_t.plot(t_in, x_in.imag, "r") - - spin_t.set_xlabel("Time (s)") - spin_t.set_ylabel("Amplitude") - - Ncols = int(scipy.floor(scipy.sqrt(tb._M))) - Nrows = int(scipy.floor(tb._M / Ncols)) - if(tb._M % Ncols != 0): - Nrows += 1 - - # Plot each of the channels outputs. Frequencies on Figure 2 and - # time signals on Figure 3 - fs_o = tb._fs / tb._M - Ts_o = 1.0/fs_o - Tmax_o = len(d)*Ts_o - for i in xrange(len(tb.snks)): - # remove issues with the transients at the beginning - # also remove some corruption at the end of the stream - # this is a bug, probably due to the corner cases - d = tb.snks[i].data()[Ns:Ne] - - sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i) - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_o = 10.0*scipy.log10(abs(X)) - f_o = freq - p2_f = sp1_f.plot(f_o, X_o, "b") - sp1_f.set_xlim([min(f_o), max(f_o)+1]) - sp1_f.set_ylim([-200.0, 50.0]) - - sp1_f.set_title(("Channel %d" % i), weight="bold") - sp1_f.set_xlabel("Frequency (Hz)") - sp1_f.set_ylabel("Power (dBW)") - - x_o = scipy.array(d) - t_o = scipy.arange(0, Tmax_o, Ts_o) - sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i) - p2_o = sp2_o.plot(t_o, x_o.real, "b") - p2_o = sp2_o.plot(t_o, x_o.imag, "r") - sp2_o.set_xlim([min(t_o), max(t_o)+1]) - sp2_o.set_ylim([-2, 2]) - - sp2_o.set_title(("Channel %d" % i), weight="bold") - sp2_o.set_xlabel("Time (s)") - sp2_o.set_ylabel("Amplitude") - - - sp3 = fig3.add_subplot(1,1,1) - p3 = sp3.plot(t_o, x_o.real) - sp3.set_xlim([min(t_o), max(t_o)+1]) - sp3.set_ylim([-2, 2]) - - sp3.set_title("All Channels") - sp3.set_xlabel("Time (s)") - sp3.set_ylabel("Amplitude") - - pylab.show() - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gnuradio-core/src/examples/pfb/decimate.py b/gnuradio-core/src/examples/pfb/decimate.py deleted file mode 100755 index 5322d746db..0000000000 --- a/gnuradio-core/src/examples/pfb/decimate.py +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, blks2 -import sys, time - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab - from pylab import mlab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -class pfb_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - self._N = 10000000 # number of samples to use - self._fs = 10000 # initial sampling rate - self._decim = 20 # Decimation rate - - # Generate the prototype filter taps for the decimators with a 200 Hz bandwidth - self._taps = gr.firdes.low_pass_2(1, self._fs, 200, 150, - attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS) - - # Calculate the number of taps per channel for our own information - tpc = scipy.ceil(float(len(self._taps)) / float(self._decim)) - print "Number of taps: ", len(self._taps) - print "Number of filters: ", self._decim - print "Taps per channel: ", tpc - - # Build the input signal source - # We create a list of freqs, and a sine wave is generated and added to the source - # for each one of these frequencies. - self.signals = list() - self.add = gr.add_cc() - freqs = [10, 20, 2040] - for i in xrange(len(freqs)): - self.signals.append(gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freqs[i], 1)) - self.connect(self.signals[i], (self.add,i)) - - self.head = gr.head(gr.sizeof_gr_complex, self._N) - - # Construct a PFB decimator filter - self.pfb = blks2.pfb_decimator_ccf(self._decim, self._taps, 0) - - # Construct a standard FIR decimating filter - self.dec = gr.fir_filter_ccf(self._decim, self._taps) - - self.snk_i = gr.vector_sink_c() - - # Connect the blocks - self.connect(self.add, self.head, self.pfb) - self.connect(self.add, self.snk_i) - - # Create the sink for the decimated siganl - self.snk = gr.vector_sink_c() - self.connect(self.pfb, self.snk) - - -def main(): - tb = pfb_top_block() - - tstart = time.time() - tb.run() - tend = time.time() - print "Run time: %f" % (tend - tstart) - - if 1: - fig1 = pylab.figure(1, figsize=(16,9)) - fig2 = pylab.figure(2, figsize=(16,9)) - - Ns = 10000 - Ne = 10000 - - fftlen = 8192 - winfunc = scipy.blackman - fs = tb._fs - - # Plot the input to the decimator - - d = tb.snk_i.data()[Ns:Ns+Ne] - sp1_f = fig1.add_subplot(2, 1, 1) - - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) - p1_f = sp1_f.plot(f_in, X_in, "b") - sp1_f.set_xlim([min(f_in), max(f_in)+1]) - sp1_f.set_ylim([-200.0, 50.0]) - - sp1_f.set_title("Input Signal", weight="bold") - sp1_f.set_xlabel("Frequency (Hz)") - sp1_f.set_ylabel("Power (dBW)") - - Ts = 1.0/fs - Tmax = len(d)*Ts - - t_in = scipy.arange(0, Tmax, Ts) - x_in = scipy.array(d) - sp1_t = fig1.add_subplot(2, 1, 2) - p1_t = sp1_t.plot(t_in, x_in.real, "b") - p1_t = sp1_t.plot(t_in, x_in.imag, "r") - sp1_t.set_ylim([-tb._decim*1.1, tb._decim*1.1]) - - sp1_t.set_xlabel("Time (s)") - sp1_t.set_ylabel("Amplitude") - - - # Plot the output of the decimator - fs_o = tb._fs / tb._decim - - sp2_f = fig2.add_subplot(2, 1, 1) - d = tb.snk.data()[Ns:Ns+Ne] - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size)) - p2_f = sp2_f.plot(f_o, X_o, "b") - sp2_f.set_xlim([min(f_o), max(f_o)+1]) - sp2_f.set_ylim([-200.0, 50.0]) - - sp2_f.set_title("PFB Decimated Signal", weight="bold") - sp2_f.set_xlabel("Frequency (Hz)") - sp2_f.set_ylabel("Power (dBW)") - - - Ts_o = 1.0/fs_o - Tmax_o = len(d)*Ts_o - - x_o = scipy.array(d) - t_o = scipy.arange(0, Tmax_o, Ts_o) - sp2_t = fig2.add_subplot(2, 1, 2) - p2_t = sp2_t.plot(t_o, x_o.real, "b-o") - p2_t = sp2_t.plot(t_o, x_o.imag, "r-o") - sp2_t.set_ylim([-2.5, 2.5]) - - sp2_t.set_xlabel("Time (s)") - sp2_t.set_ylabel("Amplitude") - - pylab.show() - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gnuradio-core/src/examples/pfb/fmtest.py b/gnuradio-core/src/examples/pfb/fmtest.py deleted file mode 100755 index b9dd9b3823..0000000000 --- a/gnuradio-core/src/examples/pfb/fmtest.py +++ /dev/null @@ -1,225 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, blks2 -import sys, math, time - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - - -class fmtx(gr.hier_block2): - def __init__(self, lo_freq, audio_rate, if_rate): - - gr.hier_block2.__init__(self, "build_fm", - gr.io_signature(1, 1, gr.sizeof_float), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - 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 (self, fmtx, (mixer, 0)) - self.connect (lo, (mixer, 1)) - self.connect (mixer, self) - -class fmtest(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - self._nsamples = 1000000 - self._audio_rate = 8000 - - # Set up N channels with their own baseband and IF frequencies - self._N = 5 - chspacing = 16000 - freq = [10, 20, 30, 40, 50] - f_lo = [0, 1*chspacing, -1*chspacing, 2*chspacing, -2*chspacing] - - self._if_rate = 4*self._N*self._audio_rate - - # Create a signal source and frequency modulate it - self.sum = gr.add_cc () - for n in xrange(self._N): - sig = gr.sig_source_f(self._audio_rate, gr.GR_SIN_WAVE, freq[n], 0.5) - fm = fmtx(f_lo[n], self._audio_rate, self._if_rate) - self.connect(sig, fm) - self.connect(fm, (self.sum, n)) - - self.head = gr.head(gr.sizeof_gr_complex, self._nsamples) - self.snk_tx = gr.vector_sink_c() - self.channel = blks2.channel_model(0.1) - - self.connect(self.sum, self.head, self.channel, self.snk_tx) - - - # Design the channlizer - self._M = 10 - bw = chspacing/2.0 - t_bw = chspacing/10.0 - self._chan_rate = self._if_rate / self._M - self._taps = gr.firdes.low_pass_2(1, self._if_rate, bw, t_bw, - attenuation_dB=100, - window=gr.firdes.WIN_BLACKMAN_hARRIS) - tpc = math.ceil(float(len(self._taps)) / float(self._M)) - - print "Number of taps: ", len(self._taps) - print "Number of channels: ", self._M - print "Taps per channel: ", tpc - - self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps) - - self.connect(self.channel, self.pfb) - - # Create a file sink for each of M output channels of the filter and connect it - self.fmdet = list() - self.squelch = list() - self.snks = list() - for i in xrange(self._M): - self.fmdet.append(blks2.nbfm_rx(self._audio_rate, self._chan_rate)) - self.squelch.append(blks2.standard_squelch(self._audio_rate*10)) - self.snks.append(gr.vector_sink_f()) - self.connect((self.pfb, i), self.fmdet[i], self.squelch[i], self.snks[i]) - - def num_tx_channels(self): - return self._N - - def num_rx_channels(self): - return self._M - -def main(): - - fm = fmtest() - - tstart = time.time() - fm.run() - tend = time.time() - - if 1: - fig1 = pylab.figure(1, figsize=(12,10), facecolor="w") - fig2 = pylab.figure(2, figsize=(12,10), facecolor="w") - fig3 = pylab.figure(3, figsize=(12,10), facecolor="w") - - Ns = 10000 - Ne = 100000 - - fftlen = 8192 - winfunc = scipy.blackman - - # Plot transmitted signal - fs = fm._if_rate - - d = fm.snk_tx.data()[Ns:Ns+Ne] - sp1_f = fig1.add_subplot(2, 1, 1) - - X,freq = sp1_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - visible=False) - X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) - p1_f = sp1_f.plot(f_in, X_in, "b") - sp1_f.set_xlim([min(f_in), max(f_in)+1]) - sp1_f.set_ylim([-120.0, 20.0]) - - sp1_f.set_title("Input Signal", weight="bold") - sp1_f.set_xlabel("Frequency (Hz)") - sp1_f.set_ylabel("Power (dBW)") - - Ts = 1.0/fs - Tmax = len(d)*Ts - - t_in = scipy.arange(0, Tmax, Ts) - x_in = scipy.array(d) - sp1_t = fig1.add_subplot(2, 1, 2) - p1_t = sp1_t.plot(t_in, x_in.real, "b-o") - #p1_t = sp1_t.plot(t_in, x_in.imag, "r-o") - sp1_t.set_ylim([-5, 5]) - - # Set up the number of rows and columns for plotting the subfigures - Ncols = int(scipy.floor(scipy.sqrt(fm.num_rx_channels()))) - Nrows = int(scipy.floor(fm.num_rx_channels() / Ncols)) - if(fm.num_rx_channels() % Ncols != 0): - Nrows += 1 - - # Plot each of the channels outputs. Frequencies on Figure 2 and - # time signals on Figure 3 - fs_o = fm._audio_rate - for i in xrange(len(fm.snks)): - # remove issues with the transients at the beginning - # also remove some corruption at the end of the stream - # this is a bug, probably due to the corner cases - d = fm.snks[i].data()[Ns:Ne] - - sp2_f = fig2.add_subplot(Nrows, Ncols, 1+i) - X,freq = sp2_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o, - window = lambda d: d*winfunc(fftlen), - visible=False) - #X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - X_o = 10.0*scipy.log10(abs(X)) - #f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size)) - f_o = scipy.arange(0, fs_o/2.0, fs_o/2.0/float(X_o.size)) - p2_f = sp2_f.plot(f_o, X_o, "b") - sp2_f.set_xlim([min(f_o), max(f_o)+0.1]) - sp2_f.set_ylim([-120.0, 20.0]) - sp2_f.grid(True) - - sp2_f.set_title(("Channel %d" % i), weight="bold") - sp2_f.set_xlabel("Frequency (kHz)") - sp2_f.set_ylabel("Power (dBW)") - - - Ts = 1.0/fs_o - Tmax = len(d)*Ts - t_o = scipy.arange(0, Tmax, Ts) - - x_t = scipy.array(d) - sp2_t = fig3.add_subplot(Nrows, Ncols, 1+i) - p2_t = sp2_t.plot(t_o, x_t.real, "b") - p2_t = sp2_t.plot(t_o, x_t.imag, "r") - sp2_t.set_xlim([min(t_o), max(t_o)+1]) - sp2_t.set_ylim([-1, 1]) - - sp2_t.set_xlabel("Time (s)") - sp2_t.set_ylabel("Amplitude") - - - pylab.show() - - -if __name__ == "__main__": - main() diff --git a/gnuradio-core/src/examples/pfb/interpolate.py b/gnuradio-core/src/examples/pfb/interpolate.py deleted file mode 100755 index 98068f220b..0000000000 --- a/gnuradio-core/src/examples/pfb/interpolate.py +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, blks2 -import sys, time - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab - from pylab import mlab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -class pfb_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - self._N = 100000 # number of samples to use - self._fs = 2000 # initial sampling rate - self._interp = 5 # Interpolation rate for PFB interpolator - self._ainterp = 5.5 # Resampling rate for the PFB arbitrary resampler - - # Frequencies of the signals we construct - freq1 = 100 - freq2 = 200 - - # Create a set of taps for the PFB interpolator - # This is based on the post-interpolation sample rate - self._taps = gr.firdes.low_pass_2(self._interp, self._interp*self._fs, freq2+50, 50, - attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS) - - # Create a set of taps for the PFB arbitrary resampler - # The filter size is the number of filters in the filterbank; 32 will give very low side-lobes, - # and larger numbers will reduce these even farther - # The taps in this filter are based on a sampling rate of the filter size since it acts - # internally as an interpolator. - flt_size = 32 - self._taps2 = gr.firdes.low_pass_2(flt_size, flt_size*self._fs, freq2+50, 150, - attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS) - - # Calculate the number of taps per channel for our own information - tpc = scipy.ceil(float(len(self._taps)) / float(self._interp)) - print "Number of taps: ", len(self._taps) - print "Number of filters: ", self._interp - print "Taps per channel: ", tpc - - # Create a couple of signals at different frequencies - self.signal1 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq1, 0.5) - self.signal2 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq2, 0.5) - self.signal = gr.add_cc() - - self.head = gr.head(gr.sizeof_gr_complex, self._N) - - # Construct the PFB interpolator filter - self.pfb = blks2.pfb_interpolator_ccf(self._interp, self._taps) - - # Construct the PFB arbitrary resampler filter - self.pfb_ar = blks2.pfb_arb_resampler_ccf(self._ainterp, self._taps2, flt_size) - self.snk_i = gr.vector_sink_c() - - #self.pfb_ar.pfb.print_taps() - #self.pfb.pfb.print_taps() - - # Connect the blocks - self.connect(self.signal1, self.head, (self.signal,0)) - self.connect(self.signal2, (self.signal,1)) - self.connect(self.signal, self.pfb) - self.connect(self.signal, self.pfb_ar) - self.connect(self.signal, self.snk_i) - - # Create the sink for the interpolated signals - self.snk1 = gr.vector_sink_c() - self.snk2 = gr.vector_sink_c() - self.connect(self.pfb, self.snk1) - self.connect(self.pfb_ar, self.snk2) - - -def main(): - tb = pfb_top_block() - - tstart = time.time() - tb.run() - tend = time.time() - print "Run time: %f" % (tend - tstart) - - - if 1: - fig1 = pylab.figure(1, figsize=(12,10), facecolor="w") - fig2 = pylab.figure(2, figsize=(12,10), facecolor="w") - fig3 = pylab.figure(3, figsize=(12,10), facecolor="w") - - Ns = 10000 - Ne = 10000 - - fftlen = 8192 - winfunc = scipy.blackman - - # Plot input signal - fs = tb._fs - - d = tb.snk_i.data()[Ns:Ns+Ne] - sp1_f = fig1.add_subplot(2, 1, 1) - - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) - p1_f = sp1_f.plot(f_in, X_in, "b") - sp1_f.set_xlim([min(f_in), max(f_in)+1]) - sp1_f.set_ylim([-200.0, 50.0]) - - - sp1_f.set_title("Input Signal", weight="bold") - sp1_f.set_xlabel("Frequency (Hz)") - sp1_f.set_ylabel("Power (dBW)") - - Ts = 1.0/fs - Tmax = len(d)*Ts - - t_in = scipy.arange(0, Tmax, Ts) - x_in = scipy.array(d) - sp1_t = fig1.add_subplot(2, 1, 2) - p1_t = sp1_t.plot(t_in, x_in.real, "b-o") - #p1_t = sp1_t.plot(t_in, x_in.imag, "r-o") - sp1_t.set_ylim([-2.5, 2.5]) - - sp1_t.set_title("Input Signal", weight="bold") - sp1_t.set_xlabel("Time (s)") - sp1_t.set_ylabel("Amplitude") - - - # Plot output of PFB interpolator - fs_int = tb._fs*tb._interp - - sp2_f = fig2.add_subplot(2, 1, 1) - d = tb.snk1.data()[Ns:Ns+(tb._interp*Ne)] - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_o = scipy.arange(-fs_int/2.0, fs_int/2.0, fs_int/float(X_o.size)) - p2_f = sp2_f.plot(f_o, X_o, "b") - sp2_f.set_xlim([min(f_o), max(f_o)+1]) - sp2_f.set_ylim([-200.0, 50.0]) - - sp2_f.set_title("Output Signal from PFB Interpolator", weight="bold") - sp2_f.set_xlabel("Frequency (Hz)") - sp2_f.set_ylabel("Power (dBW)") - - Ts_int = 1.0/fs_int - Tmax = len(d)*Ts_int - - t_o = scipy.arange(0, Tmax, Ts_int) - x_o1 = scipy.array(d) - sp2_t = fig2.add_subplot(2, 1, 2) - p2_t = sp2_t.plot(t_o, x_o1.real, "b-o") - #p2_t = sp2_t.plot(t_o, x_o.imag, "r-o") - sp2_t.set_ylim([-2.5, 2.5]) - - sp2_t.set_title("Output Signal from PFB Interpolator", weight="bold") - sp2_t.set_xlabel("Time (s)") - sp2_t.set_ylabel("Amplitude") - - - # Plot output of PFB arbitrary resampler - fs_aint = tb._fs * tb._ainterp - - sp3_f = fig3.add_subplot(2, 1, 1) - d = tb.snk2.data()[Ns:Ns+(tb._interp*Ne)] - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_o = scipy.arange(-fs_aint/2.0, fs_aint/2.0, fs_aint/float(X_o.size)) - p3_f = sp3_f.plot(f_o, X_o, "b") - sp3_f.set_xlim([min(f_o), max(f_o)+1]) - sp3_f.set_ylim([-200.0, 50.0]) - - sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold") - sp3_f.set_xlabel("Frequency (Hz)") - sp3_f.set_ylabel("Power (dBW)") - - Ts_aint = 1.0/fs_aint - Tmax = len(d)*Ts_aint - - t_o = scipy.arange(0, Tmax, Ts_aint) - x_o2 = scipy.array(d) - sp3_f = fig3.add_subplot(2, 1, 2) - p3_f = sp3_f.plot(t_o, x_o2.real, "b-o") - p3_f = sp3_f.plot(t_o, x_o1.real, "m-o") - #p3_f = sp3_f.plot(t_o, x_o2.imag, "r-o") - sp3_f.set_ylim([-2.5, 2.5]) - - sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold") - sp3_f.set_xlabel("Time (s)") - sp3_f.set_ylabel("Amplitude") - - pylab.show() - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gnuradio-core/src/examples/pfb/reconstruction.py b/gnuradio-core/src/examples/pfb/reconstruction.py deleted file mode 100755 index 59910e4d6d..0000000000 --- a/gnuradio-core/src/examples/pfb/reconstruction.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env python - -import scipy, math, pylab -from scipy import fftpack -from gnuradio import gr, digital, blks2 - -fftlen = 8192 - -def main(): - N = 10000 - fs = 2000.0 - Ts = 1.0/fs - t = scipy.arange(0, N*Ts, Ts) - - # When playing with the number of channels, be careful about the filter - # specs and the channel map of the synthesizer set below. - nchans = 10 - - # Build the filter(s) - bw = 1000 - tb = 400 - proto_taps = gr.firdes.low_pass_2(1, nchans*fs, bw, tb, 80, - gr.firdes.WIN_BLACKMAN_hARRIS) - print "Filter length: ", len(proto_taps) - - - # Create a modulated signal - npwr = 0.01 - data = scipy.random.randint(0, 256, N) - rrc_taps = gr.firdes.root_raised_cosine(1, 2, 1, 0.35, 41) - - src = gr.vector_source_b(data.astype(scipy.uint8).tolist(), False) - mod = digital.bpsk_mod(samples_per_symbol=2) - chan = gr.channel_model(npwr) - rrc = gr.fft_filter_ccc(1, rrc_taps) - - # Split it up into pieces - channelizer = blks2.pfb_channelizer_ccf(nchans, proto_taps, 2) - - # Put the pieces back together again - syn_taps = [nchans*t for t in proto_taps] - synthesizer = gr.pfb_synthesizer_ccf(nchans, syn_taps, True) - src_snk = gr.vector_sink_c() - snk = gr.vector_sink_c() - - # Remap the location of the channels - # Can be done in synth or channelizer (watch out for rotattions in - # the channelizer) - synthesizer.set_channel_map([ 0, 1, 2, 3, 4, - 15, 16, 17, 18, 19]) - - tb = gr.top_block() - tb.connect(src, mod, chan, rrc, channelizer) - tb.connect(rrc, src_snk) - - vsnk = [] - for i in xrange(nchans): - tb.connect((channelizer,i), (synthesizer, i)) - - vsnk.append(gr.vector_sink_c()) - tb.connect((channelizer,i), vsnk[i]) - - tb.connect(synthesizer, snk) - tb.run() - - sin = scipy.array(src_snk.data()[1000:]) - sout = scipy.array(snk.data()[1000:]) - - - # Plot original signal - fs_in = nchans*fs - f1 = pylab.figure(1, figsize=(16,12), facecolor='w') - s11 = f1.add_subplot(2,2,1) - s11.psd(sin, NFFT=fftlen, Fs=fs_in) - s11.set_title("PSD of Original Signal") - s11.set_ylim([-200, -20]) - - s12 = f1.add_subplot(2,2,2) - s12.plot(sin.real[1000:1500], "o-b") - s12.plot(sin.imag[1000:1500], "o-r") - s12.set_title("Original Signal in Time") - - start = 1 - skip = 4 - s13 = f1.add_subplot(2,2,3) - s13.plot(sin.real[start::skip], sin.imag[start::skip], "o") - s13.set_title("Constellation") - s13.set_xlim([-2, 2]) - s13.set_ylim([-2, 2]) - - # Plot channels - nrows = int(scipy.sqrt(nchans)) - ncols = int(scipy.ceil(float(nchans)/float(nrows))) - - f2 = pylab.figure(2, figsize=(16,12), facecolor='w') - for n in xrange(nchans): - s = f2.add_subplot(nrows, ncols, n+1) - s.psd(vsnk[n].data(), NFFT=fftlen, Fs=fs_in) - s.set_title("Channel {0}".format(n)) - s.set_ylim([-200, -20]) - - # Plot reconstructed signal - fs_out = 2*nchans*fs - f3 = pylab.figure(3, figsize=(16,12), facecolor='w') - s31 = f3.add_subplot(2,2,1) - s31.psd(sout, NFFT=fftlen, Fs=fs_out) - s31.set_title("PSD of Reconstructed Signal") - s31.set_ylim([-200, -20]) - - s32 = f3.add_subplot(2,2,2) - s32.plot(sout.real[1000:1500], "o-b") - s32.plot(sout.imag[1000:1500], "o-r") - s32.set_title("Reconstructed Signal in Time") - - start = 2 - skip = 4 - s33 = f3.add_subplot(2,2,3) - s33.plot(sout.real[start::skip], sout.imag[start::skip], "o") - s33.set_title("Constellation") - s33.set_xlim([-2, 2]) - s33.set_ylim([-2, 2]) - - pylab.show() - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gnuradio-core/src/examples/pfb/resampler.py b/gnuradio-core/src/examples/pfb/resampler.py deleted file mode 100755 index 555938d281..0000000000 --- a/gnuradio-core/src/examples/pfb/resampler.py +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, blks2 -import sys - -try: - import scipy -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -class mytb(gr.top_block): - def __init__(self, fs_in, fs_out, fc, N=10000): - gr.top_block.__init__(self) - - rerate = float(fs_out) / float(fs_in) - print "Resampling from %f to %f by %f " %(fs_in, fs_out, rerate) - - # Creating our own taps - taps = gr.firdes.low_pass_2(32, 32, 0.25, 0.1, 80) - - self.src = gr.sig_source_c(fs_in, gr.GR_SIN_WAVE, fc, 1) - #self.src = gr.noise_source_c(gr.GR_GAUSSIAN, 1) - self.head = gr.head(gr.sizeof_gr_complex, N) - - # A resampler with our taps - self.resamp_0 = blks2.pfb_arb_resampler_ccf(rerate, taps, - flt_size=32) - - # A resampler that just needs a resampling rate. - # Filter is created for us and designed to cover - # entire bandwidth of the input signal. - # An optional atten=XX rate can be used here to - # specify the out-of-band rejection (default=80). - self.resamp_1 = blks2.pfb_arb_resampler_ccf(rerate) - - self.snk_in = gr.vector_sink_c() - self.snk_0 = gr.vector_sink_c() - self.snk_1 = gr.vector_sink_c() - - self.connect(self.src, self.head, self.snk_in) - self.connect(self.head, self.resamp_0, self.snk_0) - self.connect(self.head, self.resamp_1, self.snk_1) - -def main(): - fs_in = 8000 - fs_out = 20000 - fc = 1000 - N = 10000 - - tb = mytb(fs_in, fs_out, fc, N) - tb.run() - - - # Plot PSD of signals - nfftsize = 2048 - fig1 = pylab.figure(1, figsize=(10,10), facecolor="w") - sp1 = fig1.add_subplot(2,1,1) - sp1.psd(tb.snk_in.data(), NFFT=nfftsize, - noverlap=nfftsize/4, Fs = fs_in) - sp1.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0))) - sp1.set_xlim([-fs_in/2, fs_in/2]) - - sp2 = fig1.add_subplot(2,1,2) - sp2.psd(tb.snk_0.data(), NFFT=nfftsize, - noverlap=nfftsize/4, Fs = fs_out, - label="With our filter") - sp2.psd(tb.snk_1.data(), NFFT=nfftsize, - noverlap=nfftsize/4, Fs = fs_out, - label="With auto-generated filter") - sp2.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0))) - sp2.set_xlim([-fs_out/2, fs_out/2]) - sp2.legend() - - # Plot signals in time - Ts_in = 1.0/fs_in - Ts_out = 1.0/fs_out - t_in = scipy.arange(0, len(tb.snk_in.data())*Ts_in, Ts_in) - t_out = scipy.arange(0, len(tb.snk_0.data())*Ts_out, Ts_out) - - fig2 = pylab.figure(2, figsize=(10,10), facecolor="w") - sp21 = fig2.add_subplot(2,1,1) - sp21.plot(t_in, tb.snk_in.data()) - sp21.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0))) - sp21.set_xlim([t_in[100], t_in[200]]) - - sp22 = fig2.add_subplot(2,1,2) - sp22.plot(t_out, tb.snk_0.data(), - label="With our filter") - sp22.plot(t_out, tb.snk_1.data(), - label="With auto-generated filter") - sp22.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0))) - r = float(fs_out)/float(fs_in) - sp22.set_xlim([t_out[r * 100], t_out[r * 200]]) - sp22.legend() - - pylab.show() - -if __name__ == "__main__": - main() - diff --git a/gnuradio-core/src/examples/pfb/synth_filter.py b/gnuradio-core/src/examples/pfb/synth_filter.py deleted file mode 100755 index c0f7376ec0..0000000000 --- a/gnuradio-core/src/examples/pfb/synth_filter.py +++ /dev/null @@ -1,83 +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, blks2 -import sys - -try: - import scipy -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -def main(): - N = 1000000 - fs = 8000 - - freqs = [100, 200, 300, 400, 500] - nchans = 7 - - sigs = list() - for fi in freqs: - s = gr.sig_source_c(fs, gr.GR_SIN_WAVE, fi, 1) - sigs.append(s) - - taps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100) - print "Num. Taps = %d (taps per filter = %d)" % (len(taps), - len(taps)/nchans) - filtbank = gr.pfb_synthesizer_ccf(nchans, taps) - - head = gr.head(gr.sizeof_gr_complex, N) - snk = gr.vector_sink_c() - - tb = gr.top_block() - tb.connect(filtbank, head, snk) - - for i,si in enumerate(sigs): - tb.connect(si, (filtbank, i)) - - tb.run() - - if 1: - f1 = pylab.figure(1) - s1 = f1.add_subplot(1,1,1) - s1.plot(snk.data()[1000:]) - - fftlen = 2048 - f2 = pylab.figure(2) - s2 = f2.add_subplot(1,1,1) - winfunc = scipy.blackman - s2.psd(snk.data()[10000:], NFFT=fftlen, - Fs = nchans*fs, - noverlap=fftlen/4, - window = lambda d: d*winfunc(fftlen)) - - pylab.show() - -if __name__ == "__main__": - main() diff --git a/gnuradio-core/src/examples/pfb/synth_to_chan.py b/gnuradio-core/src/examples/pfb/synth_to_chan.py deleted file mode 100755 index 18b2e7b53f..0000000000 --- a/gnuradio-core/src/examples/pfb/synth_to_chan.py +++ /dev/null @@ -1,117 +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, blks2 -import sys - -try: - import scipy -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -def main(): - N = 1000000 - fs = 8000 - - freqs = [100, 200, 300, 400, 500] - nchans = 7 - - sigs = list() - fmtx = list() - for fi in freqs: - s = gr.sig_source_f(fs, gr.GR_SIN_WAVE, fi, 1) - fm = blks2.nbfm_tx (fs, 4*fs, max_dev=10000, tau=75e-6) - sigs.append(s) - fmtx.append(fm) - - syntaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100) - print "Synthesis Num. Taps = %d (taps per filter = %d)" % (len(syntaps), - len(syntaps)/nchans) - chtaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100) - print "Channelizer Num. Taps = %d (taps per filter = %d)" % (len(chtaps), - len(chtaps)/nchans) - filtbank = gr.pfb_synthesizer_ccf(nchans, syntaps) - channelizer = blks2.pfb_channelizer_ccf(nchans, chtaps) - - noise_level = 0.01 - head = gr.head(gr.sizeof_gr_complex, N) - noise = gr.noise_source_c(gr.GR_GAUSSIAN, noise_level) - addnoise = gr.add_cc() - snk_synth = gr.vector_sink_c() - - tb = gr.top_block() - - tb.connect(noise, (addnoise,0)) - tb.connect(filtbank, head, (addnoise, 1)) - tb.connect(addnoise, channelizer) - tb.connect(addnoise, snk_synth) - - snk = list() - for i,si in enumerate(sigs): - tb.connect(si, fmtx[i], (filtbank, i)) - - for i in xrange(nchans): - snk.append(gr.vector_sink_c()) - tb.connect((channelizer, i), snk[i]) - - tb.run() - - if 1: - channel = 1 - data = snk[channel].data()[1000:] - - f1 = pylab.figure(1) - s1 = f1.add_subplot(1,1,1) - s1.plot(data[10000:10200] ) - s1.set_title(("Output Signal from Channel %d" % channel)) - - fftlen = 2048 - winfunc = scipy.blackman - #winfunc = scipy.hamming - - f2 = pylab.figure(2) - s2 = f2.add_subplot(1,1,1) - s2.psd(data, NFFT=fftlen, - Fs = nchans*fs, - noverlap=fftlen/4, - window = lambda d: d*winfunc(fftlen)) - s2.set_title(("Output PSD from Channel %d" % channel)) - - f3 = pylab.figure(3) - s3 = f3.add_subplot(1,1,1) - s3.psd(snk_synth.data()[1000:], NFFT=fftlen, - Fs = nchans*fs, - noverlap=fftlen/4, - window = lambda d: d*winfunc(fftlen)) - s3.set_title("Output of Synthesis Filter") - - pylab.show() - -if __name__ == "__main__": - main() diff --git a/gnuradio-core/src/examples/tags/CMakeLists.txt b/gnuradio-core/src/examples/tags/CMakeLists.txt index 2d9dc20832..8975fd03aa 100644 --- a/gnuradio-core/src/examples/tags/CMakeLists.txt +++ b/gnuradio-core/src/examples/tags/CMakeLists.txt @@ -21,7 +21,6 @@ include(GrPython) GR_PYTHON_INSTALL(PROGRAMS test_file_tags.py - uhd_burst_detector.py DESTINATION ${GR_PKG_DATA_DIR}/examples/tags COMPONENT "core_python" ) diff --git a/gnuradio-core/src/examples/tags/uhd_burst_detector.py b/gnuradio-core/src/examples/tags/uhd_burst_detector.py deleted file mode 100755 index 512fc715d7..0000000000 --- a/gnuradio-core/src/examples/tags/uhd_burst_detector.py +++ /dev/null @@ -1,116 +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 eng_notation -from gnuradio import gr -from gnuradio import uhd -from gnuradio import window -from gnuradio.eng_option import eng_option -from gnuradio.gr import firdes -from optparse import OptionParser - -class uhd_burst_detector(gr.top_block): - def __init__(self, uhd_address, options): - - gr.top_block.__init__(self) - - self.uhd_addr = uhd_address - self.freq = options.freq - self.samp_rate = options.samp_rate - self.gain = options.gain - self.threshold = options.threshold - self.trigger = options.trigger - - self.uhd_src = uhd.single_usrp_source( - device_addr=self.uhd_addr, - stream_args=uhd.stream_args('fc32')) - - self.uhd_src.set_samp_rate(self.samp_rate) - self.uhd_src.set_center_freq(self.freq, 0) - self.uhd_src.set_gain(self.gain, 0) - - taps = firdes.low_pass_2(1, 1, 0.4, 0.1, 60) - self.chanfilt = gr.fir_filter_ccc(10, taps) - self.tagger = gr.burst_tagger(gr.sizeof_gr_complex) - - # Dummy signaler to collect a burst on known periods - data = 1000*[0,] + 1000*[1,] - self.signal = gr.vector_source_s(data, True) - - # Energy detector to get signal burst - ## use squelch to detect energy - self.det = gr.simple_squelch_cc(self.threshold, 0.01) - ## convert to mag squared (float) - self.c2m = gr.complex_to_mag_squared() - ## average to debounce - self.avg = gr.single_pole_iir_filter_ff(0.01) - ## rescale signal for conversion to short - self.scale = gr.multiply_const_ff(2**16) - ## signal input uses shorts - self.f2s = gr.float_to_short() - - # Use file sink burst tagger to capture bursts - self.fsnk = gr.tagged_file_sink(gr.sizeof_gr_complex, self.samp_rate) - - - ################################################## - # Connections - ################################################## - self.connect((self.uhd_src, 0), (self.tagger, 0)) - self.connect((self.tagger, 0), (self.fsnk, 0)) - - if self.trigger: - # Connect a dummy signaler to the burst tagger - self.connect((self.signal, 0), (self.tagger, 1)) - - else: - # Connect an energy detector signaler to the burst tagger - self.connect(self.uhd_src, self.det) - self.connect(self.det, self.c2m, self.avg, self.scale, self.f2s) - self.connect(self.f2s, (self.tagger, 1)) - - def set_samp_rate(self, samp_rate): - self.samp_rate = samp_rate - self.uhd_src_0.set_samp_rate(self.samp_rate) - -if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2", - help="select address of the device [default=%default]") - #parser.add_option("-A", "--antenna", default=None, - # help="select Rx Antenna (only on RFX-series boards)") - parser.add_option("-f", "--freq", type="eng_float", default=450e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=0, - help="set gain in dB [default=%default]") - parser.add_option("-R", "--samp-rate", type="eng_float", default=200000, - help="set USRP sample rate [default=%default]") - parser.add_option("-t", "--threshold", type="float", default=-60, - help="Set the detection power threshold (dBm) [default=%default") - parser.add_option("-T", "--trigger", action="store_true", default=False, - help="Use internal trigger instead of detector [default=%default]") - (options, args) = parser.parse_args() - - uhd_addr = options.address - - tb = uhd_burst_detector(uhd_addr, options) - tb.run() diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_math.py b/gnuradio-core/src/examples/volk_benchmark/volk_math.py index 1d8bf04cc0..753257c237 100755 --- a/gnuradio-core/src/examples/volk_benchmark/volk_math.py +++ b/gnuradio-core/src/examples/volk_benchmark/volk_math.py @@ -1,12 +1,18 @@ #!/usr/bin/env python from gnuradio import gr +from gnuradio import blocks import argparse from volk_test_funcs import * +try: + from gnuradio import blocks +except ImportError: + sys.stderr.write("This example requires gr-blocks.\n") + def multiply_const_cc(N): k = 3.3 - op = gr.multiply_const_cc(k) + op = blocks.multiply_const_cc(k) tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_gr_complex, 1, 1) return tb @@ -14,35 +20,35 @@ def multiply_const_cc(N): def multiply_const_ff(N): k = 3.3 - op = gr.multiply_const_ff(k) + op = blocks.multiply_const_ff(k) tb = helper(N, op, gr.sizeof_float, gr.sizeof_float, 1, 1) return tb ###################################################################### def multiply_cc(N): - op = gr.multiply_cc(1) + op = blocks.multiply_cc(1) tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_gr_complex, 2, 1) return tb ###################################################################### def multiply_ff(N): - op = gr.multiply_ff() + op = blocks.multiply_ff() tb = helper(N, op, gr.sizeof_float, gr.sizeof_float, 2, 1) return tb ###################################################################### def add_ff(N): - op = gr.add_ff() + op = blocks.add_ff() tb = helper(N, op, gr.sizeof_float, gr.sizeof_float, 2, 1) return tb ###################################################################### def conjugate_cc(N): - op = gr.conjugate_cc() + op = blocks.conjugate_cc() tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_gr_complex, 1, 1) return tb @@ -50,7 +56,7 @@ def conjugate_cc(N): def multiply_conjugate_cc(N): try: - op = gr.multiply_conjugate_cc() + op = blocks.multiply_conjugate_cc() tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_gr_complex, 2, 1) return tb @@ -60,8 +66,8 @@ def multiply_conjugate_cc(N): gr.hier_block2.__init__(self, "s", gr.io_signature(2, 2, gr.sizeof_gr_complex), gr.io_signature(1, 1, gr.sizeof_gr_complex)) - conj = gr.conjugate_cc() - mult = gr.multiply_cc() + conj = blocks.conjugate_cc() + mult = blocks.multiply_cc() self.connect((self,0), (mult,0)) self.connect((self,1), conj, (mult,1)) self.connect(mult, self) diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_types.py b/gnuradio-core/src/examples/volk_benchmark/volk_types.py index 5dac23c535..134a3db781 100755 --- a/gnuradio-core/src/examples/volk_benchmark/volk_types.py +++ b/gnuradio-core/src/examples/volk_benchmark/volk_types.py @@ -1,62 +1,49 @@ #!/usr/bin/env python from gnuradio import gr +from gnuradio import blocks import argparse from volk_test_funcs import * ###################################################################### def float_to_char(N): - op = gr.float_to_char() + op = blocks.float_to_char() tb = helper(N, op, gr.sizeof_float, gr.sizeof_char, 1, 1) return tb ###################################################################### def float_to_int(N): - op = gr.float_to_int() + op = blocks.float_to_int() tb = helper(N, op, gr.sizeof_float, gr.sizeof_int, 1, 1) return tb ###################################################################### def float_to_short(N): - op = gr.float_to_short() + op = blocks.float_to_short() tb = helper(N, op, gr.sizeof_float, gr.sizeof_short, 1, 1) return tb ###################################################################### def short_to_float(N): - op = gr.short_to_float() + op = blocks.short_to_float() tb = helper(N, op, gr.sizeof_short, gr.sizeof_float, 1, 1) return tb ###################################################################### def short_to_char(N): - op = gr.short_to_char() + op = blocks.short_to_char() tb = helper(N, op, gr.sizeof_short, gr.sizeof_char, 1, 1) return tb ###################################################################### -def char_to_short(N): - op = gr.char_to_short() - tb = helper(N, op, gr.sizeof_char, gr.sizeof_short, 1, 1) - return tb - -###################################################################### - -def char_to_float(N): - op = gr.char_to_float() - tb = helper(N, op, gr.sizeof_char, gr.sizeof_float, 1, 1) - return tb - -###################################################################### - def int_to_float(N): - op = gr.int_to_float() + op = blocks.int_to_float() tb = helper(N, op, gr.sizeof_int, gr.sizeof_float, 1, 1) return tb diff --git a/gnuradio-core/src/gen_interpolator_taps/Makefile.am.obsolete b/gnuradio-core/src/gen_interpolator_taps/Makefile.am.obsolete deleted file mode 100644 index cd0edaf5c4..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/Makefile.am.obsolete +++ /dev/null @@ -1,39 +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. -# - -include $(top_srcdir)/Makefile.common - -EXTRA_DIST += \ - praxis.txt \ - simpson.h \ - objective_fct.c \ - gen_interpolator_taps.c \ - simpson.c \ - praxis.f - -# if ENABLE_FORTRAN -# noinst_PROGRAMS = gen_interpolator_taps -# noinst_HEADERS = simpson.h -# -# gen_interpolator_taps_SOURCES = gen_interpolator_taps.c objective_fct.c simpson.c praxis.f -# gen_interpolator_taps_LDADD = $(FLIBS) -lm -# -# endif diff --git a/gnuradio-core/src/gen_interpolator_taps/README b/gnuradio-core/src/gen_interpolator_taps/README deleted file mode 100644 index 8fe3e2ba32..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/README +++ /dev/null @@ -1,47 +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 file contains the source for gen_interpolator_taps, a program -which generates optimal interpolator taps for a fractional -interpolator. - -The ideal interpolator requires an infinite tap FIR filter to -realize. We design a separate 8 tap filter for each value of mu, -the fractional delay, that we are interested in. The taps are -selected such that the mean squared error between the ideal frequency -response and the approximation is mininimized over all frequencies of -interest. In this implementation we define ``frequencies of -interest'' as those from -B to +B, where B = 1/(4*Ts), where Ts is the -sampling period. - -For a detailed look at what this is all about, please see Chapter 9 of -"Digital Communication Receivers: Synchronization, Channel Estimation -and Signal Processing" by Meyr, Moeneclaey and Fechtel, ISBN 0-471-50275-8 - -NOTE, if you're running gen_interpolator_taps and it seg faults in -RANDOM, you're probably using g77-2.96. The fix is to use g77 3.0 or later - - cd <top_of_build_tree> - rm config.cache - export F77=g77-3.0.4 - ./configure - make diff --git a/gnuradio-core/src/gen_interpolator_taps/gen_interpolator_taps.c b/gnuradio-core/src/gen_interpolator_taps/gen_interpolator_taps.c deleted file mode 100644 index 2f359102cf..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/gen_interpolator_taps.c +++ /dev/null @@ -1,186 +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 <stdio.h> -#include <unistd.h> -#include <stdlib.h> - -#define NSTEPS 10 // how many steps of mu are in the generated table -#define MAX_NSTEPS 256 -#define NTAPS 8 // # of taps in the interpolator -#define MAX_NTAPS 128 - -extern void initpt (double x[], int ntaps); -extern double objective (double x[], int *ntaps); -extern double global_mu; -extern double global_B; - -// fortran -extern double prax2_ (double (fct)(double x[], int *ntaps), - double initv[], int *ntaps, double result[]); - -static void -usage (char *name) -{ - fprintf (stderr, "usage: %s [-v] [-n <nsteps>] [-t <ntaps>] [-B <bw>]\n", name); - exit (1); -} - -static void -printline (double x[], int ntaps, int imu, int nsteps) -{ - int i; - - printf (" { "); - for (i = 0; i < ntaps; i++){ - printf ("%12.5e", x[i]); - if (i != ntaps - 1) - printf (", "); - else - printf (" }, // %3d/%d\n", imu, nsteps); - } -} - -int -main (int argc, char **argv) -{ - double xx[MAX_NSTEPS+1][MAX_NTAPS]; - int ntaps = NTAPS; - int nsteps = NSTEPS; - int i, j; - double result; - double step_size; - int c; - int verbose = 0; - - global_B = 0.25; - - while ((c = getopt (argc, argv, "n:t:B:v")) != EOF){ - switch (c){ - case 'n': - nsteps = strtol (optarg, 0, 0); - break; - - case 't': - ntaps = strtol (optarg, 0, 0); - break; - - case 'B': - global_B = strtod (optarg, 0); - break; - - case 'v': - verbose = 1; - break; - - default: - usage (argv[0]); - break; - } - } - - if ((nsteps & 1) != 0){ - fprintf (stderr, "%s: nsteps must be even\n", argv[0]); - exit (1); - } - - if (nsteps > MAX_NSTEPS){ - fprintf (stderr, "%s: nsteps must be < %d\n", argv[0], MAX_NSTEPS); - exit (1); - } - - if ((ntaps & 1) != 0){ - fprintf (stderr, "%s: ntaps must be even\n", argv[0]); - exit (1); - } - - if (nsteps > MAX_NTAPS){ - fprintf (stderr, "%s: ntaps must be < %d\n", argv[0], MAX_NTAPS); - exit (1); - } - - if (global_B < 0 || global_B > 0.5){ - fprintf (stderr, "%s: bandwidth must be in the range (0, 0.5)\n", argv[0]); - exit (1); - } - - step_size = 1.0/nsteps; - - // the optimizer chokes on the two easy cases (0/N and N/N). We do them by hand... - - for (i = 0; i < ntaps; i++) - xx[0][i] = 0.0; - xx[0][ntaps/2] = 1.0; - - - // compute optimal values for mu <= 0.5 - - for (j = 1; j <= nsteps/2; j++){ - - global_mu = j * step_size; // this determines the MU for which we're computing the taps - - // initialize X to a reasonable starting value - - initpt (&xx[j][0], ntaps); - - // find the value of X that minimizes the value of OBJECTIVE - - result = prax2_ (objective, &xx[j][0], &ntaps, &xx[j][0]); - - if (verbose){ - fprintf (stderr, "Mu: %10.8f\t", global_mu); - fprintf (stderr, "Objective: %g\n", result); - } - } - - // now compute remaining values via symmetry - - for (j = 0; j < nsteps/2; j++){ - for (i = 0; i < ntaps; i++){ - xx[nsteps - j][i] = xx[j][ntaps-i-1]; - } - } - - // now print out the table - - printf ("\ -/*\n\ - * This file was machine generated by gen_interpolator_taps.\n\ - * DO NOT EDIT BY HAND.\n\ - */\n\n"); - - - printf ("static const int NTAPS = %4d;\n", ntaps); - printf ("static const int NSTEPS = %4d;\n", nsteps); - printf ("static const double BANDWIDTH = %g;\n\n", global_B); - - printf ("static const float taps[NSTEPS+1][NTAPS] = {\n"); - printf (" // -4 -3 -2 -1 0 1 2 3 mu\n"); - - - for (i = 0; i <= nsteps; i++) - printline (xx[i], ntaps, i, nsteps); - - printf ("};\n\n"); - - return 0; -} diff --git a/gnuradio-core/src/gen_interpolator_taps/objective_fct.c b/gnuradio-core/src/gen_interpolator_taps/objective_fct.c deleted file mode 100644 index 129486d634..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/objective_fct.c +++ /dev/null @@ -1,124 +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. - */ - -/* - * generate MMSE FIR interpolation table values - */ - -#include <math.h> -#include <assert.h> -#include "simpson.h" - -#define MU 0.5 /* the MU for which we're computing coeffs */ - -#define Ts (1.0) /* sampling period */ -#define B (1.0/(4*Ts)) /* one-sided signal bandwidth */ -//#define B (1.0/(8./3*Ts)) /* one-sided signal bandwidth */ - -static unsigned global_n; -static double *global_h; -double global_mu = MU; -double global_B = B; - -/* - * This function computes the difference squared between the ideal - * interpolator frequency response at frequency OMEGA and the - * approximation defined by the FIR coefficients in global_h[] - * - * See eqn (9-7), "Digital Communication Receivers", Meyr, Moeneclaey - * and Fechtel, Wiley, 1998. - */ - -static double -integrand (double omega) -{ - double real_ideal; - double real_approx; - double real_diff; - double imag_ideal; - double imag_approx; - double imag_diff; - - int i, n; - int I1; - double *h; - - real_ideal = cos (omega * Ts * global_mu); - imag_ideal = sin (omega * Ts * global_mu); - - n = global_n; - h = global_h; - I1 = -(n / 2); - - real_approx = 0; - imag_approx = 0; - - for (i = 0; i < n; i++){ - real_approx += h[i] * cos (-omega * Ts * (i + I1)); - imag_approx += h[i] * sin (-omega * Ts * (i + I1)); - } - - real_diff = real_ideal - real_approx; - imag_diff = imag_ideal - imag_approx; - - return real_diff * real_diff + imag_diff * imag_diff; -} - -/* - * Integrate the difference squared over all frequencies of interest. - */ -double -c_fcn (double *x, int n) -{ - assert ((n & 1) == 0); /* assert n is even */ - global_n = n; - global_h = x; - return qsimp (integrand, -2 * M_PI * global_B, 2 * M_PI * global_B); -} - -/* this is the interface expected by the calling fortran code */ - -double -objective (double x[], int *ndim) -{ - return c_fcn (x, *ndim); -} - -static double -si (double x) -{ - if (fabs (x) < 1e-9) - return 1.0; - - return sin(x) / x; -} - -/* - * starting guess for optimization - */ -void initpt (double x[], int ndim) -{ - int i; - for (i = 0; i < ndim; i++){ - x[i] = si (M_PI * ((double) (i - ndim/2) + global_mu)); - } -} diff --git a/gnuradio-core/src/gen_interpolator_taps/praxis.f b/gnuradio-core/src/gen_interpolator_taps/praxis.f deleted file mode 100644 index 9f3e03c977..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/praxis.f +++ /dev/null @@ -1,1705 +0,0 @@ -C -C Copyright 2002 Free Software Foundation, Inc. -C -C This file is part of GNU Radio -C -C GNU Radio is free software; you can redistribute it and/or modify -C it under the terms of the GNU General Public License as published by -C the Free Software Foundation; either version 3, or (at your option) -C any later version. -C -C GNU Radio is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with GNU Radio; see the file COPYING. If not, write to -C the Free Software Foundation, Inc., 51 Franklin Street, -C Boston, MA 02110-1301, USA. -C - DOUBLE PRECISION FUNCTION PRAX2(F,INITV,NDIM,OUT) - DOUBLE PRECISION INITV(128),OUT(128), F - INTEGER NDIM - EXTERNAL F -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - -C - N=NDIM - do 10 I=1,N - 10 X(I) = INITV(I) - -C - call praset - -C -1 produces no diagnostic output - jprint = -1 - nfmax = 3000 -C tighter tolerance - T=1.0D-6 -C - call praxis(f) -C - do 30 I=1,N - 30 OUT(I) = X(I) -C - prax2 = fx - return - end - - - SUBROUTINE PRASET -C -C PRASET 1.0 JUNE 1995 -C -C SET INITIAL VALUES FOR SOME QUANTITIES USED IN SUBROUTINE PRAXIS. -C THE USER CAN RESET THESE, IF DESIRED, -C AFTER CALLING PRASET AND BEFORE CALLING PRAXIS. -C -C J. P. CHANDLER, COMPUTER SCIENCE DEPARTMENT, -C OKLAHOMA STATE UNIVERSITY -C -C ON MANY MACHINES, SUBROUTINE PRAXIS WILL CAUSE UNDERFLOW AND/OR -C DIVIDE CHECK WHEN COMPUTING EPSMCH**4 AND EPSMCH**(-4). -C IN THAT CASE, SET EPSMCH=1.0D-9 (OR POSSIBLY EPSMCH=1.0D-8) -C AFTER CALLING SUBROUTINE PRASET. -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER J -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION A,B,XMID,XPLUS,RZERO,UNITR,RTWO -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - RZERO=0.0D0 - UNITR=1.0D0 - RTWO=2.0D0 -C -C NMAX IS THE DIMENSION OF THE ARRAYS V(*,*), X(*), D(*), -C Q0(*), AND Q1(*). -C - NMAX=128 -C -C NFMAX IS THE MAXIMUM NUMBER OF FUNCTION EVALUATIONS PERMITTED. -C - NFMAX=100000 -C -C LP IS THE LOGICAL UNIT NUMBER FOR PRINTED OUTPUT. -C - LP=6 -C -C T IS A CONVERGENCE TOLERANCE USED IN SUBROUTINE PRAXIS. -C - T=1.0D-5 -C -C JPRINT CONTROLS PRINTED OUTPUT IN PRAXIS. -C - JPRINT=4 -C -C H IS AN ESTIMATE OF THE DISTANCE FROM THE INITIAL POINT -C TO THE SOLUTION. -C - H=1.0D0 -C -C USE BISECTION TO COMPUTE THE VALUE OF EPSMCH, "MACHINE EPSILON". -C EPSMCH IS THE SMALLEST FLOATING POINT (REAL OR DOUBLE PRECISION) -C NUMBER WHICH, WHEN ADDED TO ONE, GIVES A RESULT GREATER THAN ONE. -C - A=RZERO - B=UNITR - 10 XMID=A+(B-A)/RTWO - IF(XMID.LE.A .OR. XMID.GE.B) GO TO 20 - XPLUS=UNITR+XMID - IF(XPLUS.GT.UNITR) THEN - B=XMID - ELSE - A=XMID - ENDIF - GO TO 10 -C - 20 EPSMCH=B -C - DO 30 J=1,NMAX - X(J)=RZERO - 30 CONTINUE -C -C JRANCH = 1 TO USE BRENT'S RANDOM, -C JRANCH = 2 TO USE FUNCTION DRANDM. -C - JRANCH=1 -C - CALL RANINI(4.0D0) -C -C DSEED IS AN INITIAL SEED FOR DRANDM, -C A SUBROUTINE THAT GENERATES PSEUDORANDOM NUMBERS -C UNIFORMLY DISTRIBUTED ON (0,1). -C - DSEED=1234567.0D0 -C -C SCBD IS AN UPPER BOUND ON THE SCALE FACTORS IN PRAXIS. -C IF THE AXES MAY BE BADLY SCALED (WHICH IS TO BE AVOIDED IF -C POSSIBLE) THEN SET SCBD = 10, OTHERWISE 1. -C - SCBD=1.0D0 -C -C ILLCIN IS THE INITIAL VALUE OF ILLC, -C THE FLAG THAT SIGNALS AN ILL-CONDITIONED PROBLEM. -C IF THE PROBLEM IS KNOWN TO BE ILL-CONDITIONED SET ILLCIN=1, -C OTHERWISE 0. -C - ILLCIN=0 -C -C KTM IS A CONVERGENCE SWITCH USED IN PRAXIS. -C KTM+1 IS THE NUMBER OF ITERATIONS WITHOUT IMPROVEMENT -C BEFORE THE ALGORITHM TERMINATES. -C KTM=4 IS VERY CAUTIOUS. -C USUALLY KTM=1 IS SATISFACTORY. -C - KTM=1 -C - RETURN -C -C END PRASET -C - END - SUBROUTINE PRAXIS(F) -C -C PRAXIS 2.0 JUNE 1995 -C -C THE PRAXIS PACKAGE MINIMIZES THE FUNCTION F(X,N) OF N -C VARIABLES X(1),...,X(N), USING THE PRINCIPAL AXIS METHOD. -C F MUST BE A SMOOTH (CONTINUOUSLY DIFFERENTIABLE) FUNCTION. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973 (ISBN 0-13-022335-2), -C PAGES 156-167 -C -C TRANSLATED FROM ALGOL W TO A.N.S.I. 1966 STANDARD BASIC FORTRAN -C BY ROSALEE TAYLOR AND SUE PINSKI, COMPUTER SCIENCE DEPARTMENT, -C OKLAHOMA STATE UNIVERSITY (DECEMBER 1973). -C -C UPDATED TO A.N.S.I. STANDARD FORTRAN 77 BY J. P. CHANDLER -C COMPUTER SCIENCE DEPARTMENT, OKLAHOMA STATE UNIVERSITY -C -C -C SUBROUTINE PRAXIS CALLS SUBPROGRAMS -C F, MINX, RANDOM (OR DRANDM), QUAD, MINFIT, SORT. -C -C SUBROUTINE QUAD CALLS MINX. -C -C SUBROUTINE MINX CALLS FLIN. -C -C SUBROUTINE FLIN CALLS F. -C -C -C INPUT QUANTITIES (SET IN THE CALLING PROGRAM)... -C -C F FUNCTION F(X,N) TO BE MINIMIZED -C -C X(*) INITIAL GUESS OF MINIMUM -C -C N DIMENSION OF X (NOTE... N MUST BE .GE. 2) -C -C H MAXIMUM STEP SIZE -C -C T TOLERANCE -C -C EPSMCH MACHINE PRECISION -C -C JPRINT PRINT SWITCH -C -C -C OUTPUT QUANTITIES... -C -C X(*) ESTIMATED POINT OF MINIMUM -C -C FX VALUE OF F AT X -C -C NL NUMBER OF LINEAR SEARCHES -C -C NF NUMBER OF FUNCTION EVALUATIONS -C -C V(*,*) EIGENVECTORS OF A -C NEW DIRECTIONS -C -C D(*) EIGENVALUES OF A -C NEW D -C -C Z(*) SCALE FACTORS -C -C -C ON ENTRY X(*) HOLDS A GUESS. ON RETURN IT HOLDS THE ESTIMATED -C POINT OF MINIMUM, WITH (HOPEFULLY) -C ABS(ERROR) LESS THAN SQRT(EPSMCH)*ABS(X) + T, WHERE -C EPSMCH IS THE MACHINE PRECISION, THE SMALLEST NUMBER SUCH THAT -C (1 + EPSMCH) IS GREATER THAN 1. -C -C T IS A TOLERANCE. -C -C H IS THE MAXIMUM STEP SIZE, SET TO ABOUT THE MAXIMUM EXPECTED -C DISTANCE FROM THE GUESS TO THE MINIMUM. IF H IS SET TOO -C SMALL OR TOO LARGE THEN THE INITIAL RATE OF CONVERGENCE WILL -C BE SLOW. -C -C THE USER SHOULD OBSERVE THE COMMENT ON HEURISTIC NUMBERS -C AT THE BEGINNING OF THE SUBROUTINE. -C -C JPRINT CONTROLS THE PRINTING OF INTERMEDIATE RESULTS. -C IT USES SUBROUTINES FLIN, MINX, QUAD, SORT, AND MINFIT. -C IF JPRINT = 1, F IS PRINTED AFTER EVERY N+1 OR N+2 LINEAR -C MINIMIZATIONS, AND FINAL X IS PRINTED, BUT INTERMEDIATE -C X ONLY IF N IS LESS THAN OR EQUAL TO 4. -C IF JPRINT = 2, EIGENVALUES OF A AND SCALE FACTORS ARE ALSO PRINTED. -C IF JPRINT = 3, F AND X ARE PRINTED AFTER EVERY FEW LINEAR -C MINIMIZATIONS. -C IF JPRINT = 4, EIGENVECTORS ARE ALSO PRINTED. -C IF JPRINT = 5, ADDITIONAL DEBUGGING INFORMATION IS ALSO PRINTED. -C -C RANDOM RETURNS A RANDOM NUMBER UNIFORMLY DISTRIBUTED IN (0, 1). -C -C THIS SUBROUTINE IS MACHINE-INDEPENDENT, APART FROM THE -C SPECIFICATION OF EPSMCH. WE ASSUME THAT EPSMCH**(-4) DOES NOT -C OVERFLOW (IF IT DOES THEN EPSMCH MUST BE INCREASED), AND THAT ON -C FLOATING-POINT UNDERFLOW THE RESULT IS SET TO ZERO. -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER ILLC,I,IK,IM,IMU,J,K,KL,KM1,KT,K2 -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION F, Y,Z,E, DABS,DSQRT,ZABS,ZSQRT,DRANDM, - * HUNDRD,HUNDTH,ONE,PT9,RHALF,TEN,TENTH,TWO,ZERO, - * DF,DLDFAC,DN,F1,XF,XL,T2,RANVAL,ARG, - * VLARGE,VSMALL,XLARGE,XLDS,FXVALU,F1VALU,S,SF,SL -C - EXTERNAL F -C - DIMENSION Y(128),Z(128),E(128) -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - ZABS(ARG)=DABS(ARG) - ZSQRT(ARG)=DSQRT(ARG) -C -C INITIALIZATION... -C - RHALF=0.5D0 - ONE=1.0D0 - TENTH=0.1D0 - HUNDTH=0.01D0 - HUNDRD=100.0D0 - ZERO=0.0D0 - PT9=0.9D0 - TEN=10.0D0 - TWO=2.0D0 -C -C MACHINE DEPENDENT NUMBERS... -C -C ON MANY COMPUTERS, VSMALL WILL UNDERFLOW, -C AND COMPUTING XLARGE MAY CAUSE A DIVISION BY ZERO. -C IN THAT CASE, EPSMCH SHOULD BE SET EQUAL TO 1.0D-9 -C (OR POSSIBLY 1.0D-8) BEFORE CALLING PRAXIS. -C - SMALL=EPSMCH*EPSMCH - VSMALL=SMALL*SMALL - XLARGE=ONE/SMALL - VLARGE=ONE/VSMALL - XM2=ZSQRT(EPSMCH) - XM4=ZSQRT(XM2) -C -C HEURISTIC NUMBERS... -C -C IF THE AXES MAY BE BADLY SCALED (WHICH IS TO BE AVOIDED IF -C POSSIBLE) THEN SET SCBD = 10, OTHERWISE 1. -C -C IF THE PROBLEM IS KNOWN TO BE ILL-CONDITIONED SET ILLC = 1, -C OTHERWISE 0. -C -C KTM+1 IS THE NUMBER OF ITERATIONS WITHOUT IMPROVEMENT -C BEFORE THE ALGORITHM TERMINATES. -C KTM=4 IS VERY CAUTIOUS. -C USUALLY KTM=1 IS SATISFACTORY. -C -C BRENT RECOMMENDED THE FOLLOWING VALUES FOR MOST PROBLEMS... -C -C SCBD=1.0 -C ILLC=0 -C KTM=1 -C -C SCBD, ILLCIN, AND KTM ARE NOW IN COMMON. -C THEY ARE INITIALIZED IN SUBROUTINE PRASET, -C AND CAN BE RESET BY THE USER AFTER CALLING PRASET. -C - ILLC=ILLCIN -C - IF(ILLC.EQ.1) THEN - DLDFAC=TENTH - ELSE - DLDFAC=HUNDTH - ENDIF -C - KT=0 - NL=0 - NF=1 - FX=F(X,N) - QF1=FX - T=SMALL+ZABS(T) - T2=T - DMIN=SMALL - IF(H.LT.HUNDRD*T) H=HUNDRD*T - XLDT=H -C - DO 20 I=1,N - DO 10 J=1,N - V(I,J)=ZERO - 10 CONTINUE - V(I,I)=ONE - 20 CONTINUE -C - QD0=ZERO - D(1)=ZERO -C -C Q0(*) AND Q1(*) ARE PREVIOUS X(*) POINTS, -C INITIALIZED IN PRAXIS, USED IN FLIN, -C AND CHANGED IN QUAD. -C - DO 30 I=1,N - Q1(I)=X(I) -C -C Q0(*) WAS NOT INITIALIZED IN BRENT'S ALGOL PROCEDURE. -C - Q0(I)=X(I) - 30 CONTINUE -C - IF(JPRINT.GT.0) THEN - WRITE(LP,40)NL,NF,FX - 40 FORMAT(/' NL =',I10,5X,'NF =',I10/5X,'FX =',1PG15.7) -C - IF(N.LE.4 .OR. JPRINT.GT.2) THEN - WRITE(LP,50)(X(I),I=1,N) - 50 FORMAT(/8X,'X'/(1X,1PG15.7,4G15.7)) - ENDIF - ENDIF -C -C MAIN LOOP... -C LABEL L0... -C - 60 SF=D(1) - S=ZERO - D(1)=ZERO -C -C MINIMIZE ALONG THE FIRST DIRECTION. -C - IF(JPRINT.GE.5) WRITE(LP,70)D(1),S,FX - 70 FORMAT(/' CALL NO. 1 TO MINX.'/ - * 5X,'D(1) =',1PG15.7,5X,'S =',G15.7,5X,'FX =',G15.7) -C - FXVALU=FX - CALL MINX(1,2,D(1),S,FXVALU,0,F) -C - IF(S.LE.ZERO) THEN - DO 80 I=1,N - V(I,1)=-V(I,1) - 80 CONTINUE - ENDIF -C - IF(SF.LE.PT9*D(1) .OR. PT9*SF.GE.D(1)) THEN -C - IF(N.GE.2) THEN - DO 90 I=2,N - D(I)=ZERO - 90 CONTINUE - ENDIF -C - ENDIF -C - IF(N.LT.2) GO TO 320 - DO 310 K=2,N -C - DO 100 I=1,N - Y(I)=X(I) - 100 CONTINUE -C - SF=FX - IF(KT.GT.0) ILLC=1 -C -C LABEL L1... -C - 110 KL=K - DF=ZERO -C - IF(ILLC.EQ.1) THEN -C -C TAKE A RANDOM STEP TO GET OUT OF A RESOLUTION VALLEY. -C -C PRAXIS ASSUMES THAT RANDOM (OR DRANDM) RETURNS -C A PSEUDORANDOM NUMBER UNIFORMLY DISTRIBUTED IN (0,1), -C AND THAT ANY INITIALIZATION OF THE RANDOM NUMBER GENERATOR -C HAS ALREADY BEEN DONE. -C - DO 130 I=1,N -C - IF(JRANCH.EQ.1) THEN - CALL RANDOM(RANVAL) - ELSE - RANVAL=DRANDM(DSEED) - ENDIF -C - S=(TENTH*XLDT+T2*TEN**KT)*(RANVAL-RHALF) - Z(I)=S -C - DO 120 J=1,N - X(J)=X(J)+S*V(J,I) - 120 CONTINUE - 130 CONTINUE -C - FX=F(X,N) - NF=NF+1 -C - IF(JPRINT.GE.1) WRITE(LP,140)NF,SF,FX - 140 FORMAT(/' ***** RANDOM STEP IN PRAXIS. NF =',I11/ - * 5X,'SF =',1PG15.7,5X,'FX =',G15.7) - ENDIF -C - IF(K.GT.N) GO TO 170 - DO 160 K2=K,N - SL=FX - S=ZERO -C -C MINIMIZE ALONG NON-CONJUGATE DIRECTIONS. -C - IF(JPRINT.GE.5) WRITE(LP,150)K2,D(K2),S,FX - 150 FORMAT(/' CALL NO. 2 TO MINX.'/ - * 5X,'K2 =',I4,5X,'D(K2) =',1PG15.7,5X, - * 'S =',G15.7/5X,'FX =',G15.7) -C - FXVALU=FX - CALL MINX(K2,2,D(K2),S,FXVALU,0,F) -C - IF(ILLC.EQ.1) THEN - S=D(K2)*(S+Z(K2))**2 - ELSE - S=SL-FX - ENDIF -C - IF(DF.LT.S) THEN - DF=S - KL=K2 - ENDIF - 160 CONTINUE -C - 170 IF(ILLC.EQ.0 .AND. DF.LT.ZABS(HUNDRD*EPSMCH*FX)) THEN -C -C NO SUCCESS WITH ILLC=0, SO TRY ONCE WITH ILLC=1 . -C - ILLC=1 -C -C GO TO L1. -C - GO TO 110 - ENDIF -C - IF(K.EQ.2 .AND. JPRINT.GT.1) THEN - WRITE(LP,180)(D(I),I=1,N) - 180 FORMAT(/' NEW D'/(1X,1PG15.7,4G15.7)) - ENDIF -C - KM1=K-1 - IF(KM1.LT.1) GO TO 210 - DO 200 K2=1,KM1 -C -C MINIMIZE ALONG CONJUGATE DIRECTIONS. -C - IF(JPRINT.GE.5) WRITE(LP,190)K2,D(K2),S,FX - 190 FORMAT(/' CALL NO. 3 TO MINX.'/ - * 5X,'K2 =',I4,5X,'D(K2) =',1PG15.7,5X, - * 'S =',G15.7/5X,'FX =',G15.7) -C - S=ZERO - FXVALU=FX - CALL MINX(K2,2,D(K2),S,FXVALU,0,F) - 200 CONTINUE -C - 210 F1=FX - FX=SF -C - XLDS=ZERO - DO 220 I=1,N - SL=X(I) - X(I)=Y(I) - SL=SL-Y(I) - Y(I)=SL - XLDS=XLDS+SL*SL - 220 CONTINUE -C - XLDS=ZSQRT(XLDS) - IF(XLDS.GT.SMALL) THEN -C -C THROW AWAY THE DIRECTION KL AND MINIMIZE ALONG -C THE NEW CONJUGATE DIRECTION. -C - IK=KL-1 - IF(K.GT.IK) GO TO 250 - DO 240 IM=K,IK - I=IK-IM+K -C - DO 230 J=1,N - V(J,I+1)=V(J,I) - 230 CONTINUE -C - D(I+1)=D(I) - 240 CONTINUE -C - 250 D(K)=ZERO -C - DO 260 I=1,N - V(I,K)=Y(I)/XLDS - 260 CONTINUE -C - IF(JPRINT.GE.5) WRITE(LP,270)K,D(K),XLDS,F1 - 270 FORMAT(/' CALL NO. 4 TO MINX.'/ - * 5X,'K =',I4,5X,'D(K) =',1PG15.7,5X, - * 'XLDS =',G15.7/5X,'F1 =',G15.7) -C - F1VALU=F1 - CALL MINX(K,4,D(K),XLDS,F1VALU,1,F) -C - IF(XLDS.LE.ZERO) THEN - XLDS=-XLDS -C - DO 280 I=1,N - V(I,K)=-V(I,K) - 280 CONTINUE - ENDIF - ENDIF -C - XLDT=DLDFAC*XLDT - IF(XLDT.LT.XLDS) XLDT=XLDS -C - IF(JPRINT.GT.0) THEN - WRITE(LP,40)NL,NF,FX - IF(N.LE.4 .OR. JPRINT.GT.2) THEN - WRITE(LP,50)(X(I),I=1,N) - ENDIF - ENDIF -C - T2=ZERO - DO 290 I=1,N - T2=T2+X(I)**2 - 290 CONTINUE - T2=XM2*ZSQRT(T2)+T -C -C SEE IF THE STEP LENGTH EXCEEDS HALF THE TOLERANCE. -C - IF(XLDT.GT.RHALF*T2) THEN - KT=0 - ELSE - KT=KT+1 - ENDIF -C -C IF(...) GO TO L2 -C - IF(KT.GT.KTM) GO TO 550 -C - IF(NF.GE.NFMAX) THEN - WRITE(LP,300)NFMAX - 300 FORMAT(/' IN PRAXIS, NF REACHED THE LIMIT NFMAX =',I11/ - * 5X,'THIS IS AN ABNORMAL TERMINATION.'/ - * 5X,'THE FUNCTION HAS NOT BEEN MINIMIZED AND', - * ' THE RESULTING X(*) VECTOR SHOULD NOT BE USED.') - GO TO 550 - ENDIF -C - 310 CONTINUE -C -C TRY QUADRATIC EXTRAPOLATION IN CASE WE ARE STUCK IN A CURVED VALLEY. -C - 320 CALL QUAD(F) -C - DN=ZERO - DO 330 I=1,N - D(I)=ONE/ZSQRT(D(I)) - IF(DN.LT.D(I)) DN=D(I) - 330 CONTINUE -C - IF(JPRINT.GT.3) THEN -C - WRITE(LP,340) - 340 FORMAT(/' NEW DIRECTIONS') -C - DO 360 I=1,N - WRITE(LP,350)I,(V(I,J),J=1,N) - 350 FORMAT(1X,I5,4X,1PG15.7,4G15.7/(10X,5G15.7)) - 360 CONTINUE - ENDIF -C - DO 380 J=1,N -C - S=D(J)/DN - DO 370 I=1,N - V(I,J)=S*V(I,J) - 370 CONTINUE - 380 CONTINUE -C - IF(SCBD.GT.ONE) THEN -C -C SCALE THE AXES TO TRY TO REDUCE THE CONDITION NUMBER. -C - S=VLARGE - DO 400 I=1,N -C - SL=ZERO - DO 390 J=1,N - SL=SL+V(I,J)**2 - 390 CONTINUE -C - Z(I)=ZSQRT(SL) - IF(Z(I).LT.XM4) Z(I)=XM4 - IF(S.GT.Z(I)) S=Z(I) - 400 CONTINUE -C - DO 410 I=1,N - SL=S/Z(I) - Z(I)=ONE/SL -C - IF(Z(I).GT.SCBD) THEN - SL=ONE/SCBD - Z(I)=SCBD - ENDIF -C -C IT APPEARS THAT THERE ARE TWO MISSING END; STATEMENTS -C AT THIS POINT IN BRENT'S LISTING. -C - 410 CONTINUE - ENDIF -C -C TRANSPOSE V FOR MINFIT. -C - IF(N.LT.2) GO TO 440 - DO 430 I=2,N -C - IMU=I-1 - DO 420 J=1,IMU - S=V(I,J) - V(I,J)=V(J,I) - V(J,I)=S - 420 CONTINUE - 430 CONTINUE -C -C FIND THE SINGULAR VALUE DECOMPOSITION OF V. -C THIS GIVES THE EIGENVALUES AND PRINCIPAL AXES -C OF THE APPROXIMATING QUADRATIC FORM -C WITHOUT SQUARING THE CONDITION NUMBER. -C - 440 CALL MINFIT(N,EPSMCH,VSMALL,V,D,E,NMAX,LP) -C - IF(SCBD.GT.ONE) THEN -C -C UNSCALING... -C - DO 460 I=1,N -C - S=Z(I) - DO 450 J=1,N - V(I,J)=S*V(I,J) - 450 CONTINUE - 460 CONTINUE -C - DO 490 I=1,N -C - S=ZERO - DO 470 J=1,N - S=S+V(J,I)**2 - 470 CONTINUE - S=ZSQRT(S) -C - D(I)=S*D(I) -C - S=ONE/S - DO 480 J=1,N - V(J,I)=S*V(J,I) - 480 CONTINUE - 490 CONTINUE - ENDIF -C - DO 500 I=1,N -C - IF(DN*D(I).GT.XLARGE) THEN - D(I)=VSMALL - ELSE IF(DN*D(I).LT.SMALL) THEN - D(I)=VLARGE - ELSE - D(I)=ONE/(DN*D(I))**2 - ENDIF - 500 CONTINUE -C -C SORT THE NEW EIGENVALUES AND EIGENVECTORS. -C - CALL SORT -C - DMIN=D(N) - IF(DMIN.LT.SMALL) DMIN=SMALL -C - IF(XM2*D(1).GT.DMIN) THEN - ILLC=1 - ELSE - ILLC=0 - ENDIF -C - IF(JPRINT.GT.1 .AND. SCBD.GT.ONE) THEN - WRITE(LP,510)(Z(I),I=1,N) - 510 FORMAT(/' SCALE FACTORS'/(1X,1PG15.7,4G15.7)) - ENDIF -C - IF(JPRINT.GT.1) THEN - WRITE(LP,520)(D(I),I=1,N) - 520 FORMAT(/' EIGENVALUES OF A'/(1X,1PG15.7,4G15.7)) - ENDIF -C - IF(JPRINT.GT.3) THEN -C - WRITE(LP,530) - 530 FORMAT(/' EIGENVECTORS OF A') -C - DO 540 I=1,N - WRITE(LP,350)I,(V(I,J),J=1,N) - 540 CONTINUE - ENDIF -C -C GO BACK TO THE MAIN LOOP. -C GO TO L0 -C -C HANDLE THE CASE N .EQ. 1 IN AN AD HOC WAY. -C (BRENT DID NOT PROVIDE FOR THIS CASE.) -C - IF(N.GE.2) GO TO 60 -C -C LABEL L2... -C - 550 IF(JPRINT.GT.0) THEN - WRITE(LP,560)(X(I),I=1,N) - 560 FORMAT(//7X,'X'/(1X,1PG15.7,4G15.7)) - ENDIF -C - FX=F(X,N) -C - IF(JPRINT.GE.0) WRITE(LP,570)FX,NL,NF - 570 FORMAT(/' EXIT PRAXIS. FX =',1PG25.17,5X,'NL =',I8, - * 5X,'NF =',I9) -C - RETURN -C -C END PRAXIS -C - END - SUBROUTINE QUAD(F) -C -C THIS SUBROUTINE LOOKS FOR THE MINIMUM ALONG -C A CURVE DEFINED BY Q0, Q1, AND X. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGE 161 -C -C SUBROUTINE QUAD IS CALLED BY SUBROUTINE PRAXIS. -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER I -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION F, DSQRT,ZSQRT,ARG, - * ONE,QA,QB,QC,S,TWO,XL,ZERO,QF1VAL -C - EXTERNAL F -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - ZSQRT(ARG)=DSQRT(ARG) -C - ZERO=0.0D0 - ONE=1.0D0 -C - S=FX - FX=QF1 - QF1=S - QD1=ZERO -C - DO 10 I=1,N - S=X(I) - XL=Q1(I) - X(I)=XL - Q1(I)=S - QD1=QD1+(S-XL)**2 - 10 CONTINUE -C - QD1=ZSQRT(QD1) - XL=QD1 - S=ZERO -C - IF(QD0.GT.ZERO .AND. QD1.GT.ZERO .AND. NL.GE.3*N*N) THEN -C - IF(JPRINT.GE.1) WRITE(LP,20)NF,QD0,QD1,FX,QF1 - 20 FORMAT(/' ***** CALL MINX FROM QUAD. NF =',I11/ - * 5X,'QD0 =',1PG15.7,5X,'QD1 =',G15.7/ - * 5X,'FX =',G15.7,5X,'QF1 =',G15.7) -C - QF1VAL=QF1 - CALL MINX(0,2,S,XL,QF1VAL,1,F) - QA=XL*(XL-QD1)/(QD0*(QD0+QD1)) - QB=(XL+QD0)*(QD1-XL)/(QD0*QD1) - QC=XL*(XL+QD0)/(QD1*(QD0+QD1)) - ELSE - FX=QF1 - QA=ZERO - QB=ZERO - QC=ONE - ENDIF -C - QD0=QD1 -C - DO 30 I=1,N - S=Q0(I) - Q0(I)=X(I) - X(I)=QA*S+QB*X(I)+QC*Q1(I) - 30 CONTINUE -C - RETURN -C -C END QUAD -C - END - SUBROUTINE MINX(J,NITS,D2,X1,F1,IFK,F) -C -C SUBROUTINE MINX MINIMIZES F FROM X IN THE DIRECTION V(*,J) -C UNLESS J IS LESS THAN 1, WHEN A QUADRATIC SEARCH IS DONE IN -C THE PLANE DEFINED BY Q0, Q1, AND X. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 159-160 -C -C SUBROUTINE MINX IS CALLED BY SUBROUTINES PRAXIS AND QUAD. -C -C D2 AND X1 RETURN RESULTS. -C J, NITS, F1 AND IFK ARE VALUE PARAMETERS THAT RETURN NOTHING. -C DO NOT SEND A COMMON VARIABLE TO MINX FOR PARAMETER F1. -C -C -C D2 IS AN APPROXIMATION TO HALF OF -C THE SECOND DERIVATIVE OF F (OR ZERO). -C -C X1 IS AN ESTIMATE OF DISTANCE TO MINIMUM, -C RETURNED AS THE DISTANCE FOUND. -C -C IF IFK = 1 THEN F1 IS FLIN(X1), OTHERWISE X1 AND F1 ARE -C IGNORED ON ENTRY UNLESS FINAL FX IS GREATER THAN F1. -C -C NITS CONTROLS THE NUMBER OF TIMES AN ATTEMPT IS MADE TO -C HALVE THE INTERVAL. -C - EXTERNAL F -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER IFK,J,NITS, I,IDZ,K -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION D2,X1, - * DABS,DSQRT,ZABS,ZSQRT,ARG, - * HUNDTH,RHALF,TWO,ZERO, - * DENOM,D1,FM,F0,F1,F2,S,SF1,SX1,T2,XM,X2 -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - ZSQRT(ARG)=DSQRT(ARG) - ZABS(ARG)=DABS(ARG) -C - HUNDTH=0.01D0 - ZERO=0.0D0 - TWO=2.0D0 - RHALF=0.5D0 -C - SF1=F1 - SX1=X1 - K=0 - XM=ZERO - FM=FX - F0=FX -C - IF(D2.LT.EPSMCH) THEN - IDZ=1 - ELSE - IDZ=0 - ENDIF -C -C FIND THE STEP SIZE. -C - S=ZERO - DO 10 I=1,N - S=S+X(I)**2 - 10 CONTINUE - S=ZSQRT(S) -C - IF(IDZ.EQ.1) THEN - DENOM=DMIN - ELSE - DENOM=D2 - ENDIF -C - T2=XM4*ZSQRT(ZABS(FX)/DENOM+S*XLDT)+XM2*XLDT - S=XM4*S+T - IF(IDZ.EQ.1 .AND. T2.GT.S) T2=S - IF(T2.LT.SMALL) T2=SMALL - IF(T2.GT.HUNDTH*H) T2=HUNDTH*H -C - IF(IFK.EQ.1 .AND. F1.LE.FM) THEN - XM=X1 - FM=F1 - ENDIF -C - IF(IFK.EQ.0 .OR. ZABS(X1).LT.T2) THEN -C - IF(X1.GE.ZERO) THEN - X1=T2 - ELSE - X1=-T2 - ENDIF -C - CALL FLIN(X1,J,F,F1) - ENDIF -C - IF(F1.LT.FM) THEN - XM=X1 - FM=F1 - ENDIF -C -C LABEL L0... -C - 20 IF(IDZ.EQ.1) THEN -C -C EVALUATE FLIN AT ANOTHER POINT, -C AND ESTIMATE THE SECOND DERIVATIVE. -C - IF(F0.LT.F1) THEN - X2=-X1 - ELSE - X2=TWO*X1 - ENDIF -C - CALL FLIN(X2,J,F,F2) -C - IF(F2.LE.FM) THEN - XM=X2 - FM=F2 - ENDIF -C - D2=(X2*(F1-F0)-X1*(F2-F0))/(X1*X2*(X1-X2)) -C - IF(JPRINT.GE.5) WRITE(LP,30)X1,X2,F0,F1,F2,D2 - 30 FORMAT(/' COMPUTE D2 IN SUBROUTINE MINX.'/ - * 5X,'X1 =',1PG15.7,5X,'X2 =',G15.7/ - * 5X,'F0 =',G15.7,5X,'F1 =',G15.7,5X,'F2 =',G15.7/ - * 5X,'D2 =',G15.7) - ENDIF -C -C ESTIMATE THE FIRST DERIVATIVE AT 0. -C - D1=(F1-F0)/X1-X1*D2 - IDZ=1 -C -C PREDICT THE MINIMUM. -C - IF(D2.LE.SMALL) THEN -C - IF(D1.LT.ZERO) THEN - X2=H - ELSE - X2=-H - ENDIF -C - ELSE - X2=-RHALF*D1/D2 - ENDIF -C - IF(ZABS(X2).GT.H) THEN -C - IF(X2.GT.ZERO) THEN - X2=H - ELSE - X2=-H - ENDIF - ENDIF -C -C EVALUATE F AT THE PREDICTED MINIMUM. -C LABEL L1... -C - 40 CALL FLIN(X2,J,F,F2) -C - IF(K.LT.NITS .AND. F2.GT.F0) THEN -C -C NO SUCCESS, SO TRY AGAIN. -C - K=K+1 -C -C IF(...) GO TO L0 -C - IF(F0.LT.F1 .AND. X1*X2.GT.ZERO) GO TO 20 - X2=X2/TWO -C -C GO TO L1 -C - GO TO 40 -C - ENDIF -C -C INCREMENT THE ONE-DIMENSIONAL SEARCH COUNTER. -C - NL=NL+1 -C - IF(F2.GT.FM) THEN - X2=XM - ELSE - FM=F2 - ENDIF -C -C GET A NEW ESTIMATE OF THE SECOND DERIVATIVE. -C - IF(ZABS(X2*(X2-X1)).GT.SMALL) THEN - D2=(X2*(F1-F0)-X1*(FM-F0))/(X1*X2*(X1-X2)) -C - IF(JPRINT.GE.5) WRITE(LP,50)X1,X2,F0,FM,F1,D2 - 50 FORMAT(/' RECOMPUTE D2 IN SUBROUTINE MINX.'/ - * 5X,'X1 =',1PG15.7,5X,'X2 =',G15.7/ - * 5X,'F0 =',G15.7,5X,'FM =',G15.7,5X,'F1 =',G15.7/ - * 5X,'D2 =',G15.7) -C - ELSE IF(K.GT.0) THEN - D2=ZERO -C - IF(JPRINT.GE.5) WRITE(LP,60) - 60 FORMAT(/' SET D2=0 IN SUBROUTINE MINX.') - ELSE - D2=D2 - ENDIF -C - IF(D2.LE.SMALL) THEN - D2=SMALL -C - IF(JPRINT.GE.5) WRITE(LP,70)D2 - 70 FORMAT(/' SET D2=SMALL=',1PG15.7,' IN SUBROUTINE MINX.') - ENDIF -C - IF(JPRINT.GE.5) WRITE(LP,80)X1,X2,FX,FM,SF1 - 80 FORMAT(/' SUBROUTINE MINX. X1 =',1PG15.7,5X,'X2 =',G15.7/ - * 5X,'FX =',G15.7,5X,'FM =',G15.7,5X,'SF1 =',G15.7) -C - X1=X2 - FX=FM - IF(SF1.LT.FX) THEN - FX=SF1 - X1=SX1 - ENDIF -C -C UPDATE X FOR A LINEAR SEARCH BUT NOT FOR A PARABOLIC SEARCH. -C - IF(J.GT.0) THEN -C - DO 90 I=1,N - X(I)=X(I)+X1*V(I,J) - 90 CONTINUE - ENDIF -C - IF(JPRINT.GE.5) WRITE(LP,100)D2,X1,F1,FX - 100 FORMAT(/' LEAVE SUBROUTINE MINX.'/ - * 5X,'D2 =',1PG15.7,5X,'X1 =',G15.7,5X,'F1 =',G15.7/ - * 5X,'FX =',G15.7) -C - RETURN -C -C END MINX -C - END - SUBROUTINE FLIN(XL,J,F,FLN) -C -C FLIN IS A FUNCTION OF ONE VARIABLE XL WHICH IS MINIMIZED BY -C SUBROUTINE MINX. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 159-160 -C -C SUBROUTINE FLIN IS CALLED BY SUBROUTINE MINX. -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER J, I -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION XL,F,FLN, TT, QA,QB,QC -C - DIMENSION TT(128) -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - IF(J.GT.0) THEN -C -C LINEAR SEARCH... -C - DO 10 I=1,N - TT(I)=X(I)+XL*V(I,J) - 10 CONTINUE -C - ELSE -C -C SEARCH ALONG A PARABOLIC SPACE CURVE. -C - QA=XL*(XL-QD1)/(QD0*(QD0+QD1)) - QB=(XL+QD0)*(QD1-XL)/(QD0*QD1) - QC=XL*(XL+QD0)/(QD1*(QD0+QD1)) -C - DO 20 I=1,N - TT(I)=QA*Q0(I)+QB*X(I)+QC*Q1(I) - 20 CONTINUE - ENDIF -C -C INCREMENT FUNCTION EVALUATION COUNTER. -C - NF=NF+1 - FLN=F(TT,N) -C - RETURN -C -C END FLIN -C - END - SUBROUTINE MINFIT(N,EPS,TOL,AB,Q,E,NMAX,LP) -C -C AN IMPROVED VERSION OF MINFIT, RESTRICTED TO M=N, P=0. -C SEE GOLUB AND REINSCH (1970). -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 156-158 -C -C G. H. GOLUB AND C. REINSCH, -C "SINGULAR VALUE DECOMPOSITION AND LEAST SQUARES SOLUTIONS', -C NUMERISCHE MATHEMATIK 14 (1970) PAGES 403-420 -C -C THE SINGULAR VALUES OF THE ARRAY AB ARE RETURNED IN Q, -C AND AB IS OVERWRITTEN WITH THE ORTHOGONAL MATRIX V SUCH THAT -C U.DIAG(Q)=AB.V, WHERE U IS ANOTHER ORTHOGONAL MATRIX. -C -C SUBROUTINE MINFIT IS CALLED BY SUBROUTINE PRAXIS. -C - INTEGER N,NMAX,LP, - * I,II,J,JTHIRT,K,KK,KT,L,LL2,LPI,L2 -C - DOUBLE PRECISION EPS,TOL,AB,Q,E, - * DABS,DSQRT,ZABS,ZSQRT,ARG, - * C,DENOM,F,G,H,ONE,X,Y,Z,ZERO,S,TWO -C - DIMENSION AB(NMAX,N),Q(N),E(N) -C - ZABS(ARG)=DABS(ARG) - ZSQRT(ARG)=DSQRT(ARG) -C - JTHIRT=30 -C - ZERO=0.0D0 - ONE=1.0D0 - TWO=2.0D0 -C -C HOUSEHOLDER'S REDUCTION TO BIDIAGONAL FORM... -C - X=ZERO - G=ZERO -C - DO 140 I=1,N - E(I)=G - S=ZERO - L=I+1 -C - DO 10 J=I,N - S=S+AB(J,I)**2 - 10 CONTINUE -C - IF(S.LT.TOL) THEN - G=ZERO - ELSE - F=AB(I,I) -C - IF(F.LT.ZERO) THEN - G=ZSQRT(S) - ELSE - G=-ZSQRT(S) - ENDIF -C - H=F*G-S - AB(I,I)=F-G -C - IF(L.GT.N) GO TO 60 - DO 50 J=L,N -C - F=ZERO - IF(I.GT.N) GO TO 30 - DO 20 K=I,N - F=F+AB(K,I)*AB(K,J) - 20 CONTINUE - 30 F=F/H -C - IF(I.GT.N) GO TO 50 - DO 40 K=I,N - AB(K,J)=AB(K,J)+F*AB(K,I) - 40 CONTINUE - 50 CONTINUE - ENDIF -C - 60 Q(I)=G - S=ZERO -C - IF(I.LE.N) THEN -C - IF(L.GT.N) GO TO 80 - DO 70 J=L,N - S=S+AB(I,J)**2 - 70 CONTINUE - ENDIF -C - 80 IF(S.LT.TOL) THEN - G=ZERO - ELSE - F=AB(I,I+1) -C - IF(F.LT.ZERO) THEN - G=ZSQRT(S) - ELSE - G=-ZSQRT(S) - ENDIF -C - H=F*G-S - AB(I,I+1)=F-G - IF(L.GT.N) GO TO 130 - DO 90 J=L,N - E(J)=AB(I,J)/H - 90 CONTINUE -C - DO 120 J=L,N -C - S=ZERO - DO 100 K=L,N - S=S+AB(J,K)*AB(I,K) - 100 CONTINUE -C - DO 110 K=L,N - AB(J,K)=AB(J,K)+S*E(K) - 110 CONTINUE - 120 CONTINUE - ENDIF -C - 130 Y=ZABS(Q(I))+ZABS(E(I)) -C - IF(Y.GT.X) X=Y - 140 CONTINUE -C -C ACCUMULATION OF RIGHT-HAND TRANSFORMATIONS... -C - DO 210 II=1,N - I=N-II+1 -C - IF(G.NE.ZERO) THEN - H=AB(I,I+1)*G -C - IF(L.GT.N) GO TO 200 - DO 150 J=L,N - AB(J,I)=AB(I,J)/H - 150 CONTINUE -C - DO 180 J=L,N -C - S=ZERO - DO 160 K=L,N - S=S+AB(I,K)*AB(K,J) - 160 CONTINUE -C - DO 170 K=L,N - AB(K,J)=AB(K,J)+S*AB(K,I) - 170 CONTINUE - 180 CONTINUE - ENDIF -C - IF(L.GT.N) GO TO 200 - DO 190 J=L,N - AB(J,I)=ZERO - AB(I,J)=ZERO - 190 CONTINUE -C - 200 AB(I,I)=ONE - G=E(I) - L=I - 210 CONTINUE -C -C DIAGONALIZATION OF THE BIDIAGONAL FORM... -C - EPS=EPS*X - DO 330 KK=1,N - K=N-KK+1 - KT=0 -C -C LABEL TESTFSPLITTING... -C - 220 KT=KT+1 -C - IF(KT.GT.JTHIRT) THEN - E(K)=ZERO - WRITE(LP,230) - 230 FORMAT(' QR FAILED.') - ENDIF -C - DO 240 LL2=1,K - L2=K-LL2+1 - L=L2 -C -C IF(...) GO TO TESTFCONVERGENCE -C - IF(ZABS(E(L)).LE.EPS) GO TO 270 -C -C IF(...) GO TO CANCELLATION -C - IF(ZABS(Q(L-1)).LE.EPS) GO TO 250 - 240 CONTINUE -C -C CANCELLATION OF E(L) IF L IS GREATER THAN 1... -C LABEL CANCELLATION... -C - 250 C=ZERO - S=ONE - IF(L.GT.K) GO TO 270 - DO 260 I=L,K - F=S*E(I) - E(I)=C*E(I) -C -C IF(...) GO TO TESTFCONVERGENCE -C - IF(ZABS(F).LE.EPS) GO TO 270 - G=Q(I) -C - IF(ZABS(F).LT.ZABS(G)) THEN - H=ZABS(G)*ZSQRT(ONE+(F/G)**2) - ELSE IF(F.NE.ZERO) THEN - H=ZABS(F)*ZSQRT(ONE+(G/F)**2) - ELSE - H=ZERO - ENDIF -C - Q(I)=H -C - IF(H.EQ.ZERO) THEN - H=ONE - G=ONE - ENDIF -C -C THE ABOVE REPLACES Q(I) AND H BY SQUARE ROOT OF (G*G+F*F) -C WHICH MAY GIVE INCORRECT RESULTS IF THE SQUARES UNDERFLOW OR IF -C F = G = 0 . -C - C=G/H - S=-F/H - 260 CONTINUE -C -C LABEL TESTFCONVERGENCE... -C - 270 Z=Q(K) -C -C IF(...) GO TO CONVERGENCE -C - IF(L.EQ.K) GO TO 310 -C -C SHIFT FROM BOTTOM 2*2 MINOR. -C - X=Q(L) - Y=Q(K-1) - G=E(K-1) - H=E(K) - F=((Y-Z)*(Y+Z)+(G-H)*(G+H))/(TWO*H*Y) - G=ZSQRT(F*F+ONE) -C - IF(F.LT.ZERO) THEN - DENOM=F-G - ELSE - DENOM=F+G - ENDIF -C - F=((X-Z)*(X+Z)+H*(Y/DENOM-H))/X -C -C NEXT QR TRANSFORMATION... -C - S=ONE - C=ONE - LPI=L+1 - IF(LPI.GT.K) GO TO 300 - DO 290 I=LPI,K - G=E(I) - Y=Q(I) - H=S*G - G=G*C -C - IF(ZABS(F).LT.ZABS(H)) THEN - Z=ZABS(H)*ZSQRT(ONE+(F/H)**2) - ELSE IF(F.NE.ZERO) THEN - Z=ZABS(F)*ZSQRT(ONE+(H/F)**2) - ELSE - Z=ZERO - ENDIF -C - E(I-1)=Z -C - IF(Z.EQ.ZERO) THEN - F=ONE - Z=ONE - ENDIF -C - C=F/Z - S=H/Z - F=X*C+G*S - G=-X*S+G*C - H=Y*S - Y=Y*C -C - DO 280 J=1,N - X=AB(J,I-1) - Z=AB(J,I) - AB(J,I-1)=X*C+Z*S - AB(J,I)=-X*S+Z*C - 280 CONTINUE -C - IF(ZABS(F).LT.ZABS(H)) THEN - Z=ZABS(H)*ZSQRT(ONE+(F/H)**2) - ELSE IF(F.NE.ZERO) THEN - Z=ZABS(F)*ZSQRT(ONE+(H/F)**2) - ELSE - Z=ZERO - ENDIF -C - Q(I-1)=Z -C - IF(Z.EQ.ZERO) THEN - F=ONE - Z=ONE - ENDIF -C - C=F/Z - S=H/Z - F=C*G+S*Y - X=-S*G+C*Y - 290 CONTINUE -C - 300 E(L)=ZERO - E(K)=F - Q(K)=X -C -C GO TO TESTFSPLITTING -C - GO TO 220 -C -C LABEL CONVERGENCE... -C - 310 IF(Z.LT.ZERO) THEN -C -C Q(K) IS MADE NON-NEGATIVE. -C - Q(K)=-Z - DO 320 J=1,N - AB(J,K)=-AB(J,K) - 320 CONTINUE - ENDIF - 330 CONTINUE -C - RETURN -C -C END MINFIT -C - END - SUBROUTINE SORT -C -C THIS SUBROUTINE SORTS THE ELEMENTS OF D -C AND THE CORRESPONDING COLUMNS OF V INTO DESCENDING ORDER. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 158-159 -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER I,IPI,J,K,NMI -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION S -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - NMI=N-1 - IF(NMI.LT.1) GO TO 50 - DO 40 I=1,NMI - K=I - S=D(I) - IPI=I+1 - IF(IPI.GT.N) GO TO 20 -C - DO 10 J=IPI,N -C - IF(D(J).GT.S) THEN - K=J - S=D(J) - ENDIF - 10 CONTINUE -C - 20 IF(K.GT.I) THEN - D(K)=D(I) - D(I)=S -C - DO 30 J=1,N - S=V(J,I) - V(J,I)=V(J,K) - V(J,K)=S - 30 CONTINUE - ENDIF - 40 CONTINUE -C - 50 RETURN -C -C END SORT -C - END - SUBROUTINE RANINI(RVALUE) -C -C SUBROUTINE RANINI PERFORMS INITIALIZATION FOR SUBROUTINE RANDOM. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 163-164 -C - INTEGER JRAN2,I -C - DOUBLE PRECISION RVALUE,R,RAN3,DMOD,DABS,RAN1 -C - COMMON /COMRAN/ RAN3(127),RAN1,JRAN2 -C - R=DMOD(DABS(RVALUE),8190.0D0)+1 - JRAN2=127 -C - 10 IF(JRAN2.GT.0) THEN - JRAN2=JRAN2-1 - RAN1=-2.0D0**55 -C - DO 20 I=1,7 - R=DMOD(1756.0D0*R,8191.0D0) - RAN1=(RAN1+(R-DMOD(R,32.0D0))/32.0D0)/256.0D0 - 20 CONTINUE -C - RAN3(JRAN2+1)=RAN1 - GO TO 10 - ENDIF -C - RETURN -C -C END RANINI -C - END - SUBROUTINE RANDOM(RANVAL) -C -C SUBROUTINE RANDOM RETURNS A DOUBLE PRECISION PSEUDORANDOM NUMBER -C UNIFORMLY DISTRIBUTED IN (0,1) (INCLUDING 0 BUT NOT 1). -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 163-164 -C -C BEFORE THE FIRST CALL TO RANDOM, THE USER MUST -C CALL RANINI(R) ONCE (ONLY) WITH R A DOUBLE PRECISION NUMBER -C EQUAL TO ANY INTEGER VALUE. -C BRENT (PAGE 166) USED THE EQUIVALENT OF -C CALL RANINI(4.0D0) . -C -C THE ALGORITHM USED IN SUBROUTINE RANDOM RETURNS X(N)/2**56, -C WHERE X(N) = X(N-1) + X(N-127) (MOD 2**56) . -C SINCE (1 + X + X**127) IS PRIMITIVE (MOD 2), -C THE PERIOD IS AT LEAST (2**127 - 1), WHICH EXCEEDS 10**38. -C -C SEE "SEMINUMERICAL ALGORITHMS", VOLUME 2 OF -C "THE ART OF COMPUTER PROGRAMMING" BY DONALD E. KNUTH, -C ADDISON-WESLEY 1969, PAGES 26, 34, AND 464. -C -C X(N) IS STORED IN DOUBLE PRECISION AS RAN3 = X(N)/2**56 - 1/2, -C AND ALL DOUBLE PRECISION ARITHMETIC IS EXACT. -C - INTEGER JRAN2 -C - DOUBLE PRECISION RANVAL,RAN3,RAN1 -C - COMMON /COMRAN/ RAN3(127),RAN1,JRAN2 -C - IF(JRAN2.EQ.0) THEN - JRAN2=126 - ELSE - JRAN2=JRAN2-1 - ENDIF -C - RAN1=RAN1+RAN3(JRAN2+1) - IF(RAN1.LT.0.0D0) THEN - RAN1=RAN1+0.5D0 - ELSE - RAN1=RAN1-0.5D0 - ENDIF -C - RAN3(JRAN2+1)=RAN1 - RANVAL=RAN1+0.5D0 -C - RETURN -C -C END RANDOM -C - END - DOUBLE PRECISION FUNCTION DRANDM(DL) -C -C SIMPLE PORTABLE PSEUDORANDOM NUMBER GENERATOR. -C -C DRANDM RETURNS FUNCTION VALUES THAT ARE PSEUDORANDOM -C NUMBERS UNIFORMLY DISTRIBUTED ON THE INTERVAL (0,1). -C -C 'NUMERICAL MATHEMATICS AND COMPUTING' BY WARD CHENEY AND -C DAVID KINCAID, BROOKS/COLE PUBLISHING COMPANY -C (FIRST EDITION, 1980), PAGE 203 -C -C AT THE BEGINNING OF EXECUTION, OR WHENEVER A NEW SEQUENCE IS -C TO BE INITIATED, SET DL EQUAL TO AN INTEGER VALUE BETWEEN -C 1.0D0 AND 2147483646.0D0, INCLUSIVE. DO THIS ONLY ONCE. -C THEREAFTER, DO NOT SET OR ALTER DL IN ANY WAY. -C FUNCTION DRANDM WILL MODIFY DL FOR ITS OWN PURPOSES. -C -C DRANDM USES A MULTIPLICATIVE CONGRUENTIAL METHOD. -C THE NUMBERS GENERATED BY DRANDM SUFFER FROM THE PARALLEL -C PLANES DEFECT DISCOVERED BY G. MARSAGLIA, AND SHOULD NOT BE -C USED WHEN HIGH-QUALITY RANDOMNESS IS REQUIRED. IN THAT -C CASE, USE A "SHUFFLING" METHOD. -C - DOUBLE PRECISION DL,DMOD -C - 10 DL=DMOD(16807.0D0*DL,2147483647.0D0) - DRANDM=DL/2147483647.0D0 - IF(DRANDM.LE.0.0D0 .OR. DRANDM.GE.1.0D0) GO TO 10 - RETURN - END diff --git a/gnuradio-core/src/gen_interpolator_taps/praxis.txt b/gnuradio-core/src/gen_interpolator_taps/praxis.txt deleted file mode 100644 index 9d06065660..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/praxis.txt +++ /dev/null @@ -1,176 +0,0 @@ -Brent's PRAXIS minimizer is available in FORTRAN 77. July 1995 - -"Algorithms for Minimization Without Derivatives" -by Richard P. Brent, Prentice-Hall, 1973 -ISBN: 0-13-022335-2 - -This book by Brent was a groundbreaking effort. -(I believe that it was his Ph.D. thesis at Stanford.) -His algorithms for finding roots and minima in -one dimension have good performance for typical problems -and guaranteed performance in the worst case. -(A later rootfinder by J. Bus and Dekker gave -a much lower bound for the worst case, -but no better performance in typical problems.) -These algorithms were implemented in both ALGOL W -and FORTRAN by Brent, and have been used fairly widely. - -Brent also gave a multi-dimensional minimization algorithm, -PRAXIS, but only shows an implementation in ALGOL W. -This routine has not been widely used, at least in the U.S. -The PRAXIS package has been translated into FORTRAN -by Rosalee Taylor, Sue Pinski, and me, and -I am making it available via anonymous ftp for use as -freeware (please do not remove our names). - - ftp a.cs.okstate.edu - anonymous - [enter your userid as password] - cd /pub/jpc - get praxis.f - quit - - -Brent's method and its performance - -Newton's method for minimization can find the minimum of a -quadratic function in one iteration, but is sometimes not -convenient to use. In the 1960s, several researchers found -iterative methods that solve quadratic problems exactly in a -finite number of steps. C. S. Smith (1962) and -M. J. D. Powell (1964) devised methods -that had this property and did not require derivatives. -G. W. Stewart modified the Davidon-Fletcher-Powell quasi-Newton -method to use finite difference approximations to approximate -the gradient. Powell's method, or later versions by Zangwill, -were the most successful of the early direct search methods -having the property of finite convergence on quadratic functions. - -Powell's method was programmed at Harwell as subroutine VA04A, -and is available as file va04a.f in the same directory as praxis.f. -VA04A is not extremely robust, and can give underflow, overflow, -or division by zero. va04a.f has several documented patches in it -where I tried to get around various abnormal terminations. -I do not recommend VA04A very strongly. - -Brent's PRAXIS added orthogonalization and several other features -to Powell's method. Brent also dealt carefully with roundoff. - -William H. Press et al. in their book "Numerical Recipes" -comment that -"Brent has a number of other cute tricks up his sleeve, -and his modification of Powell's method is probably -the best presently known." - -Roger Fletcher was less enthusiastic in his review of Brent's book -in The Computer Journal 16 (1973) 314: -"... I am not convinced that the modifications to Powell's -method are the best. Use of eigenvector directions -is not independent of scale changes to the variables, -and the use of searches in random directions is hardly -appealing. Nonetheless all the algorithms are demonstrated -to be competitive by numerical examples." - -The methods of Powell, Brent, et al. require that the function -for which a local minimum is sought must be smooth; -that is, the function and all of its first partial derivatives -must be continuous. - -Brent compared his method to the methods of Powell, of Stewart, -and of Davies, Swann, and Campey. Indirectly, he compared it -also to the Davidon-Fletcher-Powell quasi-Newton method. -He found that his method was about as efficient as the best -of these in most cases, and that it was more robust than others -in some cases. (Pages 139-155 in Brent's book give fair -comparisons to other methods. The results in Table 7.1 on -page 138 are correct, but do not include progress all the way -to convergence, and are therefore not too useful.) - -On least squares problems, all of these general minimization -methods are likely to be inefficient compared to least squares -methods such as the Gauss-Newton or Marquardt methods. - -In addition to the scale dependence that Fletcher deplored, -PRAXIS also had the disadvantage that it required N, the number -of parameters, to be greater than or equal to two. -The failure to handle N=1 is an unnecessary and pointless limitation. - - -The FORTRAN version - -We have followed Brent's PRAXIS rather closely. -I have added a patch to try to handle the case N=1, -and an option to use a simpler pseudorandom number generator, -DRANDM. The handling of N=1 is not guaranteed. - -The user writes a main program and a function subprogram -to compute the function to be minimized. -All communication between the user's main program and PRAXIS -is done via COMMON, except for an EXTERNAL parameter giving -the name of the function subprogram. -The disadvantages of using COMMON are at least two-fold: - - 1) Arrays cannot have adjustable dimensions. - - 2) Because some actual parameters are COMMON variables, - the FORTRAN version of PRAXIS probably will not pass - the Bell Labs PFORT package as being 100% standard FORTRAN. - Nevertheless, this usage will not cause any conflict in - any commercial FORTRAN compiler ever written. - (If it does, I will apologize and rewrite PRAXIS.) - -The advantage of using COMMON is that it is not necessary to pass -about fifteen more parameters every time the user calls PRAXIS. -At present all arrays are dimensioned (20) or (20,20), -and this can easily be increased using two simple global editing -commands. (In this case, increase the value of NMAX.) - -There are no DATA statements in PRAXIS, and it was not necessary -to use any SAVE statements. - -We have used DOUBLE PRECISION for all floating point computations, -as Brent did. We recommend using DOUBLE PRECISION on all computers -except possibly Cray computers, in which REAL is reasonably precise. -The value of "machine epsilon" is computed in subroutine PRASET -using bisection, and is called EPSMCH. -Brent computes EPSMCH**4 and 1/EPSMCH**4 in PRAXIS, -and uses these quantities later. -Because EPSMCH in DOUBLE PRECISION is less than 1E-16, -these fourth powers of EPSMCH and 1/EPSMCH will underflow -and overflow on such machines as VAXs and PCs, -which have a range of only about 1E38, grossly insufficient -for scientific computation. For such machines, Brent recommends -increasing the value of EPSMCH. -EPSMCH=1E-9 or possibly even 1E-8 might be necessary. -A better solution would be to eliminate the explicit use of -these fourth powers, accomplishing the same result implicitly. - -A "bug bounty" of $10 U.S. will be paid by me for the first -notification of any error in PRAXIS. -The same bounty also applies to any substantive poor design -choice (having no redeeming advantages whatever) in the FORTRAN -package. (The patch for N=1 is not included, although any -suggested improvements in that will be considered carefully.) - -praxis.f includes test software to run any of the test problems -that Brent ran, and is set to run at least one case of each problem. -I have run these on an IBM 3090, essentially the same -architecture that Brent used, and obtained essentially the same -results that Brent shows on pages 140-155. The Hilbert problem with -N=12, for which Brent shows no termination results and for which -the results in Table 7.1 are correct but not relevant, -runs a long time; I cut it off at 3000 function evaluations. -I don't particularly like Brent's convergence criterion, -which allows this sort of extremely slow creeping progress, -but have not modified it. - -Please notify me of any problems with this software, -or of any suggested modifications. - -John Chandler -Computer Science Department -Oklahoma State University -Stillwater, Oklahoma 74078, U.S.A. -(405) 744-5676 -jpc@a.cs.okstate.edu - diff --git a/gnuradio-core/src/gen_interpolator_taps/simpson.c b/gnuradio-core/src/gen_interpolator_taps/simpson.c deleted file mode 100644 index 31aaae4aef..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/simpson.c +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c -*- */ -#include <math.h> -#include <stdio.h> - -#define EPS (1.0e-5) -#define JMAX 16 - -/* - * Compute the Nth stage of refinement of an extended trapezoidal - * rule. FUNC is input as a pointer to a function to be integrated - * between limits A and B. When called with N = 1, the routine - * returns the crudest estimate of the integral from A to B of f(x) - * dx. Subsequent calls with N=2,3,... (in that sequential order) - * will improve the accuracy by adding 2**(N-2) additional interior - * points. - * - * N.B., this function contains static state and IS NEITHER RENTRANT - * NOR THREAD SAFE! - */ - -double -trapzd (double (*func)(double), - double a, double b, - int n) -{ - long double x, tnm, sum, del; - static long double s; - static int it; - int j; - - if (n == 1){ - it = 1; /* # of points to add on the next call */ - s = 0.5 * (b - a) * (func(a) + func(b)); - return s; - } - else { - tnm = it; - del = (b-a)/tnm; /* this is the spacing of the points to be added */ - x = a + 0.5*del; - for (sum = 0.0, j = 1; j <= it; j++, x += del) - sum += func(x); - it *= 2; - s = 0.5 * (s + (b-a) * sum/tnm); /* replace s by it's refined value */ - return s; - } -} - -/* - * Returns the integral of the function FUNC from A to B. The - * parameters EPS can be set to the desired fractional accuracy and - * JMAX so that 2**(JMAX-1) is the maximum allowed number of steps. - * Integration is performed by Simpson's rule. - */ - -double -qsimp (double (*func)(double), - double a, /* lower limit */ - double b) /* upper limit */ -{ - int j; - long double s, st, ost, os; - - ost = os = -1.0e30; - for (j = 1; j <= JMAX; j++){ - st = trapzd (func, a, b, j); - s = (4.0 * st - ost)/3.0; - if (fabs (s - os) < EPS * fabs(os)) - return s; - os = s; - ost = st; - } - fprintf (stderr, "Too many steps in routine QSIMP\n"); - // exit (1); - return s; -} - diff --git a/gnuradio-core/src/gen_interpolator_taps/simpson.h b/gnuradio-core/src/gen_interpolator_taps/simpson.h deleted file mode 100644 index 68774f9a2e..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/simpson.h +++ /dev/null @@ -1,3 +0,0 @@ -double qsimp (double (*func)(double), - double a, double b); - diff --git a/gnuradio-core/src/lib/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt index 89a1bad88b..e2675306e2 100644 --- a/gnuradio-core/src/lib/CMakeLists.txt +++ b/gnuradio-core/src/lib/CMakeLists.txt @@ -28,12 +28,9 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake) GR_INCLUDE_SUBDIRECTORY(missing) GR_INCLUDE_SUBDIRECTORY(runtime) GR_INCLUDE_SUBDIRECTORY(filter) -GR_INCLUDE_SUBDIRECTORY(viterbi) GR_INCLUDE_SUBDIRECTORY(general) GR_INCLUDE_SUBDIRECTORY(gengen) -GR_INCLUDE_SUBDIRECTORY(reed-solomon) GR_INCLUDE_SUBDIRECTORY(io) -GR_INCLUDE_SUBDIRECTORY(hier) list(APPEND gnuradio_core_sources bug_work_around_6.cc) list(APPEND test_gnuradio_core_sources bug_work_around_6.cc) @@ -76,10 +73,46 @@ endif() # Link against libvolk list(APPEND gnuradio_core_libs volk) -add_library(gnuradio-core SHARED ${gnuradio_core_sources}) +if(ENABLE_GR_CTRLPORT) + +######################################################################## +# Run ICE To compile Slice files +######################################################################## +EXECUTE_PROCESS( + COMMAND "${ICE_SLICE2CPP}" "-I${CMAKE_CURRENT_SOURCE_DIR}/runtime" + "--output-dir=${CMAKE_CURRENT_BINARY_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/runtime/gnuradio.ice" + ) + +# Append generated file in build directory +list(APPEND gnuradio_core_generated_sources + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio.cpp +) + +list(APPEND gnuradio_core_generated_includes + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio.h +) + +######################################################################## +# Add controlport stuff to gnuradio-core +######################################################################## + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +list(APPEND gnuradio_core_libs + ${ICE_LIBRARIES} +) + +endif(ENABLE_GR_CTRLPORT) + +add_library(gnuradio-core SHARED ${gnuradio_core_sources} ${gnuradio_core_generated_sources}) target_link_libraries(gnuradio-core ${gnuradio_core_libs}) GR_LIBRARY_FOO(gnuradio-core RUNTIME_COMPONENT "core_runtime" DEVEL_COMPONENT "core_devel") set_target_properties(gnuradio-core PROPERTIES LINK_INTERFACE_LIBRARIES "gruel") +ADD_DEPENDENCIES(gnuradio-core + gnuradio_core_generated_sources + gnuradio_core_generated_includes + gnuradio_core_generated_swigs) ######################################################################## # Setup executables diff --git a/gnuradio-core/src/lib/filter/3dnow_float_dotprod_really_simple.S b/gnuradio-core/src/lib/filter/3dnow_float_dotprod_really_simple.S deleted file mode 100644 index 546a4a6f3f..0000000000 --- a/gnuradio-core/src/lib/filter/3dnow_float_dotprod_really_simple.S +++ /dev/null @@ -1,99 +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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# sse_float_dotprod (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - - - .file "3dnow_float_dotprod_really_simple.s" -// .version "01.01" -.text - .p2align 4 -.globl sse_float_dotprod - .type sse_float_dotprod,@function -sse_float_dotprod: - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %edx - movl 12(%ebp), %eax - movl 16(%ebp), %ecx - - - # The plan is to get it computing the correct answer, and - # then to unroll and schedule the inner loop. - - pxor %mm4, %mm4 # mm4 = 0 0 - shll $1, %ecx # count * 2 - - .p2align 4 -.Loop1: - movq (%eax), %mm0 - pfmul (%edx), %mm0 - pfadd %mm0, %mm4 - addl $8, %edx - addl $8, %eax - decl %ecx - jne .Loop1 - - # at this point mm4 contains partial sums - - pfacc %mm4, %mm4 - movd %mm4, 16(%ebp) - femms - flds 16(%ebp) - - popl %ebp - ret -.Lfe1: - .size sse_float_dotprod,.Lfe1-sse_float_dotprod - .ident "Hand coded x86 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/3dnow_float_dotprod_simple.S b/gnuradio-core/src/lib/filter/3dnow_float_dotprod_simple.S deleted file mode 100644 index c721c36014..0000000000 --- a/gnuradio-core/src/lib/filter/3dnow_float_dotprod_simple.S +++ /dev/null @@ -1,106 +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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# sse_float_dotprod (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - - - .file "3dnow_float_dotprod_simple.s" -// .version "01.01" -.text - .p2align 4 -.globl sse_float_dotprod - .type sse_float_dotprod,@function -sse_float_dotprod: - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %edx - movl 12(%ebp), %eax - movl 16(%ebp), %ecx - - - # The plan is to get it computing the correct answer, and - # then to unroll and schedule the inner loop. - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - - .p2align 4 -.Loop1: - movq 0(%eax), %mm0 - movq 8(%eax), %mm1 - - pfmul 0(%edx), %mm0 - pfadd %mm0, %mm4 - - pfmul 8(%edx), %mm1 - pfadd %mm1, %mm5 - - addl $16, %edx - addl $16, %eax - decl %ecx - jne .Loop1 - - # at this point mm4 and mm5 contain partial sums - - pfadd %mm5, %mm4 - pfacc %mm4, %mm4 - movd %mm4, 16(%ebp) - femms - flds 16(%ebp) - - popl %ebp - ret -.Lfe1: - .size sse_float_dotprod,.Lfe1-sse_float_dotprod - .ident "Hand coded x86 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/CMakeLists.txt b/gnuradio-core/src/lib/filter/CMakeLists.txt index 088d3376d1..703580213e 100644 --- a/gnuradio-core/src/lib/filter/CMakeLists.txt +++ b/gnuradio-core/src/lib/filter/CMakeLists.txt @@ -21,337 +21,21 @@ # This file included, use CMake directory variables ######################################################################## -#set the C language property on the assembly files so the compiler will pick them up -file(GLOB gr_core_filter_asms ${CMAKE_CURRENT_SOURCE_DIR}/*.S) -foreach(gr_core_filter_asm ${gr_core_filter_asms}) - set_property(SOURCE ${gr_core_filter_asm} PROPERTY LANGUAGE C) -endforeach(gr_core_filter_asm) - -#detect 32 or 64 bit compiler -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|x86_64|amd64)$") - include(CheckTypeSize) - check_type_size("void*" SIZEOF_VOID_P BUILTIN_TYPES_ONLY) - if (${SIZEOF_VOID_P} EQUAL 8) - set(CMAKE_SYSTEM_PROCESSOR_x86 64) - else() - set(CMAKE_SYSTEM_PROCESSOR_x86 32) - endif() -endif() - -######################################################################## -# Generate the makefile.gen, then extract its sources: -# This is a round-about way to extract the sources, -# but it requires minimum changed to the python utils. -# -# The recommended way to do this: -# - Make a generation macro that registers the sources command. -# - List the generation macro with each templated source file. -# - Create a python script (very generic) to perform generation. -# - This way the targets would depend only on their sources. -######################################################################## -execute_process( - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} -c " -import os, sys -sys.path.append('${GR_CORE_PYTHONPATH}') -sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}') -os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.environ['gendir'] = '${CMAKE_CURRENT_BINARY_DIR}' -os.environ['do_makefile'] = '1' -os.environ['do_sources'] = '0' -from generate_all import generate_all -generate_all() - " WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) - -macro(FILTER_GEN_EXTRACT outvar ext) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; print ';'.join( - map(lambda x: os.path.join('${CMAKE_CURRENT_BINARY_DIR}', x.replace('\\\\', '').strip()), - filter(lambda f: '${ext}' in f, open('${CMAKE_CURRENT_BINARY_DIR}/Makefile.gen').readlines() - )))" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE ${outvar}) - file(TO_CMAKE_PATH "${${outvar}}" ${outvar}) -endmacro(FILTER_GEN_EXTRACT) - -FILTER_GEN_EXTRACT(generated_filter_sources ".cc") -FILTER_GEN_EXTRACT(generated_filter_includes ".h") -FILTER_GEN_EXTRACT(generated_filter_swigs ".i") - -#TODO simplify this list with a triple-threat for loop -set(generated_filter_deps - ${CMAKE_CURRENT_SOURCE_DIR}/generate_all.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_filter_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_interp_fir_filter_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_rational_resampler_base_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_sysconfig.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_sysconfig_generic.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_util.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_freq_xlating_fir_filter_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gri_fir_filter_with_buffer_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_utils.py - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX_generic.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX_generic.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fir_filter_with_buffer_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fir_filter_with_buffer_XXX.h.t -) - -add_custom_command( - OUTPUT - ${generated_filter_sources} - ${generated_filter_includes} - ${generated_filter_swigs} - DEPENDS ${generated_filter_deps} - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} -c - "import os, sys;sys.path.append('${GR_CORE_PYTHONPATH}');sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}');os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}';from generate_all import generate_all;generate_all()" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "generating filter files" - VERBATIM -) - -add_custom_target(filter_generated DEPENDS - ${generated_filter_sources} - ${generated_filter_includes} - ${generated_filter_swigs} -) - -######################################################################## -# Add target specific files -# May VOLK put a rest to all the insanity below. -######################################################################## -if(MSVC) - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_generic.cc - ) - list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_generic.cc - ) -else(MSVC) -if(CMAKE_SYSTEM_PROCESSOR_x86) - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccc_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccc_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fsf_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fsf_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_scc_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_scc_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fcc_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fcc_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/sse_debug.c - ) - list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_float_dotprod_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_complex_dotprod_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_ccomplex_dotprod_x86.cc - ) -endif() - -if(CMAKE_SYSTEM_PROCESSOR_x86 AND "${CMAKE_SYSTEM_PROCESSOR_x86}" STREQUAL "64") - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_sse64.S - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_3dnow64.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnowext64.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnow64.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_sse64.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnowext64.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnow64.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_sse64.S - ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_3dnow64.S - ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_sse64.S - ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_mmx64.S - ) -elseif(CMAKE_SYSTEM_PROCESSOR_x86 AND "${CMAKE_SYSTEM_PROCESSOR_x86}" STREQUAL "32") - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_sse.S - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_3dnow.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnowext.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnow.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_sse.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnowext.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnow.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_sse.S - ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_3dnow.S - ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_sse.S - ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_mmx.S - ) -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") - if(CMAKE_COMPILER_IS_GNUCXX) - add_definitions(-maltivec) - endif() - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_powerpc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_powerpc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_powerpc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_altivec.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_altivec.c - ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_fff_altivec.c - ) - list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_powerpc.cc - ) -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") - if(have_mfpu_neon) - add_definitions(-DHAVE_MFPU_NEON) - endif() - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_armv7_a.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_armv7_a.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_armv7_a.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_armv7_a.cc - ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_fff_armv7_a.c - ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_ccf_armv7_a.c - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_armv7_a.cc - ) - list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_armv7_a.cc - ) -else() - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_generic.cc - ) - list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_generic.cc - ) -endif() -endif(MSVC) - ######################################################################## # Append gnuradio-core library sources ######################################################################## list(APPEND gnuradio_core_sources - ${generated_filter_sources} - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_fff_generic.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_ccc_generic.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.c ${CMAKE_CURRENT_SOURCE_DIR}/gri_goertzel.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator_cc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_generic.cc - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_generic.cc - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_generic.c - ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_generic.c -) - -######################################################################## -# Append gnuradio-core test sources -######################################################################## -list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_filter.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_ccf.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_fcc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_fff.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_ccc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_scc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_rotator.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_mmse_fir_interpolator.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_mmse_fir_interpolator_cc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_ccf.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_ccc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fcc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fff.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fsf.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_scc.cc ) ######################################################################## # Install runtime headers ######################################################################## install(FILES - ${generated_filter_includes} - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_altivec.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_fff_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_ccc_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_powerpc.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_rotator.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_pole_iir.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_vec_types.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_goertzel.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_iir.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator_cc.h - ${CMAKE_CURRENT_SOURCE_DIR}/qa_filter.h - ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/sse_debug.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel" ) - -######################################################################## -# Install swig headers -######################################################################## -if(ENABLE_PYTHON) -install(FILES - ${generated_filter_swigs} - ${CMAKE_CURRENT_SOURCE_DIR}/filter.i - ${CMAKE_CURRENT_BINARY_DIR}/filter_generated.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "core_swig" -) -endif(ENABLE_PYTHON) - -######################################################################## -# Handle triple-threat files that have cc, h, and i -######################################################################## -set(gr_core_filter_triple_threats - gr_adaptive_fir_ccc - gr_adaptive_fir_ccf - gr_dc_blocker_cc - gr_dc_blocker_ff - gr_fft_filter_ccc - gr_fft_filter_fff - gr_filter_delay_fc - gr_fractional_interpolator_ff - gr_fractional_interpolator_cc - gr_goertzel_fc - gr_hilbert_fc - gr_iir_filter_ffd - gr_single_pole_iir_filter_ff - gr_single_pole_iir_filter_cc - gr_pfb_channelizer_ccf - gr_pfb_synthesizer_ccf - gr_pfb_decimator_ccf - gr_pfb_interpolator_ccf - gr_pfb_arb_resampler_ccf - gr_pfb_arb_resampler_fff - gr_pfb_clock_sync_ccf - gr_pfb_clock_sync_fff -) - -foreach(file_tt ${gr_core_filter_triple_threats}) - list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel") - if(ENABLE_PYTHON) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig") - endif(ENABLE_PYTHON) -endforeach(file_tt ${gr_core_filter_triple_threats}) diff --git a/gnuradio-core/src/lib/filter/Makefile.gen b/gnuradio-core/src/lib/filter/Makefile.gen deleted file mode 100644 index 909899c054..0000000000 --- a/gnuradio-core/src/lib/filter/Makefile.gen +++ /dev/null @@ -1,124 +0,0 @@ -# -# This file is machine generated. All edits will be overwritten -# -GENERATED_H = \ - gr_fir_ccc.h \ - gr_fir_ccc_generic.h \ - gr_fir_ccf.h \ - gr_fir_ccf_generic.h \ - gr_fir_fcc.h \ - gr_fir_fcc_generic.h \ - gr_fir_fff.h \ - gr_fir_fff_generic.h \ - gr_fir_filter_ccc.h \ - gr_fir_filter_ccf.h \ - gr_fir_filter_fcc.h \ - gr_fir_filter_fff.h \ - gr_fir_filter_fsf.h \ - gr_fir_filter_scc.h \ - gr_fir_fsf.h \ - gr_fir_fsf_generic.h \ - gr_fir_scc.h \ - gr_fir_scc_generic.h \ - gr_fir_sysconfig.h \ - gr_fir_sysconfig_generic.h \ - gr_fir_util.h \ - gr_freq_xlating_fir_filter_ccc.h \ - gr_freq_xlating_fir_filter_ccf.h \ - gr_freq_xlating_fir_filter_fcc.h \ - gr_freq_xlating_fir_filter_fcf.h \ - gr_freq_xlating_fir_filter_scc.h \ - gr_freq_xlating_fir_filter_scf.h \ - gr_interp_fir_filter_ccc.h \ - gr_interp_fir_filter_ccf.h \ - gr_interp_fir_filter_fcc.h \ - gr_interp_fir_filter_fff.h \ - gr_interp_fir_filter_fsf.h \ - gr_interp_fir_filter_scc.h \ - gr_rational_resampler_base_ccc.h \ - gr_rational_resampler_base_ccf.h \ - gr_rational_resampler_base_fcc.h \ - gr_rational_resampler_base_fff.h \ - gr_rational_resampler_base_fsf.h \ - gr_rational_resampler_base_scc.h \ - gri_fir_filter_with_buffer_ccc.h \ - gri_fir_filter_with_buffer_ccf.h \ - gri_fir_filter_with_buffer_fcc.h \ - gri_fir_filter_with_buffer_fff.h \ - gri_fir_filter_with_buffer_fsf.h \ - gri_fir_filter_with_buffer_scc.h - - -GENERATED_I = \ - gr_fir_filter_ccc.i \ - gr_fir_filter_ccf.i \ - gr_fir_filter_fcc.i \ - gr_fir_filter_fff.i \ - gr_fir_filter_fsf.i \ - gr_fir_filter_scc.i \ - gr_freq_xlating_fir_filter_ccc.i \ - gr_freq_xlating_fir_filter_ccf.i \ - gr_freq_xlating_fir_filter_fcc.i \ - gr_freq_xlating_fir_filter_fcf.i \ - gr_freq_xlating_fir_filter_scc.i \ - gr_freq_xlating_fir_filter_scf.i \ - gr_interp_fir_filter_ccc.i \ - gr_interp_fir_filter_ccf.i \ - gr_interp_fir_filter_fcc.i \ - gr_interp_fir_filter_fff.i \ - gr_interp_fir_filter_fsf.i \ - gr_interp_fir_filter_scc.i \ - gr_rational_resampler_base_ccc.i \ - gr_rational_resampler_base_ccf.i \ - gr_rational_resampler_base_fcc.i \ - gr_rational_resampler_base_fff.i \ - gr_rational_resampler_base_fsf.i \ - gr_rational_resampler_base_scc.i - -GENERATED_CC = \ - gr_fir_ccc.cc \ - gr_fir_ccc_generic.cc \ - gr_fir_ccf.cc \ - gr_fir_ccf_generic.cc \ - gr_fir_fcc.cc \ - gr_fir_fcc_generic.cc \ - gr_fir_fff.cc \ - gr_fir_fff_generic.cc \ - gr_fir_filter_ccc.cc \ - gr_fir_filter_ccf.cc \ - gr_fir_filter_fcc.cc \ - gr_fir_filter_fff.cc \ - gr_fir_filter_fsf.cc \ - gr_fir_filter_scc.cc \ - gr_fir_fsf.cc \ - gr_fir_fsf_generic.cc \ - gr_fir_scc.cc \ - gr_fir_scc_generic.cc \ - gr_fir_sysconfig.cc \ - gr_fir_sysconfig_generic.cc \ - gr_fir_util.cc \ - gr_freq_xlating_fir_filter_ccc.cc \ - gr_freq_xlating_fir_filter_ccf.cc \ - gr_freq_xlating_fir_filter_fcc.cc \ - gr_freq_xlating_fir_filter_fcf.cc \ - gr_freq_xlating_fir_filter_scc.cc \ - gr_freq_xlating_fir_filter_scf.cc \ - gr_interp_fir_filter_ccc.cc \ - gr_interp_fir_filter_ccf.cc \ - gr_interp_fir_filter_fcc.cc \ - gr_interp_fir_filter_fff.cc \ - gr_interp_fir_filter_fsf.cc \ - gr_interp_fir_filter_scc.cc \ - gr_rational_resampler_base_ccc.cc \ - gr_rational_resampler_base_ccf.cc \ - gr_rational_resampler_base_fcc.cc \ - gr_rational_resampler_base_fff.cc \ - gr_rational_resampler_base_fsf.cc \ - gr_rational_resampler_base_scc.cc \ - gri_fir_filter_with_buffer_ccc.cc \ - gri_fir_filter_with_buffer_ccf.cc \ - gri_fir_filter_with_buffer_fcc.cc \ - gri_fir_filter_with_buffer_fff.cc \ - gri_fir_filter_with_buffer_fsf.cc \ - gri_fir_filter_with_buffer_scc.cc - diff --git a/gnuradio-core/src/lib/filter/README b/gnuradio-core/src/lib/filter/README deleted file mode 100644 index 90c1584fcb..0000000000 --- a/gnuradio-core/src/lib/filter/README +++ /dev/null @@ -1,28 +0,0 @@ -# -# 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. -# - -This directory holds filtering code, some of which is machine -generated. Which variations are generated is controlled by two -variables. For most everything, the global "signatures" -in generate_utils.py controls. - -For GrFreqXlatingFIRfilter<foo>, the global "fx_signatures" in -generate_GrFreqXlatingFIRfilterXXX.py controls. diff --git a/gnuradio-core/src/lib/filter/assembly.h b/gnuradio-core/src/lib/filter/assembly.h deleted file mode 100644 index 32477dfd7b..0000000000 --- a/gnuradio-core/src/lib/filter/assembly.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 _ASSEMBLY_H_ -#define _ASSEMBLY_H_ - -#if defined (__APPLE__) && defined (__APPLE_CC__) - -// XCode ignores the .scl and .type functions in XCode 2.2.1 and 2.3, -// but creates an error in XCode 2.4. Just ignore them. - -#define GLOB_SYMB(f) _ ## f - -#define DEF_FUNC_HEAD(f) /* none */ - -#define FUNC_TAIL(f) /* none*/ - -#elif !defined (__ELF__) - -/* - * Too bad, the following define does not work as expected --SF - * #define GLOB_SYMB(f) __USER_LABEL_PREFIX__ ## f - */ -#define GLOB_SYMB(f) _ ## f - -#define DEF_FUNC_HEAD(f) \ - .def GLOB_SYMB(f); .scl 2; .type 32; .endef - -#define FUNC_TAIL(f) /* none */ - - -#else /* !__ELF__ */ - - -#define GLOB_SYMB(f) f - -#define DEF_FUNC_HEAD(f) \ - .type GLOB_SYMB(f),@function \ - -#define FUNC_TAIL(f) \ - .Lfe1: \ - .size GLOB_SYMB(f),.Lfe1-GLOB_SYMB(f) - - -#endif /* !__ELF__ */ - - -#endif /* _ASSEMBLY_H_ */ diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow.S deleted file mode 100644 index f663563375..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow.S +++ /dev/null @@ -1,220 +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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - .file "ccomplex_dotprod_3dnow.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_3dnow) - DEF_FUNC_HEAD(ccomplex_dotprod_3dnow) -GLOB_SYMB(ccomplex_dotprod_3dnow): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - - # zero accumulators - - pxor %mm6, %mm6 # mm6 = 0 0 - - movq 0(%eax), %mm0 - - pxor %mm7, %mm7 # mm7 = 0 0 - - movq 0(%edx), %mm2 - - movq 8(%eax), %mm1 - - shrl $1, %ecx # ecx = n_2_ccomplex_blocks / 2 - - movq 8(%edx), %mm3 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z, mmPN=$80000000 -# -# movq (%eax), %mmA -# movq (%edx), %mmB -# -# # 3DNow! replacement for: pswapd %mmA, %mmZ -# # TODO: optimize the punpckhdq -# movq %mmA, %mmZ -# punpckhdq %mmZ, %mmZ -# punpckldq %mmA, %mmZ -# -# pfmul %mmB, %mmA -# pfmul %mmZ, %mmB -# -# # 3DNow! replacement for: pfpnacc %mmB, %mmA -# pxor %mmPN, %mmA -# pfacc %mmB, %mmA -# -# pfadd %mmA, %mmC - - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - movq %mm0, %mm4 - movq %mm1, %mm5 - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - movq 16(%edx), %mm0 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - movq 16(%eax), %mm2 - pfadd %mm1, %mm6 - pfmul %mm5, %mm3 - movq 24(%edx), %mm1 - - movq %mm0, %mm4 - movq %mm1, %mm5 - - pfadd %mm3, %mm7 - movq 24(%eax), %mm3 - -# unroll - - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - movq 32(%edx), %mm0 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - movq 32(%eax), %mm2 - pfadd %mm1, %mm6 - pfmul %mm5, %mm3 - movq 40(%edx), %mm1 - - addl $32, %eax - addl $32, %edx - - pfadd %mm3, %mm7 - movq 8(%eax), %mm3 - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's see if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - andl $1, %ecx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 & mm1/mm3 preloaded - # from the main loop. - - movq %mm0, %mm4 - movq %mm1, %mm5 - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - pfmul %mm5, %mm3 - pfadd %mm1, %mm6 - pfadd %mm3, %mm7 - -.Leven: - # mmNP: negative inversor - - pcmpeqd %mm0, %mm0 # set all bits to 1 - psllq $63, %mm0 # keep only hsb - - pxor %mm0, %mm6 - pfacc %mm7, %mm6 - - movl 20(%ebp), %eax # result - movq %mm6, (%eax) - - femms - - popl %ebp - ret - -FUNC_TAIL(ccomplex_dotprod_3dnow) - .ident "Hand coded x86 3DNow! assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow64.S deleted file mode 100644 index e81d219935..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow64.S +++ /dev/null @@ -1,217 +0,0 @@ -# -# Copyright 2002,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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "ccomplex_dotprod_3dnow64.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_3dnow) - DEF_FUNC_HEAD(ccomplex_dotprod_3dnow) -GLOB_SYMB(ccomplex_dotprod_3dnow): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - # zero accumulators - - pxor %mm6, %mm6 # mm6 = 0 0 - - movq 0(%rdi), %mm0 - - pxor %mm7, %mm7 # mm7 = 0 0 - - movq 0(%rsi), %mm2 - - movq 8(%rdi), %mm1 - - shr $1, %rax # rax = n_2_ccomplex_blocks / 2 - - movq 8(%rsi), %mm3 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z, mmPN=$80000000 -# -# movq (%rdx), %mmA -# movq (%rsi), %mmB -# -# # 3DNow! replacement for: pswapd %mmA, %mmZ -# # TODO: optimize the punpckhdq -# movq %mmA, %mmZ -# punpckhdq %mmZ, %mmZ -# punpckldq %mmA, %mmZ -# -# pfmul %mmB, %mmA -# pfmul %mmZ, %mmB -# -# # 3DNow! replacement for: pfpnacc %mmB, %mmA -# pxor %mmPN, %mmA -# pfacc %mmB, %mmA -# -# pfadd %mmA, %mmC - - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - movq %mm0, %mm4 - movq %mm1, %mm5 - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - movq 16(%rsi), %mm0 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - movq 16(%rdi), %mm2 - pfadd %mm1, %mm6 - pfmul %mm5, %mm3 - movq 24(%rsi), %mm1 - - movq %mm0, %mm4 - movq %mm1, %mm5 - - pfadd %mm3, %mm7 - movq 24(%rdi), %mm3 - -# unroll - - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - movq 32(%rsi), %mm0 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - movq 32(%rdi), %mm2 - pfadd %mm1, %mm6 - pfmul %mm5, %mm3 - movq 40(%rsi), %mm1 - - add $32, %rdi - add $32, %rsi - - pfadd %mm3, %mm7 - movq 8(%rdi), %mm3 - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's see if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - and $1, %rdx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 & mm1/mm3 preloaded - # from the main loop. - - movq %mm0, %mm4 - movq %mm1, %mm5 - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - pfmul %mm5, %mm3 - pfadd %mm1, %mm6 - pfadd %mm3, %mm7 - -.Leven: - # mmNP: negative inversor - - pcmpeqd %mm0, %mm0 # set all bits to 1 - psllq $63, %mm0 # keep only hsb - - pxor %mm0, %mm6 - pfacc %mm7, %mm6 - - movq %mm6, (%rcx) - - femms - - retq - -FUNC_TAIL(ccomplex_dotprod_3dnow) - .ident "Hand coded x86_64 3DNow! assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext.S deleted file mode 100644 index 22c390bddd..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext.S +++ /dev/null @@ -1,195 +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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - .file "ccomplex_dotprod_3dnowext.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_3dnowext) - DEF_FUNC_HEAD(ccomplex_dotprod_3dnowext) -GLOB_SYMB(ccomplex_dotprod_3dnowext): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - - # zero accumulators - - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - movq 0(%eax), %mm0 - movq 0(%edx), %mm2 - - shrl $1, %ecx # ecx = n_2_ccomplex_blocks / 2 - - movq 8(%eax), %mm1 - movq 8(%edx), %mm3 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z -# -# movq 0(%eax), %mmA -# movq 0(%edx), %mmB -# pswapd %mmA, %mmZ -# pfmul %mmB, %mmA -# pfmul %mmZ, %mmB -# pfpnacc %mmB, %mmA -# pfadd %mmA, %mmC - - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - movq 16(%edx), %mm2 - pfpnacc %mm3, %mm1 - movq 24(%edx), %mm3 - - pfadd %mm0, %mm6 - movq 16(%eax), %mm0 - pfadd %mm1, %mm7 - movq 24(%eax), %mm1 - -# unroll - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - movq 32(%edx), %mm2 - pfpnacc %mm3, %mm1 - movq 40(%edx), %mm3 - - pfadd %mm0, %mm6 - movq 32(%eax), %mm0 - pfadd %mm1, %mm7 - movq 40(%eax), %mm1 - - addl $32, %edx - addl $32, %eax - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's see if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - andl $1, %ecx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 & mm1/mm3 preloaded - # from the main loop. - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - pfpnacc %mm3, %mm1 - - pfadd %mm0, %mm6 - pfadd %mm1, %mm7 - -.Leven: - # at this point mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - - movl 20(%ebp), %eax # result - movq %mm6, (%eax) - - femms - - popl %ebp - ret - -FUNC_TAIL(ccomplex_dotprod_3dnowext) - .ident "Hand coded x86 3DNow!Ext assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext64.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext64.S deleted file mode 100644 index 75608914b0..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext64.S +++ /dev/null @@ -1,192 +0,0 @@ -# -# Copyright 2002,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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - .file "ccomplex_dotprod_3dnowext64.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_3dnowext) - DEF_FUNC_HEAD(ccomplex_dotprod_3dnowext) -GLOB_SYMB(ccomplex_dotprod_3dnowext): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - - # zero accumulators - - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - movq 0(%rdi), %mm0 - movq 0(%rsi), %mm2 - - shr $1, %rax # rax = n_2_ccomplex_blocks / 2 - - movq 8(%rdi), %mm1 - movq 8(%rsi), %mm3 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z -# -# movq 0(%rdi), %mmA -# movq 0(%rsi), %mmB -# pswapd %mmA, %mmZ -# pfmul %mmB, %mmA -# pfmul %mmZ, %mmB -# pfpnacc %mmB, %mmA -# pfadd %mmA, %mmC - - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - movq 16(%rsi), %mm2 - pfpnacc %mm3, %mm1 - movq 24(%rsi), %mm3 - - pfadd %mm0, %mm6 - movq 16(%rdi), %mm0 - pfadd %mm1, %mm7 - movq 24(%rdi), %mm1 - -# unroll - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - movq 32(%rsi), %mm2 - pfpnacc %mm3, %mm1 - movq 40(%rsi), %mm3 - - pfadd %mm0, %mm6 - movq 32(%rdi), %mm0 - pfadd %mm1, %mm7 - movq 40(%rdi), %mm1 - - add $32, %rsi - add $32, %rdi - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's see if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - and $1, %rdx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 & mm1/mm3 preloaded - # from the main loop. - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - pfpnacc %mm3, %mm1 - - pfadd %mm0, %mm6 - pfadd %mm1, %mm7 - -.Leven: - # at this point mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - - movq %mm6, (%rcx) # result - - femms - - retq - -FUNC_TAIL(ccomplex_dotprod_3dnowext) - .ident "Hand coded x86_64 3DNow!Ext assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc deleted file mode 100644 index a6f3922117..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_complex.h> -#include "ccomplex_dotprod_generic.h" - -#include <iostream> - -void -ccomplex_dotprod_generic (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, - float *result) -{ - gr_complex sum0(0,0); - gr_complex sum1(0,0); - - std::cerr << "Blah!!!\n"; - do { - const gr_complex tap0(taps[0], taps[1]); - const gr_complex tap1(taps[2], taps[3]); - const gr_complex input0(input[0], input[1]); - const gr_complex input1(input[2], input[3]); - - sum0 += input0 * tap0; - sum1 += input1 * tap1; - - input += 8; - taps += 8; - - } while (--n_2_ccomplex_blocks != 0); - - - sum0 += sum1; - result[0] = sum0.real(); - result[1] = sum0.imag(); -} diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h deleted file mode 100644 index c7d761c079..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h +++ /dev/null @@ -1,34 +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 _CCOMPLEX_DOTPROD_GENERIC_H_ -#define _CCOMPLEX_DOTPROD_GENERIC_H_ - -#include <gr_core_api.h> - -GR_CORE_API void -ccomplex_dotprod_generic (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, - float *result); - - -#endif /* _CCOMPLEX_DOTPROD_GENERIC_H_ */ diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse.S deleted file mode 100644 index 3d16c352ec..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse.S +++ /dev/null @@ -1,198 +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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - .file "ccomplex_dotprod_sse.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_sse) - DEF_FUNC_HEAD(ccomplex_dotprod_sse) -GLOB_SYMB(ccomplex_dotprod_sse): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - - xorps %xmm6, %xmm6 # zero accumulators - - movaps 0(%eax), %xmm0 - - xorps %xmm7, %xmm7 # zero accumulators - - movaps 0(%edx), %xmm2 - - shrl $1, %ecx # ecx = n_2_ccomplex_blocks / 2 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000 -# -# movaps (%eax), %xmmA -# movaps (%edx), %xmmB -# -# movaps %xmmA, %xmmZ -# shufps $0xb1, %xmmZ, %xmmZ # swap internals -# -# mulps %xmmB, %xmmA -# mulps %xmmZ, %xmmB -# -# # SSE replacement for: pfpnacc %xmmB, %xmmA -# xorps %xmmPN, %xmmA -# movaps %xmmA, %xmmZ -# unpcklps %xmmB, %xmmA -# unpckhps %xmmB, %xmmZ -# movaps %xmmZ, %xmmY -# shufps $0x44, %xmmA, %xmmZ # b01000100 -# shufps $0xee, %xmmY, %xmmA # b11101110 -# addps %xmmZ, %xmmA -# -# addps %xmmA, %xmmC - -# A=xmm0, B=xmm2, Z=xmm4 -# A'=xmm1, B'=xmm3, Z'=xmm5 - - movaps 16(%eax), %xmm1 - - movaps %xmm0, %xmm4 - mulps %xmm2, %xmm0 - - shufps $0xb1, %xmm4, %xmm4 # swap internals - movaps 16(%edx), %xmm3 - movaps %xmm1, %xmm5 - addps %xmm0, %xmm6 - mulps %xmm3, %xmm1 - shufps $0xb1, %xmm5, %xmm5 # swap internals - addps %xmm1, %xmm6 - mulps %xmm4, %xmm2 - movaps 32(%eax), %xmm0 - addps %xmm2, %xmm7 - mulps %xmm5, %xmm3 - - addl $32, %eax - - movaps 32(%edx), %xmm2 - addps %xmm3, %xmm7 - - addl $32, %edx - - - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's sse if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - andl $1, %ecx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 preloaded - # from the main loop. - - movaps %xmm0, %xmm4 - mulps %xmm2, %xmm0 - shufps $0xb1, %xmm4, %xmm4 # swap internals - addps %xmm0, %xmm6 - mulps %xmm4, %xmm2 - addps %xmm2, %xmm7 - - -.Leven: - # neg inversor - xorps %xmm1, %xmm1 - movl $0x80000000, 16(%ebp) - movss 16(%ebp), %xmm1 - shufps $0x11, %xmm1, %xmm1 # b00010001 # 0 -0 0 -0 - - # pfpnacc - xorps %xmm1, %xmm6 - - movaps %xmm6, %xmm2 - unpcklps %xmm7, %xmm6 - unpckhps %xmm7, %xmm2 - movaps %xmm2, %xmm3 - shufps $0x44, %xmm6, %xmm2 # b01000100 - shufps $0xee, %xmm3, %xmm6 # b11101110 - addps %xmm2, %xmm6 - - # xmm6 = r1 i2 r3 i4 - movl 20(%ebp), %eax # @result - movhlps %xmm6, %xmm4 # xmm4 = r3 i4 ?? ?? - addps %xmm4, %xmm6 # xmm6 = r1+r3 i2+i4 ?? ?? - movlps %xmm6, (%eax) # store low 2x32 bits (complex) to memory - - popl %ebp - ret - -FUNC_TAIL(ccomplex_dotprod_sse) - .ident "Hand coded x86 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse64.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse64.S deleted file mode 100644 index 95ac3dac34..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse64.S +++ /dev/null @@ -1,195 +0,0 @@ -# -# Copyright 2002,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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "ccomplex_dotprod_sse64.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_sse) - DEF_FUNC_HEAD(ccomplex_dotprod_sse) -GLOB_SYMB(ccomplex_dotprod_sse): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - xorps %xmm6, %xmm6 # zero accumulators - - movaps 0(%rdi), %xmm0 - - xorps %xmm7, %xmm7 # zero accumulators - - movaps 0(%rsi), %xmm2 - - shr $1, %rax # rax = n_2_ccomplex_blocks / 2 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000 -# -# movaps (%rdi), %xmmA -# movaps (%rsi), %xmmB -# -# movaps %xmmA, %xmmZ -# shufps $0xb1, %xmmZ, %xmmZ # swap internals -# -# mulps %xmmB, %xmmA -# mulps %xmmZ, %xmmB -# -# # SSE replacement for: pfpnacc %xmmB, %xmmA -# xorps %xmmPN, %xmmA -# movaps %xmmA, %xmmZ -# unpcklps %xmmB, %xmmA -# unpckhps %xmmB, %xmmZ -# movaps %xmmZ, %xmmY -# shufps $0x44, %xmmA, %xmmZ # b01000100 -# shufps $0xee, %xmmY, %xmmA # b11101110 -# addps %xmmZ, %xmmA -# -# addps %xmmA, %xmmC - -# A=xmm0, B=xmm2, Z=xmm4 -# A'=xmm1, B'=xmm3, Z'=xmm5 - - movaps 16(%rdi), %xmm1 - - movaps %xmm0, %xmm4 - mulps %xmm2, %xmm0 - - shufps $0xb1, %xmm4, %xmm4 # swap internals - movaps 16(%rsi), %xmm3 - movaps %xmm1, %xmm5 - addps %xmm0, %xmm6 - mulps %xmm3, %xmm1 - shufps $0xb1, %xmm5, %xmm5 # swap internals - addps %xmm1, %xmm6 - mulps %xmm4, %xmm2 - movaps 32(%rdi), %xmm0 - addps %xmm2, %xmm7 - mulps %xmm5, %xmm3 - - add $32, %rdi - - movaps 32(%rsi), %xmm2 - addps %xmm3, %xmm7 - - add $32, %rsi - - - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's sse if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - and $1, %rdx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 preloaded - # from the main loop. - - movaps %xmm0, %xmm4 - mulps %xmm2, %xmm0 - shufps $0xb1, %xmm4, %xmm4 # swap internals - addps %xmm0, %xmm6 - mulps %xmm4, %xmm2 - addps %xmm2, %xmm7 - - -.Leven: - # neg inversor - xorps %xmm1, %xmm1 - movl $0x80000000, -8(%rsp) - movss -8(%rsp), %xmm1 - shufps $0x11, %xmm1, %xmm1 # b00010001 # 0 -0 0 -0 - - # pfpnacc - xorps %xmm1, %xmm6 - - movaps %xmm6, %xmm2 - unpcklps %xmm7, %xmm6 - unpckhps %xmm7, %xmm2 - movaps %xmm2, %xmm3 - shufps $0x44, %xmm6, %xmm2 # b01000100 - shufps $0xee, %xmm3, %xmm6 # b11101110 - addps %xmm2, %xmm6 - - # xmm6 = r1 i2 r3 i4 - movhlps %xmm6, %xmm4 # xmm4 = r3 i4 ?? ?? - addps %xmm4, %xmm6 # xmm6 = r1+r3 i2+i4 ?? ?? - movlps %xmm6, (%rcx) # store low 2x32 bits (complex) to memory - - retq - -FUNC_TAIL(ccomplex_dotprod_sse) - .ident "Hand coded x86_64 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_x86.h b/gnuradio-core/src/lib/filter/ccomplex_dotprod_x86.h deleted file mode 100644 index ebb63c2587..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_x86.h +++ /dev/null @@ -1,46 +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 _CCOMPLEX_DOTPROD_X86_H_ -#define _CCOMPLEX_DOTPROD_X86_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -void -ccomplex_dotprod_3dnow (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, float *result); - -void -ccomplex_dotprod_3dnowext (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, float *result); - -void -ccomplex_dotprod_sse (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, float *result); - -#ifdef __cplusplus -} -#endif - -#endif /* _CCOMPLEX_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnow.S deleted file mode 100644 index be49bb863f..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_3dnow.S +++ /dev/null @@ -1,192 +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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - .file "complex_dotprod_3dnow.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_3dnow) - DEF_FUNC_HEAD(complex_dotprod_3dnow) -GLOB_SYMB(complex_dotprod_3dnow): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - - shrl $1, %ecx # ecx = n_2_complex_blocks / 2 - - # pshufw & pi2fw - pxor %mm0, %mm0 - punpcklwd 0(%eax), %mm0 - psrad $16, %mm0 - punpckldq %mm0, %mm0 - pi2fd %mm0, %mm0 - - pxor %mm1, %mm1 - punpcklwd 0(%eax), %mm1 - psrad $16, %mm1 - punpckhdq %mm1, %mm1 - pi2fd %mm1, %mm1 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%edx), %mm0 - pfadd %mm2, %mm6 - - pxor %mm2, %mm2 - punpcklwd 4(%eax), %mm2 - psrad $16, %mm2 - punpckldq %mm2, %mm2 - - pfmul 8(%edx), %mm1 - pfadd %mm3, %mm7 - pi2fd %mm2, %mm2 - - pxor %mm3, %mm3 - punpcklwd 4(%eax), %mm3 - psrad $16, %mm3 - punpckhdq %mm3, %mm3 - - pfmul 16(%edx), %mm2 - pfadd %mm0, %mm4 - pi2fd %mm3, %mm3 - - pxor %mm0, %mm0 - punpcklwd 8(%eax), %mm0 - psrad $16, %mm0 - punpckldq %mm0, %mm0 - - pfmul 24(%edx), %mm3 - pfadd %mm1, %mm5 - - pxor %mm1, %mm1 - punpcklwd 8(%eax), %mm1 - psrad $16, %mm1 - punpckhdq %mm1, %mm1 - - pi2fd %mm0, %mm0 - pi2fd %mm1, %mm1 - -#TODO: add prefetch - - addl $32, %edx - addl $8, %eax - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - movl 16(%ebp), %ecx - pfadd %mm2, %mm6 - andl $1, %ecx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%edx), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%edx), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - - movl 20(%ebp), %eax # result - - pfadd %mm6, %mm4 - - movq %mm4, (%eax) - femms - - popl %ebp - ret - -FUNC_TAIL(complex_dotprod_3dnow) - .ident "Hand coded x86 3DNow! assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnow64.S deleted file mode 100644 index f1c8130786..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_3dnow64.S +++ /dev/null @@ -1,187 +0,0 @@ -# -# Copyright 2002,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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - - .file "complex_dotprod_3dnow64.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_3dnow) - DEF_FUNC_HEAD(complex_dotprod_3dnow) -GLOB_SYMB(complex_dotprod_3dnow): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - - shr $1, %rax # rax = n_2_complex_blocks / 2 - - # pshufw & pi2fw - pxor %mm0, %mm0 - punpcklwd 0(%rdi), %mm0 - psrad $16, %mm0 - punpckldq %mm0, %mm0 - pi2fd %mm0, %mm0 - - pxor %mm1, %mm1 - punpcklwd 0(%rdi), %mm1 - psrad $16, %mm1 - punpckhdq %mm1, %mm1 - pi2fd %mm1, %mm1 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%rsi), %mm0 - pfadd %mm2, %mm6 - - pxor %mm2, %mm2 - punpcklwd 4(%rdi), %mm2 - psrad $16, %mm2 - punpckldq %mm2, %mm2 - - pfmul 8(%rsi), %mm1 - pfadd %mm3, %mm7 - pi2fd %mm2, %mm2 - - pxor %mm3, %mm3 - punpcklwd 4(%rdi), %mm3 - psrad $16, %mm3 - punpckhdq %mm3, %mm3 - - pfmul 16(%rsi), %mm2 - pfadd %mm0, %mm4 - pi2fd %mm3, %mm3 - - pxor %mm0, %mm0 - punpcklwd 8(%rdi), %mm0 - psrad $16, %mm0 - punpckldq %mm0, %mm0 - - pfmul 24(%rsi), %mm3 - pfadd %mm1, %mm5 - - pxor %mm1, %mm1 - punpcklwd 8(%rdi), %mm1 - psrad $16, %mm1 - punpckhdq %mm1, %mm1 - - pi2fd %mm0, %mm0 - pi2fd %mm1, %mm1 - -#TODO: add prefetch - - add $32, %rsi - add $8, %rdi - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - pfadd %mm2, %mm6 - and $1, %rdx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%rsi), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%rsi), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - pfadd %mm6, %mm4 - - movq %mm4, (%rcx) - femms - - retq - -FUNC_TAIL(complex_dotprod_3dnow) - .ident "Hand coded x86_64 3DNow! assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext.S deleted file mode 100644 index 52f04f10cb..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext.S +++ /dev/null @@ -1,171 +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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - .file "complex_dotprod_3dnowext.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_3dnowext) - DEF_FUNC_HEAD(complex_dotprod_3dnowext) -GLOB_SYMB(complex_dotprod_3dnowext): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - - shrl $1, %ecx # ecx = n_2_complex_blocks / 2 - - movd 0(%eax), %mm0 - pshufw $0x55, %mm0, %mm1 # b01010101 - pshufw $0, %mm0, %mm0 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - pi2fw %mm1, %mm1 - pi2fw %mm0, %mm0 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%edx), %mm0 - pfadd %mm2, %mm6 - - pshufw $0, 4(%eax), %mm2 - - pfmul 8(%edx), %mm1 - pfadd %mm3, %mm7 - pi2fw %mm2, %mm2 - - pshufw $0x55, 4(%eax), %mm3 # b01010101 - - pfmul 16(%edx), %mm2 - pi2fw %mm3, %mm3 - pfadd %mm0, %mm4 - - pshufw $0, 8(%eax), %mm0 - - pfmul 24(%edx), %mm3 - pfadd %mm1, %mm5 - - pshufw $0x55, 8(%eax), %mm1 # b01010101 - pi2fw %mm0, %mm0 - -#TODO: add prefetch - - addl $32, %edx - addl $8, %eax - pi2fw %mm1, %mm1 - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - movl 16(%ebp), %ecx - pfadd %mm2, %mm6 - andl $1, %ecx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%edx), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%edx), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - - movl 20(%ebp), %eax # result - pfadd %mm6, %mm4 - movq %mm4, (%eax) - - femms - - popl %ebp - ret - -FUNC_TAIL(complex_dotprod_3dnowext) - .ident "Hand coded x86 3DNow!Ext assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext64.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext64.S deleted file mode 100644 index 6d7ad5ad4e..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext64.S +++ /dev/null @@ -1,168 +0,0 @@ -# -# Copyright 2002,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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - - .file "complex_dotprod_3dnowext64.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_3dnowext) - DEF_FUNC_HEAD(complex_dotprod_3dnowext) -GLOB_SYMB(complex_dotprod_3dnowext): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - - shr $1, %rax # rax = n_2_complex_blocks / 2 - - movd 0(%rdi), %mm0 - pshufw $0x55, %mm0, %mm1 # b01010101 - pshufw $0, %mm0, %mm0 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - pi2fw %mm1, %mm1 - pi2fw %mm0, %mm0 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%rsi), %mm0 - pfadd %mm2, %mm6 - - pshufw $0, 4(%rdi), %mm2 - - pfmul 8(%rsi), %mm1 - pfadd %mm3, %mm7 - pi2fw %mm2, %mm2 - - pshufw $0x55, 4(%rdi), %mm3 # b01010101 - - pfmul 16(%rsi), %mm2 - pi2fw %mm3, %mm3 - pfadd %mm0, %mm4 - - pshufw $0, 8(%rdi), %mm0 - - pfmul 24(%rsi), %mm3 - pfadd %mm1, %mm5 - - pshufw $0x55, 8(%rdi), %mm1 # b01010101 - pi2fw %mm0, %mm0 - -#TODO: add prefetch - - add $32, %rsi - add $8, %rdi - pi2fw %mm1, %mm1 - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - pfadd %mm2, %mm6 - and $1, %rdx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%rsi), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%rsi), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - - pfadd %mm6, %mm4 - movq %mm4, (%rcx) - - femms - - retq - -FUNC_TAIL(complex_dotprod_3dnowext) - .ident "Hand coded x86_64 3DNow!Ext assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc b/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc deleted file mode 100644 index 229cbe9785..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc +++ /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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_complex.h> -#include "complex_dotprod_generic.h" - - -void -complex_dotprod_generic (const short *input, - const float *taps, unsigned n_2_complex_blocks, - float *result) -{ - gr_complex sum0(0,0); - gr_complex sum1(0,0); - - do { - const gr_complex tap0(taps[0], taps[1]); - const gr_complex tap1(taps[2], taps[3]); - - sum0 += (float)input[0] * tap0; - sum1 += (float)input[1] * tap1; - - input += 4; - taps += 8; - - } while (--n_2_complex_blocks != 0); - - - sum0 += sum1; - result[0] = sum0.real(); - result[1] = sum0.imag(); -} diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_generic.h b/gnuradio-core/src/lib/filter/complex_dotprod_generic.h deleted file mode 100644 index 152f6e4592..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_generic.h +++ /dev/null @@ -1,34 +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 _COMPLEX_DOTPROD_GENERIC_H_ -#define _COMPLEX_DOTPROD_GENERIC_H_ - -#include <gr_core_api.h> - -GR_CORE_API void -complex_dotprod_generic (const short *input, - const float *taps, unsigned n_2_complex_blocks, - float *result); - - -#endif /* _COMPLEX_DOTPROD_GENERIC_H_ */ diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_sse.S b/gnuradio-core/src/lib/filter/complex_dotprod_sse.S deleted file mode 100644 index fb998cc454..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_sse.S +++ /dev/null @@ -1,206 +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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "complex_dotprod_sse.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_sse) - DEF_FUNC_HEAD(complex_dotprod_sse) -GLOB_SYMB(complex_dotprod_sse): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx - - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_2_complex_blocks % 4) - - andl $0x3, %ecx - jmp .L1_test - - .p2align 4 -.Loop1: - - pxor %mm0, %mm0 - punpcklwd 0(%eax), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - mulps (%edx), %xmm0 - addl $0x10, %edx - addl $4, %eax - addps %xmm0, %xmm4 -.L1_test: - decl %ecx - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movl 16(%ebp), %ecx - movaps %xmm5, %xmm6 # zero remaining accumulators - movaps %xmm5, %xmm7 - - shrl $2, %ecx # n_2_complex_blocks / 4 - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - pxor %mm0, %mm0 - punpcklwd 0(%eax), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - movaps %xmm5, %xmm2 - - pxor %mm1, %mm1 - punpcklwd 4(%eax), %mm1 - psrad $16, %mm1 - cvtpi2ps %mm1, %xmm1 - shufps $0x50, %xmm1, %xmm1 - - movaps %xmm5, %xmm3 - - # we know ecx is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - mulps (%edx), %xmm0 - addps %xmm2, %xmm6 - - pxor %mm2, %mm2 - punpcklwd 8(%eax), %mm2 - psrad $16, %mm2 - cvtpi2ps %mm2, %xmm2 - shufps $0x50, %xmm2, %xmm2 - - mulps 0x10(%edx), %xmm1 - addps %xmm3, %xmm7 - - pxor %mm3, %mm3 - punpcklwd 12(%eax), %mm3 - psrad $16, %mm3 - cvtpi2ps %mm3, %xmm3 - shufps $0x50, %xmm3, %xmm3 - - mulps 0x20(%edx), %xmm2 - addps %xmm0, %xmm4 - - pxor %mm0, %mm0 - punpcklwd 16(%eax), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - mulps 0x30(%edx), %xmm3 - addps %xmm1, %xmm5 - - pxor %mm1, %mm1 - punpcklwd 20(%eax), %mm1 - psrad $16, %mm1 - cvtpi2ps %mm1, %xmm1 - shufps $0x50, %xmm1, %xmm1 - - addl $0x40, %edx - addl $0x10, %eax - decl %ecx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 2x2 partial sums. We need - # to compute a "horizontal complex add" across xmm4. - -.Lcleanup: # xmm4 = r1 i2 r3 i4 - movl 20(%ebp), %eax # @result - movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2 - addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4 - movlps %xmm0, (%eax) # store low 2x32 bits (complex) to memory - - emms - popl %ebp - ret - -FUNC_TAIL(complex_dotprod_sse) - .ident "Hand coded x86 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_sse64.S b/gnuradio-core/src/lib/filter/complex_dotprod_sse64.S deleted file mode 100644 index 67d3519e45..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_sse64.S +++ /dev/null @@ -1,202 +0,0 @@ -# -# Copyright 2002,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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "complex_dotprod_sse64.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_sse) - DEF_FUNC_HEAD(complex_dotprod_sse) -GLOB_SYMB(complex_dotprod_sse): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_2_complex_blocks % 4) - - and $0x3, %rax - jmp .L1_test - - .p2align 4 -.Loop1: - - pxor %mm0, %mm0 - punpcklwd 0(%rdi), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - mulps (%rsi), %xmm0 - add $0x10, %rsi - add $4, %rdi - addps %xmm0, %xmm4 -.L1_test: - dec %rax - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movaps %xmm5, %xmm6 # zero remaining accumulators - shr $2, %rdx # n_2_complex_blocks / 4 - movaps %xmm5, %xmm7 - - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - pxor %mm0, %mm0 - punpcklwd 0(%rdi), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - movaps %xmm5, %xmm2 - - pxor %mm1, %mm1 - punpcklwd 4(%rdi), %mm1 - psrad $16, %mm1 - cvtpi2ps %mm1, %xmm1 - shufps $0x50, %xmm1, %xmm1 - - movaps %xmm5, %xmm3 - - # we know rax is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - mulps (%rsi), %xmm0 - addps %xmm2, %xmm6 - - pxor %mm2, %mm2 - punpcklwd 8(%rdi), %mm2 - psrad $16, %mm2 - cvtpi2ps %mm2, %xmm2 - shufps $0x50, %xmm2, %xmm2 - - mulps 0x10(%rsi), %xmm1 - addps %xmm3, %xmm7 - - pxor %mm3, %mm3 - punpcklwd 12(%rdi), %mm3 - psrad $16, %mm3 - cvtpi2ps %mm3, %xmm3 - shufps $0x50, %xmm3, %xmm3 - - mulps 0x20(%rsi), %xmm2 - addps %xmm0, %xmm4 - - pxor %mm0, %mm0 - punpcklwd 16(%rdi), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - mulps 0x30(%rsi), %xmm3 - addps %xmm1, %xmm5 - - pxor %mm1, %mm1 - punpcklwd 20(%rdi), %mm1 - psrad $16, %mm1 - cvtpi2ps %mm1, %xmm1 - shufps $0x50, %xmm1, %xmm1 - - add $0x40, %rsi - add $0x10, %rdi - dec %rdx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 2x2 partial sums. We need - # to compute a "horizontal complex add" across xmm4. - -.Lcleanup: # xmm4 = r1 i2 r3 i4 - movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2 - addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4 - movlps %xmm0, (%rcx) # store low 2x32 bits (complex) to memory - - emms - retq - -FUNC_TAIL(complex_dotprod_sse) - .ident "Hand coded x86_64 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_x86.h b/gnuradio-core/src/lib/filter/complex_dotprod_x86.h deleted file mode 100644 index aad9fb5e9d..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_x86.h +++ /dev/null @@ -1,46 +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 _COMPLEX_DOTPROD_X86_H_ -#define _COMPLEX_DOTPROD_X86_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -void -complex_dotprod_3dnow (const short *input, - const float *taps, unsigned n_2_complex_blocks, float *result); - -void -complex_dotprod_3dnowext (const short *input, - const float *taps, unsigned n_2_complex_blocks, float *result); - -void -complex_dotprod_sse (const short *input, - const float *taps, unsigned n_2_complex_blocks, float *result); - -#ifdef __cplusplus -} -#endif - -#endif /* _COMPLEX_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c deleted file mode 100644 index c125b49b3c..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 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 <dotprod_ccf_armv7_a.h> - -/*! - * \param x any value - * \param pow2 must be a power of 2 - * \returns \p x rounded down to a multiple of \p pow2. - */ -static inline size_t -gr_p2_round_down(size_t x, size_t pow2) -{ - return x & -pow2; -} - - -#ifndef HAVE_MFPU_NEON - -void -dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n) -{ - size_t i; - res[0] = 0; - res[1] = 0; - - for (i = 0; i < n; i++){ - res[0] += a[2*i] * b[i]; - res[1] += a[2*i+1] * b[i]; - } -} - -#else - -/* - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - */ -void -dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n) -{ - - asm volatile( - "vmov.f32 q14, #0.0 \n\t" - "vmov.f32 q15, #0.0 \n\t" - "1: \n\t" - "subs %2, %2, #4 \n\t" - "vld2.f32 {q0-q1}, [%0]! \n\t" - "vld1.f32 {q2}, [%1]! \n\t" - "vmla.f32 q14, q0, q2 \n\t" - "vmla.f32 q15, q1, q2 \n\t" - "bgt 1b \n\t" - "vpadd.f32 d0, d28, d29 \n\t" - "vpadd.f32 d1, d30, d31 \n\t" - "vpadd.f32 d0, d0, d1 \n\t" - "vst1.f32 {d0}, [%3] \n\t" - - : "+&r"(a), "+&r"(b), "+&r"(n) - : "r"(res) - : "memory", "d0", "d1", "d2", "d3", "d4", "d5", - "d28", "d29", "d30", "d31" ); -} - - -#endif diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h deleted file mode 100644 index e42d6d10be..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_DOTPROD_CCF_ARMV7_A_H -#define INCLUDED_DOTPROD_CCF_ARMV7_A_H - -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - * <pre> - * - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - * - * </pre> - */ -void dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n); - -#ifdef __cplusplus -} -#endif - -#endif /* INCLUDED_DOTPROD_CCF_ARMV7_A_H */ diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c b/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c deleted file mode 100644 index 53d6df714f..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 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 <dotprod_fff_altivec.h> -#include <gr_altivec.h> - -/*! - * \param x any value - * \param pow2 must be a power of 2 - * \returns \p x rounded down to a multiple of \p pow2. - */ -static inline size_t -gr_p2_round_down(size_t x, size_t pow2) -{ - return x & -pow2; -} - - -#if 0 - -float -dotprod_fff_altivec(const float *a, const float *b, size_t n) -{ - float sum = 0; - for (size_t i = 0; i < n; i++){ - sum += a[i] * b[i]; - } - return sum; -} - -#else - -/* - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - */ -float -dotprod_fff_altivec(const float *_a, const float *_b, size_t n) -{ - const vec_float4 *a = (const vec_float4 *) _a; - const vec_float4 *b = (const vec_float4 *) _b; - - static const size_t UNROLL_CNT = 4; - - n = gr_p2_round_down(n, 4); - size_t loop_cnt = n / (UNROLL_CNT * FLOATS_PER_VEC); - size_t nleft = n % (UNROLL_CNT * FLOATS_PER_VEC); - - // printf("n = %zd, loop_cnt = %zd, nleft = %zd\n", n, loop_cnt, nleft); - - // Used with vperm to build a* from p* - vec_uchar16 lvsl_a = vec_lvsl(0, _a); - - vec_float4 p0, p1, p2, p3; - vec_float4 a0, a1, a2, a3; - vec_float4 b0, b1, b2, b3; - vec_float4 acc0 = {0, 0, 0, 0}; - vec_float4 acc1 = {0, 0, 0, 0}; - vec_float4 acc2 = {0, 0, 0, 0}; - vec_float4 acc3 = {0, 0, 0, 0}; - - // wind in - - p0 = vec_ld(0*VS, a); - p1 = vec_ld(1*VS, a); - p2 = vec_ld(2*VS, a); - p3 = vec_ld(3*VS, a); - a += UNROLL_CNT; - - a0 = vec_perm(p0, p1, lvsl_a); - b0 = vec_ld(0*VS, b); - p0 = vec_ld(0*VS, a); - - size_t i; - for (i = 0; i < loop_cnt; i++){ - - a1 = vec_perm(p1, p2, lvsl_a); - b1 = vec_ld(1*VS, b); - p1 = vec_ld(1*VS, a); - acc0 = vec_madd(a0, b0, acc0); - - a2 = vec_perm(p2, p3, lvsl_a); - b2 = vec_ld(2*VS, b); - p2 = vec_ld(2*VS, a); - acc1 = vec_madd(a1, b1, acc1); - - a3 = vec_perm(p3, p0, lvsl_a); - b3 = vec_ld(3*VS, b); - p3 = vec_ld(3*VS, a); - acc2 = vec_madd(a2, b2, acc2); - - a += UNROLL_CNT; - b += UNROLL_CNT; - - a0 = vec_perm(p0, p1, lvsl_a); - b0 = vec_ld(0*VS, b); - p0 = vec_ld(0*VS, a); - acc3 = vec_madd(a3, b3, acc3); - } - - /* - * The compiler ought to be able to figure out that 0, 4, 8 and 12 - * are the only possible values for nleft. - */ - switch (nleft){ - case 0: - break; - - case 4: - acc0 = vec_madd(a0, b0, acc0); - break; - - case 8: - a1 = vec_perm(p1, p2, lvsl_a); - b1 = vec_ld(1*VS, b); - acc0 = vec_madd(a0, b0, acc0); - acc1 = vec_madd(a1, b1, acc1); - break; - - case 12: - a1 = vec_perm(p1, p2, lvsl_a); - b1 = vec_ld(1*VS, b); - acc0 = vec_madd(a0, b0, acc0); - a2 = vec_perm(p2, p3, lvsl_a); - b2 = vec_ld(2*VS, b); - acc1 = vec_madd(a1, b1, acc1); - acc2 = vec_madd(a2, b2, acc2); - break; - } - - acc0 = acc0 + acc1; - acc2 = acc2 + acc3; - acc0 = acc0 + acc2; - - return horizontal_add_f(acc0); -} - -#endif diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h b/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h deleted file mode 100644 index a52370d56f..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_DOTPROD_FFF_ALTIVEC_H -#define INCLUDED_DOTPROD_FFF_ALTIVEC_H - -#include <gr_core_api.h> -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - * <pre> - * - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - * - * </pre> - */ -float -dotprod_fff_altivec(const float *a, const float *b, size_t n); - -#ifdef __cplusplus -} -#endif - - -#endif /* INCLUDED_DOTPROD_FFF_ALTIVEC_H */ diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c deleted file mode 100644 index 23bbef0338..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <dotprod_fff_armv7_a.h> - -/*! - * \param x any value - * \param pow2 must be a power of 2 - * \returns \p x rounded down to a multiple of \p pow2. - */ -static inline size_t -gr_p2_round_down(size_t x, size_t pow2) -{ - return x & -pow2; -} - - -#ifndef HAVE_MFPU_NEON - -float -dotprod_fff_armv7_a(const float *a, const float *b, size_t n) -{ - float sum = 0; - size_t i; - for (i = 0; i < n; i++){ - sum += a[i] * b[i]; - } - return sum; -} - -#else - -/* - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - */ -float -dotprod_fff_armv7_a(const float *a, const float *b, size_t n) -{ - float s = 0; - - asm ("vmov.f32 q8, #0.0 \n\t" - "vmov.f32 q9, #0.0 \n\t" - "1: \n\t" - "subs %3, %3, #8 \n\t" - "vld1.32 {d0,d1,d2,d3}, [%1]! \n\t" - "vld1.32 {d4,d5,d6,d7}, [%2]! \n\t" - "vmla.f32 q8, q0, q2 \n\t" - "vmla.f32 q9, q1, q3 \n\t" - "bgt 1b \n\t" - "vadd.f32 q8, q8, q9 \n\t" - "vpadd.f32 d0, d16, d17 \n\t" - "vadd.f32 %0, s0, s1 \n\t" - : "=w"(s), "+r"(a), "+r"(b), "+r"(n) - :: "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", - "d16", "d17", "d18", "d19"); - - return s; - -} - -#endif diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h deleted file mode 100644 index 6cea45cea3..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ -#ifndef INCLUDED_DOTPROD_FFF_ARMV7_A_H -#define INCLUDED_DOTPROD_FFF_ARMV7_A_H - -#include <gr_core_api.h> -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - * <pre> - * - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - * - * </pre> - */ -float -dotprod_fff_armv7_a(const float *a, const float *b, size_t n); - -#ifdef __cplusplus -} -#endif - - -#endif /* INCLUDED_DOTPROD_FFF_ARMV7_A_H */ diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow.S deleted file mode 100644 index 536e46dc16..0000000000 --- a/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow.S +++ /dev/null @@ -1,176 +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. -# - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# fcomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - - .file "fcomplex_dotprod_3dnow.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(fcomplex_dotprod_3dnow) - DEF_FUNC_HEAD(fcomplex_dotprod_3dnow) -GLOB_SYMB(fcomplex_dotprod_3dnow): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - shrl $1, %ecx # ecx = n_2_complex_blocks / 2 - - movq 0(%eax), %mm0 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - movq %mm0, %mm1 - punpckldq %mm0, %mm0 - punpckhdq %mm1, %mm1 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%edx), %mm0 - pfadd %mm2, %mm6 - - movq 8(%eax), %mm2 - - pfadd %mm3, %mm7 - - pfmul 8(%edx), %mm1 - - movq %mm2, %mm3 - punpckldq %mm2, %mm2 - punpckhdq %mm3, %mm3 - - - pfmul 16(%edx), %mm2 - pfadd %mm0, %mm4 - - movq 16(%eax), %mm0 - - pfadd %mm1, %mm5 - - movq %mm0, %mm1 - punpckldq %mm0, %mm0 - - pfmul 24(%edx), %mm3 - - punpckhdq %mm1, %mm1 - - -#TODO: add prefetch? - - addl $32, %edx - addl $16, %eax - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - movl 16(%ebp), %ecx - pfadd %mm2, %mm6 - andl $1, %ecx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%edx), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%edx), %mm1 - pfadd %mm1, %mm5 - - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - - movl 20(%ebp), %eax # result - - pfadd %mm6, %mm4 - - movq %mm4, (%eax) - femms - - popl %ebp - ret - -FUNC_TAIL(fcomplex_dotprod_3dnow) - .ident "Hand coded x86 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow64.S deleted file mode 100644 index d9a695949b..0000000000 --- a/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow64.S +++ /dev/null @@ -1,170 +0,0 @@ -# -# Copyright 2002,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. -# - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# fcomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - - .file "fcomplex_dotprod_3dnow64.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(fcomplex_dotprod_3dnow) - DEF_FUNC_HEAD(fcomplex_dotprod_3dnow) -GLOB_SYMB(fcomplex_dotprod_3dnow): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - shr $1, %rax # rax = n_2_complex_blocks / 2 - - movq 0(%rdi), %mm0 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - movq %mm0, %mm1 - punpckldq %mm0, %mm0 - punpckhdq %mm1, %mm1 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%rsi), %mm0 - pfadd %mm2, %mm6 - - movq 8(%rdi), %mm2 - - pfadd %mm3, %mm7 - - pfmul 8(%rsi), %mm1 - - movq %mm2, %mm3 - punpckldq %mm2, %mm2 - punpckhdq %mm3, %mm3 - - - pfmul 16(%rsi), %mm2 - pfadd %mm0, %mm4 - - movq 16(%rdi), %mm0 - - pfadd %mm1, %mm5 - - movq %mm0, %mm1 - punpckldq %mm0, %mm0 - - pfmul 24(%rsi), %mm3 - - punpckhdq %mm1, %mm1 - - -#TODO: add prefetch? - - add $32, %rsi - add $16, %rdi - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - pfadd %mm2, %mm6 - and $1, %rdx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%rsi), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%rsi), %mm1 - pfadd %mm1, %mm5 - - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - pfadd %mm6, %mm4 - - movq %mm4, (%rcx) # result - femms - - retq - -FUNC_TAIL(fcomplex_dotprod_3dnow) - .ident "Hand coded x86_64 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse.S deleted file mode 100644 index 4c5e956f27..0000000000 --- a/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse.S +++ /dev/null @@ -1,188 +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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# fcomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "fcomplex_dotprod_sse.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(fcomplex_dotprod_sse) - DEF_FUNC_HEAD(fcomplex_dotprod_sse) -GLOB_SYMB(fcomplex_dotprod_sse): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx - - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_2_complex_blocks % 4) - - andl $0x3, %ecx - jmp .L1_test - - .p2align 4 -.Loop1: - - movlps 0(%eax), %xmm0 - shufps $0x50, %xmm0, %xmm0 # b01010000 - - mulps (%edx), %xmm0 - addl $0x10, %edx - addl $8, %eax - addps %xmm0, %xmm4 -.L1_test: - decl %ecx - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movl 16(%ebp), %ecx - movaps %xmm5, %xmm6 # zero remaining accumulators - movaps %xmm5, %xmm7 - - shrl $2, %ecx # n_2_complex_blocks / 4 - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - movlps 0(%eax), %xmm0 - - movaps %xmm5, %xmm2 - movaps %xmm5, %xmm3 - - movlps 8(%eax), %xmm1 - shufps $0x50, %xmm0, %xmm0 - - shufps $0x50, %xmm1, %xmm1 - - # we know ecx is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - addps %xmm2, %xmm6 - movlps 0x10(%eax), %xmm2 - - addps %xmm3, %xmm7 - - mulps (%edx), %xmm0 - - movlps 0x18(%eax), %xmm3 - shufps $0x50, %xmm2, %xmm2 - - mulps 0x10(%edx), %xmm1 - - shufps $0x50, %xmm3, %xmm3 - - addps %xmm0, %xmm4 - movlps 0x20(%eax), %xmm0 - - addps %xmm1, %xmm5 - - mulps 0x20(%edx), %xmm2 - - movlps 0x28(%eax), %xmm1 - shufps $0x50, %xmm0, %xmm0 - - mulps 0x30(%edx), %xmm3 - - shufps $0x50, %xmm1, %xmm1 - - addl $0x40, %edx - addl $0x20, %eax - decl %ecx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 2x2 partial sums. We need - # to compute a "horizontal complex add" across xmm4. - -.Lcleanup: # xmm4 = r1 i2 r3 i4 - movl 20(%ebp), %eax # @result - movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2 - addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4 - movlps %xmm0, (%eax) # store low 2x32 bits (complex) to memory - - popl %ebp - ret - -FUNC_TAIL(fcomplex_dotprod_sse) - .ident "Hand coded x86 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse64.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse64.S deleted file mode 100644 index 53a4f25e0f..0000000000 --- a/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse64.S +++ /dev/null @@ -1,183 +0,0 @@ -# -# Copyright 2002,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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# fcomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "fcomplex_dotprod_sse64.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(fcomplex_dotprod_sse) - DEF_FUNC_HEAD(fcomplex_dotprod_sse) -GLOB_SYMB(fcomplex_dotprod_sse): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_2_complex_blocks % 4) - - and $0x3, %rax - jmp .L1_test - - .p2align 4 -.Loop1: - - movlps 0(%rdi), %xmm0 - shufps $0x50, %xmm0, %xmm0 # b01010000 - - mulps (%rsi), %xmm0 - add $0x10, %rsi - add $8, %rdi - addps %xmm0, %xmm4 -.L1_test: - dec %rax - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movaps %xmm5, %xmm6 # zero remaining accumulators - movaps %xmm5, %xmm7 - - shr $2, %rdx # n_2_complex_blocks / 4 - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - movlps 0(%rdi), %xmm0 - - movaps %xmm5, %xmm2 - movaps %xmm5, %xmm3 - - movlps 8(%rdi), %xmm1 - shufps $0x50, %xmm0, %xmm0 - - shufps $0x50, %xmm1, %xmm1 - - # we know rdx is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - addps %xmm2, %xmm6 - movlps 0x10(%rdi), %xmm2 - - addps %xmm3, %xmm7 - - mulps (%rsi), %xmm0 - - movlps 0x18(%rdi), %xmm3 - shufps $0x50, %xmm2, %xmm2 - - mulps 0x10(%rsi), %xmm1 - - shufps $0x50, %xmm3, %xmm3 - - addps %xmm0, %xmm4 - movlps 0x20(%rdi), %xmm0 - - addps %xmm1, %xmm5 - - mulps 0x20(%rsi), %xmm2 - - movlps 0x28(%rdi), %xmm1 - shufps $0x50, %xmm0, %xmm0 - - mulps 0x30(%rsi), %xmm3 - - shufps $0x50, %xmm1, %xmm1 - - add $0x40, %rsi - add $0x20, %rdi - dec %rdx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 2x2 partial sums. We need - # to compute a "horizontal complex add" across xmm4. - -.Lcleanup: # xmm4 = r1 i2 r3 i4 - movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2 - addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4 - movlps %xmm0, (%rcx) # store low 2x32 bits (complex) to memory - - retq - -FUNC_TAIL(fcomplex_dotprod_sse) - .ident "Hand coded x86_64 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_x86.h b/gnuradio-core/src/lib/filter/fcomplex_dotprod_x86.h deleted file mode 100644 index b7eddf936b..0000000000 --- a/gnuradio-core/src/lib/filter/fcomplex_dotprod_x86.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 _FCOMPLEX_DOTPROD_X86_H_ -#define _FCOMPLEX_DOTPROD_X86_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -void -fcomplex_dotprod_3dnow (const float *input, - const float *taps, unsigned n_2_complex_blocks, float *result); - -void -fcomplex_dotprod_sse (const float *input, - const float *taps, unsigned n_2_complex_blocks, float *result); - -#ifdef __cplusplus -} -#endif - -#endif /* _FCOMPLEX_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/filter.i b/gnuradio-core/src/lib/filter/filter.i deleted file mode 100644 index 12580aa101..0000000000 --- a/gnuradio-core/src/lib/filter/filter.i +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005,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. - */ - -%{ -#include <gr_iir_filter_ffd.h> -#include <gr_single_pole_iir_filter_ff.h> -#include <gr_single_pole_iir_filter_cc.h> -#include <gr_hilbert_fc.h> -#include <gr_filter_delay_fc.h> -#include <gr_fft_filter_ccc.h> -#include <gr_fft_filter_fff.h> -#include <gr_fractional_interpolator_ff.h> -#include <gr_fractional_interpolator_cc.h> -#include <gr_goertzel_fc.h> -#include <gr_pfb_channelizer_ccf.h> -#include <gr_pfb_synthesizer_ccf.h> -#include <gr_pfb_decimator_ccf.h> -#include <gr_pfb_interpolator_ccf.h> -#include <gr_pfb_arb_resampler_ccf.h> -#include <gr_pfb_arb_resampler_fff.h> -#include <gr_pfb_clock_sync_ccf.h> -#include <gr_pfb_clock_sync_fff.h> -#include <gr_dc_blocker_cc.h> -#include <gr_dc_blocker_ff.h> -%} - -%include "gr_iir_filter_ffd.i" -%include "gr_single_pole_iir_filter_ff.i" -%include "gr_single_pole_iir_filter_cc.i" -%include "gr_hilbert_fc.i" -%include "gr_filter_delay_fc.i" -%include "gr_fft_filter_ccc.i" -%include "gr_fft_filter_fff.i" -%include "gr_fractional_interpolator_ff.i" -%include "gr_fractional_interpolator_cc.i" -%include "gr_goertzel_fc.i" -%include "gr_pfb_channelizer_ccf.i" -%include "gr_pfb_synthesizer_ccf.i" -%include "gr_pfb_decimator_ccf.i" -%include "gr_pfb_interpolator_ccf.i" -%include "gr_pfb_arb_resampler_ccf.i" -%include "gr_pfb_arb_resampler_fff.i" -%include "gr_pfb_decimator_ccf.i" -%include "gr_pfb_interpolator_ccf.i" -%include "gr_pfb_arb_resampler_ccf.i" -%include "gr_pfb_clock_sync_ccf.i" -%include "gr_pfb_clock_sync_fff.i" -%include "gr_dc_blocker_cc.i" -%include "gr_dc_blocker_ff.i" - -%include "filter_generated.i" diff --git a/gnuradio-core/src/lib/filter/float_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/float_dotprod_3dnow.S deleted file mode 100644 index cdebe9bc31..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_3dnow.S +++ /dev/null @@ -1,152 +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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# float_dotprod_generic (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - -#include "assembly.h" - - - .file "float_dotprod_3dnow.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(float_dotprod_3dnow) - DEF_FUNC_HEAD(float_dotprod_3dnow) -GLOB_SYMB(float_dotprod_3dnow): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %edx - movl 12(%ebp), %eax - movl 16(%ebp), %ecx - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - shrl $1, %ecx # ecx = n_4_float_blocks / 2 - movq 0(%eax), %mm0 - movq 8(%eax), %mm1 - pxor %mm2, %mm2 - pxor %mm3, %mm3 - jmp .L1_test - - # - # 8 taps / loop - # something like 6 cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%edx), %mm0 - pfadd %mm2, %mm6 - movq 16(%eax), %mm2 - - pfmul 8(%edx), %mm1 - pfadd %mm3, %mm7 - movq 24(%eax), %mm3 - - pfmul 16(%edx), %mm2 - pfadd %mm0, %mm4 - movq 32(%eax), %mm0 - - pfmul 24(%edx), %mm3 - pfadd %mm1, %mm5 - movq 40(%eax), %mm1 - - addl $32, %edx - addl $32, %eax -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_4_float_blocks was odd. If so, we've got 4 more - # taps to do. - - movl 16(%ebp), %ecx - pfadd %mm2, %mm6 - andl $1, %ecx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 4 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%edx), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%edx), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - pfadd %mm6, %mm4 - pfacc %mm4, %mm4 - - movd %mm4, 16(%ebp) - femms - flds 16(%ebp) - - popl %ebp - ret - -FUNC_TAIL(float_dotprod_3dnow) - .ident "Hand coded x86 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/float_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/float_dotprod_3dnow64.S deleted file mode 100644 index 1e859d75a8..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_3dnow64.S +++ /dev/null @@ -1,149 +0,0 @@ -# -# Copyright 2002,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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# float_dotprod_generic (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - -#include "assembly.h" - - - .file "float_dotprod_3dnow64.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(float_dotprod_3dnow) - DEF_FUNC_HEAD(float_dotprod_3dnow) -GLOB_SYMB(float_dotprod_3dnow): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx - - mov %rdx, %rax - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - shr $1, %rax # rax = n_4_float_blocks / 2 - movq 0(%rsi), %mm0 - movq 8(%rsi), %mm1 - pxor %mm2, %mm2 - pxor %mm3, %mm3 - jmp .L1_test - - # - # 8 taps / loop - # something like 6 cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%rdi), %mm0 - pfadd %mm2, %mm6 - movq 16(%rsi), %mm2 - - pfmul 8(%rdi), %mm1 - pfadd %mm3, %mm7 - movq 24(%rsi), %mm3 - - pfmul 16(%rdi), %mm2 - pfadd %mm0, %mm4 - movq 32(%rsi), %mm0 - - pfmul 24(%rdi), %mm3 - pfadd %mm1, %mm5 - movq 40(%rsi), %mm1 - - add $32, %rdi - add $32, %rsi -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_4_float_blocks was odd. If so, we've got 4 more - # taps to do. - - pfadd %mm2, %mm6 - and $1, %rdx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 4 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%rdi), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%rdi), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - pfadd %mm6, %mm4 - pfacc %mm4, %mm4 - - movd %mm4, -8(%rsp) - movss -8(%rsp), %xmm0 - femms - - retq - -FUNC_TAIL(float_dotprod_3dnow) - .ident "Hand coded x86_64 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/float_dotprod_generic.c b/gnuradio-core/src/lib/filter/float_dotprod_generic.c deleted file mode 100644 index fb91390362..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_generic.c +++ /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. - */ - -#include "float_dotprod_generic.h" - - -float -float_dotprod_generic (const float *input, - const float *taps, unsigned n_4_float_blocks) -{ - float sum0 = 0; - float sum1 = 0; - float sum2 = 0; - float sum3 = 0; - - do { - - sum0 += input[0] * taps[0]; - sum1 += input[1] * taps[1]; - sum2 += input[2] * taps[2]; - sum3 += input[3] * taps[3]; - - input += 4; - taps += 4; - - } while (--n_4_float_blocks != 0); - - - return sum0 + sum1 + sum2 + sum3; -} diff --git a/gnuradio-core/src/lib/filter/float_dotprod_generic.h b/gnuradio-core/src/lib/filter/float_dotprod_generic.h deleted file mode 100644 index dee967642a..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_generic.h +++ /dev/null @@ -1,41 +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 _FLOAT_DOTPROD_GENERIC_H_ -#define _FLOAT_DOTPROD_GENERIC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -float -float_dotprod_generic (const float *input, - const float *taps, unsigned n_4_float_blocks); - - -#ifdef __cplusplus -} -#endif - - - -#endif /* _FLOAT_DOTPROD_GENERIC_H_ */ diff --git a/gnuradio-core/src/lib/filter/float_dotprod_sse.S b/gnuradio-core/src/lib/filter/float_dotprod_sse.S deleted file mode 100644 index 66604526d0..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_sse.S +++ /dev/null @@ -1,171 +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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# float_dotprod_generic (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - -#include "assembly.h" - - - .file "float_dotprod_sse.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(float_dotprod_sse) - DEF_FUNC_HEAD(float_dotprod_sse) -GLOB_SYMB(float_dotprod_sse): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %edx - movl 12(%ebp), %eax - movl 16(%ebp), %ecx - - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_4_float_blocks % 4) - - andl $0x3, %ecx - jmp .L1_test - - .p2align 4 -.Loop1: - movaps (%eax), %xmm0 - mulps (%edx), %xmm0 - addl $0x10, %edx - addl $0x10, %eax - addps %xmm0, %xmm4 -.L1_test: - decl %ecx - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movl 16(%ebp), %ecx - movaps %xmm5, %xmm6 # zero remaining accumulators - movaps %xmm5, %xmm7 - - shrl $2, %ecx # n_4_float_blocks / 4 - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - movaps 0x00(%eax), %xmm0 - movaps %xmm5, %xmm2 - movaps 0x10(%eax), %xmm1 - movaps %xmm5, %xmm3 - - # we know ecx is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - mulps (%edx), %xmm0 - addps %xmm2, %xmm6 - movaps 0x20(%eax), %xmm2 - - mulps 0x10(%edx), %xmm1 - addps %xmm3, %xmm7 - movaps 0x30(%eax), %xmm3 - - mulps 0x20(%edx), %xmm2 - addps %xmm0, %xmm4 - movaps 0x40(%eax), %xmm0 - - mulps 0x30(%edx), %xmm3 - addps %xmm1, %xmm5 - movaps 0x50(%eax), %xmm1 - - addl $0x40, %edx - addl $0x40, %eax - decl %ecx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 4 partial sums. We need - # to compute a "horizontal add" across xmm4. - # This is a fairly nasty operation... - -.Lcleanup: # xmm4 = d1 d2 d3 d4 - xorps %xmm0, %xmm0 # xmm0 = 0 0 0 0 (may be unnecessary) - movhlps %xmm4, %xmm0 # xmm0 = 0 0 d1 d2 - addps %xmm4, %xmm0 # xmm0 = d1 d2 d1+d3 d2+d4 - movaps %xmm0, %xmm1 # xmm1 = d1 d2 d1+d3 d2+d4 - shufps $0xE1, %xmm4, %xmm1 # xmm1 = d1 d2 d2+d4 d1+d3 - addss %xmm1, %xmm0 # xmm1 = d1 d2 d1+d3 d1+d2+d3+d4 - movss %xmm0, 16(%ebp) # store low 32 bits (sum) to memory - flds 16(%ebp) # and load onto FPU stack for return - - popl %ebp - ret - -FUNC_TAIL(float_dotprod_sse) - .ident "Hand coded x86 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/float_dotprod_sse64.S b/gnuradio-core/src/lib/filter/float_dotprod_sse64.S deleted file mode 100644 index 0dd0764c5e..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_sse64.S +++ /dev/null @@ -1,165 +0,0 @@ -# -# Copyright 2002,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. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# float_dotprod_generic (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - -#include "assembly.h" - - - .file "float_dotprod_sse64.S" -// .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(float_dotprod_sse) - DEF_FUNC_HEAD(float_dotprod_sse) -GLOB_SYMB(float_dotprod_sse): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx - - mov %rdx, %rax - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_4_float_blocks % 4) - - and $0x3, %rax - jmp .L1_test - - .p2align 4 -.Loop1: - movaps (%rsi), %xmm0 - mulps (%rdi), %xmm0 - add $0x10, %rdi - add $0x10, %rsi - addps %xmm0, %xmm4 -.L1_test: - dec %rax - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movaps %xmm5, %xmm6 # zero remaining accumulators - movaps %xmm5, %xmm7 - - shr $2, %rdx # n_4_float_blocks / 4 - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - movaps 0x00(%rsi), %xmm0 - movaps %xmm5, %xmm2 - movaps 0x10(%rsi), %xmm1 - movaps %xmm5, %xmm3 - - # we know rdx is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - mulps (%rdi), %xmm0 - addps %xmm2, %xmm6 - movaps 0x20(%rsi), %xmm2 - - mulps 0x10(%rdi), %xmm1 - addps %xmm3, %xmm7 - movaps 0x30(%rsi), %xmm3 - - mulps 0x20(%rdi), %xmm2 - addps %xmm0, %xmm4 - movaps 0x40(%rsi), %xmm0 - - mulps 0x30(%rdi), %xmm3 - addps %xmm1, %xmm5 - movaps 0x50(%rsi), %xmm1 - - add $0x40, %rdi - add $0x40, %rsi - dec %rdx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 4 partial sums. We need - # to compute a "horizontal add" across xmm4. - # This is a fairly nasty operation... - -.Lcleanup: # xmm4 = d1 d2 d3 d4 - xorps %xmm0, %xmm0 # xmm0 = 0 0 0 0 (may be unnecessary) - movhlps %xmm4, %xmm0 # xmm0 = 0 0 d1 d2 - addps %xmm4, %xmm0 # xmm0 = d1 d2 d1+d3 d2+d4 - movaps %xmm0, %xmm1 # xmm1 = d1 d2 d1+d3 d2+d4 - shufps $0xE1, %xmm4, %xmm1 # xmm1 = d1 d2 d2+d4 d1+d3 - addss %xmm1, %xmm0 # xmm1 = d1 d2 d1+d3 d1+d2+d3+d4 - - retq - -FUNC_TAIL(float_dotprod_sse) - .ident "Hand coded x86_64 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/float_dotprod_x86.h b/gnuradio-core/src/lib/filter/float_dotprod_x86.h deleted file mode 100644 index fd1a2cc937..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_x86.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 _FLOAT_DOTPROD_X86_H_ -#define _FLOAT_DOTPROD_X86_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -float -float_dotprod_3dnow (const float *input, - const float *taps, unsigned n_4_float_blocks); - -float -float_dotprod_sse (const float *input, - const float *taps, unsigned n_4_float_blocks); - -#ifdef __cplusplus -} -#endif - - - -#endif /* _FLOAT_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h b/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h deleted file mode 100644 index 98eeb33a31..0000000000 --- a/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. - * - * This file is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 3, or (at your option) any - * later version. - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * Under Section 7 of GPL version 3, you are granted additional - * permissions described in the GCC Runtime Library Exception, version - * 3.1, as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License and - * a copy of the GCC Runtime Library Exception along with this program; - * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - * <http://www.gnu.org/licenses/>. - */ - -/* %ecx */ -#define bit_SSE3 (1 << 0) -#define bit_PCLMUL (1 << 1) -#define bit_SSSE3 (1 << 9) -#define bit_FMA (1 << 12) -#define bit_CMPXCHG16B (1 << 13) -#define bit_SSE4_1 (1 << 19) -#define bit_SSE4_2 (1 << 20) -#define bit_MOVBE (1 << 22) -#define bit_POPCNT (1 << 23) -#define bit_AES (1 << 25) -#define bit_XSAVE (1 << 26) -#define bit_OSXSAVE (1 << 27) -#define bit_AVX (1 << 28) - -/* %edx */ -#define bit_CMPXCHG8B (1 << 8) -#define bit_CMOV (1 << 15) -#define bit_MMX (1 << 23) -#define bit_FXSAVE (1 << 24) -#define bit_SSE (1 << 25) -#define bit_SSE2 (1 << 26) - -/* Extended Features */ -/* %ecx */ -#define bit_LAHF_LM (1 << 0) -#define bit_SSE4a (1 << 6) -#define bit_SSE5 (1 << 11) - -/* %edx */ -#define bit_LM (1 << 29) -#define bit_3DNOWP (1 << 30) -#define bit_3DNOW (1 << 31) - - -#if defined(__i386__) && defined(__PIC__) -/* %ebx may be the PIC register. */ -#if __GNUC__ >= 3 -#define __cpuid(level, a, b, c, d) \ - __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ - "cpuid\n\t" \ - "xchg{l}\t{%%}ebx, %1\n\t" \ - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - -#define __cpuid_count(level, count, a, b, c, d) \ - __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ - "cpuid\n\t" \ - "xchg{l}\t{%%}ebx, %1\n\t" \ - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "0" (level), "2" (count)) -#else -/* Host GCCs older than 3.0 weren't supporting Intel asm syntax - nor alternatives in i386 code. */ -#define __cpuid(level, a, b, c, d) \ - __asm__ ("xchgl\t%%ebx, %1\n\t" \ - "cpuid\n\t" \ - "xchgl\t%%ebx, %1\n\t" \ - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - -#define __cpuid_count(level, count, a, b, c, d) \ - __asm__ ("xchgl\t%%ebx, %1\n\t" \ - "cpuid\n\t" \ - "xchgl\t%%ebx, %1\n\t" \ - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "0" (level), "2" (count)) -#endif -#else -#define __cpuid(level, a, b, c, d) \ - __asm__ ("cpuid\n\t" \ - : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - -#define __cpuid_count(level, count, a, b, c, d) \ - __asm__ ("cpuid\n\t" \ - : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ - : "0" (level), "2" (count)) -#endif - -/* Return highest supported input value for cpuid instruction. ext can - be either 0x0 or 0x8000000 to return highest supported value for - basic or extended cpuid information. Function returns 0 if cpuid - is not supported or whatever cpuid returns in eax register. If sig - pointer is non-null, then first four bytes of the signature - (as found in ebx register) are returned in location pointed by sig. */ - -static __inline unsigned int -__get_cpuid_max (unsigned int __ext, unsigned int *__sig) -{ - unsigned int __eax, __ebx, __ecx, __edx; - -#ifndef __x86_64__ -#if __GNUC__ >= 3 - /* See if we can use cpuid. On AMD64 we always can. */ - __asm__ ("pushf{l|d}\n\t" - "pushf{l|d}\n\t" - "pop{l}\t%0\n\t" - "mov{l}\t{%0, %1|%1, %0}\n\t" - "xor{l}\t{%2, %0|%0, %2}\n\t" - "push{l}\t%0\n\t" - "popf{l|d}\n\t" - "pushf{l|d}\n\t" - "pop{l}\t%0\n\t" - "popf{l|d}\n\t" - : "=&r" (__eax), "=&r" (__ebx) - : "i" (0x00200000)); -#else -/* Host GCCs older than 3.0 weren't supporting Intel asm syntax - nor alternatives in i386 code. */ - __asm__ ("pushfl\n\t" - "pushfl\n\t" - "popl\t%0\n\t" - "movl\t%0, %1\n\t" - "xorl\t%2, %0\n\t" - "pushl\t%0\n\t" - "popfl\n\t" - "pushfl\n\t" - "popl\t%0\n\t" - "popfl\n\t" - : "=&r" (__eax), "=&r" (__ebx) - : "i" (0x00200000)); -#endif - - if (!((__eax ^ __ebx) & 0x00200000)) - return 0; -#endif - - /* Host supports cpuid. Return highest supported cpuid input value. */ - __cpuid (__ext, __eax, __ebx, __ecx, __edx); - - if (__sig) - *__sig = __ebx; - - return __eax; -} - -/* Return cpuid data for requested cpuid level, as found in returned - eax, ebx, ecx and edx registers. The function checks if cpuid is - supported and returns 1 for valid cpuid information or 0 for - unsupported cpuid level. All pointers are required to be non-null. */ - -static __inline int -__get_cpuid (unsigned int __level, - unsigned int *__eax, unsigned int *__ebx, - unsigned int *__ecx, unsigned int *__edx) -{ - unsigned int __ext = __level & 0x80000000; - - if (__get_cpuid_max (__ext, 0) < __level) - return 0; - - __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx); - return 1; -} diff --git a/gnuradio-core/src/lib/filter/generate_all.py b/gnuradio-core/src/lib/filter/generate_all.py deleted file mode 100755 index 1da9f7209a..0000000000 --- a/gnuradio-core/src/lib/filter/generate_all.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2003 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along 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_gr_fir_filter_XXX -import generate_gr_interp_fir_filter_XXX -import generate_gr_rational_resampler_base_XXX -import generate_gr_freq_xlating_fir_filter_XXX -import generate_gr_fir_sysconfig_generic -import generate_gr_fir_sysconfig -import generate_gr_fir_util -import generate_gr_fir_XXX -import generate_gri_fir_filter_with_buffer_XXX - -def generate_all(): - generate_gr_fir_XXX.generate() - generate_gr_fir_filter_XXX.generate() - generate_gr_interp_fir_filter_XXX.generate() - generate_gr_rational_resampler_base_XXX.generate() - generate_gr_freq_xlating_fir_filter_XXX.generate() - generate_gr_fir_sysconfig_generic.generate() - generate_gr_fir_sysconfig.generate() - generate_gr_fir_util.generate() - generate_gri_fir_filter_with_buffer_XXX.generate() - output_glue('filter') - -if __name__ == '__main__': - generate_all() diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_fir_XXX.py deleted file mode 100755 index cf37fbb24d..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_fir_XXX.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along 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 -from generate_utils import * - -roots = ['gr_fir_XXX', 'gr_fir_XXX_generic'] - - -# figure out accumulator type. Use biggest of input, output and tap type - -def code3_to_acc_code (code3): - if i_code (code3) == 'c' or o_code (code3) == 'c' or tap_code (code3) == 'c': - return 'c' - if i_code (code3) == 'f' or o_code (code3) == 'f' or tap_code (code3) == 'f': - return 'f' - if i_code (code3) == 'i' or o_code (code3) == 'i' or tap_code (code3) == 'i': - return 'i' - return 'i' # even short short short needs int accumulator - - -def code3_to_input_cast (code3): - if i_code (code3) == 's' and o_code (code3) == 'c': - return '(float)' - return '' - -def expand_h_cc (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['FIR_TYPE'] = 'gr_fir_' + code3 - d['INPUT_CAST'] = code3_to_input_cast (code3) - acc_code = code3_to_acc_code (code3) - d['ACC_TYPE'] = char_to_type[acc_code] - if acc_code == 'c': - d['N_UNROLL'] = '2' - d['VRCOMPLEX_INCLUDE'] = '#include <gr_types.h>' - else: - d['N_UNROLL'] = '4' - d['VRCOMPLEX_INCLUDE'] = '' - return d - - -def generate (): - for r in roots: - for s in fir_signatures: - expand_h_cc (r, s) - - -if __name__ == '__main__': - generate () diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_filter_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_fir_filter_XXX.py deleted file mode 100755 index 50cc586e59..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_fir_filter_XXX.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,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 -from generate_utils import * - -roots = ['gr_fir_filter_XXX'] - - -def expand_h_cc_i (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['FIR_TYPE'] = 'gr_fir_' + code3 - return d - -def generate (): - for r in roots: - for s in fir_signatures: - expand_h_cc_i (r, s) - -if __name__ == '__main__': - generate () - diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py deleted file mode 100755 index 50d819fd18..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,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 generate_utils import * - - -# ---------------------------------------------------------------- - -def make_gr_fir_sysconfig_h (): - out = open_and_log_name ('gr_fir_sysconfig.h', 'w') - if not out: - return - - out.write (copyright) - - out.write ( -''' -/* - * WARNING: This file is automatically generated by generate_gr_fir_sysconfig.py - * Any changes made to this file will be overwritten. - */ - -#ifndef INCLUDED_GR_FIR_SYSCONFIG_H -#define INCLUDED_GR_FIR_SYSCONFIG_H - -#include <gr_types.h> - -''') - - # for sig in fir_signatures: - # out.write ('class gr_fir_' + sig + ';\n') - - out.write ('#include <gr_fir_util.h>\n') - - out.write ( -''' -/*! - * \\brief abstract base class for configuring the automatic selection of the - * fastest gr_fir for your platform. - * - * This is used internally by gr_fir_util. - */ - -class gr_fir_sysconfig { -public: - virtual ~gr_fir_sysconfig (); - -''') - - for sig in fir_signatures: - out.write ((' virtual gr_fir_%s *create_gr_fir_%s (const std::vector<%s> &taps) = 0;\n' % - (sig, sig, tap_type (sig)))) - - out.write ('\n') - - for sig in fir_signatures: - out.write ((' virtual void get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info) = 0;\n' % - (sig, sig))) - - out.write ( -''' -}; - -/* - * This returns the single instance of the appropriate derived class. - * This function must be defined only once in the system, and should be defined - * in the platform specific code. - */ - -gr_fir_sysconfig *gr_fir_sysconfig_singleton (); - - -#endif /* INCLUDED_GR_FIR_SYSCONFIG_H */ -''') - out.close () - - -# ---------------------------------------------------------------- - -def make_gr_fir_sysconfig_cc (): - out = open_and_log_name ('gr_fir_sysconfig.cc', 'w') - if not out: - return - - out.write (copyright) - - out.write ( -''' -/* - * WARNING: This file is automatically generated by generate_gr_fir_sysconfig.py - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_sysconfig.h> - -gr_fir_sysconfig::~gr_fir_sysconfig () -{ -} -''') - out.close () - - -# ---------------------------------------------------------------- - -def generate (): - make_gr_fir_sysconfig_h () - make_gr_fir_sysconfig_cc () - -if __name__ == '__main__': - generate () diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py deleted file mode 100755 index dcbadd30f7..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py +++ /dev/null @@ -1,186 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,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 generate_utils import * - - -# ---------------------------------------------------------------- - -def make_gr_fir_sysconfig_generic_h (): - out = open_and_log_name ('gr_fir_sysconfig_generic.h', 'w') - if not out: - return - out.write (copyright) - - out.write ( -''' -/* - * WARNING: This file is automatically generated by - * generate_gr_fir_sysconfig_generic.py. - * - * Any changes made to this file will be overwritten. - */ - -#ifndef _GR_FIR_SYSCONFIG_GENERIC_H_ -#define _GR_FIR_SYSCONFIG_GENERIC_H_ - -#include <gr_fir_sysconfig.h> - -''') - - out.write ( -''' -class gr_fir_sysconfig_generic : public gr_fir_sysconfig { -public: -''') - - for sig in fir_signatures: - out.write ((' virtual gr_fir_%s *create_gr_fir_%s (const std::vector<%s> &taps);\n' % - (sig, sig, tap_type (sig)))) - - out.write ('\n') - - for sig in fir_signatures: - out.write ((' virtual void get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info);\n' % - (sig, sig))) - - out.write ( -''' -}; - - -#endif /* _GR_FIR_SYSCONFIG_GENERIC_H_ */ -''') - out.close () - - -# ---------------------------------------------------------------- - -def make_constructor (sig, out): - out.write (''' -static gr_fir_%s * -make_gr_fir_%s (const std::vector<%s> &taps) -{ - return new gr_fir_%s_generic (taps); -} -''' % (sig, sig, tap_type (sig), sig)) - - -def make_creator (sig, out): - out.write (''' -gr_fir_%s * -gr_fir_sysconfig_generic::create_gr_fir_%s (const std::vector<%s> &taps) -{ - return make_gr_fir_%s (taps); -} -''' % (sig, sig, tap_type (sig), sig)) - - -def make_info (sig, out): - out.write (''' -void -gr_fir_sysconfig_generic::get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info) -{ - info->resize (1); - (*info)[0].name = "generic"; - (*info)[0].create = make_gr_fir_%s; -} -''' % (sig, sig, sig)) - - -# ---------------------------------------------------------------- - -def make_gr_fir_sysconfig_generic_cc (): - out = open_and_log_name ('gr_fir_sysconfig_generic.cc', 'w') - if not out: - return - out.write (copyright) - - out.write ( -''' -/* - * WARNING: This file is automatically generated by - * generate_gr_fir_sysconfig_generic.py. - * - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_sysconfig_generic.h> - -''') - - for sig in fir_signatures: - out.write ('#include <gr_fir_%s_generic.h>\n' % (sig)) - - out.write ( -''' -/* - * ---------------------------------------------------------------- - * static functions that serve as constructors returned by info - * ---------------------------------------------------------------- - */ -''') - - for sig in fir_signatures: - make_constructor (sig, out) - - out.write ( -''' -/* - * ---------------------------------------------------------------- - * return instances of the generic C++ versions of these classes. - * ---------------------------------------------------------------- - */ -''') - - for sig in fir_signatures: - make_creator (sig, out) - - out.write ( -''' -/* - * Return info about available implementations. - * - * This is the bottom of the concrete hierarchy, so we set the - * size of the vector to 1, and install our info. Classes derived - * from us invoke us first, then append their own info. - */ -''') - - for sig in fir_signatures: - make_info (sig, out) - - - out.close () - -# ---------------------------------------------------------------- - -def generate (): - make_gr_fir_sysconfig_generic_h () - make_gr_fir_sysconfig_generic_cc () - -if __name__ == '__main__': - generate () diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_util.py b/gnuradio-core/src/lib/filter/generate_gr_fir_util.py deleted file mode 100755 index 79fa51c278..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_fir_util.py +++ /dev/null @@ -1,190 +0,0 @@ -#!/bin/env python -# -# Copyright 2003,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 generate_utils import * - -def make_info_struct (out, sig): - out.write ( -''' -struct GR_CORE_API gr_fir_%s_info { - const char *name; // implementation name, e.g., "generic", "SSE", "3DNow!" - gr_fir_%s *(*create)(const std::vector<%s> &taps); -}; -''' % (sig, sig, tap_type(sig))) - -def make_create (out, sig): - out.write (''' static gr_fir_%s *create_gr_fir_%s (const std::vector<%s> &taps); -''' % (sig, sig, tap_type (sig))) - -def make_info (out, sig): - out.write (''' static void get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info); -''' % (sig, sig)) - - -# ---------------------------------------------------------------- - -def make_gr_fir_util_h (): - out = open_and_log_name ('gr_fir_util.h', 'w') - if not out: - return - out.write (copyright) - - out.write ( -''' -/* - * WARNING: This file is automatically generated by - * generate_gr_fir_util.py. - * - * Any changes made to this file will be overwritten. - */ - -#ifndef INCLUDED_GR_FIR_UTIL_H -#define INCLUDED_GR_FIR_UTIL_H - -/*! - * \\brief routines to create gr_fir_XXX's - * - * This class handles selecting the fastest version of the finite - * implulse response filter available for your platform. This - * interface should be used by the rest of the system for creating - * gr_fir_XXX's. - * - * The trailing suffix has the form _IOT where I codes the input type, - * O codes the output type, and T codes the tap type. - * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), - * 'i' (short) - */ - -#include <gr_core_api.h> -#include <gr_types.h> - -''') - - for sig in fir_signatures: - out.write ('class gr_fir_%s;\n' % sig); - - out.write ('\n// structures returned by get_gr_fir_XXX_info methods\n\n') - - for sig in fir_signatures: - make_info_struct (out, sig) - - out.write (''' -struct GR_CORE_API gr_fir_util { - - // create a fast version of gr_fir_XXX. - -''') - - for sig in fir_signatures: - make_create (out, sig) - - out.write (''' - // Get information about all gr_fir_XXX implementations. - // This is useful for benchmarking, testing, etc without having to - // know a priori what's linked into this image - // - // The caller must pass in a valid pointer to a vector. - // The vector will be filled with structs describing the - // available implementations. - -''') - - for sig in fir_signatures: - make_info (out, sig) - - out.write (''' -}; - -#endif /* INCLUDED_GR_FIR_UTIL_H */ -''') - out.close () - - -# ---------------------------------------------------------------- - -def make_constructor_cc (out, sig): - out.write ( -''' -gr_fir_%s * -gr_fir_util::create_gr_fir_%s (const std::vector<%s> &taps) -{ - return gr_fir_sysconfig_singleton()->create_gr_fir_%s (taps); -} -''' % (sig, sig, tap_type (sig), sig)) - - -def make_info_cc (out, sig): - out.write ( -''' -void -gr_fir_util::get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info) -{ - gr_fir_sysconfig_singleton()->get_gr_fir_%s_info (info); -} -''' % (sig, sig, sig)) - - -def make_gr_fir_util_cc (): - out = open_and_log_name ('gr_fir_util.cc', 'w') - if not out: - return - out.write (copyright) - out.write (''' - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_util.h> -#include <gr_fir_sysconfig.h> - -// -// There's no problem that can't be solved by the addition of -// another layer of indirection... -// - -// --- constructors --- - -''') - - for sig in fir_signatures: - make_constructor_cc (out, sig) - - out.write (''' -// --- info gatherers --- - -''') - - for sig in fir_signatures: - make_info_cc (out, sig) - - out.close () - - -# ---------------------------------------------------------------- - -def generate (): - make_gr_fir_util_h () - make_gr_fir_util_cc () - -if __name__ == '__main__': - generate () - diff --git a/gnuradio-core/src/lib/filter/generate_gr_freq_xlating_fir_filter_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_freq_xlating_fir_filter_XXX.py deleted file mode 100755 index 41c0b2b70c..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_freq_xlating_fir_filter_XXX.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,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 -from generate_utils import * - -# files to generate - -fx_signatures = [ 'scf', 'scc', 'fcf', 'fcc', 'ccf', 'ccc' ] - -roots = ['gr_freq_xlating_fir_filter_XXX'] - -def expand_h_cc_i (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['FIR_TYPE'] = 'gr_fir_' + i_code (code3) + 'cc' - return d - - -def generate (): - for r in roots: - for s in fx_signatures: - expand_h_cc_i (r, s) - - -if __name__ == '__main__': - generate () diff --git a/gnuradio-core/src/lib/filter/generate_gr_interp_fir_filter_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_interp_fir_filter_XXX.py deleted file mode 100644 index 1dcfdadede..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_interp_fir_filter_XXX.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,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 -from generate_utils import * - -roots = ['gr_interp_fir_filter_XXX'] - -def expand_h_cc_i (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['FIR_TYPE'] = 'gr_fir_' + code3 - return d - -def generate (): - for r in roots: - for s in fir_signatures: - expand_h_cc_i (r, s) - -if __name__ == '__main__': - generate () - diff --git a/gnuradio-core/src/lib/filter/generate_gr_rational_resampler_base_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_rational_resampler_base_XXX.py deleted file mode 100644 index 1dafec3fbe..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_rational_resampler_base_XXX.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,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 -from generate_utils import * - -roots = ['gr_rational_resampler_base_XXX'] - -def expand_h_cc_i (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['FIR_TYPE'] = 'gr_fir_' + code3 - return d - -def generate (): - for r in roots: - for s in fir_signatures: - expand_h_cc_i (r, s) - -if __name__ == '__main__': - generate () - diff --git a/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py b/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py deleted file mode 100755 index 6442fb3dc2..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# - -import re -from generate_utils import * - -roots = ['gri_fir_filter_with_buffer_XXX',] - -def code3_to_acc_code (code3): - if i_code (code3) == 'c' or o_code (code3) == 'c' or tap_code (code3) == 'c': - return 'c' - if i_code (code3) == 'f' or o_code (code3) == 'f' or tap_code (code3) == 'f': - return 'f' - if i_code (code3) == 'i' or o_code (code3) == 'i' or tap_code (code3) == 'i': - return 'i' - return 'i' # even short short short needs int accumulator - -def code3_to_input_cast (code3): - if i_code (code3) == 's' and o_code (code3) == 'c': - return '(float)' - return '' - -def expand_h_cc (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['INPUT_CAST'] = code3_to_input_cast (code3) - acc_code = code3_to_acc_code (code3) - d['ACC_TYPE'] = char_to_type[acc_code] - return d - - -def generate (): - for r in roots: - for s in fir_signatures: - expand_h_cc (r, s) - - -if __name__ == '__main__': - generate () diff --git a/gnuradio-core/src/lib/filter/generate_utils.py b/gnuradio-core/src/lib/filter/generate_utils.py deleted file mode 100644 index 212ea95f9c..0000000000 --- a/gnuradio-core/src/lib/filter/generate_utils.py +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright 2003,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. -# - -## ----------------------------------------------------------------------- -## signatures defines which variations to generate (input, output, taps) - -fir_signatures = [ 'ccf', 'fcc', 'ccc', 'fff', 'scc', 'fsf' ] - - -## ----------------------------------------------------------------------- - -from build_utils import expand_template, copyright, open_and_log_name, standard_dict -from build_utils_codes import * diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc deleted file mode 100644 index da407caa0c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc +++ /dev/null @@ -1,88 +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_adaptive_fir_ccc.h> -#include <gr_io_signature.h> - -gr_adaptive_fir_ccc::gr_adaptive_fir_ccc(const char *name, int decimation, - const std::vector<gr_complex> &taps) - : gr_sync_decimator (name, - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - decimation), - d_updated(false), d_taps(taps) -{ - set_history(d_taps.size()); -} - -void -gr_adaptive_fir_ccc::set_taps(const std::vector<gr_complex> &taps) -{ - d_new_taps = taps; - d_updated = true; -} - -gr_complex -gr_adaptive_fir_ccc::filter(gr_complex *x) -{ - // Generic dot product of d_taps[] and in[] - gr_complex acc(0.0, 0.0); - int l = d_taps.size(); - for (int k = 0; k < l; k++) - acc += d_taps[l-k-1] * x[k]; - return acc; -} - -int -gr_adaptive_fir_ccc::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]; - - if (d_updated) { - d_taps = d_new_taps; - set_history(d_taps.size()); - d_updated = false; - return 0; // history requirements may have changed. - } - - int j = 0, k, l = d_taps.size(); - for (int i = 0; i < noutput_items; i++) { - out[i] = filter(&in[j]); - - // Adjust taps - d_error = error(out[i]); - for (k = 0; k < l; k++) { - update_tap(d_taps[l-k-1], in[j+k]); - } - - j += decimation(); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h deleted file mode 100644 index d144c3eb46..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h +++ /dev/null @@ -1,62 +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_GR_ADAPTIVE_FIR_CCC_H -#define INCLUDED_GR_ADAPTIVE_FIR_CCC_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -/*! - * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps - * \ingroup filter_blk - */ -class GR_CORE_API gr_adaptive_fir_ccc : public gr_sync_decimator -{ -private: - std::vector<gr_complex> d_new_taps; - bool d_updated; - -protected: - gr_complex d_error; - std::vector<gr_complex> d_taps; - - // Override to calculate error signal per output - virtual gr_complex error(const gr_complex &out) = 0; - - // Override to calculate new weight from old, corresponding input - virtual void update_tap(gr_complex &tap, const gr_complex &in) = 0; - - gr_complex filter(gr_complex *x); - - gr_adaptive_fir_ccc(const char *name, int decimation, - const std::vector<gr_complex> &taps); - -public: - void set_taps(const std::vector<gr_complex> &taps); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.i b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.i deleted file mode 100644 index a3c875a3dc..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.i +++ /dev/null @@ -1,31 +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. - */ - -class gr_adaptive_fir_ccc : public gr_sync_decimator -{ -protected: - gr_adaptive_fir_ccc(char *name, int decimation, - const std::vector<gr_complex> &taps); - -public: - void set_taps(const std::vector<gr_complex> &taps); -}; diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.cc b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.cc deleted file mode 100644 index 045d9faf92..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 <gr_adaptive_fir_ccf.h> -#include <gr_io_signature.h> - -gr_adaptive_fir_ccf::gr_adaptive_fir_ccf(const char *name, int decimation, const std::vector<float> &taps) - : gr_sync_decimator (name, - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - decimation), - d_updated(false) -{ - d_taps = taps; - set_history(d_taps.size()); -} - -void gr_adaptive_fir_ccf::set_taps(const std::vector<float> &taps) -{ - d_new_taps = taps; - d_updated = true; -} - -int gr_adaptive_fir_ccf::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]; - - if (d_updated) { - d_taps = d_new_taps; - set_history(d_taps.size()); - d_updated = false; - return 0; // history requirements may have changed. - } - - int j = 0, k, l = d_taps.size(); - for (int i = 0; i < noutput_items; i++) { - // Generic dot product of d_taps[] and in[] - gr_complex sum(0.0, 0.0); - for (k = 0; k < l; k++) - sum += d_taps[l-k-1]*in[j+k]; - out[i] = sum; - - // Adjust taps - d_error = error(sum); - for (k = 0; k < l; k++) { - //printf("%f ", d_taps[k]); - update_tap(d_taps[l-k-1], in[j+k]); - } - //printf("\n"); - - j += decimation(); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h deleted file mode 100644 index 7ec78099f8..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.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_GR_ADAPTIVE_FIR_CCF_H -#define INCLUDED_GR_ADAPTIVE_FIR_CCF_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -/*! - * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps - * \ingroup filter_blk - */ -class GR_CORE_API gr_adaptive_fir_ccf : public gr_sync_decimator -{ -private: - std::vector<float> d_new_taps; - bool d_updated; - -protected: - float d_error; - std::vector<float> d_taps; - - // Override to calculate error signal per output - virtual float error(const gr_complex &out) = 0; - - // Override to calculate new weight from old, corresponding input - virtual void update_tap(float &tap, const gr_complex &in) = 0; - - gr_adaptive_fir_ccf(const char *name, int decimation, const std::vector<float> &taps); - -public: - void set_taps(const std::vector<float> &taps); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.i b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.i deleted file mode 100644 index 346defd4d1..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.i +++ /dev/null @@ -1,30 +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. - */ - -class gr_adaptive_fir_ccf : public gr_sync_decimator -{ -protected: - gr_adaptive_fir_ccf(char *name, int decimation, const std::vector<float> &taps); - -public: - void set_taps(const std::vector<float> &taps); -}; diff --git a/gnuradio-core/src/lib/filter/gr_altivec.c b/gnuradio-core/src/lib/filter/gr_altivec.c deleted file mode 100644 index 22a67291d4..0000000000 --- a/gnuradio-core/src/lib/filter/gr_altivec.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <gr_altivec.h> - -void -gr_print_vector_float(FILE *fp, vec_float4 v) -{ - union v_float_u u; - u.v = v; - fprintf(fp, "{ %f, %f, %f, %f }", u.f[0], u.f[1], u.f[2], u.f[3]); -} - -void -gr_pvf(FILE *fp, const char *label, vec_float4 v) -{ - fprintf(fp, "%s = ", label); - gr_print_vector_float(fp, v); - putc('\n', fp); -} diff --git a/gnuradio-core/src/lib/filter/gr_altivec.h b/gnuradio-core/src/lib/filter/gr_altivec.h deleted file mode 100644 index ed11490f58..0000000000 --- a/gnuradio-core/src/lib/filter/gr_altivec.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GR_ALTIVEC_H -#define INCLUDED_GR_ALTIVEC_H - -/* - * N.B., always use "vec_float4" et al. instead of "vector float" to - * ensure portability across the various powerpc compilers. Some of - * them treat "vector" as a context specific keyword, some don't. - * Avoid the problem by always using the defines in vec_types.h - * (included below) - */ - -#include <gr_core_api.h> -#include <altivec.h> -#undef bool // repair namespace pollution -#undef vector // repair namespace pollution - -#ifdef HAVE_VEC_TYPES_H -#include <vec_types.h> // use system version if we've got it -#else -#include <gr_vec_types.h> // fall back to our local copy -#endif -#undef qword // repair namespace pollution - -#include <stddef.h> -#include <stdio.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define VS sizeof(vec_float4) -#define FLOATS_PER_VEC (sizeof(vec_float4)/sizeof(float)) - -union v_float_u { - vec_float4 v; - float f[FLOATS_PER_VEC]; -}; - -GR_CORE_API void gr_print_vector_float(FILE *fp, vec_float4 v); -GR_CORE_API void gr_pvf(FILE *fp, const char *label, vec_float4 v); - -static inline float -horizontal_add_f(vec_float4 v) -{ - union v_float_u u; - vec_float4 t0 = vec_add(v, vec_sld(v, v, 8)); - vec_float4 t1 = vec_add(t0, vec_sld(t0, t0, 4)); - u.v = t1; - return u.f[0]; -} - -#ifdef __cplusplus -} -#endif - -#endif /* INCLUDED_GR_ALTIVEC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_cpu.h b/gnuradio-core/src/lib/filter/gr_cpu.h deleted file mode 100644 index 35824ac1ee..0000000000 --- a/gnuradio-core/src/lib/filter/gr_cpu.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _GR_CPU_H_ -#define _GR_CPU_H_ - -#include <gr_core_api.h> - -struct GR_CORE_API gr_cpu { - static bool has_mmx (); - static bool has_sse (); - static bool has_sse2 (); - static bool has_sse3 (); - static bool has_ssse3 (); - static bool has_sse4_1 (); - static bool has_sse4_2 (); - static bool has_3dnow (); - static bool has_3dnowext (); - static bool has_altivec (); - static bool has_armv7_a (); -}; - -#endif /* _GR_CPU_H_ */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/filter/gr_cpu_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_cpu_armv7_a.cc deleted file mode 100644 index 2450492066..0000000000 --- a/gnuradio-core/src/lib/filter/gr_cpu_armv7_a.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 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_cpu.h> - -bool -gr_cpu::has_mmx () -{ - return false; -} - -bool -gr_cpu::has_sse () -{ - return false; -} - -bool -gr_cpu::has_sse2 () -{ - return false; -} - -bool -gr_cpu::has_3dnow () -{ - return false; -} - -bool -gr_cpu::has_3dnowext () -{ - return false; -} - -bool -gr_cpu::has_altivec () -{ - return false; -} - -bool -gr_cpu::has_armv7_a () -{ - return true; -} diff --git a/gnuradio-core/src/lib/filter/gr_cpu_powerpc.cc b/gnuradio-core/src/lib/filter/gr_cpu_powerpc.cc deleted file mode 100644 index d613f0ae45..0000000000 --- a/gnuradio-core/src/lib/filter/gr_cpu_powerpc.cc +++ /dev/null @@ -1,65 +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 <gr_cpu.h> - -bool -gr_cpu::has_mmx () -{ - return false; -} - -bool -gr_cpu::has_sse () -{ - return false; -} - -bool -gr_cpu::has_sse2 () -{ - return false; -} - -bool -gr_cpu::has_3dnow () -{ - return false; -} - -bool -gr_cpu::has_3dnowext () -{ - return false; -} - -bool -gr_cpu::has_altivec () -{ - return true; // FIXME assume we've always got it -} - -bool -gr_cpu::has_armv7_a () -{ - return false; -} diff --git a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc deleted file mode 100644 index 3acd694d55..0000000000 --- a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 <gr_cpu.h> -#include "gcc_x86_cpuid.h" - -/* - * execute CPUID instruction, return EAX, EBX, ECX and EDX values in result - */ -#define cpuid_x86(op, r) __get_cpuid(op, r+0, r+1, r+2, r+3) - -/* - * CPUID functions returning a single datum - */ - -static inline unsigned int cpuid_eax(unsigned int op) -{ - unsigned int regs[4] = {0,0,0,0}; - cpuid_x86 (op, regs); - return regs[0]; -} - -static inline unsigned int cpuid_ebx(unsigned int op) -{ - unsigned int regs[4] = {0,0,0,0}; - cpuid_x86 (op, regs); - return regs[1]; -} - -static inline unsigned int cpuid_ecx(unsigned int op) -{ - unsigned int regs[4] = {0,0,0,0}; - cpuid_x86 (op, regs); - return regs[2]; -} - -static inline unsigned int cpuid_edx(unsigned int op) -{ - unsigned int regs[4] = {0,0,0,0}; - cpuid_x86 (op, regs); - return regs[3]; -} - -// ---------------------------------------------------------------- - -bool -gr_cpu::has_mmx () -{ - unsigned int edx = cpuid_edx (1); // standard features - return (edx & (1 << 23)) != 0; -} - -bool -gr_cpu::has_sse () -{ - unsigned int edx = cpuid_edx (1); // standard features - return (edx & (1 << 25)) != 0; -} - -bool -gr_cpu::has_sse2 () -{ - unsigned int edx = cpuid_edx (1); // standard features - return (edx & (1 << 26)) != 0; -} - -bool -gr_cpu::has_3dnow () -{ - unsigned int extended_fct_count = cpuid_eax (0x80000000); - if (extended_fct_count < 0x80000001) - return false; - - unsigned int extended_features = cpuid_edx (0x80000001); - return (extended_features & (1 << 31)) != 0; -} - -bool -gr_cpu::has_3dnowext () -{ - unsigned int extended_fct_count = cpuid_eax (0x80000000); - if (extended_fct_count < 0x80000001) - return false; - - unsigned int extended_features = cpuid_edx (0x80000001); - return (extended_features & (1 << 30)) != 0; -} - -bool -gr_cpu::has_altivec () -{ - return false; -} - -bool -gr_cpu::has_armv7_a () -{ - return false; -} - diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc deleted file mode 100644 index 0438a193fa..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc +++ /dev/null @@ -1,138 +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_dc_blocker_cc.h> -#include <gr_io_signature.h> -#include <cstdio> - -moving_averager_c::moving_averager_c(int D) - : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0) -{ - d_delay_line = std::deque<gr_complex>(d_length-1, gr_complex(0,0)); -} - -moving_averager_c::~moving_averager_c() -{ -} - -gr_complex -moving_averager_c::filter(gr_complex x) -{ - d_out_d1 = d_out; - d_delay_line.push_back(x); - d_out = d_delay_line[0]; - d_delay_line.pop_front(); - - gr_complex y = x - d_out_d1 + d_out_d2; - d_out_d2 = y; - - return (y / (float)(d_length)); -} - - - -gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form) -{ - return gnuradio::get_initial_sptr(new gr_dc_blocker_cc(D, long_form)); -} - - -gr_dc_blocker_cc::gr_dc_blocker_cc (int D, bool long_form) - : gr_sync_block ("dc_blocker_cc", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex))), - d_length(D), d_long_form(long_form) -{ - if(d_long_form) { - d_ma_0 = new moving_averager_c(D); - d_ma_1 = new moving_averager_c(D); - d_ma_2 = new moving_averager_c(D); - d_ma_3 = new moving_averager_c(D); - d_delay_line = std::deque<gr_complex>(d_length-1, gr_complex(0,0)); - } - else { - d_ma_0 = new moving_averager_c(D); - d_ma_1 = new moving_averager_c(D); - } -} - -gr_dc_blocker_cc::~gr_dc_blocker_cc() -{ - if(d_long_form) { - delete d_ma_0; - delete d_ma_1; - delete d_ma_2; - delete d_ma_3; - } - else { - delete d_ma_0; - delete d_ma_1; - } -} - -int -gr_dc_blocker_cc::get_group_delay() -{ - if(d_long_form) - return (2*d_length-2); - else - return d_length - 1; -} - -int -gr_dc_blocker_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]; - - if(d_long_form) { - gr_complex y1, y2, y3, y4, d; - for(int i = 0; i < noutput_items; i++) { - y1 = d_ma_0->filter(in[i]); - y2 = d_ma_1->filter(y1); - y3 = d_ma_2->filter(y2); - y4 = d_ma_3->filter(y3); - - d_delay_line.push_back(d_ma_0->delayed_sig()); - d = d_delay_line[0]; - d_delay_line.pop_front(); - - out[i] = d - y4; - } - } - else { - gr_complex y1, y2; - for(int i = 0; i < noutput_items; i++) { - y1 = d_ma_0->filter(in[i]); - y2 = d_ma_1->filter(y1); - out[i] = d_ma_0->delayed_sig() - y2; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h deleted file mode 100644 index e4d89a775c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h +++ /dev/null @@ -1,111 +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_GR_DC_BLOCKER_CC_H -#define INCLUDED_GR_DC_BLOCKER_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <deque> - -class GR_CORE_API moving_averager_c -{ -public: - moving_averager_c(int D); - ~moving_averager_c(); - - gr_complex filter(gr_complex x); - gr_complex delayed_sig() { return d_out; } - -private: - int d_length; - gr_complex d_out, d_out_d1, d_out_d2; - std::deque<gr_complex> d_delay_line; -}; - -class gr_dc_blocker_cc; -typedef boost::shared_ptr<gr_dc_blocker_cc> gr_dc_blocker_cc_sptr; -GR_CORE_API gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); - -/*! - * \class gr_dc_blocker_cc - * \brief a computationally efficient controllable DC blocker - * - * \ingroup filter_blk - * - * This block implements a computationally efficient DC blocker that produces - * a tighter notch filter around DC for a smaller group delay than an - * equivalent FIR filter or using a single pole IIR filter (though the IIR - * filter is computationally cheaper). - * - * The block defaults to using a delay line of length 32 and the long form - * of the filter. Optionally, the delay line length can be changed to alter - * the width of the DC notch (longer lines will decrease the width). - * - * The long form of the filter produces a nearly flat response outside of - * the notch but at the cost of a group delay of 2D-2. - * - * The short form of the filter does not have as flat a response in the - * passband but has a group delay of only D-1 and is cheaper to compute. - * - * The theory behind this block can be found in the paper: - * - * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine, - * Mar. 2008, pp 132-134.</EM></B> - */ -class GR_CORE_API gr_dc_blocker_cc : public gr_sync_block -{ - private: - /*! - * Build the DC blocker. - * \param D (int) the length of the delay line - * \param long_form (bool) whether to use long (true, default) or short form - */ - friend GR_CORE_API gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form); - - int d_length; - bool d_long_form; - moving_averager_c *d_ma_0; - moving_averager_c *d_ma_1; - moving_averager_c *d_ma_2; - moving_averager_c *d_ma_3; - std::deque<gr_complex> d_delay_line; - - gr_dc_blocker_cc (int D, bool long_form); - -public: - ~gr_dc_blocker_cc (); - - /*! - * Get the blocker's group delay that is based on length of delay lines - */ - int get_group_delay(); - - //int set_length(int D); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i deleted file mode 100644 index 83d05044b8..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,dc_blocker_cc); - -gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); - -class gr_dc_blocker_cc : public gr_sync_block -{ - private: - gr_dc_blocker_cc (int D, bool long_form); - - public: - ~gr_dc_blocker_cc (); -}; diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc deleted file mode 100644 index 04ee648797..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc +++ /dev/null @@ -1,138 +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_dc_blocker_ff.h> -#include <gr_io_signature.h> -#include <cstdio> - -moving_averager_f::moving_averager_f(int D) - : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0) -{ - d_delay_line = std::deque<float>(d_length-1, 0); -} - -moving_averager_f::~moving_averager_f() -{ -} - -float -moving_averager_f::filter(float x) -{ - d_out_d1 = d_out; - d_delay_line.push_back(x); - d_out = d_delay_line[0]; - d_delay_line.pop_front(); - - float y = x - d_out_d1 + d_out_d2; - d_out_d2 = y; - - return (y / (float)(d_length)); -} - - - -gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form) -{ - return gnuradio::get_initial_sptr(new gr_dc_blocker_ff(D, long_form)); -} - - -gr_dc_blocker_ff::gr_dc_blocker_ff (int D, bool long_form) - : gr_sync_block ("dc_blocker_ff", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (1, 1, sizeof(float))), - d_length(D), d_long_form(long_form) -{ - if(d_long_form) { - d_ma_0 = new moving_averager_f(D); - d_ma_1 = new moving_averager_f(D); - d_ma_2 = new moving_averager_f(D); - d_ma_3 = new moving_averager_f(D); - d_delay_line = std::deque<float>(d_length-1, 0); - } - else { - d_ma_0 = new moving_averager_f(D); - d_ma_1 = new moving_averager_f(D); - } -} - -gr_dc_blocker_ff::~gr_dc_blocker_ff() -{ - if(d_long_form) { - delete d_ma_0; - delete d_ma_1; - delete d_ma_2; - delete d_ma_3; - } - else { - delete d_ma_0; - delete d_ma_1; - } -} - -int -gr_dc_blocker_ff::get_group_delay() -{ - if(d_long_form) - return (2*d_length-2); - else - return d_length - 1; -} - -int -gr_dc_blocker_ff::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]; - - if(d_long_form) { - float y1, y2, y3, y4, d; - for(int i = 0; i < noutput_items; i++) { - y1 = d_ma_0->filter(in[i]); - y2 = d_ma_1->filter(y1); - y3 = d_ma_2->filter(y2); - y4 = d_ma_3->filter(y3); - - d_delay_line.push_back(d_ma_0->delayed_sig()); - d = d_delay_line[0]; - d_delay_line.pop_front(); - - out[i] = d - y4; - } - } - else { - float y1, y2; - for(int i = 0; i < noutput_items; i++) { - y1 = d_ma_0->filter(in[i]); - y2 = d_ma_1->filter(y1); - out[i] = d_ma_0->delayed_sig() - y2; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h deleted file mode 100644 index d69f24835b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h +++ /dev/null @@ -1,112 +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_GR_DC_BLOCKER_FF_H -#define INCLUDED_GR_DC_BLOCKER_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <deque> - -class GR_CORE_API moving_averager_f -{ -public: - moving_averager_f(int D); - ~moving_averager_f(); - - float filter(float x); - float delayed_sig() { return d_out; } - -private: - int d_length; - float d_out, d_out_d1, d_out_d2; - std::deque<float> d_delay_line; -}; - - -class gr_dc_blocker_ff; -typedef boost::shared_ptr<gr_dc_blocker_ff> gr_dc_blocker_ff_sptr; -GR_CORE_API gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true); - -/*! - * \class gr_dc_blocker_ff - * \brief a computationally efficient controllable DC blocker - * - * \ingroup filter_blk - * - * This block implements a computationally efficient DC blocker that produces - * a tighter notch filter around DC for a smaller group delay than an - * equivalent FIR filter or using a single pole IIR filter (though the IIR - * filter is computationally cheaper). - * - * The block defaults to using a delay line of length 32 and the long form - * of the filter. Optionally, the delay line length can be changed to alter - * the width of the DC notch (longer lines will decrease the width). - * - * The long form of the filter produces a nearly flat response outside of - * the notch but at the cost of a group delay of 2D-2. - * - * The short form of the filter does not have as flat a response in the - * passband but has a group delay of only D-1 and is cheaper to compute. - * - * The theory behind this block can be found in the paper: - * - * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine, - * Mar. 2008, pp 132-134.</EM></B> - */ -class GR_CORE_API gr_dc_blocker_ff : public gr_sync_block -{ - private: - /*! - * Build the DC blocker. - * \param D (int) the length of the delay line - * \param long_form (bool) whether to use long (true, default) or short form - */ - friend GR_CORE_API gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form); - - int d_length; - bool d_long_form; - moving_averager_f *d_ma_0; - moving_averager_f *d_ma_1; - moving_averager_f *d_ma_2; - moving_averager_f *d_ma_3; - std::deque<float> d_delay_line; - - gr_dc_blocker_ff (int D, bool long_form); - -public: - ~gr_dc_blocker_ff (); - - /*! - * Get the blocker's group delay that is based on length of delay lines - */ - int get_group_delay(); - - //int set_length(int D); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i deleted file mode 100644 index 065eb441d6..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,dc_blocker_ff); - -gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true); - -class gr_dc_blocker_ff : public gr_sync_block -{ - private: - gr_dc_blocker_ff (int D, bool long_form); - - public: - ~gr_dc_blocker_ff (); -}; diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc deleted file mode 100644 index 08e231a442..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc +++ /dev/null @@ -1,132 +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. - */ - -/* - * WARNING: This file is automatically generated by generate_gr_fft_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_fft_filter_ccc.h> -#include <gri_fft_filter_ccc_generic.h> -#include <gr_io_signature.h> -#include <gri_fft.h> -#include <math.h> -#include <assert.h> -#include <stdexcept> -#include <gr_firdes.h> - -#include <cstdio> -#include <iostream> -#include <string.h> - -gr_fft_filter_ccc_sptr gr_make_fft_filter_ccc (int decimation, - const std::vector<gr_complex> &taps, - int nthreads) -{ - return gnuradio::get_initial_sptr(new gr_fft_filter_ccc (decimation, taps, nthreads)); -} - - -gr_fft_filter_ccc::gr_fft_filter_ccc (int decimation, - const std::vector<gr_complex> &taps, - int nthreads) - : gr_sync_decimator ("fft_filter_ccc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex)), - decimation), - d_updated(false) -{ - set_history(1); - -#if 1 // don't enable the sse version until handling it is worked out - d_filter = new gri_fft_filter_ccc_generic(decimation, taps, nthreads); -#else - d_filter = new gri_fft_filter_ccc_sse(decimation, taps); -#endif - - d_new_taps = taps; - d_nsamples = d_filter->set_taps(taps); - set_output_multiple(d_nsamples); -} - -gr_fft_filter_ccc::~gr_fft_filter_ccc () -{ - delete d_filter; -} - -void -gr_fft_filter_ccc::set_taps (const std::vector<gr_complex> &taps) -{ - d_new_taps = taps; - d_updated = true; -} - -std::vector<gr_complex> -gr_fft_filter_ccc::taps () const -{ - return d_new_taps; -} - -void -gr_fft_filter_ccc::set_nthreads(int n) -{ - if(d_filter) - d_filter->set_nthreads(n); -} - -int -gr_fft_filter_ccc::nthreads() const -{ - if(d_filter) - return d_filter->nthreads(); - else - return 0; -} - - -int -gr_fft_filter_ccc::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]; - - if (d_updated){ - d_nsamples = d_filter->set_taps(d_new_taps); - d_updated = false; - set_output_multiple(d_nsamples); - return 0; // output multiple may have changed - } - - assert(noutput_items % d_nsamples == 0); - - d_filter->filter(noutput_items, in, out); - - //assert((out - (gr_complex *) output_items[0]) == noutput_items); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h deleted file mode 100644 index 4b478b65f7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h +++ /dev/null @@ -1,90 +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_GR_FFT_FILTER_CCC_H -#define INCLUDED_GR_FFT_FILTER_CCC_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_fft_filter_ccc; -typedef boost::shared_ptr<gr_fft_filter_ccc> gr_fft_filter_ccc_sptr; -GR_CORE_API gr_fft_filter_ccc_sptr -gr_make_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps, - int nthreads=1); - -//class gri_fft_filter_ccc_sse; -class gri_fft_filter_ccc_generic; - -/*! - * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps - * \ingroup filter_blk - */ -class GR_CORE_API gr_fft_filter_ccc : public gr_sync_decimator -{ - private: - friend GR_CORE_API gr_fft_filter_ccc_sptr - gr_make_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps, - int nthreads); - - int d_nsamples; - bool d_updated; -#if 1 // don't enable the sse version until handling it is worked out - gri_fft_filter_ccc_generic *d_filter; -#else - gri_fft_filter_ccc_sse *d_filter; -#endif - std::vector<gr_complex> d_new_taps; - - /*! - * Construct a FFT filter with the given taps - * - * \param decimation >= 1 - * \param taps complex filter taps - * \param nthreads number of threads for the FFT to use - */ - gr_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps, - int nthreads=1); - - public: - ~gr_fft_filter_ccc (); - - void set_taps (const std::vector<gr_complex> &taps); - std::vector<gr_complex> taps () const; - - /*! - * \brief Set number of threads to use. - */ - void set_nthreads(int n); - - /*! - * \brief Get number of threads being used. - */ - int nthreads() const; - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - - -#endif /* INCLUDED_GR_FFT_FILTER_CCC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.i b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.i deleted file mode 100644 index 76837b582b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.i +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,fft_filter_ccc) - -gr_fft_filter_ccc_sptr -gr_make_fft_filter_ccc (int decimation, - const std::vector<gr_complex> &taps, - int nthreads=1 - ) throw (std::invalid_argument); - -class gr_fft_filter_ccc : public gr_sync_decimator -{ - private: - gr_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps, - int nthreads=1); - - public: - ~gr_fft_filter_ccc (); - - void set_taps (const std::vector<gr_complex> &taps); - std::vector<gr_complex> taps () const; - - void set_nthreads(int n); - int nthreads() const; - -}; diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc deleted file mode 100644 index a09feb7f1f..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc +++ /dev/null @@ -1,123 +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 <gr_fft_filter_fff.h> -#include <gri_fft_filter_fff_generic.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> - -#include <cstdio> -#include <iostream> -#include <string.h> - -gr_fft_filter_fff_sptr gr_make_fft_filter_fff (int decimation, - const std::vector<float> &taps, - int nthreads) -{ - return gnuradio::get_initial_sptr(new gr_fft_filter_fff (decimation, taps, nthreads)); -} - - -gr_fft_filter_fff::gr_fft_filter_fff (int decimation, - const std::vector<float> &taps, - int nthreads) - : gr_sync_decimator ("fft_filter_fff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float)), - decimation), - d_updated(false) -{ - set_history(1); - -#if 1 // don't enable the sse version until handling it is worked out - d_filter = new gri_fft_filter_fff_generic(decimation, taps, nthreads); -#else - d_filter = new gri_fft_filter_fff_sse(decimation, taps); -#endif - - d_new_taps = taps; - d_nsamples = d_filter->set_taps(taps); - set_output_multiple(d_nsamples); -} - -gr_fft_filter_fff::~gr_fft_filter_fff () -{ - delete d_filter; -} - -void -gr_fft_filter_fff::set_taps (const std::vector<float> &taps) -{ - d_new_taps = taps; - d_updated = true; -} - -std::vector<float> -gr_fft_filter_fff::taps () const -{ - return d_new_taps; -} - -void -gr_fft_filter_fff::set_nthreads(int n) -{ - if(d_filter) - d_filter->set_nthreads(n); -} - -int -gr_fft_filter_fff::nthreads() const -{ - if(d_filter) - return d_filter->nthreads(); - else - return 0; -} - -int -gr_fft_filter_fff::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]; - - if (d_updated){ - d_nsamples = d_filter->set_taps(d_new_taps); - d_updated = false; - set_output_multiple(d_nsamples); - return 0; // output multiple may have changed - } - - assert(noutput_items % d_nsamples == 0); - - d_filter->filter(noutput_items, in, out); - - //assert((out - (float *) output_items[0]) == noutput_items); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h deleted file mode 100644 index 309a551352..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h +++ /dev/null @@ -1,88 +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_GR_FFT_FILTER_FFF_H -#define INCLUDED_GR_FFT_FILTER_FFF_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_fft_filter_fff; -typedef boost::shared_ptr<gr_fft_filter_fff> gr_fft_filter_fff_sptr; -GR_CORE_API gr_fft_filter_fff_sptr -gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps, - int nthreads=1); - -class gri_fft_filter_fff_generic; -//class gri_fft_filter_fff_sse; - -/*! - * \brief Fast FFT filter with float input, float output and float taps - * \ingroup filter_blk - */ -class GR_CORE_API gr_fft_filter_fff : public gr_sync_decimator -{ - private: - friend GR_CORE_API gr_fft_filter_fff_sptr - gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps, - int nthreads); - - int d_nsamples; - bool d_updated; -#if 1 // don't enable the sse version until handling it is worked out - gri_fft_filter_fff_generic *d_filter; -#else - gri_fft_filter_fff_sse *d_filter; -#endif - std::vector<float> d_new_taps; - - /*! - * Construct a FFT filter with the given taps - * - * \param decimation >= 1 - * \param taps float filter taps - * \param nthreads number of threads for the FFT to use - */ - gr_fft_filter_fff (int decimation, const std::vector<float> &taps, - int nthreads=1); - - public: - ~gr_fft_filter_fff (); - - void set_taps (const std::vector<float> &taps); - std::vector<float> taps () const; - - /*! - * \brief Set number of threads to use. - */ - void set_nthreads(int n); - - /*! - * \brief Get number of threads being used. - */ - int nthreads() const; - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FFT_FILTER_FFF_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.i b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.i deleted file mode 100644 index 86c554893e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.i +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,fft_filter_fff) - -gr_fft_filter_fff_sptr -gr_make_fft_filter_fff (int decimation, - const std::vector<float> &taps, - int nthreads=1 - ) throw (std::invalid_argument); - -class gr_fft_filter_fff : public gr_sync_decimator -{ - private: - gr_fft_filter_fff (int decimation, const std::vector<float> &taps, - int nthreads=1); - - public: - ~gr_fft_filter_fff (); - - void set_taps (const std::vector<float> &taps); - std::vector<float> taps () const; - void set_nthreads(int n); - int nthreads() const; - -}; diff --git a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.cc b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.cc deleted file mode 100644 index af8a8e9e7d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.cc +++ /dev/null @@ -1,80 +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 <gr_filter_delay_fc.h> -#include <gr_fir_fff.h> -#include <gr_fir_util.h> - -// public constructor -gr_filter_delay_fc_sptr -gr_make_filter_delay_fc (const std::vector<float> &taps) -{ - return gnuradio::get_initial_sptr(new gr_filter_delay_fc (taps)); -} - -gr_filter_delay_fc::gr_filter_delay_fc (const std::vector<float> &taps) - : gr_sync_block ("filter_delay_fc", - gr_make_io_signature (1, 2, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (gr_complex))) -{ - d_fir = gr_fir_util::create_gr_fir_fff (taps); - d_delay = d_fir->ntaps () / 2; - set_history (d_fir->ntaps ()); -} - -gr_filter_delay_fc::~gr_filter_delay_fc () -{ - delete d_fir; -} - -int -gr_filter_delay_fc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *in0 = (float *) input_items[0]; - float *in1 = (float *) input_items[1]; - gr_complex *out = (gr_complex *) output_items[0]; - - switch (input_items.size ()){ - case 1: - for (int i = 0; i < noutput_items; i++) - out[i] = gr_complex (in0[i + d_delay], - d_fir->filter (&in0[i])); - break; - - case 2: - for (int j = 0; j < noutput_items; j++) - out[j] = gr_complex (in0[j + d_delay], - d_fir->filter (&in1[j])); - break; - - default: - assert (0); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h deleted file mode 100644 index fee11243a5..0000000000 --- a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h +++ /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. - */ - -#ifndef INCLUDED_GR_FILTER_DELAY_FC_H -#define INCLUDED_GR_FILTER_DELAY_FC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_io_signature.h> -#include <gr_types.h> - -class gr_filter_delay_fc; -typedef boost::shared_ptr<gr_filter_delay_fc> gr_filter_delay_fc_sptr; - -// public constructor -GR_CORE_API gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps); - -class gr_fir_fff; - -/*! - * \brief Filter-Delay Combination Block. - * \ingroup filter_blk - * - * The block takes one or two float stream and outputs a complex - * stream. If only one float stream is input, the real output is - * a delayed version of this input and the imaginary output is the - * filtered output. If two floats are connected to the input, then - * the real output is the delayed version of the first input, and - * the imaginary output is the filtered output. The delay in the - * real path accounts for the group delay introduced by the filter - * in the imaginary path. The filter taps needs to be calculated - * before initializing this block. - * - */ -class GR_CORE_API gr_filter_delay_fc : public gr_sync_block -{ - public: - ~gr_filter_delay_fc (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - protected: - gr_filter_delay_fc (const std::vector<float> &taps); - - private: - unsigned int d_delay; - gr_fir_fff *d_fir; - - friend GR_CORE_API gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps); -}; - -#endif /* INCLUDED_GR_FILTER_DELAY_FC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.i b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.i deleted file mode 100644 index 54b721cee7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.i +++ /dev/null @@ -1,34 +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(gr,filter_delay_fc); - -gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps); - -class gr_filter_delay_fc : public gr_sync_block -{ -private: - gr_filter_delay_fc (); -}; - -// ---------------------------------------------------------------- - diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_fir_XXX.cc.t deleted file mode 100644 index 2396f0fe66..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_XXX.cc.t +++ /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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <@FIR_TYPE@.h> - -@FIR_TYPE@::~@FIR_TYPE@ () -{ -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t b/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t deleted file mode 100644 index 197bb3cd2c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along 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 automatically generated by generate_gr_fir_XXX.py - * Any changes made to this file will be overwritten. - */ - - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <vector> -@VRCOMPLEX_INCLUDE@ -#include <gr_reverse.h> - -/*! - * \brief Abstract class for FIR with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter_primitive - * - * This is the abstract class for a Finite Impulse Response filter. - * - * The trailing suffix has the form _IOT where I codes the input type, - * O codes the output type, and T codes the tap type. - * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 'i' (int) - */ - -class GR_CORE_API @FIR_TYPE@ { - -protected: - std::vector<@TAP_TYPE@> d_taps; // reversed taps - -public: - - // CONSTRUCTORS - - /*! - * \brief construct new FIR with given taps. - * - * Note that taps must be in forward order, e.g., coefficient 0 is - * stored in new_taps[0], coefficient 1 is stored in - * new_taps[1], etc. - */ - @FIR_TYPE@ () {} - @FIR_TYPE@ (const std::vector<@TAP_TYPE@> &taps) : d_taps (gr_reverse(taps)) {} - - virtual ~@FIR_TYPE@ (); - - // MANIPULATORS - - /*! - * \brief compute a single output value. - * - * \p input must have ntaps() valid entries. - * input[0] .. input[ntaps() - 1] are referenced to compute the output value. - * - * \returns the filtered input value. - */ - virtual @O_TYPE@ filter (const @I_TYPE@ input[]) = 0; - - /*! - * \brief compute an array of N output values. - * - * \p input must have (n - 1 + ntaps()) valid entries. - * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values. - */ - virtual void filterN (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n) = 0; - - /*! - * \brief compute an array of N output values, decimating the input - * - * \p input must have (decimate * (n - 1) + ntaps()) valid entries. - * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to - * compute the output values. - */ - virtual void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n, unsigned decimate) = 0; - - /*! - * \brief install \p new_taps as the current taps. - */ - virtual void set_taps (const std::vector<@TAP_TYPE@> &taps) - { - d_taps = gr_reverse(taps); - } - - // ACCESSORS - - /*! - * \return number of taps in filter. - */ - unsigned ntaps () const { return d_taps.size (); } - - /*! - * \return current taps - */ - virtual const std::vector<@TAP_TYPE@> get_taps () const - { - return gr_reverse(d_taps); - } -}; - -#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.cc.t b/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.cc.t deleted file mode 100644 index 11b4fd50fb..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.cc.t +++ /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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <@FIR_TYPE@_generic.h> - -#if (@N_UNROLL@ == 4) - -@O_TYPE@ -@FIR_TYPE@_generic::filter (const @I_TYPE@ input[]) -{ - static const int N_UNROLL = 4; - - @ACC_TYPE@ acc0 = 0; - @ACC_TYPE@ acc1 = 0; - @ACC_TYPE@ acc2 = 0; - @ACC_TYPE@ 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_CAST@ input[i + 0]; - acc1 += d_taps[i + 1] * @INPUT_CAST@ input[i + 1]; - acc2 += d_taps[i + 2] * @INPUT_CAST@ input[i + 2]; - acc3 += d_taps[i + 3] * @INPUT_CAST@ input[i + 3]; - } - - for (; i < ntaps (); i++) - acc0 += d_taps[i] * @INPUT_CAST@ input[i]; - - return (@O_TYPE@) (acc0 + acc1 + acc2 + acc3); -} - -#else - -@O_TYPE@ -@FIR_TYPE@_generic::filter (const @I_TYPE@ input[]) -{ - static const int N_UNROLL = 2; - - @ACC_TYPE@ acc0 = 0; - @ACC_TYPE@ acc1 = 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_CAST@ input[i + 0]; - acc1 += d_taps[i + 1] * @INPUT_CAST@ input[i + 1]; - } - - for (; i < ntaps (); i++) - acc0 += d_taps[i] * @INPUT_CAST@ input[i]; - - return (@O_TYPE@) (acc0 + acc1); -} - -#endif // N_UNROLL - -void -@FIR_TYPE@_generic::filterN (@O_TYPE@ output[], - const @I_TYPE@ input[], - unsigned long n) -{ - for (unsigned i = 0; i < n; i++) - output[i] = filter (&input[i]); -} - -void -@FIR_TYPE@_generic::filterNdec (@O_TYPE@ output[], - const @I_TYPE@ input[], - unsigned long n, - unsigned decimate) -{ - unsigned j = 0; - for (unsigned i = 0; i < n; i++){ - output[i] = filter (&input[j]); - j += decimate; - } -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t b/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t deleted file mode 100644 index f7382d7393..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t +++ /dev/null @@ -1,78 +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 @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <@FIR_TYPE@.h> - -/*! - * \brief Concrete class for generic implementation of FIR with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * - * The trailing suffix has the form _IOT where I codes the input type, - * O codes the output type, and T codes the tap type. - * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 'i' (int) - */ - -class GR_CORE_API @FIR_TYPE@_generic : public @FIR_TYPE@ { - -public: - - // CREATORS - - @FIR_TYPE@_generic () {} - @FIR_TYPE@_generic (const std::vector<@TAP_TYPE@> &taps) : @FIR_TYPE@ (taps) {} - - // MANIPULATORS - - /*! - * \brief compute a single output value. - * - * \p input must have ntaps() valid entries. - * input[0] .. input[ntaps() - 1] are referenced to compute the output value. - * - * \returns the filtered input value. - */ - virtual @O_TYPE@ filter (const @I_TYPE@ input[]); - - /*! - * \brief compute an array of N output values. - * - * \p input must have (n - 1 + ntaps()) valid entries. - * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values. - */ - virtual void filterN (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n); - - /*! - * \brief compute an array of N output values, decimating the input - * - * \p input must have (decimate * (n - 1) + ntaps()) valid entries. - * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to - * compute the output values. - */ - virtual void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n, unsigned decimate); - -}; - -#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.cc deleted file mode 100644 index d88b696c9a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.cc +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_ccc_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> -#include <stdexcept> - -using std::cerr; -using std::endl; - -gr_fir_ccc_simd::gr_fir_ccc_simd () - : gr_fir_ccc_generic () -{ - // cerr << "@@@ gr_fir_ccc_simd\n"; - - d_ccomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_ccc_simd::gr_fir_ccc_simd (const std::vector<gr_complex> &new_taps) - : gr_fir_ccc_generic (new_taps) -{ - // cerr << "@@@ gr_fir_ccc_simd\n"; - - d_ccomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_ccc_simd::~gr_fir_ccc_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_ccc_simd::set_taps (const std::vector<gr_complex> &inew_taps) -{ - gr_fir_ccc::set_taps (inew_taps); // call superclass - - const std::vector<gr_complex> new_taps = gr_reverse(inew_taps); - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 2, - 2 * 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_ccc_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) { - d_aligned_taps[i][2*(j+i)] = new_taps[j].real(); - d_aligned_taps[i][2*(j+i)+1] = new_taps[j].imag(); - } - } -} - -gr_complex -gr_fir_ccc_simd::filter (const gr_complex input[]) -{ - if (ntaps () == 0) - return 0.0; - - if (((intptr_t) input & 0x7) != 0) - throw std::invalid_argument("gr_complex must be 8-byte aligned"); - - // Round input data address down to 16 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const gr_complex *ar = (gr_complex *)((unsigned long) input & ~15); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 2x4-float blocks. - - // assert (((unsigned long) ar & 15) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl; - - float result[2]; - - d_ccomplex_dotprod ((float*)ar, d_aligned_taps[al], (ntaps() + al - 1) / 2 + 1, result); - - // cerr << "result = " << result[0] << " " << result[1] << endl; - - return gr_complex(result[0], result[1]); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h deleted file mode 100644 index ed7249c91d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.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 INCLUDED_GR_FIR_CCC_SIMD_H -#define INCLUDED_GR_FIR_CCC_SIMD_H - -#include <gr_core_api.h> -#include <gr_fir_ccc_generic.h> - -/*! - * \brief common base class for SIMD versions of gr_fir_ccc - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ - -class GR_CORE_API gr_fir_ccc_simd : public gr_fir_ccc_generic -{ -protected: - typedef void (*ccomplex_dotprod_t)(const float *input, - const float *taps, - unsigned n_2_ccomplex_blocks, - float *result); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 floats to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - ccomplex_dotprod_t d_ccomplex_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_ccc_simd (); - gr_fir_ccc_simd (const std::vector<gr_complex> &taps); - ~gr_fir_ccc_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<gr_complex> &taps); - virtual gr_complex filter (const gr_complex input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.cc deleted file mode 100644 index 28bc008e8a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.cc +++ /dev/null @@ -1,77 +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 <gr_fir_ccc_x86.h> -#include <ccomplex_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_ccc_3dnow::gr_fir_ccc_3dnow () - : gr_fir_ccc_simd () -{ - d_ccomplex_dotprod = ccomplex_dotprod_3dnow; -} - -gr_fir_ccc_3dnow::gr_fir_ccc_3dnow (const std::vector<gr_complex> &new_taps) - : gr_fir_ccc_simd (new_taps) -{ - d_ccomplex_dotprod = ccomplex_dotprod_3dnow; -} - - -/* - * --- 3DNow!Ext version --- - */ - -gr_fir_ccc_3dnowext::gr_fir_ccc_3dnowext () - : gr_fir_ccc_simd () -{ - d_ccomplex_dotprod = ccomplex_dotprod_3dnowext; -} - -gr_fir_ccc_3dnowext::gr_fir_ccc_3dnowext (const std::vector<gr_complex> &new_taps) - : gr_fir_ccc_simd (new_taps) -{ - d_ccomplex_dotprod = ccomplex_dotprod_3dnowext; -} - - -/* - * --- SSE version --- - */ - -gr_fir_ccc_sse::gr_fir_ccc_sse () - : gr_fir_ccc_simd () -{ - d_ccomplex_dotprod = ccomplex_dotprod_sse; -} - -gr_fir_ccc_sse::gr_fir_ccc_sse (const std::vector<gr_complex> &new_taps) - : gr_fir_ccc_simd (new_taps) -{ - d_ccomplex_dotprod = ccomplex_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h deleted file mode 100644 index 0a9d2c83c3..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.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 INCLUDED_GR_FIR_CCC_X86_H -#define INCLUDED_GR_FIR_CCC_X86_H - -#include <gr_core_api.h> -#include <gr_fir_ccc_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_ccc - */ -class GR_CORE_API gr_fir_ccc_3dnow : public gr_fir_ccc_simd -{ -public: - gr_fir_ccc_3dnow (); - gr_fir_ccc_3dnow (const std::vector<gr_complex> &taps); -}; - -class GR_CORE_API gr_fir_ccc_3dnowext : public gr_fir_ccc_simd -{ -public: - gr_fir_ccc_3dnowext (); - gr_fir_ccc_3dnowext (const std::vector<gr_complex> &taps); -}; - -/*! - * \brief SSE version of gr_fir_ccc - */ -class GR_CORE_API gr_fir_ccc_sse : public gr_fir_ccc_simd -{ -public: - gr_fir_ccc_sse (); - gr_fir_ccc_sse (const std::vector<gr_complex> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc deleted file mode 100644 index d849c3dd57..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 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 <gr_fir_ccf_armv7_a.h> -#include <stdlib.h> -#include <string.h> -#include <stdexcept> -#include <assert.h> -#include <gr_math.h> -#include <dotprod_ccf_armv7_a.h> - -#define FLOATS_PER_VEC 4 - -gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a() - : gr_fir_ccf_generic(), - d_naligned_taps(0), d_aligned_taps(0) -{ -} - -gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a (const std::vector<float> &new_taps) - : gr_fir_ccf_generic(new_taps), - d_naligned_taps(0), d_aligned_taps(0) -{ - set_taps(new_taps); -} - -gr_fir_ccf_armv7_a::~gr_fir_ccf_armv7_a() -{ - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } -} - -void -gr_fir_ccf_armv7_a::set_taps(const std::vector<float> &inew_taps) -{ - gr_fir_ccf_generic::set_taps(inew_taps); // call superclass - d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC); - - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } - void *p; - int r = posix_memalign(&p, sizeof(float), d_naligned_taps * sizeof(d_aligned_taps[0])); - if (r != 0){ - throw std::bad_alloc(); - } - d_aligned_taps = (float *) p; - memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0])); - for (size_t i = ntaps(); i < d_naligned_taps; i++) - d_aligned_taps[i] = 0.0; -} - - -gr_complex -gr_fir_ccf_armv7_a::filter (const gr_complex input[]) -{ - if (d_naligned_taps == 0) - return 0.0; - - gr_complex result; - float *presult = reinterpret_cast<float *>(&result); - const float *pinput = reinterpret_cast<const float *>(input); - - dotprod_ccf_armv7_a(pinput, d_aligned_taps, presult, d_naligned_taps); - return result; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h deleted file mode 100644 index e4844bae1a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GR_FIR_CCF_ARMV7_A_H -#define INCLUDED_GR_FIR_CCF_ARMV7_A_H - -#include <gr_fir_ccf_generic.h> - -/*! - * \brief armv7_a using NEON coprocessor version of gr_fir_ccf - */ -class gr_fir_ccf_armv7_a : public gr_fir_ccf_generic -{ -protected: - - size_t d_naligned_taps; // number of taps (multiple of 4) - float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4 - -public: - gr_fir_ccf_armv7_a(); - gr_fir_ccf_armv7_a(const std::vector<float> &taps); - ~gr_fir_ccf_armv7_a(); - - virtual void set_taps (const std::vector<float> &taps); - virtual gr_complex filter (const gr_complex input[]); -}; - -#endif /* INCLUDED_GR_FIR_CCF_ARMV7_A*_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.cc deleted file mode 100644 index 872415e8eb..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.cc +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_ccf_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> -#include <stdexcept> - -using std::cerr; -using std::endl; - -gr_fir_ccf_simd::gr_fir_ccf_simd () - : gr_fir_ccf_generic () -{ - // cerr << "@@@ gr_fir_ccf_simd\n"; - - d_fcomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_ccf_simd::gr_fir_ccf_simd (const std::vector<float> &new_taps) - : gr_fir_ccf_generic (new_taps) -{ - // cerr << "@@@ gr_fir_ccf_simd\n"; - - d_fcomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_ccf_simd::~gr_fir_ccf_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_ccf_simd::set_taps (const std::vector<float> &inew_taps) -{ - gr_fir_ccf::set_taps (inew_taps); // call superclass - const std::vector<float> new_taps = gr_reverse(inew_taps); - - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 4, - 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_ccf_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) - d_aligned_taps[i][j+i] = new_taps[j]; - } -} - -gr_complex -gr_fir_ccf_simd::filter (const gr_complex input[]) -{ - if (ntaps () == 0) - return 0.0; - - if (((intptr_t) input & 0x7) != 0) - throw std::invalid_argument("gr_complex must be 8-byte aligned"); - - // Round input data address down to 16 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const gr_complex *ar = (gr_complex *)((unsigned long) input & ~15); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 2x4-float blocks. - - // assert (((unsigned long) ar & 15) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl; - - float result[2]; - - // the trick here is to invert input and taps, and reuse FCC speedup - d_fcomplex_dotprod (d_aligned_taps[al], (float*)ar, (ntaps() + al - 1) / 2 + 1, result); - - // cerr << "result = " << result[0] << " " << result[1] << endl; - - return gr_complex(result[0], result[1]); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h deleted file mode 100644 index 3c3e7e4f5b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h +++ /dev/null @@ -1,66 +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_GR_FIR_CCF_SIMD_H -#define INCLUDED_GR_FIR_CCF_SIMD_H - -#include <gr_core_api.h> -#include <gr_fir_ccf_generic.h> - - -/*! - * \brief common base class for SIMD versions of gr_fir_ccf - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ - -class GR_CORE_API gr_fir_ccf_simd : public gr_fir_ccf_generic -{ -protected: - typedef void (*fcomplex_dotprod_t)(const float *taps, - const float *input, - unsigned n_2_complex_blocks, - float *result); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 float pairs to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - fcomplex_dotprod_t d_fcomplex_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_ccf_simd (); - gr_fir_ccf_simd (const std::vector<float> &taps); - ~gr_fir_ccf_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<float> &taps); - virtual gr_complex filter (const gr_complex input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.cc deleted file mode 100644 index f26d4ecc2c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.cc +++ /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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_ccf_x86.h> -#include <fcomplex_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_ccf_3dnow::gr_fir_ccf_3dnow () - : gr_fir_ccf_simd () -{ - d_fcomplex_dotprod = fcomplex_dotprod_3dnow; -} - -gr_fir_ccf_3dnow::gr_fir_ccf_3dnow (const std::vector<float> &new_taps) - : gr_fir_ccf_simd (new_taps) -{ - d_fcomplex_dotprod = fcomplex_dotprod_3dnow; -} - - -/* - * --- SSE version --- - */ - -gr_fir_ccf_sse::gr_fir_ccf_sse () - : gr_fir_ccf_simd () -{ - d_fcomplex_dotprod = fcomplex_dotprod_sse; -} - -gr_fir_ccf_sse::gr_fir_ccf_sse (const std::vector<float> &new_taps) - : gr_fir_ccf_simd (new_taps) -{ - d_fcomplex_dotprod = fcomplex_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h deleted file mode 100644 index 6b260c3dbb..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.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 INCLUDED_GR_FIR_CCF_X86_H -#define INCLUDED_GR_FIR_CCF_X86_H - -#include <gr_core_api.h> -#include <gr_fir_ccf_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_ccf - * \ingroup filter_primitive - */ -class GR_CORE_API gr_fir_ccf_3dnow : public gr_fir_ccf_simd -{ -public: - gr_fir_ccf_3dnow (); - gr_fir_ccf_3dnow (const std::vector<float> &taps); -}; - -/*! - * \brief SSE version of gr_fir_ccf - * \ingroup filter_primitive - */ -class GR_CORE_API gr_fir_ccf_sse : public gr_fir_ccf_simd -{ -public: - gr_fir_ccf_sse (); - gr_fir_ccf_sse (const std::vector<float> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.cc deleted file mode 100644 index 5b75a43fd2..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.cc +++ /dev/null @@ -1,139 +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 <gr_fir_fcc_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> - -using std::cerr; -using std::endl; - -gr_fir_fcc_simd::gr_fir_fcc_simd () - : gr_fir_fcc_generic () -{ - // cerr << "@@@ gr_fir_fcc_simd\n"; - - d_fcomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_fcc_simd::gr_fir_fcc_simd (const std::vector<gr_complex> &new_taps) - : gr_fir_fcc_generic (new_taps) -{ - // cerr << "@@@ gr_fir_fcc_simd\n"; - - d_fcomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_fcc_simd::~gr_fir_fcc_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_fcc_simd::set_taps (const std::vector<gr_complex> &inew_taps) -{ - gr_fir_fcc::set_taps (inew_taps); // call superclass - const std::vector<gr_complex> new_taps = gr_reverse(inew_taps); - - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 2, - 2 * 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_fcc_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) { - d_aligned_taps[i][2*(j+i)] = new_taps[j].real(); - d_aligned_taps[i][2*(j+i)+1] = new_taps[j].imag(); - } - } -} - -gr_complex -gr_fir_fcc_simd::filter (const float input[]) -{ - if (ntaps () == 0) - return 0.0; - - - // Round input data address down to 16 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const float *ar = (float *)((unsigned long) input & ~15); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 2x4-float blocks. - - // assert (((unsigned long) ar & 15) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl; - - float result[2]; - - d_fcomplex_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 2 + 1, result); - - // cerr << "result = " << result[0] << " " << result[1] << endl; - - return gr_complex(result[0], result[1]); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h deleted file mode 100644 index b7463070bc..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h +++ /dev/null @@ -1,66 +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_GR_FIR_FCC_SIMD_H -#define INCLUDED_GR_FIR_FCC_SIMD_H - -#include <gr_core_api.h> -#include <gr_fir_fcc_generic.h> - - -/*! - * \brief common base class for SIMD versions of gr_fir_fcc - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ - -class GR_CORE_API gr_fir_fcc_simd : public gr_fir_fcc_generic -{ -protected: - typedef void (*fcomplex_dotprod_t)(const float *input, - const float *taps, - unsigned n_2_complex_blocks, - float *result); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 float pairs to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - fcomplex_dotprod_t d_fcomplex_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_fcc_simd (); - gr_fir_fcc_simd (const std::vector<gr_complex> &taps); - ~gr_fir_fcc_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<gr_complex> &taps); - virtual gr_complex filter (const float input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.cc deleted file mode 100644 index d9904133c4..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.cc +++ /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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_fcc_x86.h> -#include <fcomplex_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_fcc_3dnow::gr_fir_fcc_3dnow () - : gr_fir_fcc_simd () -{ - d_fcomplex_dotprod = fcomplex_dotprod_3dnow; -} - -gr_fir_fcc_3dnow::gr_fir_fcc_3dnow (const std::vector<gr_complex> &new_taps) - : gr_fir_fcc_simd (new_taps) -{ - d_fcomplex_dotprod = fcomplex_dotprod_3dnow; -} - - -/* - * --- SSE version --- - */ - -gr_fir_fcc_sse::gr_fir_fcc_sse () - : gr_fir_fcc_simd () -{ - d_fcomplex_dotprod = fcomplex_dotprod_sse; -} - -gr_fir_fcc_sse::gr_fir_fcc_sse (const std::vector<gr_complex> &new_taps) - : gr_fir_fcc_simd (new_taps) -{ - d_fcomplex_dotprod = fcomplex_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h deleted file mode 100644 index 3fc6c4855b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.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 INCLUDED_GR_FIR_FCC_X86_H -#define INCLUDED_GR_FIR_FCC_X86_H - -#include <gr_core_api.h> -#include <gr_fir_fcc_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_fcc - * \ingroup filter_primitive - */ -class GR_CORE_API gr_fir_fcc_3dnow : public gr_fir_fcc_simd -{ -public: - gr_fir_fcc_3dnow (); - gr_fir_fcc_3dnow (const std::vector<gr_complex> &taps); -}; - -/*! - * \brief SSE version of gr_fir_fcc - * \ingroup filter_blk - */ -class GR_CORE_API gr_fir_fcc_sse : public gr_fir_fcc_simd -{ -public: - gr_fir_fcc_sse (); - gr_fir_fcc_sse (const std::vector<gr_complex> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc deleted file mode 100644 index b81283ce56..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 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 <gr_fir_fff_altivec.h> -#include <stdexcept> -#include <assert.h> -#include <gr_math.h> -#include <gr_altivec.h> -#include <dotprod_fff_altivec.h> -#include <string.h> -#include "posix_memalign.h" - -gr_fir_fff_altivec::gr_fir_fff_altivec() - : gr_fir_fff_generic(), - d_naligned_taps(0), d_aligned_taps(0) -{ -} - -gr_fir_fff_altivec::gr_fir_fff_altivec (const std::vector<float> &new_taps) - : gr_fir_fff_generic(new_taps), - d_naligned_taps(0), d_aligned_taps(0) -{ - set_taps(new_taps); -} - -gr_fir_fff_altivec::~gr_fir_fff_altivec() -{ - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } -} - -void -gr_fir_fff_altivec::set_taps(const std::vector<float> &inew_taps) -{ - gr_fir_fff_generic::set_taps(inew_taps); // call superclass - d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC); - - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } - void *p; - int r = posix_memalign(&p, sizeof(vec_float4), d_naligned_taps * sizeof(d_aligned_taps[0])); - if (r != 0){ - throw std::bad_alloc(); - } - d_aligned_taps = (float *) p; - memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0])); - for (size_t i = ntaps(); i < d_naligned_taps; i++) - d_aligned_taps[i] = 0.0; -} - - -float -gr_fir_fff_altivec::filter (const float input[]) -{ - if (d_naligned_taps == 0) - return 0.0; - - return dotprod_fff_altivec(input, d_aligned_taps, d_naligned_taps); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h b/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h deleted file mode 100644 index a3d4a2aae9..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GR_FIR_FFF_ALTIVEC_H -#define INCLUDED_GR_FIR_FFF_ALTIVEC_H - -#include <gr_core_api.h> -#include <gr_fir_fff_generic.h> - -/*! - * \brief altivec version of gr_fir_fff - */ -class GR_CORE_API gr_fir_fff_altivec : public gr_fir_fff_generic -{ -protected: - - size_t d_naligned_taps; // number of taps (multiple of 4) - float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4 - -public: - gr_fir_fff_altivec(); - gr_fir_fff_altivec(const std::vector<float> &taps); - ~gr_fir_fff_altivec(); - - virtual void set_taps (const std::vector<float> &taps); - virtual float filter (const float input[]); -}; - -#endif /* INCLUDED_GR_FIR_FFF_ALTIVEC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.cc deleted file mode 100644 index b437254202..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_fir_fff_armv7_a.h> -#include <stdlib.h> -#include <string.h> -#include <stdexcept> -#include <assert.h> -#include <gr_math.h> -#include <dotprod_fff_armv7_a.h> - -#define FLOATS_PER_VEC 8 - -gr_fir_fff_armv7_a::gr_fir_fff_armv7_a() - : gr_fir_fff_generic(), - d_naligned_taps(0), d_aligned_taps(0) -{ -} - -gr_fir_fff_armv7_a::gr_fir_fff_armv7_a (const std::vector<float> &new_taps) - : gr_fir_fff_generic(new_taps), - d_naligned_taps(0), d_aligned_taps(0) -{ - set_taps(new_taps); -} - -gr_fir_fff_armv7_a::~gr_fir_fff_armv7_a() -{ - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } -} - -void -gr_fir_fff_armv7_a::set_taps(const std::vector<float> &inew_taps) -{ - gr_fir_fff_generic::set_taps(inew_taps); // call superclass - d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC); - - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } - void *p; - int r = posix_memalign(&p, sizeof(float), d_naligned_taps * sizeof(d_aligned_taps[0])); - if (r != 0){ - throw std::bad_alloc(); - } - d_aligned_taps = (float *) p; - memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0])); - for (size_t i = ntaps(); i < d_naligned_taps; i++) - d_aligned_taps[i] = 0.0; -} - - -float -gr_fir_fff_armv7_a::filter (const float input[]) -{ - if (d_naligned_taps == 0) - return 0.0; - - return dotprod_fff_armv7_a(input, d_aligned_taps, d_naligned_taps); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h deleted file mode 100644 index 78863d2866..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ -#ifndef INCLUDED_GR_FIR_FFF_ARMV7_A_H -#define INCLUDED_GR_FIR_FFF_ARMV7_A_H - -#include <gr_core_api.h> -#include <gr_fir_fff_generic.h> - -/*! - * \brief armv7_a using NEON coprocessor version of gr_fir_fff - */ -class GR_CORE_API gr_fir_fff_armv7_a : public gr_fir_fff_generic -{ -protected: - - size_t d_naligned_taps; // number of taps (multiple of 4) - float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4 - -public: - gr_fir_fff_armv7_a(); - gr_fir_fff_armv7_a(const std::vector<float> &taps); - ~gr_fir_fff_armv7_a(); - - virtual void set_taps (const std::vector<float> &taps); - virtual float filter (const float input[]); -}; - -#endif /* INCLUDED_GR_FIR_FFF_ARMV7_A*_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_simd.cc deleted file mode 100644 index d6c28ed45b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.cc +++ /dev/null @@ -1,134 +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 <gr_fir_fff_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> - -using std::cerr; - -gr_fir_fff_simd::gr_fir_fff_simd () - : gr_fir_fff_generic () -{ - // cerr << "@@@ gr_fir_fff_simd\n"; - - d_float_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_fff_simd::gr_fir_fff_simd (const std::vector<float> &new_taps) - : gr_fir_fff_generic (new_taps) -{ - // cerr << "@@@ gr_fir_fff_simd\n"; - - d_float_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_fff_simd::~gr_fir_fff_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_fff_simd::set_taps (const std::vector<float> &inew_taps) -{ - gr_fir_fff::set_taps (inew_taps); // call superclass - const std::vector<float> new_taps = gr_reverse(inew_taps); - - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 4, - 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_fff_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) - d_aligned_taps[i][j+i] = new_taps[j]; - } -} - -float -gr_fir_fff_simd::filter (const float input[]) -{ - if (ntaps () == 0) - return 0.0; - - - // Round input data address down to 16 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const float *ar = (float *)((unsigned long) input & ~15); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 4-float blocks. - - // assert (((unsigned long) ar & 15) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/4 + 1: " << (ntaps() + al -1) / 4 + 1 << endl; - - float r = d_float_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 4 + 1); - - // cerr << "result = " << r << endl; - - return r; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h deleted file mode 100644 index 9d61062664..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.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 INCLUDED_GR_FIR_FFF_SIMD_H -#define INCLUDED_GR_FIR_FFF_SIMD_H - -#include <gr_core_api.h> -#include <gr_fir_fff_generic.h> - -/*! - * \brief common base class for SIMD versions of gr_fir_fff - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ - -class GR_CORE_API gr_fir_fff_simd : public gr_fir_fff_generic -{ -protected: - typedef float (*float_dotprod_t)(const float *input, - const float *taps, - unsigned n_4_float_blocks); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 floats to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - float_dotprod_t d_float_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_fff_simd (); - gr_fir_fff_simd (const std::vector<float> &taps); - ~gr_fir_fff_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<float> &taps); - virtual float filter (const float input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_x86.cc deleted file mode 100644 index 40ac266be6..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.cc +++ /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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_fff_x86.h> -#include <float_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_fff_3dnow::gr_fir_fff_3dnow () - : gr_fir_fff_simd () -{ - d_float_dotprod = float_dotprod_3dnow; -} - -gr_fir_fff_3dnow::gr_fir_fff_3dnow (const std::vector<float> &new_taps) - : gr_fir_fff_simd (new_taps) -{ - d_float_dotprod = float_dotprod_3dnow; -} - - -/* - * --- SSE version --- - */ - -gr_fir_fff_sse::gr_fir_fff_sse () - : gr_fir_fff_simd () -{ - d_float_dotprod = float_dotprod_sse; -} - -gr_fir_fff_sse::gr_fir_fff_sse (const std::vector<float> &new_taps) - : gr_fir_fff_simd (new_taps) -{ - d_float_dotprod = float_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h deleted file mode 100644 index 8d451f0c95..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.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_GR_FIR_FFF_X86_H -#define INCLUDED_GR_FIR_FFF_X86_H - -#include <gr_core_api.h> -#include <gr_fir_fff_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_fff - */ -class GR_CORE_API gr_fir_fff_3dnow : public gr_fir_fff_simd -{ -public: - gr_fir_fff_3dnow (); - gr_fir_fff_3dnow (const std::vector<float> &taps); -}; - -/*! - * \brief SSE version of gr_fir_fff - */ -class GR_CORE_API gr_fir_fff_sse : public gr_fir_fff_simd -{ -public: - gr_fir_fff_sse (); - gr_fir_fff_sse (const std::vector<float> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.cc.t deleted file mode 100644 index 39bc756301..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.cc.t +++ /dev/null @@ -1,94 +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: This file is automatically generated by generate_gr_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <@FIR_TYPE@.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps) -{ - return gnuradio::get_initial_sptr (new @NAME@ (decimation, taps)); -} - - -@NAME@::@NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps) - : gr_sync_decimator ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)), - decimation), - d_updated (false) -{ - d_fir = gr_fir_util::create_@FIR_TYPE@ (taps); - set_history (d_fir->ntaps ()); -} - -@NAME@::~@NAME@ () -{ - delete d_fir; -} - -void -@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps) -{ - d_new_taps = taps; - d_updated = true; -} - -std::vector<@TAP_TYPE@> -@NAME@::taps () const -{ - return d_new_taps; -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @I_TYPE@ *in = (@I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - - if (d_updated) { - d_fir->set_taps (d_new_taps); - set_history (d_fir->ntaps ()); - d_updated = false; - return 0; // history requirements may have changed. - } - - if (decimation() == 1) - d_fir->filterN (out, in, noutput_items); - - else - d_fir->filterNdec (out, in, noutput_items, decimation()); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t deleted file mode 100644 index b32e04bd35..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t +++ /dev/null @@ -1,69 +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: This file is automatically generated by generate_gr_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); - -class @FIR_TYPE@; - -/*! - * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter_blk - */ -class GR_CORE_API @NAME@ : public gr_sync_decimator -{ - private: - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); - - @FIR_TYPE@ *d_fir; - std::vector<@TAP_TYPE@> d_new_taps; - bool d_updated; - - /*! - * Construct a FIR filter with the given taps - */ - @NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - - void set_taps (const std::vector<@TAP_TYPE@> &taps); - std::vector<@TAP_TYPE@> taps () const; - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.i.t b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.i.t deleted file mode 100644 index d9dc86180e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.i.t +++ /dev/null @@ -1,42 +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: This file is automatically generated by generate_GrFIRfilterXXX.py - * Any changes made to this file will be overwritten. - */ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); - -class @NAME@ : public gr_sync_decimator -{ - private: - @NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - - void set_taps (const std::vector<@TAP_TYPE@> &taps); - std::vector<@TAP_TYPE@> taps () const; -}; diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.cc deleted file mode 100644 index a49503e6ab..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_fsf_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> - -using std::cerr; - -gr_fir_fsf_simd::gr_fir_fsf_simd () - : gr_fir_fsf_generic () -{ - // cerr << "@@@ gr_fir_fsf_simd\n"; - - d_float_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_fsf_simd::gr_fir_fsf_simd (const std::vector<float> &new_taps) - : gr_fir_fsf_generic (new_taps) -{ - // cerr << "@@@ gr_fir_fsf_simd\n"; - - d_float_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_fsf_simd::~gr_fir_fsf_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_fsf_simd::set_taps (const std::vector<float> &inew_taps) -{ - gr_fir_fsf::set_taps (inew_taps); // call superclass - const std::vector<float> new_taps = gr_reverse(inew_taps); - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 4, - 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_fsf_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) - d_aligned_taps[i][j+i] = new_taps[j]; - } -} - -short -gr_fir_fsf_simd::filter (const float input[]) -{ - if (ntaps () == 0) - return 0; - - - // Round input data address down to 16 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const float *ar = (float *)((unsigned long) input & ~15); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 4-float blocks. - - // assert (((unsigned long) ar & 15) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/4 + 1: " << (ntaps() + al -1) / 4 + 1 << endl; - - float r = d_float_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 4 + 1); - - // cerr << "result = " << r << endl; - - return (short) r; // FIXME? may want to saturate here -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h deleted file mode 100644 index d63e9dd17d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.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 _GR_FIR_FSF_SIMD_H_ -#define _GR_FIR_FSF_SIMD_H_ - -#include <gr_core_api.h> -#include <gr_fir_fsf_generic.h> - -/*! - * \brief common base class for SIMD versions of gr_fir_fsf - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ - -class GR_CORE_API gr_fir_fsf_simd : public gr_fir_fsf_generic -{ -protected: - typedef float (*float_dotprod_t)(const float *input, - const float *taps, - unsigned n_4_float_blocks); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 floats to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - float_dotprod_t d_float_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_fsf_simd (); - gr_fir_fsf_simd (const std::vector<float> &taps); - ~gr_fir_fsf_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<float> &taps); - virtual short filter (const float input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.cc deleted file mode 100644 index 40ba17d3a7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.cc +++ /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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_fsf_x86.h> -#include <float_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_fsf_3dnow::gr_fir_fsf_3dnow () - : gr_fir_fsf_simd () -{ - d_float_dotprod = float_dotprod_3dnow; -} - -gr_fir_fsf_3dnow::gr_fir_fsf_3dnow (const std::vector<float> &new_taps) - : gr_fir_fsf_simd (new_taps) -{ - d_float_dotprod = float_dotprod_3dnow; -} - - -/* - * --- SSE version --- - */ - -gr_fir_fsf_sse::gr_fir_fsf_sse () - : gr_fir_fsf_simd () -{ - d_float_dotprod = float_dotprod_sse; -} - -gr_fir_fsf_sse::gr_fir_fsf_sse (const std::vector<float> &new_taps) - : gr_fir_fsf_simd (new_taps) -{ - d_float_dotprod = float_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h deleted file mode 100644 index df664d5e27..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.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 INCLUDED_GR_FIR_FSF_X86_H -#define INCLUDED_GR_FIR_FSF_X86_H - -#include <gr_core_api.h> -#include <gr_fir_fsf_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_fsf - * \ingroup filter_primitive - */ -class GR_CORE_API gr_fir_fsf_3dnow : public gr_fir_fsf_simd -{ -public: - gr_fir_fsf_3dnow (); - gr_fir_fsf_3dnow (const std::vector<float> &taps); -}; - -/*! - * \brief SSE version of gr_fir_fsf - * \ingroup filter_primitive - */ -class GR_CORE_API gr_fir_fsf_sse : public gr_fir_fsf_simd -{ -public: - gr_fir_fsf_sse (); - gr_fir_fsf_sse (const std::vector<float> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_scc_simd.cc deleted file mode 100644 index 0b2dd7e613..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_scc_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> - -using std::cerr; -using std::endl; - -gr_fir_scc_simd::gr_fir_scc_simd () - : gr_fir_scc_generic () -{ - // cerr << "@@@ gr_fir_scc_simd\n"; - - d_complex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_scc_simd::gr_fir_scc_simd (const std::vector<gr_complex> &new_taps) - : gr_fir_scc_generic (new_taps) -{ - // cerr << "@@@ gr_fir_scc_simd\n"; - - d_complex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_scc_simd::~gr_fir_scc_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_scc_simd::set_taps (const std::vector<gr_complex> &inew_taps) -{ - gr_fir_scc::set_taps (inew_taps); // call superclass - - const std::vector<gr_complex> new_taps = gr_reverse(inew_taps); - - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 2, - 2 * 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_scc_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) { - d_aligned_taps[i][2*(j+i)] = new_taps[j].real(); - d_aligned_taps[i][2*(j+i)+1] = new_taps[j].imag(); - } - } -} - -gr_complex -gr_fir_scc_simd::filter (const short input[]) -{ - if (ntaps () == 0) - return 0.0; - - - // Round input data address down to 8 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const short *ar = (short *)((unsigned long) input & ~7); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 2x4-float blocks. - - // assert (((unsigned long) ar & 7) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl; - - float result[2]; - - d_complex_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 2 + 1, result); - - // cerr << "result = " << result[0] << " " << result[1] << endl; - - return gr_complex(result[0], result[1]); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h deleted file mode 100644 index 72c15f93b3..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.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 INCLUDED_GR_FIR_SCC_SIMD_H -#define INCLUDED_GR_FIR_SCC_SIMD_H - -#include <gr_core_api.h> -#include <gr_fir_scc_generic.h> - - -/*! - * \brief common base class for SIMD versions of gr_fir_scc - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ -class GR_CORE_API gr_fir_scc_simd : public gr_fir_scc_generic -{ -protected: - typedef void (*complex_dotprod_t)(const short *input, - const float *taps, - unsigned n_2_complex_blocks, - float *result); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 float pairs to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - complex_dotprod_t d_complex_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_scc_simd (); - gr_fir_scc_simd (const std::vector<gr_complex> &taps); - ~gr_fir_scc_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<gr_complex> &taps); - virtual gr_complex filter (const short input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_scc_x86.cc deleted file mode 100644 index ab0668c63a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.cc +++ /dev/null @@ -1,77 +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 <gr_fir_scc_x86.h> -#include <complex_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_scc_3dnow::gr_fir_scc_3dnow () - : gr_fir_scc_simd () -{ - d_complex_dotprod = complex_dotprod_3dnow; -} - -gr_fir_scc_3dnow::gr_fir_scc_3dnow (const std::vector<gr_complex> &new_taps) - : gr_fir_scc_simd (new_taps) -{ - d_complex_dotprod = complex_dotprod_3dnow; -} - - -/* - * --- 3DNow! Ext version --- - */ - -gr_fir_scc_3dnowext::gr_fir_scc_3dnowext () - : gr_fir_scc_simd () -{ - d_complex_dotprod = complex_dotprod_3dnowext; -} - -gr_fir_scc_3dnowext::gr_fir_scc_3dnowext (const std::vector<gr_complex> &new_taps) - : gr_fir_scc_simd (new_taps) -{ - d_complex_dotprod = complex_dotprod_3dnowext; -} - - -/* - * --- SSE version --- - */ - -gr_fir_scc_sse::gr_fir_scc_sse () - : gr_fir_scc_simd () -{ - d_complex_dotprod = complex_dotprod_sse; -} - -gr_fir_scc_sse::gr_fir_scc_sse (const std::vector<gr_complex> &new_taps) - : gr_fir_scc_simd (new_taps) -{ - d_complex_dotprod = complex_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h deleted file mode 100644 index 85a63251b2..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.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 INCLUDED_GR_FIR_SCC_X86_H -#define INCLUDED_GR_FIR_SCC_X86_H - -#include <gr_core_api.h> -#include <gr_fir_scc_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_scc - */ -class GR_CORE_API gr_fir_scc_3dnow : public gr_fir_scc_simd -{ -public: - gr_fir_scc_3dnow (); - gr_fir_scc_3dnow (const std::vector<gr_complex> &taps); -}; - -/*! - * \brief 3DNow! Ext version of gr_fir_scc - */ -class GR_CORE_API gr_fir_scc_3dnowext : public gr_fir_scc_simd -{ -public: - gr_fir_scc_3dnowext (); - gr_fir_scc_3dnowext (const std::vector<gr_complex> &taps); -}; - -/*! - * \brief SSE version of gr_fir_scc - */ -class GR_CORE_API gr_fir_scc_sse : public gr_fir_scc_simd -{ -public: - gr_fir_scc_sse (); - gr_fir_scc_sse (const std::vector<gr_complex> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc deleted file mode 100644 index 70adbc0920..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc +++ /dev/null @@ -1,337 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2008,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. - */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_fir_sysconfig_armv7_a.h> -#include <gr_cpu.h> - -#include <gr_fir_ccf.h> -#include <gr_fir_ccf_generic.h> -#include <gr_fir_ccf_armv7_a.h> -#include <gr_fir_fcc.h> -#include <gr_fir_fcc_generic.h> -#include <gr_fir_fff.h> -#include <gr_fir_fff_generic.h> -#include <gr_fir_fff_armv7_a.h> -#include <gr_fir_fsf.h> -#include <gr_fir_fsf_generic.h> -#include <gr_fir_ccc.h> -#include <gr_fir_ccc_generic.h> -#include <gr_fir_scc.h> -#include <gr_fir_scc_generic.h> - -#include <iostream> -using std::cerr; - -///\todo Remove commented out code for altivec and replace with NEON versions. - -/* - * ---------------------------------------------------------------- - * static functions that serve as constructors... - * ---------------------------------------------------------------- - */ - -static gr_fir_ccf * -make_gr_fir_ccf_armv7_a (const std::vector<float> &taps) -{ - return new gr_fir_ccf_armv7_a(taps); -} - -#if 0 -static gr_fir_fcc * -make_gr_fir_fcc_altivec(const std::vector<gr_complex> &taps) -{ - return new gr_fir_fcc_altivec(taps); -} - -static gr_fir_ccc * -make_gr_fir_ccc_altivec (const std::vector<gr_complex> &taps) -{ - return new gr_fir_ccc_altivec (taps); -} -#endif - -static gr_fir_fff * -make_gr_fir_fff_armv7_a (const std::vector<float> &taps) -{ - return new gr_fir_fff_armv7_a (taps); -} - -#if 0 -static gr_fir_fsf * -make_gr_fir_fsf_altivec (const std::vector<float> &taps) -{ - return new gr_fir_fsf_altivec (taps); -} - -static gr_fir_scc * -make_gr_fir_scc_altivec(const std::vector<gr_complex> &taps) -{ - return new gr_fir_scc_altivec(taps); -} -#endif - -/* - * ---------------------------------------------------------------- - * Return instances of the fastest arm versions of these classes. - * - * check CPUID, if has armv7-a, return armv7-a version, - * else return generic version. This will break - * when someone makes an armv7-a without a NEON - * coprocessor. - * ---------------------------------------------------------------- - */ - -gr_fir_ccf * -gr_fir_sysconfig_armv7_a::create_gr_fir_ccf (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_armv7_a ()){ - if (first){ - cerr << ">>> gr_fir_ccf: using armv7_a\n"; - first = false; - } - return make_gr_fir_ccf_armv7_a (taps); - } - - if (0 && first){ - cerr << ">>> gr_fir_ccf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps); -} - -gr_fir_fcc * -gr_fir_sysconfig_armv7_a::create_gr_fir_fcc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_fcc: using altivec\n"; - first = false; - } - return make_gr_fir_fcc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_fcc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps); -} - -gr_fir_ccc * -gr_fir_sysconfig_armv7_a::create_gr_fir_ccc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_ccc: using altivec\n"; - first = false; - } - return make_gr_fir_ccc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_ccc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps); -} - -gr_fir_fff * -gr_fir_sysconfig_armv7_a::create_gr_fir_fff (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_armv7_a ()){ - if (first){ - cerr << ">>> gr_fir_fff: using armv7_a\n"; - first = false; - } - return make_gr_fir_fff_armv7_a (taps); - } - - if (0 && first){ - cerr << ">>> gr_fir_fff: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fff (taps); -} - -gr_fir_fsf * -gr_fir_sysconfig_armv7_a::create_gr_fir_fsf (const std::vector<float> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_fsf: using altivec\n"; - first = false; - } - return make_gr_fir_fsf_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_fsf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps); -} - - -gr_fir_scc * -gr_fir_sysconfig_armv7_a::create_gr_fir_scc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_scc: using altivec\n"; - first = false; - } - return make_gr_fir_scc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_scc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_scc (taps); -} - -/* - * ---------------------------------------------------------------- - * Return info about available implementations - * ---------------------------------------------------------------- - */ - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info); - - // add our stuff... - gr_fir_ccf_info t; - if (gr_cpu::has_armv7_a ()){ - t.name = "armv7_a"; - t.create = make_gr_fir_ccf_armv7_a; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fcc_info (info); - -#if 0 - // add our stuff... - gr_fir_fcc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_fcc_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccc_info (info); - -#if 0 - // add our stuff... - gr_fir_ccc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_ccc_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fff_info (info); - - // add our stuff... - gr_fir_fff_info t; - if (gr_cpu::has_armv7_a ()){ - t.name = "armv7_a"; - t.create = make_gr_fir_fff_armv7_a; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fsf_info (info); - -#if 0 - // add our stuff... - gr_fir_fsf_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_fsf_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_scc_info (info); - -#if 0 - // add our stuff... - gr_fir_scc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_scc_altivec; - (*info).push_back (t); - } -#endif -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h deleted file mode 100644 index 7295475f64..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 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_FIR_SYSCONFIG_ARMV7_A_H -#define INCLUDED_GR_FIR_SYSCONFIG_ARMV7_A_H - -#include <gr_core_api.h> -#include <gr_fir_sysconfig_generic.h> - -class GR_CORE_API gr_fir_sysconfig_armv7_a : public gr_fir_sysconfig_generic { -public: - virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps); - virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps); - virtual gr_fir_fff *create_gr_fir_fff (const std::vector<float> &taps); - virtual gr_fir_fsf *create_gr_fir_fsf (const std::vector<float> &taps); - virtual gr_fir_scc *create_gr_fir_scc (const std::vector<gr_complex> &taps); - virtual gr_fir_ccc *create_gr_fir_ccc (const std::vector<gr_complex> &taps); -//virtual gr_fir_sss *create_gr_fir_sss (const std::vector<short> &taps); - - virtual void get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info); - virtual void get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info); - virtual void get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info); - virtual void get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info); - virtual void get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info); - virtual void get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info); -//virtual void get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.cc deleted file mode 100644 index f706bd5bf2..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.cc +++ /dev/null @@ -1,340 +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. - */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_sysconfig_powerpc.h> -#include <gr_cpu.h> - -#include <gr_fir_ccf.h> -#include <gr_fir_ccf_generic.h> -//#include <gr_fir_ccf_altivec.h> -#include <gr_fir_fcc.h> -#include <gr_fir_fcc_generic.h> -//#include <gr_fir_fcc_altivec.h> -#include <gr_fir_fff.h> -#include <gr_fir_fff_generic.h> -#include <gr_fir_fff_altivec.h> -#include <gr_fir_fsf.h> -#include <gr_fir_fsf_generic.h> -//#include <gr_fir_fsf_powerpc.h> -#include <gr_fir_ccc.h> -#include <gr_fir_ccc_generic.h> -//#include <gr_fir_ccc_altivec.h> -#include <gr_fir_scc.h> -#include <gr_fir_scc_generic.h> -//#include <gr_fir_scc_altivec.h> - -#include <iostream> -using std::cerr; - -/* - * ---------------------------------------------------------------- - * static functions that serve as constructors... - * ---------------------------------------------------------------- - */ - -#if 0 -static gr_fir_ccf * -make_gr_fir_ccf_altivec(const std::vector<float> &taps) -{ - return new gr_fir_ccf_altivec(taps); -} - -static gr_fir_fcc * -make_gr_fir_fcc_altivec(const std::vector<gr_complex> &taps) -{ - return new gr_fir_fcc_altivec(taps); -} - -static gr_fir_ccc * -make_gr_fir_ccc_altivec (const std::vector<gr_complex> &taps) -{ - return new gr_fir_ccc_altivec (taps); -} -#endif - -static gr_fir_fff * -make_gr_fir_fff_altivec (const std::vector<float> &taps) -{ - return new gr_fir_fff_altivec (taps); -} - -#if 0 -static gr_fir_fsf * -make_gr_fir_fsf_altivec (const std::vector<float> &taps) -{ - return new gr_fir_fsf_altivec (taps); -} - -static gr_fir_scc * -make_gr_fir_scc_altivec(const std::vector<gr_complex> &taps) -{ - return new gr_fir_scc_altivec(taps); -} -#endif - -/* - * ---------------------------------------------------------------- - * Return instances of the fastest powerpc versions of these classes. - * - * check CPUID, if has altivec, return altivec version, - * else return generic version. - * ---------------------------------------------------------------- - */ - -gr_fir_ccf * -gr_fir_sysconfig_powerpc::create_gr_fir_ccf (const std::vector<float> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_ccf: using altivec\n"; - first = false; - } - return make_gr_fir_ccf_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_ccf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps); -} - -gr_fir_fcc * -gr_fir_sysconfig_powerpc::create_gr_fir_fcc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_fcc: using altivec\n"; - first = false; - } - return make_gr_fir_fcc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_fcc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps); -} - -gr_fir_ccc * -gr_fir_sysconfig_powerpc::create_gr_fir_ccc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_ccc: using altivec\n"; - first = false; - } - return make_gr_fir_ccc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_ccc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps); -} - -gr_fir_fff * -gr_fir_sysconfig_powerpc::create_gr_fir_fff (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_fff: using altivec\n"; - first = false; - } - return make_gr_fir_fff_altivec (taps); - } - - if (0 && first){ - cerr << ">>> gr_fir_fff: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fff (taps); -} - -gr_fir_fsf * -gr_fir_sysconfig_powerpc::create_gr_fir_fsf (const std::vector<float> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_fsf: using altivec\n"; - first = false; - } - return make_gr_fir_fsf_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_fsf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps); -} - - -gr_fir_scc * -gr_fir_sysconfig_powerpc::create_gr_fir_scc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_scc: using altivec\n"; - first = false; - } - return make_gr_fir_scc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_scc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_scc (taps); -} - -/* - * ---------------------------------------------------------------- - * Return info about available implementations - * ---------------------------------------------------------------- - */ - -void -gr_fir_sysconfig_powerpc::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info); - -#if 0 - // add our stuff... - gr_fir_ccf_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_ccf_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_powerpc::get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fcc_info (info); - -#if 0 - // add our stuff... - gr_fir_fcc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_fcc_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_powerpc::get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccc_info (info); - -#if 0 - // add our stuff... - gr_fir_ccc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_ccc_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_powerpc::get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fff_info (info); - - // add our stuff... - gr_fir_fff_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_fff_altivec; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_powerpc::get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fsf_info (info); - -#if 0 - // add our stuff... - gr_fir_fsf_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_fsf_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_powerpc::get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_scc_info (info); - -#if 0 - // add our stuff... - gr_fir_scc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_scc_altivec; - (*info).push_back (t); - } -#endif -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h deleted file mode 100644 index 09a7a0ba04..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h +++ /dev/null @@ -1,47 +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. - */ -#ifndef INCLUDED_GR_FIR_SYSCONFIG_POWERPC_H -#define INCLUDED_GR_FIR_SYSCONFIG_POWERPC_H - -#include <gr_core_api.h> -#include <gr_fir_sysconfig_generic.h> - -class GR_CORE_API gr_fir_sysconfig_powerpc : public gr_fir_sysconfig_generic { -public: - virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps); - virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps); - virtual gr_fir_fff *create_gr_fir_fff (const std::vector<float> &taps); - virtual gr_fir_fsf *create_gr_fir_fsf (const std::vector<float> &taps); - virtual gr_fir_scc *create_gr_fir_scc (const std::vector<gr_complex> &taps); - virtual gr_fir_ccc *create_gr_fir_ccc (const std::vector<gr_complex> &taps); -//virtual gr_fir_sss *create_gr_fir_sss (const std::vector<short> &taps); - - virtual void get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info); - virtual void get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info); - virtual void get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info); - virtual void get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info); - virtual void get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info); - virtual void get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info); -//virtual void get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc deleted file mode 100644 index 97b8106994..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc +++ /dev/null @@ -1,553 +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 <gr_fir_sysconfig_x86.h> -#include <gr_cpu.h> - -#include <gr_fir_ccf.h> -#include <gr_fir_ccf_generic.h> -#include <gr_fir_ccf_x86.h> -#include <gr_fir_fcc.h> -#include <gr_fir_fcc_generic.h> -#include <gr_fir_fcc_x86.h> -#include <gr_fir_fff.h> -#include <gr_fir_fff_generic.h> -#include <gr_fir_fff_x86.h> -#include <gr_fir_fsf.h> -#include <gr_fir_fsf_generic.h> -#include <gr_fir_fsf_x86.h> -#include <gr_fir_ccc.h> -#include <gr_fir_ccc_generic.h> -#include <gr_fir_ccc_x86.h> -#include <gr_fir_scc.h> -#include <gr_fir_scc_generic.h> -#include <gr_fir_scc_x86.h> -// #include <gr_fir_sss.h> -// #include <gr_fir_sss_generic.h> -// #include <gr_fir_sss_mmx.h> -// #include <gr_fir_sss_sse2.h> - -#include <iostream> -using std::cerr; - -/* - * ---------------------------------------------------------------- - * static functions that serve as constructors... - * Is it possible to take the address of a normal constructor? - * ---------------------------------------------------------------- - */ - -static gr_fir_ccf * -make_gr_fir_ccf_3dnow(const std::vector<float> &taps) -{ - return new gr_fir_ccf_3dnow(taps); -} - -static gr_fir_ccf * -make_gr_fir_ccf_sse(const std::vector<float> &taps) -{ - return new gr_fir_ccf_sse(taps); -} - -static gr_fir_fcc * -make_gr_fir_fcc_3dnow(const std::vector<gr_complex> &taps) -{ - return new gr_fir_fcc_3dnow(taps); -} - -static gr_fir_fcc * -make_gr_fir_fcc_sse(const std::vector<gr_complex> &taps) -{ - return new gr_fir_fcc_sse(taps); -} - -static gr_fir_ccc * -make_gr_fir_ccc_3dnow (const std::vector<gr_complex> &taps) -{ - return new gr_fir_ccc_3dnow (taps); -} - -static gr_fir_ccc * -make_gr_fir_ccc_3dnowext (const std::vector<gr_complex> &taps) -{ - return new gr_fir_ccc_3dnowext (taps); -} - -static gr_fir_ccc * -make_gr_fir_ccc_sse (const std::vector<gr_complex> &taps) -{ - return new gr_fir_ccc_sse (taps); -} - -static gr_fir_fff * -make_gr_fir_fff_3dnow (const std::vector<float> &taps) -{ - return new gr_fir_fff_3dnow (taps); -} - -static gr_fir_fff * -make_gr_fir_fff_sse (const std::vector<float> &taps) -{ - return new gr_fir_fff_sse (taps); -} - -static gr_fir_fsf * -make_gr_fir_fsf_3dnow (const std::vector<float> &taps) -{ - return new gr_fir_fsf_3dnow (taps); -} - -static gr_fir_fsf * -make_gr_fir_fsf_sse (const std::vector<float> &taps) -{ - return new gr_fir_fsf_sse (taps); -} - -#if 0 -static gr_fir_sss * -make_gr_fir_sss_mmx (const std::vector<short> &taps) -{ - return new gr_fir_sss_mmx (taps); -} - -static gr_fir_sss * -make_gr_fir_sss_sse2 (const std::vector<short> &taps) -{ - return new gr_fir_sss_sse2 (taps); -} -#endif - -static gr_fir_scc * -make_gr_fir_scc_3dnow(const std::vector<gr_complex> &taps) -{ - return new gr_fir_scc_3dnow(taps); -} - -static gr_fir_scc * -make_gr_fir_scc_3dnowext(const std::vector<gr_complex> &taps) -{ - return new gr_fir_scc_3dnowext(taps); -} - -static gr_fir_scc * -make_gr_fir_scc_sse(const std::vector<gr_complex> &taps) -{ - return new gr_fir_scc_sse(taps); -} - -/* - * ---------------------------------------------------------------- - * Return instances of the fastest x86 versions of these classes. - * - * check CPUID, if has 3DNowExt, return 3DNow!Ext version, - * else if 3DNow, return 3DNow! version, - * else if SSE2, return SSE2 version, - * else if SSE, return SSE version, - * else if MMX, return MMX version, - * else return generic version. - * - * FIXME: benchmark, store result, use stored result to - * select the fastest version. - * ---------------------------------------------------------------- - */ - -gr_fir_ccf * -gr_fir_sysconfig_x86::create_gr_fir_ccf (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnow ()){ - if (first){ - cerr << ">>> gr_fir_ccf: using 3DNow!\n"; - first = false; - } - return make_gr_fir_ccf_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_ccf: using SSE\n"; - first = false; - } - return make_gr_fir_ccf_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_ccf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps); -} - -gr_fir_fcc * -gr_fir_sysconfig_x86::create_gr_fir_fcc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnow ()){ - if (first){ - cerr << ">>> gr_fir_fcc: using 3DNow!\n"; - first = false; - } - return make_gr_fir_fcc_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_fcc: using SSE\n"; - first = false; - } - return make_gr_fir_fcc_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_fcc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps); -} - -gr_fir_ccc * -gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnowext ()){ - if (first) { - cerr << ">>> gr_fir_ccc: using 3DNow!Ext\n"; - first = false; - } - return make_gr_fir_ccc_3dnowext (taps); - } - - if (gr_cpu::has_3dnow ()){ - if (first) { - cerr << ">>> gr_fir_ccc: using 3DNow!\n"; - first = false; - } - return make_gr_fir_ccc_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_ccc: using SSE\n"; - first = false; - } - return make_gr_fir_ccc_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_ccc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps); -} - -gr_fir_fff * -gr_fir_sysconfig_x86::create_gr_fir_fff (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnow ()){ - if (first) { - cerr << ">>> gr_fir_fff: using 3DNow!\n"; - first = false; - } - return make_gr_fir_fff_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_fff: using SSE\n"; - first = false; - } - return make_gr_fir_fff_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_fff: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fff (taps); -} - -gr_fir_fsf * -gr_fir_sysconfig_x86::create_gr_fir_fsf (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnow ()){ - if (first) { - cerr << ">>> gr_fir_fsf: using 3DNow!\n"; - first = false; - } - return make_gr_fir_fsf_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_fsf: using SSE\n"; - first = false; - } - return make_gr_fir_fsf_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_fsf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps); -} - -#if 0 -gr_fir_sss * -gr_fir_sysconfig_x86::create_gr_fir_sss (const std::vector<short> &taps) -{ - // FIXME -- probably want to figure out best answer for Athlon and code - // add code to select it here... - - if (gr_cpu::has_sse2 ()){ - cerr << ">>> gr_fir_sss: using SSE2\n"; - return make_gr_fir_sss_sse2 (taps); - } - - if (gr_cpu::has_mmx ()){ - cerr << ">>> gr_fir_sss: using MMX\n"; - return make_gr_fir_sss_mmx (taps); - } - - cerr << ">>> gr_fir_sss: handing off to parent class\n"; - return gr_fir_sysconfig_generic::create_gr_fir_sss (taps); -} -#endif - -gr_fir_scc * -gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnowext ()){ - if (first){ - cerr << ">>> gr_fir_scc: using 3DNow!Ext\n"; - first = false; - } - return make_gr_fir_scc_3dnowext (taps); - } - - if (gr_cpu::has_3dnow ()){ - if (first){ - cerr << ">>> gr_fir_scc: using 3DNow!\n"; - first = false; - } - return make_gr_fir_scc_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_scc: using SSE\n"; - first = false; - } - return make_gr_fir_scc_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_scc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_scc (taps); -} - -/* - * ---------------------------------------------------------------- - * Return info about available implementations - * ---------------------------------------------------------------- - */ - -void -gr_fir_sysconfig_x86::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info) -{ - gr_fir_ccf_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info); - - // add our stuff... - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_ccf_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_ccf_sse; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_x86::get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info) -{ - gr_fir_fcc_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fcc_info (info); - - // add our stuff... - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_fcc_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_fcc_sse; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_x86::get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info) -{ - gr_fir_ccc_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccc_info (info); - - // add our stuff... - if (gr_cpu::has_3dnowext ()){ - t.name = "3DNow!Ext"; - t.create = make_gr_fir_ccc_3dnowext; - (*info).push_back (t); - } - - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_ccc_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_ccc_sse; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_x86::get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info) -{ - gr_fir_fff_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fff_info (info); - - // add our stuff... - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_fff_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_fff_sse; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_x86::get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info) -{ - gr_fir_fsf_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fsf_info (info); - - // add our stuff... - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_fsf_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_fsf_sse; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_x86::get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info) -{ - gr_fir_scc_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_scc_info (info); - - // add our stuff... - if (gr_cpu::has_3dnowext ()){ - t.name = "3DNow!Ext"; - t.create = make_gr_fir_scc_3dnowext; - (*info).push_back (t); - } - - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_scc_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_scc_sse; - (*info).push_back (t); - } -} - -#if 0 -void -gr_fir_sysconfig_x86::get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info) -{ - gr_fir_sss_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_sss_info (info); - - // add our stuff... - if (gr_cpu::has_mmx ()){ - t.name = "MMX"; - t.create = make_gr_fir_sss_mmx; - (*info).push_back (t); - } - - if (gr_cpu::has_sse2 ()){ - t.name = "SSE2"; - t.create = make_gr_fir_sss_sse2; - (*info).push_back (t); - } -} -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h deleted file mode 100644 index ebb399c8ba..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h +++ /dev/null @@ -1,47 +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_GR_FIR_SYSCONFIG_X86_H -#define INCLUDED_GR_FIR_SYSCONFIG_X86_H - -#include <gr_core_api.h> -#include <gr_fir_sysconfig_generic.h> - -class GR_CORE_API gr_fir_sysconfig_x86 : public gr_fir_sysconfig_generic { -public: - virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps); - virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps); - virtual gr_fir_fff *create_gr_fir_fff (const std::vector<float> &taps); - virtual gr_fir_fsf *create_gr_fir_fsf (const std::vector<float> &taps); - virtual gr_fir_scc *create_gr_fir_scc (const std::vector<gr_complex> &taps); - virtual gr_fir_ccc *create_gr_fir_ccc (const std::vector<gr_complex> &taps); -//virtual gr_fir_sss *create_gr_fir_sss (const std::vector<short> &taps); - - virtual void get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info); - virtual void get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info); - virtual void get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info); - virtual void get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info); - virtual void get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info); - virtual void get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info); -//virtual void get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.cc b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.cc deleted file mode 100644 index 500958e3da..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_io_signature.h> -#include <gr_fractional_interpolator_cc.h> -#include <gri_mmse_fir_interpolator_cc.h> -#include <stdexcept> - -// Public constructor -gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc(float phase_shift, float interp_ratio) -{ - return gnuradio::get_initial_sptr(new gr_fractional_interpolator_cc(phase_shift, interp_ratio)); -} - -gr_fractional_interpolator_cc::gr_fractional_interpolator_cc(float phase_shift, float interp_ratio) - : gr_block ("fractional_interpolator_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_mu (phase_shift), d_mu_inc (interp_ratio), d_interp(new gri_mmse_fir_interpolator_cc()) -{ - if (interp_ratio <= 0) - throw std::out_of_range ("interpolation ratio must be > 0"); - if (phase_shift < 0 || phase_shift > 1) - throw std::out_of_range ("phase shift ratio must be > 0 and < 1"); - - set_relative_rate (1.0 / interp_ratio); -} - -gr_fractional_interpolator_cc::~gr_fractional_interpolator_cc() -{ - delete d_interp; -} - -void -gr_fractional_interpolator_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_mu_inc) + d_interp->ntaps()); -} - -int -gr_fractional_interpolator_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 ii = 0; // input index - int oo = 0; // output index - - while (oo < noutput_items) { - - out[oo++] = d_interp->interpolate(&in[ii], d_mu); - - double s = d_mu + d_mu_inc; - double f = floor (s); - int incr = (int) f; - d_mu = s - f; - ii += incr; - } - - consume_each (ii); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h deleted file mode 100644 index 29c67895a4..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h +++ /dev/null @@ -1,68 +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_GR_FRACTIONAL_INTERPOLATOR_CC_H -#define INCLUDED_GR_FRACTIONAL_INTERPOLATOR_CC_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gri_mmse_fir_interpolator_cc; - -class gr_fractional_interpolator_cc; -typedef boost::shared_ptr<gr_fractional_interpolator_cc> gr_fractional_interpolator_cc_sptr; - -// public constructor -GR_CORE_API gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio); - -/*! - * \brief Interpolating mmse filter with gr_complex input, gr_complex output - * \ingroup filter_blk - */ -class GR_CORE_API gr_fractional_interpolator_cc : public gr_block -{ -public: - ~gr_fractional_interpolator_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 interp_ratio() const { return d_mu_inc;} - void set_mu (float mu) { d_mu = mu; } - void set_interp_ratio (float interp_ratio) { d_mu_inc = interp_ratio; } - -protected: - gr_fractional_interpolator_cc (float phase_shift, float interp_ratio); - -private: - float d_mu; - float d_mu_inc; - gri_mmse_fir_interpolator_cc *d_interp; - - friend GR_CORE_API gr_fractional_interpolator_cc_sptr - gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.i b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.i deleted file mode 100644 index d7341176a7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.i +++ /dev/null @@ -1,37 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,fractional_interpolator_cc); - -gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio); - -class gr_fractional_interpolator_cc : public gr_block -{ -private: - gr_fractional_interpolator_cc (float phase_shift, float interp_ratio); - -public: - float mu() const; - float interp_ratio() const; - void set_mu (float mu); - void set_interp_ratio (float interp_ratio); -}; diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.cc b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.cc deleted file mode 100644 index 9cbe31635d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_io_signature.h> -#include <gr_fractional_interpolator_ff.h> -#include <gri_mmse_fir_interpolator.h> -#include <stdexcept> - -// Public constructor -gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff(float phase_shift, float interp_ratio) -{ - return gnuradio::get_initial_sptr(new gr_fractional_interpolator_ff(phase_shift, interp_ratio)); -} - -gr_fractional_interpolator_ff::gr_fractional_interpolator_ff(float phase_shift, float interp_ratio) - : gr_block ("fractional_interpolator_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))), - d_mu (phase_shift), d_mu_inc (interp_ratio), d_interp(new gri_mmse_fir_interpolator()) -{ - if (interp_ratio <= 0) - throw std::out_of_range ("interpolation ratio must be > 0"); - if (phase_shift < 0 || phase_shift > 1) - throw std::out_of_range ("phase shift ratio must be > 0 and < 1"); - - set_relative_rate (1.0 / interp_ratio); -} - -gr_fractional_interpolator_ff::~gr_fractional_interpolator_ff() -{ - delete d_interp; -} - -void -gr_fractional_interpolator_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_mu_inc) + d_interp->ntaps()); -} - -int -gr_fractional_interpolator_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 - - while (oo < noutput_items) { - - out[oo++] = d_interp->interpolate(&in[ii], d_mu); - - double s = d_mu + d_mu_inc; - double f = floor (s); - int incr = (int) f; - d_mu = s - f; - ii += incr; - } - - consume_each (ii); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h deleted file mode 100644 index 7e000a6d1c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h +++ /dev/null @@ -1,68 +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_GR_FRACTIONAL_INTERPOLATOR_FF_H -#define INCLUDED_GR_FRACTIONAL_INTERPOLATOR_FF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gri_mmse_fir_interpolator; - -class gr_fractional_interpolator_ff; -typedef boost::shared_ptr<gr_fractional_interpolator_ff> gr_fractional_interpolator_ff_sptr; - -// public constructor -GR_CORE_API gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio); - -/*! - * \brief Interpolating mmse filter with float input, float output - * \ingroup filter_blk - */ -class GR_CORE_API gr_fractional_interpolator_ff : public gr_block -{ -public: - ~gr_fractional_interpolator_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 interp_ratio() const { return d_mu_inc;} - void set_mu (float mu) { d_mu = mu; } - void set_interp_ratio (float interp_ratio) { d_mu_inc = interp_ratio; } - -protected: - gr_fractional_interpolator_ff (float phase_shift, float interp_ratio); - -private: - float d_mu; - float d_mu_inc; - gri_mmse_fir_interpolator *d_interp; - - friend GR_CORE_API gr_fractional_interpolator_ff_sptr - gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.i b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.i deleted file mode 100644 index 4ec7c85cfc..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.i +++ /dev/null @@ -1,37 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,fractional_interpolator_ff); - -gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio); - -class gr_fractional_interpolator_ff : public gr_block -{ -private: - gr_fractional_interpolator_ff (float phase_shift, float interp_ratio); - -public: - float mu() const; - float interp_ratio() const; - void set_mu (float mu); - void set_interp_ratio (float interp_ratio); -}; diff --git a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.cc.t deleted file mode 100644 index 3d65f872e6..0000000000 --- a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.cc.t +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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: This file is automatically generated by - * generate_gr_freq_xlating_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <@FIR_TYPE@.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq) -{ - return gnuradio::get_initial_sptr (new @NAME@ (decimation, taps, center_freq, sampling_freq)); -} - - -@NAME@::@NAME@ ( - - int decimation, - const std::vector<@TAP_TYPE@> &taps, - double center_freq, - double sampling_freq) - - : gr_sync_decimator ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)), - decimation), - d_proto_taps (taps), d_center_freq (center_freq), d_sampling_freq (sampling_freq), - d_updated (false) -{ - std::vector<gr_complex> dummy_taps; - d_composite_fir = gr_fir_util::create_@FIR_TYPE@ (dummy_taps); - - set_history (d_proto_taps.size ()); - build_composite_fir (); -} - -@NAME@::~@NAME@ () -{ - delete d_composite_fir; -} - -void -@NAME@::build_composite_fir () -{ - std::vector<gr_complex> ctaps (d_proto_taps.size ()); - - float fwT0 = 2 * M_PI * d_center_freq / d_sampling_freq; - for (unsigned int i = 0; i < d_proto_taps.size (); i++) - ctaps[i] = d_proto_taps[i] * exp (gr_complex (0, i * fwT0)); - - d_composite_fir->set_taps (gr_reverse(ctaps)); - d_r.set_phase_incr (exp (gr_complex (0, fwT0 * decimation ()))); -} - -void -@NAME@::set_center_freq (double center_freq) -{ - d_center_freq = center_freq; - d_updated = true; -} - -void -@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps) -{ - d_proto_taps = taps; - d_updated = true; -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @I_TYPE@ *in = (@I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - - // rebuild composite FIR if the center freq has changed - - if (d_updated){ - set_history (d_proto_taps.size ()); - build_composite_fir (); - d_updated = false; - return 0; // history requirements may have changed. - } - - unsigned j = 0; - for (int i = 0; i < noutput_items; i++){ - out[i] = d_r.rotate (d_composite_fir->filter (&in[j])); - j += decimation (); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t deleted file mode 100644 index 97d20e04f5..0000000000 --- a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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: This file is automatically generated by - * generate_gr_freq_xlating_fir_filter_XXX.py Any changes made to this file - * will be overwritten. - */ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> -#include <gr_rotator.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -/*! - * Construct a FIR filter with the given taps and a composite frequency - * translation that shifts center_freq down to zero Hz. The frequency - * translation logically comes before the filtering operation. - */ -GR_CORE_API @SPTR_NAME@ -gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq); - - -class @FIR_TYPE@; - -/*! - * \brief FIR filter combined with frequency translation with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter_blk - * - * This class efficiently combines a frequency translation - * (typically "down conversion") with a FIR filter (typically low-pass) - * and decimation. It is ideally suited for a "channel selection filter" - * and can be efficiently used to select and decimate a narrow band signal - * out of wide bandwidth input. - * - * Uses a single input array to produce a single output array. - * Additional inputs and/or outputs are ignored. - */ -class GR_CORE_API @NAME@ : public gr_sync_decimator -{ - public: - virtual ~@NAME@ (); - - void set_center_freq (double center_freq); - void set_taps (const std::vector<@TAP_TYPE@> &taps); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - private: - friend GR_CORE_API @SPTR_NAME@ - gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq); - - protected: - std::vector<@TAP_TYPE@> d_proto_taps; - @FIR_TYPE@ *d_composite_fir; - gr_rotator d_r; - double d_center_freq; - double d_sampling_freq; - bool d_updated; - - virtual void build_composite_fir (); - - /*! - * Construct a FIR filter with the given taps and a composite frequency - * translation that shifts center_freq down to zero Hz. The frequency - * translation logically comes before the filtering operation. - */ - @NAME@ (int decimation, - const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq); -}; - -#endif /* _@NAME@_H_ */ diff --git a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.i.t b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.i.t deleted file mode 100644 index ac6c8c9e1e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.i.t +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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: This file is automatically generated by - * generate_gr_freq_xlating_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq); - - -class @NAME@ : public gr_sync_decimator -{ - protected: - @NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq); - - public: - ~@NAME@ (); - - void set_center_freq (double center_freq); - void set_taps (const std::vector<@TAP_TYPE@> &taps); -}; diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc b/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc deleted file mode 100644 index 07bed8157b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc +++ /dev/null @@ -1,76 +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 <gr_goertzel_fc.h> -#include <gr_io_signature.h> - -// public constructor -gr_goertzel_fc_sptr -gr_make_goertzel_fc(int rate, int len, float freq) -{ - return gnuradio::get_initial_sptr(new gr_goertzel_fc(rate, len, freq)); -} - -gr_goertzel_fc::gr_goertzel_fc(int rate, int len, float freq) - : gr_sync_decimator("goertzel_fc", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (gr_complex)), - len), - d_goertzel(rate, len, freq) -{ - d_len = len; - d_rate = rate; - d_freq = freq; -} - -int gr_goertzel_fc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *in = (float *)input_items[0]; - gr_complex *out = (gr_complex *)output_items[0]; - - for (int i = 0; i < noutput_items; i++) { - *out++ = d_goertzel.batch(in); - in += d_len; - } - - return noutput_items; -} - -void -gr_goertzel_fc::set_freq(float freq) -{ - d_freq = freq; - d_goertzel.gri_setparms(d_rate, d_len, d_freq); -} - -void -gr_goertzel_fc::set_rate(int rate) -{ - d_rate = rate; - d_goertzel.gri_setparms(d_rate, d_len, d_freq); -} diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.h b/gnuradio-core/src/lib/filter/gr_goertzel_fc.h deleted file mode 100644 index 5fb6e0ee05..0000000000 --- a/gnuradio-core/src/lib/filter/gr_goertzel_fc.h +++ /dev/null @@ -1,61 +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_GR_GOERTZEL_FC_H -#define INCLUDED_GR_GOERTZEL_FC_H - -#include <gr_core_api.h> -#include <gri_goertzel.h> -#include <gr_sync_decimator.h> - -class gr_goertzel_fc; -typedef boost::shared_ptr<gr_goertzel_fc> gr_goertzel_fc_sptr; - -// public constructor -GR_CORE_API gr_goertzel_fc_sptr gr_make_goertzel_fc(int rate, int len, float freq); - -/*! - * \brief Goertzel single-bin DFT calculation. - * \ingroup dft_blk - */ -class GR_CORE_API gr_goertzel_fc : public gr_sync_decimator -{ -private: - friend GR_CORE_API gr_goertzel_fc_sptr gr_make_goertzel_fc (int rate, int len, float freq); - - gr_goertzel_fc(int rate, int len, float freq); - gri_goertzel d_goertzel; - int d_len; - float d_freq; - int d_rate; - -public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_freq (float freq); - void set_rate (int rate); -}; - -#endif /* INCLUDED_GR_GOERTZEL_FC_H */ - diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.i b/gnuradio-core/src/lib/filter/gr_goertzel_fc.i deleted file mode 100644 index 775c78cc8e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_goertzel_fc.i +++ /dev/null @@ -1,35 +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(gr,goertzel_fc); - -gr_goertzel_fc_sptr gr_make_goertzel_fc(int rate, int len, float freq); - -class gr_goertzel_fc : public gr_sync_decimator -{ -private: - gr_goertzel_fc(); - -public: - void set_freq (float freq); - void set_rate (int rate); -}; diff --git a/gnuradio-core/src/lib/filter/gr_hilbert_fc.cc b/gnuradio-core/src/lib/filter/gr_hilbert_fc.cc deleted file mode 100644 index 385e24ad2b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_hilbert_fc.cc +++ /dev/null @@ -1,67 +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 <gr_hilbert_fc.h> -#include <gr_firdes.h> -#include <gr_fir_fff.h> -#include <gr_fir_util.h> - -// public constructor -gr_hilbert_fc_sptr -gr_make_hilbert_fc (unsigned int ntaps) -{ - return gnuradio::get_initial_sptr(new gr_hilbert_fc (ntaps)); -} - -gr_hilbert_fc::gr_hilbert_fc (unsigned int ntaps) - : gr_sync_block ("hilbert_fc", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_ntaps (ntaps | 0x1), // ensure ntaps is odd - d_hilb (gr_fir_util::create_gr_fir_fff (gr_firdes::hilbert (d_ntaps))) -{ - set_history (d_ntaps); -} - -gr_hilbert_fc::~gr_hilbert_fc () -{ - delete d_hilb; -} - -int -gr_hilbert_fc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *in = (float *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) - out[i] = gr_complex (in[i + d_ntaps/2], - d_hilb->filter (&in[i])); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_hilbert_fc.h b/gnuradio-core/src/lib/filter/gr_hilbert_fc.h deleted file mode 100644 index 2bb5ff9e37..0000000000 --- a/gnuradio-core/src/lib/filter/gr_hilbert_fc.h +++ /dev/null @@ -1,69 +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_GR_HILBERT_FC_H -#define INCLUDED_GR_HILBERT_FC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_io_signature.h> -#include <gr_types.h> - -class gr_hilbert_fc; -typedef boost::shared_ptr<gr_hilbert_fc> gr_hilbert_fc_sptr; - -// public constructor -GR_CORE_API gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps); - - -class gr_fir_fff; - -/*! - * \brief Hilbert transformer. - * \ingroup filter_blk - * - * real output is input appropriately delayed. - * imaginary output is hilbert filtered (90 degree phase shift) - * version of input. - */ -class GR_CORE_API gr_hilbert_fc : public gr_sync_block -{ - public: - ~gr_hilbert_fc (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - protected: - gr_hilbert_fc (unsigned int ntaps); - - private: - unsigned int d_ntaps; - gr_fir_fff *d_hilb; - - friend GR_CORE_API gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps); -}; - - - -#endif /* INCLUDED_GR_HILBERT_FC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_hilbert_fc.i b/gnuradio-core/src/lib/filter/gr_hilbert_fc.i deleted file mode 100644 index 91d4e23eb7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_hilbert_fc.i +++ /dev/null @@ -1,34 +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(gr,hilbert_fc); - -gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps); - -class gr_hilbert_fc : public gr_sync_block -{ -protected: - gr_hilbert_fc (unsigned int ntaps); - -public: - ~gr_hilbert_fc (); -}; diff --git a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.cc b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.cc deleted file mode 100644 index 4da2aa310b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.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 <gr_iir_filter_ffd.h> -#include <gr_io_signature.h> -#include <stdio.h> - - -gr_iir_filter_ffd_sptr -gr_make_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument) -{ - return gnuradio::get_initial_sptr(new gr_iir_filter_ffd (fftaps, fbtaps)); -} - -gr_iir_filter_ffd::gr_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument) - - : gr_sync_block ("iir_filter_ffd", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))), - d_iir (fftaps, fbtaps), - d_updated (false) -{ - // fprintf (stderr, "gr_iir_filter_ffd::ctor\n"); -} - -gr_iir_filter_ffd::~gr_iir_filter_ffd () -{ - // nop -} - -void -gr_iir_filter_ffd::set_taps (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument) -{ - - d_new_fftaps = fftaps; - d_new_fbtaps = fbtaps; - d_updated = true; -} - -int -gr_iir_filter_ffd::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]; - - - if (d_updated){ - d_iir.set_taps (d_new_fftaps, d_new_fbtaps); - d_updated = false; - } - - d_iir.filter_n (out, in, noutput_items); - return noutput_items; -}; diff --git a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h deleted file mode 100644 index ab7065e921..0000000000 --- a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h +++ /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. - */ - -#ifndef INCLUDED_GR_IIR_FILTER_FFD_H -#define INCLUDED_GR_IIR_FILTER_FFD_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_iir.h> -#include <stdexcept> - -class gr_iir_filter_ffd; -typedef boost::shared_ptr<gr_iir_filter_ffd> gr_iir_filter_ffd_sptr; -GR_CORE_API gr_iir_filter_ffd_sptr -gr_make_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - -/*! - * \brief IIR filter with float input, float output and double taps - * \ingroup filter_blk - * - * This filter uses the Direct Form I implementation, where - * \p fftaps contains the feed-forward taps, and \p fbtaps the feedback ones. - * - * - * The input and output satisfy a difference equation of the form - \htmlonly - \f{ - y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k] - \f} - \endhtmlonly - - \xmlonly - y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k] - \endxmlonly - - * with the corresponding rational system function - \htmlonly - \f{ - H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}} - \f} - \endhtmlonly - - \xmlonly - H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}} - \endxmlonly - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback taps. - */ -class GR_CORE_API gr_iir_filter_ffd : public gr_sync_block -{ - private: - friend GR_CORE_API gr_iir_filter_ffd_sptr - gr_make_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - - gri_iir<float,float,double> d_iir; - std::vector<double> d_new_fftaps; - std::vector<double> d_new_fbtaps; - bool d_updated; - - /*! - * Construct an IIR filter with the given taps - */ - gr_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - - public: - ~gr_iir_filter_ffd (); - - void set_taps (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.i b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.i deleted file mode 100644 index 0a35ad89e1..0000000000 --- a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.i +++ /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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,iir_filter_ffd); - -gr_iir_filter_ffd_sptr -gr_make_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - -class gr_iir_filter_ffd : public gr_sync_block -{ - private: - gr_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - - public: - ~gr_iir_filter_ffd (); - - void set_taps (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); -}; diff --git a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.cc.t deleted file mode 100644 index 55297d1eb9..0000000000 --- a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.cc.t +++ /dev/null @@ -1,146 +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: This file is automatically generated by generate_gr_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <@FIR_TYPE@.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -@SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps) -{ - return gnuradio::get_initial_sptr (new @NAME@ (interpolation, taps)); -} - - -@NAME@::@NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps) - : gr_sync_interpolator ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)), - interpolation), - d_updated (false), d_firs (interpolation) -{ - if (interpolation == 0) - throw std::out_of_range ("interpolation must be > 0"); - - std::vector<@TAP_TYPE@> dummy_taps; - - for (unsigned i = 0; i < interpolation; i++) - d_firs[i] = gr_fir_util::create_@FIR_TYPE@ (dummy_taps); - - set_taps (taps); - install_taps(d_new_taps); -} - -@NAME@::~@NAME@ () -{ - int interp = interpolation (); - for (int i = 0; i < interp; i++) - delete d_firs[i]; -} - -void -@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps) -{ - d_new_taps = taps; - d_updated = true; - - // round up length to a multiple of the interpolation factor - int n = taps.size () % interpolation (); - if (n > 0){ - n = interpolation () - n; - while (n-- > 0) - d_new_taps.insert(d_new_taps.begin(), 0); - } - - assert (d_new_taps.size () % interpolation () == 0); -} - - -void -@NAME@::install_taps (const std::vector<@TAP_TYPE@> &taps) -{ - int nfilters = interpolation (); - int nt = taps.size () / nfilters; - - assert (nt * nfilters == (int) taps.size ()); - - std::vector< std::vector <@TAP_TYPE@> > xtaps (nfilters); - - for (int n = 0; n < nfilters; n++) - xtaps[n].resize (nt); - - for (int i = 0; i < (int) taps.size(); i++) - xtaps[i % nfilters][i / nfilters] = taps[i]; - - for (int n = 0; n < nfilters; n++) - d_firs[n]->set_taps (xtaps[n]); - - set_history (nt); - d_updated = false; - -#if 0 - for (int i = 0; i < nfilters; i++){ - std::cout << "filter[" << i << "] = "; - for (int j = 0; j < nt; j++) - std::cout << xtaps[i][j] << " "; - - std::cout << "\n"; - } -#endif - -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - - if (d_updated) { - install_taps (d_new_taps); - return 0; // history requirements may have changed. - } - - int nfilters = interpolation (); - int ni = noutput_items / interpolation (); - - for (int i = 0; i < ni; i++){ - for (int nf = 0; nf < nfilters; nf++) - out[nf] = d_firs[nf]->filter (&in[i]); - out += nfilters; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t deleted file mode 100644 index 83904dce21..0000000000 --- a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t +++ /dev/null @@ -1,70 +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: This file is automatically generated by generate_gr_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps); - -class @FIR_TYPE@; - -/*! - * \brief Interpolating FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter_blk - */ -class GR_CORE_API @NAME@ : public gr_sync_interpolator -{ - private: - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps); - - std::vector<@TAP_TYPE@> d_new_taps; - bool d_updated; - std::vector<@FIR_TYPE@ *> d_firs; - - /*! - * Construct a FIR filter with the given taps - */ - @NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps); - - void install_taps (const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - - void set_taps (const std::vector<@TAP_TYPE@> &taps); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.i.t b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.i.t deleted file mode 100644 index 2747530016..0000000000 --- a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.i.t +++ /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. - */ - -/* - * WARNING: This file is automatically generated by generate_GrFIRfilterXXX.py - * Any changes made to this file will be overwritten. - */ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int interpolation, const std::vector<@TAP_TYPE@> &taps); - -class @NAME@ : public gr_sync_interpolator -{ - private: - @NAME@ (int interpolation, const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - - void set_taps (const std::vector<@TAP_TYPE@> &taps); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc deleted file mode 100644 index ee09fef44e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc +++ /dev/null @@ -1,210 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 <gr_pfb_arb_resampler_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <cstdio> - -gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size) -{ - return gnuradio::get_initial_sptr(new gr_pfb_arb_resampler_ccf (rate, taps, - filter_size)); -} - - -gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size) - : gr_block ("pfb_arb_resampler_ccf", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex))), - d_updated (false) -{ - d_acc = 0; // start accumulator at 0 - - /* The number of filters is specified by the user as the filter size; - this is also the interpolation rate of the filter. We use it and the - rate provided to determine the decimation rate. This acts as a - rational resampler. The flt_rate is calculated as the residual - between the integer decimation rate and the real decimation rate and - will be used to determine to interpolation point of the resampling - process. - */ - d_int_rate = filter_size; - set_rate(rate); - - // Store the last filter between calls to work - d_last_filter = 0; - - d_start_index = 0; - - d_filters = std::vector<gr_fir_ccf*>(d_int_rate); - d_diff_filters = std::vector<gr_fir_ccf*>(d_int_rate); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_int_rate); - for(unsigned int i = 0; i < d_int_rate; 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); - create_taps(taps, d_taps, d_filters); - create_taps(dtaps, d_dtaps, d_diff_filters); -} - -gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf () -{ - for(unsigned int i = 0; i < d_int_rate; i++) { - delete d_filters[i]; - delete d_diff_filters[i]; - } -} - -void -gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_ccf*> &ourfilter) -{ - unsigned int ntaps = newtaps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate); - - // Create d_numchan vectors to store each channel's taps - ourtaps.resize(d_int_rate); - - // 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_int_rate*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(unsigned int i = 0; i < d_int_rate; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0); - for(unsigned int j = 0; j < d_taps_per_filter; j++) { - ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate]; - } - - // Build a filter for each channel and add it's taps to it - ourfilter[i]->set_taps(ourtaps[d_int_rate-1-i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter + 1); - - d_updated = true; -} - -void -gr_pfb_arb_resampler_ccf::create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps) -{ - // Calculate the differential taps (derivative filter) by taking the difference - // between two taps. Duplicate the last one to make both filters the same length. - float tap; - difftaps.clear(); - for(unsigned int i = 0; i < newtaps.size()-1; i++) { - tap = newtaps[i+1] - newtaps[i]; - difftaps.push_back(tap); - } - difftaps.push_back(tap); -} - -void -gr_pfb_arb_resampler_ccf::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_int_rate; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n"); - } -} - -int -gr_pfb_arb_resampler_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]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - int i = 0, count = d_start_index; - unsigned int j; - gr_complex o0, o1; - - // Restore the last filter position - j = d_last_filter; - - // produce output as long as we can and there are enough input samples - int max_input = ninput_items[0]-(int)d_taps_per_filter; - while((i < noutput_items) && (count < max_input)) { - // start j by wrapping around mod the number of channels - while((j < d_int_rate) && (i < noutput_items)) { - // Take the current filter and derivative filter output - o0 = d_filters[j]->filter(&in[count]); - o1 = d_diff_filters[j]->filter(&in[count]); - - out[i] = o0 + o1*d_acc; // linearly interpolate between samples - i++; - - // Adjust accumulator and index into filterbank - d_acc += d_flt_rate; - j += d_dec_rate + (int)floor(d_acc); - d_acc = fmodf(d_acc, 1.0); - } - if(i < noutput_items) { // keep state for next entry - float ss = (int)(j / d_int_rate); // number of items to skip ahead by - count += ss; // we have fully consumed another input - j = j % d_int_rate; // roll filter around - } - } - - // Store the current filter position and start of next sample - d_last_filter = j; - d_start_index = std::max(0, count - ninput_items[0]); - - // consume all we've processed but no more than we can - consume_each(std::min(count, ninput_items[0])); - return i; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h deleted file mode 100644 index d92898a23e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 INCLUDED_GR_PFB_ARB_RESAMPLER_CCF_H -#define INCLUDED_GR_PFB_ARB_RESAMPLER_CCF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_pfb_arb_resampler_ccf; -typedef boost::shared_ptr<gr_pfb_arb_resampler_ccf> gr_pfb_arb_resampler_ccf_sptr; -GR_CORE_API gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size=32); - -class gr_fir_ccf; - -/*! - * \class gr_pfb_arb_resampler_ccf - * - * \brief Polyphase filterbank arbitrary resampler with - * gr_complex input, gr_complex output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block takes in a signal stream and performs arbitrary - * resampling. The resampling rate can be any real - * number <EM>r</EM>. The resampling is done by constructing - * <EM>N</EM> filters where <EM>N</EM> is the interpolation rate. We - * then calculate <EM>D</EM> where <EM>D = floor(N/r)</EM>. - * - * Using <EM>N</EM> and <EM>D</EM>, we can perform rational resampling - * where <EM>N/D</EM> is a rational number close to the input rate - * <EM>r</EM> where we have <EM>N</EM> filters and we cycle through - * them as a polyphase filterbank with a stride of <EM>D</EM> so that - * <EM>i+1 = (i + D) % N</EM>. - * - * To get the arbitrary rate, we want to interpolate between two - * points. For each value out, we take an output from the current - * filter, <EM>i</EM>, and the next filter <EM>i+1</EM> and then - * linearly interpolate between the two based on the real resampling - * rate we want. - * - * The linear interpolation only provides us with an approximation to - * the real sampling rate specified. The error is a quantization error - * between the two filters we used as our interpolation points. To - * this end, the number of filters, <EM>N</EM>, used determines the - * quantization error; the larger <EM>N</EM>, the smaller the - * noise. You can design for a specified noise floor by setting the - * filter size (parameters <EM>filter_size</EM>). The size defaults to - * 32 filters, which is about as good as most implementations need. - * - * The trick with designing this filter is in how to specify the taps - * of the prototype filter. Like the PFB interpolator, the taps are - * specified using the interpolated filter rate. In this case, that - * rate is the input sample rate multiplied by the number of filters - * in the filterbank, which is also the interpolation rate. All other - * values should be relative to this rate. - * - * For example, for a 32-filter arbitrary resampler and using the - * GNU Radio's firdes utility to build the filter, we build a low-pass - * filter with a sampling rate of <EM>fs</EM>, a 3-dB bandwidth of - * <EM>BW</EM> and a transition bandwidth of <EM>TB</EM>. We can also - * specify the out-of-band attenuation to use, <EM>ATT</EM>, and the - * filter window function (a Blackman-harris window in this case). The - * first input is the gain of the filter, which we specify here as the - * interpolation rate (<EM>32</EM>). - * - * <B><EM>self._taps = gr.firdes.low_pass_2(32, 32*fs, BW, TB, - * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B> - * - * The theory behind this block can be found in Chapter 7.5 of - * the following book. - * - * <B><EM>f. harris, "Multirate Signal Processing for Communication - * Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> - */ - -class GR_CORE_API gr_pfb_arb_resampler_ccf : public gr_block -{ - private: - /*! - * Build the polyphase filterbank arbitray resampler. - * \param rate (float) Specifies the resampling rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the filter_size sampling rate. - * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly - related to quantization noise introduced during the resampling. - Defaults to 32 filters. - */ - friend GR_CORE_API gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - 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; - unsigned int d_int_rate; // the number of filters (interpolation rate) - unsigned int d_dec_rate; // the stride through the filters (decimation rate) - float d_flt_rate; // residual rate for the linear interpolation - float d_acc; - unsigned int d_last_filter; - int d_start_index; - unsigned int d_taps_per_filter; - bool d_updated; - - /*! - * Build the polyphase filterbank arbitray resampler. - * \param rate (float) Specifies the resampling rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the filter_size sampling rate. - * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly - related to quantization noise introduced during the resampling. - Defaults to 32 filters. - */ - gr_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - void create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param newtaps (vector of floats) The prototype filter to populate the filterbank. - * The taps should be generated at the interpolated sampling rate. - * \param ourtaps (vector of floats) Reference to our internal member of holding the taps. - * \param ourfilter (vector of filters) Reference to our internal filter to set the taps for. - */ - void create_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_ccf*> &ourfilter); - - -public: - ~gr_pfb_arb_resampler_ccf (); - - // FIXME: See about a set_taps function during runtime. - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - void set_rate (float rate) { - d_dec_rate = (unsigned int)floor(d_int_rate/rate); - d_flt_rate = (d_int_rate/rate) - d_dec_rate; - set_relative_rate(rate); - } - - 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/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i deleted file mode 100644 index da58947e92..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i +++ /dev/null @@ -1,42 +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(gr,pfb_arb_resampler_ccf); - -gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size=32); - -class gr_pfb_arb_resampler_ccf : public gr_block -{ - private: - gr_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - public: - ~gr_pfb_arb_resampler_ccf (); - - //void set_taps (const std::vector<float> &taps); - void print_taps(); - void set_rate (float rate); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.cc deleted file mode 100644 index f01af2e6f4..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.cc +++ /dev/null @@ -1,210 +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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pfb_arb_resampler_fff.h> -#include <gr_fir_fff.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <cstdio> - -gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size) -{ - return gnuradio::get_initial_sptr(new gr_pfb_arb_resampler_fff (rate, taps, - filter_size)); -} - - -gr_pfb_arb_resampler_fff::gr_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size) - : gr_block ("pfb_arb_resampler_fff", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (1, 1, sizeof(float))), - d_updated (false) -{ - d_acc = 0; // start accumulator at 0 - - /* The number of filters is specified by the user as the filter size; - this is also the interpolation rate of the filter. We use it and the - rate provided to determine the decimation rate. This acts as a - rational resampler. The flt_rate is calculated as the residual - between the integer decimation rate and the real decimation rate and - will be used to determine to interpolation point of the resampling - process. - */ - d_int_rate = filter_size; - set_rate(rate); - - // Store the last filter between calls to work - d_last_filter = 0; - - d_start_index = 0; - - d_filters = std::vector<gr_fir_fff*>(d_int_rate); - d_diff_filters = std::vector<gr_fir_fff*>(d_int_rate); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_int_rate); - for(unsigned int i = 0; i < d_int_rate; 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); - create_taps(taps, d_taps, d_filters); - create_taps(dtaps, d_dtaps, d_diff_filters); -} - -gr_pfb_arb_resampler_fff::~gr_pfb_arb_resampler_fff () -{ - for(unsigned int i = 0; i < d_int_rate; i++) { - delete d_filters[i]; - delete d_diff_filters[i]; - } -} - -void -gr_pfb_arb_resampler_fff::create_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_fff*> &ourfilter) -{ - unsigned int ntaps = newtaps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate); - - // Create d_numchan vectors to store each channel's taps - ourtaps.resize(d_int_rate); - - // 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_int_rate*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(unsigned int i = 0; i < d_int_rate; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0); - for(unsigned int j = 0; j < d_taps_per_filter; j++) { - ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate]; - } - - // Build a filter for each channel and add it's taps to it - ourfilter[i]->set_taps(ourtaps[d_int_rate-1-i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter + 1); - - d_updated = true; -} - -void -gr_pfb_arb_resampler_fff::create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps) -{ - // Calculate the differential taps (derivative filter) by taking the difference - // between two taps. Duplicate the last one to make both filters the same length. - float tap; - difftaps.clear(); - for(unsigned int i = 0; i < newtaps.size()-1; i++) { - tap = newtaps[i+1] - newtaps[i]; - difftaps.push_back(tap); - } - difftaps.push_back(tap); -} - -void -gr_pfb_arb_resampler_fff::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_int_rate; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n"); - } -} - -int -gr_pfb_arb_resampler_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]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - int i = 0, count = d_start_index; - unsigned int j; - float o0, o1; - - // Restore the last filter position - j = d_last_filter; - - // produce output as long as we can and there are enough input samples - int max_input = ninput_items[0]-(int)d_taps_per_filter; - while((i < noutput_items) && (count < max_input)) { - // start j by wrapping around mod the number of channels - while((j < d_int_rate) && (i < noutput_items)) { - // Take the current filter and derivative filter output - o0 = d_filters[j]->filter(&in[count]); - o1 = d_diff_filters[j]->filter(&in[count]); - - out[i] = o0 + o1*d_acc; // linearly interpolate between samples - i++; - - // Adjust accumulator and index into filterbank - d_acc += d_flt_rate; - j += d_dec_rate + (int)floor(d_acc); - d_acc = fmodf(d_acc, 1.0); - } - if(i < noutput_items) { // keep state for next entry - float ss = (int)(j / d_int_rate); // number of items to skip ahead by - count += ss; // we have fully consumed another input - j = j % d_int_rate; // roll filter around - } - } - - // Store the current filter position and start of next sample - d_last_filter = j; - d_start_index = std::max(0, count - ninput_items[0]); - - // consume all we've processed but no more than we can - consume_each(std::min(count, ninput_items[0])); - return i; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.h deleted file mode 100644 index d2e375210d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.h +++ /dev/null @@ -1,178 +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. - */ - - -#ifndef INCLUDED_GR_PFB_ARB_RESAMPLER_FFF_H -#define INCLUDED_GR_PFB_ARB_RESAMPLER_FFF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_pfb_arb_resampler_fff; -typedef boost::shared_ptr<gr_pfb_arb_resampler_fff> gr_pfb_arb_resampler_fff_sptr; -GR_CORE_API gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size=32); - -class gr_fir_fff; - -/*! - * \class gr_pfb_arb_resampler_fff - * - * \brief Polyphase filterbank arbitrary resampler with - * float input, float output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block takes in a signal stream and performs arbitrary - * resampling. The resampling rate can be any real - * number <EM>r</EM>. The resampling is done by constructing - * <EM>N</EM> filters where <EM>N</EM> is the interpolation rate. We - * then calculate <EM>D</EM> where <EM>D = floor(N/r)</EM>. - * - * Using <EM>N</EM> and <EM>D</EM>, we can perform rational resampling - * where <EM>N/D</EM> is a rational number close to the input rate - * <EM>r</EM> where we have <EM>N</EM> filters and we cycle through - * them as a polyphase filterbank with a stride of <EM>D</EM> so that - * <EM>i+1 = (i + D) % N</EM>. - * - * To get the arbitrary rate, we want to interpolate between two - * points. For each value out, we take an output from the current - * filter, <EM>i</EM>, and the next filter <EM>i+1</EM> and then - * linearly interpolate between the two based on the real resampling - * rate we want. - * - * The linear interpolation only provides us with an approximation to - * the real sampling rate specified. The error is a quantization error - * between the two filters we used as our interpolation points. To - * this end, the number of filters, <EM>N</EM>, used determines the - * quantization error; the larger <EM>N</EM>, the smaller the - * noise. You can design for a specified noise floor by setting the - * filter size (parameters <EM>filter_size</EM>). The size defaults to - * 32 filters, which is about as good as most implementations need. - * - * The trick with designing this filter is in how to specify the taps - * of the prototype filter. Like the PFB interpolator, the taps are - * specified using the interpolated filter rate. In this case, that - * rate is the input sample rate multiplied by the number of filters - * in the filterbank, which is also the interpolation rate. All other - * values should be relative to this rate. - * - * For example, for a 32-filter arbitrary resampler and using the - * GNU Radio's firdes utility to build the filter, we build a low-pass - * filter with a sampling rate of <EM>fs</EM>, a 3-dB bandwidth of - * <EM>BW</EM> and a transition bandwidth of <EM>TB</EM>. We can also - * specify the out-of-band attenuation to use, <EM>ATT</EM>, and the - * filter window function (a Blackman-harris window in this case). The - * first input is the gain of the filter, which we specify here as the - * interpolation rate (<EM>32</EM>). - * - * <B><EM>self._taps = gr.firdes.low_pass_2(32, 32*fs, BW, TB, - * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B> - * - * The theory behind this block can be found in Chapter 7.5 of - * the following book. - * - * <B><EM>f. harris, "Multirate Signal Processing for Communication - * Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> - */ - -class GR_CORE_API gr_pfb_arb_resampler_fff : public gr_block -{ - private: - /*! - * Build the polyphase filterbank arbitray resampler. - * \param rate (float) Specifies the resampling rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the filter_size sampling rate. - * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly - related to quantization noise introduced during the resampling. - Defaults to 32 filters. - */ - friend GR_CORE_API gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - 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; - unsigned int d_int_rate; // the number of filters (interpolation rate) - unsigned int d_dec_rate; // the stride through the filters (decimation rate) - float d_flt_rate; // residual rate for the linear interpolation - float d_acc; - unsigned int d_last_filter; - int d_start_index; - unsigned int d_taps_per_filter; - bool d_updated; - - /*! - * Build the polyphase filterbank arbitray resampler. - * \param rate (float) Specifies the resampling rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the filter_size sampling rate. - * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly - related to quantization noise introduced during the resampling. - Defaults to 32 filters. - */ - gr_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - void create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param newtaps (vector of floats) The prototype filter to populate the filterbank. - * The taps should be generated at the interpolated sampling rate. - * \param ourtaps (vector of floats) Reference to our internal member of holding the taps. - * \param ourfilter (vector of filters) Reference to our internal filter to set the taps for. - */ - void create_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_fff*> &ourfilter); - - -public: - ~gr_pfb_arb_resampler_fff (); - - // FIXME: See about a set_taps function during runtime. - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - void set_rate (float rate) { - d_dec_rate = (unsigned int)floor(d_int_rate/rate); - d_flt_rate = (d_int_rate/rate) - d_dec_rate; - set_relative_rate(rate); - } - - 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/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.i b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.i deleted file mode 100644 index ad09053610..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.i +++ /dev/null @@ -1,42 +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(gr,pfb_arb_resampler_fff); - -gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size=32); - -class gr_pfb_arb_resampler_fff : public gr_block -{ - private: - gr_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - public: - ~gr_pfb_arb_resampler_fff (); - - //void set_taps (const std::vector<float> &taps); - void print_taps(); - void set_rate (float rate); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc deleted file mode 100644 index a8cb849e27..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc +++ /dev/null @@ -1,240 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 <gr_pfb_channelizer_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <gri_fft.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <cstring> - -gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate) -{ - return gnuradio::get_initial_sptr(new gr_pfb_channelizer_ccf (numchans, taps, - oversample_rate)); -} - - -gr_pfb_channelizer_ccf::gr_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate) - : gr_block ("pfb_channelizer_ccf", - gr_make_io_signature (numchans, numchans, sizeof(gr_complex)), - gr_make_io_signature (1, numchans, sizeof(gr_complex))), - d_updated (false), d_numchans(numchans), d_oversample_rate(oversample_rate) -{ - // The over sampling rate must be rationally related to the number of channels - // in that it must be N/i for i in [1,N], which gives an outputsample rate - // of [fs/N, fs] where fs is the input sample rate. - // This tests the specified input sample rate to see if it conforms to this - // requirement within a few significant figures. - double intp = 0; - double fltp = modf(numchans / oversample_rate, &intp); - if(fltp != 0.0) - throw std::invalid_argument("gr_pfb_channelizer: oversample rate must be N/i for i in [1, N]"); - - set_relative_rate(1.0/intp); - - d_filters = std::vector<gr_fir_ccf*>(d_numchans); - d_channel_map.resize(d_numchans); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_numchans); - for(unsigned int i = 0; i < d_numchans; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - d_channel_map[i] = i; - } - - // Now, actually set the filters' taps - set_taps(taps); - - // Create the FFT to handle the output de-spinning of the channels - d_fft = new gri_fft_complex (d_numchans, false); - - // Although the filters change, we use this look up table - // to set the index of the FFT input buffer, which equivalently - // performs the FFT shift operation on every other turn. - d_rate_ratio = (int)rintf(d_numchans / d_oversample_rate); - d_idxlut = new int[d_numchans]; - for(unsigned int i = 0; i < d_numchans; i++) { - d_idxlut[i] = d_numchans - ((i + d_rate_ratio) % d_numchans) - 1; - } - - // Calculate the number of filtering rounds to do to evenly - // align the input vectors with the output channels - d_output_multiple = 1; - while((d_output_multiple * d_rate_ratio) % d_numchans != 0) - d_output_multiple++; - set_output_multiple(d_output_multiple); -} - -gr_pfb_channelizer_ccf::~gr_pfb_channelizer_ccf () -{ - delete d_fft; - delete [] d_idxlut; - - for(unsigned int i = 0; i < d_numchans; i++) { - delete d_filters[i]; - } -} - -void -gr_pfb_channelizer_ccf::set_taps (const std::vector<float> &taps) -{ - gruel::scoped_lock guard(d_mutex); - unsigned int i,j; - - unsigned int ntaps = taps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans); - - // Create d_numchan vectors to store each channel's taps - d_taps.resize(d_numchans); - - // 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 = taps; - while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_numchans; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - d_taps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - d_taps[i][j] = tmp_taps[i + j*d_numchans]; // add taps to channels in reverse order - } - - // Build a filter for each channel and add it's taps to it - d_filters[i]->set_taps(d_taps[i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter+1); - - d_updated = true; -} - -void -gr_pfb_channelizer_ccf::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_numchans; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n\n"); - } -} - -std::vector< std::vector<float> > -gr_pfb_channelizer_ccf::taps() const -{ - return d_taps; -} - -void -gr_pfb_channelizer_ccf::set_channel_map(const std::vector<int> &map) -{ - gruel::scoped_lock guard(d_mutex); - - if(map.size() > 0) { - unsigned int max = (unsigned int)*std::max_element(map.begin(), map.end()); - unsigned int min = (unsigned int)*std::min_element(map.begin(), map.end()); - if((max >= d_numchans) || (min < 0)) { - throw std::invalid_argument("gr_pfb_channelizer_ccf::set_channel_map: map range out of bounds.\n"); - } - d_channel_map = map; - } -} - -std::vector<int> -gr_pfb_channelizer_ccf::channel_map() const -{ - return d_channel_map; -} - - -int -gr_pfb_channelizer_ccf::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gruel::scoped_lock guard(d_mutex); - - gr_complex *in = (gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - size_t noutputs = output_items.size(); - - int n=1, i=-1, j=0, oo=0, last; - int toconsume = (int)rintf(noutput_items/d_oversample_rate); - while(n <= toconsume) { - j = 0; - i = (i + d_rate_ratio) % d_numchans; - last = i; - while(i >= 0) { - in = (gr_complex*)input_items[j]; - d_fft->get_inbuf()[d_idxlut[j]] = d_filters[i]->filter(&in[n]); - j++; - i--; - } - - i = d_numchans-1; - while(i > last) { - in = (gr_complex*)input_items[j]; - d_fft->get_inbuf()[d_idxlut[j]] = d_filters[i]->filter(&in[n-1]); - j++; - i--; - } - - n += (i+d_rate_ratio) >= (int)d_numchans; - - // despin through FFT - d_fft->execute(); - - // Send to output channels - for(unsigned int nn = 0; nn < noutputs; nn++) { - out = (gr_complex*)output_items[nn]; - out[oo] = d_fft->get_outbuf()[d_channel_map[nn]]; - } - oo++; - } - - consume_each(toconsume); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h deleted file mode 100644 index 79ad322f9a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 INCLUDED_GR_PFB_CHANNELIZER_CCF_H -#define INCLUDED_GR_PFB_CHANNELIZER_CCF_H - -#include <gr_core_api.h> -#include <gr_block.h> -#include <gruel/thread.h> - -class gr_pfb_channelizer_ccf; -typedef boost::shared_ptr<gr_pfb_channelizer_ccf> gr_pfb_channelizer_ccf_sptr; -GR_CORE_API gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate=1); - -class gr_fir_ccf; -class gri_fft_complex; - - -/*! - * \class gr_pfb_channelizer_ccf - * - * \brief Polyphase filterbank channelizer with - * gr_complex input, gr_complex output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block takes in complex inputs and channelizes it to <EM>M</EM> - * channels of equal bandwidth. Each of the resulting channels is - * decimated to the new rate that is the input sampling rate - * <EM>fs</EM> divided by the number of channels, <EM>M</EM>. - * - * The PFB channelizer code takes the taps generated above and builds - * a set of filters. The set contains <EM>M</EM> number of filters - * and each filter contains ceil(taps.size()/decim) number of taps. - * Each tap from the filter prototype is sequentially inserted into - * the next filter. When all of the input taps are used, the remaining - * filters in the filterbank are filled out with 0's to make sure each - * filter has the same number of taps. - * - * Each filter operates using the gr_fir filter classs of GNU Radio, - * which takes the input stream at <EM>i</EM> and performs the inner - * product calculation to <EM>i+(n-1)</EM> where <EM>n</EM> is the - * number of filter taps. To efficiently handle this in the GNU Radio - * structure, each filter input must come from its own input - * stream. So the channelizer must be provided with <EM>M</EM> streams - * where the input stream has been deinterleaved. This is most easily - * done using the gr_stream_to_streams block. - * - * The output is then produced as a vector, where index <EM>i</EM> in - * the vector is the next sample from the <EM>i</EM>th channel. This - * is most easily handled by sending the output to a - * gr_vector_to_streams block to handle the conversion and passing - * <EM>M</EM> streams out. - * - * The input and output formatting is done using a hier_block2 called - * pfb_channelizer_ccf. This can take in a single stream and outputs - * <EM>M</EM> streams based on the behavior described above. - * - * The filter's taps should be based on the input sampling rate. - * - * For example, using the GNU Radio's firdes utility to building - * filters, we build a low-pass filter with a sampling rate of - * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition - * bandwidth of <EM>TB</EM>. We can also specify the out-of-band - * attenuation to use, <EM>ATT</EM>, and the filter window - * function (a Blackman-harris window in this case). The first input - * is the gain of the filter, which we specify here as unity. - * - * <B><EM>self._taps = gr.firdes.low_pass_2(1, fs, BW, TB, - * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B> - * - * The filter output can also be overs ampled. The over sampling rate - * is the ratio of the the actual output sampling rate to the normal - * output sampling rate. It must be rationally related to the number - * of channels as N/i for i in [1,N], which gives an outputsample rate - * of [fs/N, fs] where fs is the input sample rate and N is the number - * of channels. - * - * For example, for 6 channels with fs = 6000 Hz, the normal rate is - * 6000/6 = 1000 Hz. Allowable oversampling rates are 6/6, 6/5, 6/4, - * 6/3, 6/2, and 6/1 where the output sample rate of a 6/1 oversample - * ratio is 6000 Hz, or 6 times the normal 1000 Hz. A rate of 6/5 = 1.2, - * so the output rate would be 1200 Hz. - * - * The theory behind this block can be found in Chapter 6 of - * the following book. - * - * <B><EM>f. harris, "Multirate Signal Processing for Communication - * Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> - * - */ - -class GR_CORE_API gr_pfb_channelizer_ccf : public gr_block -{ - private: - /*! - * Build the polyphase filterbank decimator. - * \param numchans (unsigned integer) Specifies the number of channels <EM>M</EM> - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - * \param oversample_rate (float) The over sampling rate is the ratio of the the actual - * output sampling rate to the normal output sampling rate. - * It must be rationally related to the number of channels - * as N/i for i in [1,N], which gives an outputsample rate - * of [fs/N, fs] where fs is the input sample rate and N is - * the number of channels. - * - * For example, for 6 channels with fs = 6000 Hz, the normal - * rate is 6000/6 = 1000 Hz. Allowable oversampling rates - * are 6/6, 6/5, 6/4, 6/3, 6/2, and 6/1 where the output - * sample rate of a 6/1 oversample ratio is 6000 Hz, or - * 6 times the normal 1000 Hz. - */ - friend GR_CORE_API gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate); - - bool d_updated; - unsigned int d_numchans; - float d_oversample_rate; - std::vector<gr_fir_ccf*> d_filters; - std::vector< std::vector<float> > d_taps; - unsigned int d_taps_per_filter; - gri_fft_complex *d_fft; - int *d_idxlut; - int d_rate_ratio; - int d_output_multiple; - std::vector<int> d_channel_map; - gruel::mutex d_mutex; // mutex to protect set/work access - - /*! - * Build the polyphase filterbank decimator. - * \param numchans (unsigned integer) Specifies the number of channels <EM>M</EM> - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - * \param oversample_rate (float) The output over sampling rate. - */ - gr_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate); - -public: - ~gr_pfb_channelizer_ccf (); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - */ - void set_taps (const std::vector<float> &taps); - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - - /*! - * Return a vector<vector<>> of the filterbank taps - */ - std::vector<std::vector<float> > taps() const; - - /*! - * Set the channel map. Channels are numbers as: - * - * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2 - * <------------------- 0 --------------------> - * freq - * - * So output stream 0 comes from channel 0, etc. Setting a new - * channel map allows the user to specify which channel in frequency - * he/she wants to got to which output stream. - * - * The map should have the same number of elements as the number of - * output connections from the block. The minimum value of the map - * is 0 (for the 0th channel) and the maximum number is N-1 where N - * is the number of channels. - * - * We specify M as the number of output connections made where M <= - * N, so only M out of N channels are driven to an output - * stream. The number of items in the channel map should be at least - * M long. If there are more channels specified, any value in the - * map over M-1 will be ignored. If the size of the map is less than - * M the behavior is unknown (we don't wish to check every entry - * into the work function). - * - * This means that if the channelizer is splitting the signal up - * into N channels but only M channels are specified in the map - * (where M <= N), then M output streams must be connected and the - * map and the channel numbers used must be less than N-1. Output - * channel number can be reused, too. By default, the map is - * [0...M-1] with M = N. - */ - void set_channel_map(const std::vector<int> &map); - - /*! - * Gets the current channel map. - */ - std::vector<int> channel_map() const; - - 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/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i deleted file mode 100644 index 1f2b49452f..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pfb_channelizer_ccf); - -gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate=1); - -class gr_pfb_channelizer_ccf : public gr_block -{ - private: - gr_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate); - - public: - ~gr_pfb_channelizer_ccf (); - - void set_taps (const std::vector<float> &taps); - void print_taps(); - std::vector<std::vector<float> > taps() const; - - void set_channel_map(const std::vector<int> &map); - std::vector<int> channel_map() const; -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc deleted file mode 100644 index efe417918a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc +++ /dev/null @@ -1,441 +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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <cstdio> -#include <cmath> - -#include <gr_pfb_clock_sync_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <gr_math.h> - -gr_pfb_clock_sync_ccf_sptr gr_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 gr_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)); -gr_pfb_clock_sync_ccf::gr_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); -} - -gr_pfb_clock_sync_ccf::~gr_pfb_clock_sync_ccf () -{ - for(int i = 0; i < d_nfilters; i++) { - delete d_filters[i]; - delete d_diff_filters[i]; - } -} - -bool -gr_pfb_clock_sync_ccf::check_topology(int ninputs, int noutputs) -{ - return noutputs == 1 || noutputs == 4; -} - - - -/******************************************************************* - SET FUNCTIONS -*******************************************************************/ - - -void -gr_pfb_clock_sync_ccf::set_loop_bandwidth(float bw) -{ - if(bw < 0) { - throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid bandwidth. Must be >= 0."); - } - - d_loop_bw = bw; - update_gains(); -} - -void -gr_pfb_clock_sync_ccf::set_damping_factor(float df) -{ - if(df < 0 || df > 1.0) { - throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid damping factor. Must be in [0,1]."); - } - - d_damping = df; - update_gains(); -} - -void -gr_pfb_clock_sync_ccf::set_alpha(float alpha) -{ - if(alpha < 0 || alpha > 1.0) { - throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid alpha. Must be in [0,1]."); - } - d_alpha = alpha; -} - -void -gr_pfb_clock_sync_ccf::set_beta(float beta) -{ - if(beta < 0 || beta > 1.0) { - throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid beta. Must be in [0,1]."); - } - d_beta = beta; -} - -/******************************************************************* - GET FUNCTIONS -*******************************************************************/ - - -float -gr_pfb_clock_sync_ccf::get_loop_bandwidth() const -{ - return d_loop_bw; -} - -float -gr_pfb_clock_sync_ccf::get_damping_factor() const -{ - return d_damping; -} - -float -gr_pfb_clock_sync_ccf::get_alpha() const -{ - return d_alpha; -} - -float -gr_pfb_clock_sync_ccf::get_beta() const -{ - return d_beta; -} - -float -gr_pfb_clock_sync_ccf::get_clock_rate() const -{ - return d_rate_f; -} - -/******************************************************************* -*******************************************************************/ - -void -gr_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 -gr_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[d_nfilters-1-i] = std::vector<float>(d_taps_per_filter, 0); - ourtaps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - //ourtaps[d_nfilters - 1 - i][j] = tmp_taps[i + j*d_nfilters]; - 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[d_nfilters-1-i]); - 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 -gr_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 -gr_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 -gr_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> > -gr_pfb_clock_sync_ccf::get_taps() -{ - return d_taps; -} - -std::vector< std::vector<float> > -gr_pfb_clock_sync_ccf::get_diff_taps() -{ - return d_dtaps; -} - -std::vector<float> -gr_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> -gr_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 -gr_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/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h deleted file mode 100644 index 8715b4b106..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h +++ /dev/null @@ -1,375 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 INCLUDED_GR_PFB_CLOCK_SYNC_CCF_H -#define INCLUDED_GR_PFB_CLOCK_SYNC_CCF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_pfb_clock_sync_ccf; -typedef boost::shared_ptr<gr_pfb_clock_sync_ccf> gr_pfb_clock_sync_ccf_sptr; -GR_CORE_API gr_pfb_clock_sync_ccf_sptr gr_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 gr_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 GR_CORE_API gr_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 GR_CORE_API gr_pfb_clock_sync_ccf_sptr gr_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. - */ - gr_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: - ~gr_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/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i deleted file mode 100644 index 85915196f8..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i +++ /dev/null @@ -1,67 +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(gr,pfb_clock_sync_ccf); - -gr_pfb_clock_sync_ccf_sptr gr_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_pfb_clock_sync_ccf : public gr_block -{ - private: - gr_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); - - public: - ~gr_pfb_clock_sync_ccf (); - - 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/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.cc b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.cc deleted file mode 100644 index 886f989130..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.cc +++ /dev/null @@ -1,288 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 <cstdio> -#include <cmath> - -#include <gr_pfb_clock_sync_fff.h> -#include <gr_fir_fff.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <gr_math.h> - -gr_pfb_clock_sync_fff_sptr gr_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) -{ - return gnuradio::get_initial_sptr(new gr_pfb_clock_sync_fff (sps, gain, taps, - filter_size, - init_phase, - max_rate_deviation)); -} - -static int ios[] = {sizeof(float), sizeof(float), sizeof(float), sizeof(float)}; -static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); -gr_pfb_clock_sync_fff::gr_pfb_clock_sync_fff (double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation) - : 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_nfilters = filter_size; - d_sps = floor(sps); - - // 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 - set_alpha(gain); - set_beta(0.25*gain*gain); - 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); -} - -gr_pfb_clock_sync_fff::~gr_pfb_clock_sync_fff () -{ - for(int i = 0; i < d_nfilters; i++) { - delete d_filters[i]; - delete d_diff_filters[i]; - } -} - -bool -gr_pfb_clock_sync_fff::check_topology(int ninputs, int noutputs) -{ - return noutputs == 1 || noutputs == 4; -} - -void -gr_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[d_nfilters-1-i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - ourtaps[d_nfilters - 1 - 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[d_nfilters-1-i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter + d_sps); - - d_updated = true; -} - -void -gr_pfb_clock_sync_fff::create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps) -{ - float maxtap = 1e-20; - difftaps.clear(); - difftaps.push_back(0); //newtaps[0]); - for(unsigned int i = 1; i < newtaps.size()-1; i++) { - float tap = newtaps[i+1] - newtaps[i-1]; - difftaps.push_back(tap); - if(tap > maxtap) { - maxtap = tap; - } - } - difftaps.push_back(0);//-newtaps[newtaps.size()-1]); - - // Scale the differential taps; helps scale error term to better update state - // FIXME: should this be scaled this way or use the same gain as the taps? - for(unsigned int i = 0; i < difftaps.size(); i++) { - difftaps[i] /= maxtap; - } -} - -void -gr_pfb_clock_sync_fff::print_taps() -{ - int i, j; - printf("[ "); - for(i = 0; i < d_nfilters; i++) { - printf("[%.4e, ", d_taps[i][0]); - for(j = 1; j < d_taps_per_filter-1; j++) { - printf("%.4e,", d_taps[i][j]); - } - printf("%.4e],", d_taps[i][j]); - } - printf(" ]\n"); -} - -void -gr_pfb_clock_sync_fff::print_diff_taps() -{ - int i, j; - printf("[ "); - for(i = 0; i < d_nfilters; i++) { - printf("[%.4e, ", d_dtaps[i][0]); - for(j = 1; j < d_taps_per_filter-1; j++) { - printf("%.4e,", d_dtaps[i][j]); - } - printf("%.4e],", d_dtaps[i][j]); - } - printf(" ]\n"); -} - - -std::vector<float> -gr_pfb_clock_sync_fff::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> -gr_pfb_clock_sync_fff::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 -gr_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 = 0, *outrate = 0, *outk = 0; - 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; - - int i = 0, count = 0; - float error; - - // produce output as long as we can and there are enough input samples - while((i < noutput_items) && (count < nrequired)) { - 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_filters[d_filtnum]->filter(&in[count]); - float diff = d_diff_filters[d_filtnum]->filter(&in[count]); - error = out[i] * diff; - - // Run the control loop to update the current phase (k) and tracking rate - d_k = d_k + d_alpha*error + d_rate_i + d_rate_f; - d_rate_f = d_rate_f + d_beta*error; - - // Keep our rate within a good range - d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev); - - i++; - count += (int)floor(d_sps); - - if(output_items.size() == 4) { - err[i] = error; - outrate[i] = d_rate_f; - outk[i] = d_k; - } - } - consume_each(count); - - return i; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h deleted file mode 100644 index 4909d556b9..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h +++ /dev/null @@ -1,266 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 INCLUDED_GR_PFB_CLOCK_SYNC_FFF_H -#define INCLUDED_GR_PFB_CLOCK_SYNC_FFF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_pfb_clock_sync_fff; -typedef boost::shared_ptr<gr_pfb_clock_sync_fff> gr_pfb_clock_sync_fff_sptr; -GR_CORE_API gr_pfb_clock_sync_fff_sptr gr_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); - -class gr_fir_fff; - -/*! - * \class gr_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: note that unlike the ccf version of this algorithm, - * this block does \a not have a setting for the number of output - * samples per symbol. This is mostly because it should not be - * necessary as the reason for having multiple output sps is to - * perform equalization and the equalizers will take in complex - * numbers in order to do magnitude and phase correction. - */ - -class GR_CORE_API gr_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). - * - */ - friend GR_CORE_API gr_pfb_clock_sync_fff_sptr gr_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); - - bool d_updated; - double d_sps; - double d_sample_num; - float d_alpha; - float d_beta; - int d_nfilters; - 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_taps_per_filter; - - /*! - * Build the polyphase filterbank timing synchronizer. - */ - gr_pfb_clock_sync_fff (double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation); - - void create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps); - -public: - ~gr_pfb_clock_sync_fff (); - - /*! - * 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 the taps of the matched filter - */ - std::vector<float> channel_taps(int channel); - - /*! - * Returns the taps in the derivative filter - */ - std::vector<float> diff_channel_taps(int channel); - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - - /*! - * Print all of the filterbank taps of the derivative filter to screen. - */ - void print_diff_taps(); - - /*! - * Set the gain value alpha for the control loop - */ - void set_alpha(float alpha) - { - d_alpha = alpha; - } - - /*! - * Set the gain value beta for the control loop - */ - void set_beta(float beta) - { - d_beta = beta; - } - - /*! - * Set the maximum deviation from 0 d_rate can have - */ - void set_max_rate_deviation(float m) - { - d_max_dev = m; - } - - 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/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.i b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.i deleted file mode 100644 index 754af1a87f..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.i +++ /dev/null @@ -1,54 +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(gr,pfb_clock_sync_fff); - -gr_pfb_clock_sync_fff_sptr gr_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); - -class gr_pfb_clock_sync_fff : public gr_block -{ - private: - gr_pfb_clock_sync_fff (double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation); - - public: - ~gr_pfb_clock_sync_fff (); - - void set_taps (const std::vector<float> &taps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_fff*> &ourfilter); - - std::vector<float> channel_taps(int channel); - std::vector<float> diff_channel_taps(int channel); - void print_taps(); - void print_diff_taps(); - void set_alpha(float alpha); - void set_beta(float beta); - void set_max_rate_deviation(float m); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc deleted file mode 100644 index e563daa513..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 <gr_pfb_decimator_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <gri_fft.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <cstdio> - -gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel) -{ - return gnuradio::get_initial_sptr(new gr_pfb_decimator_ccf (decim, taps, channel)); -} - - -gr_pfb_decimator_ccf::gr_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel) - : gr_sync_block ("pfb_decimator_ccf", - gr_make_io_signature (decim, decim, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex))), - d_updated (false) -{ - d_rate = decim; - d_filters = std::vector<gr_fir_ccf*>(d_rate); - d_chan = channel; - d_rotator = new gr_complex[d_rate]; - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_rate); - for(unsigned int i = 0; i < d_rate; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - d_rotator[i] = gr_expj(i*2*M_PI*d_chan/d_rate); - } - - // Now, actually set the filters' taps - set_taps(taps); - - // Create the FFT to handle the output de-spinning of the channels - d_fft = new gri_fft_complex (d_rate, false); -} - -gr_pfb_decimator_ccf::~gr_pfb_decimator_ccf () -{ - delete d_fft; - for(unsigned int i = 0; i < d_rate; i++) { - delete d_filters[i]; - } -} - -void -gr_pfb_decimator_ccf::set_taps (const std::vector<float> &taps) -{ - unsigned int i,j; - - unsigned int ntaps = taps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_rate); - - // Create d_numchan vectors to store each channel's taps - d_taps.resize(d_rate); - - // 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 = taps; - while((float)(tmp_taps.size()) < d_rate*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_rate; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - d_taps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - d_taps[i][j] = tmp_taps[i + j*d_rate]; // add taps to channels in reverse order - } - - // Build a filter for each channel and add it's taps to it - d_filters[i]->set_taps(d_taps[i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter); - - d_updated = true; -} - -void -gr_pfb_decimator_ccf::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_rate; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n\n"); - } -} - -#define ROTATEFFT - -int -gr_pfb_decimator_ccf::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in; - gr_complex *out = (gr_complex *) output_items[0]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - int i; - for(i = 0; i < noutput_items; i++) { - // Move through filters from bottom to top - out[i] = 0; - for(int j = d_rate-1; j >= 0; j--) { - // Take in the items from the first input stream to d_rate - in = (gr_complex*)input_items[d_rate - 1 - j]; - - // Filter current input stream from bottom filter to top - // The rotate them by expj(j*k*2pi/M) where M is the number of filters - // (the decimation rate) and k is the channel number to extract - - // This is the real math that goes on; we abuse the FFT to do this quickly - // for decimation rates > N where N is a small number (~5): - // out[i] += d_filters[j]->filter(&in[i])*gr_expj(j*d_chan*2*M_PI/d_rate); -#ifdef ROTATEFFT - d_fft->get_inbuf()[j] = d_filters[j]->filter(&in[i]); -#else - out[i] += d_filters[j]->filter(&in[i])*d_rotator[i]; -#endif - } - -#ifdef ROTATEFFT - // Perform the FFT to do the complex multiply despinning for all channels - d_fft->execute(); - - // Select only the desired channel out - out[i] = d_fft->get_outbuf()[d_chan]; -#endif - - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h deleted file mode 100644 index a2b347ae24..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h +++ /dev/null @@ -1,150 +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_GR_PFB_DECIMATOR_CCF_H -#define INCLUDED_GR_PFB_DECIMATOR_CCF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_pfb_decimator_ccf; -typedef boost::shared_ptr<gr_pfb_decimator_ccf> gr_pfb_decimator_ccf_sptr; -GR_CORE_API gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel=0); - -class gr_fir_ccf; -class gri_fft_complex; - -/*! - * \class gr_pfb_decimator_ccf - * \brief Polyphase filterbank bandpass decimator with gr_complex - * input, gr_complex output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block takes in a signal stream and performs interger down- - * sampling (decimation) with a polyphase filterbank. The first input - * is the integer specifying how much to decimate by. The second - * input is a vector (Python list) of floating-point taps of the - * prototype filter. The third input specifies the channel to extract. - * By default, the zeroth channel is used, which is the baseband - * channel (first Nyquist zone). - * - * The <EM>channel</EM> parameter specifies which channel to use since - * this class is capable of bandpass decimation. Given a complex input - * stream at a sampling rate of <EM>fs</EM> and a decimation rate of - * <EM>decim</EM>, the input frequency domain is split into - * <EM>decim</EM> channels that represent the Nyquist zones. Using the - * polyphase filterbank, we can select any one of these channels to - * decimate. - * - * The output signal will be the basebanded and decimated signal from - * that channel. This concept is very similar to the PFB channelizer - * (see #gr_pfb_channelizer_ccf) where only a single channel is - * extracted at a time. - * - * The filter's taps should be based on the sampling rate before - * decimation. - * - * For example, using the GNU Radio's firdes utility to building - * filters, we build a low-pass filter with a sampling rate of - * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition - * bandwidth of <EM>TB</EM>. We can also specify the out-of-band - * attenuation to use, <EM>ATT</EM>, and the filter window - * function (a Blackman-harris window in this case). The first input - * is the gain of the filter, which we specify here as unity. - * - * <B><EM>self._taps = gr.firdes.low_pass_2(1, fs, BW, TB, - * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B> - * - * The PFB decimator code takes the taps generated above and builds a - * set of filters. The set contains <EM>decim</EM> number of filters - * and each filter contains ceil(taps.size()/decim) number of taps. - * Each tap from the filter prototype is sequentially inserted into - * the next filter. When all of the input taps are used, the remaining - * filters in the filterbank are filled out with 0's to make sure each - * filter has the same number of taps. - * - * The theory behind this block can be found in Chapter 6 of - * the following book. - * - * <B><EM>f. harris, "Multirate Signal Processing for Communication - * Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> - */ - -class GR_CORE_API gr_pfb_decimator_ccf : public gr_sync_block -{ - private: - /*! - * Build the polyphase filterbank decimator. - * \param decim (unsigned integer) Specifies the decimation rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - * \param channel (unsigned integer) Selects the channel to return [default=0]. - */ - friend GR_CORE_API gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel); - - std::vector<gr_fir_ccf*> d_filters; - std::vector< std::vector<float> > d_taps; - gri_fft_complex *d_fft; - unsigned int d_rate; - unsigned int d_chan; - unsigned int d_taps_per_filter; - bool d_updated; - gr_complex *d_rotator; - - /*! - * Build the polyphase filterbank decimator. - * \param decim (unsigned integer) Specifies the decimation rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - * \param channel (unsigned integer) Selects the channel to return [default=0]. - */ - gr_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel); - -public: - ~gr_pfb_decimator_ccf (); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - */ - void set_taps (const std::vector<float> &taps); - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - - //void set_channel (unsigned int channel); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i deleted file mode 100644 index e40d00fa9d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i +++ /dev/null @@ -1,41 +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(gr,pfb_decimator_ccf); - -gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel); - -class gr_pfb_decimator_ccf : public gr_sync_block -{ - private: - gr_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel); - - public: - ~gr_pfb_decimator_ccf (); - - void set_taps (const std::vector<float> &taps); - //void set_channel (unsigned int channel); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc deleted file mode 100644 index 9c8e734ea9..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 <gr_pfb_interpolator_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <cstdio> - -gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps) -{ - return gnuradio::get_initial_sptr(new gr_pfb_interpolator_ccf (interp, taps)); -} - - -gr_pfb_interpolator_ccf::gr_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps) - : gr_sync_interpolator ("pfb_interpolator_ccf", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - interp), - d_updated (false) -{ - d_rate = interp; - d_filters = std::vector<gr_fir_ccf*>(d_rate); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_rate); - for(unsigned int i = 0; i < d_rate; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - } - - // Now, actually set the filters' taps - set_taps(taps); -} - -gr_pfb_interpolator_ccf::~gr_pfb_interpolator_ccf () -{ - for(unsigned int i = 0; i < d_rate; i++) { - delete d_filters[i]; - } -} - -void -gr_pfb_interpolator_ccf::set_taps (const std::vector<float> &taps) -{ - unsigned int i,j; - - unsigned int ntaps = taps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_rate); - - // Create d_numchan vectors to store each channel's taps - //std::vector< std::vector<float> > vtaps(d_rate); - d_taps.resize(d_rate); - - // 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 = taps; - while((float)(tmp_taps.size()) < d_rate*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_rate; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - d_taps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - d_taps[i][j] = tmp_taps[i + j*d_rate]; // add taps to channels in reverse order - } - - // Build a filter for each channel and add it's taps to it - d_filters[i]->set_taps(d_taps[i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter); - - d_updated = true; -} - -void -gr_pfb_interpolator_ccf::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_rate; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n\n"); - } -} - -int -gr_pfb_interpolator_ccf::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]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - int i = 0, count = 0; - - while(i < noutput_items) { - for(unsigned int j = 0; j < d_rate; j++) { - out[i] = d_filters[j]->filter(&in[count]); - i++; - } - count++; - } - - return i; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h deleted file mode 100644 index aeae86e408..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h +++ /dev/null @@ -1,131 +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_GR_PFB_INTERPOLATOR_CCF_H -#define INCLUDED_GR_PFB_INTERPOLATOR_CCF_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_pfb_interpolator_ccf; -typedef boost::shared_ptr<gr_pfb_interpolator_ccf> gr_pfb_interpolator_ccf_sptr; -GR_CORE_API gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps); - -class gr_fir_ccf; - -/*! - * \class gr_pfb_interpolator_ccf - * \brief Polyphase filterbank interpolator with gr_complex input, - * gr_complex output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block takes in a signal stream and performs interger up- - * sampling (interpolation) with a polyphase filterbank. The first - * input is the integer specifying how much to interpolate by. The - * second input is a vector (Python list) of floating-point taps of - * the prototype filter. - * - * The filter's taps should be based on the interpolation rate - * specified. That is, the bandwidth specified is relative to the - * bandwidth after interpolation. - * - * For example, using the GNU Radio's firdes utility to building - * filters, we build a low-pass filter with a sampling rate of - * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition - * bandwidth of <EM>TB</EM>. We can also specify the out-of-band - * attenuation to use, ATT, and the filter window function (a - * Blackman-harris window in this case). The first input is the gain, - * which is also specified as the interpolation rate so that the - * output levels are the same as the input (this creates an overall - * increase in power). - * - * <B><EM>self._taps = gr.firdes.low_pass_2(interp, interp*fs, BW, TB, - * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B> - * - * The PFB interpolator code takes the taps generated above and builds - * a set of filters. The set contains <EM>interp</EM> number of - * filters and each filter contains ceil(taps.size()/interp) number of - * taps. Each tap from the filter prototype is sequentially inserted - * into the next filter. When all of the input taps are used, the - * remaining filters in the filterbank are filled out with 0's to make - * sure each filter has the same number of taps. - * - * The theory behind this block can be found in Chapter 7.1 of the - * following book. - * - * <B><EM>f. harris, "Multirate Signal Processing for Communication - * Systems</EM>," Upper Saddle River, NJ: Prentice Hall, - * Inc. 2004.</EM></B> - */ - -class GR_CORE_API gr_pfb_interpolator_ccf : public gr_sync_interpolator -{ - private: - /*! - * Build the polyphase filterbank interpolator. - * \param interp (unsigned integer) Specifies the interpolation rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the interpolated sampling rate. - */ - friend GR_CORE_API gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps); - - std::vector<gr_fir_ccf*> d_filters; - std::vector< std::vector<float> > d_taps; - unsigned int d_rate; - unsigned int d_taps_per_filter; - bool d_updated; - - /*! - * Construct a Polyphase filterbank interpolator - * \param interp (unsigned integer) Specifies the interpolation rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the interpolated sampling rate. - */ - gr_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps); - -public: - ~gr_pfb_interpolator_ccf (); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the interpolated sampling rate. - */ - void set_taps (const std::vector<float> &taps); - - /*! - * Print all of the filterbank 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/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i deleted file mode 100644 index 427f1b913d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i +++ /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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pfb_interpolator_ccf); - -gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps); - -class gr_pfb_interpolator_ccf : public gr_sync_interpolator -{ - private: - gr_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps); - - public: - ~gr_pfb_interpolator_ccf (); - - void set_taps (const std::vector<float> &taps); - void print_taps(); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.cc deleted file mode 100644 index cd01aaff5c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.cc +++ /dev/null @@ -1,287 +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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pfb_synthesizer_ccf.h> -#include <gri_fft.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <cstring> - -gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf - (unsigned int numchans, const std::vector<float> &taps, bool twox) -{ - return gr_pfb_synthesizer_ccf_sptr - (new gr_pfb_synthesizer_ccf (numchans, taps, twox)); -} - - -gr_pfb_synthesizer_ccf::gr_pfb_synthesizer_ccf - (unsigned int numchans, const std::vector<float> &taps, bool twox) - : gr_sync_interpolator ("pfb_synthesizer_ccf", - gr_make_io_signature (1, numchans, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - numchans), - d_updated (false), d_numchans(numchans), d_state(0) -{ - // set up 2x multiplier; if twox==True, set to 2, otherwise to 1 - d_twox = (twox ? 2 : 1); - if(d_numchans % d_twox != 0) { - throw std::invalid_argument("gr_pfb_synthesizer_ccf: number of channels must be even for 2x oversampling.\n"); - } - - d_filters = std::vector<gri_fir_filter_with_buffer_ccf*>(d_twox*d_numchans); - d_channel_map.resize(d_twox*d_numchans); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_twox*d_numchans); - for(unsigned int i = 0; i < d_twox*d_numchans; i++) { - d_filters[i] = new gri_fir_filter_with_buffer_ccf(vtaps); - d_channel_map[i] = i; - } - - // Now, actually set the filters' taps - set_taps(taps); - - // Create the IFFT to handle the input channel rotations - d_fft = new gri_fft_complex (d_twox*d_numchans, false); - memset(d_fft->get_inbuf(), 0, d_twox*d_numchans*sizeof(gr_complex)); - - set_output_multiple(d_numchans); -} - -gr_pfb_synthesizer_ccf::~gr_pfb_synthesizer_ccf () -{ - delete d_fft; - for(unsigned int i = 0; i < d_twox*d_numchans; i++) { - delete d_filters[i]; - } -} - -void -gr_pfb_synthesizer_ccf::set_taps(const std::vector<float> &taps) -{ - gruel::scoped_lock guard(d_mutex); - if(d_twox == 1) - set_taps1(taps); - else - set_taps2(taps); -} - -void -gr_pfb_synthesizer_ccf::set_taps1(const std::vector<float> &taps) -{ - unsigned int i,j; - - unsigned int ntaps = taps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans); - - // Create d_numchan vectors to store each channel's taps - d_taps.resize(d_numchans); - - // 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 = taps; - while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_numchans; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - d_taps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - d_taps[i][j] = tmp_taps[i + j*d_numchans]; // add taps to channels in reverse order - } - - // Build a filter for each channel and add it's taps to it - d_filters[i]->set_taps(d_taps[i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter+1); - - d_updated = true; -} - -void -gr_pfb_synthesizer_ccf::set_taps2 (const std::vector<float> &taps) -{ - unsigned int i,j; - int state = 0; - - unsigned int ntaps = taps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans); - - // Create d_numchan vectors to store each channel's taps - d_taps.resize(d_twox*d_numchans); - - // 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 = taps; - while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_numchans; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - d_taps[i] = std::vector<float>(d_taps_per_filter, 0); - d_taps[d_numchans+i] = std::vector<float>(d_taps_per_filter, 0); - state = 0; - for(j = 0; j < d_taps_per_filter; j++) { - // add taps to channels in reverse order - // Zero out every other tap - if(state == 0) { - d_taps[i][j] = tmp_taps[i + j*d_numchans]; - d_taps[d_numchans + i][j] = 0; - state = 1; - } - else { - d_taps[i][j] = 0; - d_taps[d_numchans + i][j] = tmp_taps[i + j*d_numchans]; - state = 0; - } - } - - // Build a filter for each channel and add it's taps to it - d_filters[i]->set_taps(d_taps[i]); - d_filters[d_numchans + i]->set_taps(d_taps[d_numchans + i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter+1); - - d_updated = true; -} - -void -gr_pfb_synthesizer_ccf::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_twox*d_numchans; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n\n"); - } -} - - -std::vector< std::vector<float> > -gr_pfb_synthesizer_ccf::taps() const -{ - return d_taps; -} - -void -gr_pfb_synthesizer_ccf::set_channel_map(const std::vector<int> &map) -{ - gruel::scoped_lock guard(d_mutex); - - if(map.size() > 0) { - unsigned int max = (unsigned int)*std::max_element(map.begin(), map.end()); - unsigned int min = (unsigned int)*std::min_element(map.begin(), map.end()); - if((max >= d_twox*d_numchans) || (min < 0)) { - throw std::invalid_argument("gr_pfb_synthesizer_ccf::set_channel_map: map range out of bounds.\n"); - } - d_channel_map = map; - - // Zero out fft buffer so that unused channels are always 0 - memset(d_fft->get_inbuf(), 0,d_twox*d_numchans*sizeof(gr_complex)); - } -} - -std::vector<int> -gr_pfb_synthesizer_ccf::channel_map() const -{ - return d_channel_map; -} - -int -gr_pfb_synthesizer_ccf::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gruel::scoped_lock guard(d_mutex); - - gr_complex *in = (gr_complex*) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - unsigned int n, i; - size_t ninputs = input_items.size(); - - // Algoritm for critically sampled channels - if(d_twox == 1) { - for(n = 0; n < noutput_items/d_numchans; n++) { - for(i = 0; i < ninputs; i++) { - in = (gr_complex*)input_items[i]; - d_fft->get_inbuf()[d_channel_map[i]] = in[n]; - } - - // spin through IFFT - d_fft->execute(); - - for(i = 0; i < d_numchans; i++) { - out[i] = d_filters[i]->filter(d_fft->get_outbuf()[i]); - } - out += d_numchans; - } - } - - // Algorithm for oversampling by 2x - else { - for(n = 0; n < noutput_items/d_numchans; n++) { - for(i = 0; i < ninputs; i++) { - in = (gr_complex*)input_items[i]; - d_fft->get_inbuf()[d_channel_map[i]] = in[n]; - } - - // spin through IFFT - d_fft->execute(); - - // Output is sum of two filters, but the input buffer to the filters must be circularly - // shifted by numchans every time through, done by using d_state to determine which IFFT - // buffer position to pull from. - for(i = 0; i < d_numchans; i++) { - out[i] = d_filters[i]->filter(d_fft->get_outbuf()[d_state*d_numchans+i]); - out[i] += d_filters[d_numchans+i]->filter(d_fft->get_outbuf()[(d_state^1)*d_numchans+i]); - } - d_state ^= 1; - - out += d_numchans; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.h deleted file mode 100644 index 9e4f85497d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.h +++ /dev/null @@ -1,147 +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. - */ - - -#ifndef INCLUDED_GR_PFB_SYNTHESIZER_CCF_H -#define INCLUDED_GR_PFB_SYNTHESIZER_CCF_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> -#include <gri_fir_filter_with_buffer_ccf.h> -#include <gruel/thread.h> - -class gr_pfb_synthesizer_ccf; -typedef boost::shared_ptr<gr_pfb_synthesizer_ccf> gr_pfb_synthesizer_ccf_sptr; -GR_CORE_API gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf - (unsigned int numchans, const std::vector<float> &taps, bool twox=false); - -class gri_fft_complex; - - -/*! - * \class gr_pfb_synthesizer_ccf - * - * \brief Polyphase synthesis filterbank with - * gr_complex input, gr_complex output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - */ - -class GR_CORE_API gr_pfb_synthesizer_ccf : public gr_sync_interpolator -{ - private: - /*! - * Build the polyphase synthesis filterbank. - * \param numchans (unsigned integer) Specifies the number of - channels <EM>M</EM> - * \param taps (vector/list of floats) The prototype filter to - populate the filterbank. - * \param twox (bool) use 2x oversampling or not (default is no) - */ - friend GR_CORE_API gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf - (unsigned int numchans, const std::vector<float> &taps, bool twox); - - bool d_updated; - unsigned int d_numchans; - unsigned int d_taps_per_filter; - gri_fft_complex *d_fft; - std::vector< gri_fir_filter_with_buffer_ccf*> d_filters; - std::vector< std::vector<float> > d_taps; - int d_state; - std::vector<int> d_channel_map; - unsigned int d_twox; - gruel::mutex d_mutex; // mutex to protect set/work access - - /*! - * \brief Tap setting algorithm for critically sampled channels - */ - void set_taps1(const std::vector<float> &taps); - - /*! - * \brief Tap setting algorithm for 2x over-sampled channels - */ - void set_taps2(const std::vector<float> &taps); - - /*! - * Build the polyphase synthesis filterbank. - * \param numchans (unsigned integer) Specifies the number of - channels <EM>M</EM> - * \param taps (vector/list of floats) The prototype filter - to populate the filterbank. - * \param twox (bool) use 2x oversampling or not (default is no) - */ - gr_pfb_synthesizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - bool twox); - -public: - ~gr_pfb_synthesizer_ccf (); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param taps (vector/list of floats) The prototype filter to - populate the filterbank. - */ - void set_taps (const std::vector<float> &taps); - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - - /*! - * Return a vector<vector<>> of the filterbank taps - */ - std::vector<std::vector<float> > taps() const; - - /*! - * Set the channel map. Channels are numbers as: - * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2 - * <------------------- 0 --------------------> - * freq - * - * So input stream 0 goes to channel 0, etc. Setting a new channel - * map allows the user to specify where in frequency he/she wants - * the input stream to go. This is especially useful to avoid - * putting signals into the channels on the edge of the spectrum - * which can either wrap around (in the case of odd number of - * channels) and be affected by filter rolloff in the transmitter. - * - * The map must be at least the number of streams being sent to the - * block. Less and the algorithm will not have enough data to - * properly setup the buffers. Any more channels specified will be - * ignored. - */ - void set_channel_map(const std::vector<int> &map); - - /*! - * Gets the current channel map. - */ - std::vector<int> channel_map() const; - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.i deleted file mode 100644 index c186ae355a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.i +++ /dev/null @@ -1,44 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pfb_synthesizer_ccf); - -gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf - (unsigned int numchans, const std::vector<float> &taps, bool twox=false); - -class gr_pfb_synthesizer_ccf : public gr_sync_interpolator -{ - private: - gr_pfb_synthesizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - bool twox=false); - - public: - ~gr_pfb_synthesizer_ccf (); - - void set_taps (const std::vector<float> &taps); - void print_taps(); - std::vector< std::vector<float> > taps() const; - - void set_channel_map(const std::vector<int> &map); - std::vector<int> channel_map() const; -}; diff --git a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.cc.t deleted file mode 100644 index 445834dda0..0000000000 --- a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.cc.t +++ /dev/null @@ -1,172 +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: This file is automatically generated by - * generate_gr_rational_resampler_base_XXX.py Any changes made to this - * file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <@FIR_TYPE@.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (unsigned interpolation, - unsigned decimation, - const std::vector<@TAP_TYPE@> &taps) -{ - return gnuradio::get_initial_sptr (new @NAME@ (interpolation, decimation, taps)); -} - -@NAME@::@NAME@ (unsigned interpolation, unsigned decimation, - const std::vector<@TAP_TYPE@> &taps) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_history(1), - d_interpolation(interpolation), d_decimation(decimation), - d_ctr(0), d_updated(false), - d_firs(interpolation) -{ - if (interpolation == 0) - throw std::out_of_range ("interpolation must be > 0"); - if (decimation == 0) - throw std::out_of_range ("decimation must be > 0"); - - set_relative_rate (1.0 * interpolation / decimation); - set_output_multiple (1); - - std::vector<@TAP_TYPE@> dummy_taps; - - for (unsigned i = 0; i < interpolation; i++) - d_firs[i] = gr_fir_util::create_@FIR_TYPE@ (dummy_taps); - - set_taps (taps); - install_taps (d_new_taps); -} - -@NAME@::~@NAME@ () -{ - int interp = interpolation(); - for (int i = 0; i < interp; i++) - delete d_firs[i]; -} - -void -@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps) -{ - d_new_taps = taps; - d_updated = true; - - // round up length to a multiple of the interpolation factor - int n = taps.size () % interpolation (); - if (n > 0){ - n = interpolation () - n; - while (n-- > 0) - d_new_taps.insert(d_new_taps.begin(), 0); - } - - assert (d_new_taps.size () % interpolation () == 0); -} - - -void -@NAME@::install_taps (const std::vector<@TAP_TYPE@> &taps) -{ - int nfilters = interpolation (); - int nt = taps.size () / nfilters; - - assert (nt * nfilters == (int) taps.size ()); - - std::vector< std::vector <@TAP_TYPE@> > xtaps (nfilters); - - for (int n = 0; n < nfilters; n++) - xtaps[n].resize (nt); - - for (int i = 0; i < (int) taps.size(); i++) - xtaps[i % nfilters][i / nfilters] = taps[i]; - - for (int n = 0; n < nfilters; n++) - d_firs[n]->set_taps (xtaps[n]); - - set_history (nt); - d_updated = false; - -#if 0 - for (int i = 0; i < nfilters; i++){ - std::cout << "filter[" << i << "] = "; - for (int j = 0; j < nt; j++) - std::cout << xtaps[i][j] << " "; - - std::cout << "\n"; - } -#endif - -} - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - int nreqd = std::max((unsigned)1, (int)((double) (noutput_items+1) * decimation() / interpolation()) + history() - 1); - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = nreqd; -} - -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) -{ - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - - if (d_updated) { - install_taps (d_new_taps); - return 0; // history requirement may have increased. - } - - unsigned int ctr = d_ctr; - - int i = 0; - while (i < noutput_items){ - out[i++] = d_firs[ctr]->filter(in); - ctr += decimation(); - while (ctr >= interpolation()){ - ctr -= interpolation(); - in++; - } - } - - d_ctr = ctr; - consume_each(in - (@I_TYPE@ *) input_items[0]); - return i; -} diff --git a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t deleted file mode 100644 index 3eb85a9795..0000000000 --- a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t +++ /dev/null @@ -1,88 +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. - */ - -/* - * WARNING: This file is automatically generated by - * generate_gr_rational_resampler_base_XXX.py Any changes made to this - * file will be overwritten. - */ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -GR_CORE_API @SPTR_NAME@ -gr_make_@BASE_NAME@ (unsigned interpolation, - unsigned decimation, - const std::vector<@TAP_TYPE@> &taps); - -class @FIR_TYPE@; - -/*! - * \brief Rational Resampling Polyphase FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter_blk - */ -class GR_CORE_API @NAME@ : public gr_block -{ - private: - unsigned d_history; - unsigned d_interpolation, d_decimation; - unsigned d_ctr; - std::vector<@TAP_TYPE@> d_new_taps; - bool d_updated; - std::vector<@FIR_TYPE@ *> d_firs; - - friend GR_CORE_API @SPTR_NAME@ - gr_make_@BASE_NAME@ (unsigned interpolation, unsigned decimation, const std::vector<@TAP_TYPE@> &taps); - - - /*! - * Construct a FIR filter with the given taps - */ - @NAME@ (unsigned interpolation, unsigned decimation, - const std::vector<@TAP_TYPE@> &taps); - - void install_taps (const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - unsigned history () const { return d_history; } - void set_history (unsigned history) { d_history = history; } - - unsigned interpolation() const { return d_interpolation; } - unsigned decimation() const { return d_decimation; } - - void set_taps (const std::vector<@TAP_TYPE@> &taps); - - 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/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.i.t b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.i.t deleted file mode 100644 index 1f789b0a35..0000000000 --- a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.i.t +++ /dev/null @@ -1,42 +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. - */ - -/* - * WARNING: This file is automatically generated by - * generate_gr_rational_resampler_base_XXX.py Any changes made to this - * file will be overwritten. - */ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int interpolation, int decimation, const std::vector<@TAP_TYPE@> &taps); - -class @NAME@ : public gr_block -{ - private: - @NAME@ (int interpolation, int decimation, const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - - void set_taps (const std::vector<@TAP_TYPE@> &taps); -}; diff --git a/gnuradio-core/src/lib/filter/gr_rotator.h b/gnuradio-core/src/lib/filter/gr_rotator.h index e31be6ee63..77946dd397 100644 --- a/gnuradio-core/src/lib/filter/gr_rotator.h +++ b/gnuradio-core/src/lib/filter/gr_rotator.h @@ -26,7 +26,7 @@ #include <gr_core_api.h> #include <gr_complex.h> -class GR_CORE_API gr_rotator { +class /*GR_CORE_API*/ gr_rotator { gr_complex d_phase; gr_complex d_phase_incr; unsigned int d_counter; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.cc b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.cc deleted file mode 100644 index ae4f654dda..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 <gr_single_pole_iir_filter_cc.h> -#include <gr_io_signature.h> -#include <stdio.h> - - -gr_single_pole_iir_filter_cc_sptr -gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen) -{ - return gnuradio::get_initial_sptr(new gr_single_pole_iir_filter_cc(alpha, vlen)); -} - -gr_single_pole_iir_filter_cc::gr_single_pole_iir_filter_cc ( - double alpha, unsigned int vlen) - : gr_sync_block ("single_pole_iir_filter_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen), - gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen)), - d_vlen(vlen), d_iir(vlen) -{ - set_taps(alpha); -} - -gr_single_pole_iir_filter_cc::~gr_single_pole_iir_filter_cc () -{ - // nop -} - -void -gr_single_pole_iir_filter_cc::set_taps (double alpha) -{ - for (unsigned int i = 0; i < d_vlen; i++) - d_iir[i].set_taps(alpha); -} - -int -gr_single_pole_iir_filter_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]; - unsigned int vlen = d_vlen; - - if (d_vlen == 1){ - for (int i = 0; i < noutput_items; i++) - out[i] = d_iir[0].filter (in[i]); - } - else { - for (int i = 0; i < noutput_items; i++){ - for (unsigned int j = 0; j < vlen; j++){ - *out++ = d_iir[j].filter (*in++); - } - } - } - return noutput_items; -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h deleted file mode 100644 index 13c595826d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -#ifndef INCLUDED_GR_SINGLE_POLE_IIR_FILTER_CC_H -#define INCLUDED_GR_SINGLE_POLE_IIR_FILTER_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> -#include <gr_complex.h> -#include <stdexcept> - -class gr_single_pole_iir_filter_cc; -typedef boost::shared_ptr<gr_single_pole_iir_filter_cc> gr_single_pole_iir_filter_cc_sptr; - -GR_CORE_API gr_single_pole_iir_filter_cc_sptr -gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen=1); - -/*! - * \brief single pole IIR filter with complex input, complex output - * \ingroup filter_blk - * - * The input and output satisfy a difference equation of the form - \htmlonly - \f{ - y[n] - (1-alpha) y[n-1] = alpha x[n] - \f} - \endhtmlonly - - \xmlonly - y[n] - (1-alpha) y[n-1] = alpha x[n] - \endxmlonly - - * with the corresponding rational system function - \htmlonly - \f{ - H(z) = \frac{alpha}{1 - (1-alpha) z^{-1}} - \f} - \endhtmlonly - - \xmlonly - H(z) = \ frac{alpha}{1 - (1-alpha) z^{-1}} - \endxmlonly - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback tap. - */ -class GR_CORE_API gr_single_pole_iir_filter_cc : public gr_sync_block -{ - private: - friend GR_CORE_API gr_single_pole_iir_filter_cc_sptr - gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen); - - unsigned int d_vlen; - std::vector<gr_single_pole_iir<gr_complex,gr_complex,double> > d_iir; - - gr_single_pole_iir_filter_cc (double alpha, unsigned int vlen); - - public: - ~gr_single_pole_iir_filter_cc (); - - void set_taps (double alpha); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.i b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.i deleted file mode 100644 index 2f1f285de7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,single_pole_iir_filter_cc); - -gr_single_pole_iir_filter_cc_sptr -gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen=1); - -class gr_single_pole_iir_filter_cc : public gr_sync_block -{ - public: - ~gr_single_pole_iir_filter_cc (); - - void set_taps (double alpha); -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.cc b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.cc deleted file mode 100644 index 047b2ba25c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.cc +++ /dev/null @@ -1,81 +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 <gr_single_pole_iir_filter_ff.h> -#include <gr_io_signature.h> -#include <stdio.h> - - -gr_single_pole_iir_filter_ff_sptr -gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen) -{ - return gnuradio::get_initial_sptr(new gr_single_pole_iir_filter_ff(alpha, vlen)); -} - -gr_single_pole_iir_filter_ff::gr_single_pole_iir_filter_ff ( - double alpha, unsigned int vlen) - : gr_sync_block ("single_pole_iir_filter_ff", - gr_make_io_signature (1, 1, sizeof (float) * vlen), - gr_make_io_signature (1, 1, sizeof (float) * vlen)), - d_vlen(vlen), d_iir(vlen) -{ - set_taps(alpha); -} - -gr_single_pole_iir_filter_ff::~gr_single_pole_iir_filter_ff () -{ - // nop -} - -void -gr_single_pole_iir_filter_ff::set_taps (double alpha) -{ - for (unsigned int i = 0; i < d_vlen; i++) - d_iir[i].set_taps(alpha); -} - -int -gr_single_pole_iir_filter_ff::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]; - unsigned int vlen = d_vlen; - - if (d_vlen == 1){ - for (int i = 0; i < noutput_items; i++) - out[i] = d_iir[0].filter (in[i]); - } - else { - for (int i = 0; i < noutput_items; i++){ - for (unsigned int j = 0; j < vlen; j++){ - *out++ = d_iir[j].filter (*in++); - } - } - } - return noutput_items; -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h deleted file mode 100644 index 8dcdad2c94..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_SINGLE_POLE_IIR_FILTER_FF_H -#define INCLUDED_GR_SINGLE_POLE_IIR_FILTER_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> -#include <stdexcept> - -class gr_single_pole_iir_filter_ff; -typedef boost::shared_ptr<gr_single_pole_iir_filter_ff> gr_single_pole_iir_filter_ff_sptr; - -GR_CORE_API gr_single_pole_iir_filter_ff_sptr -gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen=1); - -/*! - * \brief single pole IIR filter with float input, float output - * \ingroup filter_blk - * - * The input and output satisfy a difference equation of the form - \htmlonly - \f{ - y[n] - (1-alpha) y[n-1] = alpha x[n] - \f} - \endhtmlonly - - \xmlonly - y[n] - (1-alpha) y[n-1] = alpha x[n] - \endxmlonly - - * with the corresponding rational system function - \htmlonly - \f{ - H(z) = \frac{alpha}{1 - (1-alpha) z^{-1}} - \f} - \endhtmlonly - - \xmlonly -H(z) = \ frac{alpha}{1 - (1-alpha) z^{-1}} - \endxmlonly - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback tap. - */ -class GR_CORE_API gr_single_pole_iir_filter_ff : public gr_sync_block -{ - private: - friend GR_CORE_API gr_single_pole_iir_filter_ff_sptr - gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen); - - unsigned int d_vlen; - std::vector<gr_single_pole_iir<float,float,double> > d_iir; - - gr_single_pole_iir_filter_ff (double alpha, unsigned int vlen); - - public: - ~gr_single_pole_iir_filter_ff (); - - void set_taps (double alpha); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.i b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.i deleted file mode 100644 index a835fabb2e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.i +++ /dev/null @@ -1,34 +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(gr,single_pole_iir_filter_ff); - -gr_single_pole_iir_filter_ff_sptr -gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen=1); - -class gr_single_pole_iir_filter_ff : public gr_sync_block -{ - public: - ~gr_single_pole_iir_filter_ff (); - - void set_taps (double alpha); -}; diff --git a/gnuradio-core/src/lib/filter/gr_vec_types.h b/gnuradio-core/src/lib/filter/gr_vec_types.h deleted file mode 100644 index 2bcec44bf8..0000000000 --- a/gnuradio-core/src/lib/filter/gr_vec_types.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Cell single token vector types - Copyright (C) 2007 Free Software Foundation, Inc. - - This file is free software; you can 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. - - This file is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR 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 file; see the file COPYING. If not, write to the Free - Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ - -/* As a special exception, if you include this header file into source files - compiled by GCC, this header file does not by itself cause the resulting - executable to be covered by the GNU General Public License. This exception - does not however invalidate any other reasons why the executable file might be - covered by the GNU General Public License. */ - -/* Single token vector data types for the PowerPC SIMD/Vector Multi-media - eXtension */ - -#ifndef INCLUDED_GR_VEC_TYPES_H -#define INCLUDED_GR_VEC_TYPES_H - -#define qword __vector unsigned char - -#define vec_uchar16 __vector unsigned char -#define vec_char16 __vector signed char -#define vec_bchar16 __vector bool char - -#define vec_ushort8 __vector unsigned short -#define vec_short8 __vector signed short -#define vec_bshort8 __vector bool short - -#define vec_pixel8 __vector pixel - -#define vec_uint4 __vector unsigned int -#define vec_int4 __vector signed int -#define vec_bint4 __vector bool int - -#define vec_float4 __vector float - -#define vec_ullong2 __vector bool char -#define vec_llong2 __vector bool short - -#define vec_double2 __vector bool int - -#endif /* INCLUDED_GR_VEC_TYPES_H */ diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc deleted file mode 100644 index e958c5061f..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc +++ /dev/null @@ -1,184 +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 <gri_fft_filter_ccc_generic.h> -#include <gri_fft.h> -#include <volk/volk.h> -#include <assert.h> -#include <stdexcept> -#include <cstdio> -#include <cstring> -#include <fftw3.h> - -gri_fft_filter_ccc_generic::gri_fft_filter_ccc_generic (int decimation, - const std::vector<gr_complex> &taps, - int nthreads) - : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0), d_nthreads(nthreads) -{ - set_taps(taps); -} - -gri_fft_filter_ccc_generic::~gri_fft_filter_ccc_generic () -{ - delete d_fwdfft; - delete d_invfft; - gri_fft_free(d_xformed_taps); -} - -#if 0 -static void -print_vector_complex(const std::string label, const std::vector<gr_complex> &x) -{ - std::cout << label; - for (unsigned i = 0; i < x.size(); i++) - std::cout << x[i] << " "; - std::cout << "\n"; -} -#endif - - -/* - * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps - */ -int -gri_fft_filter_ccc_generic::set_taps (const std::vector<gr_complex> &taps) -{ - int i = 0; - compute_sizes(taps.size()); - - d_tail.resize(tailsize()); - for (i = 0; i < tailsize(); i++) - d_tail[i] = 0; - - gr_complex *in = d_fwdfft->get_inbuf(); - gr_complex *out = d_fwdfft->get_outbuf(); - - float scale = 1.0 / d_fftsize; - - // Compute forward xform of taps. - // Copy taps into first ntaps slots, then pad with zeros - for (i = 0; i < d_ntaps; i++) - in[i] = taps[i] * scale; - - for (; i < d_fftsize; i++) - in[i] = 0; - - d_fwdfft->execute(); // do the xform - - // now copy output to d_xformed_taps - for (i = 0; i < d_fftsize; i++) - d_xformed_taps[i] = out[i]; - - return d_nsamples; -} - -// determine and set d_ntaps, d_nsamples, d_fftsize - -void -gri_fft_filter_ccc_generic::compute_sizes(int ntaps) -{ - int old_fftsize = d_fftsize; - d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0)))); - d_nsamples = d_fftsize - d_ntaps + 1; - - if (0) - fprintf(stderr, "gri_fft_filter_ccc_generic: ntaps = %d, fftsize = %d, nsamples = %d\n", - d_ntaps, d_fftsize, d_nsamples); - - assert(d_fftsize == d_ntaps + d_nsamples -1 ); - - if (d_fftsize != old_fftsize){ // compute new plans - delete d_fwdfft; - delete d_invfft; - d_fwdfft = new gri_fft_complex(d_fftsize, true, d_nthreads); - d_invfft = new gri_fft_complex(d_fftsize, false, d_nthreads); - d_xformed_taps = gri_fft_malloc_complex(d_fftsize); - } -} - -void -gri_fft_filter_ccc_generic::set_nthreads(int n) -{ - d_nthreads = n; - if(d_fwdfft) - d_fwdfft->set_nthreads(n); - if(d_invfft) - d_invfft->set_nthreads(n); -} - -int -gri_fft_filter_ccc_generic::nthreads() const -{ - return d_nthreads; -} - -int -gri_fft_filter_ccc_generic::filter (int nitems, const gr_complex *input, gr_complex *output) -{ - int dec_ctr = 0; - int j = 0; - int ninput_items = nitems * d_decimation; - - for (int i = 0; i < ninput_items; i += d_nsamples){ - - memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(gr_complex)); - - for (j = d_nsamples; j < d_fftsize; j++) - d_fwdfft->get_inbuf()[j] = 0; - - d_fwdfft->execute(); // compute fwd xform - - gr_complex *a = d_fwdfft->get_outbuf(); - gr_complex *b = d_xformed_taps; - gr_complex *c = d_invfft->get_inbuf(); - - volk_32fc_x2_multiply_32fc_a(c, a, b, d_fftsize); - - d_invfft->execute(); // compute inv xform - - // add in the overlapping tail - - for (j = 0; j < tailsize(); j++) - d_invfft->get_outbuf()[j] += d_tail[j]; - - // copy nsamples to output - j = dec_ctr; - while (j < d_nsamples) { - *output++ = d_invfft->get_outbuf()[j]; - j += d_decimation; - } - dec_ctr = (j - d_nsamples); - - // stash the tail - memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples, - tailsize() * sizeof(gr_complex)); - } - - assert(dec_ctr == 0); - - return nitems; -} diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h deleted file mode 100644 index 648c2b8c54..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h +++ /dev/null @@ -1,96 +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_GRI_FFT_FILTER_CCC_GENERIC_H -#define INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H - -#include <gr_core_api.h> -#include <gr_complex.h> -#include <vector> - -class gri_fft_complex; - -/*! - * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps - * \ingroup filter_blk - */ -class GR_CORE_API gri_fft_filter_ccc_generic -{ - private: - int d_ntaps; - int d_nsamples; - int d_fftsize; // fftsize = ntaps + nsamples - 1 - int d_decimation; - gri_fft_complex *d_fwdfft; // forward "plan" - gri_fft_complex *d_invfft; // inverse "plan" - int d_nthreads; // number of FFTW threads to use - std::vector<gr_complex> d_tail; // state carried between blocks for overlap-add - std::vector<gr_complex> d_new_taps; - gr_complex *d_xformed_taps; // Fourier xformed taps - - void compute_sizes(int ntaps); - int tailsize() const { return d_ntaps - 1; } - - public: - /*! - * \brief Construct an FFT filter for complex vectors with the given taps and decimation rate. - * - * This is the basic implementation for performing FFT filter for fast convolution - * in other blocks for complex vectors (such as gr_fft_filter_ccc). - * \param decimation The decimation rate of the filter (int) - * \param taps The filter taps (complex) - * \param nthreads The number of threads for the FFT to use (int) - */ - gri_fft_filter_ccc_generic (int decimation, const std::vector<gr_complex> &taps, - int nthreads=1); - ~gri_fft_filter_ccc_generic (); - - /*! - * \brief Set new taps for the filter. - * - * Sets new taps and resets the class properties to handle different sizes - * \param taps The filter taps (complex) - */ - int set_taps (const std::vector<gr_complex> &taps); - - /*! - * \brief Set number of threads to use. - */ - void set_nthreads(int n); - - /*! - * \brief Get number of threads being used. - */ - int nthreads() const; - - /*! - * \brief Perform the filter operation - * - * \param nitems The number of items to produce - * \param input The input vector to be filtered - * \param output The result of the filter operation - */ - int filter (int nitems, const gr_complex *input, gr_complex *output); - -}; - -#endif /* INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H */ diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.cc deleted file mode 100644 index bfc939869e..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.cc +++ /dev/null @@ -1,186 +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 <gri_fft_filter_ccc_sse.h> -#include <gri_fft.h> -#include <assert.h> -#include <stdexcept> -#include <cstdio> -#include <xmmintrin.h> -#include <fftw3.h> - -gri_fft_filter_ccc_sse::gri_fft_filter_ccc_sse (int decimation, - const std::vector<gr_complex> &taps) - : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0) -{ - d_xformed_taps = (gr_complex*)fftwf_malloc(1*sizeof(gr_complex)); - set_taps(taps); -} - -gri_fft_filter_ccc_sse::~gri_fft_filter_ccc_sse () -{ - fftwf_free(d_xformed_taps); - delete d_fwdfft; - delete d_invfft; -} - -#if 0 -static void -print_vector_complex(const std::string label, const std::vector<gr_complex> &x) -{ - std::cout << label; - for (unsigned i = 0; i < x.size(); i++) - std::cout << x[i] << " "; - std::cout << "\n"; -} -#endif - - -/* - * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps - */ -int -gri_fft_filter_ccc_sse::set_taps (const std::vector<gr_complex> &taps) -{ - int i = 0; - compute_sizes(taps.size()); - - d_tail.resize(tailsize()); - for (i = 0; i < tailsize(); i++) - d_tail[i] = 0; - - gr_complex *in = d_fwdfft->get_inbuf(); - gr_complex *out = d_fwdfft->get_outbuf(); - - float scale = 1.0 / d_fftsize; - - // Compute forward xform of taps. - // Copy taps into first ntaps slots, then pad with zeros - for (i = 0; i < d_ntaps; i++) - in[i] = taps[i] * scale; - - for (; i < d_fftsize; i++) - in[i] = 0; - - d_fwdfft->execute(); // do the xform - - // now copy output to d_xformed_taps - for (i = 0; i < d_fftsize; i++) - d_xformed_taps[i] = out[i]; - - return d_nsamples; -} - -// determine and set d_ntaps, d_nsamples, d_fftsize - -void -gri_fft_filter_ccc_sse::compute_sizes(int ntaps) -{ - int old_fftsize = d_fftsize; - d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2)))); - d_nsamples = d_fftsize - d_ntaps + 1; - - if (0) - fprintf(stderr, "gri_fft_filter_ccc_sse: ntaps = %d, fftsize = %d, nsamples = %d\n", - d_ntaps, d_fftsize, d_nsamples); - - assert(d_fftsize == d_ntaps + d_nsamples -1 ); - - if (d_fftsize != old_fftsize){ // compute new plans - delete d_fwdfft; - delete d_invfft; - d_fwdfft = new gri_fft_complex(d_fftsize, true); - d_invfft = new gri_fft_complex(d_fftsize, false); - - fftwf_free(d_xformed_taps); - d_xformed_taps = (gr_complex*)fftwf_malloc((d_fftsize)*sizeof(gr_complex)); - } -} - -int -gri_fft_filter_ccc_sse::filter (int nitems, const gr_complex *input, gr_complex *output) -{ - int dec_ctr = 0; - int j = 0; - int ninput_items = nitems * d_decimation; - - for (int i = 0; i < ninput_items; i += d_nsamples){ - - memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(gr_complex)); - - for (j = d_nsamples; j < d_fftsize; j++) - d_fwdfft->get_inbuf()[j] = 0; - - d_fwdfft->execute(); // compute fwd xform - - float *a = (float*)(d_fwdfft->get_outbuf()); - float *b = (float*)(&d_xformed_taps[0]); - float *c = (float*)(d_invfft->get_inbuf()); - - __m128 x0, x1, x2, t0, t1, m; - m = _mm_set_ps(-1, 1, -1, 1); - for (j = 0; j < 2*d_fftsize; j+=4) { // filter in the freq domain - x0 = _mm_load_ps(&a[j]); - t0 = _mm_load_ps(&b[j]); - - t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(3, 3, 1, 1)); - t0 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(2, 2, 0, 0)); - t1 = _mm_mul_ps(t1, m); - - x1 = _mm_mul_ps(x0, t0); - x2 = _mm_mul_ps(x0, t1); - - x2 = _mm_shuffle_ps(x2, x2, _MM_SHUFFLE(2, 3, 0, 1)); - x2 = _mm_add_ps(x1, x2); - - _mm_store_ps(&c[j], x2); - } - - d_invfft->execute(); // compute inv xform - - // add in the overlapping tail - - for (j = 0; j < tailsize(); j++) - d_invfft->get_outbuf()[j] += d_tail[j]; - - // copy nsamples to output - j = dec_ctr; - while (j < d_nsamples) { - *output++ = d_invfft->get_outbuf()[j]; - j += d_decimation; - } - dec_ctr = (j - d_nsamples); - - // stash the tail - memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples, - tailsize() * sizeof(gr_complex)); - } - - assert(dec_ctr == 0); - - return nitems; -} diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h deleted file mode 100644 index 64b8c0c153..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h +++ /dev/null @@ -1,83 +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_GRI_FFT_FILTER_CCC_SSE_H -#define INCLUDED_GRI_FFT_FILTER_CCC_SSE_H - -#include <gr_core_api.h> -#include <gr_complex.h> -#include <vector> - -class gri_fft_complex; - -/*! - * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps - * \ingroup filter_blk - */ -class GR_CORE_API gri_fft_filter_ccc_sse -{ - private: - int d_ntaps; - int d_nsamples; - int d_fftsize; // fftsize = ntaps + nsamples - 1 - int d_decimation; - gri_fft_complex *d_fwdfft; // forward "plan" - gri_fft_complex *d_invfft; // inverse "plan" - std::vector<gr_complex> d_tail; // state carried between blocks for overlap-add - gr_complex *d_xformed_taps; - std::vector<gr_complex> d_new_taps; - - void compute_sizes(int ntaps); - int tailsize() const { return d_ntaps - 1; } - - public: - /*! - * \brief Construct an FFT filter for complex vectors with the given taps and decimation rate. - * - * This is the basic implementation for performing FFT filter for fast convolution - * in other blocks for complex vectors (such as gr_fft_filter_ccc). - * \param decimation The decimation rate of the filter (int) - * \param taps The filter taps (complex) - */ - gri_fft_filter_ccc_sse (int decimation, const std::vector<gr_complex> &taps); - ~gri_fft_filter_ccc_sse (); - - /*! - * \brief Set new taps for the filter. - * - * Sets new taps and resets the class properties to handle different sizes - * \param taps The filter taps (complex) - */ - int set_taps (const std::vector<gr_complex> &taps); - - /*! - * \brief Perform the filter operation - * - * \param nitems The number of items to produce - * \param input The input vector to be filtered - * \param output The result of the filter operation - */ - int filter (int nitems, const gr_complex *input, gr_complex *output); - -}; - -#endif /* INCLUDED_GRI_FFT_FILTER_CCC_SSE_H */ diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc deleted file mode 100644 index c6e923ee11..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc +++ /dev/null @@ -1,175 +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 <gri_fft_filter_fff_generic.h> -#include <gri_fft.h> -#include <volk/volk.h> -#include <assert.h> -#include <stdexcept> -#include <cstdio> -#include <cstring> - -gri_fft_filter_fff_generic::gri_fft_filter_fff_generic (int decimation, - const std::vector<float> &taps, - int nthreads) - : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0), d_nthreads(nthreads) -{ - set_taps(taps); -} - -gri_fft_filter_fff_generic::~gri_fft_filter_fff_generic () -{ - delete d_fwdfft; - delete d_invfft; - gri_fft_free(d_xformed_taps); -} - -/* - * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps - */ -int -gri_fft_filter_fff_generic::set_taps (const std::vector<float> &taps) -{ - int i = 0; - compute_sizes(taps.size()); - - d_tail.resize(tailsize()); - for (i = 0; i < tailsize(); i++) - d_tail[i] = 0; - - float *in = d_fwdfft->get_inbuf(); - gr_complex *out = d_fwdfft->get_outbuf(); - - float scale = 1.0 / d_fftsize; - - // Compute forward xform of taps. - // Copy taps into first ntaps slots, then pad with zeros - for (i = 0; i < d_ntaps; i++) - in[i] = taps[i] * scale; - - for (; i < d_fftsize; i++) - in[i] = 0; - - d_fwdfft->execute(); // do the xform - - // now copy output to d_xformed_taps - for (i = 0; i < d_fftsize/2+1; i++) - d_xformed_taps[i] = out[i]; - - return d_nsamples; -} - -// determine and set d_ntaps, d_nsamples, d_fftsize - -void -gri_fft_filter_fff_generic::compute_sizes(int ntaps) -{ - int old_fftsize = d_fftsize; - d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0)))); - d_nsamples = d_fftsize - d_ntaps + 1; - - if (0) - fprintf(stderr, "gri_fft_filter_fff_generic: ntaps = %d, fftsize = %d, nsamples = %d\n", - d_ntaps, d_fftsize, d_nsamples); - - assert(d_fftsize == d_ntaps + d_nsamples -1 ); - - if (d_fftsize != old_fftsize){ // compute new plans - delete d_fwdfft; - delete d_invfft; - d_fwdfft = new gri_fft_real_fwd(d_fftsize); - d_invfft = new gri_fft_real_rev(d_fftsize); - d_xformed_taps = gri_fft_malloc_complex(d_fftsize/2+1); - } -} - -void -gri_fft_filter_fff_generic::set_nthreads(int n) -{ - d_nthreads = n; - if(d_fwdfft) - d_fwdfft->set_nthreads(n); - if(d_invfft) - d_invfft->set_nthreads(n); -} - -int -gri_fft_filter_fff_generic::nthreads() const -{ - return d_nthreads; -} - -int -gri_fft_filter_fff_generic::filter (int nitems, const float *input, float *output) -{ - int dec_ctr = 0; - int j = 0; - int ninput_items = nitems * d_decimation; - - for (int i = 0; i < ninput_items; i += d_nsamples){ - - memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(float)); - - for (j = d_nsamples; j < d_fftsize; j++) - d_fwdfft->get_inbuf()[j] = 0; - - d_fwdfft->execute(); // compute fwd xform - - gr_complex *a = d_fwdfft->get_outbuf(); - gr_complex *b = d_xformed_taps; - gr_complex *c = d_invfft->get_inbuf(); - - volk_32fc_x2_multiply_32fc_a(c, a, b, d_fftsize/2+1); - - d_invfft->execute(); // compute inv xform - - // add in the overlapping tail - - for (j = 0; j < tailsize(); j++) - d_invfft->get_outbuf()[j] += d_tail[j]; - - // copy nsamples to output - - //memcpy(out, d_invfft->get_outbuf(), d_nsamples * sizeof(float)); - //out += d_nsamples; - - j = dec_ctr; - while (j < d_nsamples) { - *output++ = d_invfft->get_outbuf()[j]; - j += d_decimation; - } - dec_ctr = (j - d_nsamples); - - // stash the tail - memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples, - tailsize() * sizeof(float)); - } - - assert(dec_ctr == 0); - - return nitems; -} diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h deleted file mode 100644 index 528bf5dd7d..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h +++ /dev/null @@ -1,94 +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_GRI_FFT_FILTER_FFF_GENERIC_H -#define INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H - -#include <gr_core_api.h> -#include <gr_complex.h> -#include <vector> - -class gri_fft_real_fwd; -class gri_fft_real_rev; - -class GR_CORE_API gri_fft_filter_fff_generic -{ - private: - int d_ntaps; - int d_nsamples; - int d_fftsize; // fftsize = ntaps + nsamples - 1 - int d_decimation; - gri_fft_real_fwd *d_fwdfft; // forward "plan" - gri_fft_real_rev *d_invfft; // inverse "plan" - int d_nthreads; // number of FFTW threads to use - std::vector<float> d_tail; // state carried between blocks for overlap-add - std::vector<float> d_new_taps; - gr_complex *d_xformed_taps; // Fourier xformed taps - - - void compute_sizes(int ntaps); - int tailsize() const { return d_ntaps - 1; } - - public: - /*! - * \brief Construct a FFT filter for float vectors with the given taps and decimation rate. - * - * This is the basic implementation for performing FFT filter for fast convolution - * in other blocks for floating point vectors (such as gr_fft_filter_fff). - * \param decimation The decimation rate of the filter (int) - * \param taps The filter taps (float) - * \param nthreads The number of threads for the FFT to use (int) - */ - gri_fft_filter_fff_generic (int decimation, const std::vector<float> &taps, - int nthreads=1); - ~gri_fft_filter_fff_generic (); - - /*! - * \brief Set new taps for the filter. - * - * Sets new taps and resets the class properties to handle different sizes - * \param taps The filter taps (float) - */ - int set_taps (const std::vector<float> &taps); - - /*! - * \brief Set number of threads to use. - */ - void set_nthreads(int n); - - /*! - * \brief Get number of threads being used. - */ - int nthreads() const; - - /*! - * \brief Perform the filter operation - * - * \param nitems The number of items to produce - * \param input The input vector to be filtered - * \param output The result of the filter operation - */ - int filter (int nitems, const float *input, float *output); - -}; - -#endif /* INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H */ diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.cc deleted file mode 100644 index 84fcfa4380..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.cc +++ /dev/null @@ -1,184 +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 <gri_fft_filter_fff_sse.h> -#include <gri_fft.h> -#include <assert.h> -#include <stdexcept> -#include <cstdio> -#include <xmmintrin.h> -#include <fftw3.h> - -gri_fft_filter_fff_sse::gri_fft_filter_fff_sse (int decimation, - const std::vector<float> &taps) - : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0) -{ - d_xformed_taps = (gr_complex*)fftwf_malloc(1*sizeof(gr_complex)); - set_taps(taps); -} - -gri_fft_filter_fff_sse::~gri_fft_filter_fff_sse () -{ - fftwf_free(d_xformed_taps); - delete d_fwdfft; - delete d_invfft; -} - -/* - * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps - */ -int -gri_fft_filter_fff_sse::set_taps (const std::vector<float> &taps) -{ - int i = 0; - compute_sizes(taps.size()); - - d_tail.resize(tailsize()); - for (i = 0; i < tailsize(); i++) - d_tail[i] = 0; - - float *in = d_fwdfft->get_inbuf(); - gr_complex *out = d_fwdfft->get_outbuf(); - - float scale = 1.0 / d_fftsize; - - // Compute forward xform of taps. - // Copy taps into first ntaps slots, then pad with zeros - for (i = 0; i < d_ntaps; i++) - in[i] = taps[i] * scale; - - for (; i < d_fftsize; i++) - in[i] = 0; - - d_fwdfft->execute(); // do the xform - - // now copy output to d_xformed_taps - for (i = 0; i < d_fftsize/2+1; i++) - d_xformed_taps[i] = out[i]; - - return d_nsamples; -} - -// determine and set d_ntaps, d_nsamples, d_fftsize - -void -gri_fft_filter_fff_sse::compute_sizes(int ntaps) -{ - int old_fftsize = d_fftsize; - d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2)))); - d_nsamples = d_fftsize - d_ntaps + 1; - - if (0) - fprintf(stderr, "gri_fft_filter_fff_sse: ntaps = %d, fftsize = %d, nsamples = %d\n", - d_ntaps, d_fftsize, d_nsamples); - - assert(d_fftsize == d_ntaps + d_nsamples -1 ); - - if (d_fftsize != old_fftsize){ // compute new plans - delete d_fwdfft; - delete d_invfft; - d_fwdfft = new gri_fft_real_fwd(d_fftsize); - d_invfft = new gri_fft_real_rev(d_fftsize); - //d_xformed_taps.resize(d_fftsize/2+1); - - fftwf_free(d_xformed_taps); - d_xformed_taps = (gr_complex*)fftwf_malloc((d_fftsize/2+1)*sizeof(gr_complex)); - } -} - -int -gri_fft_filter_fff_sse::filter (int nitems, const float *input, float *output) -{ - int dec_ctr = 0; - int j = 0; - int ninput_items = nitems * d_decimation; - - for (int i = 0; i < ninput_items; i += d_nsamples){ - - memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(float)); - - for (j = d_nsamples; j < d_fftsize; j++) - d_fwdfft->get_inbuf()[j] = 0; - - d_fwdfft->execute(); // compute fwd xform - - float *a = (float*)(d_fwdfft->get_outbuf()); - float *b = (float*)(&d_xformed_taps[0]); - float *c = (float*)(d_invfft->get_inbuf()); - - __m128 x0, x1, x2, t0, t1, m; - m = _mm_set_ps(-1, 1, -1, 1); - for (j = 0; j < d_fftsize; j+=4) { // filter in the freq domain - x0 = _mm_load_ps(&a[j]); - t0 = _mm_load_ps(&b[j]); - - t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(3, 3, 1, 1)); - t0 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(2, 2, 0, 0)); - t1 = _mm_mul_ps(t1, m); - - x1 = _mm_mul_ps(x0, t0); - x2 = _mm_mul_ps(x0, t1); - - x2 = _mm_shuffle_ps(x2, x2, _MM_SHUFFLE(2, 3, 0, 1)); - x2 = _mm_add_ps(x1, x2); - - _mm_store_ps(&c[j], x2); - } - - // Finish off the last one; do the complex multiply as floats - j = d_fftsize/2; - c[j] = (a[j] * b[j]) - (a[j+1] * b[j+1]); - c[j+1] = (a[j] * b[j+1]) + (a[j+1] * b[j]); - - d_invfft->execute(); // compute inv xform - - // add in the overlapping tail - - for (j = 0; j < tailsize(); j++) - d_invfft->get_outbuf()[j] += d_tail[j]; - - // copy nsamples to output - - //memcpy(out, d_invfft->get_outbuf(), d_nsamples * sizeof(float)); - //out += d_nsamples; - - j = dec_ctr; - while (j < d_nsamples) { - *output++ = d_invfft->get_outbuf()[j]; - j += d_decimation; - } - dec_ctr = (j - d_nsamples); - - // stash the tail - memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples, - tailsize() * sizeof(float)); - } - - assert(dec_ctr == 0); - - return nitems; -} diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h deleted file mode 100644 index b6086562d9..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h +++ /dev/null @@ -1,82 +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_GRI_FFT_FILTER_FFF_SSE_H -#define INCLUDED_GRI_FFT_FILTER_FFF_SSE_H - -#include <gr_core_api.h> -#include <gr_complex.h> -#include <vector> - -class gri_fft_real_fwd; -class gri_fft_real_rev; - -class GR_CORE_API gri_fft_filter_fff_sse -{ - private: - int d_ntaps; - int d_nsamples; - int d_fftsize; // fftsize = ntaps + nsamples - 1 - int d_decimation; - gri_fft_real_fwd *d_fwdfft; // forward "plan" - gri_fft_real_rev *d_invfft; // inverse "plan" - std::vector<float> d_tail; // state carried between blocks for overlap-add - //std::vector<gr_complex> d_xformed_taps; // Fourier xformed taps - gr_complex *d_xformed_taps; - std::vector<float> d_new_taps; - - - void compute_sizes(int ntaps); - int tailsize() const { return d_ntaps - 1; } - - public: - /*! - * \brief Construct a FFT filter for float vectors with the given taps and decimation rate. - * - * This is the basic implementation for performing FFT filter for fast convolution - * in other blocks for floating point vectors (such as gr_fft_filter_fff). - * \param decimation The decimation rate of the filter (int) - * \param taps The filter taps (float) - */ - gri_fft_filter_fff_sse (int decimation, const std::vector<float> &taps); - ~gri_fft_filter_fff_sse (); - - /*! - * \brief Set new taps for the filter. - * - * Sets new taps and resets the class properties to handle different sizes - * \param taps The filter taps (float) - */ - int set_taps (const std::vector<float> &taps); - - /*! - * \brief Perform the filter operation - * - * \param nitems The number of items to produce - * \param input The input vector to be filtered - * \param output The result of the filter operation - */ - int filter (int nitems, const float *input, float *output); - -}; - -#endif /* INCLUDED_GRI_FFT_FILTER_FFF_SSE_H */ diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t deleted file mode 100644 index 0ae644cc65..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t +++ /dev/null @@ -1,121 +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 <@NAME@.h> - -@NAME@::@NAME@(const std::vector<@TAP_TYPE@> &taps) -{ - d_buffer = NULL; - set_taps(taps); -} - -@NAME@::~@NAME@() -{ - if(d_buffer != NULL) - free(d_buffer); -} - -void -@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps) -{ - d_taps = gr_reverse(taps); - - if(d_buffer != NULL) { - free(d_buffer); - d_buffer = NULL; - } - - // FIXME: memalign this to 16-byte boundaries for SIMD later - size_t t = sizeof(@I_TYPE@) * 2 * d_taps.size(); - d_buffer = (@I_TYPE@*)malloc(t); - memset(d_buffer, 0x00, t); - d_idx = 0; -} - -@O_TYPE@ -@NAME@::filter (@I_TYPE@ input) -{ - unsigned int i; - - d_buffer[d_idx] = input; - d_buffer[d_idx+ntaps()] = input; - - // using the later for the case when ntaps=0; - // profiling shows this doesn't make a difference - //d_idx = (d_idx + 1) % ntaps(); - d_idx++; - if(d_idx >= ntaps()) - d_idx = 0; - - @ACC_TYPE@ out = 0; - for(i = 0; i < ntaps(); i++) { - out += @INPUT_CAST@ d_buffer[d_idx + i] * d_taps[i]; - } - return (@O_TYPE@)out; -} - -@O_TYPE@ -@NAME@::filter (const @I_TYPE@ input[], unsigned long dec) -{ - unsigned int i; - - for(i = 0; i < dec; i++) { - d_buffer[d_idx] = input[i]; - d_buffer[d_idx+ntaps()] = input[i]; - d_idx++; - if(d_idx >= ntaps()) - d_idx = 0; - } - - @ACC_TYPE@ out = 0; - for(i = 0; i < ntaps(); i++) { - out += @INPUT_CAST@ d_buffer[d_idx + i] * d_taps[i]; - } - return (@O_TYPE@)out; -} - -void -@NAME@::filterN (@O_TYPE@ output[], - const @I_TYPE@ input[], - unsigned long n) -{ - for(unsigned long i = 0; i < n; i++) { - output[i] = filter(input[i]); - } -} - -void -@NAME@::filterNdec (@O_TYPE@ output[], - const @I_TYPE@ input[], - unsigned long n, - unsigned long decimate) -{ - unsigned long j = 0; - for(unsigned long i = 0; i < n; i++) { - output[i] = filter(&input[j], decimate); - j += decimate; - } -} diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t deleted file mode 100644 index efb314bed0..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t +++ /dev/null @@ -1,132 +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. - */ - -/* - * WARNING: This file is automatically generated by generate_gri_fir_XXX.py - * Any changes made to this file will be overwritten. - */ - - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <vector> -#include <gr_types.h> -#include <gr_reverse.h> -#include <string.h> -#include <cstdio> - -/*! - * \brief FIR with internal buffer for @I_TYPE@ input, - @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter - * - */ - -class GR_CORE_API @NAME@ { - -protected: - std::vector<@TAP_TYPE@> d_taps; // reversed taps - @I_TYPE@ *d_buffer; - unsigned int d_idx; - -public: - - // CONSTRUCTORS - - /*! - * \brief construct new FIR with given taps. - * - * Note that taps must be in forward order, e.g., coefficient 0 is - * stored in new_taps[0], coefficient 1 is stored in - * new_taps[1], etc. - */ - @NAME@ (const std::vector<@TAP_TYPE@> &taps); - - ~@NAME@ (); - - // MANIPULATORS - - /*! - * \brief compute a single output value. - * - * \p input is a single input value of the filter type - * - * \returns the filtered input value. - */ - @O_TYPE@ filter (@I_TYPE@ input); - - - /*! - * \brief compute a single output value; designed for decimating filters. - * - * \p input is a single input value of the filter type. The value of dec is the - * decimating value of the filter, so input[] must have dec valid values. - * The filter pushes dec number of items onto the circ. buffer before computing - * a single output. - * - * \returns the filtered input value. - */ - @O_TYPE@ filter (const @I_TYPE@ input[], unsigned long dec); - - /*! - * \brief compute an array of N output values. - * - * \p input must have (n - 1 + ntaps()) valid entries. - * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values. - */ - void filterN (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n); - - /*! - * \brief compute an array of N output values, decimating the input - * - * \p input must have (decimate * (n - 1) + ntaps()) valid entries. - * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to - * compute the output values. - */ - void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n, unsigned long decimate); - - /*! - * \brief install \p new_taps as the current taps. - */ - void set_taps (const std::vector<@TAP_TYPE@> &taps); - - // ACCESSORS - - /*! - * \return number of taps in filter. - */ - unsigned ntaps () const { return d_taps.size (); } - - /*! - * \return current taps - */ - const std::vector<@TAP_TYPE@> get_taps () const - { - return gr_reverse(d_taps); - } -}; - -#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/filter/gri_iir.h b/gnuradio-core/src/lib/filter/gri_iir.h deleted file mode 100644 index 86345f6c09..0000000000 --- a/gnuradio-core/src/lib/filter/gri_iir.h +++ /dev/null @@ -1,177 +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_GRI_IIR_H -#define INCLUDED_GRI_IIR_H - -#include <gr_core_api.h> -#include <vector> -#include <stdexcept> - -/*! - * \brief base class template for Infinite Impulse Response filter (IIR) - */ -template<class i_type, class o_type, class tap_type> -class gri_iir { -public: - /*! - * \brief Construct an IIR with the given taps. - * - * This filter uses the Direct Form I implementation, where - * \p fftaps contains the feed-forward taps, and \p fbtaps the feedback ones. - * - * \p fftaps and \p fbtaps must have equal numbers of taps - * - * The input and output satisfy a difference equation of the form - - \f[ - y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k] - \f] - - * with the corresponding rational system function - - \f[ - H(z) = \frac{\sum_{k=0}^{N} b_k z^{-k}}{1 - \sum_{k=1}^{M} a_k z^{-k}} - \f] - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback taps. - */ - gri_iir (const std::vector<tap_type>& fftaps, - const std::vector<tap_type>& fbtaps) throw (std::invalid_argument) - { - set_taps (fftaps, fbtaps); - } - - gri_iir () : d_latest_n(0),d_latest_m(0) { } - - ~gri_iir () {} - - /*! - * \brief compute a single output value. - * \returns the filtered input value. - */ - o_type filter (const i_type input); - - /*! - * \brief compute an array of N output values. - * \p input must have N valid entries. - */ - void filter_n (o_type output[], const i_type input[], long n); - - /*! - * \return number of taps in filter. - */ - unsigned ntaps_ff () const { return d_fftaps.size (); } - unsigned ntaps_fb () const { return d_fbtaps.size (); } - - /*! - * \brief install new taps. - */ - void set_taps (const std::vector<tap_type> &fftaps, - const std::vector<tap_type> &fbtaps) throw (std::invalid_argument) - { - - - d_latest_n = 0; - d_latest_m = 0; - d_fftaps = fftaps; - d_fbtaps = fbtaps; - - int n = fftaps.size (); - int m = fbtaps.size (); - d_prev_input.resize (2 * n); - d_prev_output.resize (2 * m); - - for (int i = 0; i < 2 * n; i++){ - d_prev_input[i] = 0; - } - for (int i = 0; i < 2 * m; i++){ - d_prev_output[i] = 0; - } - } - -protected: - std::vector<tap_type> d_fftaps; - std::vector<tap_type> d_fbtaps; - int d_latest_n; - int d_latest_m; - std::vector<tap_type> d_prev_output; - std::vector<i_type> d_prev_input; -}; - - -// -// general case. We may want to specialize this -// -template<class i_type, class o_type, class tap_type> -o_type -gri_iir<i_type, o_type, tap_type>::filter (const i_type input) -{ - tap_type acc; - unsigned i = 0; - unsigned n = ntaps_ff (); - unsigned m = ntaps_fb (); - - if (n == 0) - return (o_type) 0; - - int latest_n = d_latest_n; - int latest_m = d_latest_m; - - acc = d_fftaps[0] * input; - for (i = 1; i < n; i ++) - acc += (d_fftaps[i] * d_prev_input[latest_n + i]); - for (i = 1; i < m; i ++) - acc += (d_fbtaps[i] * d_prev_output[latest_m + i]); - - // store the values twice to avoid having to handle wrap-around in the loop - d_prev_output[latest_m] = acc; - d_prev_output[latest_m+m] = acc; - d_prev_input[latest_n] = input; - d_prev_input[latest_n+n] = input; - - latest_n--; - latest_m--; - if (latest_n < 0) - latest_n += n; - if (latest_m < 0) - latest_m += m; - - d_latest_m = latest_m; - d_latest_n = latest_n; - return (o_type) acc; -} - - -template<class i_type, class o_type, class tap_type> -void -gri_iir<i_type, o_type, tap_type>::filter_n (o_type output[], - const i_type input[], - long n) -{ - for (int i = 0; i < n; i++) - output[i] = filter (input[i]); -} - -#endif /* INCLUDED_GRI_IIR_H */ - diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.cc b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.cc deleted file mode 100644 index 52098bf1aa..0000000000 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.cc +++ /dev/null @@ -1,71 +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 <gri_mmse_fir_interpolator.h> -#include <gr_fir_util.h> -#include <gr_fir_fff.h> -#include <assert.h> -#include <cmath> -#include "interpolator_taps.h" - -gri_mmse_fir_interpolator::gri_mmse_fir_interpolator () -{ - filters.resize (NSTEPS + 1); - - for (int i = 0; i < NSTEPS + 1; i++){ - std::vector<float> t (&taps[i][0], &taps[i][NTAPS]); - filters[i] = gr_fir_util::create_gr_fir_fff (t); - } -} - -gri_mmse_fir_interpolator::~gri_mmse_fir_interpolator () -{ - for (int i = 0; i < NSTEPS + 1; i++) - delete filters[i]; -} - -unsigned -gri_mmse_fir_interpolator::ntaps () const -{ - return NTAPS; -} - -unsigned -gri_mmse_fir_interpolator::nsteps () const -{ - return NSTEPS; -} - -float -gri_mmse_fir_interpolator::interpolate (const float input[], float mu) const -{ - int imu = (int) rint (mu * NSTEPS); - - assert (imu >= 0); - assert (imu <= NSTEPS); - - float r = filters[imu]->filter (input); - return r; -} diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h deleted file mode 100644 index f479169bc8..0000000000 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h +++ /dev/null @@ -1,71 +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 _GRI_MMSE_FIR_INTERPOLATOR_H_ -#define _GRI_MMSE_FIR_INTERPOLATOR_H_ - -#include <gr_core_api.h> -#include <vector> - -class gr_fir_fff; - -/*! - * \brief Compute intermediate samples between signal samples x(k*Ts) - * \ingroup filter_primitive - * - * This implements a Mininum Mean Squared Error interpolator with 8 taps. - * It is suitable for signals where the bandwidth of interest B = 1/(4*Ts) - * Where Ts is the time between samples. - * - * Although mu, the fractional delay, is specified as a float, it is actually - * quantized. 0.0 <= mu <= 1.0. That is, mu is quantized in the interpolate - * method to 32nd's of a sample. - * - * For more information, in the GNU Radio source code, see: - * \li gnuradio-core/src/gen_interpolator_taps/README - * \li gnuradio-core/src/gen_interpolator_taps/praxis.txt - */ - -class GR_CORE_API gri_mmse_fir_interpolator { -public: - gri_mmse_fir_interpolator (); - ~gri_mmse_fir_interpolator (); - - unsigned ntaps () const; - unsigned nsteps () const; - - /*! - * \brief compute a single interpolated output value. - * \p input must have ntaps() valid entries. - * input[0] .. input[ntaps() - 1] are referenced to compute the output value. - * - * \p mu must be in the range [0, 1] and specifies the fractional delay. - * - * \returns the interpolated input value. - */ - float interpolate (const float input[], float mu) const; - -protected: - std::vector<gr_fir_fff *> filters; -}; - - -#endif /* _GRI_MMSE_FIR_INTERPOLATOR_H_ */ diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.cc b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.cc deleted file mode 100644 index 174378c22a..0000000000 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.cc +++ /dev/null @@ -1,71 +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 <gri_mmse_fir_interpolator_cc.h> -#include <gr_fir_util.h> -#include <gr_fir_ccf.h> -#include <assert.h> -#include <cmath> -#include "interpolator_taps.h" - -gri_mmse_fir_interpolator_cc::gri_mmse_fir_interpolator_cc () -{ - filters.resize (NSTEPS + 1); - - for (int i = 0; i < NSTEPS + 1; i++){ - std::vector<float> t (&taps[i][0], &taps[i][NTAPS]); - filters[i] = gr_fir_util::create_gr_fir_ccf (t); - } -} - -gri_mmse_fir_interpolator_cc::~gri_mmse_fir_interpolator_cc () -{ - for (int i = 0; i < NSTEPS + 1; i++) - delete filters[i]; -} - -unsigned -gri_mmse_fir_interpolator_cc::ntaps () const -{ - return NTAPS; -} - -unsigned -gri_mmse_fir_interpolator_cc::nsteps () const -{ - return NSTEPS; -} - -gr_complex -gri_mmse_fir_interpolator_cc::interpolate (const gr_complex input[], float mu) -{ - int imu = (int) rint (mu * NSTEPS); - - assert (imu >= 0); - assert (imu <= NSTEPS); - - gr_complex r = filters[imu]->filter (input); - return r; -} diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h deleted file mode 100644 index bacd9ed92a..0000000000 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 _GRI_MMSE_FIR_INTERPOLATOR_CC_H_ -#define _GRI_MMSE_FIR_INTERPOLATOR_CC_H_ - -#include <gr_core_api.h> -#include <gr_complex.h> -#include <vector> - -class gr_fir_ccf; - -/*! - * \brief Compute intermediate samples between signal samples x(k*Ts) - * \ingroup filter_primitive - * - * This implements a Mininum Mean Squared Error interpolator with 8 taps. - * It is suitable for signals where the bandwidth of interest B = 1/(4*Ts) - * Where Ts is the time between samples. - * - * Although mu, the fractional delay, is specified as a float, it is actually - * quantized. 0.0 <= mu <= 1.0. That is, mu is quantized in the interpolate - * method to 32nd's of a sample. - * - * For more information, in the GNU Radio source code, see: - * \li gnuradio-core/src/gen_interpolator_taps/README - * \li gnuradio-core/src/gen_interpolator_taps/praxis.txt - */ - -class GR_CORE_API gri_mmse_fir_interpolator_cc { -public: - gri_mmse_fir_interpolator_cc (); - ~gri_mmse_fir_interpolator_cc (); - - unsigned ntaps () const; - unsigned nsteps () const; - - /*! - * \brief compute a single interpolated output value. - * - * \p input must have ntaps() valid entries and be 8-byte aligned. - * input[0] .. input[ntaps() - 1] are referenced to compute the output value. - * \throws std::invalid_argument if input is not 8-byte aligned. - * - * \p mu must be in the range [0, 1] and specifies the fractional delay. - * - * \returns the interpolated input value. - */ - gr_complex interpolate (const gr_complex input[], float mu); - -protected: - std::vector<gr_fir_ccf *> filters; -}; - - -#endif /* _GRI_MMSE_FIR_INTERPOLATOR_CC_H_ */ diff --git a/gnuradio-core/src/lib/filter/interpolator_taps.h b/gnuradio-core/src/lib/filter/interpolator_taps.h deleted file mode 100644 index 76702b63fa..0000000000 --- a/gnuradio-core/src/lib/filter/interpolator_taps.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This file was machine generated by gen_interpolator_taps. - * DO NOT EDIT BY HAND. - */ - -static const int NTAPS = 8; -static const int NSTEPS = 128; - -static const float taps[NSTEPS+1][NTAPS] = { - // -4 -3 -2 -1 0 1 2 3 mu - { 0.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00, 1.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00 }, // 0/128 - { -1.54700e-04, 8.53777e-04, -2.76968e-03, 7.89295e-03, 9.98534e-01, -5.41054e-03, 1.24642e-03, -1.98993e-04 }, // 1/128 - { -3.09412e-04, 1.70888e-03, -5.55134e-03, 1.58840e-02, 9.96891e-01, -1.07209e-02, 2.47942e-03, -3.96391e-04 }, // 2/128 - { -4.64053e-04, 2.56486e-03, -8.34364e-03, 2.39714e-02, 9.95074e-01, -1.59305e-02, 3.69852e-03, -5.92100e-04 }, // 3/128 - { -6.18544e-04, 3.42130e-03, -1.11453e-02, 3.21531e-02, 9.93082e-01, -2.10389e-02, 4.90322e-03, -7.86031e-04 }, // 4/128 - { -7.72802e-04, 4.27773e-03, -1.39548e-02, 4.04274e-02, 9.90917e-01, -2.60456e-02, 6.09305e-03, -9.78093e-04 }, // 5/128 - { -9.26747e-04, 5.13372e-03, -1.67710e-02, 4.87921e-02, 9.88580e-01, -3.09503e-02, 7.26755e-03, -1.16820e-03 }, // 6/128 - { -1.08030e-03, 5.98883e-03, -1.95925e-02, 5.72454e-02, 9.86071e-01, -3.57525e-02, 8.42626e-03, -1.35627e-03 }, // 7/128 - { -1.23337e-03, 6.84261e-03, -2.24178e-02, 6.57852e-02, 9.83392e-01, -4.04519e-02, 9.56876e-03, -1.54221e-03 }, // 8/128 - { -1.38589e-03, 7.69462e-03, -2.52457e-02, 7.44095e-02, 9.80543e-01, -4.50483e-02, 1.06946e-02, -1.72594e-03 }, // 9/128 - { -1.53777e-03, 8.54441e-03, -2.80746e-02, 8.31162e-02, 9.77526e-01, -4.95412e-02, 1.18034e-02, -1.90738e-03 }, // 10/128 - { -1.68894e-03, 9.39154e-03, -3.09033e-02, 9.19033e-02, 9.74342e-01, -5.39305e-02, 1.28947e-02, -2.08645e-03 }, // 11/128 - { -1.83931e-03, 1.02356e-02, -3.37303e-02, 1.00769e-01, 9.70992e-01, -5.82159e-02, 1.39681e-02, -2.26307e-03 }, // 12/128 - { -1.98880e-03, 1.10760e-02, -3.65541e-02, 1.09710e-01, 9.67477e-01, -6.23972e-02, 1.50233e-02, -2.43718e-03 }, // 13/128 - { -2.13733e-03, 1.19125e-02, -3.93735e-02, 1.18725e-01, 9.63798e-01, -6.64743e-02, 1.60599e-02, -2.60868e-03 }, // 14/128 - { -2.28483e-03, 1.27445e-02, -4.21869e-02, 1.27812e-01, 9.59958e-01, -7.04471e-02, 1.70776e-02, -2.77751e-03 }, // 15/128 - { -2.43121e-03, 1.35716e-02, -4.49929e-02, 1.36968e-01, 9.55956e-01, -7.43154e-02, 1.80759e-02, -2.94361e-03 }, // 16/128 - { -2.57640e-03, 1.43934e-02, -4.77900e-02, 1.46192e-01, 9.51795e-01, -7.80792e-02, 1.90545e-02, -3.10689e-03 }, // 17/128 - { -2.72032e-03, 1.52095e-02, -5.05770e-02, 1.55480e-01, 9.47477e-01, -8.17385e-02, 2.00132e-02, -3.26730e-03 }, // 18/128 - { -2.86289e-03, 1.60193e-02, -5.33522e-02, 1.64831e-01, 9.43001e-01, -8.52933e-02, 2.09516e-02, -3.42477e-03 }, // 19/128 - { -3.00403e-03, 1.68225e-02, -5.61142e-02, 1.74242e-01, 9.38371e-01, -8.87435e-02, 2.18695e-02, -3.57923e-03 }, // 20/128 - { -3.14367e-03, 1.76185e-02, -5.88617e-02, 1.83711e-01, 9.33586e-01, -9.20893e-02, 2.27664e-02, -3.73062e-03 }, // 21/128 - { -3.28174e-03, 1.84071e-02, -6.15931e-02, 1.93236e-01, 9.28650e-01, -9.53307e-02, 2.36423e-02, -3.87888e-03 }, // 22/128 - { -3.41815e-03, 1.91877e-02, -6.43069e-02, 2.02814e-01, 9.23564e-01, -9.84679e-02, 2.44967e-02, -4.02397e-03 }, // 23/128 - { -3.55283e-03, 1.99599e-02, -6.70018e-02, 2.12443e-01, 9.18329e-01, -1.01501e-01, 2.53295e-02, -4.16581e-03 }, // 24/128 - { -3.68570e-03, 2.07233e-02, -6.96762e-02, 2.22120e-01, 9.12947e-01, -1.04430e-01, 2.61404e-02, -4.30435e-03 }, // 25/128 - { -3.81671e-03, 2.14774e-02, -7.23286e-02, 2.31843e-01, 9.07420e-01, -1.07256e-01, 2.69293e-02, -4.43955e-03 }, // 26/128 - { -3.94576e-03, 2.22218e-02, -7.49577e-02, 2.41609e-01, 9.01749e-01, -1.09978e-01, 2.76957e-02, -4.57135e-03 }, // 27/128 - { -4.07279e-03, 2.29562e-02, -7.75620e-02, 2.51417e-01, 8.95936e-01, -1.12597e-01, 2.84397e-02, -4.69970e-03 }, // 28/128 - { -4.19774e-03, 2.36801e-02, -8.01399e-02, 2.61263e-01, 8.89984e-01, -1.15113e-01, 2.91609e-02, -4.82456e-03 }, // 29/128 - { -4.32052e-03, 2.43930e-02, -8.26900e-02, 2.71144e-01, 8.83893e-01, -1.17526e-01, 2.98593e-02, -4.94589e-03 }, // 30/128 - { -4.44107e-03, 2.50946e-02, -8.52109e-02, 2.81060e-01, 8.77666e-01, -1.19837e-01, 3.05345e-02, -5.06363e-03 }, // 31/128 - { -4.55932e-03, 2.57844e-02, -8.77011e-02, 2.91006e-01, 8.71305e-01, -1.22047e-01, 3.11866e-02, -5.17776e-03 }, // 32/128 - { -4.67520e-03, 2.64621e-02, -9.01591e-02, 3.00980e-01, 8.64812e-01, -1.24154e-01, 3.18153e-02, -5.28823e-03 }, // 33/128 - { -4.78866e-03, 2.71272e-02, -9.25834e-02, 3.10980e-01, 8.58189e-01, -1.26161e-01, 3.24205e-02, -5.39500e-03 }, // 34/128 - { -4.89961e-03, 2.77794e-02, -9.49727e-02, 3.21004e-01, 8.51437e-01, -1.28068e-01, 3.30021e-02, -5.49804e-03 }, // 35/128 - { -5.00800e-03, 2.84182e-02, -9.73254e-02, 3.31048e-01, 8.44559e-01, -1.29874e-01, 3.35600e-02, -5.59731e-03 }, // 36/128 - { -5.11376e-03, 2.90433e-02, -9.96402e-02, 3.41109e-01, 8.37557e-01, -1.31581e-01, 3.40940e-02, -5.69280e-03 }, // 37/128 - { -5.21683e-03, 2.96543e-02, -1.01915e-01, 3.51186e-01, 8.30432e-01, -1.33189e-01, 3.46042e-02, -5.78446e-03 }, // 38/128 - { -5.31716e-03, 3.02507e-02, -1.04150e-01, 3.61276e-01, 8.23188e-01, -1.34699e-01, 3.50903e-02, -5.87227e-03 }, // 39/128 - { -5.41467e-03, 3.08323e-02, -1.06342e-01, 3.71376e-01, 8.15826e-01, -1.36111e-01, 3.55525e-02, -5.95620e-03 }, // 40/128 - { -5.50931e-03, 3.13987e-02, -1.08490e-01, 3.81484e-01, 8.08348e-01, -1.37426e-01, 3.59905e-02, -6.03624e-03 }, // 41/128 - { -5.60103e-03, 3.19495e-02, -1.10593e-01, 3.91596e-01, 8.00757e-01, -1.38644e-01, 3.64044e-02, -6.11236e-03 }, // 42/128 - { -5.68976e-03, 3.24843e-02, -1.12650e-01, 4.01710e-01, 7.93055e-01, -1.39767e-01, 3.67941e-02, -6.18454e-03 }, // 43/128 - { -5.77544e-03, 3.30027e-02, -1.14659e-01, 4.11823e-01, 7.85244e-01, -1.40794e-01, 3.71596e-02, -6.25277e-03 }, // 44/128 - { -5.85804e-03, 3.35046e-02, -1.16618e-01, 4.21934e-01, 7.77327e-01, -1.41727e-01, 3.75010e-02, -6.31703e-03 }, // 45/128 - { -5.93749e-03, 3.39894e-02, -1.18526e-01, 4.32038e-01, 7.69305e-01, -1.42566e-01, 3.78182e-02, -6.37730e-03 }, // 46/128 - { -6.01374e-03, 3.44568e-02, -1.20382e-01, 4.42134e-01, 7.61181e-01, -1.43313e-01, 3.81111e-02, -6.43358e-03 }, // 47/128 - { -6.08674e-03, 3.49066e-02, -1.22185e-01, 4.52218e-01, 7.52958e-01, -1.43968e-01, 3.83800e-02, -6.48585e-03 }, // 48/128 - { -6.15644e-03, 3.53384e-02, -1.23933e-01, 4.62289e-01, 7.44637e-01, -1.44531e-01, 3.86247e-02, -6.53412e-03 }, // 49/128 - { -6.22280e-03, 3.57519e-02, -1.25624e-01, 4.72342e-01, 7.36222e-01, -1.45004e-01, 3.88454e-02, -6.57836e-03 }, // 50/128 - { -6.28577e-03, 3.61468e-02, -1.27258e-01, 4.82377e-01, 7.27714e-01, -1.45387e-01, 3.90420e-02, -6.61859e-03 }, // 51/128 - { -6.34530e-03, 3.65227e-02, -1.28832e-01, 4.92389e-01, 7.19116e-01, -1.45682e-01, 3.92147e-02, -6.65479e-03 }, // 52/128 - { -6.40135e-03, 3.68795e-02, -1.30347e-01, 5.02377e-01, 7.10431e-01, -1.45889e-01, 3.93636e-02, -6.68698e-03 }, // 53/128 - { -6.45388e-03, 3.72167e-02, -1.31800e-01, 5.12337e-01, 7.01661e-01, -1.46009e-01, 3.94886e-02, -6.71514e-03 }, // 54/128 - { -6.50285e-03, 3.75341e-02, -1.33190e-01, 5.22267e-01, 6.92808e-01, -1.46043e-01, 3.95900e-02, -6.73929e-03 }, // 55/128 - { -6.54823e-03, 3.78315e-02, -1.34515e-01, 5.32164e-01, 6.83875e-01, -1.45993e-01, 3.96678e-02, -6.75943e-03 }, // 56/128 - { -6.58996e-03, 3.81085e-02, -1.35775e-01, 5.42025e-01, 6.74865e-01, -1.45859e-01, 3.97222e-02, -6.77557e-03 }, // 57/128 - { -6.62802e-03, 3.83650e-02, -1.36969e-01, 5.51849e-01, 6.65779e-01, -1.45641e-01, 3.97532e-02, -6.78771e-03 }, // 58/128 - { -6.66238e-03, 3.86006e-02, -1.38094e-01, 5.61631e-01, 6.56621e-01, -1.45343e-01, 3.97610e-02, -6.79588e-03 }, // 59/128 - { -6.69300e-03, 3.88151e-02, -1.39150e-01, 5.71370e-01, 6.47394e-01, -1.44963e-01, 3.97458e-02, -6.80007e-03 }, // 60/128 - { -6.71985e-03, 3.90083e-02, -1.40136e-01, 5.81063e-01, 6.38099e-01, -1.44503e-01, 3.97077e-02, -6.80032e-03 }, // 61/128 - { -6.74291e-03, 3.91800e-02, -1.41050e-01, 5.90706e-01, 6.28739e-01, -1.43965e-01, 3.96469e-02, -6.79662e-03 }, // 62/128 - { -6.76214e-03, 3.93299e-02, -1.41891e-01, 6.00298e-01, 6.19318e-01, -1.43350e-01, 3.95635e-02, -6.78902e-03 }, // 63/128 - { -6.77751e-03, 3.94578e-02, -1.42658e-01, 6.09836e-01, 6.09836e-01, -1.42658e-01, 3.94578e-02, -6.77751e-03 }, // 64/128 - { -6.78902e-03, 3.95635e-02, -1.43350e-01, 6.19318e-01, 6.00298e-01, -1.41891e-01, 3.93299e-02, -6.76214e-03 }, // 65/128 - { -6.79662e-03, 3.96469e-02, -1.43965e-01, 6.28739e-01, 5.90706e-01, -1.41050e-01, 3.91800e-02, -6.74291e-03 }, // 66/128 - { -6.80032e-03, 3.97077e-02, -1.44503e-01, 6.38099e-01, 5.81063e-01, -1.40136e-01, 3.90083e-02, -6.71985e-03 }, // 67/128 - { -6.80007e-03, 3.97458e-02, -1.44963e-01, 6.47394e-01, 5.71370e-01, -1.39150e-01, 3.88151e-02, -6.69300e-03 }, // 68/128 - { -6.79588e-03, 3.97610e-02, -1.45343e-01, 6.56621e-01, 5.61631e-01, -1.38094e-01, 3.86006e-02, -6.66238e-03 }, // 69/128 - { -6.78771e-03, 3.97532e-02, -1.45641e-01, 6.65779e-01, 5.51849e-01, -1.36969e-01, 3.83650e-02, -6.62802e-03 }, // 70/128 - { -6.77557e-03, 3.97222e-02, -1.45859e-01, 6.74865e-01, 5.42025e-01, -1.35775e-01, 3.81085e-02, -6.58996e-03 }, // 71/128 - { -6.75943e-03, 3.96678e-02, -1.45993e-01, 6.83875e-01, 5.32164e-01, -1.34515e-01, 3.78315e-02, -6.54823e-03 }, // 72/128 - { -6.73929e-03, 3.95900e-02, -1.46043e-01, 6.92808e-01, 5.22267e-01, -1.33190e-01, 3.75341e-02, -6.50285e-03 }, // 73/128 - { -6.71514e-03, 3.94886e-02, -1.46009e-01, 7.01661e-01, 5.12337e-01, -1.31800e-01, 3.72167e-02, -6.45388e-03 }, // 74/128 - { -6.68698e-03, 3.93636e-02, -1.45889e-01, 7.10431e-01, 5.02377e-01, -1.30347e-01, 3.68795e-02, -6.40135e-03 }, // 75/128 - { -6.65479e-03, 3.92147e-02, -1.45682e-01, 7.19116e-01, 4.92389e-01, -1.28832e-01, 3.65227e-02, -6.34530e-03 }, // 76/128 - { -6.61859e-03, 3.90420e-02, -1.45387e-01, 7.27714e-01, 4.82377e-01, -1.27258e-01, 3.61468e-02, -6.28577e-03 }, // 77/128 - { -6.57836e-03, 3.88454e-02, -1.45004e-01, 7.36222e-01, 4.72342e-01, -1.25624e-01, 3.57519e-02, -6.22280e-03 }, // 78/128 - { -6.53412e-03, 3.86247e-02, -1.44531e-01, 7.44637e-01, 4.62289e-01, -1.23933e-01, 3.53384e-02, -6.15644e-03 }, // 79/128 - { -6.48585e-03, 3.83800e-02, -1.43968e-01, 7.52958e-01, 4.52218e-01, -1.22185e-01, 3.49066e-02, -6.08674e-03 }, // 80/128 - { -6.43358e-03, 3.81111e-02, -1.43313e-01, 7.61181e-01, 4.42134e-01, -1.20382e-01, 3.44568e-02, -6.01374e-03 }, // 81/128 - { -6.37730e-03, 3.78182e-02, -1.42566e-01, 7.69305e-01, 4.32038e-01, -1.18526e-01, 3.39894e-02, -5.93749e-03 }, // 82/128 - { -6.31703e-03, 3.75010e-02, -1.41727e-01, 7.77327e-01, 4.21934e-01, -1.16618e-01, 3.35046e-02, -5.85804e-03 }, // 83/128 - { -6.25277e-03, 3.71596e-02, -1.40794e-01, 7.85244e-01, 4.11823e-01, -1.14659e-01, 3.30027e-02, -5.77544e-03 }, // 84/128 - { -6.18454e-03, 3.67941e-02, -1.39767e-01, 7.93055e-01, 4.01710e-01, -1.12650e-01, 3.24843e-02, -5.68976e-03 }, // 85/128 - { -6.11236e-03, 3.64044e-02, -1.38644e-01, 8.00757e-01, 3.91596e-01, -1.10593e-01, 3.19495e-02, -5.60103e-03 }, // 86/128 - { -6.03624e-03, 3.59905e-02, -1.37426e-01, 8.08348e-01, 3.81484e-01, -1.08490e-01, 3.13987e-02, -5.50931e-03 }, // 87/128 - { -5.95620e-03, 3.55525e-02, -1.36111e-01, 8.15826e-01, 3.71376e-01, -1.06342e-01, 3.08323e-02, -5.41467e-03 }, // 88/128 - { -5.87227e-03, 3.50903e-02, -1.34699e-01, 8.23188e-01, 3.61276e-01, -1.04150e-01, 3.02507e-02, -5.31716e-03 }, // 89/128 - { -5.78446e-03, 3.46042e-02, -1.33189e-01, 8.30432e-01, 3.51186e-01, -1.01915e-01, 2.96543e-02, -5.21683e-03 }, // 90/128 - { -5.69280e-03, 3.40940e-02, -1.31581e-01, 8.37557e-01, 3.41109e-01, -9.96402e-02, 2.90433e-02, -5.11376e-03 }, // 91/128 - { -5.59731e-03, 3.35600e-02, -1.29874e-01, 8.44559e-01, 3.31048e-01, -9.73254e-02, 2.84182e-02, -5.00800e-03 }, // 92/128 - { -5.49804e-03, 3.30021e-02, -1.28068e-01, 8.51437e-01, 3.21004e-01, -9.49727e-02, 2.77794e-02, -4.89961e-03 }, // 93/128 - { -5.39500e-03, 3.24205e-02, -1.26161e-01, 8.58189e-01, 3.10980e-01, -9.25834e-02, 2.71272e-02, -4.78866e-03 }, // 94/128 - { -5.28823e-03, 3.18153e-02, -1.24154e-01, 8.64812e-01, 3.00980e-01, -9.01591e-02, 2.64621e-02, -4.67520e-03 }, // 95/128 - { -5.17776e-03, 3.11866e-02, -1.22047e-01, 8.71305e-01, 2.91006e-01, -8.77011e-02, 2.57844e-02, -4.55932e-03 }, // 96/128 - { -5.06363e-03, 3.05345e-02, -1.19837e-01, 8.77666e-01, 2.81060e-01, -8.52109e-02, 2.50946e-02, -4.44107e-03 }, // 97/128 - { -4.94589e-03, 2.98593e-02, -1.17526e-01, 8.83893e-01, 2.71144e-01, -8.26900e-02, 2.43930e-02, -4.32052e-03 }, // 98/128 - { -4.82456e-03, 2.91609e-02, -1.15113e-01, 8.89984e-01, 2.61263e-01, -8.01399e-02, 2.36801e-02, -4.19774e-03 }, // 99/128 - { -4.69970e-03, 2.84397e-02, -1.12597e-01, 8.95936e-01, 2.51417e-01, -7.75620e-02, 2.29562e-02, -4.07279e-03 }, // 100/128 - { -4.57135e-03, 2.76957e-02, -1.09978e-01, 9.01749e-01, 2.41609e-01, -7.49577e-02, 2.22218e-02, -3.94576e-03 }, // 101/128 - { -4.43955e-03, 2.69293e-02, -1.07256e-01, 9.07420e-01, 2.31843e-01, -7.23286e-02, 2.14774e-02, -3.81671e-03 }, // 102/128 - { -4.30435e-03, 2.61404e-02, -1.04430e-01, 9.12947e-01, 2.22120e-01, -6.96762e-02, 2.07233e-02, -3.68570e-03 }, // 103/128 - { -4.16581e-03, 2.53295e-02, -1.01501e-01, 9.18329e-01, 2.12443e-01, -6.70018e-02, 1.99599e-02, -3.55283e-03 }, // 104/128 - { -4.02397e-03, 2.44967e-02, -9.84679e-02, 9.23564e-01, 2.02814e-01, -6.43069e-02, 1.91877e-02, -3.41815e-03 }, // 105/128 - { -3.87888e-03, 2.36423e-02, -9.53307e-02, 9.28650e-01, 1.93236e-01, -6.15931e-02, 1.84071e-02, -3.28174e-03 }, // 106/128 - { -3.73062e-03, 2.27664e-02, -9.20893e-02, 9.33586e-01, 1.83711e-01, -5.88617e-02, 1.76185e-02, -3.14367e-03 }, // 107/128 - { -3.57923e-03, 2.18695e-02, -8.87435e-02, 9.38371e-01, 1.74242e-01, -5.61142e-02, 1.68225e-02, -3.00403e-03 }, // 108/128 - { -3.42477e-03, 2.09516e-02, -8.52933e-02, 9.43001e-01, 1.64831e-01, -5.33522e-02, 1.60193e-02, -2.86289e-03 }, // 109/128 - { -3.26730e-03, 2.00132e-02, -8.17385e-02, 9.47477e-01, 1.55480e-01, -5.05770e-02, 1.52095e-02, -2.72032e-03 }, // 110/128 - { -3.10689e-03, 1.90545e-02, -7.80792e-02, 9.51795e-01, 1.46192e-01, -4.77900e-02, 1.43934e-02, -2.57640e-03 }, // 111/128 - { -2.94361e-03, 1.80759e-02, -7.43154e-02, 9.55956e-01, 1.36968e-01, -4.49929e-02, 1.35716e-02, -2.43121e-03 }, // 112/128 - { -2.77751e-03, 1.70776e-02, -7.04471e-02, 9.59958e-01, 1.27812e-01, -4.21869e-02, 1.27445e-02, -2.28483e-03 }, // 113/128 - { -2.60868e-03, 1.60599e-02, -6.64743e-02, 9.63798e-01, 1.18725e-01, -3.93735e-02, 1.19125e-02, -2.13733e-03 }, // 114/128 - { -2.43718e-03, 1.50233e-02, -6.23972e-02, 9.67477e-01, 1.09710e-01, -3.65541e-02, 1.10760e-02, -1.98880e-03 }, // 115/128 - { -2.26307e-03, 1.39681e-02, -5.82159e-02, 9.70992e-01, 1.00769e-01, -3.37303e-02, 1.02356e-02, -1.83931e-03 }, // 116/128 - { -2.08645e-03, 1.28947e-02, -5.39305e-02, 9.74342e-01, 9.19033e-02, -3.09033e-02, 9.39154e-03, -1.68894e-03 }, // 117/128 - { -1.90738e-03, 1.18034e-02, -4.95412e-02, 9.77526e-01, 8.31162e-02, -2.80746e-02, 8.54441e-03, -1.53777e-03 }, // 118/128 - { -1.72594e-03, 1.06946e-02, -4.50483e-02, 9.80543e-01, 7.44095e-02, -2.52457e-02, 7.69462e-03, -1.38589e-03 }, // 119/128 - { -1.54221e-03, 9.56876e-03, -4.04519e-02, 9.83392e-01, 6.57852e-02, -2.24178e-02, 6.84261e-03, -1.23337e-03 }, // 120/128 - { -1.35627e-03, 8.42626e-03, -3.57525e-02, 9.86071e-01, 5.72454e-02, -1.95925e-02, 5.98883e-03, -1.08030e-03 }, // 121/128 - { -1.16820e-03, 7.26755e-03, -3.09503e-02, 9.88580e-01, 4.87921e-02, -1.67710e-02, 5.13372e-03, -9.26747e-04 }, // 122/128 - { -9.78093e-04, 6.09305e-03, -2.60456e-02, 9.90917e-01, 4.04274e-02, -1.39548e-02, 4.27773e-03, -7.72802e-04 }, // 123/128 - { -7.86031e-04, 4.90322e-03, -2.10389e-02, 9.93082e-01, 3.21531e-02, -1.11453e-02, 3.42130e-03, -6.18544e-04 }, // 124/128 - { -5.92100e-04, 3.69852e-03, -1.59305e-02, 9.95074e-01, 2.39714e-02, -8.34364e-03, 2.56486e-03, -4.64053e-04 }, // 125/128 - { -3.96391e-04, 2.47942e-03, -1.07209e-02, 9.96891e-01, 1.58840e-02, -5.55134e-03, 1.70888e-03, -3.09412e-04 }, // 126/128 - { -1.98993e-04, 1.24642e-03, -5.41054e-03, 9.98534e-01, 7.89295e-03, -2.76968e-03, 8.53777e-04, -1.54700e-04 }, // 127/128 - { 0.00000e+00, 0.00000e+00, 0.00000e+00, 1.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00 }, // 128/128 -}; - diff --git a/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.cc deleted file mode 100644 index 0d7b878da5..0000000000 --- a/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.cc +++ /dev/null @@ -1,341 +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_ccomplex_dotprod_x86.h> -#include <ccomplex_dotprod_x86.h> -#include <string.h> -#include <iostream> -#include <malloc16.h> -#include <sse_debug.h> -#include <cmath> -#include <gr_cpu.h> -#include <random.h> - -using std::cerr; - -/// Macro for primitive value comparisons -#define assertcomplexEqual(expected0,expected1,actual,delta) \ - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected0, actual[0], delta); \ - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected1, actual[1], delta); - - -#define MAX_BLKS 10 -#define FLOATS_PER_BLK 4 - -#define ERR_DELTA (1e-6) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = rint (uniform () * 32767); -} - -static void -zero_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = 0.0; -} - -void -ref_ccomplex_dotprod (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, - float *result) -{ - float sum0[2] = {0,0}; - float sum1[2] = {0,0}; - - do { - - sum0[0] += input[0] * taps[0] - input[1] * taps[1]; - sum0[1] += input[0] * taps[1] + input[1] * taps[0]; - sum1[0] += input[2] * taps[2] - input[3] * taps[3]; - sum1[1] += input[2] * taps[3] + input[3] * taps[2]; - - input += 4; - taps += 4; - - } while (--n_2_ccomplex_blocks != 0); - - - result[0] = sum0[0] + sum1[0]; - result[1] = sum0[1] + sum1[1]; -} - -void -qa_ccomplex_dotprod_x86::setUp () -{ - taps = (float *) calloc16Align (MAX_BLKS, - sizeof (float) * FLOATS_PER_BLK); - - input = (float *) calloc16Align (MAX_BLKS, - sizeof (float) * FLOATS_PER_BLK); - - if (taps == 0 || input == 0) - abort (); -} - -void -qa_ccomplex_dotprod_x86::tearDown () -{ - free16Align (taps); - free16Align (input); - taps = 0; - input = 0; -} - - -void -qa_ccomplex_dotprod_x86::zb () // "zero both" -{ - zero_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - zero_floats (input, MAX_BLKS * FLOATS_PER_BLK); -} - -// -// t1 -// - -void -qa_ccomplex_dotprod_x86::t1_base (ccomplex_dotprod_t ccomplex_dotprod) -{ - float result[2]; - - // cerr << "Testing dump_xmm_regs\n"; - // dump_xmm_regs (); - - // test basic cases, 1 block - - zb (); - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (0.0, 0.0, result, ERR_DELTA); - - // vary each input - - zb (); - input[0] = 1.0; taps[0] = 1.0; taps[1] = -1.0; - ccomplex_dotprod (input, taps, 1, result); - //cerr << result[0] << " " << result[1] << "\n"; - assertcomplexEqual (1.0, -1.0, result, ERR_DELTA); - - zb (); - input[1] = 2.0; taps[0] = 1.0; taps[1] = -1.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (2.0, 2.0, result, ERR_DELTA); - - zb (); - input[2] = 3.0; taps[2] = 1.0; taps[3] = -1.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (3.0, -3.0, result, ERR_DELTA); - - zb (); - input[3] = 4.0; taps[2] = 1.0; taps[3] = -1.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (4.0, 4.0, result, ERR_DELTA); - - // vary each tap - - zb (); - input[0] = 1.0; taps[0] = 0.5; taps[1] = -0.5; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (0.5, -0.5, result, ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 2.0; taps[1] = -2.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (2.0, -2.0, result, ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 3.0; taps[1] = -3.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (3.0, -3.0, result, ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 4.0; taps[1] = -4.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (4.0, -4.0, result, ERR_DELTA); -} - -// -// t2 -// -void -qa_ccomplex_dotprod_x86::t2_base (ccomplex_dotprod_t ccomplex_dotprod) -{ - float result[2]; - - zb (); - input[0] = 1.0; input[1] = 3.0; taps[0] = 5.0; taps[1] = -2.0; - - //1*5-3*-2 =11, 1*-2+3*5=13 - - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (11.0, 13.0, result, ERR_DELTA); - - //7*5-13*-5 =100, 7*-5+13*5=30 - - input[2] = 7.0; input[3] = 13.0; taps[2] = 5.0; taps[3] = -5.0; - - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (111.0, 43.0, result, ERR_DELTA); - - input[4] = 19; input[5] = -19; taps[4] = 23.0; taps[5] = -23.0; - - //19*23--19*-23 =0, 19*-23+-19*23=-874 - - ccomplex_dotprod (input, taps, 2, result); - assertcomplexEqual (111.0, -831.0, result, ERR_DELTA); - -} - -// -// t3 -// -void -qa_ccomplex_dotprod_x86::t3_base (ccomplex_dotprod_t ccomplex_dotprod) -{ - srandom (0); // we want reproducibility - - for (unsigned int i = 0; i < 10; i++){ - random_floats (input, MAX_BLKS * FLOATS_PER_BLK); - random_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - float ref[2]; - ref_ccomplex_dotprod (input, taps, MAX_BLKS, ref); - float calc[2]; - ccomplex_dotprod (input, taps, MAX_BLKS, calc); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[0], - calc[0], - fabs (ref[0]) * 1e-4); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[1], - calc[1], - fabs (ref[1]) * 1e-4); - } -} - -void -qa_ccomplex_dotprod_x86::t1_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t1_base (ccomplex_dotprod_3dnowext); -} - -void -qa_ccomplex_dotprod_x86::t2_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t2_base (ccomplex_dotprod_3dnowext); -} - -void -qa_ccomplex_dotprod_x86::t3_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t3_base (ccomplex_dotprod_3dnowext); -} - -void -qa_ccomplex_dotprod_x86::t1_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t1_base (ccomplex_dotprod_3dnow); -} - -void -qa_ccomplex_dotprod_x86::t2_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t2_base (ccomplex_dotprod_3dnow); -} - -void -qa_ccomplex_dotprod_x86::t3_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t3_base (ccomplex_dotprod_3dnow); -} - -void -qa_ccomplex_dotprod_x86::t1_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t1_base (ccomplex_dotprod_sse); -} - -void -qa_ccomplex_dotprod_x86::t2_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t2_base (ccomplex_dotprod_sse); -} - -void -qa_ccomplex_dotprod_x86::t3_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t3_base (ccomplex_dotprod_sse); -} - diff --git a/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.h b/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.h deleted file mode 100644 index d24561c72b..0000000000 --- a/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.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 _QA_CCOMPLEX_DOTPROD_X86_H_ -#define _QA_CCOMPLEX_DOTPROD_X86_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_ccomplex_dotprod_x86 : public CppUnit::TestCase { - public: - void setUp (); - void tearDown (); - - CPPUNIT_TEST_SUITE (qa_ccomplex_dotprod_x86); - CPPUNIT_TEST (t1_3dnowext); - CPPUNIT_TEST (t2_3dnowext); - CPPUNIT_TEST (t3_3dnowext); - CPPUNIT_TEST (t1_3dnow); - CPPUNIT_TEST (t2_3dnow); - CPPUNIT_TEST (t3_3dnow); - CPPUNIT_TEST (t1_sse); - CPPUNIT_TEST (t2_sse); - CPPUNIT_TEST (t3_sse); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1_3dnowext (); - void t2_3dnowext (); - void t3_3dnowext (); - void t1_3dnow (); - void t2_3dnow (); - void t3_3dnow (); - void t1_sse (); - void t2_sse (); - void t3_sse (); - - - typedef void (*ccomplex_dotprod_t)(const float *input, - const float *taps, - unsigned n_2_ccomplex_blocks, - float *result); - - void t1_base (ccomplex_dotprod_t); - void t2_base (ccomplex_dotprod_t); - void t3_base (ccomplex_dotprod_t); - - void zb (); - - float *taps; // 16-byte aligned - float *input; // 16-byte aligned -}; - - -#endif /* _QA_CCOMPLEX_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.cc deleted file mode 100644 index a21b95f633..0000000000 --- a/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.cc +++ /dev/null @@ -1,347 +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_complex_dotprod_x86.h> -#include <complex_dotprod_x86.h> -#include <string.h> -#include <iostream> -#include <malloc16.h> -#include <sse_debug.h> -#include <cmath> -#include <gr_cpu.h> -#include <random.h> - -using std::cerr; - -/// Macro for primitive value comparisons -#define assertcomplexEqual(expected0,expected1,actual,delta) \ - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected0, actual[0], delta); \ - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected1, actual[1], delta); - - -#define MAX_BLKS 10 -#define FLOATS_PER_BLK 4 -#define SHORTS_PER_BLK 2 - -#define ERR_DELTA (1e-6) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = rint (uniform () * 32767); -} - -static void -zero_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = 0.0; -} - -static void -random_shorts (short *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (short) rint (uniform () * 32767); -} - -static void -zero_shorts (short *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = 0; -} - -void -ref_complex_dotprod (const short *input, - const float *taps, unsigned n_2_complex_blocks, - float *result) -{ - float sum0[2] = {0,0}; - float sum1[2] = {0,0}; - - do { - - sum0[0] += input[0] * taps[0]; - sum0[1] += input[0] * taps[1]; - sum1[0] += input[1] * taps[2]; - sum1[1] += input[1] * taps[3]; - - input += 2; - taps += 4; - - } while (--n_2_complex_blocks != 0); - - - result[0] = sum0[0] + sum1[0]; - result[1] = sum0[1] + sum1[1]; -} - -void -qa_complex_dotprod_x86::setUp () -{ - taps = (float *) calloc16Align (MAX_BLKS, - sizeof (float) * FLOATS_PER_BLK); - - input = (short *) calloc16Align (MAX_BLKS, - sizeof (short) * SHORTS_PER_BLK); - - if (taps == 0 || input == 0) - abort (); -} - -void -qa_complex_dotprod_x86::tearDown () -{ - free16Align (taps); - free16Align (input); - taps = 0; - input = 0; -} - - -void -qa_complex_dotprod_x86::zb () // "zero both" -{ - zero_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - zero_shorts (input, MAX_BLKS * SHORTS_PER_BLK); -} - -// -// t1 -// - -void -qa_complex_dotprod_x86::t1_base (complex_dotprod_t complex_dotprod) -{ - float result[2]; - - // cerr << "Testing dump_xmm_regs\n"; - // dump_xmm_regs (); - - // test basic cases, 1 block - - zb (); - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (0.0, 0.0, result, ERR_DELTA); - - // vary each input - - zb (); - input[0] = 1; taps[0] = 1.0; taps[1] = -1.0; - complex_dotprod (input, taps, 1, result); - //cerr << result[0] << " " << result[1] << "\n"; - assertcomplexEqual (1.0, -1.0, result, ERR_DELTA); - - zb (); - input[1] = 2; taps[2] = 1.0; taps[3] = -1.0; - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (2.0, -2.0, result, ERR_DELTA); - - zb (); - input[2] = 3; taps[4] = 1.0; taps[5] = -1.0; - complex_dotprod (input, taps, 2, result); - assertcomplexEqual (3.0, -3.0, result, ERR_DELTA); - - zb (); - input[3] = 4; taps[6] = 1.0; taps[7] = -1.0; - complex_dotprod (input, taps, 2, result); - assertcomplexEqual (4.0, -4.0, result, ERR_DELTA); - - // vary each tap - - zb (); - input[0] = 1; taps[0] = 0.5; taps[1] = -0.5; - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (0.5, -0.5, result, ERR_DELTA); - - zb (); - input[0] = 1; taps[0] = 2.0; taps[1] = -2.0; - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (2.0, -2.0, result, ERR_DELTA); - - zb (); - input[0] = 1; taps[0] = 3.0; taps[1] = -3.0; - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (3.0, -3.0, result, ERR_DELTA); - - zb (); - input[0] = 1; taps[0] = 4.0; taps[1] = -4.0; - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (4.0, -4.0, result, ERR_DELTA); -} - -// -// t2 -// -void -qa_complex_dotprod_x86::t2_base (complex_dotprod_t complex_dotprod) -{ - float result[2]; - - zb (); - input[0] = 1; taps[0] = 2.0; taps[1] = -2.0; - input[1] = 3; taps[2] = 5.0; taps[3] = -5.0; - input[2] = 7; taps[4] = 11.0; taps[5] = -11.0; - input[3] = 13; taps[6] = 17.0; taps[7] = -17.0; - - complex_dotprod (input, taps, 2, result); - assertcomplexEqual (315.0, -315.0, result, ERR_DELTA); - - input[4] = 19; taps[8] = 23.0; taps[9] = -23.0; - complex_dotprod (input, taps, 3, result); - assertcomplexEqual (752.0, -752.0, result, ERR_DELTA); - -} - -// -// t3 -// -void -qa_complex_dotprod_x86::t3_base (complex_dotprod_t complex_dotprod) -{ - srandom (0); // we want reproducibility - - for (unsigned int i = 0; i < 10; i++){ - random_shorts (input, MAX_BLKS * SHORTS_PER_BLK); - random_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - float ref[2]; - ref_complex_dotprod (input, taps, MAX_BLKS, ref); - float calc[2]; - complex_dotprod (input, taps, MAX_BLKS, calc); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[0], - calc[0], - fabs (ref[0]) * 1e-4); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[1], - calc[1], - fabs (ref[1]) * 1e-4); - } -} - -void -qa_complex_dotprod_x86::t1_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t1_base (complex_dotprod_3dnowext); -} - -void -qa_complex_dotprod_x86::t2_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t2_base (complex_dotprod_3dnowext); -} - -void -qa_complex_dotprod_x86::t3_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t3_base (complex_dotprod_3dnowext); -} - -void -qa_complex_dotprod_x86::t1_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t1_base (complex_dotprod_3dnow); -} - -void -qa_complex_dotprod_x86::t2_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t2_base (complex_dotprod_3dnow); -} - -void -qa_complex_dotprod_x86::t3_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t3_base (complex_dotprod_3dnow); -} - -void -qa_complex_dotprod_x86::t1_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t1_base (complex_dotprod_sse); -} - -void -qa_complex_dotprod_x86::t2_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t2_base (complex_dotprod_sse); -} - -void -qa_complex_dotprod_x86::t3_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t3_base (complex_dotprod_sse); -} - diff --git a/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.h b/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.h deleted file mode 100644 index 9f9b460399..0000000000 --- a/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.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 _QA_COMPLEX_DOTPROD_X86_H_ -#define _QA_COMPLEX_DOTPROD_X86_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_complex_dotprod_x86 : public CppUnit::TestCase { - public: - void setUp (); - void tearDown (); - - CPPUNIT_TEST_SUITE (qa_complex_dotprod_x86); - CPPUNIT_TEST (t1_3dnowext); - CPPUNIT_TEST (t2_3dnowext); - CPPUNIT_TEST (t3_3dnowext); - CPPUNIT_TEST (t1_3dnow); - CPPUNIT_TEST (t2_3dnow); - CPPUNIT_TEST (t3_3dnow); - CPPUNIT_TEST (t1_sse); - CPPUNIT_TEST (t2_sse); - CPPUNIT_TEST (t3_sse); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1_3dnowext (); - void t2_3dnowext (); - void t3_3dnowext (); - void t1_3dnow (); - void t2_3dnow (); - void t3_3dnow (); - void t1_sse (); - void t2_sse (); - void t3_sse (); - - - typedef void (*complex_dotprod_t)(const short *input, - const float *taps, - unsigned n_2_complex_blocks, - float *result); - - void t1_base (complex_dotprod_t); - void t2_base (complex_dotprod_t); - void t3_base (complex_dotprod_t); - - void zb (); - - float *taps; // 16-byte aligned - short *input; // 16-byte aligned -}; - - -#endif /* _QA_COMPLEX_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_dotprod.h b/gnuradio-core/src/lib/filter/qa_dotprod.h deleted file mode 100644 index bd5ba8f3ae..0000000000 --- a/gnuradio-core/src/lib/filter/qa_dotprod.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with 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_DOTPROD_H_ -#define _QA_DOTPROD_H_ - -#include <cppunit/TestSuite.h> - -CppUnit::TestSuite *qa_dotprod_suite (); - -#endif // _QA_DOTPROD_H_ - diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_armv7_a.cc b/gnuradio-core/src/lib/filter/qa_dotprod_armv7_a.cc deleted file mode 100644 index 1e1ded7ea1..0000000000 --- a/gnuradio-core/src/lib/filter/qa_dotprod_armv7_a.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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 "qa_dotprod.h" - -CppUnit::TestSuite * -qa_dotprod_suite () -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod"); - - // empty test suite - - return s; -} diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_generic.cc b/gnuradio-core/src/lib/filter/qa_dotprod_generic.cc deleted file mode 100644 index 2c49d1d28f..0000000000 --- a/gnuradio-core/src/lib/filter/qa_dotprod_generic.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along 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_dotprod.h" - -CppUnit::TestSuite * -qa_dotprod_suite () -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod"); - - // empty test suite - - return s; -} diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_powerpc.cc b/gnuradio-core/src/lib/filter/qa_dotprod_powerpc.cc deleted file mode 100644 index 2c49d1d28f..0000000000 --- a/gnuradio-core/src/lib/filter/qa_dotprod_powerpc.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along 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_dotprod.h" - -CppUnit::TestSuite * -qa_dotprod_suite () -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod"); - - // empty test suite - - return s; -} diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_dotprod_x86.cc deleted file mode 100644 index ec5625f10c..0000000000 --- a/gnuradio-core/src/lib/filter/qa_dotprod_x86.cc +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along 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_dotprod.h" -#include "qa_float_dotprod_x86.h" -#include "qa_complex_dotprod_x86.h" -#include "qa_ccomplex_dotprod_x86.h" - -CppUnit::TestSuite * -qa_dotprod_suite () -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod"); - - s->addTest (qa_float_dotprod_x86::suite ()); - s->addTest (qa_complex_dotprod_x86::suite ()); - s->addTest (qa_ccomplex_dotprod_x86::suite ()); - - return s; -} diff --git a/gnuradio-core/src/lib/filter/qa_filter.cc b/gnuradio-core/src/lib/filter/qa_filter.cc deleted file mode 100644 index 6296350845..0000000000 --- a/gnuradio-core/src/lib/filter/qa_filter.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2002,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. - */ - -/* - * This class gathers together all the test cases for the gr - * directory into a single test suite. As you create new test cases, - * add them here. - */ - -#include <qa_filter.h> -#include <qa_gr_fir_ccf.h> -#include <qa_gr_fir_fff.h> -#include <qa_gr_fir_ccc.h> -#include <qa_gr_fir_fcc.h> -#include <qa_gr_fir_scc.h> -#include <qa_gr_firdes.h> -#include <qa_dotprod.h> -#include <qa_gri_mmse_fir_interpolator.h> -#include <qa_gri_mmse_fir_interpolator_cc.h> -#include <qa_gr_rotator.h> -#include <qa_gri_fir_filter_with_buffer_ccf.h> -#include <qa_gri_fir_filter_with_buffer_ccc.h> -#include <qa_gri_fir_filter_with_buffer_fcc.h> -#include <qa_gri_fir_filter_with_buffer_fff.h> -#include <qa_gri_fir_filter_with_buffer_fsf.h> -#include <qa_gri_fir_filter_with_buffer_scc.h> - -CppUnit::TestSuite * -qa_filter::suite () -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite ("filter"); - - s->addTest (qa_dotprod_suite ()); - s->addTest (qa_gr_fir_fff::suite ()); - s->addTest (qa_gr_fir_ccc::suite ()); - s->addTest (qa_gr_fir_fcc::suite ()); - s->addTest (qa_gr_fir_scc::suite ()); - s->addTest (qa_gr_fir_ccf::suite ()); - s->addTest (qa_gri_mmse_fir_interpolator::suite ()); - s->addTest (qa_gri_mmse_fir_interpolator_cc::suite ()); - s->addTest (qa_gr_rotator::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_ccf::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_ccc::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_fcc::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_fff::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_fsf::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_scc::suite ()); - - return s; -} diff --git a/gnuradio-core/src/lib/filter/qa_filter.h b/gnuradio-core/src/lib/filter/qa_filter.h deleted file mode 100644 index 740d05ce40..0000000000 --- a/gnuradio-core/src/lib/filter/qa_filter.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 _QA_FILTER_H_ -#define _QA_FILTER_H_ - -#include <gruel/attributes.h> -#include <cppunit/TestSuite.h> - -//! collect all the tests for the gr directory - -class __GR_ATTR_EXPORT qa_filter { - public: - //! return suite of tests for all of gr directory - static CppUnit::TestSuite *suite (); -}; - - -#endif /* _QA_FILTER_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.cc deleted file mode 100644 index f8752d0716..0000000000 --- a/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.cc +++ /dev/null @@ -1,270 +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_float_dotprod_x86.h> -#include <float_dotprod_x86.h> -#include <string.h> -#include <iostream> -#include <malloc16.h> -#include <sse_debug.h> -#include <cmath> -#include <gr_cpu.h> -#include <random.h> - -using std::cerr; - - -#define MAX_BLKS 10 -#define FLOATS_PER_BLK 4 - -#define ERR_DELTA (1e-6) - - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = random () - RANDOM_MAX/2; -} - -static void -zero_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = 0.0; -} - -float -ref_float_dotprod (const float *input, - const float *taps, unsigned n_4_float_blocks) -{ - float sum0 = 0; - float sum1 = 0; - float sum2 = 0; - float sum3 = 0; - - do { - - sum0 += input[0] * taps[0]; - sum1 += input[1] * taps[1]; - sum2 += input[2] * taps[2]; - sum3 += input[3] * taps[3]; - - input += 4; - taps += 4; - - } while (--n_4_float_blocks != 0); - - - return sum0 + sum1 + sum2 + sum3; -} - -void -qa_float_dotprod_x86::setUp () -{ - taps = (float *) calloc16Align (MAX_BLKS, - sizeof (float) * FLOATS_PER_BLK); - - input = (float *) calloc16Align (MAX_BLKS, - sizeof (float) * FLOATS_PER_BLK); - - if (taps == 0 || input == 0) - abort (); -} - -void -qa_float_dotprod_x86::tearDown () -{ - free16Align (taps); - free16Align (input); - taps = 0; - input = 0; -} - - -void -qa_float_dotprod_x86::zb () // "zero both" -{ - zero_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - zero_floats (input, MAX_BLKS * FLOATS_PER_BLK); -} - -// -// t1 -// - -void -qa_float_dotprod_x86::t1_base (float_dotprod_t float_dotprod) -{ - - // cerr << "Testing dump_xmm_regs\n"; - // dump_xmm_regs (); - - // test basic cases, 1 block - - zb (); - CPPUNIT_ASSERT_DOUBLES_EQUAL (0.0, float_dotprod (input, taps, 1), ERR_DELTA); - - // vary each input - - zb (); - input[0] = 0.5; taps[0] = 1.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (0.5, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[1] = 2.0; taps[1] = 1.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (2.0, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[2] = 3.0; taps[2] = 1.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (3.0, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[3] = 4.0; taps[3] = 1.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (4.0, float_dotprod (input, taps, 1), ERR_DELTA); - - // vary each tap - - zb (); - input[0] = 1.0; taps[0] = 0.5; - CPPUNIT_ASSERT_DOUBLES_EQUAL (0.5, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 2.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (2.0, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 3.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (3.0, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 4.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (4.0, float_dotprod (input, taps, 1), ERR_DELTA); -} - -// -// t2 -// -void -qa_float_dotprod_x86::t2_base (float_dotprod_t float_dotprod) -{ - zb (); - input[0] = 1.0; taps[0] = 2.0; - input[1] = 3.0; taps[1] = 5.0; - input[2] = 7.0; taps[2] = 11.0; - input[3] = 13.0; taps[3] = 17.0; - - CPPUNIT_ASSERT_DOUBLES_EQUAL (315.0, float_dotprod (input, taps, 1), ERR_DELTA); - - input[4] = 19.0; taps[4] = 23.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (752.0, float_dotprod (input, taps, 2), ERR_DELTA); - -} - -// -// t3 -// -void -qa_float_dotprod_x86::t3_base (float_dotprod_t float_dotprod) -{ - srandom (0); // we want reproducibility - - for (unsigned int i = 0; i < 10; i++){ - random_floats (input, MAX_BLKS * FLOATS_PER_BLK); - random_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - float ref = ref_float_dotprod (input, taps, MAX_BLKS); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref, - float_dotprod (input, taps, MAX_BLKS), - fabs (ref) * 1e-4); - } -} - -void -qa_float_dotprod_x86::t1_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t1_base (float_dotprod_3dnow); -} - -void -qa_float_dotprod_x86::t2_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t2_base (float_dotprod_3dnow); -} - -void -qa_float_dotprod_x86::t3_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t3_base (float_dotprod_3dnow); -} - -void -qa_float_dotprod_x86::t1_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t1_base (float_dotprod_sse); -} - -void -qa_float_dotprod_x86::t2_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t2_base (float_dotprod_sse); -} - -void -qa_float_dotprod_x86::t3_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t3_base (float_dotprod_sse); -} diff --git a/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.h b/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.h deleted file mode 100644 index 38d6104fab..0000000000 --- a/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.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_FLOAT_DOTPROD_X86_H_ -#define _QA_FLOAT_DOTPROD_X86_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_float_dotprod_x86 : public CppUnit::TestCase { - public: - void setUp (); - void tearDown (); - - CPPUNIT_TEST_SUITE (qa_float_dotprod_x86); - CPPUNIT_TEST (t1_3dnow); - CPPUNIT_TEST (t2_3dnow); - CPPUNIT_TEST (t3_3dnow); - CPPUNIT_TEST (t1_sse); - CPPUNIT_TEST (t2_sse); - CPPUNIT_TEST (t3_sse); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1_3dnow (); - void t2_3dnow (); - void t3_3dnow (); - void t1_sse (); - void t2_sse (); - void t3_sse (); - - - typedef float (*float_dotprod_t)(const float *input, - const float *taps, - unsigned n_4_float_blocks); - - void t1_base (float_dotprod_t); - void t2_base (float_dotprod_t); - void t3_base (float_dotprod_t); - - - void zb (); - - float *taps; // 16-byte aligned - float *input; // 16-byte aligned - -}; - - -#endif /* _QA_FLOAT_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.cc deleted file mode 100644 index 7474b76e25..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.cc +++ /dev/null @@ -1,184 +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. - */ - -/* - * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc - * Kludge up some kind of macro to handle the minor differences. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> - -typedef gr_complex i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - - -#include <qa_gr_fir_ccc.h> -#include <gr_fir_ccc.h> -#include <gr_fir_util.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <gr_types.h> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -// -// typedef for something logically "pointer to constructor". -// there may be a better way, please let me know... -// -typedef gr_fir_ccc* (*fir_maker_t)(const std::vector<tap_type> &taps); - - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_input (i_type *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (i_type) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) - sum += input[i] * taps[ntaps - i - 1]; - - return sum; -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// - -static void -test_random_io (fir_maker_t maker) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Our SIMD ccc kernel requires that the complex input be 64-bit (8-byte) aligned. - // i_type input[INPUT_LEN]; - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - - srandom (0); // we want reproducibility - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_input (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - for (int o = 0; o < ol; o++){ - expected_output[o] = ref_dotprod (&input[o], taps, n); - } - - // build filter - - vector<tap_type> f1_taps (&taps[0], &taps[n]); - gr_fir_ccc *f1 = maker (f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterN (actual_output, input, ol); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < ol; o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], - actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - - delete f1; - } - } - free16Align(input); -} - -static void -for_each (void (*f)(fir_maker_t)) -{ - std::vector<gr_fir_ccc_info> info; - gr_fir_util::get_gr_fir_ccc_info (&info); // get all known ccc implementations - - for (std::vector<gr_fir_ccc_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - std::cerr << " [" << p->name << "]"; - f (p->create); - } - - std::cerr << std::endl; -} - -void -qa_gr_fir_ccc::t1 () -{ - for_each (test_random_io); -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.cc deleted file mode 100644 index 84cb924aea..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.cc +++ /dev/null @@ -1,184 +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. - */ - -/* - * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc - * Kludge up some kind of macro to handle the minor differences. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> - -typedef gr_complex i_type; -typedef gr_complex o_type; -typedef float tap_type; -typedef gr_complex acc_type; - - -#include <qa_gr_fir_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <gr_types.h> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -// -// typedef for something logically "pointer to constructor". -// there may be a better way, please let me know... -// -typedef gr_fir_ccf* (*fir_maker_t)(const std::vector<tap_type> &taps); - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (float) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) - sum += input[i] * taps[ntaps - i - 1]; - - return sum; -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// - -static void -test_random_io (fir_maker_t maker) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Our SIMD ccc kernel requires that the complex input be 64-bit (8-byte) aligned. - //i_type input[INPUT_LEN]; - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - - srandom (0); // we want reproducibility - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_complex (input, INPUT_LEN); - random_floats (taps, MAX_TAPS); - - // compute expected output values - for (int o = 0; o < ol; o++){ - expected_output[o] = ref_dotprod (&input[o], taps, n); - } - - // build filter - - vector<tap_type> f1_taps (&taps[0], &taps[n]); - gr_fir_ccf *f1 = maker (f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterN (actual_output, input, ol); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < ol; o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - - delete f1; - } - } - free16Align(input); -} - - -static void -for_each (void (*f)(fir_maker_t)) -{ - std::vector<gr_fir_ccf_info> info; - gr_fir_util::get_gr_fir_ccf_info (&info); // get all known ccf implementations - - for (std::vector<gr_fir_ccf_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - std::cerr << " [" << p->name << "]"; - f (p->create); - } - - std::cerr << std::endl; -} - - -void -qa_gr_fir_ccf::t1 () -{ - for_each (test_random_io); -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.h b/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.h deleted file mode 100644 index bda79cc2fa..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.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_GR_FIR_CCF_H_ -#define _QA_GR_FIR_CCF_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_fir_ccf : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fir_ccf); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1 (); - // void t2 (); - // void t3 (); - -}; - - -#endif /* _QA_GR_FIR_CCF_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc deleted file mode 100644 index 4c77a5e5c0..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc +++ /dev/null @@ -1,181 +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. - */ - -/* - * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc - * Kludge up some kind of macro to handle the minor differences. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> - -typedef float i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - - -#include <qa_gr_fir_fcc.h> -#include <gr_fir_fcc.h> -#include <gr_fir_util.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <gr_types.h> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <string.h> - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - - -// -// typedef for something logically "pointer to constructor". -// there may be a better way, please let me know... -// -typedef gr_fir_fcc* (*fir_maker_t)(const std::vector<tap_type> &taps); - - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_input (i_type *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (i_type) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) - sum += input[i] * taps[ntaps - i - 1]; - - return sum; -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// - -static void -test_random_io (fir_maker_t maker) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - i_type input[INPUT_LEN]; - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - - srandom (0); // we want reproducibility - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_input (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - for (int o = 0; o < ol; o++){ - expected_output[o] = ref_dotprod (&input[o], taps, n); - } - - // build filter - - vector<tap_type> f1_taps (&taps[0], &taps[n]); - gr_fir_fcc *f1 = maker (f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterN (actual_output, input, ol); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < ol; o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], - actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - - delete f1; - } - } -} - -static void -for_each (void (*f)(fir_maker_t)) -{ - std::vector<gr_fir_fcc_info> info; - gr_fir_util::get_gr_fir_fcc_info (&info); // get all known fcc implementations - - for (std::vector<gr_fir_fcc_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - std::cerr << " [" << p->name << "]"; - f (p->create); - } - - std::cerr << std::endl; -} - -void -qa_gr_fir_fcc::t1 () -{ - for_each (test_random_io); -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.h b/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.h deleted file mode 100644 index 23706fd9c1..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.h +++ /dev/null @@ -1,40 +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_GR_FIR_FCC_H_ -#define _QA_GR_FIR_FCC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_fir_fcc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fir_fcc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1 (); -}; - - -#endif /* _QA_GR_FIR_FCC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc deleted file mode 100644 index 80ed674658..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc +++ /dev/null @@ -1,226 +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_gr_fir_fff.h> -#include <gr_fir_fff.h> -#include <gr_fir_util.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <string.h> - -using std::vector; - -typedef float i_type; -typedef float o_type; -typedef float tap_type; -typedef float acc_type; - -#define ERR_DELTA (1e-6) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - - -// -// typedef for something logically "pointer to constructor". -// there may be a better way, please let me know... -// -typedef gr_fir_fff* (*fir_maker_t)(const std::vector<tap_type> &taps); - - -// ---------------------------------------------------------------- - -const static i_type input_1[] = { - 234, -4, 23, -56, 45, 98, -23, -7 -}; - -const static tap_type taps_1a[] = { - -3 -}; - -const static o_type expected_1a[] = { - -702, 12, -69, 168, -135, -294, 69, 21 -}; - -const static tap_type taps_1b[] = { - -4, 5 -}; - -const static o_type expected_1b[] = { - 1186, -112, 339, -460, -167, 582, -87 -}; - -// ---------------------------------------------------------------- - -static void -test_known_io (fir_maker_t maker) -{ - vector<tap_type> t1a (&taps_1a[0], &taps_1a[NELEM (taps_1a)]); - vector<tap_type> t1b (&taps_1b[0], &taps_1b[NELEM (taps_1b)]); - - gr_fir_fff *f1 = maker (t1a); // create filter - CPPUNIT_ASSERT_EQUAL ((unsigned) 1, f1->ntaps ()); // check ntaps - - // check filter output - int n = NELEM (input_1) - f1->ntaps () + 1; - for (int i = 0; i < n; i++) - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_1a[i], f1->filter (&input_1[i]), ERR_DELTA); - - f1->set_taps (t1b); // set new taps - CPPUNIT_ASSERT_EQUAL ((unsigned) 2, f1->ntaps ()); // check ntaps - - // check filter output - n = NELEM (input_1) - f1->ntaps () + 1; - for (int i = 0; i < n; i++) - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_1b[i], f1->filter (&input_1[i]), ERR_DELTA); - - // test filterN interface - - o_type output[NELEM (expected_1b)]; - memset (output, 0, sizeof (output)); - - f1->filterN (output, input_1, n); - for (int i = 0; i < n; i++) - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_1b[i], output[i], ERR_DELTA); - - delete f1; -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = rint (uniform () * 32768); -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) - sum += input[i] * taps[ntaps - i - 1]; - - return sum; -} - -static void -test_random_io (fir_maker_t maker) -{ - const int MAX_TAPS = 32; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - i_type input[INPUT_LEN]; - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - - srandom (0); // we want reproducibility - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_floats (input, INPUT_LEN); - random_floats (taps, MAX_TAPS); - - // compute expected output values - for (int o = 0; o < ol; o++){ - expected_output[o] = ref_dotprod (&input[o], taps, n); - } - - // build filter - - vector<tap_type> f1_taps (&taps[0], &taps[n]); - gr_fir_fff *f1 = maker (f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterN (actual_output, input, ol); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < ol; o++){ - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_output[o], actual_output[o], - fabs (expected_output[o]) * 9e-3); - } - - delete f1; - } - } -} - - -static void -for_each (void (*f)(fir_maker_t)) -{ - std::vector<gr_fir_fff_info> info; - gr_fir_util::get_gr_fir_fff_info (&info); // get all known fff implementations - - for (std::vector<gr_fir_fff_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - std::cerr << " [" << p->name << "]"; - f (p->create); - } - - std::cerr << std::endl; -} - -void -qa_gr_fir_fff::t1 () -{ - for_each (test_known_io); -} - -void -qa_gr_fir_fff::t2 () -{ - for_each (test_random_io); -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.h b/gnuradio-core/src/lib/filter/qa_gr_fir_fff.h deleted file mode 100644 index c896728960..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.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_GR_FIR_FFF_H_ -#define _QA_GR_FIR_FFF_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_fir_fff : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fir_fff); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1 (); - void t2 (); - -}; - - -#endif /* _QA_GR_FIR_FFF_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc deleted file mode 100644 index 3f4a7be2c4..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc +++ /dev/null @@ -1,179 +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. - */ - -/* - * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc - * Kludge up some kind of macro to handle the minor differences. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> - -typedef short i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - - -#include <qa_gr_fir_scc.h> -#include <gr_fir_scc.h> -#include <gr_fir_util.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <gr_types.h> -#include <cppunit/TestAssert.h> -#include <random.h> - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -// -// typedef for something logically "pointer to constructor". -// there may be a better way, please let me know... -// -typedef gr_fir_scc* (*fir_maker_t)(const std::vector<tap_type> &taps); - - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_input (i_type *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (i_type) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) - sum += (float) input[i] * taps[ntaps - i - 1]; - - return sum; -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// - -static void -test_random_io (fir_maker_t maker) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - i_type input[INPUT_LEN]; - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - - srandom (0); // we want reproducibility - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_input (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - for (int o = 0; o < ol; o++){ - expected_output[o] = ref_dotprod (&input[o], taps, n); - } - - // build filter - - vector<tap_type> f1_taps (&taps[0], &taps[n]); - gr_fir_scc *f1 = maker (f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterN (actual_output, input, ol); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < ol; o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], - actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - - delete f1; - } - } -} - -static void -for_each (void (*f)(fir_maker_t)) -{ - std::vector<gr_fir_scc_info> info; - gr_fir_util::get_gr_fir_scc_info (&info); // get all known scc implementations - - for (std::vector<gr_fir_scc_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - std::cerr << " [" << p->name << "]"; - f (p->create); - } - - std::cerr << std::endl; -} - -void -qa_gr_fir_scc::t1 () -{ - for_each (test_random_io); -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.h b/gnuradio-core/src/lib/filter/qa_gr_fir_scc.h deleted file mode 100644 index 4b5ffdae3c..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.h +++ /dev/null @@ -1,40 +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_GR_FIR_SCC_H_ -#define _QA_GR_FIR_SCC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_fir_scc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fir_scc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - void t1 (); - -}; - - -#endif /* _QA_GR_FIR_SCC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gr_rotator.cc b/gnuradio-core/src/lib/filter/qa_gr_rotator.cc deleted file mode 100644 index b2885a12d4..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_rotator.cc +++ /dev/null @@ -1,75 +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 <gruel/attributes.h> -#include <cppunit/TestAssert.h> -#include <qa_gr_rotator.h> -#include <gr_rotator.h> -#include <stdio.h> -#include <cmath> -#include <gr_expj.h> - - -// error vector magnitude -__GR_ATTR_UNUSED static float -error_vector_mag(gr_complex a, gr_complex b) -{ - return abs(a-b); -} - -void -qa_gr_rotator::t1 () -{ - static const unsigned int N = 100000; - - gr_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; - } -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_rotator.h b/gnuradio-core/src/lib/filter/qa_gr_rotator.h deleted file mode 100644 index 739b23f8c3..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_rotator.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ -#ifndef _QA_GR_ROTATOR_H_ -#define _QA_GR_ROTATOR_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_rotator : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_rotator); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - void t1 (); - -}; - -#endif /* _QA_GR_ROTATOR_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc deleted file mode 100644 index cfdbc53eb3..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc +++ /dev/null @@ -1,161 +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 <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_ccc.h> -#include <gri_fir_filter_with_buffer_ccc.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef gr_complex i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - -using std::vector; - -#define MAX_DATA (32767) -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * MAX_DATA); - float im = rint (uniform () * MAX_DATA); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += input[i] * taps[i]; - } - - return sum; -} - -void -qa_gri_fir_filter_with_buffer_ccc::t1 () -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_ccc::t2 () -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_ccc::t3 () -{ - test_decimate(5); -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_ccc::test_decimate(unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_complex (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_ccc *f1 = new gri_fir_filter_with_buffer_ccc(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o], - sqrt((float)n)*0.25*MAX_DATA*MAX_DATA * ERR_DELTA); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h deleted file mode 100644 index c1f2df10c0..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h +++ /dev/null @@ -1,46 +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 _QA_GRI_FIR_FILTER_WITH_BUFFER_CCC_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_CCC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_ccc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_ccc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_CCC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc deleted file mode 100644 index 9a5be03518..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc +++ /dev/null @@ -1,167 +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 <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_ccf.h> -#include <gri_fir_filter_with_buffer_ccf.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef gr_complex i_type; -typedef gr_complex o_type; -typedef float tap_type; -typedef gr_complex acc_type; - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (float) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += input[i] * taps[i]; - } - - return sum; -} - -void -qa_gri_fir_filter_with_buffer_ccf::t1 () -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_ccf::t2 () -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_ccf::t3 () -{ - test_decimate(5); -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_ccf::test_decimate (unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_complex (input, INPUT_LEN); - random_floats (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_ccf *f1 = new gri_fir_filter_with_buffer_ccf(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h deleted file mode 100644 index 686bc85411..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h +++ /dev/null @@ -1,46 +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 _QA_GRI_FIR_FILTER_WITH_BUFFER_CCF_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_CCF_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_ccf : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_ccf); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_CCF_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc deleted file mode 100644 index 583697165f..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc +++ /dev/null @@ -1,168 +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 <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_fcc.h> -#include <gri_fir_filter_with_buffer_fcc.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef float i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (float) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += input[i] * taps[i]; - } - - return sum; -} - -void -qa_gri_fir_filter_with_buffer_fcc::t1() -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_fcc::t2() -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_fcc::t3() -{ - test_decimate(5); -} - - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_fcc::test_decimate(unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_floats (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_fcc *f1 = new gri_fir_filter_with_buffer_fcc(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h deleted file mode 100644 index 64eed25d3a..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h +++ /dev/null @@ -1,46 +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 _QA_GRI_FIR_FILTER_WITH_BUFFER_FCC_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FCC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_fcc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fcc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FCC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc deleted file mode 100644 index 208ae01dbb..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc +++ /dev/null @@ -1,156 +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 <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_fff.h> -#include <gri_fir_filter_with_buffer_fff.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef float i_type; -typedef float o_type; -typedef float tap_type; -typedef float acc_type; - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (float) rint (uniform () * 32767); -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += input[i] * taps[i]; - } - return sum; -} - -void -qa_gri_fir_filter_with_buffer_fff::t1 () -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_fff::t2 () -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_fff::t3 () -{ - test_decimate(5); -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_fff::test_decimate(unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_floats (input, INPUT_LEN); - random_floats (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_fff *f1 = new gri_fir_filter_with_buffer_fff(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_DOUBLES_EQUAL(expected_output[o], actual_output[o], - fabsf (expected_output[o]) * ERR_DELTA); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h deleted file mode 100644 index d219ec72d9..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h +++ /dev/null @@ -1,46 +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 _QA_GRI_FIR_FILTER_WITH_BUFFER_FFF_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FFF_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_fff : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fff); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FFF_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc deleted file mode 100644 index e2b6fb04f0..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc +++ /dev/null @@ -1,147 +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 <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_fsf.h> -#include <gri_fir_filter_with_buffer_fsf.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef float i_type; -typedef short o_type; -typedef float tap_type; -typedef float acc_type; - -using std::vector; - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (float) rint (uniform () * 128); -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += input[i] * taps[i]; - } - return (o_type)sum; -} - -void -qa_gri_fir_filter_with_buffer_fsf::t1 () -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_fsf::t2 () -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_fsf::t3 () -{ - test_decimate(5); -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_fsf::test_decimate (unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_floats (input, INPUT_LEN); - random_floats (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_fsf *f1 = new gri_fir_filter_with_buffer_fsf(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_EQUAL(expected_output[o], actual_output[o]); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h deleted file mode 100644 index 70030a0721..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h +++ /dev/null @@ -1,46 +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 _QA_GRI_FIR_FILTER_WITH_BUFFER_FSF_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FSF_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_fsf : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fsf); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FSF_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc deleted file mode 100644 index 15f8b1f95a..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc +++ /dev/null @@ -1,167 +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 <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_scc.h> -#include <gri_fir_filter_with_buffer_scc.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef short i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_shorts (short *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (short) rint (uniform () * 16384); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += (float)input[i] * taps[i]; - } - - return sum; -} - -void -qa_gri_fir_filter_with_buffer_scc::t1 () -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_scc::t2 () -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_scc::t3 () -{ - test_decimate(5); -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_scc::test_decimate (unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_shorts (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_scc *f1 = new gri_fir_filter_with_buffer_scc(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h deleted file mode 100644 index f80056189f..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h +++ /dev/null @@ -1,46 +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 _QA_GRI_FIR_FILTER_WITH_BUFFER_SCC_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_SCC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_scc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_scc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_SCC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc deleted file mode 100644 index 7dca65b9a1..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc +++ /dev/null @@ -1,66 +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_gri_mmse_fir_interpolator.h> -#include <gri_mmse_fir_interpolator.h> -#include <stdio.h> -#include <cmath> - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - - -static float -test_fcn (double index) -{ - return (2 * sin (index * 0.25 * 2 * M_PI + 0.125 * M_PI) - + 3 * sin (index * 0.077 * 2 * M_PI + 0.3 * M_PI)); -} - - -void -qa_gri_mmse_fir_interpolator::t1 () -{ - static const unsigned N = 100; - float input[N + 10]; - - for (unsigned i = 0; i < NELEM(input); i++) - input[i] = test_fcn ((double) i); - - gri_mmse_fir_interpolator intr; - float inv_nsteps = 1.0 / intr.nsteps (); - - for (unsigned i = 0; i < N; i++){ - for (unsigned imu = 0; imu <= intr.nsteps (); imu += 1){ - float expected = test_fcn ((i + 3) + imu * inv_nsteps); - float actual = intr.interpolate (&input[i], imu * inv_nsteps); - - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected, actual, 0.004); - // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual); - } - } -} - diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.h b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.h deleted file mode 100644 index 3f4dec7c29..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.h +++ /dev/null @@ -1,40 +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_GRI_MMSE_FIR_INTERPOLATOR_H_ -#define _QA_GRI_MMSE_FIR_INTERPOLATOR_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_mmse_fir_interpolator : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_mmse_fir_interpolator); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - void t1 (); - -}; - - -#endif /* _QA_GRI_MMSE_FIR_INTERPOLATOR_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc deleted file mode 100644 index 1f70d7f42d..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gruel/attributes.h> -#include <cppunit/TestAssert.h> -#include <qa_gri_mmse_fir_interpolator_cc.h> -#include <gri_mmse_fir_interpolator_cc.h> -#include <stdio.h> -#include <cmath> -#include <stdexcept> -#include <unistd.h> - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - - -static float -test_fcn_sin(double index) -{ - return (2 * sin (index * 0.25 * 2 * M_PI + 0.125 * M_PI) - + 3 * sin (index * 0.077 * 2 * M_PI + 0.3 * M_PI)); -} - -static float -test_fcn_cos(double index) -{ - return (2 * cos (index * 0.25 * 2 * M_PI + 0.125 * M_PI) - + 3 * cos (index * 0.077 * 2 * M_PI + 0.3 * M_PI)); -} - -static gr_complex -test_fcn(double index) -{ - return gr_complex(test_fcn_cos(index), test_fcn_sin(index)); -} - - -void -qa_gri_mmse_fir_interpolator_cc::t1() -{ - static const unsigned N = 100; - __GR_ATTR_ALIGNED(8) gr_complex input[N + 10]; - - for (unsigned i = 0; i < NELEM(input); i++) - input[i] = test_fcn ((double) i); - - gri_mmse_fir_interpolator_cc intr; - float inv_nsteps = 1.0 / intr.nsteps (); - - for (unsigned i = 0; i < N; i++){ - for (unsigned imu = 0; imu <= intr.nsteps (); imu += 1){ - gr_complex expected = test_fcn ((i + 3) + imu * inv_nsteps); - gr_complex actual = intr.interpolate (&input[i], imu * inv_nsteps); - - CPPUNIT_ASSERT_COMPLEXES_EQUAL (expected, actual, 0.004); - // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual); - } - } -} - - -/* - * Force bad alignment and confirm that it raises an exception - */ -void -qa_gri_mmse_fir_interpolator_cc::t2_body() -{ - static const unsigned N = 100; - float float_input[2*(N+10) + 1]; - gr_complex *input; - - // We require that gr_complex be aligned on an 8-byte boundary. - // Ensure that we ARE NOT ;) - - if (((intptr_t) float_input & 0x7) == 0) - input = reinterpret_cast<gr_complex *>(&float_input[1]); - else - input = reinterpret_cast<gr_complex *>(&float_input[0]); - - - for (unsigned i = 0; i < (N+10); i++) - input[i] = test_fcn ((double) i); - - gri_mmse_fir_interpolator_cc intr; - float inv_nsteps = 1.0 / intr.nsteps (); - - for (unsigned i = 0; i < N; i++){ - for (unsigned imu = 0; imu <= intr.nsteps (); imu += 1){ - gr_complex expected = test_fcn ((i + 3) + imu * inv_nsteps); - gr_complex actual = intr.interpolate (&input[i], imu * inv_nsteps); - - CPPUNIT_ASSERT_COMPLEXES_EQUAL (expected, actual, 0.004); - // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual); - } - } -} - -void -qa_gri_mmse_fir_interpolator_cc::t2() -{ - CPPUNIT_ASSERT_THROW(t2_body(), std::invalid_argument); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.h b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.h deleted file mode 100644 index 6be3d97433..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 _QA_GRI_MMSE_FIR_INTERPOLATOR_CC_H_ -#define _QA_GRI_MMSE_FIR_INTERPOLATOR_CC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_mmse_fir_interpolator_cc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE(qa_gri_mmse_fir_interpolator_cc); - CPPUNIT_TEST(t1); - // CPPUNIT_TEST(t2); - CPPUNIT_TEST_SUITE_END(); - - private: - void t1(); - void t2(); - void t2_body(); - -}; - -#endif /* _QA_GRI_MMSE_FIR_INTERPOLATOR_CC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_rotator.cc b/gnuradio-core/src/lib/filter/qa_rotator.cc new file mode 100644 index 0000000000..b722f32c43 --- /dev/null +++ b/gnuradio-core/src/lib/filter/qa_rotator.cc @@ -0,0 +1,81 @@ +/* -*- 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/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.h b/gnuradio-core/src/lib/filter/qa_rotator.h index 0535e66528..a22e41ec26 100644 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.h +++ b/gnuradio-core/src/lib/filter/qa_rotator.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2008,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,22 +19,27 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -#ifndef _QA_GR_FIR_CCC_H_ -#define _QA_GR_FIR_CCC_H_ + +#ifndef _QA_ANALOG_ROTATOR_H_ +#define _QA_ANALOG_ROTATOR_H_ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class qa_gr_fir_ccc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fir_ccc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); +namespace gr { + namespace analog { - private: - void t1 (); + 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_GR_FIR_CCC_H_ */ +#endif /* _QA_ANALOG_ROTATOR_H_ */ diff --git a/gnuradio-core/src/lib/filter/short_dotprod_generic.c b/gnuradio-core/src/lib/filter/short_dotprod_generic.c deleted file mode 100644 index 49a9c0483c..0000000000 --- a/gnuradio-core/src/lib/filter/short_dotprod_generic.c +++ /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. - */ - -#include "short_dotprod_generic.h" - - -int -short_dotprod_generic (const short *input, - const short *taps, unsigned n_4_short_blocks) -{ - int sum0 = 0; - int sum1 = 0; - int sum2 = 0; - int sum3 = 0; - - do { - - sum0 += input[0] * taps[0]; - sum1 += input[1] * taps[1]; - sum2 += input[2] * taps[2]; - sum3 += input[3] * taps[3]; - - input += 4; - taps += 4; - - } while (--n_4_short_blocks != 0); - - - return (sum0 + sum1 + sum2 + sum3); -} diff --git a/gnuradio-core/src/lib/filter/short_dotprod_generic.h b/gnuradio-core/src/lib/filter/short_dotprod_generic.h deleted file mode 100644 index e7d977a007..0000000000 --- a/gnuradio-core/src/lib/filter/short_dotprod_generic.h +++ /dev/null @@ -1,41 +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 _SHORT_DOTPROD_GENERIC_H_ -#define _SHORT_DOTPROD_GENERIC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -int -short_dotprod_generic (const short *input, - const short *taps, unsigned n_4_short_blocks); - - -#ifdef __cplusplus -} -#endif - - - -#endif /* _SHORT_DOTPROD_GENERIC_H_ */ diff --git a/gnuradio-core/src/lib/filter/short_dotprod_mmx.S b/gnuradio-core/src/lib/filter/short_dotprod_mmx.S deleted file mode 100644 index 0f6801e4bb..0000000000 --- a/gnuradio-core/src/lib/filter/short_dotprod_mmx.S +++ /dev/null @@ -1,117 +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. -# - -# SIMD MMX dot product -# Equivalent to the following C code: -# long dotprod(signed short *a,signed short *b,int cnt) -# { -# long sum = 0; -# cnt *= 4; -# while(cnt--) -# sum += *a++ + *b++; -# return sum; -# } -# a and b should also be 64-bit aligned, or speed will suffer greatly -# Copyright 1999, Phil Karn KA9Q -# May be used under the terms of the GNU public license - -#include "assembly.h" - - - .file "short_dotprod_mmx.S" -// .version "01.01" -.text - .p2align 3 -.globl GLOB_SYMB(short_dotprod_mmx) - DEF_FUNC_HEAD(short_dotprod_mmx) -GLOB_SYMB(short_dotprod_mmx): - pushl %ebp - movl %esp,%ebp - pushl %esi - pushl %edi - pushl %ecx - pushl %ebx - movl 8(%ebp),%esi # a - movl 12(%ebp),%edi # b - movl 16(%ebp),%ecx # cnt - pxor %mm0,%mm0 # clear running sum (in two 32-bit halves) - -# MMX dot product loop unrolled 4 times, crunching 16 terms per loop - .p2align 4 -.Loop1mmx: subl $4,%ecx - jl .Loop1Done - - movq (%esi),%mm1 # mm1 = a[3],a[2],a[1],a[0] - pmaddwd (%edi),%mm1 # mm1 = b[3]*a[3]+b[2]*a[2],b[1]*a[1]+b[0]*a[0] - paddd %mm1,%mm0 - - movq 8(%esi),%mm1 - pmaddwd 8(%edi),%mm1 - paddd %mm1,%mm0 - - movq 16(%esi),%mm1 - pmaddwd 16(%edi),%mm1 - paddd %mm1,%mm0 - - movq 24(%esi),%mm1 - addl $32,%esi - pmaddwd 24(%edi),%mm1 - addl $32,%edi - paddd %mm1,%mm0 - - jmp .Loop1mmx -.Loop1Done: - - addl $4,%ecx - -# MMX dot product loop, not unrolled, crunching 4 terms per loop -# This could be redone as Duff's Device on the unrolled loop above -.Loop2: subl $1,%ecx - jl .Loop2Done - - movq (%esi),%mm1 - addl $8,%esi - pmaddwd (%edi),%mm1 - addl $8,%edi - paddd %mm1,%mm0 - jmp .Loop2 -.Loop2Done: - - movd %mm0,%ebx # right-hand word to ebx - punpckhdq %mm0,%mm0 # left-hand word to right side of %mm0 - movd %mm0,%eax - addl %ebx,%eax # running sum now in %eax - emms # done with MMX - - popl %ebx - popl %ecx - popl %edi - popl %esi - movl %ebp,%esp - popl %ebp - ret - -FUNC_TAIL(short_dotprod_mmx) - .ident "Hand coded x86 MMX assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/short_dotprod_mmx64.S b/gnuradio-core/src/lib/filter/short_dotprod_mmx64.S deleted file mode 100644 index bafd0e04e2..0000000000 --- a/gnuradio-core/src/lib/filter/short_dotprod_mmx64.S +++ /dev/null @@ -1,105 +0,0 @@ -# -# Copyright 2002,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. -# - -# SIMD MMX dot product -# Equivalent to the following C code: -# long dotprod(signed short *a,signed short *b,int cnt) -# { -# long sum = 0; -# cnt *= 4; -# while(cnt--) -# sum += *a++ + *b++; -# return sum; -# } -# a and b should also be 64-bit aligned, or speed will suffer greatly -# Copyright 1999, Phil Karn KA9Q -# May be used under the terms of the GNU public license - -#include "assembly.h" - - - .file "short_dotprod_mmx64.S" -// .version "01.01" -.text - .p2align 3 -.globl GLOB_SYMB(short_dotprod_mmx) - DEF_FUNC_HEAD(short_dotprod_mmx) -GLOB_SYMB(short_dotprod_mmx): - - # a: rdi, b: rsi, cnt: rdx - - pxor %mm0,%mm0 # clear running sum (in two 32-bit halves) - -# MMX dot product loop unrolled 4 times, crunching 16 terms per loop - .p2align 4 -.Loop1mmx: sub $4,%rdx - jl .Loop1Done - - movq (%rdi),%mm1 # mm1 = a[3],a[2],a[1],a[0] - pmaddwd (%rsi),%mm1 # mm1 = b[3]*a[3]+b[2]*a[2],b[1]*a[1]+b[0]*a[0] - paddd %mm1,%mm0 - - movq 8(%rdi),%mm1 - pmaddwd 8(%rsi),%mm1 - paddd %mm1,%mm0 - - movq 16(%rdi),%mm1 - pmaddwd 16(%rsi),%mm1 - paddd %mm1,%mm0 - - movq 24(%rdi),%mm1 - add $32,%rdi - pmaddwd 24(%rsi),%mm1 - add $32,%rsi - paddd %mm1,%mm0 - - jmp .Loop1mmx -.Loop1Done: - - add $4,%rdx - -# MMX dot product loop, not unrolled, crunching 4 terms per loop -# This could be redone as Duff's Device on the unrolled loop above -.Loop2: sub $1,%rdx - jl .Loop2Done - - movq (%rdi),%mm1 - add $8,%rdi - pmaddwd (%rsi),%mm1 - add $8,%rsi - paddd %mm1,%mm0 - jmp .Loop2 -.Loop2Done: - - movd %mm0,%edx # right-hand word to edx - punpckhdq %mm0,%mm0 # left-hand word to right side of %mm0 - movd %mm0,%eax - addl %edx,%eax # running sum now in %eax - emms # done with MMX - - retq - -FUNC_TAIL(short_dotprod_mmx) - .ident "Hand coded x86_64 MMX assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/short_dotprod_x86.h b/gnuradio-core/src/lib/filter/short_dotprod_x86.h deleted file mode 100644 index 13d5ae2a3c..0000000000 --- a/gnuradio-core/src/lib/filter/short_dotprod_x86.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 _SHORT_DOTPROD_X86_H_ -#define _SHORT_DOTPROD_X86_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -int -short_dotprod_mmx (const short *input, - const short *taps, unsigned n_4_short_blocks); - -int -short_dotprod_sse2 (const short *input, - const short *taps, unsigned n_4_short_blocks); - -#ifdef __cplusplus -} -#endif - - - -#endif /* _SHORT_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/sse_debug.c b/gnuradio-core/src/lib/filter/sse_debug.c deleted file mode 100644 index 870cc0543e..0000000000 --- a/gnuradio-core/src/lib/filter/sse_debug.c +++ /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 <stdio.h> -#include <sse_debug.h> -#include <string.h> - -void -format_xmm_regs (FILE *f, struct xmm_regs *r) -{ - int i; - - for (i = 0; i < 8; i++){ - union xmm_register *x = &r->xmm[i]; - fprintf (f, "xmm%d: %08lx %08lx %08lx %08lx", i, - x->ul[0], x->ul[1], x->ul[2], x->ul[3]); - fprintf (f, " %12g %12g %12g %12g\n", - x->f[0], x->f[1], x->f[2], x->f[3]); - } -} - - -void -get_xmm_regs (struct xmm_regs *x) -{ - asm ("movups %%xmm0,0x00(%0); \n" - "movups %%xmm1,0x10(%0); \n" - "movups %%xmm2,0x20(%0); \n" - "movups %%xmm3,0x30(%0); \n" - "movups %%xmm4,0x40(%0); \n" - "movups %%xmm5,0x50(%0); \n" - "movups %%xmm6,0x60(%0); \n" - "movups %%xmm7,0x70(%0); \n" : : "r" (x)); -} - -void -dump_xmm_regs (void) -{ - struct xmm_regs r; - - get_xmm_regs (&r); - format_xmm_regs (stderr, &r); -} - diff --git a/gnuradio-core/src/lib/filter/sse_debug.h b/gnuradio-core/src/lib/filter/sse_debug.h deleted file mode 100644 index b19b4e646c..0000000000 --- a/gnuradio-core/src/lib/filter/sse_debug.h +++ /dev/null @@ -1,48 +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 _SSE_DEBUG_H_ -#define _SSE_DEBUG_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - union xmm_register { - unsigned long ul[4]; - float f[4]; - }; - - struct xmm_regs { - union xmm_register xmm[8]; - }; - - // callable from asm, dumps all xmm regs - void dump_xmm_regs (void); - - void get_xmm_regs (struct xmm_regs *x); - -#ifdef __cplusplus -} -#endif - -#endif // _SSE_DEBUG_H_ diff --git a/gnuradio-core/src/lib/filter/sysconfig_armv7_a.cc b/gnuradio-core/src/lib/filter/sysconfig_armv7_a.cc deleted file mode 100644 index 2c415863b5..0000000000 --- a/gnuradio-core/src/lib/filter/sysconfig_armv7_a.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 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_fir_sysconfig_armv7_a.h> - -gr_fir_sysconfig * -gr_fir_sysconfig_singleton () -{ - static gr_fir_sysconfig *singleton = 0; - - if (singleton) - return singleton; - - singleton = new gr_fir_sysconfig_armv7_a (); - return singleton; -} diff --git a/gnuradio-core/src/lib/filter/sysconfig_generic.cc b/gnuradio-core/src/lib/filter/sysconfig_generic.cc deleted file mode 100644 index 88508f62b1..0000000000 --- a/gnuradio-core/src/lib/filter/sysconfig_generic.cc +++ /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. - */ - -#include <gr_fir_sysconfig_generic.h> - -gr_fir_sysconfig * -gr_fir_sysconfig_singleton () -{ - static gr_fir_sysconfig *singleton = 0; - - if (singleton) - return singleton; - - singleton = new gr_fir_sysconfig_generic (); - return singleton; -} diff --git a/gnuradio-core/src/lib/filter/sysconfig_powerpc.cc b/gnuradio-core/src/lib/filter/sysconfig_powerpc.cc deleted file mode 100644 index 911beae2a7..0000000000 --- a/gnuradio-core/src/lib/filter/sysconfig_powerpc.cc +++ /dev/null @@ -1,38 +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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_sysconfig_powerpc.h> - -gr_fir_sysconfig * -gr_fir_sysconfig_singleton () -{ - static gr_fir_sysconfig *singleton = 0; - - if (singleton) - return singleton; - - singleton = new gr_fir_sysconfig_powerpc (); - return singleton; -} diff --git a/gnuradio-core/src/lib/filter/sysconfig_x86.cc b/gnuradio-core/src/lib/filter/sysconfig_x86.cc deleted file mode 100644 index 582df0ab72..0000000000 --- a/gnuradio-core/src/lib/filter/sysconfig_x86.cc +++ /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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_sysconfig_x86.h> - -gr_fir_sysconfig * -gr_fir_sysconfig_singleton () -{ - static gr_fir_sysconfig *singleton = 0; - - if (singleton) - return singleton; - - singleton = new gr_fir_sysconfig_x86 (); - return singleton; -} diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index ce9a80f377..26dab910c9 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -71,25 +71,14 @@ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/gr_circular_file.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_count_bits.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_fast_atan2f.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fft_vcc_fftw.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_misc.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_random.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_reverse.cc ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss_generic.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_char_to_float.cc ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.cc ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.cc ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_char.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_int.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_glfsr.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_int_to_float.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_short_to_float.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_uchar_to_float.cc ${CMAKE_CURRENT_SOURCE_DIR}/malloc16.c ) @@ -99,13 +88,11 @@ list(APPEND gnuradio_core_sources list(APPEND test_gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/qa_general.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_circular_file.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_cpm.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_firdes.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt_nco.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt_vco.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_math.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_lfsr.cc ) ######################################################################## @@ -117,7 +104,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_count_bits.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_expj.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fft_vcc_fftw.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt_nco.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt_vco.h @@ -131,26 +117,11 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_test_types.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_vco.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_char_to_float.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_char.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_int.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_glfsr.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_15_1_0.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_32k.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_int_to_float.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_short_to_float.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_uchar_to_float.h ${CMAKE_CURRENT_SOURCE_DIR}/malloc16.h ${CMAKE_CURRENT_SOURCE_DIR}/random.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio @@ -164,10 +135,6 @@ if(ENABLE_PYTHON) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/general.i ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.i ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig" @@ -179,130 +146,62 @@ endif(ENABLE_PYTHON) ######################################################################## set(gr_core_general_triple_threats complex_vec_test - gr_add_ff - gr_additive_scrambler_bb - gr_agc_cc - gr_agc_ff - gr_agc2_cc - gr_agc2_ff gr_align_on_samplenumbers_ss gr_bin_statistics_f gr_block_gateway - gr_bytes_to_syms - gr_char_to_float - gr_char_to_short gr_check_counting_s gr_check_lfsr_32k_s gr_complex_to_interleaved_short gr_complex_to_xxx - gr_conjugate_cc gr_copy - gr_cpfsk_bc - gr_cpm - gr_ctcss_squelch_ff - gr_decode_ccsds_27_fb - gr_diff_decoder_bb - gr_diff_encoder_bb - gr_diff_phasor_cc - gr_dpll_bb - gr_deinterleave gr_delay - gr_encode_ccsds_27_bb gr_endian_swap gr_fake_channel_coder_pp - gr_feedforward_agc_cc gr_feval - gr_fft_vcc - gr_fft_vfc gr_firdes - gr_float_to_char - gr_float_to_complex - gr_float_to_int - gr_float_to_short - gr_float_to_uchar - gr_fmdet_cf - gr_frequency_modulator_fc - gr_framer_sink_1 - gr_glfsr_source_b - gr_glfsr_source_f gr_head - gr_int_to_float - gr_interleave - gr_interleaved_short_to_complex gr_iqcomp_cc - gr_keep_one_in_n - gr_keep_m_in_n gr_kludge_copy gr_lfsr_32k_source_s - gr_map_bb - gr_multiply_cc - gr_multiply_ff - gr_multiply_const_cc - gr_multiply_const_ff - gr_multiply_conjugate_cc - gr_nlog10_ff gr_nop gr_null_sink gr_null_source gr_pa_2x2_phase_combiner - gr_packet_sink gr_peak_detector2_fb - gr_phase_modulator_fc - gr_pll_carriertracking_cc - gr_pll_freqdet_cf - gr_pll_refout_cc - gr_pn_correlator_cc gr_prefs - gr_probe_avg_mag_sqrd_c - gr_probe_avg_mag_sqrd_cf - gr_probe_avg_mag_sqrd_f - gr_pwr_squelch_cc - gr_pwr_squelch_ff - gr_quadrature_demod_cf gr_random_pdu - gr_rail_ff gr_regenerate_bb gr_remez gr_rms_cf gr_rms_ff - gr_repeat - gr_short_to_float - gr_short_to_char gr_simple_correlator - gr_simple_framer - gr_simple_squelch_cc gr_skiphead - gr_squelch_base_cc - gr_squelch_base_ff - gr_stream_mux - gr_stream_to_streams - gr_stream_to_vector - gr_streams_to_stream - gr_streams_to_vector gr_stretch_ff gr_test gr_threshold_ff gr_throttle gr_transcendental - gr_uchar_to_float gr_vco_f gr_vector_map - gr_vector_to_stream - gr_vector_to_streams gr_unpack_k_bits_bb gr_pack_k_bits_bb - gr_descrambler_bb - gr_scrambler_bb - gr_probe_density_b gr_annotator_alltoall gr_annotator_1to1 gr_annotator_raw gr_burst_tagger - gr_correlate_access_code_tag_bb gr_tag_debug gr_message_strobe ) +if(ENABLE_GR_CTRLPORT) +ADD_DEFINITIONS(-DGR_CTRLPORT) +list(APPEND gr_core_general_triple_threats + gr_ctrlport_probe_c + gr_ctrlport_probe2_c +) +endif(ENABLE_GR_CTRLPORT) + + foreach(file_tt ${gr_core_general_triple_threats}) list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel") diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index b727bc8a6f..e379c40867 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -28,73 +28,26 @@ #include <gr_null_source.h> #include <gr_head.h> #include <gr_skiphead.h> -#include <gr_quadrature_demod_cf.h> #include <gr_remez.h> -#include <gr_float_to_complex.h> #include <gr_check_counting_s.h> #include <gr_lfsr_32k_source_s.h> #include <gr_check_lfsr_32k_s.h> -#include <gr_stream_to_vector.h> -#include <gr_vector_to_stream.h> -#include <gr_keep_one_in_n.h> -#include <gr_keep_m_in_n.h> -#include <gr_fft_vcc.h> -#include <gr_fft_vfc.h> -#include <gr_float_to_int.h> -#include <gr_float_to_short.h> -#include <gr_float_to_char.h> -#include <gr_float_to_uchar.h> -#include <gr_short_to_float.h> -#include <gr_short_to_char.h> -#include <gr_int_to_float.h> -#include <gr_char_to_float.h> -#include <gr_char_to_short.h> -#include <gr_uchar_to_float.h> -#include <gr_frequency_modulator_fc.h> -#include <gr_phase_modulator_fc.h> -#include <gr_bytes_to_syms.h> #include <gr_simple_correlator.h> -#include <gr_simple_framer.h> #include <gr_align_on_samplenumbers_ss.h> #include <gr_complex_to_xxx.h> #include <gr_complex_to_interleaved_short.h> -#include <gr_interleaved_short_to_complex.h> //#include <gr_endianness.h> #include <gr_endian_swap.h> #include <gr_firdes.h> -#include <gr_interleave.h> -#include <gr_deinterleave.h> #include <gr_delay.h> -#include <gr_simple_squelch_cc.h> -#include <gr_agc_ff.h> -#include <gr_agc_cc.h> -#include <gr_agc2_ff.h> -#include <gr_agc2_cc.h> #include <gr_random_pdu.h> #include <gr_rms_cf.h> #include <gr_rms_ff.h> -#include <gr_nlog10_ff.h> #include <gr_fake_channel_coder_pp.h> #include <gr_throttle.h> #include <gr_transcendental.h> -#include <gr_stream_mux.h> -#include <gr_stream_to_streams.h> -#include <gr_streams_to_stream.h> -#include <gr_streams_to_vector.h> -#include <gr_vector_to_streams.h> -#include <gr_conjugate_cc.h> #include <gr_vco_f.h> #include <gr_threshold_ff.h> -#include <gr_packet_sink.h> -#include <gr_dpll_bb.h> -#include <gr_fmdet_cf.h> -#include <gr_pll_freqdet_cf.h> -#include <gr_pll_refout_cc.h> -#include <gr_pll_carriertracking_cc.h> -#include <gr_pn_correlator_cc.h> -#include <gr_probe_avg_mag_sqrd_c.h> -#include <gr_probe_avg_mag_sqrd_cf.h> -#include <gr_probe_avg_mag_sqrd_f.h> #include <gr_regenerate_bb.h> #include <gr_pa_2x2_phase_combiner.h> #include <gr_kludge_copy.h> @@ -104,44 +57,16 @@ #include <gr_test.h> #include <gr_unpack_k_bits_bb.h> #include <gr_pack_k_bits_bb.h> -#include <gr_diff_phasor_cc.h> -#include <gr_diff_encoder_bb.h> -#include <gr_diff_decoder_bb.h> -#include <gr_framer_sink_1.h> -#include <gr_map_bb.h> -#include <gr_multiply_cc.h> -#include <gr_multiply_ff.h> -#include <gr_multiply_const_cc.h> -#include <gr_multiply_const_ff.h> -#include <gr_multiply_conjugate_cc.h> #include <gr_feval.h> -#include <gr_pwr_squelch_cc.h> -#include <gr_pwr_squelch_ff.h> -#include <gr_ctcss_squelch_ff.h> -#include <gr_feedforward_agc_cc.h> #include <gr_bin_statistics_f.h> -#include <gr_glfsr_source_b.h> -#include <gr_glfsr_source_f.h> #include <gr_peak_detector2_fb.h> -#include <gr_repeat.h> -#include <gr_cpfsk_bc.h> -#include <gr_encode_ccsds_27_bb.h> -#include <gr_decode_ccsds_27_fb.h> -#include <gr_descrambler_bb.h> -#include <gr_scrambler_bb.h> -#include <gr_probe_density_b.h> -#include <gr_rail_ff.h> #include <gr_stretch_ff.h> #include <gr_copy.h> -#include <gr_additive_scrambler_bb.h> #include <complex_vec_test.h> #include <gr_annotator_alltoall.h> #include <gr_annotator_1to1.h> #include <gr_annotator_raw.h> #include <gr_burst_tagger.h> -#include <gr_cpm.h> -#include <gr_correlate_access_code_tag_bb.h> -#include <gr_add_ff.h> #include <gr_vector_map.h> #include <gr_tag_debug.h> #include <gr_message_strobe.h> @@ -153,73 +78,26 @@ %include "gr_null_source.i" %include "gr_head.i" %include "gr_skiphead.i" -%include "gr_quadrature_demod_cf.i" %include "gr_remez.i" -%include "gr_float_to_complex.i" %include "gr_check_counting_s.i" %include "gr_lfsr_32k_source_s.i" %include "gr_check_lfsr_32k_s.i" -%include "gr_stream_to_vector.i" -%include "gr_vector_to_stream.i" -%include "gr_keep_one_in_n.i" -%include "gr_keep_m_in_n.i" -%include "gr_fft_vcc.i" -%include "gr_fft_vfc.i" -%include "gr_float_to_int.i" -%include "gr_float_to_short.i" -%include "gr_float_to_char.i" -%include "gr_float_to_uchar.i" -%include "gr_short_to_float.i" -%include "gr_short_to_char.i" -%include "gr_int_to_float.i" -%include "gr_char_to_float.i" -%include "gr_char_to_short.i" -%include "gr_uchar_to_float.i" -%include "gr_frequency_modulator_fc.i" -%include "gr_phase_modulator_fc.i" -%include "gr_bytes_to_syms.i" %include "gr_simple_correlator.i" -%include "gr_simple_framer.i" %include "gr_align_on_samplenumbers_ss.i" %include "gr_complex_to_xxx.i" %include "gr_complex_to_interleaved_short.i" //%include "gr_endianness.i" %include "gr_endian_swap.i" -%include "gr_interleaved_short_to_complex.i" %include "gr_firdes.i" -%include "gr_interleave.i" -%include "gr_deinterleave.i" %include "gr_delay.i" -%include "gr_simple_squelch_cc.i" -%include "gr_agc_ff.i" -%include "gr_agc_cc.i" -%include "gr_agc2_ff.i" -%include "gr_agc2_cc.i" %include "gr_random_pdu.i" %include "gr_rms_cf.i" %include "gr_rms_ff.i" -%include "gr_nlog10_ff.i" %include "gr_fake_channel_coder_pp.i" %include "gr_throttle.i" %include "gr_transcendental.i" -%include "gr_stream_mux.i" -%include "gr_stream_to_streams.i" -%include "gr_streams_to_stream.i" -%include "gr_streams_to_vector.i" -%include "gr_vector_to_streams.i" -%include "gr_conjugate_cc.i" %include "gr_vco_f.i" %include "gr_threshold_ff.i" -%include "gr_packet_sink.i" -%include "gr_dpll_bb.i" -%include "gr_fmdet_cf.i" -%include "gr_pll_freqdet_cf.i" -%include "gr_pll_refout_cc.i" -%include "gr_pll_carriertracking_cc.i" -%include "gr_pn_correlator_cc.i" -%include "gr_probe_avg_mag_sqrd_c.i" -%include "gr_probe_avg_mag_sqrd_cf.i" -%include "gr_probe_avg_mag_sqrd_f.i" %include "gr_regenerate_bb.i" %include "gr_pa_2x2_phase_combiner.i" %include "gr_kludge_copy.i" @@ -229,45 +107,30 @@ %include "gr_test.i" %include "gr_unpack_k_bits_bb.i" %include "gr_pack_k_bits_bb.i" -%include "gr_diff_phasor_cc.i" -%include "gr_diff_encoder_bb.i" -%include "gr_diff_decoder_bb.i" -%include "gr_framer_sink_1.i" -%include "gr_map_bb.i" -%include "gr_multiply_cc.i" -%include "gr_multiply_ff.i" -%include "gr_multiply_const_cc.i" -%include "gr_multiply_const_ff.i" -%include "gr_multiply_conjugate_cc.i" %include "gr_feval.i" -%include "gr_pwr_squelch_cc.i" -%include "gr_pwr_squelch_ff.i" -%include "gr_ctcss_squelch_ff.i" -%include "gr_feedforward_agc_cc.i" %include "gr_bin_statistics_f.i" -%include "gr_glfsr_source_b.i" -%include "gr_glfsr_source_f.i" %include "gr_peak_detector2_fb.i" -%include "gr_repeat.i" -%include "gr_cpfsk_bc.i" -%include "gr_encode_ccsds_27_bb.i" -%include "gr_decode_ccsds_27_fb.i" -%include "gr_descrambler_bb.i" -%include "gr_scrambler_bb.i" -%include "gr_probe_density_b.i" -%include "gr_rail_ff.i" %include "gr_stretch_ff.i" %include "gr_copy.i" -%include "gr_additive_scrambler_bb.i" %include "complex_vec_test.i" %include "gr_annotator_alltoall.i" %include "gr_annotator_1to1.i" %include "gr_annotator_raw.i" %include "gr_burst_tagger.i" -%include "gr_cpm.i" -%include "gr_correlate_access_code_tag_bb.i" -%include "gr_add_ff.i" %include "gr_vector_map.i" %include "gr_tag_debug.i" %include "gr_block_gateway.i" %include "gr_message_strobe.i" + + +#ifdef GR_CTRLPORT + +%{ +#include <gr_ctrlport_probe_c.h> +#include <gr_ctrlport_probe2_c.h> +%} + +%include "gr_ctrlport_probe_c.i" +%include "gr_ctrlport_probe2_c.i" + +#endif /* GR_CTRLPORT */ diff --git a/gnuradio-core/src/lib/general/general_generated.i b/gnuradio-core/src/lib/general/general_generated.i index 89b7e1776e..251406c99e 100644 --- a/gnuradio-core/src/lib/general/general_generated.i +++ b/gnuradio-core/src/lib/general/general_generated.i @@ -2,52 +2,10 @@ // This file is machine generated. All edits will be overwritten // %{ -#include <gr_add_cc.h> -#include <gr_add_const_cc.h> -#include <gr_add_const_ff.h> -#include <gr_add_const_ii.h> -#include <gr_add_const_sf.h> -#include <gr_add_const_ss.h> -#include <gr_add_const_vcc.h> -#include <gr_add_const_vff.h> -#include <gr_add_const_vii.h> -#include <gr_add_const_vss.h> -#include <gr_add_ii.h> -#include <gr_add_ss.h> -#include <gr_add_vcc.h> -#include <gr_add_vff.h> -#include <gr_add_vii.h> -#include <gr_add_vss.h> -#include <gr_chunks_to_symbols_bc.h> -#include <gr_chunks_to_symbols_bf.h> -#include <gr_chunks_to_symbols_ic.h> -#include <gr_chunks_to_symbols_if.h> -#include <gr_chunks_to_symbols_sc.h> -#include <gr_chunks_to_symbols_sf.h> -#include <gr_divide_cc.h> -#include <gr_divide_ff.h> -#include <gr_divide_ii.h> -#include <gr_divide_ss.h> -#include <gr_multiply_const_ii.h> -#include <gr_multiply_const_ss.h> -#include <gr_multiply_const_vcc.h> -#include <gr_multiply_const_vff.h> -#include <gr_multiply_const_vii.h> -#include <gr_multiply_const_vss.h> -#include <gr_multiply_ii.h> -#include <gr_multiply_ss.h> -#include <gr_multiply_vcc.h> -#include <gr_multiply_vff.h> -#include <gr_multiply_vii.h> -#include <gr_multiply_vss.h> #include <gr_mute_cc.h> #include <gr_mute_ff.h> #include <gr_mute_ii.h> #include <gr_mute_ss.h> -#include <gr_noise_source_c.h> -#include <gr_noise_source_f.h> -#include <gr_noise_source_i.h> -#include <gr_noise_source_s.h> #include <gr_packed_to_unpacked_bb.h> #include <gr_packed_to_unpacked_ii.h> #include <gr_packed_to_unpacked_ss.h> @@ -61,14 +19,6 @@ #include <gr_probe_signal_vi.h> #include <gr_probe_signal_vf.h> #include <gr_probe_signal_vc.h> -#include <gr_sig_source_c.h> -#include <gr_sig_source_f.h> -#include <gr_sig_source_i.h> -#include <gr_sig_source_s.h> -#include <gr_sub_cc.h> -#include <gr_sub_ff.h> -#include <gr_sub_ii.h> -#include <gr_sub_ss.h> #include <gr_unpacked_to_packed_bb.h> #include <gr_unpacked_to_packed_ii.h> #include <gr_unpacked_to_packed_ss.h> @@ -84,52 +34,10 @@ #include <gr_vector_source_s.h> %} -%include <gr_add_cc.i> -%include <gr_add_const_cc.i> -%include <gr_add_const_ff.i> -%include <gr_add_const_ii.i> -%include <gr_add_const_sf.i> -%include <gr_add_const_ss.i> -%include <gr_add_const_vcc.i> -%include <gr_add_const_vff.i> -%include <gr_add_const_vii.i> -%include <gr_add_const_vss.i> -%include <gr_add_ii.i> -%include <gr_add_ss.i> -%include <gr_add_vcc.i> -%include <gr_add_vff.i> -%include <gr_add_vii.i> -%include <gr_add_vss.i> -%include <gr_chunks_to_symbols_bc.i> -%include <gr_chunks_to_symbols_bf.i> -%include <gr_chunks_to_symbols_ic.i> -%include <gr_chunks_to_symbols_if.i> -%include <gr_chunks_to_symbols_sc.i> -%include <gr_chunks_to_symbols_sf.i> -%include <gr_divide_cc.i> -%include <gr_divide_ff.i> -%include <gr_divide_ii.i> -%include <gr_divide_ss.i> -%include <gr_multiply_const_ii.i> -%include <gr_multiply_const_ss.i> -%include <gr_multiply_const_vcc.i> -%include <gr_multiply_const_vff.i> -%include <gr_multiply_const_vii.i> -%include <gr_multiply_const_vss.i> -%include <gr_multiply_ii.i> -%include <gr_multiply_ss.i> -%include <gr_multiply_vcc.i> -%include <gr_multiply_vff.i> -%include <gr_multiply_vii.i> -%include <gr_multiply_vss.i> %include <gr_mute_cc.i> %include <gr_mute_ff.i> %include <gr_mute_ii.i> %include <gr_mute_ss.i> -%include <gr_noise_source_c.i> -%include <gr_noise_source_f.i> -%include <gr_noise_source_i.i> -%include <gr_noise_source_s.i> %include <gr_packed_to_unpacked_bb.i> %include <gr_packed_to_unpacked_ii.i> %include <gr_packed_to_unpacked_ss.i> @@ -143,14 +51,6 @@ %include <gr_probe_signal_vi.i> %include <gr_probe_signal_vf.i> %include <gr_probe_signal_vc.i> -%include <gr_sig_source_c.i> -%include <gr_sig_source_f.i> -%include <gr_sig_source_i.i> -%include <gr_sig_source_s.i> -%include <gr_sub_cc.i> -%include <gr_sub_ff.i> -%include <gr_sub_ii.i> -%include <gr_sub_ss.i> %include <gr_unpacked_to_packed_bb.i> %include <gr_unpacked_to_packed_ii.i> %include <gr_unpacked_to_packed_ss.i> diff --git a/gnuradio-core/src/lib/general/gr_add_ff.cc b/gnuradio-core/src/lib/general/gr_add_ff.cc deleted file mode 100644 index 5f6676bb7b..0000000000 --- a/gnuradio-core/src/lib/general/gr_add_ff.cc +++ /dev/null @@ -1,66 +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 <gr_add_ff.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_add_ff_sptr -gr_make_add_ff(size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_add_ff(vlen)); -} - -gr_add_ff::gr_add_ff (size_t vlen) - : gr_sync_block("add_ff", - gr_make_io_signature (1, -1, sizeof(float)*vlen), - gr_make_io_signature (1, 1, sizeof(float)*vlen)), - d_vlen (vlen) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(float); - set_alignment(std::max(1,alignment_multiple)); -} - -int -gr_add_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *out = (float *) output_items[0]; - int noi = d_vlen*noutput_items; - - memcpy(out, input_items[0], noi*sizeof(float)); - if(is_unaligned()) { - for(size_t i = 1; i < input_items.size(); i++) - volk_32f_x2_add_32f_u(out, out, (const float*)input_items[i], noi); - } - else { - for(size_t i = 1; i < input_items.size(); i++) - volk_32f_x2_add_32f_a(out, out, (const float*)input_items[i], noi); - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc deleted file mode 100644 index 35cbb9572f..0000000000 --- a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_additive_scrambler_bb.h> -#include <gr_io_signature.h> - -gr_additive_scrambler_bb_sptr -gr_make_additive_scrambler_bb(int mask, int seed, int len, int count) -{ - return gnuradio::get_initial_sptr(new gr_additive_scrambler_bb(mask, seed, len, count)); -} - -gr_additive_scrambler_bb::gr_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 -gr_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/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h deleted file mode 100644 index 1c336306d6..0000000000 --- a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ -#ifndef INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H -#define INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include "gri_lfsr.h" - -class gr_additive_scrambler_bb; -typedef boost::shared_ptr<gr_additive_scrambler_bb> gr_additive_scrambler_bb_sptr; - -GR_CORE_API gr_additive_scrambler_bb_sptr gr_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 GR_CORE_API gr_additive_scrambler_bb : public gr_sync_block -{ - friend GR_CORE_API gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count); - - gri_lfsr d_lfsr; - int d_count; - int d_bits; - - gr_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/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i deleted file mode 100644 index acf9e8c47e..0000000000 --- a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,additive_scrambler_bb); - -gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count=0); - -class gr_additive_scrambler_bb : public gr_sync_block -{ -private: - gr_additive_scrambler_bb(int mask, int seed, int len, int count); -}; diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.cc b/gnuradio-core/src/lib/general/gr_agc2_cc.cc deleted file mode 100644 index 5097babc9b..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_cc.cc +++ /dev/null @@ -1,56 +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 <gr_agc2_cc.h> -#include <gr_io_signature.h> -#include <gri_agc2_cc.h> - -gr_agc2_cc_sptr -gr_make_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc2_cc (attack_rate, decay_rate, reference, gain, max_gain)); -} - -gr_agc2_cc::gr_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) - : gr_sync_block ("gr_agc2_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - gri_agc2_cc (attack_rate, decay_rate, reference, gain, max_gain) -{ -} - -int -gr_agc2_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]; - scaleN (out, in, noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.h b/gnuradio-core/src/lib/general/gr_agc2_cc.h deleted file mode 100644 index 54bae1aae9..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_cc.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_GR_AGC2_CC_H -#define INCLUDED_GR_AGC2_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc2_cc.h> - -class gr_agc2_cc; -typedef boost::shared_ptr<gr_agc2_cc> gr_agc2_cc_sptr; - -GR_CORE_API gr_agc2_cc_sptr -gr_make_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); -/*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * For Power the absolute value of the complex number is used. - */ - -class GR_CORE_API gr_agc2_cc : public gr_sync_block, public gri_agc2_cc -{ - friend GR_CORE_API gr_agc2_cc_sptr gr_make_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); - gr_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_AGC2_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.i b/gnuradio-core/src/lib/general/gr_agc2_cc.i deleted file mode 100644 index 6d7b221010..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_cc.i +++ /dev/null @@ -1,35 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,agc2_cc) - -%include <gri_agc2_cc.i> - -gr_agc2_cc_sptr -gr_make_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); - -class gr_agc2_cc : public gr_sync_block , public gri_agc2_cc -{ - gr_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.cc b/gnuradio-core/src/lib/general/gr_agc2_ff.cc deleted file mode 100644 index 792ee1c6be..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_ff.cc +++ /dev/null @@ -1,57 +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_agc2_ff.h> -#include <gr_io_signature.h> -#include <gri_agc2_ff.h> - -gr_agc2_ff_sptr -gr_make_agc2_ff (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc2_ff (attack_rate, decay_rate, reference, - gain, max_gain)); -} - -gr_agc2_ff::gr_agc2_ff (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) - : gr_sync_block ("gr_agc2_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))) - , gri_agc2_ff (attack_rate, decay_rate, reference, gain, max_gain) -{ -} - -int -gr_agc2_ff::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; -} diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.h b/gnuradio-core/src/lib/general/gr_agc2_ff.h deleted file mode 100644 index 48529948c0..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_ff.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_GR_AGC2_FF_H -#define INCLUDED_GR_AGC2_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc2_ff.h> -class gr_agc2_ff; -typedef boost::shared_ptr<gr_agc2_ff> gr_agc2_ff_sptr; - -GR_CORE_API gr_agc2_ff_sptr -gr_make_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); -/*! - * \brief high performance Automatic Gain Control class - * - * \ingroup level_blk - * Power is approximated by absolute value - */ - -class GR_CORE_API gr_agc2_ff : public gr_sync_block, public gri_agc2_ff -{ - friend GR_CORE_API gr_agc2_ff_sptr gr_make_agc2_ff (float attack_rate, float decay_rate, - float reference, float gain, float max_gain); - gr_agc2_ff (float attack_rate, float decay_rate, float reference, float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FLOAT_AGC2_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.i b/gnuradio-core/src/lib/general/gr_agc2_ff.i deleted file mode 100644 index 646391aa7f..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_ff.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,agc2_ff) - -%include <gri_agc2_ff.i> - -gr_agc2_ff_sptr -gr_make_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); - -class gr_agc2_ff : public gr_sync_block , public gri_agc2_ff -{ - gr_agc2_ff (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.cc b/gnuradio-core/src/lib/general/gr_agc_cc.cc deleted file mode 100644 index e98f3a303f..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_cc.cc +++ /dev/null @@ -1,56 +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 <gr_agc_cc.h> -#include <gr_io_signature.h> -#include <gri_agc_cc.h> - -gr_agc_cc_sptr -gr_make_agc_cc (float rate, float reference, - float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc_cc (rate, reference, gain, max_gain)); -} - -gr_agc_cc::gr_agc_cc (float rate, float reference, - float gain, float max_gain) - : gr_sync_block ("gr_agc_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - gri_agc_cc (rate, reference, gain, max_gain) -{ -} - -int -gr_agc_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]; - scaleN (out, in, noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.h b/gnuradio-core/src/lib/general/gr_agc_cc.h deleted file mode 100644 index 9f35350dbd..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_cc.h +++ /dev/null @@ -1,55 +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_GR_AGC_CC_H -#define INCLUDED_GR_AGC_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc_cc.h> -class gr_agc_cc; -typedef boost::shared_ptr<gr_agc_cc> gr_agc_cc_sptr; - -GR_CORE_API gr_agc_cc_sptr -gr_make_agc_cc (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); -/*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * For Power the absolute value of the complex number is used. - */ - -class GR_CORE_API gr_agc_cc : public gr_sync_block, public gri_agc_cc -{ - friend GR_CORE_API gr_agc_cc_sptr gr_make_agc_cc (float rate, float reference, - float gain, float max_gain); - gr_agc_cc (float rate, float reference, - float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_AGC_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.i b/gnuradio-core/src/lib/general/gr_agc_cc.i deleted file mode 100644 index f942713b08..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_cc.i +++ /dev/null @@ -1,35 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,agc_cc) - -%include <gri_agc_cc.i> - -gr_agc_cc_sptr -gr_make_agc_cc (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -class gr_agc_cc : public gr_sync_block , public gri_agc_cc -{ - gr_agc_cc (float rate, float reference, - float gain, float max_gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.cc b/gnuradio-core/src/lib/general/gr_agc_ff.cc deleted file mode 100644 index 6050dc7f0a..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_ff.cc +++ /dev/null @@ -1,54 +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_agc_ff.h> -#include <gr_io_signature.h> -#include <gri_agc_ff.h> - -gr_agc_ff_sptr -gr_make_agc_ff (float rate, float reference, float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc_ff (rate, reference, gain, max_gain)); -} - -gr_agc_ff::gr_agc_ff (float rate, float reference, float gain, float max_gain) - : gr_sync_block ("gr_agc_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))) - , gri_agc_ff (rate, reference, gain, max_gain) -{ -} - -int -gr_agc_ff::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; -} diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.h b/gnuradio-core/src/lib/general/gr_agc_ff.h deleted file mode 100644 index dc618213bb..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_ff.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_GR_AGC_FF_H -#define INCLUDED_GR_AGC_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc_ff.h> -class gr_agc_ff; -typedef boost::shared_ptr<gr_agc_ff> gr_agc_ff_sptr; - -GR_CORE_API gr_agc_ff_sptr -gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -/*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * Power is approximated by absolute value - */ - -class GR_CORE_API gr_agc_ff : public gr_sync_block, public gri_agc_ff -{ - friend GR_CORE_API gr_agc_ff_sptr gr_make_agc_ff (float rate, float reference, - float gain, float max_gain); - gr_agc_ff (float rate, float reference, float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FLOAT_AGC_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.i b/gnuradio-core/src/lib/general/gr_agc_ff.i deleted file mode 100644 index 03c571e1a4..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_ff.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,agc_ff) - -%include <gri_agc_ff.i> - -gr_agc_ff_sptr -gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -class gr_agc_ff : public gr_sync_block , public gri_agc_ff -{ - gr_agc_ff (float rate, float reference, float gain, float max_gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc index 963af9202a..1178bdc34f 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc @@ -79,8 +79,8 @@ gr_annotator_1to1::work (int noutput_items, } // Storing the current noutput_items as the value to the "noutput_items" key - pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); - pmt::pmt_t key = pmt::pmt_string_to_symbol("seq"); + pmt::pmt_t srcid = pmt::string_to_symbol(str.str()); + pmt::pmt_t key = pmt::string_to_symbol("seq"); // Work does nothing to the data stream; just copy all inputs to outputs // Adds a new tag when the number of items read is a multiple of d_when @@ -92,7 +92,7 @@ gr_annotator_1to1::work (int noutput_items, // the 1-to-1 propagation policy. for(int i = 0; i < std::min(noutputs, ninputs); i++) { if(abs_N % d_when == 0) { - pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++); + pmt::pmt_t value = pmt::from_uint64(d_tag_counter++); add_item_tag(i, abs_N, key, value, srcid); } diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc index 01bdd30644..d8b7e2db7e 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc @@ -80,8 +80,8 @@ gr_annotator_alltoall::work (int noutput_items, } // Source ID and key for any tag that might get applied from this block - pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); - pmt::pmt_t key = pmt::pmt_string_to_symbol("seq"); + pmt::pmt_t srcid = pmt::string_to_symbol(str.str()); + pmt::pmt_t key = pmt::string_to_symbol("seq"); // Work does nothing to the data stream; just copy all inputs to outputs // Adds a new tag when the number of items read is a multiple of d_when @@ -91,7 +91,7 @@ gr_annotator_alltoall::work (int noutput_items, for(int j = 0; j < noutput_items; j++) { for(int i = 0; i < noutputs; i++) { if(abs_N % d_when == 0) { - pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++); + pmt::pmt_t value = pmt::from_uint64(d_tag_counter++); add_item_tag(i, abs_N, key, value, srcid); } diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.cc b/gnuradio-core/src/lib/general/gr_annotator_raw.cc index d3dcce73af..c3aecdd938 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_raw.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_raw.cc @@ -55,7 +55,7 @@ void gr_annotator_raw::add_tag(uint64_t offset, pmt_t key, pmt_t val) gruel::scoped_lock l(d_mutex); gr_tag_t tag; - tag.srcid = pmt::pmt_intern(name()); + tag.srcid = pmt::intern(name()); tag.key = key; tag.value = val; tag.offset = offset; diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.cc b/gnuradio-core/src/lib/general/gr_burst_tagger.cc index 83e84bfa09..72924109bf 100644 --- a/gnuradio-core/src/lib/general/gr_burst_tagger.cc +++ b/gnuradio-core/src/lib/general/gr_burst_tagger.cc @@ -43,19 +43,19 @@ gr_burst_tagger::gr_burst_tagger(size_t itemsize) std::stringstream str; str << name() << unique_id(); - d_true_key = pmt::pmt_string_to_symbol("burst"); + d_true_key = pmt::string_to_symbol("burst"); d_true_value = pmt::PMT_T; - d_false_key = pmt::pmt_string_to_symbol("burst"); + d_false_key = pmt::string_to_symbol("burst"); d_false_value = pmt::PMT_F; - d_id = pmt::pmt_string_to_symbol(str.str()); + d_id = pmt::string_to_symbol(str.str()); } void gr_burst_tagger::set_true_tag (const std::string &key, bool value) { - d_true_key = pmt::pmt_string_to_symbol(key); + d_true_key = pmt::string_to_symbol(key); if(value == true) { d_true_value = pmt::PMT_T; } @@ -67,7 +67,7 @@ gr_burst_tagger::set_true_tag (const std::string &key, bool value) void gr_burst_tagger::set_false_tag (const std::string &key, bool value) { - d_false_key = pmt::pmt_string_to_symbol(key); + d_false_key = pmt::string_to_symbol(key); if(value == true) { d_false_value = pmt::PMT_T; } diff --git a/gnuradio-core/src/lib/general/gr_bytes_to_syms.cc b/gnuradio-core/src/lib/general/gr_bytes_to_syms.cc deleted file mode 100644 index 7dafa29f99..0000000000 --- a/gnuradio-core/src/lib/general/gr_bytes_to_syms.cc +++ /dev/null @@ -1,74 +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 <gr_bytes_to_syms.h> -#include <gr_io_signature.h> -#include <assert.h> - -static const int BITS_PER_BYTE = 8; - -gr_bytes_to_syms_sptr -gr_make_bytes_to_syms () -{ - return gnuradio::get_initial_sptr(new gr_bytes_to_syms ()); -} - -gr_bytes_to_syms::gr_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 -gr_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/gnuradio-core/src/lib/general/gr_bytes_to_syms.h b/gnuradio-core/src/lib/general/gr_bytes_to_syms.h deleted file mode 100644 index 23e5c6b91b..0000000000 --- a/gnuradio-core/src/lib/general/gr_bytes_to_syms.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_GR_BYTES_TO_SYMS_H -#define INCLUDED_GR_BYTES_TO_SYMS_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_bytes_to_syms; -typedef boost::shared_ptr<gr_bytes_to_syms> gr_bytes_to_syms_sptr; - -GR_CORE_API gr_bytes_to_syms_sptr gr_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 GR_CORE_API gr_bytes_to_syms : public gr_sync_interpolator -{ - friend GR_CORE_API gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); - - gr_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/gnuradio-core/src/lib/general/gr_bytes_to_syms.i b/gnuradio-core/src/lib/general/gr_bytes_to_syms.i deleted file mode 100644 index 185e7cd290..0000000000 --- a/gnuradio-core/src/lib/general/gr_bytes_to_syms.i +++ /dev/null @@ -1,30 +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(gr,bytes_to_syms); - -gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); - -class gr_bytes_to_syms : public gr_sync_interpolator -{ - gr_bytes_to_syms (); -}; diff --git a/gnuradio-core/src/lib/general/gr_char_to_float.cc b/gnuradio-core/src/lib/general/gr_char_to_float.cc deleted file mode 100644 index f63aa5b169..0000000000 --- a/gnuradio-core/src/lib/general/gr_char_to_float.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 <gr_char_to_float.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_char_to_float_sptr -gr_make_char_to_float (size_t vlen, float scale) -{ - return gnuradio::get_initial_sptr(new gr_char_to_float (vlen, scale)); -} - -gr_char_to_float::gr_char_to_float (size_t vlen, float scale) - : gr_sync_block ("gr_char_to_float", - gr_make_io_signature (1, 1, sizeof (char)*vlen), - gr_make_io_signature (1, 1, sizeof (float)*vlen)), - d_vlen(vlen), d_scale(scale) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(float); - set_alignment(std::max(1,alignment_multiple)); -} - -float -gr_char_to_float::scale() const -{ - return d_scale; -} - -void -gr_char_to_float::set_scale(float scale) -{ - d_scale = scale; -} - -int -gr_char_to_float::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const int8_t *in = (const int8_t *) input_items[0]; - float *out = (float *) output_items[0]; - - // Note: the unaligned benchmarked much faster than the aligned - volk_8i_s32f_convert_32f_u(out, in, d_scale, d_vlen*noutput_items); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_char_to_float.h b/gnuradio-core/src/lib/general/gr_char_to_float.h deleted file mode 100644 index 5170c618c9..0000000000 --- a/gnuradio-core/src/lib/general/gr_char_to_float.h +++ /dev/null @@ -1,70 +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_GR_CHAR_TO_FLOAT_H -#define INCLUDED_GR_CHAR_TO_FLOAT_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_char_to_float; -typedef boost::shared_ptr<gr_char_to_float> gr_char_to_float_sptr; - -GR_CORE_API gr_char_to_float_sptr -gr_make_char_to_float (size_t vlen=1, float scale=1); - -/*! - * \brief Convert stream of chars to a stream of float - * \ingroup converter_blk - * - * \param vlen vector length of data streams. - * \param scale a scalar divider to change the output signal scale. - */ - -class GR_CORE_API gr_char_to_float : public gr_sync_block -{ - private: - friend GR_CORE_API gr_char_to_float_sptr - gr_make_char_to_float (size_t vlen, float scale); - gr_char_to_float (size_t vlen, float scale); - - size_t d_vlen; - float d_scale; - - public: - /*! - * Get the scalar divider value. - */ - float scale() const; - - /*! - * Set the scalar divider value. - */ - void set_scale(float scale); - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_CHAR_TO_FLOAT_H */ diff --git a/gnuradio-core/src/lib/general/gr_char_to_float.i b/gnuradio-core/src/lib/general/gr_char_to_float.i deleted file mode 100644 index c0b3d75fef..0000000000 --- a/gnuradio-core/src/lib/general/gr_char_to_float.i +++ /dev/null @@ -1,33 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,char_to_float) - -gr_char_to_float_sptr -gr_make_char_to_float (size_t vlen=1, float scale=1); - -class gr_char_to_float : public gr_sync_block -{ -public: - float scale() const; - void set_scale(float scale); -}; diff --git a/gnuradio-core/src/lib/general/gr_char_to_short.cc b/gnuradio-core/src/lib/general/gr_char_to_short.cc deleted file mode 100644 index bb9bd8909e..0000000000 --- a/gnuradio-core/src/lib/general/gr_char_to_short.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_char_to_short.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_char_to_short_sptr -gr_make_char_to_short (size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_char_to_short (vlen)); -} - -gr_char_to_short::gr_char_to_short (size_t vlen) - : gr_sync_block ("gr_char_to_short", - gr_make_io_signature (1, 1, sizeof (char)*vlen), - gr_make_io_signature (1, 1, sizeof (short)*vlen)), - d_vlen(vlen) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(char); - set_alignment(std::max(1,alignment_multiple)); -} - -int -gr_char_to_short::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const int8_t *in = (const int8_t *) input_items[0]; - int16_t *out = (int16_t *) output_items[0]; - - if(is_unaligned()) { - volk_8i_convert_16i_u(out, in, d_vlen*noutput_items); - } - else { - volk_8i_convert_16i_a(out, in, d_vlen*noutput_items); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_char_to_short.h b/gnuradio-core/src/lib/general/gr_char_to_short.h deleted file mode 100644 index 7ac5e97b93..0000000000 --- a/gnuradio-core/src/lib/general/gr_char_to_short.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_GR_CHAR_TO_SHORT_H -#define INCLUDED_GR_CHAR_TO_SHORT_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_char_to_short; -typedef boost::shared_ptr<gr_char_to_short> gr_char_to_short_sptr; - -GR_CORE_API gr_char_to_short_sptr -gr_make_char_to_short (size_t vlen=1); - -/*! - * \brief Convert stream of chars to a stream of float - * \ingroup converter_blk - * - * \param vlen vector length of data streams. - */ - -class GR_CORE_API gr_char_to_short : public gr_sync_block -{ - private: - friend GR_CORE_API gr_char_to_short_sptr - gr_make_char_to_short (size_t vlen); - gr_char_to_short (size_t vlen); - - size_t d_vlen; - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_CHAR_TO_SHORT_H */ diff --git a/gnuradio-core/src/lib/general/gr_char_to_short.i b/gnuradio-core/src/lib/general/gr_char_to_short.i deleted file mode 100644 index a53a0990e3..0000000000 --- a/gnuradio-core/src/lib/general/gr_char_to_short.i +++ /dev/null @@ -1,30 +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(gr,char_to_short) - -gr_char_to_short_sptr gr_make_char_to_short (size_t vlen=1); - -class gr_char_to_short : public gr_sync_block -{ - -}; diff --git a/gnuradio-core/src/lib/general/gr_conjugate_cc.cc b/gnuradio-core/src/lib/general/gr_conjugate_cc.cc deleted file mode 100644 index 94ac3e162b..0000000000 --- a/gnuradio-core/src/lib/general/gr_conjugate_cc.cc +++ /dev/null @@ -1,65 +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: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_conjugate_cc.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_conjugate_cc_sptr -gr_make_conjugate_cc () -{ - return gnuradio::get_initial_sptr(new gr_conjugate_cc ()); -} - -gr_conjugate_cc::gr_conjugate_cc () - : gr_sync_block ("conjugate_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(gr_complex); - set_alignment(std::max(1,alignment_multiple)); -} - -int -gr_conjugate_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *iptr = (gr_complex *) input_items[0]; - gr_complex *optr = (gr_complex *) output_items[0]; - - if(is_unaligned()) { - volk_32fc_conjugate_32fc_u(optr, iptr, noutput_items); - } - else { - volk_32fc_conjugate_32fc_a(optr, iptr, noutput_items); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_conjugate_cc.h b/gnuradio-core/src/lib/general/gr_conjugate_cc.h deleted file mode 100644 index e0a2af7164..0000000000 --- a/gnuradio-core/src/lib/general/gr_conjugate_cc.h +++ /dev/null @@ -1,52 +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: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_GR_CONJUGATE_CC_H -#define INCLUDED_GR_CONJUGATE_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_conjugate_cc; -typedef boost::shared_ptr<gr_conjugate_cc> gr_conjugate_cc_sptr; - -GR_CORE_API gr_conjugate_cc_sptr gr_make_conjugate_cc (); - -/*! - * \brief output = complex conjugate of input - * \ingroup math_blk - */ -class GR_CORE_API gr_conjugate_cc : public gr_sync_block -{ - friend GR_CORE_API gr_conjugate_cc_sptr gr_make_conjugate_cc (); - - gr_conjugate_cc (); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_conjugate_cc.i b/gnuradio-core/src/lib/general/gr_conjugate_cc.i deleted file mode 100644 index 444ebb1b8b..0000000000 --- a/gnuradio-core/src/lib/general/gr_conjugate_cc.i +++ /dev/null @@ -1,33 +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: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(gr,conjugate_cc) - -gr_conjugate_cc_sptr gr_make_conjugate_cc (); - -class gr_conjugate_cc : public gr_sync_block -{ - private: - gr_conjugate_cc (); -}; diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc deleted file mode 100644 index 73ded3c8b3..0000000000 --- a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc +++ /dev/null @@ -1,129 +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 <gr_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 - - -gr_correlate_access_code_tag_bb_sptr -gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name) -{ - return gnuradio::get_initial_sptr(new gr_correlate_access_code_tag_bb (access_code, threshold, tag_name)); -} - - -gr_correlate_access_code_tag_bb::gr_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, "gr_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); -} - -gr_correlate_access_code_tag_bb::~gr_correlate_access_code_tag_bb () -{ -} - -bool -gr_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 -gr_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/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h deleted file mode 100644 index 345d3004a5..0000000000 --- a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h +++ /dev/null @@ -1,87 +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_gr_correlate_access_code_tag_bb_H -#define INCLUDED_gr_correlate_access_code_tag_bb_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <string> - -class gr_correlate_access_code_tag_bb; -typedef boost::shared_ptr<gr_correlate_access_code_tag_bb> gr_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 - */ -GR_CORE_API gr_correlate_access_code_tag_bb_sptr -gr_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 GR_CORE_API gr_correlate_access_code_tag_bb : public gr_sync_block -{ - friend GR_CORE_API gr_correlate_access_code_tag_bb_sptr - gr_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: - gr_correlate_access_code_tag_bb(const std::string &access_code, int threshold, - const std::string &tag_name); - - public: - ~gr_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_gr_correlate_access_code_tag_bb_H */ diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i deleted file mode 100644 index f7ca4bea7b..0000000000 --- a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i +++ /dev/null @@ -1,60 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,correlate_access_code_tag_bb); - -/*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - * \param threshold maximum number of bits that may be wrong - */ -gr_correlate_access_code_tag_bb_sptr -gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name) - 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 gr_correlate_access_code_tag_bb : public gr_sync_block -{ - friend gr_correlate_access_code_tag_bb_sptr - gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name); - protected: - gr_correlate_access_code_tag_bb(const std::string &access_code, int threshold, const std::string &tag_name); - - public: - ~gr_correlate_access_code_tag_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/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc b/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc deleted file mode 100644 index 24f0edd5cb..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 <gr_cpfsk_bc.h> -#include <gr_io_signature.h> -#include <gr_expj.h> - -#define M_TWOPI (2*M_PI) - -gr_cpfsk_bc_sptr -gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym) -{ - return gnuradio::get_initial_sptr(new gr_cpfsk_bc(k, ampl, samples_per_sym)); -} - -gr_cpfsk_bc::gr_cpfsk_bc(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; -} - -gr_cpfsk_bc::~gr_cpfsk_bc() -{ -} - -int -gr_cpfsk_bc::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; -} diff --git a/gnuradio-core/src/lib/general/gr_cpfsk_bc.h b/gnuradio-core/src/lib/general/gr_cpfsk_bc.h deleted file mode 100644 index 6ad2774b3a..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpfsk_bc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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_CPFSK_BC_H -#define INCLUDED_GR_CPFSK_BC_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_cpfsk_bc; - -typedef boost::shared_ptr<gr_cpfsk_bc> gr_cpfsk_bc_sptr; - -GR_CORE_API gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); - -/*! - * \brief Perform continuous phase 2-level frequency shift keying modulation - * on an input stream of unpacked bits. - * \ingroup modulation_blk - * - * \param k modulation index - * \param ampl output amplitude - * \param samples_per_sym number of output samples per input bit - */ - -class GR_CORE_API gr_cpfsk_bc : public gr_sync_interpolator -{ -private: - friend GR_CORE_API gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); - - gr_cpfsk_bc(float k, float ampl, int samples_per_sym); - - 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: - ~gr_cpfsk_bc(); - - void set_amplitude(float amplitude) { d_ampl = amplitude; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_CPFSK_BC_H */ diff --git a/gnuradio-core/src/lib/general/gr_cpfsk_bc.i b/gnuradio-core/src/lib/general/gr_cpfsk_bc.i deleted file mode 100644 index b86dfb81bd..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpfsk_bc.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,cpfsk_bc); - -gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); - -class gr_cpfsk_bc : public gr_sync_interpolator -{ -private: - gr_cpfsk_bc(float k, float ampl, int samples_per_sym); - -public: - void set_amplitude(float amplitude); -}; diff --git a/gnuradio-core/src/lib/general/gr_cpm.cc b/gnuradio-core/src/lib/general/gr_cpm.cc deleted file mode 100644 index 32ce6502dd..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpm.cc +++ /dev/null @@ -1,218 +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. - */ - -// Calculate the taps for the CPM phase responses - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <cmath> -#include <cfloat> -#include <gr_cpm.h> - -//gives us erf on compilers without it -#include <boost/math/special_functions/erf.hpp> -namespace bm = boost::math; - -#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> -gr_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); - } -} - diff --git a/gnuradio-core/src/lib/general/gr_cpm.h b/gnuradio-core/src/lib/general/gr_cpm.h deleted file mode 100644 index ef2ff84142..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpm.h +++ /dev/null @@ -1,81 +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. - */ - - -#ifndef INCLUDED_GR_CPM_H -#define INCLUDED_GR_CPM_H - -#include <gr_core_api.h> -#include <vector> - -class GR_CORE_API gr_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); -}; - -#endif /* INCLUDED_GR_CPM_H */ - diff --git a/gnuradio-core/src/lib/general/gr_cpm.i b/gnuradio-core/src/lib/general/gr_cpm.i deleted file mode 100644 index 6c077687d5..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpm.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. - */ - -%rename(cpm) gr_cpm; - -class gr_cpm -{ - public: - enum cpm_type { - LRC, - LSRC, - LREC, - TFM, - GAUSSIAN, - GENERIC = 999 - }; - - static std::vector<float> - phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta=0.3); -}; - diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc deleted file mode 100644 index d31763a6bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 <gr_ctcss_squelch_ff.h> - -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; - -gr_ctcss_squelch_ff_sptr -gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate) -{ - return gnuradio::get_initial_sptr(new gr_ctcss_squelch_ff(rate, freq, level, len, ramp, gate)); -} - -int gr_ctcss_squelch_ff::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; -} - -gr_ctcss_squelch_ff::gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate) : - gr_squelch_base_ff("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 = gri_goertzel(rate, d_len, f_l); - d_goertzel_c = gri_goertzel(rate, d_len, freq); - d_goertzel_r = gri_goertzel(rate, d_len, f_r); - - d_mute = true; -} - -std::vector<float> gr_ctcss_squelch_ff::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 gr_ctcss_squelch_ff::update_state(const float &in) -{ - d_goertzel_l.input(in); - d_goertzel_c.input(in); - d_goertzel_r.input(in); - - float d_out_l, d_out_c, d_out_r; - if (d_goertzel_c.ready()) { - d_out_l = abs(d_goertzel_l.output()); - d_out_c = abs(d_goertzel_c.output()); - d_out_r = abs(d_goertzel_r.output()); - - //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); - } -} diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h deleted file mode 100644 index ef3d13ba7b..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h +++ /dev/null @@ -1,68 +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_GR_CTCSS_SQUELCH_FF_H -#define INCLUDED_GR_CTCSS_SQUELCH_FF_H - -#include <gr_core_api.h> -#include <gr_squelch_base_ff.h> -#include <gri_goertzel.h> - -class gr_ctcss_squelch_ff; -typedef boost::shared_ptr<gr_ctcss_squelch_ff> gr_ctcss_squelch_ff_sptr; - -GR_CORE_API gr_ctcss_squelch_ff_sptr -gr_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false); - -/*! - * \brief gate or zero output if ctcss tone not present - * \ingroup level_blk - */ -class GR_CORE_API gr_ctcss_squelch_ff : public gr_squelch_base_ff -{ -private: - float d_freq; - float d_level; - int d_len; - bool d_mute; - - gri_goertzel d_goertzel_l; - gri_goertzel d_goertzel_c; - gri_goertzel d_goertzel_r; - - friend GR_CORE_API gr_ctcss_squelch_ff_sptr gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); - gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); - - int find_tone(float freq); - -protected: - virtual void update_state(const float &in); - virtual bool mute() const { return d_mute; } - -public: - 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; } -}; - -#endif /* INCLUDED_GR_CTCSS_SQUELCH_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i deleted file mode 100644 index b160c5dfd7..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i +++ /dev/null @@ -1,39 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,ctcss_squelch_ff); - -%include gr_squelch_base_ff.i - -gr_ctcss_squelch_ff_sptr -gr_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false); - -class gr_ctcss_squelch_ff : public gr_squelch_base_ff -{ - gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); - -public: - 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; } -}; diff --git a/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.cc b/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.cc new file mode 100644 index 0000000000..1b78a9cbc3 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.cc @@ -0,0 +1,155 @@ +/* -*- 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 <gr_ctrlport_probe2_c.h> +#include <gr_io_signature.h> + +gr_ctrlport_probe2_c_sptr +gr_make_ctrlport_probe2_c(const std::string &id, + const std::string &desc, int len) +{ + return gnuradio::get_initial_sptr + (new gr_ctrlport_probe2_c(id, desc, len)); +} + +gr_ctrlport_probe2_c::gr_ctrlport_probe2_c(const std::string &id, + const std::string &desc, int len) + : gr_sync_block("probe2_c", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(0, 0, 0)), + d_id(id), d_desc(desc), d_len(len) +{ + set_length(len); +} + +gr_ctrlport_probe2_c::~gr_ctrlport_probe2_c() +{ +} + +void +gr_ctrlport_probe2_c::forecast(int noutput_items, gr_vector_int &ninput_items_required) +{ + // make sure all inputs have noutput_items available + unsigned ninputs = ninput_items_required.size(); + for(unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = d_len; +} + +// boost::shared_mutex mutex_buffer; +// mutable boost::mutex mutex_notify; +// boost::condition_variable condition_buffer_ready; +std::vector<gr_complex> +gr_ctrlport_probe2_c::get() +{ + mutex_buffer.lock(); + d_buffer.clear(); + mutex_buffer.unlock(); + + // wait for condition + boost::mutex::scoped_lock lock(mutex_notify); + condition_buffer_ready.wait(lock); + + mutex_buffer.lock(); + std::vector<gr_complex> buf_copy = d_buffer; + assert(buf_copy.size() == d_len); + mutex_buffer.unlock(); + + return buf_copy; +} + +void +gr_ctrlport_probe2_c::set_length(int len) +{ + if(len > 8191) { + std::cerr << "probe2_c: length " << len + << " exceeds maximum buffer size of 8191" << std::endl; + len = 8191; + } + + d_len = len; + d_buffer.reserve(d_len); +} + +int +gr_ctrlport_probe2_c::length() const +{ + return (int)d_len; +} + +int +gr_ctrlport_probe2_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]; + + // copy samples to get buffer if we need samples + mutex_buffer.lock(); + if(d_buffer.size() < d_len) { + // copy smaller of remaining buffer space and num inputs to work() + int num_copy = std::min( (int)(d_len - d_buffer.size()), noutput_items ); + + // TODO: convert this to a copy operator for speed... + for(int i = 0; i < num_copy; i++) { + d_buffer.push_back(in[i]); + } + + // notify the waiting get() if we fill up the buffer + if(d_buffer.size() == d_len) { + condition_buffer_ready.notify_one(); + } + } + mutex_buffer.unlock(); + + return noutput_items; +} + +void +gr_ctrlport_probe2_c::setup_rpc() +{ +#ifdef GR_CTRLPORT + int len = static_cast<int>(d_len); + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<gr_ctrlport_probe2_c, std::vector<std::complex<float> > >( + alias(), d_id.c_str(), &gr_ctrlport_probe2_c::get, + pmt::make_c32vector(0,-2), + pmt::make_c32vector(0,2), + pmt::make_c32vector(0,0), + "volts", d_desc.c_str(), RPC_PRIVLVL_MIN, DISPXYSCATTER))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<gr_ctrlport_probe2_c, int>( + alias(), "length", &gr_ctrlport_probe2_c::length, + pmt::mp(1), pmt::mp(10*len), pmt::mp(len), + "samples", "get vector length", RPC_PRIVLVL_MIN, DISPNULL))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_set<gr_ctrlport_probe2_c, int>( + alias(), "length", &gr_ctrlport_probe2_c::set_length, + pmt::mp(1), pmt::mp(10*len), pmt::mp(len), + "samples", "set vector length", RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ +} diff --git a/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.h b/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.h new file mode 100644 index 0000000000..0920c0f4e8 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.h @@ -0,0 +1,72 @@ +/* -*- 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 INCLUDED_CTRLPORT_PROBE2_C_H +#define INCLUDED_CTRLPORT_PROBE2_C_H + +#include <gr_core_api.h> +#include <gr_sync_block.h> +#include <rpcregisterhelpers.h> +#include <boost/thread/shared_mutex.hpp> + +class gr_ctrlport_probe2_c; +typedef boost::shared_ptr<gr_ctrlport_probe2_c> gr_ctrlport_probe2_c_sptr; + +GR_CORE_API gr_ctrlport_probe2_c_sptr +gr_make_ctrlport_probe2_c(const std::string &id, const std::string &desc, int len); + +class GR_CORE_API gr_ctrlport_probe2_c : public gr_sync_block +{ + private: + friend GR_CORE_API gr_ctrlport_probe2_c_sptr gr_make_ctrlport_probe2_c + (const std::string &id, const std::string &desc, int len); + + gr_ctrlport_probe2_c(const std::string &id, const std::string &desc, int len); + + std::string d_id; + std::string d_desc; + size_t d_len; + boost::shared_mutex mutex_buffer; + mutable boost::mutex mutex_notify; + boost::condition_variable condition_buffer_ready; + + std::vector<gr_complex> d_buffer; + + public: + ~gr_ctrlport_probe2_c(); + + void setup_rpc(); + + void forecast(int noutput_items, gr_vector_int &ninput_items_required); + + std::vector<gr_complex> get(); + + void set_length(int len); + int length() const; + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_CTRLPORT_PROBE2_C_H */ + diff --git a/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.i b/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.i index e7979dbcdf..18858595ea 100644 --- a/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.i +++ b/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.i @@ -20,13 +20,17 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,multiply_conjugate_cc) +GR_SWIG_BLOCK_MAGIC(gr,ctrlport_probe2_c) -gr_multiply_conjugate_cc_sptr -gr_make_multiply_conjugate_cc (size_t vlen=1); +gr_ctrlport_probe2_c_sptr +gr_make_ctrlport_probe2_c(const std::string &id, const std::string &desc, int len); -class gr_multiply_conjugate_cc : public gr_sync_block +class gr_ctrlport_probe2_c : public gr_sync_block { public: - + ~gr_ctrlport_probe2_c(); + std::vector<gr_complex> get(); + void set_length(int len); + int length() const; }; + diff --git a/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.cc b/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.cc new file mode 100644 index 0000000000..e06f27eb70 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.cc @@ -0,0 +1,95 @@ +/* -*- 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 <gr_ctrlport_probe_c.h> +#include <gr_io_signature.h> + +gr_ctrlport_probe_c_sptr +gr_make_ctrlport_probe_c(const std::string &id, + const std::string &desc) +{ + return gnuradio::get_initial_sptr + (new gr_ctrlport_probe_c(id, desc)); +} + + +gr_ctrlport_probe_c::gr_ctrlport_probe_c(const std::string &id, + const std::string &desc) + : gr_sync_block("probe_c", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(0, 0, 0)), + d_id(id), d_desc(desc), d_ptr(NULL), d_ptrLen(0) +{ +} + +gr_ctrlport_probe_c::~gr_ctrlport_probe_c() +{ +} + +std::vector<gr_complex> +gr_ctrlport_probe_c::get() +{ + if(d_ptr != NULL && d_ptrLen > 0) { + ptrlock.lock(); + std::vector<gr_complex> vec(d_ptr, d_ptr+d_ptrLen); + ptrlock.unlock(); + return vec; + } + else { + std::vector<gr_complex> vec; + return vec; + } +} + +int +gr_ctrlport_probe_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]; + + // keep reference to symbols + ptrlock.lock(); + d_ptr = in; + d_ptrLen = noutput_items; + ptrlock.unlock(); + + return noutput_items; +} + +void +gr_ctrlport_probe_c::setup_rpc() +{ +#ifdef GR_CTRLPORT + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<gr_ctrlport_probe_c, std::vector<std::complex<float> > >( + alias(), d_id.c_str(), &gr_ctrlport_probe_c::get, + pmt::make_c32vector(0,-2), + pmt::make_c32vector(0,2), + pmt::make_c32vector(0,0), + "volts", d_desc.c_str(), RPC_PRIVLVL_MIN, DISPXYSCATTER))); +#endif /* GR_CTRLPORT */ +} diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_b.h b/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.h index 7549a76b32..27666ab597 100644 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_b.h +++ b/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007 Free Software Foundation, Inc. + * Copyright 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,47 +20,46 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GR_GLFSR_SOURCE_B_H -#define INCLUDED_GR_GLFSR_SOURCE_B_H +#ifndef INCLUDED_CTRLPORT_PROBE_C_H +#define INCLUDED_CTRLPORT_PROBE_C_H #include <gr_core_api.h> #include <gr_sync_block.h> +#include <rpcregisterhelpers.h> +#include <boost/thread/shared_mutex.hpp> -class gri_glfsr; +class gr_ctrlport_probe_c; +typedef boost::shared_ptr<gr_ctrlport_probe_c> gr_ctrlport_probe_c_sptr; -class gr_glfsr_source_b; -typedef boost::shared_ptr<gr_glfsr_source_b> gr_glfsr_source_b_sptr; +GR_CORE_API gr_ctrlport_probe_c_sptr +gr_make_ctrlport_probe_c(const std::string &id, const std::string &desc); -GR_CORE_API gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat=true, int mask=0, int seed=1); - -/*! - * \brief Galois LFSR pseudo-random source - * \ingroup source_blk - */ -class GR_CORE_API gr_glfsr_source_b : public gr_sync_block +class GR_CORE_API gr_ctrlport_probe_c : public gr_sync_block { private: - friend GR_CORE_API gr_glfsr_source_b_sptr - gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed); + friend GR_CORE_API gr_ctrlport_probe_c_sptr gr_make_ctrlport_probe_c + (const std::string &id, const std::string &desc); - gri_glfsr *d_glfsr; + gr_ctrlport_probe_c(const std::string &id, const std::string &desc); - bool d_repeat; - unsigned int d_index; - unsigned int d_length; + boost::shared_mutex ptrlock; - gr_glfsr_source_b(int degree, bool repeat, int mask, int seed); + std::string d_id; + std::string d_desc; + const gr_complex* d_ptr; + size_t d_ptrLen; public: + ~gr_ctrlport_probe_c(); + + void setup_rpc(); - ~gr_glfsr_source_b(); + std::vector<gr_complex> get(); 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 */ +#endif /* INCLUDED_CTRLPORT_GR_CTRLPORT_PROBE_C_H */ + diff --git a/gnuradio-core/src/lib/general/gr_multiply_ff.i b/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.i index e5fdea3488..cd4c521cb0 100644 --- a/gnuradio-core/src/lib/general/gr_multiply_ff.i +++ b/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.i @@ -20,13 +20,15 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,multiply_ff) +GR_SWIG_BLOCK_MAGIC(gr,ctrlport_probe_c) -gr_multiply_ff_sptr -gr_make_multiply_ff (size_t vlen=1); +gr_ctrlport_probe_c_sptr +gr_make_ctrlport_probe_c(const std::string &id, const std::string &desc); -class gr_multiply_ff : public gr_sync_block +class gr_ctrlport_probe_c : public gr_sync_block { public: - + ~gr_ctrlport_probe_c(); + std::vector<gr_complex> get(); }; + diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc deleted file mode 100644 index 319aceeaab..0000000000 --- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 <gr_decode_ccsds_27_fb.h> -#include <gr_io_signature.h> - -gr_decode_ccsds_27_fb_sptr -gr_make_decode_ccsds_27_fb() -{ - return gnuradio::get_initial_sptr(new gr_decode_ccsds_27_fb()); -} - -gr_decode_ccsds_27_fb::gr_decode_ccsds_27_fb() - : gr_sync_decimator("decode_ccsds_27_fb", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(char)), - 2*8) // Rate 1/2 code, unpacked to packed translation -{ - float RATE = 0.5; - float ebn0 = 12.0; - float esn0 = RATE*pow(10.0, ebn0/10.0); - - gen_met(d_mettab, 100, esn0, 0.0, 256); - viterbi_chunks_init(d_state0); -} - -gr_decode_ccsds_27_fb::~gr_decode_ccsds_27_fb() -{ -} - -int -gr_decode_ccsds_27_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*16; i++) { - // Translate and clip [-1.0..1.0] to [28..228] - float sample = in[i]*100.0+128.0; - if (sample > 255.0) - sample = 255.0; - else if (sample < 0.0) - sample = 0.0; - unsigned char sym = (unsigned char)(floor(sample)); - - d_viterbi_in[d_count % 4] = sym; - if ((d_count % 4) == 3) { - // Every fourth symbol, perform butterfly operation - viterbi_butterfly2(d_viterbi_in, d_mettab, d_state0, d_state1); - - // Every sixteenth symbol, read out a byte - if (d_count % 16 == 11) { - // long metric = - viterbi_get_output(d_state0, out++); - // printf("%li\n", *(out-1), metric); - } - } - - d_count++; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h deleted file mode 100644 index df8e6f449d..0000000000 --- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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_DECODE_CCSDS_27_FB_H -#define INCLUDED_GR_DECODE_CCSDS_27_FB_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -extern "C" { -#include <viterbi.h> -} - -class gr_decode_ccsds_27_fb; - -typedef boost::shared_ptr<gr_decode_ccsds_27_fb> gr_decode_ccsds_27_fb_sptr; - -GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); - -/*! \brief A rate 1/2, k=7 convolutional decoder for the CCSDS standard - * \ingroup ecc - * - * This block performs soft-decision convolutional decoding using the Viterbi - * algorithm. - * - * The input is a stream of (possibly noise corrupted) floating point values - * nominally spanning [-1.0, 1.0], representing the encoded channel symbols - * 0 (-1.0) and 1 (1.0), with erased symbols at 0.0. - * - * The output is MSB first packed bytes of decoded values. - * - * As a rate 1/2 code, there will be one output byte for every 16 input symbols. - * - * This block is designed for continuous data streaming, not packetized data. - * The first 32 bits out will be zeroes, with the output delayed four bytes - * from the corresponding inputs. - */ - -class GR_CORE_API gr_decode_ccsds_27_fb : public gr_sync_decimator -{ -private: - friend GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); - - gr_decode_ccsds_27_fb(); - - // Viterbi state - int d_mettab[2][256]; - struct viterbi_state d_state0[64]; - struct viterbi_state d_state1[64]; - unsigned char d_viterbi_in[16]; - - int d_count; - -public: - ~gr_decode_ccsds_27_fb(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_DECODE_CCSDS_27_FB_H */ diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.i b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.i deleted file mode 100644 index f2e13b593a..0000000000 --- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,decode_ccsds_27_fb); - -gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb (); - -class gr_decode_ccsds_27_fb : public gr_sync_decimator -{ -private: - gr_decode_ccsds_27_fb(); -}; diff --git a/gnuradio-core/src/lib/general/gr_deinterleave.cc b/gnuradio-core/src/lib/general/gr_deinterleave.cc deleted file mode 100644 index e22db60c1a..0000000000 --- a/gnuradio-core/src/lib/general/gr_deinterleave.cc +++ /dev/null @@ -1,78 +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 <gr_deinterleave.h> -#include <gr_io_signature.h> -#include <string.h> - - -gr_deinterleave_sptr -gr_make_deinterleave (size_t itemsize) -{ - return gnuradio::get_initial_sptr(new gr_deinterleave (itemsize)); -} - -gr_deinterleave::gr_deinterleave (size_t itemsize) - : gr_sync_decimator ("deinterleave", - gr_make_io_signature (1, 1, itemsize), - gr_make_io_signature (1, gr_io_signature::IO_INFINITE, itemsize), - 1), - d_itemsize (itemsize) -{ -} - -gr_deinterleave::~gr_deinterleave () -{ - // NOP -} - -bool -gr_deinterleave::check_topology (int ninputs, int noutputs) -{ - set_decimation (noutputs); - return true; -} - -int -gr_deinterleave::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - size_t nchan = output_items.size (); - size_t itemsize = d_itemsize; - const char *in = (const char *) input_items[0]; - char **out = (char **) &output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - for (unsigned int n = 0; n < nchan; n++){ - memcpy (out[n], in, itemsize); - out[n] += itemsize; - in += itemsize; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_deinterleave.h b/gnuradio-core/src/lib/general/gr_deinterleave.h deleted file mode 100644 index 0eecc44d13..0000000000 --- a/gnuradio-core/src/lib/general/gr_deinterleave.h +++ /dev/null @@ -1,57 +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_GR_DEINTERLEAVE_H -#define INCLUDED_GR_DEINTERLEAVE_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_deinterleave; -typedef boost::shared_ptr<gr_deinterleave> gr_deinterleave_sptr; - -GR_CORE_API gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize); - -/*! - * \brief deinterleave a single input into N outputs - * \ingroup slicedice_blk - */ -class GR_CORE_API gr_deinterleave : public gr_sync_decimator -{ - friend GR_CORE_API gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize); - - size_t d_itemsize; - - gr_deinterleave (size_t itemsize); - -public: - ~gr_deinterleave (); - - 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); - -}; - -#endif /* INCLUDED_GR_DEINTERLEAVE_H */ diff --git a/gnuradio-core/src/lib/general/gr_deinterleave.i b/gnuradio-core/src/lib/general/gr_deinterleave.i deleted file mode 100644 index a70ce6c527..0000000000 --- a/gnuradio-core/src/lib/general/gr_deinterleave.i +++ /dev/null @@ -1,30 +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(gr,deinterleave) - -gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize); - -class gr_deinterleave : public gr_sync_decimator -{ - gr_deinterleave (size_t itemsize); -}; diff --git a/gnuradio-core/src/lib/general/gr_descrambler_bb.cc b/gnuradio-core/src/lib/general/gr_descrambler_bb.cc deleted file mode 100644 index b5ae28fa97..0000000000 --- a/gnuradio-core/src/lib/general/gr_descrambler_bb.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_descrambler_bb.h> -#include <gr_io_signature.h> - -gr_descrambler_bb_sptr -gr_make_descrambler_bb(int mask, int seed, int len) -{ - return gnuradio::get_initial_sptr(new gr_descrambler_bb(mask, seed, len)); -} - -gr_descrambler_bb::gr_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 -gr_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/gnuradio-core/src/lib/general/gr_descrambler_bb.h b/gnuradio-core/src/lib/general/gr_descrambler_bb.h deleted file mode 100644 index 333593caaf..0000000000 --- a/gnuradio-core/src/lib/general/gr_descrambler_bb.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ -#ifndef INCLUDED_GR_DESCRAMBLER_BB_H -#define INCLUDED_GR_DESCRAMBLER_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include "gri_lfsr.h" - -class gr_descrambler_bb; -typedef boost::shared_ptr<gr_descrambler_bb> gr_descrambler_bb_sptr; - -GR_CORE_API gr_descrambler_bb_sptr gr_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 GR_CORE_API gr_descrambler_bb : public gr_sync_block -{ - friend GR_CORE_API gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); - - gri_lfsr d_lfsr; - - gr_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/gnuradio-core/src/lib/general/gr_descrambler_bb.i b/gnuradio-core/src/lib/general/gr_descrambler_bb.i deleted file mode 100644 index c6cd0a2852..0000000000 --- a/gnuradio-core/src/lib/general/gr_descrambler_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,descrambler_bb); - -gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); - -class gr_descrambler_bb : public gr_sync_block -{ -private: - gr_descrambler_bb(int mask, int seed, int len); -}; diff --git a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.cc b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.cc deleted file mode 100644 index 74324a62ea..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.cc +++ /dev/null @@ -1,61 +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 <gr_diff_decoder_bb.h> -#include <gr_io_signature.h> - -gr_diff_decoder_bb_sptr -gr_make_diff_decoder_bb (unsigned int modulus) -{ - return gnuradio::get_initial_sptr(new gr_diff_decoder_bb(modulus)); -} - -gr_diff_decoder_bb::gr_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 -gr_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/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h deleted file mode 100644 index c4ebbc4765..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h +++ /dev/null @@ -1,53 +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_GR_DIFF_DECODER_BB_H -#define INCLUDED_GR_DIFF_DECODER_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_diff_decoder_bb; -typedef boost::shared_ptr<gr_diff_decoder_bb> gr_diff_decoder_bb_sptr; - -GR_CORE_API gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); - -/*! - * \brief y[0] = (x[0] - x[-1]) % M - * \ingroup coding_blk - * - * Differential decoder - */ -class GR_CORE_API gr_diff_decoder_bb : public gr_sync_block -{ - friend GR_CORE_API gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); - gr_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/gnuradio-core/src/lib/general/gr_diff_decoder_bb.i b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.i deleted file mode 100644 index 3dddb17c3e..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.i +++ /dev/null @@ -1,31 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,diff_decoder_bb) - -gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); - -class gr_diff_decoder_bb : public gr_sync_block -{ - private: - gr_diff_decoder_bb (unsigned int modulus); -}; diff --git a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.cc b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.cc deleted file mode 100644 index 98492c746e..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.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 <gr_diff_encoder_bb.h> -#include <gr_io_signature.h> - -gr_diff_encoder_bb_sptr -gr_make_diff_encoder_bb (unsigned int modulus) -{ - return gnuradio::get_initial_sptr(new gr_diff_encoder_bb(modulus)); -} - -gr_diff_encoder_bb::gr_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 -gr_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/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h deleted file mode 100644 index e98876b700..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.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_GR_DIFF_ENCODER_BB_H -#define INCLUDED_GR_DIFF_ENCODER_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_diff_encoder_bb; -typedef boost::shared_ptr<gr_diff_encoder_bb> gr_diff_encoder_bb_sptr; - -GR_CORE_API gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); - -/*! - * \brief y[0] = (x[0] + y[-1]) % M - * \ingroup coding_blk - * - * Differential encoder - */ -class GR_CORE_API gr_diff_encoder_bb : public gr_sync_block -{ - friend GR_CORE_API gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); - gr_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/gnuradio-core/src/lib/general/gr_diff_encoder_bb.i b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.i deleted file mode 100644 index 96dadaca5b..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.i +++ /dev/null @@ -1,31 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,diff_encoder_bb) - -gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); - -class gr_diff_encoder_bb : public gr_sync_block -{ - private: - gr_diff_encoder_bb (unsigned int modulus); -}; diff --git a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.cc b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.cc deleted file mode 100644 index 89fa2041e7..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.cc +++ /dev/null @@ -1,61 +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 <gr_diff_phasor_cc.h> -#include <gr_io_signature.h> - -gr_diff_phasor_cc_sptr -gr_make_diff_phasor_cc () -{ - return gnuradio::get_initial_sptr(new gr_diff_phasor_cc()); -} - -gr_diff_phasor_cc::gr_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); -} - - -gr_diff_phasor_cc::~gr_diff_phasor_cc(){} - -int -gr_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/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h deleted file mode 100644 index 21c4f616d5..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h +++ /dev/null @@ -1,53 +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_GR_DIFF_PHASOR_CC_H -#define INCLUDED_GR_DIFF_PHASOR_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -/*! - * \brief Please fix my documentation! - * \ingroup misc - */ -class gr_diff_phasor_cc; -typedef boost::shared_ptr<gr_diff_phasor_cc> gr_diff_phasor_cc_sptr; - -GR_CORE_API gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); - - -class GR_CORE_API gr_diff_phasor_cc : public gr_sync_block -{ - friend GR_CORE_API gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); - - gr_diff_phasor_cc (); //constructor - - public: - ~gr_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/gnuradio-core/src/lib/general/gr_diff_phasor_cc.i b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.i deleted file mode 100644 index 8aecd5cc77..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.i +++ /dev/null @@ -1,34 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,diff_phasor_cc) - -gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); - -class gr_diff_phasor_cc : public gr_sync_block -{ - private: - gr_diff_phasor_cc (); - - public: - ~gr_diff_phasor_cc(); -}; diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.cc b/gnuradio-core/src/lib/general/gr_dpll_bb.cc deleted file mode 100644 index 1d5a0d4fda..0000000000 --- a/gnuradio-core/src/lib/general/gr_dpll_bb.cc +++ /dev/null @@ -1,84 +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 <gr_dpll_bb.h> -#include <gr_io_signature.h> -#include <cstdio> - -gr_dpll_bb_sptr -gr_make_dpll_bb (float period, float gain) -{ - return gnuradio::get_initial_sptr(new gr_dpll_bb (period, gain)); -} - -gr_dpll_bb::gr_dpll_bb (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 1 - fprintf(stderr,"frequency = %f period = %f gain = %f threshold = %f\n", - d_pulse_frequency, - period, - d_gain, - d_decision_threshold); -#endif -} - -int -gr_dpll_bb::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; -} diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.h b/gnuradio-core/src/lib/general/gr_dpll_bb.h deleted file mode 100644 index a7df974fb4..0000000000 --- a/gnuradio-core/src/lib/general/gr_dpll_bb.h +++ /dev/null @@ -1,58 +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_GR_DPLL_BB_H -#define INCLUDED_GR_DPLL_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_dpll_bb; -typedef boost::shared_ptr<gr_dpll_bb> gr_dpll_bb_sptr; - -GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); - -/*! - * \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 GR_CORE_API gr_dpll_bb : public gr_sync_block -{ - friend GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); - - gr_dpll_bb (float period, float gain); - - private: - unsigned char d_restart; - float d_pulse_phase, d_pulse_frequency,d_gain,d_decision_threshold; - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.i b/gnuradio-core/src/lib/general/gr_dpll_bb.i deleted file mode 100644 index f31a873743..0000000000 --- a/gnuradio-core/src/lib/general/gr_dpll_bb.i +++ /dev/null @@ -1,31 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,dpll_bb) - - gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); - -class gr_dpll_bb : public gr_sync_block -{ - private: - gr_dpll_bb (float period, float gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.cc b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.cc deleted file mode 100644 index 4a92d113a5..0000000000 --- a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,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 <gr_encode_ccsds_27_bb.h> -#include <gr_io_signature.h> - -extern "C" { -#include <../viterbi/viterbi.h> -} - -gr_encode_ccsds_27_bb_sptr -gr_make_encode_ccsds_27_bb() -{ - return gnuradio::get_initial_sptr(new gr_encode_ccsds_27_bb()); -} - -gr_encode_ccsds_27_bb::gr_encode_ccsds_27_bb() - : gr_sync_interpolator("encode_ccsds_27_bb", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(char)), - 16) // Rate 1/2 code, packed to unpacked conversion -{ - d_encstate = 0; -} - -gr_encode_ccsds_27_bb::~gr_encode_ccsds_27_bb() -{ -} - -int -gr_encode_ccsds_27_bb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - unsigned char *in = (unsigned char *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - d_encstate = encode(out, in, noutput_items/16, d_encstate); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h deleted file mode 100644 index 94e9c33f1b..0000000000 --- a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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_ENCODE_CCSDS_27_BB_H -#define INCLUDED_GR_ENCODE_CCSDS_27_BB_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_encode_ccsds_27_bb; - -typedef boost::shared_ptr<gr_encode_ccsds_27_bb> gr_encode_ccsds_27_bb_sptr; - -GR_CORE_API gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); - -/*! \brief A rate 1/2, k=7 convolutional encoder for the CCSDS standard - * \ingroup ecc - * - * This block performs convolutional encoding using the CCSDS standard - * polynomial ("Voyager"). - * - * The input is an MSB first packed stream of bits. - * - * The output is a stream of symbols 0 or 1 representing the encoded data. - * - * As a rate 1/2 code, there will be 16 output symbols for every input byte. - * - * This block is designed for continuous data streaming, not packetized data. - * There is no provision to "flush" the encoder. - */ - -class GR_CORE_API gr_encode_ccsds_27_bb : public gr_sync_interpolator -{ -private: - friend GR_CORE_API gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); - - gr_encode_ccsds_27_bb(); - unsigned char d_encstate; - - public: - ~gr_encode_ccsds_27_bb(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_ENCODE_CCSDS_27_BB_H */ diff --git a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.i b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.i deleted file mode 100644 index e74e9174ac..0000000000 --- a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,encode_ccsds_27_bb); - -gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb (); - -class gr_encode_ccsds_27_bb : public gr_sync_interpolator -{ -private: - gr_encode_ccsds_27_bb(); -}; diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc deleted file mode 100644 index 147b64e9bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc +++ /dev/null @@ -1,91 +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 <gr_feedforward_agc_cc.h> -#include <gr_io_signature.h> -#include <stdexcept> - -gr_feedforward_agc_cc_sptr -gr_make_feedforward_agc_cc(int nsamples, float reference) -{ - return gnuradio::get_initial_sptr(new gr_feedforward_agc_cc (nsamples, reference)); -} - -gr_feedforward_agc_cc::gr_feedforward_agc_cc (int nsamples, float reference) - : gr_sync_block ("gr_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("gr_feedforward_agc_cc: nsamples must be >= 1"); - - set_history(nsamples); -} - -gr_feedforward_agc_cc::~gr_feedforward_agc_cc() -{ -} - -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 -gr_feedforward_agc_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]; - 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; -} diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h deleted file mode 100644 index 63e5e4c436..0000000000 --- a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.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_GR_FEEDFORWARD_AGC_CC_H -#define INCLUDED_GR_FEEDFORWARD_AGC_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_feedforward_agc_cc; -typedef boost::shared_ptr<gr_feedforward_agc_cc> gr_feedforward_agc_cc_sptr; - -GR_CORE_API gr_feedforward_agc_cc_sptr -gr_make_feedforward_agc_cc(int nsamples, float reference = 1.0); - -/*! - * \brief Non-causal AGC which computes required gain based on max absolute value over nsamples - * \ingroup level_blk - */ -class GR_CORE_API gr_feedforward_agc_cc : public gr_sync_block -{ - friend GR_CORE_API gr_feedforward_agc_cc_sptr - gr_make_feedforward_agc_cc(int nsamples, float reference); - - int d_nsamples; - float d_reference; - - gr_feedforward_agc_cc(int nsamples, float reference); - - public: - ~gr_feedforward_agc_cc(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FEEDFORWARD_AGC_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i deleted file mode 100644 index 1fd5a2c26d..0000000000 --- a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i +++ /dev/null @@ -1,34 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,feedforward_agc_cc); - -gr_feedforward_agc_cc_sptr -gr_make_feedforward_agc_cc(int nsamples, float reference = 1.0); - -class gr_feedforward_agc_cc : public gr_sync_block -{ - gr_feedforward_agc_cc(int nsamples, float reference); - - public: - ~gr_feedforward_agc_cc(); -}; diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc.cc b/gnuradio-core/src/lib/general/gr_fft_vcc.cc deleted file mode 100644 index addcddb64a..0000000000 --- a/gnuradio-core/src/lib/general/gr_fft_vcc.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_fft_vcc.h> // abstract class -#include <gr_fft_vcc_fftw.h> // concrete class -#include <gr_io_signature.h> -#include <gri_fft.h> -#include <math.h> -#include <string.h> - -gr_fft_vcc_sptr -gr_make_fft_vcc (int fft_size, bool forward, - const std::vector<float> &window, - bool shift, int nthreads) -{ - return gr_make_fft_vcc_fftw(fft_size, forward, - window, shift, nthreads); -} - -gr_fft_vcc::gr_fft_vcc (const std::string &name, - int fft_size, bool forward, const std::vector<float> &window, - bool shift) - : gr_sync_block (name, - gr_make_io_signature (1, 1, fft_size * sizeof (gr_complex)), - gr_make_io_signature (1, 1, fft_size * sizeof (gr_complex))), - d_fft_size(fft_size), d_forward(forward), d_shift(shift) -{ - set_window(window); -} - -gr_fft_vcc::~gr_fft_vcc () -{ -} - -bool -gr_fft_vcc::set_window(const std::vector<float> &window) -{ - if(window.size()==0 || window.size()==d_fft_size) { - d_window=window; - return true; - } - else - return false; -} - -void -gr_fft_vcc::set_nthreads(int n) -{ - throw std::runtime_error("gr_fft_vcc::set_nthreads not implemented."); -} - -int -gr_fft_vcc::nthreads() const -{ - throw std::runtime_error("gr_fft_vcc::nthreads not implemented."); - return 0; -} diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc.h b/gnuradio-core/src/lib/general/gr_fft_vcc.h deleted file mode 100644 index db5690d41d..0000000000 --- a/gnuradio-core/src/lib/general/gr_fft_vcc.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007,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_FFT_VCC_H -#define INCLUDED_GR_FFT_VCC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_fft_vcc; -typedef boost::shared_ptr<gr_fft_vcc> gr_fft_vcc_sptr; - -GR_CORE_API gr_fft_vcc_sptr -gr_make_fft_vcc (int fft_size, bool forward, - const std::vector<float> &window, - bool shift=false, int nthreads=1); - -/*! - * \brief Compute forward or reverse FFT. complex vector in / complex vector out. - * \ingroup dft_blk - * - * Abstract base class - */ -class GR_CORE_API gr_fft_vcc : public gr_sync_block -{ -protected: - friend GR_CORE_API gr_fft_vcc_sptr - gr_make_fft_vcc (int fft_size, bool forward, - const std::vector<float> &window, - bool shift); - - unsigned int d_fft_size; - std::vector<float> d_window; - bool d_forward; - bool d_shift; - - gr_fft_vcc (const std::string &name, int fft_size, bool forward, - const std::vector<float> &window, bool shift); - - public: - ~gr_fft_vcc (); - - virtual void set_nthreads(int n); - virtual int nthreads() const; - - bool set_window(const std::vector<float> &window); -}; - -#endif /* INCLUDED_GR_FFT_VCC_H */ diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc.i b/gnuradio-core/src/lib/general/gr_fft_vcc.i deleted file mode 100644 index f9caae7d8d..0000000000 --- a/gnuradio-core/src/lib/general/gr_fft_vcc.i +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007,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(gr, fft_vcc) - -gr_fft_vcc_sptr -gr_make_fft_vcc (int fft_size, bool forward, - const std::vector<float> &window, - bool shift=false, int nthreads=1); - -class gr_fft_vcc : public gr_sync_block -{ - protected: - gr_fft_vcc (int fft_size, bool forward, - const std::vector<float> &window, - bool shift); - - public: - bool set_window(const std::vector<float> &window); - void set_nthreads(int n); - int nthreads() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc deleted file mode 100644 index 891173bcd8..0000000000 --- a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007,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 <gr_fft_vcc_fftw.h> -#include <gr_io_signature.h> -#include <gri_fft.h> -#include <math.h> -#include <string.h> - -gr_fft_vcc_sptr -gr_make_fft_vcc_fftw (int fft_size, bool forward, - const std::vector<float> &window, - bool shift, int nthreads) -{ - return gnuradio::get_initial_sptr(new gr_fft_vcc_fftw - (fft_size, forward, window, - shift, nthreads)); -} - -gr_fft_vcc_fftw::gr_fft_vcc_fftw (int fft_size, bool forward, - const std::vector<float> &window, - bool shift, int nthreads) - : gr_fft_vcc("fft_vcc_fftw", fft_size, forward, window, shift) -{ - d_fft = new gri_fft_complex (d_fft_size, forward, nthreads); -} - -gr_fft_vcc_fftw::~gr_fft_vcc_fftw () -{ - delete d_fft; -} - -void -gr_fft_vcc_fftw::set_nthreads(int n) -{ - d_fft->set_nthreads(n); -} - -int -gr_fft_vcc_fftw::nthreads() const -{ - return d_fft->nthreads(); -} - -int -gr_fft_vcc_fftw::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]; - - unsigned int input_data_size = input_signature()->sizeof_stream_item (0); - unsigned int output_data_size = output_signature()->sizeof_stream_item (0); - - int count = 0; - - while (count++ < noutput_items){ - - // copy input into optimally aligned buffer - - if (d_window.size()){ - gr_complex *dst = d_fft->get_inbuf(); - if(!d_forward && d_shift){ - unsigned int offset = (!d_forward && d_shift)?(d_fft_size/2):0; - int fft_m_offset = d_fft_size - offset; - for (unsigned int i = 0; i < offset; i++) // apply window - dst[i+fft_m_offset] = in[i] * d_window[i]; - for (unsigned int i = offset; i < d_fft_size; i++) // apply window - dst[i-offset] = in[i] * d_window[i]; - } else { - for (unsigned int i = 0; i < d_fft_size; i++) // apply window - dst[i] = in[i] * d_window[i]; - } - } - else { - if(!d_forward && d_shift) { // apply an ifft shift on the data - gr_complex *dst = d_fft->get_inbuf(); - unsigned int len = (unsigned int)(floor(d_fft_size/2.0)); // half length of complex array - memcpy(&dst[0], &in[len], sizeof(gr_complex)*(d_fft_size - len)); - memcpy(&dst[d_fft_size - len], &in[0], sizeof(gr_complex)*len); - } - else { - memcpy (d_fft->get_inbuf(), in, input_data_size); - } - } - - // compute the fft - d_fft->execute (); - - // copy result to our output - if(d_forward && d_shift) { // apply a fft shift on the data - unsigned int len = (unsigned int)(ceil(d_fft_size/2.0)); - memcpy(&out[0], &d_fft->get_outbuf()[len], sizeof(gr_complex)*(d_fft_size - len)); - memcpy(&out[d_fft_size - len], &d_fft->get_outbuf()[0], sizeof(gr_complex)*len); - } - else { - memcpy (out, d_fft->get_outbuf (), output_data_size); - } - - in += d_fft_size; - out += d_fft_size; - } - - return noutput_items; -} - diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h deleted file mode 100644 index 967ceaefb6..0000000000 --- a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -#ifndef INCLUDED_GR_FFT_VCC_FFTW_H -#define INCLUDED_GR_FFT_VCC_FFTW_H - -#include <gr_core_api.h> -#include <gr_fft_vcc.h> - -class gri_fft_complex; - -GR_CORE_API gr_fft_vcc_sptr -gr_make_fft_vcc_fftw (int fft_size, bool forward, - const std::vector<float> &window, - bool shift=false, int nthreads=1); - -/*! - * \brief Compute forward or reverse FFT. complex vector in / complex vector out. - * \ingroup dft_blk - * - * Concrete class that uses FFTW. - */ -class GR_CORE_API gr_fft_vcc_fftw : public gr_fft_vcc -{ - friend GR_CORE_API gr_fft_vcc_sptr - gr_make_fft_vcc_fftw (int fft_size, bool forward, - const std::vector<float> &window, - bool shift, int nthreads); - - gri_fft_complex *d_fft; - - gr_fft_vcc_fftw (int fft_size, bool forward, - const std::vector<float> &window, - bool shift, int nthreads=1); - - public: - ~gr_fft_vcc_fftw (); - - void set_nthreads(int n); - int nthreads() const; - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_FFT_VCC_FFTW_H */ diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.cc b/gnuradio-core/src/lib/general/gr_fft_vfc.cc deleted file mode 100644 index 2396055b93..0000000000 --- a/gnuradio-core/src/lib/general/gr_fft_vfc.cc +++ /dev/null @@ -1,135 +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 <gr_fft_vfc.h> -#include <gr_io_signature.h> -#include <gri_fft.h> -#include <math.h> -#include <stdexcept> -#include <string.h> -#include <cstdio> - - -// FIXME after this is working, change to use native real to complex fft. -// It should run twice as fast. - - - - -gr_fft_vfc_sptr -gr_make_fft_vfc (int fft_size, bool forward, - const std::vector<float> &window, - int nthreads) -{ - return gnuradio::get_initial_sptr(new gr_fft_vfc (fft_size, forward, - window, nthreads)); -} - -gr_fft_vfc::gr_fft_vfc (int fft_size, bool forward, - const std::vector<float> &window, - int nthreads) - : gr_sync_block ("fft_vfc", - gr_make_io_signature (1, 1, fft_size * sizeof (float)), - gr_make_io_signature (1, 1, fft_size * sizeof (gr_complex))), - d_fft_size(fft_size), d_window() -{ - if (!forward){ - fprintf (stderr, "fft_vfc: forward must == true\n"); - throw std::invalid_argument ("fft_vfc: forward must == true"); - } - - d_fft = new gri_fft_complex (d_fft_size, forward, nthreads); - - set_window(window); -} - -gr_fft_vfc::~gr_fft_vfc () -{ - delete d_fft; -} - -void -gr_fft_vfc::set_nthreads(int n) -{ - d_fft->set_nthreads(n); -} - -int -gr_fft_vfc::nthreads() const -{ - return d_fft->nthreads(); -} - -int -gr_fft_vfc::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]; - - unsigned int output_data_size = output_signature()->sizeof_stream_item (0); - - int count = 0; - - while (count++ < noutput_items){ - - // copy input into optimally aligned buffer - - if (d_window.size()){ - gr_complex *dst = d_fft->get_inbuf(); - for (unsigned int i = 0; i < d_fft_size; i++) // apply window - dst[i] = in[i] * d_window[i]; - } - else { - gr_complex *dst = d_fft->get_inbuf(); - for (unsigned int i = 0; i < d_fft_size; i++) // float to complex conversion - dst[i] = in[i]; - } - - // compute the fft - d_fft->execute (); - - // cpoy result to our output - memcpy (out, d_fft->get_outbuf (), output_data_size); - - in += d_fft_size; - out += d_fft_size; - } - - return noutput_items; -} - -bool -gr_fft_vfc::set_window(const std::vector<float> &window) -{ - if(window.size()==0 || window.size()==d_fft_size) { - d_window=window; - return true; - } - else - return false; -} diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.h b/gnuradio-core/src/lib/general/gr_fft_vfc.h deleted file mode 100644 index 35b95313d3..0000000000 --- a/gnuradio-core/src/lib/general/gr_fft_vfc.h +++ /dev/null @@ -1,72 +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. - */ - -#ifndef INCLUDED_GR_FFT_VFC_H -#define INCLUDED_GR_FFT_VFC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gri_fft_complex; - -class gr_fft_vfc; -typedef boost::shared_ptr<gr_fft_vfc> gr_fft_vfc_sptr; - -GR_CORE_API gr_fft_vfc_sptr -gr_make_fft_vfc (int fft_size, bool forward, - const std::vector<float> &window, - int nthreads=1); - -/*! - * \brief Compute forward FFT. float vector in / complex vector out. - * \ingroup dft_blk - */ - -class GR_CORE_API gr_fft_vfc : public gr_sync_block -{ - friend GR_CORE_API gr_fft_vfc_sptr - gr_make_fft_vfc (int fft_size, bool forward, - const std::vector<float> &window, - int nthreads); - - unsigned int d_fft_size; - std::vector<float> d_window; - gri_fft_complex *d_fft; - - gr_fft_vfc (int fft_size, bool forward, - const std::vector<float> &window, - int nthreads=1); - - public: - ~gr_fft_vfc (); - - void set_nthreads(int n); - int nthreads() const; - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - bool set_window(const std::vector<float> &window); -}; - - -#endif /* INCLUDED_GR_FFT_VFC_H */ diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.i b/gnuradio-core/src/lib/general/gr_fft_vfc.i deleted file mode 100644 index d387ae155d..0000000000 --- a/gnuradio-core/src/lib/general/gr_fft_vfc.i +++ /dev/null @@ -1,42 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr, fft_vfc) - -gr_fft_vfc_sptr -gr_make_fft_vfc (int fft_size, bool forward, - const std::vector<float> &window, - int nthreads=1) -throw(std::exception); - -class gr_fft_vfc : public gr_sync_block -{ - protected: - gr_fft_vfc (int fft_size, bool forward, - const std::vector<float> &window, - int nthreads=1); - - public: - bool set_window(const std::vector<float> &window); - void set_nthreads(int n); - int nthreads() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_float_to_char.cc b/gnuradio-core/src/lib/general/gr_float_to_char.cc deleted file mode 100644 index d67ded3ea6..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_char.cc +++ /dev/null @@ -1,79 +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 <gr_float_to_char.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_float_to_char_sptr -gr_make_float_to_char (size_t vlen, float scale) -{ - return gnuradio::get_initial_sptr(new gr_float_to_char (vlen, scale)); -} - -gr_float_to_char::gr_float_to_char (size_t vlen, float scale) - : gr_sync_block ("gr_float_to_char", - gr_make_io_signature (1, 1, sizeof (float)*vlen), - gr_make_io_signature (1, 1, sizeof (char)*vlen)), - d_vlen(vlen), d_scale(scale) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(char); - set_alignment(std::max(1,alignment_multiple)); -} - -float -gr_float_to_char::scale() const -{ - return d_scale; -} - -void -gr_float_to_char::set_scale(float scale) -{ - d_scale = scale; -} - -int -gr_float_to_char::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]; - int8_t *out = (int8_t *) output_items[0]; - - if(is_unaligned()) { - volk_32f_s32f_convert_8i_u(out, in, d_scale, d_vlen*noutput_items); - } - else { - volk_32f_s32f_convert_8i_a(out, in, d_scale, d_vlen*noutput_items); - } - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_float_to_char.h b/gnuradio-core/src/lib/general/gr_float_to_char.h deleted file mode 100644 index 2df50f18d5..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_char.h +++ /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. - */ - -#ifndef INCLUDED_GR_FLOAT_TO_CHAR_H -#define INCLUDED_GR_FLOAT_TO_CHAR_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_float_to_char; -typedef boost::shared_ptr<gr_float_to_char> gr_float_to_char_sptr; - -GR_CORE_API gr_float_to_char_sptr -gr_make_float_to_char (size_t vlen=1, float scale=1); - -/*! - * \brief Convert stream of float to a stream of char - * \ingroup converter_blk - * - * \param vlen vector length of data streams. - * \param scale a scalar multiplier to change the output signal scale. - */ - -class GR_CORE_API gr_float_to_char : public gr_sync_block -{ - private: - friend GR_CORE_API gr_float_to_char_sptr gr_make_float_to_char - (size_t vlen, float scale); - gr_float_to_char (size_t vlen, float scale); - - size_t d_vlen; - float d_scale; - - public: - /*! - * Get the scalar multiplier value. - */ - float scale() const; - - /*! - * Set the scalar multiplier value. - */ - void set_scale(float scale); - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_FLOAT_TO_CHAR_H */ diff --git a/gnuradio-core/src/lib/general/gr_float_to_char.i b/gnuradio-core/src/lib/general/gr_float_to_char.i deleted file mode 100644 index b40389ede5..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_char.i +++ /dev/null @@ -1,33 +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(gr,float_to_char) - -gr_float_to_char_sptr -gr_make_float_to_char (size_t vlen=1, float scale=1); - -class gr_float_to_char : public gr_sync_block -{ -public: - float scale() const; - void set_scale(float scale); -}; diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.cc b/gnuradio-core/src/lib/general/gr_float_to_complex.cc deleted file mode 100644 index c68eac8c7c..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_complex.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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 <gr_float_to_complex.h> -#include <gr_io_signature.h> - -gr_float_to_complex_sptr -gr_make_float_to_complex (size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_float_to_complex (vlen)); -} - -gr_float_to_complex::gr_float_to_complex (size_t vlen) - : gr_sync_block ("gr_float_to_complex", - gr_make_io_signature (1, 2, sizeof (float) * vlen), - gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen)), - d_vlen (vlen) -{ -} - -int -gr_float_to_complex::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *r = (float *)input_items[0]; - float *i = (float *)input_items[1]; - gr_complex *out = (gr_complex *) output_items[0]; - - switch (input_items.size ()){ - case 1: - for (size_t j = 0; j < noutput_items*d_vlen; j++) - out[j] = gr_complex (r[j], 0); - break; - - case 2: - for (size_t j = 0; j < noutput_items*d_vlen; j++) - out[j] = gr_complex (r[j], i[j]); - break; - - default: - assert (0); - } - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.h b/gnuradio-core/src/lib/general/gr_float_to_complex.h deleted file mode 100644 index 628b4a954e..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_complex.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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_GR_FLOAT_TO_COMPLEX_H -#define INCLUDED_GR_FLOAT_TO_COMPLEX_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_complex.h> - -class gr_float_to_complex; -typedef boost::shared_ptr<gr_float_to_complex> gr_float_to_complex_sptr; - -GR_CORE_API gr_float_to_complex_sptr -gr_make_float_to_complex (size_t vlen = 1); - -/*! - * \brief Convert 1 or 2 streams of float to a stream of gr_complex - * \ingroup converter_blk - */ - -class GR_CORE_API gr_float_to_complex : public gr_sync_block -{ - friend GR_CORE_API gr_float_to_complex_sptr gr_make_float_to_complex (size_t vlen); - gr_float_to_complex (size_t vlen); - - size_t d_vlen; - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_FLOAT_TO_COMPLEX_H */ diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.i b/gnuradio-core/src/lib/general/gr_float_to_complex.i deleted file mode 100644 index ed5ad128b0..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_complex.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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(gr,float_to_complex) - -gr_float_to_complex_sptr gr_make_float_to_complex (size_t vlen = 1); - -class gr_float_to_complex : public gr_sync_block -{ - gr_float_to_complex (size_t vlen); -}; diff --git a/gnuradio-core/src/lib/general/gr_float_to_int.cc b/gnuradio-core/src/lib/general/gr_float_to_int.cc deleted file mode 100644 index 43b8518956..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_int.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_float_to_int.h> -#include <gr_io_signature.h> -#include <gri_float_to_int.h> -#include <volk/volk.h> - -gr_float_to_int_sptr -gr_make_float_to_int (size_t vlen, float scale) -{ - return gnuradio::get_initial_sptr(new gr_float_to_int (vlen, scale)); -} - -gr_float_to_int::gr_float_to_int (size_t vlen, float scale) - : gr_sync_block ("gr_float_to_int", - gr_make_io_signature (1, 1, sizeof (float)*vlen), - gr_make_io_signature (1, 1, sizeof (int)*vlen)), - d_vlen(vlen), d_scale(scale) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(int); - set_alignment(std::max(1,alignment_multiple)); -} - -float -gr_float_to_int::scale() const -{ - return d_scale; -} - -void -gr_float_to_int::set_scale(float scale) -{ - d_scale = scale; -} -int -gr_float_to_int::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - // Disable the Volk for now. There is a problem for large 32-bit ints that - // are not properly represented by the precisions of a single float, which - // can cause wrapping from large, positive numbers to negative. - // In gri_float_to_int, the value is first promoted to a 64-bit - // value, clipped, then converted to a float. -#if 0 - const float *in = (const float *) input_items[0]; - int32_t *out = (int32_t *) output_items[0]; - - if(is_unaligned()) { - volk_32f_s32f_convert_32i_u(out, in, d_scale, d_vlen*noutput_items); - } - else { - volk_32f_s32f_convert_32i_a(out, in, d_scale, d_vlen*noutput_items); - } -#else - const float *in = (const float *) input_items[0]; - int *out = (int *) output_items[0]; - - gri_float_to_int (in, out, d_scale, d_vlen*noutput_items); - -#endif - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_float_to_int.h b/gnuradio-core/src/lib/general/gr_float_to_int.h deleted file mode 100644 index c10ea739d2..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_int.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_GR_FLOAT_TO_INT_H -#define INCLUDED_GR_FLOAT_TO_INT_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_float_to_int; -typedef boost::shared_ptr<gr_float_to_int> gr_float_to_int_sptr; - -GR_CORE_API gr_float_to_int_sptr -gr_make_float_to_int (size_t vlen=1, float scale=1); - -/*! - * \brief Convert stream of float to a stream of short - * \ingroup converter_blk - * - * \param vlen vector length of data streams. - * \param scale a scalar multiplier to change the output signal scale. - */ - -class GR_CORE_API gr_float_to_int : public gr_sync_block -{ - private: - friend GR_CORE_API - gr_float_to_int_sptr gr_make_float_to_int (size_t vlen, float scale); - gr_float_to_int (size_t vlen, float scale); - - size_t d_vlen; - float d_scale; - - public: - /*! - * Get the scalar multiplier value. - */ - float scale() const; - - /*! - * Set the scalar multiplier value. - */ - void set_scale(float scale); - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_FLOAT_TO_INT_H */ diff --git a/gnuradio-core/src/lib/general/gr_float_to_int.i b/gnuradio-core/src/lib/general/gr_float_to_int.i deleted file mode 100644 index e2a2c53ceb..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_int.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,float_to_int) - -gr_float_to_int_sptr -gr_make_float_to_int (size_t vlen=1, float scale=1); - -class gr_float_to_int : public gr_sync_block -{ -public: - float scale() const; - void set_scale(float scale); -}; diff --git a/gnuradio-core/src/lib/general/gr_float_to_short.cc b/gnuradio-core/src/lib/general/gr_float_to_short.cc deleted file mode 100644 index ab720168bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_short.cc +++ /dev/null @@ -1,79 +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 <gr_float_to_short.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_float_to_short_sptr -gr_make_float_to_short (size_t vlen, float scale) -{ - return gnuradio::get_initial_sptr(new gr_float_to_short (vlen, scale)); -} - -gr_float_to_short::gr_float_to_short (size_t vlen, float scale) - : gr_sync_block ("gr_float_to_short", - gr_make_io_signature (1, 1, sizeof (float)*vlen), - gr_make_io_signature (1, 1, sizeof (short)*vlen)), - d_vlen(vlen), d_scale(scale) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(short); - set_alignment(std::max(1,alignment_multiple)); -} - -float -gr_float_to_short::scale() const -{ - return d_scale; -} - -void -gr_float_to_short::set_scale(float scale) -{ - d_scale = scale; -} - -int -gr_float_to_short::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]; - short *out = (short *) output_items[0]; - - if(is_unaligned()) { - volk_32f_s32f_convert_16i_u(out, in, d_scale, d_vlen*noutput_items); - } - else { - volk_32f_s32f_convert_16i_a(out, in, d_scale, d_vlen*noutput_items); - } - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_float_to_short.h b/gnuradio-core/src/lib/general/gr_float_to_short.h deleted file mode 100644 index 9e43804f54..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_short.h +++ /dev/null @@ -1,69 +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_FLOAT_TO_SHORT_H -#define INCLUDED_GR_FLOAT_TO_SHORT_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_float_to_short; -typedef boost::shared_ptr<gr_float_to_short> gr_float_to_short_sptr; - -GR_CORE_API gr_float_to_short_sptr -gr_make_float_to_short (size_t vlen=1, float scale=1); - -/*! - * \brief Convert stream of float to a stream of short - * \ingroup converter_blk - * - * \param vlen vector length of data streams. - * \param scale a scalar multiplier to change the output signal scale. - */ - -class GR_CORE_API gr_float_to_short : public gr_sync_block -{ - friend GR_CORE_API - gr_float_to_short_sptr gr_make_float_to_short (size_t vlen, float scale); - gr_float_to_short (size_t vlen, float scale); - - size_t d_vlen; - float d_scale; - - public: - /*! - * Get the scalar multiplier value. - */ - float scale() const; - - /*! - * Set the scalar multiplier value. - */ - void set_scale(float scale); - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_FLOAT_TO_SHORT_H */ diff --git a/gnuradio-core/src/lib/general/gr_float_to_short.i b/gnuradio-core/src/lib/general/gr_float_to_short.i deleted file mode 100644 index ea59a388e2..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_short.i +++ /dev/null @@ -1,33 +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(gr,float_to_short) - -gr_float_to_short_sptr -gr_make_float_to_short (size_t vlen=1, float scale=1); - -class gr_float_to_short : public gr_sync_block -{ -public: - float scale() const; - void set_scale(float scale); -}; diff --git a/gnuradio-core/src/lib/general/gr_float_to_uchar.cc b/gnuradio-core/src/lib/general/gr_float_to_uchar.cc deleted file mode 100644 index 5aec73b71f..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_uchar.cc +++ /dev/null @@ -1,58 +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 <gr_float_to_uchar.h> -#include <gr_io_signature.h> -#include <gri_float_to_uchar.h> - -gr_float_to_uchar_sptr -gr_make_float_to_uchar () -{ - return gnuradio::get_initial_sptr(new gr_float_to_uchar ()); -} - -gr_float_to_uchar::gr_float_to_uchar () - : gr_sync_block ("gr_float_to_uchar", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ -} - -int -gr_float_to_uchar::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]; - - gri_float_to_uchar (in, out, noutput_items); - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_float_to_uchar.h b/gnuradio-core/src/lib/general/gr_float_to_uchar.h deleted file mode 100644 index 7fd947048a..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_uchar.h +++ /dev/null @@ -1,52 +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_GR_FLOAT_TO_UCHAR_H -#define INCLUDED_GR_FLOAT_TO_UCHAR_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_float_to_uchar; -typedef boost::shared_ptr<gr_float_to_uchar> gr_float_to_uchar_sptr; - -GR_CORE_API gr_float_to_uchar_sptr -gr_make_float_to_uchar (); - -/*! - * \brief Convert stream of float to a stream of unsigned char - * \ingroup converter_blk - */ - -class GR_CORE_API gr_float_to_uchar : public gr_sync_block -{ - friend GR_CORE_API gr_float_to_uchar_sptr gr_make_float_to_uchar (); - gr_float_to_uchar (); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_FLOAT_TO_UCHAR_H */ diff --git a/gnuradio-core/src/lib/general/gr_float_to_uchar.i b/gnuradio-core/src/lib/general/gr_float_to_uchar.i deleted file mode 100644 index b35979213c..0000000000 --- a/gnuradio-core/src/lib/general/gr_float_to_uchar.i +++ /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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,float_to_uchar) - -gr_float_to_uchar_sptr gr_make_float_to_uchar (); - -class gr_float_to_uchar : public gr_sync_block -{ - gr_float_to_uchar (); -}; diff --git a/gnuradio-core/src/lib/general/gr_fmdet_cf.cc b/gnuradio-core/src/lib/general/gr_fmdet_cf.cc deleted file mode 100644 index f020362920..0000000000 --- a/gnuradio-core/src/lib/general/gr_fmdet_cf.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_fmdet_cf.h> -#include <gr_io_signature.h> -#include <math.h> -#include <gr_math.h> - -#define M_TWOPI (2*M_PI) - -gr_fmdet_cf_sptr -gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl) -{ - return gnuradio::get_initial_sptr(new gr_fmdet_cf (samplerate, freq_low, freq_high, scl)); -} - -gr_fmdet_cf::gr_fmdet_cf (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}; - - - - - float delta; - std::vector<float> taps(15); - - d_freqhi = freq_high; - d_freqlo = freq_low; - delta = (d_freqhi - d_freqlo); - d_scl = scl; - d_bias = 0.5*scl*(d_freqhi+d_freqlo)/delta; - for (int i=0;i<15;i++) taps[i] = h[i]; - // d_filter = gr_fir_util::create_gr_fir_ccf(taps); - -} - -int -gr_fmdet_cf::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,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; -} diff --git a/gnuradio-core/src/lib/general/gr_fmdet_cf.h b/gnuradio-core/src/lib/general/gr_fmdet_cf.h deleted file mode 100644 index f85630f2fb..0000000000 --- a/gnuradio-core/src/lib/general/gr_fmdet_cf.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -#ifndef INCLUDED_GR_FMDET_CF_H -#define INCLUDED_GR_FMDET_CF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_fmdet_cf; -typedef boost::shared_ptr<gr_fmdet_cf> gr_fmdet_cf_sptr; - -GR_CORE_API gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); - -class gr_fir_ccf; - - -/*! - * \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 GR_CORE_API gr_fmdet_cf : public gr_sync_block -{ - friend GR_CORE_API gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, - float freq_high, float scl); - - gr_complex d_S1,d_S2,d_S3,d_S4; - float d_freq,d_freqlo,d_freqhi,d_scl,d_bias; - gr_fir_ccf* d_filter; - gr_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_fmdet_cf.i b/gnuradio-core/src/lib/general/gr_fmdet_cf.i deleted file mode 100644 index 2db596b7a9..0000000000 --- a/gnuradio-core/src/lib/general/gr_fmdet_cf.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,fmdet_cf) - -gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); - -class gr_fmdet_cf : public gr_sync_block -{ - private: - gr_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); -}; diff --git a/gnuradio-core/src/lib/general/gr_framer_sink_1.cc b/gnuradio-core/src/lib/general/gr_framer_sink_1.cc deleted file mode 100644 index 64a0af6a07..0000000000 --- a/gnuradio-core/src/lib/general/gr_framer_sink_1.cc +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 <gr_framer_sink_1.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <stdexcept> -#include <string.h> - -#define VERBOSE 0 - -inline void -gr_framer_sink_1::enter_search() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_search\n"); - - d_state = STATE_SYNC_SEARCH; -} - -inline void -gr_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 -gr_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; -} - -gr_framer_sink_1_sptr -gr_make_framer_sink_1(gr_msg_queue_sptr target_queue) -{ - return gnuradio::get_initial_sptr(new gr_framer_sink_1(target_queue)); -} - - -gr_framer_sink_1::gr_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(); -} - -gr_framer_sink_1::~gr_framer_sink_1 () -{ -} - -int -gr_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/gnuradio-core/src/lib/general/gr_framer_sink_1.h b/gnuradio-core/src/lib/general/gr_framer_sink_1.h deleted file mode 100644 index 93e41745f3..0000000000 --- a/gnuradio-core/src/lib/general/gr_framer_sink_1.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_GR_FRAMER_SINK_1_H -#define INCLUDED_GR_FRAMER_SINK_1_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> - -class gr_framer_sink_1; -typedef boost::shared_ptr<gr_framer_sink_1> gr_framer_sink_1_sptr; - -GR_CORE_API gr_framer_sink_1_sptr -gr_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 GR_CORE_API gr_framer_sink_1 : public gr_sync_block -{ - friend GR_CORE_API gr_framer_sink_1_sptr - gr_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: - gr_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: - ~gr_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/gnuradio-core/src/lib/general/gr_framer_sink_1.i b/gnuradio-core/src/lib/general/gr_framer_sink_1.i deleted file mode 100644 index 06281b138d..0000000000 --- a/gnuradio-core/src/lib/general/gr_framer_sink_1.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,framer_sink_1); - -gr_framer_sink_1_sptr -gr_make_framer_sink_1(gr_msg_queue_sptr target_queue); - -class gr_framer_sink_1 : public gr_sync_block -{ - protected: - gr_framer_sink_1(gr_msg_queue_sptr target_queue); - - public: - ~gr_framer_sink_1(); -}; diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc deleted file mode 100644 index 5c4daec583..0000000000 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc +++ /dev/null @@ -1,71 +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_frequency_modulator_fc.h> -#include <gr_io_signature.h> -#include <gr_fxpt.h> -#include <math.h> -#include <boost/math/special_functions/trunc.hpp> - - -gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity) -{ - return gnuradio::get_initial_sptr(new gr_frequency_modulator_fc (sensitivity)); -} - -gr_frequency_modulator_fc::gr_frequency_modulator_fc (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) -{ -} - -int -gr_frequency_modulator_fc::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; -} diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h deleted file mode 100644 index c680e96480..0000000000 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h +++ /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. - */ - -#ifndef INCLUDED_GR_FREQUENCY_MODULATOR_FC_H -#define INCLUDED_GR_FREQUENCY_MODULATOR_FC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_frequency_modulator_fc; -typedef boost::shared_ptr<gr_frequency_modulator_fc> gr_frequency_modulator_fc_sptr; - -GR_CORE_API gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity); - -/*! - * \brief Frequency modulator block - * \ingroup modulation_blk - * - * float input; complex baseband output - */ -class GR_CORE_API gr_frequency_modulator_fc : public gr_sync_block -{ - float d_sensitivity; - float d_phase; - - friend GR_CORE_API gr_frequency_modulator_fc_sptr - gr_make_frequency_modulator_fc (double sensitivity); - - gr_frequency_modulator_fc (double sensitivity); - - public: - 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); -}; - -#endif /* INCLUDED_GR_FREQUENCY_MODULATOR_FC_H */ diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i deleted file mode 100644 index 9a740583b0..0000000000 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i +++ /dev/null @@ -1,34 +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(gr,frequency_modulator_fc) - -gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity); - -class gr_frequency_modulator_fc : public gr_sync_block -{ - private: - gr_frequency_modulator_fc (double sensitivity); -public: - void set_sensitivity(float sens) { d_sensitivity = sens; } - float sensitivity() const { return d_sensitivity; } -}; diff --git a/gnuradio-core/src/lib/general/gr_fxpt_nco.h b/gnuradio-core/src/lib/general/gr_fxpt_nco.h index 9473e6ddbc..9defa083da 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt_nco.h +++ b/gnuradio-core/src/lib/general/gr_fxpt_nco.h @@ -30,7 +30,7 @@ * \brief Numerically Controlled Oscillator (NCO) * \ingroup misc */ -class GR_CORE_API gr_fxpt_nco { +class /*GR_CORE_API*/ gr_fxpt_nco { gr_uint32 d_phase; gr_int32 d_phase_inc; diff --git a/gnuradio-core/src/lib/general/gr_fxpt_vco.h b/gnuradio-core/src/lib/general/gr_fxpt_vco.h index 09c649de72..13be2526bd 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt_vco.h +++ b/gnuradio-core/src/lib/general/gr_fxpt_vco.h @@ -30,7 +30,7 @@ * \brief Voltage Controlled Oscillator (VCO) * \ingroup misc */ -class GR_CORE_API gr_fxpt_vco { +class /*GR_CORE_API*/ gr_fxpt_vco { gr_int32 d_phase; public: diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc b/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc deleted file mode 100644 index fcfeb80dcf..0000000000 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 <gr_glfsr_source_b.h> -#include <gri_glfsr.h> -#include <gr_io_signature.h> -#include <stdexcept> - -gr_glfsr_source_b_sptr -gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed) -{ - return gnuradio::get_initial_sptr(new gr_glfsr_source_b(degree, repeat, mask, seed)); -} - -gr_glfsr_source_b::gr_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("gr_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); -} - -gr_glfsr_source_b::~gr_glfsr_source_b() -{ - delete d_glfsr; -} - -int -gr_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 -gr_glfsr_source_b::mask() const -{ - return d_glfsr->mask(); -} diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_b.i b/gnuradio-core/src/lib/general/gr_glfsr_source_b.i deleted file mode 100644 index ffdd52ddba..0000000000 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_b.i +++ /dev/null @@ -1,37 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,glfsr_source_b); - -gr_glfsr_source_b_sptr -gr_make_glfsr_source_b(int degree, bool repeat=true, int mask=0, int seed=1) - throw (std::runtime_error); - -class gr_glfsr_source_b : public gr_sync_block -{ -protected: - gr_glfsr_source_b(int degree, bool repeat, int mask, int seed); - -public: - unsigned int period() const; - int mask() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc b/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc deleted file mode 100644 index a9efc8a706..0000000000 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 <gr_glfsr_source_f.h> -#include <gri_glfsr.h> -#include <gr_io_signature.h> -#include <stdexcept> - -gr_glfsr_source_f_sptr -gr_make_glfsr_source_f(int degree, bool repeat, int mask, int seed) -{ - return gnuradio::get_initial_sptr(new gr_glfsr_source_f(degree, repeat, mask, seed)); -} - -gr_glfsr_source_f::gr_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("gr_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); -} - -gr_glfsr_source_f::~gr_glfsr_source_f() -{ - delete d_glfsr; -} - -int -gr_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 -gr_glfsr_source_f::mask() const -{ - return d_glfsr->mask(); -} diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_f.h b/gnuradio-core/src/lib/general/gr_glfsr_source_f.h deleted file mode 100644 index 3549e3e5df..0000000000 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_f.h +++ /dev/null @@ -1,66 +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_GR_GLFSR_SOURCE_F_H -#define INCLUDED_GR_GLFSR_SOURCE_F_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gri_glfsr; - -class gr_glfsr_source_f; -typedef boost::shared_ptr<gr_glfsr_source_f> gr_glfsr_source_f_sptr; - -GR_CORE_API gr_glfsr_source_f_sptr gr_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 - */ -class GR_CORE_API gr_glfsr_source_f : public gr_sync_block -{ - private: - friend GR_CORE_API gr_glfsr_source_f_sptr - gr_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; - - gr_glfsr_source_f(int degree, bool repeat, int mask, int seed); - - public: - - ~gr_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/gnuradio-core/src/lib/general/gr_glfsr_source_f.i b/gnuradio-core/src/lib/general/gr_glfsr_source_f.i deleted file mode 100644 index 2f84387c27..0000000000 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_f.i +++ /dev/null @@ -1,37 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,glfsr_source_f); - -gr_glfsr_source_f_sptr -gr_make_glfsr_source_f(int degree, bool repeat=true, int mask=0, int seed=1) - throw (std::runtime_error); - -class gr_glfsr_source_f : public gr_sync_block -{ -protected: - gr_glfsr_source_f(int degree, bool repeat, int mask, int seed); - -public: - unsigned int period() const; - int mask() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_head.cc b/gnuradio-core/src/lib/general/gr_head.cc index cb07c84ddc..1726888113 100644 --- a/gnuradio-core/src/lib/general/gr_head.cc +++ b/gnuradio-core/src/lib/general/gr_head.cc @@ -26,6 +26,7 @@ #include <gr_head.h> #include <gr_io_signature.h> #include <string.h> +#include <iostream> gr_head::gr_head (size_t sizeof_stream_item, unsigned long long nitems) : gr_sync_block ("head", diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.cc b/gnuradio-core/src/lib/general/gr_int_to_float.cc deleted file mode 100644 index a7fb24dc69..0000000000 --- a/gnuradio-core/src/lib/general/gr_int_to_float.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_int_to_float.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_int_to_float_sptr -gr_make_int_to_float (size_t vlen, float scale) -{ - return gnuradio::get_initial_sptr(new gr_int_to_float (vlen, scale)); -} - -gr_int_to_float::gr_int_to_float (size_t vlen, float scale) - : gr_sync_block ("gr_int_to_float", - gr_make_io_signature (1, 1, sizeof (int32_t)*vlen), - gr_make_io_signature (1, 1, sizeof (float)*vlen)), - d_vlen(vlen), d_scale(scale) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(float); - set_alignment(std::max(1,alignment_multiple)); -} - -int -gr_int_to_float::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const int32_t *in = (const int32_t *) input_items[0]; - float *out = (float *) output_items[0]; - - if(is_unaligned()) { - volk_32i_s32f_convert_32f_u(out, in, d_scale, d_vlen*noutput_items); - } - else { - volk_32i_s32f_convert_32f_a(out, in, d_scale, d_vlen*noutput_items); - } - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.h b/gnuradio-core/src/lib/general/gr_int_to_float.h deleted file mode 100644 index 6200c5be75..0000000000 --- a/gnuradio-core/src/lib/general/gr_int_to_float.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_GR_INT_TO_FLOAT_H -#define INCLUDED_GR_INT_TO_FLOAT_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_int_to_float; -typedef boost::shared_ptr<gr_int_to_float> gr_int_to_float_sptr; - -GR_CORE_API gr_int_to_float_sptr -gr_make_int_to_float (size_t vlen=1, float scale=1); - -/*! - * \brief Convert stream of int to a stream of float - * \ingroup converter_blk - * - * \param vlen vector length of data streams. - * \param scale a scalar divider to change the output signal scale. - */ - -class GR_CORE_API gr_int_to_float : public gr_sync_block -{ - private: - friend GR_CORE_API gr_int_to_float_sptr - gr_make_int_to_float (size_t vlen, float scale); - gr_int_to_float (size_t vlen, float scale); - - size_t d_vlen; - float d_scale; - - public: - /*! - * Get the scalar divider value. - */ - float scale() const; - - /*! - * Set the scalar divider value. - */ - void set_scale(float scale); - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_INT_TO_FLOAT_H */ diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.i b/gnuradio-core/src/lib/general/gr_int_to_float.i deleted file mode 100644 index f3781ac8ab..0000000000 --- a/gnuradio-core/src/lib/general/gr_int_to_float.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,int_to_float) - -gr_int_to_float_sptr -gr_make_int_to_float (size_t vlen=1, float scale=1); - -class gr_int_to_float : public gr_sync_block -{ - float scale() const; - void set_scale(float scale); -}; diff --git a/gnuradio-core/src/lib/general/gr_interleave.cc b/gnuradio-core/src/lib/general/gr_interleave.cc deleted file mode 100644 index 5d572871eb..0000000000 --- a/gnuradio-core/src/lib/general/gr_interleave.cc +++ /dev/null @@ -1,77 +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 <gr_interleave.h> -#include <gr_io_signature.h> -#include <string.h> - - -gr_interleave_sptr -gr_make_interleave (size_t itemsize) -{ - return gnuradio::get_initial_sptr(new gr_interleave (itemsize)); -} - -gr_interleave::gr_interleave (size_t itemsize) - : gr_sync_interpolator ("interleave", - gr_make_io_signature (1, gr_io_signature::IO_INFINITE, itemsize), - gr_make_io_signature (1, 1, itemsize), - 1), - d_itemsize (itemsize) -{ -} - -gr_interleave::~gr_interleave () -{ - // NOP -} - -bool -gr_interleave::check_topology (int ninputs, int noutputs) -{ - set_interpolation (ninputs); - return true; -} - -int -gr_interleave::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - size_t nchan = input_items.size (); - size_t itemsize = d_itemsize; - const char **in = (const char **) &input_items[0]; - char *out = (char *) output_items[0]; - - for (int i = 0; i < noutput_items; i += nchan){ - for (unsigned int n = 0; n < nchan; n++){ - memcpy (out, in[n], itemsize); - out += itemsize; - in[n] += itemsize; - } - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_interleave.h b/gnuradio-core/src/lib/general/gr_interleave.h deleted file mode 100644 index 3b0202d008..0000000000 --- a/gnuradio-core/src/lib/general/gr_interleave.h +++ /dev/null @@ -1,57 +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_GR_INTERLEAVE_H -#define INCLUDED_GR_INTERLEAVE_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_interleave; -typedef boost::shared_ptr<gr_interleave> gr_interleave_sptr; - -GR_CORE_API gr_interleave_sptr gr_make_interleave (size_t itemsize); - -/*! - * \brief interleave N inputs to a single output - * \ingroup slicedice_blk - */ -class GR_CORE_API gr_interleave : public gr_sync_interpolator -{ - friend GR_CORE_API gr_interleave_sptr gr_make_interleave (size_t itemsize); - - size_t d_itemsize; - - gr_interleave (size_t itemsize); - -public: - ~gr_interleave (); - - 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); - -}; - -#endif /* INCLUDED_GR_INTERLEAVE_H */ diff --git a/gnuradio-core/src/lib/general/gr_interleave.i b/gnuradio-core/src/lib/general/gr_interleave.i deleted file mode 100644 index 09a57c886c..0000000000 --- a/gnuradio-core/src/lib/general/gr_interleave.i +++ /dev/null @@ -1,30 +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(gr,interleave) - -gr_interleave_sptr gr_make_interleave (size_t itemsize); - -class gr_interleave : public gr_sync_interpolator -{ - gr_interleave (size_t itemsize); -}; diff --git a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.cc b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.cc deleted file mode 100644 index e7d375a355..0000000000 --- a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.cc +++ /dev/null @@ -1,59 +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 <gr_interleaved_short_to_complex.h> -#include <gr_io_signature.h> -#include <gri_interleaved_short_to_complex.h> - -gr_interleaved_short_to_complex_sptr -gr_make_interleaved_short_to_complex () -{ - return gnuradio::get_initial_sptr(new gr_interleaved_short_to_complex ()); -} - -gr_interleaved_short_to_complex::gr_interleaved_short_to_complex () - : gr_sync_decimator ("gr_interleaved_short_to_complex", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (gr_complex)), - 2) -{ -} - -int -gr_interleaved_short_to_complex::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]; - gr_complex *out = (gr_complex *) output_items[0]; - - gri_interleaved_short_to_complex (in, out, 2 * noutput_items); - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h deleted file mode 100644 index 159d107b33..0000000000 --- a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h +++ /dev/null @@ -1,52 +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_GR_INTERLEAVED_SHORT_TO_COMPLEX_H -#define INCLUDED_GR_INTERLEAVED_SHORT_TO_COMPLEX_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_interleaved_short_to_complex; -typedef boost::shared_ptr<gr_interleaved_short_to_complex> - gr_interleaved_short_to_complex_sptr; - -GR_CORE_API gr_interleaved_short_to_complex_sptr -gr_make_interleaved_short_to_complex (); - -/*! - * \brief Convert stream of interleaved shorts to a stream of complex - * \ingroup converter_blk - */ - -class GR_CORE_API gr_interleaved_short_to_complex : public gr_sync_decimator -{ - friend GR_CORE_API gr_interleaved_short_to_complex_sptr gr_make_interleaved_short_to_complex (); - gr_interleaved_short_to_complex (); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_INTERLEAVED_SHORT_TO_COMPLEX_H */ diff --git a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.i b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.i deleted file mode 100644 index 7977105506..0000000000 --- a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.i +++ /dev/null @@ -1,30 +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(gr,interleaved_short_to_complex) - -gr_interleaved_short_to_complex_sptr gr_make_interleaved_short_to_complex (); - -class gr_interleaved_short_to_complex : public gr_sync_decimator -{ - gr_interleaved_short_to_complex (); -}; diff --git a/gnuradio-core/src/lib/general/gr_keep_m_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_m_in_n.cc deleted file mode 100644 index 1becbfa116..0000000000 --- a/gnuradio-core/src/lib/general/gr_keep_m_in_n.cc +++ /dev/null @@ -1,98 +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 <gr_keep_m_in_n.h> -#include <gr_io_signature.h> -#include <string.h> -#include <stdio.h> - -gr_keep_m_in_n_sptr -gr_make_keep_m_in_n(size_t item_size, int m, int n, int offset) -{ - return gnuradio::get_initial_sptr(new gr_keep_m_in_n(item_size, m, n, offset)); -} - - -/* -* -* offset = 0, starts with 0th item -* offset = 1, starts with 1st item, etc... -* -* we take m items out of each n -*/ -gr_keep_m_in_n::gr_keep_m_in_n(size_t item_size, int m, int n, int offset) - : gr_block("keep_m_in_n", - gr_make_io_signature(1, 1, item_size), - gr_make_io_signature(1, 1, item_size)), - d_n(n), - d_m(m), - d_offset(offset), - d_itemsize(item_size) -{ - // sanity checking - assert(d_m > 0); - assert(d_n > 0); - assert(d_m <= d_n); - assert(d_offset <= (d_n-d_m)); - - set_output_multiple(m); -} - - -void -gr_keep_m_in_n::forecast(int noutput_items, gr_vector_int &ninput_items_required) -{ - ninput_items_required[0] = d_n*(noutput_items/d_m); -} - -void -gr_keep_m_in_n::set_offset(int offset) -{ - d_offset = offset; -} - -int -gr_keep_m_in_n::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - uint8_t* out = (uint8_t*)output_items[0]; - const uint8_t* in = (const uint8_t*)input_items[0]; - - // iterate over data blocks of size {n, input : m, output} - int blks = std::min(noutput_items/d_m, ninput_items[0]/d_n); - for(int i=0; i<blks; i++) { - // set up copy pointers - const uint8_t* iptr = &in[(i*d_n + d_offset)*d_itemsize]; - uint8_t* optr = &out[i*d_m*d_itemsize]; - // perform copy - memcpy( optr, iptr, d_m*d_itemsize ); - } - - consume_each(d_n); - return d_m; -} diff --git a/gnuradio-core/src/lib/general/gr_keep_m_in_n.h b/gnuradio-core/src/lib/general/gr_keep_m_in_n.h deleted file mode 100644 index c6bf40ecf2..0000000000 --- a/gnuradio-core/src/lib/general/gr_keep_m_in_n.h +++ /dev/null @@ -1,67 +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 INCLUDED_GR_KEEP_M_IN_N_H -#define INCLUDED_GR_KEEP_M_IN_N_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_keep_m_in_n; -typedef boost::shared_ptr<gr_keep_m_in_n> gr_keep_m_in_n_sptr; - -GR_CORE_API gr_keep_m_in_n_sptr -gr_make_keep_m_in_n (size_t item_size, int m, int n, int offset); - - -/*! - * \brief decimate a stream, keeping one item out of every n. - * \ingroup slicedice_blk - */ -class GR_CORE_API gr_keep_m_in_n : public gr_block -{ - friend GR_CORE_API gr_keep_m_in_n_sptr - gr_make_keep_m_in_n (size_t item_size, int m, int n, int offset); - - int d_n; - int d_m; - int d_count; - int d_offset; - int d_itemsize; - - protected: - gr_keep_m_in_n (size_t item_size, int m, int n, int offset); - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - - 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); - - void set_offset(int offset); - void set_n(int n){ d_n = n; } - void set_m(int m){ d_m = m; } - -}; - -#endif /* INCLUDED_GR_KEEP_M_IN_N_H */ diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc deleted file mode 100644 index fbba9e91c0..0000000000 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc +++ /dev/null @@ -1,105 +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 <gr_keep_one_in_n.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_keep_one_in_n_sptr -gr_make_keep_one_in_n (size_t item_size, int n) -{ - return gnuradio::get_initial_sptr(new gr_keep_one_in_n (item_size, n)); -} - -gr_keep_one_in_n::gr_keep_one_in_n (size_t item_size, int n) - : gr_block ("keep_one_in_n", - gr_make_io_signature (1, 1, item_size), - gr_make_io_signature (1, 1, item_size)), - d_count(n) -{ - // To avoid bad behavior with using set_relative_rate in this block with - // VERY large values of n, we will keep track of things ourselves. Using - // this to turn off automatic tag propagation, which will be handled - // locally in general_work(). - set_tag_propagation_policy(TPP_DONT); - - set_n(n); -} - -void -gr_keep_one_in_n::set_n(int n) -{ - if (n < 1) - n = 1; - - d_n = n; - d_count = n; - - // keep our internal understanding of the relative rate of this block - // don't set the relative rate, though, and we will handle our own - // tag propagation. - d_decim_rate = 1.0/(float)d_n; -} - -int -gr_keep_one_in_n::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *) input_items[0]; - char *out = (char *) output_items[0]; - - size_t item_size = input_signature ()->sizeof_stream_item (0); - int ni = 0; - int no = 0; - - while (ni < ninput_items[0] && no < noutput_items){ - d_count--; - if (d_count <= 0){ - memcpy (out, in, item_size); // copy 1 item - out += item_size; - no++; - d_count = d_n; - } - in += item_size; - ni++; - } - - // Because we have set TPP_DONT, we have to propagate the tags here manually. - // Adjustment of the tag sample value is done using the float d_decim_rate. - std::vector<gr_tag_t> tags; - std::vector<gr_tag_t>::iterator t; - get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+ni); - for(t = tags.begin(); t != tags.end(); t++) { - gr_tag_t new_tag = *t; - new_tag.offset *= d_decim_rate; - add_item_tag(0, new_tag); - } - - consume_each (ni); - return no; -} diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.h b/gnuradio-core/src/lib/general/gr_keep_one_in_n.h deleted file mode 100644 index f37475204b..0000000000 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.h +++ /dev/null @@ -1,62 +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_GR_KEEP_ONE_IN_N_H -#define INCLUDED_GR_KEEP_ONE_IN_N_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_keep_one_in_n; -typedef boost::shared_ptr<gr_keep_one_in_n> gr_keep_one_in_n_sptr; - -GR_CORE_API gr_keep_one_in_n_sptr -gr_make_keep_one_in_n (size_t item_size, int n); - - -/*! - * \brief decimate a stream, keeping one item out of every n. - * \ingroup slicedice_blk - */ -class GR_CORE_API gr_keep_one_in_n : public gr_block -{ - friend GR_CORE_API gr_keep_one_in_n_sptr - gr_make_keep_one_in_n (size_t item_size, int n); - - int d_n; - int d_count; - float d_decim_rate; - - protected: - gr_keep_one_in_n (size_t item_size, int n); - - 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); - - void set_n(int n); - -}; - -#endif /* INCLUDED_GR_KEEP_ONE_IN_N_H */ diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.i b/gnuradio-core/src/lib/general/gr_keep_one_in_n.i deleted file mode 100644 index 534098cded..0000000000 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.i +++ /dev/null @@ -1,35 +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(gr,keep_one_in_n) - -gr_keep_one_in_n_sptr -gr_make_keep_one_in_n (size_t itemsize, int n); - -class gr_keep_one_in_n : public gr_block -{ - protected: - gr_keep_one_in_n (size_t itemsize, int n); - - public: - void set_n(int n); -}; diff --git a/gnuradio-core/src/lib/general/gr_map_bb.cc b/gnuradio-core/src/lib/general/gr_map_bb.cc deleted file mode 100644 index 7deb8971a5..0000000000 --- a/gnuradio-core/src/lib/general/gr_map_bb.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 <gr_map_bb.h> -#include <gr_io_signature.h> - -gr_map_bb_sptr -gr_make_map_bb (const std::vector<int> &map) -{ - return gnuradio::get_initial_sptr(new gr_map_bb (map)); -} - -gr_map_bb::gr_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 -gr_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/gnuradio-core/src/lib/general/gr_map_bb.h b/gnuradio-core/src/lib/general/gr_map_bb.h deleted file mode 100644 index 0a2f5a45f8..0000000000 --- a/gnuradio-core/src/lib/general/gr_map_bb.h +++ /dev/null @@ -1,52 +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_GR_MAP_BB_H -#define INCLUDED_GR_MAP_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_map_bb; -typedef boost::shared_ptr<gr_map_bb> gr_map_bb_sptr; - -GR_CORE_API gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); - -/*! - * \brief output[i] = map[input[i]] - * \ingroup coding_blk - */ - -class GR_CORE_API gr_map_bb : public gr_sync_block -{ - friend GR_CORE_API gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); - - unsigned char d_map[0x100]; - - gr_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/gnuradio-core/src/lib/general/gr_map_bb.i b/gnuradio-core/src/lib/general/gr_map_bb.i deleted file mode 100644 index 9c8bff6447..0000000000 --- a/gnuradio-core/src/lib/general/gr_map_bb.i +++ /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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,map_bb); - -gr_map_bb_sptr gr_make_map_bb (const std::vector<int> &map); - -class gr_map_bb : public gr_sync_block -{ - private: - gr_map_bb (const std::vector<int> &map); -}; - diff --git a/gnuradio-core/src/lib/general/gr_multiply_cc.cc b/gnuradio-core/src/lib/general/gr_multiply_cc.cc deleted file mode 100644 index 4a3751419f..0000000000 --- a/gnuradio-core/src/lib/general/gr_multiply_cc.cc +++ /dev/null @@ -1,69 +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 <gr_multiply_cc.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_multiply_cc_sptr -gr_make_multiply_cc (size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_multiply_cc (vlen)); -} - -gr_multiply_cc::gr_multiply_cc (size_t vlen) - : gr_sync_block ("gr_multiply_cc", - gr_make_io_signature (1, -1, sizeof (gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen)), - d_vlen(vlen) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(gr_complex); - set_alignment(std::max(1,alignment_multiple)); -} - -int -gr_multiply_cc::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]; - int noi = d_vlen*noutput_items; - - memcpy(out, input_items[0], noi*sizeof(gr_complex)); - if(is_unaligned()) { - for(size_t i = 1; i < input_items.size(); i++) - volk_32fc_x2_multiply_32fc_u(out, out, (gr_complex*)input_items[i], noi); - } - else { - for(size_t i = 1; i < input_items.size(); i++) - volk_32fc_x2_multiply_32fc_a(out, out, (gr_complex*)input_items[i], noi); - } - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.cc b/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.cc deleted file mode 100644 index 0c5fb4a926..0000000000 --- a/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.cc +++ /dev/null @@ -1,69 +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 <gr_multiply_conjugate_cc.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_multiply_conjugate_cc_sptr -gr_make_multiply_conjugate_cc (size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_multiply_conjugate_cc (vlen)); -} - -gr_multiply_conjugate_cc::gr_multiply_conjugate_cc (size_t vlen) - : gr_sync_block ("gr_multiply_conjugate_cc", - gr_make_io_signature (2, 2, sizeof (gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen)), - d_vlen(vlen) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(gr_complex); - set_alignment(std::max(1,alignment_multiple)); -} - -int -gr_multiply_conjugate_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in0 = (gr_complex *) input_items[0]; - gr_complex *in1 = (gr_complex *) input_items[1]; - gr_complex *out = (gr_complex *) output_items[0]; - int noi = d_vlen*noutput_items; - - if(is_unaligned()) { - volk_32fc_x2_multiply_conjugate_32fc_u(out, in0, in1, noi); - } - else { - volk_32fc_x2_multiply_conjugate_32fc_a(out, in0, in1, noi); - } - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_cc.cc b/gnuradio-core/src/lib/general/gr_multiply_const_cc.cc deleted file mode 100644 index bd4511937f..0000000000 --- a/gnuradio-core/src/lib/general/gr_multiply_const_cc.cc +++ /dev/null @@ -1,80 +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 <gr_multiply_const_cc.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_multiply_const_cc_sptr -gr_make_multiply_const_cc (gr_complex k, size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_multiply_const_cc (k, vlen)); -} - -gr_multiply_const_cc::gr_multiply_const_cc (gr_complex k, size_t vlen) - : gr_sync_block ("gr_multiply_const_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen)), - d_k(k), d_vlen(vlen) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(gr_complex); - set_alignment(std::max(1,alignment_multiple)); -} - -gr_complex -gr_multiply_const_cc::k() const -{ - return d_k; -} - -void -gr_multiply_const_cc::set_k(gr_complex k) -{ - d_k = k; -} - -int -gr_multiply_const_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]; - int noi = d_vlen*noutput_items; - - if(is_unaligned()) { - volk_32fc_s32fc_multiply_32fc_u(out, in, d_k, noi); - } - else { - volk_32fc_s32fc_multiply_32fc_a(out, in, d_k, noi); - } - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_cc.h b/gnuradio-core/src/lib/general/gr_multiply_const_cc.h deleted file mode 100644 index 97962abc70..0000000000 --- a/gnuradio-core/src/lib/general/gr_multiply_const_cc.h +++ /dev/null @@ -1,60 +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 INCLUDED_GR_MULTIPLY_CONST_CC_H -#define INCLUDED_GR_MULTIPLY_CONST_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_multiply_const_cc; -typedef boost::shared_ptr<gr_multiply_const_cc> gr_multiply_const_cc_sptr; - -GR_CORE_API gr_multiply_const_cc_sptr -gr_make_multiply_const_cc (gr_complex k, size_t vlen=1); - -/*! - * \brief Multiply stream of complex values with a constant \p k - * \ingroup math_blk - */ - -class GR_CORE_API gr_multiply_const_cc : public gr_sync_block -{ - private: - friend GR_CORE_API gr_multiply_const_cc_sptr - gr_make_multiply_const_cc (gr_complex k, size_t vlen); - gr_multiply_const_cc (gr_complex k, size_t vlen); - - gr_complex d_k; - size_t d_vlen; - - public: - gr_complex k() const; - void set_k(gr_complex k); - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_MULTIPLY_CONST_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_cc.i b/gnuradio-core/src/lib/general/gr_multiply_const_cc.i deleted file mode 100644 index c2f3cbed31..0000000000 --- a/gnuradio-core/src/lib/general/gr_multiply_const_cc.i +++ /dev/null @@ -1,33 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,multiply_const_cc) - -gr_multiply_const_cc_sptr -gr_make_multiply_const_cc (gr_complex k, size_t vlen=1); - -class gr_multiply_const_cc : public gr_sync_block -{ -public: - gr_complex k() const; - void set_k(gr_complex k); -}; diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_ff.cc b/gnuradio-core/src/lib/general/gr_multiply_const_ff.cc deleted file mode 100644 index 16ba39df93..0000000000 --- a/gnuradio-core/src/lib/general/gr_multiply_const_ff.cc +++ /dev/null @@ -1,80 +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 <gr_multiply_const_ff.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_multiply_const_ff_sptr -gr_make_multiply_const_ff (float k, size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_multiply_const_ff (k, vlen)); -} - -gr_multiply_const_ff::gr_multiply_const_ff (float k, size_t vlen) - : gr_sync_block ("gr_multiply_const_ff", - gr_make_io_signature (1, 1, sizeof (float)*vlen), - gr_make_io_signature (1, 1, sizeof (float)*vlen)), - d_k(k), d_vlen(vlen) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(float); - set_alignment(std::max(1,alignment_multiple)); -} - -float -gr_multiply_const_ff::k() const -{ - return d_k; -} - -void -gr_multiply_const_ff::set_k(float k) -{ - d_k = k; -} - -int -gr_multiply_const_ff::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]; - int noi = d_vlen*noutput_items; - - if(is_unaligned()) { - volk_32f_s32f_multiply_32f_u(out, in, d_k, noi); - } - else { - volk_32f_s32f_multiply_32f_a(out, in, d_k, noi); - } - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_ff.h b/gnuradio-core/src/lib/general/gr_multiply_const_ff.h deleted file mode 100644 index fac73f88a2..0000000000 --- a/gnuradio-core/src/lib/general/gr_multiply_const_ff.h +++ /dev/null @@ -1,60 +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 INCLUDED_GR_MULTIPLY_CONST_FF_H -#define INCLUDED_GR_MULTIPLY_CONST_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_multiply_const_ff; -typedef boost::shared_ptr<gr_multiply_const_ff> gr_multiply_const_ff_sptr; - -GR_CORE_API gr_multiply_const_ff_sptr -gr_make_multiply_const_ff (float k, size_t vlen=1); - -/*! - * \brief Multiply stream of float values with a constant \p k - * \ingroup math_blk - */ - -class GR_CORE_API gr_multiply_const_ff : public gr_sync_block -{ - private: - friend GR_CORE_API gr_multiply_const_ff_sptr - gr_make_multiply_const_ff (float k, size_t vlen); - gr_multiply_const_ff (float k, size_t vlen); - - float d_k; - size_t d_vlen; - - public: - float k() const; - void set_k(float k); - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_MULTIPLY_CONST_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_ff.i b/gnuradio-core/src/lib/general/gr_multiply_const_ff.i deleted file mode 100644 index 343f67cd25..0000000000 --- a/gnuradio-core/src/lib/general/gr_multiply_const_ff.i +++ /dev/null @@ -1,33 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,multiply_const_ff) - -gr_multiply_const_ff_sptr -gr_make_multiply_const_ff (float k, size_t vlen=1); - -class gr_multiply_const_ff : public gr_sync_block -{ -public: - float k() const; - void set_k(float k); -}; diff --git a/gnuradio-core/src/lib/general/gr_multiply_ff.cc b/gnuradio-core/src/lib/general/gr_multiply_ff.cc deleted file mode 100644 index bb7bd07550..0000000000 --- a/gnuradio-core/src/lib/general/gr_multiply_ff.cc +++ /dev/null @@ -1,69 +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 <gr_multiply_ff.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_multiply_ff_sptr -gr_make_multiply_ff (size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_multiply_ff (vlen)); -} - -gr_multiply_ff::gr_multiply_ff (size_t vlen) - : gr_sync_block ("gr_multiply_ff", - gr_make_io_signature (1, -1, sizeof (float)*vlen), - gr_make_io_signature (1, 1, sizeof (float)*vlen)), - d_vlen(vlen) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(float); - set_alignment(std::max(1,alignment_multiple)); -} - -int -gr_multiply_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *out = (float *) output_items[0]; - int noi = d_vlen*noutput_items; - - memcpy(out, input_items[0], noi*sizeof(float)); - if(is_unaligned()) { - for(size_t i = 1; i < input_items.size(); i++) - volk_32f_x2_multiply_32f_u(out, out, (const float*)input_items[i], noi); - } - else { - for(size_t i = 1; i < input_items.size(); i++) - volk_32f_x2_multiply_32f_a(out, out, (const float*)input_items[i], noi); - } - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_nlog10_ff.cc b/gnuradio-core/src/lib/general/gr_nlog10_ff.cc deleted file mode 100644 index 24cfe25fb5..0000000000 --- a/gnuradio-core/src/lib/general/gr_nlog10_ff.cc +++ /dev/null @@ -1,64 +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 <gr_nlog10_ff.h> -#include <gr_io_signature.h> -#include <algorithm> - -gr_nlog10_ff_sptr -gr_make_nlog10_ff (float n, unsigned vlen, float k) -{ - return gnuradio::get_initial_sptr(new gr_nlog10_ff(n, vlen, k)); -} - -gr_nlog10_ff::gr_nlog10_ff(float n, unsigned vlen, float k) - : gr_sync_block("nlog10_ff", - gr_make_io_signature(1, 1, sizeof(float) * vlen), - gr_make_io_signature(1, 1, sizeof(float) * vlen)), - d_vlen(vlen), d_n(n), d_k(k) -{ -} - -gr_nlog10_ff::~gr_nlog10_ff() -{ -} - -int -gr_nlog10_ff::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]; - int noi = noutput_items * d_vlen; - float n = d_n; - float k = d_k; - - for (int i = 0; i < noi; i++) - out[i] = n * log10(std::max(in[i], (float) 1e-18)) + k; - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_nlog10_ff.h b/gnuradio-core/src/lib/general/gr_nlog10_ff.h deleted file mode 100644 index cfeba3feeb..0000000000 --- a/gnuradio-core/src/lib/general/gr_nlog10_ff.h +++ /dev/null @@ -1,56 +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_GR_NLOG10_FF_H -#define INCLUDED_GR_NLOG10_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_nlog10_ff; -typedef boost::shared_ptr<gr_nlog10_ff> gr_nlog10_ff_sptr; - -GR_CORE_API gr_nlog10_ff_sptr gr_make_nlog10_ff (float n=1.0, unsigned vlen=1, float k=0); - -/*! - * \brief output = n*log10(input) + k - * \ingroup math_blk - */ -class GR_CORE_API gr_nlog10_ff : public gr_sync_block -{ - friend GR_CORE_API gr_nlog10_ff_sptr gr_make_nlog10_ff (float n, unsigned vlen, float k); - - unsigned int d_vlen; - float d_n; - float d_k; - - gr_nlog10_ff (float n, unsigned vlen, float k); - -public: - ~gr_nlog10_ff(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_NLOG10_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_nlog10_ff.i b/gnuradio-core/src/lib/general/gr_nlog10_ff.i deleted file mode 100644 index 73da597938..0000000000 --- a/gnuradio-core/src/lib/general/gr_nlog10_ff.i +++ /dev/null @@ -1,33 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,nlog10_ff); - -gr_nlog10_ff_sptr gr_make_nlog10_ff (float n=1.0, unsigned vlen=1, float k=0); - -class gr_nlog10_ff : public gr_sync_block -{ - gr_nlog10_ff (float n, unsigned vlen, float k); - -public: - ~gr_nlog10_ff(); -}; diff --git a/gnuradio-core/src/lib/general/gr_nop.cc b/gnuradio-core/src/lib/general/gr_nop.cc index edfe1d76d9..164f3ba8dd 100644 --- a/gnuradio-core/src/lib/general/gr_nop.cc +++ b/gnuradio-core/src/lib/general/gr_nop.cc @@ -27,6 +27,10 @@ #include <gr_io_signature.h> #include <boost/bind.hpp> +#ifdef GR_CTRLPORT +#include <rpcregisterhelpers.h> +#endif + gr_nop_sptr gr_make_nop (size_t sizeof_stream_item) { @@ -37,7 +41,7 @@ gr_nop::gr_nop (size_t sizeof_stream_item) : gr_block ("nop", gr_make_io_signature (0, -1, sizeof_stream_item), gr_make_io_signature (0, -1, sizeof_stream_item)), - d_nmsgs_recvd(0) + d_nmsgs_recvd(0), d_ctrlport_test(0) { // Arrange to have count_received_msgs called when messages are received. message_port_register_in(pmt::mp("port")); @@ -64,3 +68,25 @@ gr_nop::general_work (int noutput_items, return noutput_items; } + +void +gr_nop::setup_rpc() +{ +#ifdef GR_CTRLPORT + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<gr_nop, int>( + alias(), "test", + &gr_nop::ctrlport_test, + pmt::mp(-256), pmt::mp(255), pmt::mp(0), + "", "Simple testing variable", + RPC_PRIVLVL_MIN, DISPNULL))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_set<gr_nop, int>( + alias(), "test", + &gr_nop::set_ctrlport_test, + pmt::mp(-256), pmt::mp(255), pmt::mp(0), + "", "Simple testing variable", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ +} diff --git a/gnuradio-core/src/lib/general/gr_nop.h b/gnuradio-core/src/lib/general/gr_nop.h index e0d59280f9..5f1cb13a02 100644 --- a/gnuradio-core/src/lib/general/gr_nop.h +++ b/gnuradio-core/src/lib/general/gr_nop.h @@ -42,8 +42,12 @@ class GR_CORE_API gr_nop : public gr_block friend GR_CORE_API gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); gr_nop (size_t sizeof_stream_item); + std::vector<boost::any> d_rpc_vars; + void setup_rpc(); + protected: int d_nmsgs_recvd; + int d_ctrlport_test; // Method that just counts any received messages. void count_received_msgs(pmt::pmt_t msg); @@ -56,6 +60,8 @@ protected: int nmsgs_received() const { return d_nmsgs_recvd; } + int ctrlport_test() { return d_ctrlport_test; } + void set_ctrlport_test(int x) { d_ctrlport_test = x; } }; #endif /* INCLUDED_GR_NOP_H */ diff --git a/gnuradio-core/src/lib/general/gr_nop.i b/gnuradio-core/src/lib/general/gr_nop.i index 977a15d186..73ffa93630 100644 --- a/gnuradio-core/src/lib/general/gr_nop.i +++ b/gnuradio-core/src/lib/general/gr_nop.i @@ -25,6 +25,9 @@ GR_SWIG_BLOCK_MAGIC(gr,nop) gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); class gr_nop : public gr_block { +public: + int ctrlport_test(); + void set_ctrlport_test(int x); private: gr_nop (size_t sizeof_stream_item); }; diff --git a/gnuradio-core/src/lib/general/gr_packet_sink.cc b/gnuradio-core/src/lib/general/gr_packet_sink.cc deleted file mode 100644 index 19a8c5fc20..0000000000 --- a/gnuradio-core/src/lib/general/gr_packet_sink.cc +++ /dev/null @@ -1,207 +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 <gr_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 -gr_packet_sink::enter_search() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_search\n"); - - d_state = STATE_SYNC_SEARCH; - d_shift_reg = 0; -} - -inline void -gr_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 -gr_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; -} - -gr_packet_sink_sptr -gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, int threshold) -{ - return gnuradio::get_initial_sptr(new gr_packet_sink (sync_vector, target_queue, threshold)); -} - - -gr_packet_sink::gr_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(); -} - -gr_packet_sink::~gr_packet_sink () -{ -} - -int -gr_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/gnuradio-core/src/lib/general/gr_packet_sink.h b/gnuradio-core/src/lib/general/gr_packet_sink.h deleted file mode 100644 index b4cb0b0f6e..0000000000 --- a/gnuradio-core/src/lib/general/gr_packet_sink.h +++ /dev/null @@ -1,112 +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_GR_PACKET_SINK_H -#define INCLUDED_GR_PACKET_SINK_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> - -class gr_packet_sink; -typedef boost::shared_ptr<gr_packet_sink> gr_packet_sink_sptr; - -GR_CORE_API gr_packet_sink_sptr -gr_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 - */ -class GR_CORE_API gr_packet_sink : public gr_sync_block -{ - friend GR_CORE_API gr_packet_sink_sptr - gr_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: - gr_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: - ~gr_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/gnuradio-core/src/lib/general/gr_packet_sink.i b/gnuradio-core/src/lib/general/gr_packet_sink.i deleted file mode 100644 index d1290f9d39..0000000000 --- a/gnuradio-core/src/lib/general/gr_packet_sink.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(gr,packet_sink) - -gr_packet_sink_sptr -gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, - int threshold = -1 // -1 -> use default - ); - -class gr_packet_sink : public gr_sync_block -{ - protected: - gr_packet_sink (const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, - int threshold); - public: - ~gr_packet_sink (); - - bool carrier_sensed() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.cc b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.cc deleted file mode 100644 index fb05c85a52..0000000000 --- a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.cc +++ /dev/null @@ -1,62 +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_phase_modulator_fc.h> -#include <gr_io_signature.h> -#include <gr_sincos.h> -#include <math.h> - - -gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity) -{ - return gnuradio::get_initial_sptr(new gr_phase_modulator_fc (sensitivity)); -} - -gr_phase_modulator_fc::gr_phase_modulator_fc (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) -{ -} - -int -gr_phase_modulator_fc::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; -} diff --git a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h deleted file mode 100644 index 07f3b82d4c..0000000000 --- a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_GR_PHASE_MODULATOR_FC_H -#define INCLUDED_GR_PHASE_MODULATOR_FC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_phase_modulator_fc; -typedef boost::shared_ptr<gr_phase_modulator_fc> gr_phase_modulator_fc_sptr; - -GR_CORE_API gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity); - -/*! - * \brief Phase modulator block - * \ingroup modulation_blk - * output=complex(cos(in*sensitivity),sin(in*sensitivity)) - */ -class GR_CORE_API gr_phase_modulator_fc : public gr_sync_block -{ - double d_sensitivity; - double d_phase; - - friend GR_CORE_API gr_phase_modulator_fc_sptr - gr_make_phase_modulator_fc (double sensitivity); - - gr_phase_modulator_fc (double sensitivity); - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_PHASE_MODULATOR_FC_H */ diff --git a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.i b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.i deleted file mode 100644 index c1816c647e..0000000000 --- a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,phase_modulator_fc) - -gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity); - -class gr_phase_modulator_fc : public gr_sync_block -{ - private: - gr_phase_modulator_fc (double sensitivity); -}; diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc deleted file mode 100644 index b7b1291a3d..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc +++ /dev/null @@ -1,120 +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 <gr_pll_carriertracking_cc.h> -#include <gr_io_signature.h> -#include <gr_sincos.h> -#include <math.h> -#include <gr_math.h> - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - -gr_pll_carriertracking_cc_sptr -gr_make_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq) -{ - return gnuradio::get_initial_sptr(new gr_pll_carriertracking_cc (loop_bw, max_freq, min_freq)); -} - -gr_pll_carriertracking_cc::gr_pll_carriertracking_cc (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) -{ -} - -float -gr_pll_carriertracking_cc::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 -gr_pll_carriertracking_cc::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 -gr_pll_carriertracking_cc::lock_detector(void) -{ - return (fabsf(d_locksig) > d_lock_threshold); -} - -bool -gr_pll_carriertracking_cc::squelch_enable(bool set_squelch) -{ - return d_squelch_enable = set_squelch; -} - -float -gr_pll_carriertracking_cc::set_lock_threshold(float threshold) -{ - return d_lock_threshold = threshold; -} - -int -gr_pll_carriertracking_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 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; -} diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h deleted file mode 100644 index b3bc5ddd0c..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h +++ /dev/null @@ -1,74 +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_GR_PLL_CARRIERTRACKING_CC_H -#define INCLUDED_GR_PLL_CARRIERTRACKING_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_control_loop.h> - -class gr_pll_carriertracking_cc; -typedef boost::shared_ptr<gr_pll_carriertracking_cc> gr_pll_carriertracking_cc_sptr; - -GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, - float max_freq, - float min_freq); -/*! - * \brief Implements a PLL which locks to the input frequency and outputs the - * input signal mixed with that carrier. - * \ingroup sync_blk - * - * input: stream of complex; output: stream of 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 gr_pll_freqdet_cf, gr_pll_carriertracking_cc - */ - -class GR_CORE_API gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop -{ - friend GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, - float max_freq, - float min_freq); - - float d_locksig,d_lock_threshold; - bool d_squelch_enable; - gr_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -private: - float mod_2pi (float in); - float phase_detector(gr_complex sample,float ref_phase); -public: - bool lock_detector(void); - bool squelch_enable(bool); - float set_lock_threshold(float); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i deleted file mode 100644 index a20adf7e20..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i +++ /dev/null @@ -1,39 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pll_carriertracking_cc); - -gr_pll_carriertracking_cc_sptr -gr_make_pll_carriertracking_cc (float loop_bw, - float max_freq, - float min_freq); - -class gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop -{ - private: - gr_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq); - public: - bool lock_detector(void); - bool squelch_enable(bool); - float set_lock_threshold(float); - -}; diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc deleted file mode 100644 index f80f4ed07a..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_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 <gr_pll_freqdet_cf.h> -#include <gr_io_signature.h> -#include <math.h> -#include <gr_math.h> - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - -gr_pll_freqdet_cf_sptr -gr_make_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq) -{ - return gnuradio::get_initial_sptr(new gr_pll_freqdet_cf (loop_bw, max_freq, min_freq)); -} - -gr_pll_freqdet_cf::gr_pll_freqdet_cf (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) -{ -} - -float -gr_pll_freqdet_cf::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 -gr_pll_freqdet_cf::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 -gr_pll_freqdet_cf::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; -} diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h deleted file mode 100644 index 3dfc8d7093..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h +++ /dev/null @@ -1,67 +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_GR_PLL_FREQDET_CF_H -#define INCLUDED_GR_PLL_FREQDET_CF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_control_loop.h> - -class gr_pll_freqdet_cf; -typedef boost::shared_ptr<gr_pll_freqdet_cf> gr_pll_freqdet_cf_sptr; - -GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, - float max_freq, - float min_freq); -/*! - * \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 of complex; output: stream of floats - * - * 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 gr_pll_refout_cc, gr_pll_carriertracking_cc - */ - -class GR_CORE_API gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop -{ - friend GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, - float max_freq, - float min_freq); - - float mod_2pi (float in); - gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -private: - float phase_detector(gr_complex sample,float ref_phase); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i deleted file mode 100644 index 87e515adb8..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i +++ /dev/null @@ -1,33 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pll_freqdet_cf) - - gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, - float max_freq, - float min_freq); - -class gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop -{ - private: - gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq); -}; diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc deleted file mode 100644 index 9f95c3f64e..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc +++ /dev/null @@ -1,93 +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_pll_refout_cc.h> -#include <gr_io_signature.h> -#include <gr_sincos.h> -#include <math.h> -#include <gr_math.h> - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - -gr_pll_refout_cc_sptr -gr_make_pll_refout_cc (float loop_bw, float max_freq, float min_freq) -{ - return gnuradio::get_initial_sptr(new gr_pll_refout_cc (loop_bw, max_freq, min_freq)); -} - -gr_pll_refout_cc::gr_pll_refout_cc (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) -{ -} - -float -gr_pll_refout_cc::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 -gr_pll_refout_cc::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 -gr_pll_refout_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 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; -} diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h b/gnuradio-core/src/lib/general/gr_pll_refout_cc.h deleted file mode 100644 index ef5cd31e27..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h +++ /dev/null @@ -1,65 +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_GR_PLL_REFOUT_CC_H -#define INCLUDED_GR_PLL_REFOUT_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_control_loop.h> - -class gr_pll_refout_cc; -typedef boost::shared_ptr<gr_pll_refout_cc> gr_pll_refout_cc_sptr; - -GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, - float max_freq, float min_freq); -/*! - * \brief Implements a PLL which locks to the input frequency and outputs a carrier - * \ingroup sync_blk - * - * input: stream of complex; output: stream of 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 gr_pll_freqdet_cf, gr_pll_carriertracking_cc - */ -class GR_CORE_API gr_pll_refout_cc : public gr_sync_block, public gri_control_loop -{ - friend GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, - float max_freq, float min_freq); - - gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -private: - float mod_2pi (float in); - float phase_detector(gr_complex sample, float ref_phase); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.i b/gnuradio-core/src/lib/general/gr_pll_refout_cc.i deleted file mode 100644 index 630c0444fa..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.i +++ /dev/null @@ -1,32 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pll_refout_cc) - -gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, - float max_freq, float min_freq); - -class gr_pll_refout_cc : public gr_sync_block, public gri_control_loop -{ - private: - gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq); -}; diff --git a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc deleted file mode 100644 index 818e48c34b..0000000000 --- a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 <gr_pn_correlator_cc.h> -#include <gr_io_signature.h> - -gr_pn_correlator_cc_sptr -gr_make_pn_correlator_cc(int degree, int mask, int seed) -{ - return gnuradio::get_initial_sptr(new gr_pn_correlator_cc(degree, mask, seed)); -} - -gr_pn_correlator_cc::gr_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; -} - -gr_pn_correlator_cc::~gr_pn_correlator_cc() -{ - delete d_reference; -} - -int -gr_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/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h deleted file mode 100644 index 69bd2c502f..0000000000 --- a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h +++ /dev/null @@ -1,62 +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_GR_PN_CORRELATOR_CC_H -#define INCLUDED_GR_PN_CORRELATOR_CC_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> -#include <gri_glfsr.h> - -class gr_pn_correlator_cc; -typedef boost::shared_ptr<gr_pn_correlator_cc> gr_pn_correlator_cc_sptr; - -GR_CORE_API gr_pn_correlator_cc_sptr -gr_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 - */ - -class GR_CORE_API gr_pn_correlator_cc : public gr_sync_decimator -{ - friend GR_CORE_API gr_pn_correlator_cc_sptr gr_make_pn_correlator_cc(int degree, int mask, int seed); - - int d_len; - float d_pn; - gri_glfsr *d_reference; - - protected: - gr_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); - - ~gr_pn_correlator_cc(); -}; - -#endif /* INCLUDED_GR_PN_CORRELATOR_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i deleted file mode 100644 index e992f33a7f..0000000000 --- a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i +++ /dev/null @@ -1,32 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pn_correlator_cc) - -gr_pn_correlator_cc_sptr -gr_make_pn_correlator_cc(int degree, int mask=0, int seed=1); - -class gr_pn_correlator_cc : public gr_sync_decimator -{ - protected: - gr_pn_correlator_cc(); -}; diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.cc b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.cc deleted file mode 100644 index 6430d2753d..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.cc +++ /dev/null @@ -1,84 +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 <gr_probe_avg_mag_sqrd_c.h> -#include <gr_io_signature.h> -#include <cmath> - -gr_probe_avg_mag_sqrd_c_sptr -gr_make_probe_avg_mag_sqrd_c(double threshold_db, double alpha) -{ - return gnuradio::get_initial_sptr(new gr_probe_avg_mag_sqrd_c(threshold_db, alpha)); -} - -gr_probe_avg_mag_sqrd_c::gr_probe_avg_mag_sqrd_c (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_iir(alpha), d_unmuted(false), d_level(0) -{ - set_threshold (threshold_db); -} - -gr_probe_avg_mag_sqrd_c::~gr_probe_avg_mag_sqrd_c() -{ -} - - -int -gr_probe_avg_mag_sqrd_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]; - - 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 -gr_probe_avg_mag_sqrd_c::threshold() const -{ - return 10 * std::log10(d_threshold); -} - -void -gr_probe_avg_mag_sqrd_c::set_threshold(double decibels) -{ - // convert to absolute threshold (mag squared) - d_threshold = std::pow(10.0, decibels/10); -} - -void -gr_probe_avg_mag_sqrd_c::set_alpha(double alpha) -{ - d_iir.set_taps(alpha); -} diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h deleted file mode 100644 index 2811677cfc..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ -#ifndef INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H -#define INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> - -class gr_probe_avg_mag_sqrd_c; -typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_c> gr_probe_avg_mag_sqrd_c_sptr; - -GR_CORE_API gr_probe_avg_mag_sqrd_c_sptr -gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha = 0.0001); - -/*! - * \brief compute avg magnitude squared. - * \ingroup sink_blk - * - * input: gr_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 GR_CORE_API gr_probe_avg_mag_sqrd_c : public gr_sync_block -{ - double d_threshold; - gr_single_pole_iir<double,double,double> d_iir; - bool d_unmuted; - double d_level; - - friend GR_CORE_API gr_probe_avg_mag_sqrd_c_sptr - gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha); - - gr_probe_avg_mag_sqrd_c (double threshold_db, double alpha); - -public: - ~gr_probe_avg_mag_sqrd_c (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // ACCESSORS - bool unmuted () const { return d_unmuted; } - double level () const { return d_level; } - - double threshold() const; - - // SETTERS - void set_alpha (double alpha); - void set_threshold (double decibels); -}; - -#endif /* INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H */ diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.i b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.i deleted file mode 100644 index bce244c127..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.i +++ /dev/null @@ -1,36 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,probe_avg_mag_sqrd_c); - -gr_probe_avg_mag_sqrd_c_sptr -gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha = 0.0001); - -class gr_probe_avg_mag_sqrd_c : public gr_sync_block -{ -public: - bool unmuted () const { return d_unmuted; } - double level () const { return d_level; } - void set_alpha (double alpha); - void set_threshold (double decibels); - double threshold(); -}; diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.cc b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.cc deleted file mode 100644 index b5946283b8..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 <gr_probe_avg_mag_sqrd_cf.h> -#include <gr_io_signature.h> -#include <cmath> - -gr_probe_avg_mag_sqrd_cf_sptr -gr_make_probe_avg_mag_sqrd_cf(double threshold_db, double alpha) -{ - return gnuradio::get_initial_sptr(new gr_probe_avg_mag_sqrd_cf(threshold_db, alpha)); -} - -gr_probe_avg_mag_sqrd_cf::gr_probe_avg_mag_sqrd_cf (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_iir(alpha), d_unmuted(false), d_level(0) -{ - set_threshold (threshold_db); -} - -gr_probe_avg_mag_sqrd_cf::~gr_probe_avg_mag_sqrd_cf() -{ -} - - -int -gr_probe_avg_mag_sqrd_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++){ - 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 -gr_probe_avg_mag_sqrd_cf::threshold() const -{ - return 10 * std::log10(d_threshold); -} - -void -gr_probe_avg_mag_sqrd_cf::set_threshold(double decibels) -{ - // convert to absolute threshold (mag squared) - d_threshold = std::pow(10.0, decibels/10); -} - -void -gr_probe_avg_mag_sqrd_cf::set_alpha(double alpha) -{ - d_iir.set_taps(alpha); -} diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h deleted file mode 100644 index bb5d1ebf91..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ -#ifndef INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H -#define INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> - -class gr_probe_avg_mag_sqrd_cf; -typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_cf> gr_probe_avg_mag_sqrd_cf_sptr; - -GR_CORE_API gr_probe_avg_mag_sqrd_cf_sptr -gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha = 0.0001); - -/*! - * \brief compute avg magnitude squared. - * \ingroup sink_blk - * - * input: gr_complex - * output: gr_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 GR_CORE_API gr_probe_avg_mag_sqrd_cf : public gr_sync_block -{ - double d_threshold; - gr_single_pole_iir<double,double,double> d_iir; - bool d_unmuted; - double d_level; - - friend GR_CORE_API gr_probe_avg_mag_sqrd_cf_sptr - gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha); - - gr_probe_avg_mag_sqrd_cf (double threshold_db, double alpha); - -public: - ~gr_probe_avg_mag_sqrd_cf (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // ACCESSORS - bool unmuted () const { return d_unmuted; } - double level () const { return d_level; } - - double threshold() const; - - // SETTERS - void set_alpha (double alpha); - void set_threshold (double decibels); -}; - -#endif /* INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H */ diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.i b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.i deleted file mode 100644 index bf76d973b7..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.i +++ /dev/null @@ -1,36 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,probe_avg_mag_sqrd_cf); - -gr_probe_avg_mag_sqrd_cf_sptr -gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha = 0.0001); - -class gr_probe_avg_mag_sqrd_cf : public gr_sync_block -{ -public: - bool unmuted () const { return d_unmuted; } - double level () const { return d_level; } - void set_alpha (double alpha); - void set_threshold (double decibels); - double threshold(); -}; diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.cc b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.cc deleted file mode 100644 index 4ed40743fc..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.cc +++ /dev/null @@ -1,84 +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 <gr_probe_avg_mag_sqrd_f.h> -#include <gr_io_signature.h> -#include <cmath> - -gr_probe_avg_mag_sqrd_f_sptr -gr_make_probe_avg_mag_sqrd_f(double threshold_db, double alpha) -{ - return gnuradio::get_initial_sptr(new gr_probe_avg_mag_sqrd_f(threshold_db, alpha)); -} - -gr_probe_avg_mag_sqrd_f::gr_probe_avg_mag_sqrd_f (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_iir(alpha), d_unmuted(false), d_level(0) -{ - set_threshold (threshold_db); -} - -gr_probe_avg_mag_sqrd_f::~gr_probe_avg_mag_sqrd_f() -{ -} - - -int -gr_probe_avg_mag_sqrd_f::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 -gr_probe_avg_mag_sqrd_f::threshold() const -{ - return 10 * std::log10(d_threshold); -} - -void -gr_probe_avg_mag_sqrd_f::set_threshold(double decibels) -{ - // convert to absolute threshold (mag sqrd) - d_threshold = std::pow(10.0, decibels/10); -} - -void -gr_probe_avg_mag_sqrd_f::set_alpha(double alpha) -{ - d_iir.set_taps(alpha); -} diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h deleted file mode 100644 index b2efcc64eb..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h +++ /dev/null @@ -1,75 +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_GR_PROBE_AVG_MAG_SQRD_F_H -#define INCLUDED_GR_PROBE_AVG_MAG_SQRD_F_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> - -class gr_probe_avg_mag_sqrd_f; -typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_f> gr_probe_avg_mag_sqrd_f_sptr; - -GR_CORE_API gr_probe_avg_mag_sqrd_f_sptr -gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha = 0.0001); - -/*! - * \brief compute avg magnitude squared. - * \ingroup sink_blk - * - * input: 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 GR_CORE_API gr_probe_avg_mag_sqrd_f : public gr_sync_block -{ - double d_threshold; - gr_single_pole_iir<double,double,double> d_iir; - bool d_unmuted; - double d_level; - - friend GR_CORE_API gr_probe_avg_mag_sqrd_f_sptr - gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha); - - gr_probe_avg_mag_sqrd_f (double threshold_db, double alpha); - -public: - ~gr_probe_avg_mag_sqrd_f (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // ACCESSORS - bool unmuted () const { return d_unmuted; } - double level () const { return d_level; } - - double threshold() const; - - // SETTERS - void set_alpha (double alpha); - void set_threshold (double decibels); -}; - -#endif /* INCLUDED_GR_PROBE_AVG_MAG_SQRD_F_H */ diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.i b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.i deleted file mode 100644 index 1c63ae8e9d..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.i +++ /dev/null @@ -1,36 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,probe_avg_mag_sqrd_f); - -gr_probe_avg_mag_sqrd_f_sptr -gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha = 0.0001); - -class gr_probe_avg_mag_sqrd_f : public gr_sync_block -{ -public: - 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); -}; diff --git a/gnuradio-core/src/lib/general/gr_probe_density_b.cc b/gnuradio-core/src/lib/general/gr_probe_density_b.cc deleted file mode 100644 index 31661780af..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_density_b.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 <gr_probe_density_b.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -gr_probe_density_b_sptr -gr_make_probe_density_b(double alpha) -{ - return gnuradio::get_initial_sptr(new gr_probe_density_b(alpha)); -} - -gr_probe_density_b::gr_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; -} - -gr_probe_density_b::~gr_probe_density_b() -{ -} - -int -gr_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 -gr_probe_density_b::set_alpha(double alpha) -{ - d_alpha = alpha; - d_beta = 1.0-d_alpha; -} - diff --git a/gnuradio-core/src/lib/general/gr_probe_density_b.h b/gnuradio-core/src/lib/general/gr_probe_density_b.h deleted file mode 100644 index ab84a63a96..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_density_b.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_probe_density_b; - -typedef boost::shared_ptr<gr_probe_density_b> gr_probe_density_b_sptr; - -GR_CORE_API gr_probe_density_b_sptr gr_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 GR_CORE_API gr_probe_density_b : public gr_sync_block -{ -private: - friend GR_CORE_API gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); - - double d_alpha; - double d_beta; - double d_density; - - gr_probe_density_b(double alpha); - -public: - ~gr_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/gnuradio-core/src/lib/general/gr_probe_density_b.i b/gnuradio-core/src/lib/general/gr_probe_density_b.i deleted file mode 100644 index ca65708af6..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_density_b.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,probe_density_b); - -gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); - -class gr_probe_density_b : public gr_sync_block -{ -public: - double density() const; - - void set_alpha(double alpha); - -private: - gr_probe_density_b(); -}; diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc deleted file mode 100644 index 90eab13eba..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 <gr_pwr_squelch_cc.h> - -gr_pwr_squelch_cc_sptr -gr_make_pwr_squelch_cc(double threshold, double alpha, int ramp, bool gate) -{ - return gnuradio::get_initial_sptr(new gr_pwr_squelch_cc(threshold, alpha, ramp, gate)); -} - -gr_pwr_squelch_cc::gr_pwr_squelch_cc(double threshold, double alpha, int ramp, bool gate) : - gr_squelch_base_cc("pwr_squelch_cc", ramp, gate), - d_iir(alpha) -{ - set_threshold(threshold); -} - -std::vector<float> gr_pwr_squelch_cc::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 gr_pwr_squelch_cc::update_state(const gr_complex &in) -{ - d_pwr = d_iir.filter(in.real()*in.real()+in.imag()*in.imag()); -} diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h deleted file mode 100644 index b2b4624f58..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.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_GR_PWR_SQUELCH_CC_H -#define INCLUDED_GR_PWR_SQUELCH_CC_H - -#include <gr_core_api.h> -#include <cmath> -#include <gr_squelch_base_cc.h> -#include <gr_single_pole_iir.h> - -class gr_pwr_squelch_cc; -typedef boost::shared_ptr<gr_pwr_squelch_cc> gr_pwr_squelch_cc_sptr; - -GR_CORE_API gr_pwr_squelch_cc_sptr -gr_make_pwr_squelch_cc(double db, double alpha = 0.0001, int ramp=0, bool gate=false); - -/*! - * \brief gate or zero output when input power below threshold - * \ingroup level_blk - */ -class GR_CORE_API gr_pwr_squelch_cc : public gr_squelch_base_cc -{ -private: - double d_threshold; - double d_pwr; - gr_single_pole_iir<double,double,double> d_iir; - - friend GR_CORE_API gr_pwr_squelch_cc_sptr gr_make_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); - gr_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); - -protected: - virtual void update_state(const gr_complex &in); - virtual bool mute() const { return d_pwr < d_threshold; } - -public: - 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); } -}; - -#endif /* INCLUDED_GR_PWR_SQUELCH_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i deleted file mode 100644 index c8cafd7aac..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i +++ /dev/null @@ -1,42 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pwr_squelch_cc); - -// retrieve info on the base class, without generating wrappers since -// the base class has a pure virual method. -%import "gr_squelch_base_cc.i" - -gr_pwr_squelch_cc_sptr -gr_make_pwr_squelch_cc(double db, double alpha=0.0001, int ramp=0, bool gate=false); - -class gr_pwr_squelch_cc : public gr_squelch_base_cc -{ -private: - gr_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); - -public: - 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); } - std::vector<float> squelch_range() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc deleted file mode 100644 index cfa867243d..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 <gr_pwr_squelch_ff.h> - -gr_pwr_squelch_ff_sptr -gr_make_pwr_squelch_ff(double threshold, double alpha, int ramp, bool gate) -{ - return gnuradio::get_initial_sptr(new gr_pwr_squelch_ff(threshold, alpha, ramp, gate)); -} - -gr_pwr_squelch_ff::gr_pwr_squelch_ff(double threshold, double alpha, int ramp, bool gate) : - gr_squelch_base_ff("pwr_squelch_ff", ramp, gate), - d_iir(alpha) -{ - set_threshold(threshold); -} - -std::vector<float> gr_pwr_squelch_ff::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 gr_pwr_squelch_ff::update_state(const float &in) -{ - d_pwr = d_iir.filter(in*in); -} diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h deleted file mode 100644 index d5148c4096..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.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_GR_PWR_SQUELCH_FF_H -#define INCLUDED_GR_PWR_SQUELCH_FF_H - -#include <gr_core_api.h> -#include <cmath> -#include <gr_squelch_base_ff.h> -#include <gr_single_pole_iir.h> - -class gr_pwr_squelch_ff; -typedef boost::shared_ptr<gr_pwr_squelch_ff> gr_pwr_squelch_ff_sptr; - -GR_CORE_API gr_pwr_squelch_ff_sptr -gr_make_pwr_squelch_ff(double db, double alpha = 0.0001, int ramp=0, bool gate=false); - -/*! - * \brief gate or zero output when input power below threshold - * \ingroup level_blk - */ -class GR_CORE_API gr_pwr_squelch_ff : public gr_squelch_base_ff -{ -private: - double d_threshold; - double d_pwr; - gr_single_pole_iir<double,double,double> d_iir; - - friend GR_CORE_API gr_pwr_squelch_ff_sptr gr_make_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); - gr_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); - -protected: - virtual void update_state(const float &in); - virtual bool mute() const { return d_pwr < d_threshold; } - -public: - 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); } -}; - -#endif /* INCLUDED_GR_PWR_SQUELCH_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i deleted file mode 100644 index 2682f27586..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i +++ /dev/null @@ -1,42 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pwr_squelch_ff); - -// retrieve info on the base class, without generating wrappers since -// the base class has a pure virual method. -%import "gr_squelch_base_ff.i" - -gr_pwr_squelch_ff_sptr -gr_make_pwr_squelch_ff(double db, double alpha=0.0001, int ramp=0, bool gate=false); - -class gr_pwr_squelch_ff : public gr_squelch_base_ff -{ -private: - gr_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); - -public: - 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); } - std::vector<float> squelch_range() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.cc b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.cc deleted file mode 100644 index fa09582762..0000000000 --- a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 <gr_quadrature_demod_cf.h> -#include <gr_io_signature.h> -#include <gr_math.h> - -gr_quadrature_demod_cf::gr_quadrature_demod_cf (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 -} - -gr_quadrature_demod_cf_sptr -gr_make_quadrature_demod_cf (float gain) -{ - return gnuradio::get_initial_sptr(new gr_quadrature_demod_cf (gain)); -} - -int -gr_quadrature_demod_cf::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 * arg (product); - out[i] = d_gain * gr_fast_atan2f(imag(product), real(product)); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h deleted file mode 100644 index 9f5976c971..0000000000 --- a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h +++ /dev/null @@ -1,56 +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_GR_QUADRATURE_DEMOD_CF_H -#define INCLUDED_GR_QUADRATURE_DEMOD_CF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_quadrature_demod_cf; -typedef boost::shared_ptr<gr_quadrature_demod_cf> gr_quadrature_demod_cf_sptr; -GR_CORE_API gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); - -/*! - * \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 GR_CORE_API gr_quadrature_demod_cf : public gr_sync_block -{ - friend GR_CORE_API gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); - gr_quadrature_demod_cf (float gain); - - float d_gain; - - public: - 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); -}; - -#endif /* INCLUDED_GR_QUADRATURE_DEMOD_CF_H */ diff --git a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.i b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.i deleted file mode 100644 index 4c9168e647..0000000000 --- a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.i +++ /dev/null @@ -1,34 +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 (gr, quadrature_demod_cf) - -gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); - -class gr_quadrature_demod_cf : public gr_sync_block -{ - gr_quadrature_demod_cf (float gain); - -public: - void set_gain(float gain) { d_gain = gain; } - float gain() const { return d_gain; } -}; diff --git a/gnuradio-core/src/lib/general/gr_rail_ff.cc b/gnuradio-core/src/lib/general/gr_rail_ff.cc deleted file mode 100644 index cd33c10d39..0000000000 --- a/gnuradio-core/src/lib/general/gr_rail_ff.cc +++ /dev/null @@ -1,62 +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 <gr_rail_ff.h> -#include <gr_io_signature.h> - -gr_rail_ff_sptr -gr_make_rail_ff(float lo, float hi) -{ - return gnuradio::get_initial_sptr(new gr_rail_ff(lo, hi)); -} - -gr_rail_ff::gr_rail_ff(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) -{ -} - -int -gr_rail_ff::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++) { - if (in[i] < d_lo) - out[i] = d_lo; - else if (in[i] > d_hi) - out[i] = d_hi; - else - out[i] = in[i]; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_rail_ff.h b/gnuradio-core/src/lib/general/gr_rail_ff.h deleted file mode 100644 index 29db5b1fa1..0000000000 --- a/gnuradio-core/src/lib/general/gr_rail_ff.h +++ /dev/null @@ -1,57 +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_GR_RAIL_FF_H_ -# define INCLUDED_GR_RAIL_FF_H_ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -/*! - * \brief clips input values to min, max - * \ingroup misc - */ - -class gr_rail_ff; -typedef boost::shared_ptr<gr_rail_ff> gr_rail_ff_sptr; - -GR_CORE_API gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi); - -class GR_CORE_API gr_rail_ff : public gr_sync_block -{ - friend GR_CORE_API gr_rail_ff_sptr gr_make_rail_ff (float lo, float hi); - - float d_lo, d_hi; // the constant - gr_rail_ff(float lo, float hi); - - public: - float lo() const { return d_lo; } - void set_lo(float lo) { d_lo = lo; } - float hi() const { return d_hi; } - void set_hi(float hi) { d_hi = hi; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_rail_ff.i b/gnuradio-core/src/lib/general/gr_rail_ff.i deleted file mode 100644 index bdc453516e..0000000000 --- a/gnuradio-core/src/lib/general/gr_rail_ff.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,rail_ff); - -gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi); - -class gr_rail_ff : public gr_sync_block -{ -private: - gr_rail_ff(float lo, float hi); -}; diff --git a/gnuradio-core/src/lib/general/gr_random_pdu.cc b/gnuradio-core/src/lib/general/gr_random_pdu.cc index 9f692c72be..61332c0715 100644 --- a/gnuradio-core/src/lib/general/gr_random_pdu.cc +++ b/gnuradio-core/src/lib/general/gr_random_pdu.cc @@ -74,8 +74,8 @@ void gr_random_pdu::output_random(){ } // send the vector - pmt::pmt_t vecpmt( pmt::pmt_make_blob( vec, len ) ); - pmt::pmt_t pdu( pmt::pmt_cons( pmt::PMT_NIL, vecpmt ) ); + pmt::pmt_t vecpmt( pmt::make_blob( vec, len ) ); + pmt::pmt_t pdu( pmt::cons( pmt::PMT_NIL, vecpmt ) ); message_port_pub( pmt::mp("pdus"), pdu ); std::cout << "sending new random vector of length " << len << "\n"; diff --git a/gnuradio-core/src/lib/general/gr_repeat.cc b/gnuradio-core/src/lib/general/gr_repeat.cc deleted file mode 100644 index 2fa82cd94d..0000000000 --- a/gnuradio-core/src/lib/general/gr_repeat.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_repeat.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_repeat_sptr -gr_make_repeat(size_t itemsize, int interp) -{ - return gnuradio::get_initial_sptr(new gr_repeat(itemsize, interp)); -} - -gr_repeat::gr_repeat(size_t itemsize, int interp) - : gr_sync_interpolator("extend", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(1, 1, itemsize), - interp), - d_interp(interp), - d_itemsize(itemsize) -{ -} - -gr_repeat::~gr_repeat() -{ -} - -int -gr_repeat::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]; - char *out = (char *)output_items[0]; - - for (int i = 0; i < noutput_items/d_interp; i++) { - for (int j = 0; j < d_interp; j++) { - memcpy(out, in, d_itemsize); - out += d_itemsize; - } - - in += d_itemsize; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_repeat.h b/gnuradio-core/src/lib/general/gr_repeat.h deleted file mode 100644 index 548ca79f4d..0000000000 --- a/gnuradio-core/src/lib/general/gr_repeat.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ -#ifndef INCLUDED_GR_REPEAT_H -#define INCLUDED_GR_REPEAT_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_repeat; - -typedef boost::shared_ptr<gr_repeat> gr_repeat_sptr; - -GR_CORE_API gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp); - -/*! - * \brief Repeat a sample 'interp' times in output stream - * \ingroup misc_blk - */ - -class GR_CORE_API gr_repeat : public gr_sync_interpolator -{ -private: - friend GR_CORE_API gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp); - - gr_repeat(size_t itemsize, int interp); - - int d_interp; - int d_itemsize; - - public: - ~gr_repeat(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_REPEAT_H */ diff --git a/gnuradio-core/src/lib/general/gr_repeat.i b/gnuradio-core/src/lib/general/gr_repeat.i deleted file mode 100644 index c657a4906f..0000000000 --- a/gnuradio-core/src/lib/general/gr_repeat.i +++ /dev/null @@ -1,11 +0,0 @@ -/* -*- c++ -*- */ - -GR_SWIG_BLOCK_MAGIC(gr,repeat); - -gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp); - -class gr_repeat : public gr_sync_interpolator -{ -private: - gr_repeat(); -}; diff --git a/gnuradio-core/src/lib/general/gr_scrambler_bb.cc b/gnuradio-core/src/lib/general/gr_scrambler_bb.cc deleted file mode 100644 index 31eb192077..0000000000 --- a/gnuradio-core/src/lib/general/gr_scrambler_bb.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_scrambler_bb.h> -#include <gr_io_signature.h> - -gr_scrambler_bb_sptr -gr_make_scrambler_bb(int mask, int seed, int len) -{ - return gnuradio::get_initial_sptr(new gr_scrambler_bb(mask, seed, len)); -} - -gr_scrambler_bb::gr_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 -gr_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/gnuradio-core/src/lib/general/gr_scrambler_bb.h b/gnuradio-core/src/lib/general/gr_scrambler_bb.h deleted file mode 100644 index edb429e0a0..0000000000 --- a/gnuradio-core/src/lib/general/gr_scrambler_bb.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ -#ifndef INCLUDED_GR_SCRAMBLER_BB_H -#define INCLUDED_GR_SCRAMBLER_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include "gri_lfsr.h" - -class gr_scrambler_bb; -typedef boost::shared_ptr<gr_scrambler_bb> gr_scrambler_bb_sptr; - -GR_CORE_API gr_scrambler_bb_sptr gr_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 GR_CORE_API gr_scrambler_bb : public gr_sync_block -{ - friend GR_CORE_API gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); - - gri_lfsr d_lfsr; - - gr_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/gnuradio-core/src/lib/general/gr_scrambler_bb.i b/gnuradio-core/src/lib/general/gr_scrambler_bb.i deleted file mode 100644 index a7ef7b364f..0000000000 --- a/gnuradio-core/src/lib/general/gr_scrambler_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,scrambler_bb); - -gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); - -class gr_scrambler_bb : public gr_sync_block -{ -private: - gr_scrambler_bb(int mask, int seed, int len); -}; diff --git a/gnuradio-core/src/lib/general/gr_short_to_char.cc b/gnuradio-core/src/lib/general/gr_short_to_char.cc deleted file mode 100644 index 8c146a351d..0000000000 --- a/gnuradio-core/src/lib/general/gr_short_to_char.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_short_to_char.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_short_to_char_sptr -gr_make_short_to_char (size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_short_to_char (vlen)); -} - -gr_short_to_char::gr_short_to_char (size_t vlen) - : gr_sync_block ("gr_short_to_char", - gr_make_io_signature (1, 1, sizeof (short)*vlen), - gr_make_io_signature (1, 1, sizeof (char)*vlen)), - d_vlen(vlen) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(char); - set_alignment(std::max(1,alignment_multiple)); -} - -int -gr_short_to_char::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const int16_t *in = (const int16_t *) input_items[0]; - int8_t *out = (int8_t *) output_items[0]; - - if(is_unaligned()) { - volk_16i_convert_8i_u(out, in, d_vlen*noutput_items); - } - else { - volk_16i_convert_8i_a(out, in, d_vlen*noutput_items); - } - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_short_to_char.h b/gnuradio-core/src/lib/general/gr_short_to_char.h deleted file mode 100644 index bf96211c7c..0000000000 --- a/gnuradio-core/src/lib/general/gr_short_to_char.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_GR_SHORT_TO_CHAR_H -#define INCLUDED_GR_SHORT_TO_CHAR_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_short_to_char; -typedef boost::shared_ptr<gr_short_to_char> gr_short_to_char_sptr; - -GR_CORE_API gr_short_to_char_sptr -gr_make_short_to_char (size_t vlen=1); - -/*! - * \brief Convert stream of short to a stream of float - * \ingroup converter_blk - * - * \param vlen vector length of data streams. - */ - -class GR_CORE_API gr_short_to_char : public gr_sync_block -{ - private: - friend GR_CORE_API gr_short_to_char_sptr - gr_make_short_to_char (size_t vlen); - gr_short_to_char (size_t vlen); - - size_t d_vlen; - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_SHORT_TO_CHAR_H */ diff --git a/gnuradio-core/src/lib/general/gr_short_to_char.i b/gnuradio-core/src/lib/general/gr_short_to_char.i deleted file mode 100644 index 7389ed10ba..0000000000 --- a/gnuradio-core/src/lib/general/gr_short_to_char.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,short_to_char) - -gr_short_to_char_sptr -gr_make_short_to_char (size_t vlen=1); - -class gr_short_to_char : public gr_sync_block -{ - -}; diff --git a/gnuradio-core/src/lib/general/gr_short_to_float.cc b/gnuradio-core/src/lib/general/gr_short_to_float.cc deleted file mode 100644 index 093d6024fa..0000000000 --- a/gnuradio-core/src/lib/general/gr_short_to_float.cc +++ /dev/null @@ -1,78 +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 <gr_short_to_float.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_short_to_float_sptr -gr_make_short_to_float (size_t vlen, float scale) -{ - return gnuradio::get_initial_sptr(new gr_short_to_float (vlen, scale)); -} - -gr_short_to_float::gr_short_to_float (size_t vlen, float scale) - : gr_sync_block ("gr_short_to_float", - gr_make_io_signature (1, 1, sizeof (short)*vlen), - gr_make_io_signature (1, 1, sizeof (float)*vlen)), - d_vlen(vlen), d_scale(scale) -{ - const int alignment_multiple = - volk_get_alignment() / sizeof(float); - set_alignment(std::max(1,alignment_multiple)); -} - -float -gr_short_to_float::scale() const -{ - return d_scale; -} - -void -gr_short_to_float::set_scale(float scale) -{ - d_scale = scale; -} - -int -gr_short_to_float::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]; - float *out = (float *) output_items[0]; - - if(is_unaligned()) { - volk_16i_s32f_convert_32f_u(out, in, d_scale, d_vlen*noutput_items); - } - else { - volk_16i_s32f_convert_32f_a(out, in, d_scale, d_vlen*noutput_items); - } - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_short_to_float.h b/gnuradio-core/src/lib/general/gr_short_to_float.h deleted file mode 100644 index 362549e70a..0000000000 --- a/gnuradio-core/src/lib/general/gr_short_to_float.h +++ /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. - */ - -#ifndef INCLUDED_GR_SHORT_TO_FLOAT_H -#define INCLUDED_GR_SHORT_TO_FLOAT_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_short_to_float; -typedef boost::shared_ptr<gr_short_to_float> gr_short_to_float_sptr; - -GR_CORE_API gr_short_to_float_sptr -gr_make_short_to_float (size_t vlen=1, float scale=1); - -/*! - * \brief Convert stream of short to a stream of float - * \ingroup converter_blk - * - * \param vlen vector length of data streams. - * \param scale a scalar divider to change the output signal scale. - */ - -class GR_CORE_API gr_short_to_float : public gr_sync_block -{ - private: - friend GR_CORE_API gr_short_to_float_sptr - gr_make_short_to_float (size_t vlen, float scale); - gr_short_to_float (size_t vlen, float scale); - - size_t d_vlen; - float d_scale; - - public: - /*! - * Get the scalar divider value. - */ - float scale() const; - - /*! - * Set the scalar divider value. - */ - void set_scale(float scale); - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_SHORT_TO_FLOAT_H */ diff --git a/gnuradio-core/src/lib/general/gr_short_to_float.i b/gnuradio-core/src/lib/general/gr_short_to_float.i deleted file mode 100644 index e781e292c9..0000000000 --- a/gnuradio-core/src/lib/general/gr_short_to_float.i +++ /dev/null @@ -1,33 +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(gr,short_to_float) - -gr_short_to_float_sptr -gr_make_short_to_float (size_t vlen=1, float scale=1); - -class gr_short_to_float : public gr_sync_block -{ -public: - float scale() const; - void set_scale(float scale); -}; diff --git a/gnuradio-core/src/lib/general/gr_simple_framer.cc b/gnuradio-core/src/lib/general/gr_simple_framer.cc deleted file mode 100644 index 506603bb71..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_framer.cc +++ /dev/null @@ -1,101 +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 <gr_simple_framer.h> -#include <gr_simple_framer_sync.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <string.h> - - -gr_simple_framer_sptr -gr_make_simple_framer (int payload_bytesize) -{ - return gnuradio::get_initial_sptr(new gr_simple_framer (payload_bytesize)); -} - -gr_simple_framer::gr_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 -gr_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 -gr_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/gnuradio-core/src/lib/general/gr_simple_framer.h b/gnuradio-core/src/lib/general/gr_simple_framer.h deleted file mode 100644 index 76a4b7baba..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_framer.h +++ /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. - */ - -#ifndef INCLUDED_GR_SIMPLE_FRAMER_H -#define INCLUDED_GR_SIMPLE_FRAMER_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_simple_framer; -typedef boost::shared_ptr<gr_simple_framer> gr_simple_framer_sptr; - -GR_CORE_API gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); - -/*! - * \brief add sync field, seq number and command field to payload - * \ingroup sync_blk - */ -class GR_CORE_API gr_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 GR_CORE_API gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); - gr_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/gnuradio-core/src/lib/general/gr_simple_framer.i b/gnuradio-core/src/lib/general/gr_simple_framer.i deleted file mode 100644 index c13ead87bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_framer.i +++ /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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,simple_framer); - -gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); - -class gr_simple_framer : public gr_block -{ - private: - gr_simple_framer (int payload_bytesize); -}; diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc deleted file mode 100644 index 5d90a3da48..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc +++ /dev/null @@ -1,99 +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 <gr_simple_squelch_cc.h> -#include <gr_io_signature.h> -#include <cmath> - -gr_simple_squelch_cc_sptr -gr_make_simple_squelch_cc(double threshold_db, double alpha) -{ - return gnuradio::get_initial_sptr(new gr_simple_squelch_cc(threshold_db, alpha)); -} - -gr_simple_squelch_cc::gr_simple_squelch_cc (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_iir(alpha), d_unmuted(false) -{ - set_threshold (threshold_db); -} - -gr_simple_squelch_cc::~gr_simple_squelch_cc() -{ -} - - -int -gr_simple_squelch_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]; - - 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; -} - -void -gr_simple_squelch_cc::set_threshold(double decibels) -{ - // convert to absolute threshold (mag squared) - d_threshold = std::pow(10.0, decibels/10); -} - -double -gr_simple_squelch_cc::threshold() const -{ - return 10 * log10(d_threshold); -} - -void -gr_simple_squelch_cc::set_alpha(double alpha) -{ - d_iir.set_taps(alpha); -} - -std::vector<float> -gr_simple_squelch_cc::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; -} diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h deleted file mode 100644 index 4bf62c7ec6..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h +++ /dev/null @@ -1,67 +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_GR_SIMPLE_SQUELCH_CC_H -#define INCLUDED_GR_SIMPLE_SQUELCH_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> - -class gr_simple_squelch_cc; -typedef boost::shared_ptr<gr_simple_squelch_cc> gr_simple_squelch_cc_sptr; - -GR_CORE_API gr_simple_squelch_cc_sptr -gr_make_simple_squelch_cc (double threshold_db, double alpha = 0.0001); - -/*! - * \brief simple squelch block based on average signal power and threshold in dB. - * \ingroup level_blk - */ -class GR_CORE_API gr_simple_squelch_cc : public gr_sync_block -{ - double d_threshold; - gr_single_pole_iir<double,double,double> d_iir; - bool d_unmuted; - - friend GR_CORE_API gr_simple_squelch_cc_sptr - gr_make_simple_squelch_cc (double threshold_db, double alpha); - - gr_simple_squelch_cc (double threshold_db, double alpha); - -public: - ~gr_simple_squelch_cc (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - 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; - -}; - -#endif /* INCLUDED_GR_SIMPLE_SQUELCH_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i deleted file mode 100644 index 17b469e156..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i +++ /dev/null @@ -1,37 +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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,simple_squelch_cc); - -gr_simple_squelch_cc_sptr -gr_make_simple_squelch_cc (double threshold_db, double alpha = 0.0001); - -class gr_simple_squelch_cc : public gr_sync_block -{ -public: - 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; -}; diff --git a/gnuradio-core/src/lib/general/gr_skiphead.cc b/gnuradio-core/src/lib/general/gr_skiphead.cc index 7b441bea9a..c93478597b 100644 --- a/gnuradio-core/src/lib/general/gr_skiphead.cc +++ b/gnuradio-core/src/lib/general/gr_skiphead.cc @@ -41,6 +41,31 @@ gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip) return gnuradio::get_initial_sptr(new gr_skiphead (itemsize, nitems_to_skip)); } +void +gr_skiphead::set_nitems_to_skip(uint64_t nitems_to_skip) +{ + d_nitems_to_skip = nitems_to_skip; + reset(); +} + +uint64_t +gr_skiphead::nitems_to_skip() const +{ + return d_nitems_to_skip; +} + +uint64_t +gr_skiphead::nitems_skiped() const +{ + return d_nitems; +} + +void +gr_skiphead::reset() +{ + d_nitems = 0; +} + int gr_skiphead::general_work(int noutput_items, gr_vector_int &ninput_items_, diff --git a/gnuradio-core/src/lib/general/gr_skiphead.h b/gnuradio-core/src/lib/general/gr_skiphead.h index 899b40f27a..710530ff4c 100644 --- a/gnuradio-core/src/lib/general/gr_skiphead.h +++ b/gnuradio-core/src/lib/general/gr_skiphead.h @@ -51,6 +51,26 @@ class GR_CORE_API gr_skiphead : public gr_block public: + /*! + * \brief Sets number of items to skip; resets current skip count to 0. + */ + void set_nitems_to_skip(uint64_t nitems_to_skip); + + /*! + * \brief Gets the number of items to skip. + */ + uint64_t nitems_to_skip() const; + + /*! + * \brief Gets the number of items already skipped. + */ + uint64_t nitems_skiped() const; + + /*! + * \brief Resets number of items skipped to 0. + */ + void reset(); + int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, diff --git a/gnuradio-core/src/lib/general/gr_skiphead.i b/gnuradio-core/src/lib/general/gr_skiphead.i index 3246db9702..8ab23a77a6 100644 --- a/gnuradio-core/src/lib/general/gr_skiphead.i +++ b/gnuradio-core/src/lib/general/gr_skiphead.i @@ -22,9 +22,14 @@ GR_SWIG_BLOCK_MAGIC(gr,skiphead); -gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); +gr_skiphead_sptr gr_make_skiphead(size_t itemsize, + uint64_t nitems_to_skip); -class gr_skiphead : public gr_block { - friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); - gr_skiphead (size_t itemsize, uint64_t nitems_to_skip); +class gr_skiphead : public gr_block +{ +public: + void set_nitems_to_skip(uint64_t nitems_to_skip); + uint64_t nitems_to_skip() const; + uint64_t nitems_skiped() const; + void reset(); }; diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc b/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc deleted file mode 100644 index b32a0a6954..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 <gr_squelch_base_cc.h> -#include <gr_io_signature.h> - -gr_squelch_base_cc::gr_squelch_base_cc(const char *name, int ramp, bool gate) : - gr_block(name, - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))) -{ - set_ramp(ramp); - set_gate(gate); - d_state = ST_MUTED; - d_envelope = d_ramp ? 0.0 : 1.0; - d_ramped = 0; -} - -int gr_squelch_base_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 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 -} diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.h b/gnuradio-core/src/lib/general/gr_squelch_base_cc.h deleted file mode 100644 index f1814473fb..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_cc.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_GR_SQUELCH_BASE_CC_H -#define INCLUDED_GR_SQUELCH_BASE_CC_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class GR_CORE_API gr_squelch_base_cc : public gr_block -{ -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: - gr_squelch_base_cc(const char *name, int ramp, bool gate); - - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } - - 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); -}; - -#endif /* INCLUDED_GR_SQUELCH_BASE_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.i b/gnuradio-core/src/lib/general/gr_squelch_base_cc.i deleted file mode 100644 index 6501b7d2bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_cc.i +++ /dev/null @@ -1,40 +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. - */ - -#include <gr_block.h> - -class gr_squelch_base_cc : public gr_block -{ -private: - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; - -public: - gr_squelch_base_cc(const char *name, int ramp, bool gate); - - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } - - virtual std::vector<float> squelch_range() const = 0; -}; diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc b/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc deleted file mode 100644 index 4bf8cff971..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 <gr_squelch_base_ff.h> -#include <gr_io_signature.h> - -gr_squelch_base_ff::gr_squelch_base_ff(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; -} - -int gr_squelch_base_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 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]*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 -} diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.h b/gnuradio-core/src/lib/general/gr_squelch_base_ff.h deleted file mode 100644 index eb52635b45..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_ff.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_GR_SQUELCH_BASE_FF_H -#define INCLUDED_GR_SQUELCH_BASE_FF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class GR_CORE_API gr_squelch_base_ff : public gr_block -{ -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: - gr_squelch_base_ff(const char *name, int ramp, bool gate); - - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } - - 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); -}; - -#endif /* INCLUDED_GR_SQUELCH_BASE_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.i b/gnuradio-core/src/lib/general/gr_squelch_base_ff.i deleted file mode 100644 index a4e5c7115c..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_ff.i +++ /dev/null @@ -1,40 +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. - */ - -#include <gr_block.h> - -class gr_squelch_base_ff : public gr_block -{ -private: - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; - -public: - gr_squelch_base_ff(const char *name, int ramp, bool gate); - - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } - - virtual std::vector<float> squelch_range() const = 0; -}; diff --git a/gnuradio-core/src/lib/general/gr_stream_mux.cc b/gnuradio-core/src/lib/general/gr_stream_mux.cc deleted file mode 100644 index 978d960b20..0000000000 --- a/gnuradio-core/src/lib/general/gr_stream_mux.cc +++ /dev/null @@ -1,124 +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 <gr_stream_mux.h> -#include <gr_io_signature.h> -#include <string.h> -#include <cstdio> - -#define VERBOSE 0 - -gr_stream_mux_sptr -gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths) -{ - return gnuradio::get_initial_sptr(new gr_stream_mux (itemsize, lengths)); -} - -gr_stream_mux::gr_stream_mux (size_t itemsize, const std::vector<int> &lengths) - : gr_block ("stream_mux", - gr_make_io_signature (1, -1, itemsize), - gr_make_io_signature (1, 1, itemsize)), - d_itemsize(itemsize), - d_stream(0), - d_residual(0), - d_lengths(lengths) -{ - if(d_lengths[d_stream] == 0) { - increment_stream(); - } - d_residual = d_lengths[d_stream]; -} - -gr_stream_mux::~gr_stream_mux(void) -{ -} - -void -gr_stream_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] = (d_lengths[i] == 0 ? 0 : 1); -} - -void gr_stream_mux::increment_stream() -{ - do { - d_stream = (d_stream+1) % d_lengths.size(); - } while(d_lengths[d_stream] == 0); - - d_residual = d_lengths[d_stream]; -} - -int -gr_stream_mux::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *out = (char *) output_items[0]; - const char *in; - int out_index = 0; - std::vector<int> input_index(d_lengths.size(), 0); - - if(VERBOSE) { - printf("mux: nouput_items: %d d_stream: %d\n", noutput_items, d_stream); - for(size_t i = 0; i < d_lengths.size(); i++) - printf("\tninput_items[%zu]: %d\n", i, ninput_items[i]); - } - - while (1) { - int r = std::min(noutput_items - out_index, - std::min(d_residual, - ninput_items[d_stream] - input_index[d_stream])); - if(VERBOSE) { - printf("mux: r=%d\n", r); - printf("\tnoutput_items - out_index: %d\n", - noutput_items - out_index); - printf("\td_residual: %d\n", - d_residual); - printf("\tninput_items[d_stream] - input_index[d_stream]: %d\n", - ninput_items[d_stream] - input_index[d_stream]); - } - - if(r <= 0) { - return out_index; - } - - in = (const char *) input_items[d_stream] + input_index[d_stream]*d_itemsize; - - memcpy(&out[out_index*d_itemsize], in, r*d_itemsize); - out_index += r; - input_index[d_stream] += r; - d_residual -= r; - - consume(d_stream, r); - - if(d_residual == 0) { - increment_stream(); - } - } -} diff --git a/gnuradio-core/src/lib/general/gr_stream_mux.h b/gnuradio-core/src/lib/general/gr_stream_mux.h deleted file mode 100644 index 742bf082d1..0000000000 --- a/gnuradio-core/src/lib/general/gr_stream_mux.h +++ /dev/null @@ -1,93 +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_GR_STREAM_MUX_H -#define INCLUDED_GR_STREAM_MUX_H - - -#include <gr_core_api.h> -#include <gr_block.h> -#include <vector> - -/*! - * \brief Creates a stream muxing block to multiplex many streams into - * one with a specified format. - * \ingroup converter_blk - * - * \param itemsize the item size of the stream - * \param length a vector (list/tuple) specifying the number of - * items from each stream the mux together. - * Warning: this requires that at least as many items - * per stream are available or the system will wait - * indefinitely for the items. - * - */ -class gr_stream_mux; -typedef boost::shared_ptr<gr_stream_mux> gr_stream_mux_sptr; - - - -GR_CORE_API gr_stream_mux_sptr -gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths); - - -/*! - * \brief Stream muxing block to multiplex many streams into - * one with a specified format. - * - * Muxes N streams together producing an output stream that - * contains N0 items from the first stream, N1 items from the second, - * etc. and repeats: - * - * [N0, N1, N2, ..., Nm, N0, N1, ...] - */ - -class GR_CORE_API gr_stream_mux : public gr_block -{ - friend GR_CORE_API gr_stream_mux_sptr - gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths); - - protected: - gr_stream_mux (size_t itemsize, const std::vector<int> &lengths); - - private: - size_t d_itemsize; - unsigned int d_stream; // index of currently selected stream - int d_residual; // number if items left to put into current stream - gr_vector_int d_lengths; // number if items to pack per stream - - void increment_stream(); - - public: - ~gr_stream_mux(void); - - 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/gnuradio-core/src/lib/general/gr_stream_mux.i b/gnuradio-core/src/lib/general/gr_stream_mux.i deleted file mode 100644 index 7cc116a23b..0000000000 --- a/gnuradio-core/src/lib/general/gr_stream_mux.i +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 <vector> - -GR_SWIG_BLOCK_MAGIC(gr,stream_mux) - -gr_stream_mux_sptr -gr_make_stream_mux (size_t itemsize, - const std::vector<int> &lengths); - -class gr_stream_mux : public gr_block -{ - protected: - gr_make_stream_mux (size_t itemsize, - const std::vector<int> &lengths); - - 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); -}; diff --git a/gnuradio-core/src/lib/general/gr_stream_to_streams.cc b/gnuradio-core/src/lib/general/gr_stream_to_streams.cc deleted file mode 100644 index de72adb1dd..0000000000 --- a/gnuradio-core/src/lib/general/gr_stream_to_streams.cc +++ /dev/null @@ -1,66 +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 <gr_stream_to_streams.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_stream_to_streams_sptr -gr_make_stream_to_streams (size_t item_size, size_t nstreams) -{ - return gnuradio::get_initial_sptr(new gr_stream_to_streams (item_size, nstreams)); -} - -gr_stream_to_streams::gr_stream_to_streams (size_t item_size, size_t nstreams) - : gr_sync_decimator ("stream_to_streams", - gr_make_io_signature (1, 1, item_size), - gr_make_io_signature (nstreams, - nstreams, item_size), - nstreams) -{ -} - -int -gr_stream_to_streams::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - size_t item_size = output_signature()->sizeof_stream_item (0); - - const char *in = (const char *) input_items[0]; - char **outv = (char **) &output_items[0]; - int nstreams = output_items.size(); - - for (int i = 0; i < noutput_items; i++){ - for (int j = 0; j < nstreams; j++){ - memcpy(outv[j], in, item_size); - outv[j] += item_size; - in += item_size; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_stream_to_streams.h b/gnuradio-core/src/lib/general/gr_stream_to_streams.h deleted file mode 100644 index 117f57bf5e..0000000000 --- a/gnuradio-core/src/lib/general/gr_stream_to_streams.h +++ /dev/null @@ -1,56 +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_GR_STREAM_TO_STREAMS_H -#define INCLUDED_GR_STREAM_TO_STREAMS_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_stream_to_streams; -typedef boost::shared_ptr<gr_stream_to_streams> gr_stream_to_streams_sptr; - -GR_CORE_API gr_stream_to_streams_sptr -gr_make_stream_to_streams (size_t item_size, size_t nstreams); - - -/*! - * \brief convert a stream of items into a N streams of items - * \ingroup slicedice_blk - * - * Converts a stream of N items into N streams of 1 item. - * Repeat ad infinitum. - */ -class GR_CORE_API gr_stream_to_streams : public gr_sync_decimator -{ - friend GR_CORE_API gr_stream_to_streams_sptr - gr_make_stream_to_streams (size_t item_size, size_t nstreams); - - protected: - gr_stream_to_streams (size_t item_size, size_t nstreams); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_STREAM_TO_STREAMS_H */ diff --git a/gnuradio-core/src/lib/general/gr_stream_to_streams.i b/gnuradio-core/src/lib/general/gr_stream_to_streams.i deleted file mode 100644 index 4d324372ee..0000000000 --- a/gnuradio-core/src/lib/general/gr_stream_to_streams.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,stream_to_streams) - -gr_stream_to_streams_sptr -gr_make_stream_to_streams (size_t itemsize, size_t nstreams); - -class gr_stream_to_streams : public gr_sync_decimator -{ - protected: - gr_stream_to_streams (size_t itemsize, size_t nstreams); - - public: -}; diff --git a/gnuradio-core/src/lib/general/gr_stream_to_vector.cc b/gnuradio-core/src/lib/general/gr_stream_to_vector.cc deleted file mode 100644 index d38cdd4348..0000000000 --- a/gnuradio-core/src/lib/general/gr_stream_to_vector.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 <gr_stream_to_vector.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_stream_to_vector_sptr -gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block) -{ - return gnuradio::get_initial_sptr(new gr_stream_to_vector (item_size, nitems_per_block)); -} - -gr_stream_to_vector::gr_stream_to_vector (size_t item_size, size_t nitems_per_block) - : gr_sync_decimator ("stream_to_vector", - gr_make_io_signature (1, 1, item_size), - gr_make_io_signature (1, 1, item_size * nitems_per_block), - nitems_per_block) -{ -} - -int -gr_stream_to_vector::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - size_t block_size = output_signature()->sizeof_stream_item (0); - - const char *in = (const char *) input_items[0]; - char *out = (char *) output_items[0]; - - memcpy (out, in, noutput_items * block_size); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_stream_to_vector.h b/gnuradio-core/src/lib/general/gr_stream_to_vector.h deleted file mode 100644 index 362349965f..0000000000 --- a/gnuradio-core/src/lib/general/gr_stream_to_vector.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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_GR_STREAM_TO_VECTOR_H -#define INCLUDED_GR_STREAM_TO_VECTOR_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_stream_to_vector; -typedef boost::shared_ptr<gr_stream_to_vector> gr_stream_to_vector_sptr; - -GR_CORE_API gr_stream_to_vector_sptr -gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block); - - -/*! - * \brief convert a stream of items into a stream of blocks containing nitems_per_block - * \ingroup slicedice_blk - */ -class GR_CORE_API gr_stream_to_vector : public gr_sync_decimator -{ - friend GR_CORE_API gr_stream_to_vector_sptr - gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block); - - protected: - gr_stream_to_vector (size_t item_size, size_t nitems_per_block); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_STREAM_TO_VECTOR_H */ diff --git a/gnuradio-core/src/lib/general/gr_stream_to_vector.i b/gnuradio-core/src/lib/general/gr_stream_to_vector.i deleted file mode 100644 index ef867012ad..0000000000 --- a/gnuradio-core/src/lib/general/gr_stream_to_vector.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,stream_to_vector) - -gr_stream_to_vector_sptr -gr_make_stream_to_vector (size_t itemsize, size_t nitems_per_block); - -class gr_stream_to_vector : public gr_sync_decimator -{ - protected: - gr_stream_to_vector (size_t itemsize, size_t nitems_per_block); - - public: -}; diff --git a/gnuradio-core/src/lib/general/gr_streams_to_stream.cc b/gnuradio-core/src/lib/general/gr_streams_to_stream.cc deleted file mode 100644 index 8bce747227..0000000000 --- a/gnuradio-core/src/lib/general/gr_streams_to_stream.cc +++ /dev/null @@ -1,68 +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 <gr_streams_to_stream.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_streams_to_stream_sptr -gr_make_streams_to_stream (size_t item_size, size_t nstreams) -{ - return gnuradio::get_initial_sptr(new gr_streams_to_stream (item_size, nstreams)); -} - -gr_streams_to_stream::gr_streams_to_stream (size_t item_size, size_t nstreams) - : gr_sync_interpolator ("streams_to_stream", - gr_make_io_signature (nstreams, nstreams, item_size), - gr_make_io_signature (1, 1, item_size), - nstreams) -{ -} - -int -gr_streams_to_stream::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - size_t item_size = output_signature()->sizeof_stream_item (0); - - const char **inv = (const char **) &input_items[0]; - char *out = (char *) output_items[0]; - int nstreams = input_items.size(); - - assert (noutput_items % nstreams == 0); - int ni = noutput_items / nstreams; - - for (int i = 0; i < ni; i++){ - for (int j = 0; j < nstreams; j++){ - memcpy(out, inv[j], item_size); - out += item_size; - inv[j] += item_size; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_streams_to_stream.h b/gnuradio-core/src/lib/general/gr_streams_to_stream.h deleted file mode 100644 index f636837675..0000000000 --- a/gnuradio-core/src/lib/general/gr_streams_to_stream.h +++ /dev/null @@ -1,56 +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_GR_STREAMS_TO_STREAM_H -#define INCLUDED_GR_STREAMS_TO_STREAM_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_streams_to_stream; -typedef boost::shared_ptr<gr_streams_to_stream> gr_streams_to_stream_sptr; - -GR_CORE_API gr_streams_to_stream_sptr -gr_make_streams_to_stream (size_t item_size, size_t nstreams); - - -/*! - * \brief Convert N streams of 1 item into a 1 stream of N items - * \ingroup slicedice_blk - * - * Convert N streams of 1 item into 1 stream of N items. - * Repeat ad infinitum. - */ -class GR_CORE_API gr_streams_to_stream : public gr_sync_interpolator -{ - friend GR_CORE_API gr_streams_to_stream_sptr - gr_make_streams_to_stream (size_t item_size, size_t nstreams); - - protected: - gr_streams_to_stream (size_t item_size, size_t nstreams); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_STREAMS_TO_STREAM_H */ diff --git a/gnuradio-core/src/lib/general/gr_streams_to_stream.i b/gnuradio-core/src/lib/general/gr_streams_to_stream.i deleted file mode 100644 index a09ded0710..0000000000 --- a/gnuradio-core/src/lib/general/gr_streams_to_stream.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,streams_to_stream) - -gr_streams_to_stream_sptr -gr_make_streams_to_stream (size_t itemsize, size_t nstreams); - -class gr_streams_to_stream : public gr_sync_interpolator -{ - protected: - gr_streams_to_stream (size_t itemsize, size_t nstreams); - - public: -}; diff --git a/gnuradio-core/src/lib/general/gr_streams_to_vector.cc b/gnuradio-core/src/lib/general/gr_streams_to_vector.cc deleted file mode 100644 index cf862ca954..0000000000 --- a/gnuradio-core/src/lib/general/gr_streams_to_vector.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 <gr_streams_to_vector.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_streams_to_vector_sptr -gr_make_streams_to_vector (size_t item_size, size_t nstreams) -{ - return gnuradio::get_initial_sptr(new gr_streams_to_vector (item_size, nstreams)); -} - -gr_streams_to_vector::gr_streams_to_vector (size_t item_size, size_t nstreams) - : gr_sync_block ("streams_to_vector", - gr_make_io_signature (nstreams, nstreams, item_size), - gr_make_io_signature (1, 1, nstreams * item_size)) -{ -} - -int -gr_streams_to_vector::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - size_t item_size = input_signature()->sizeof_stream_item(0); - int nstreams = input_items.size(); - - const char **inv = (const char **) &input_items[0]; - char *out = (char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - for (int j = 0; j < nstreams; j++){ - memcpy(out, inv[j], item_size); - inv[j] += item_size; - out += item_size; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_streams_to_vector.h b/gnuradio-core/src/lib/general/gr_streams_to_vector.h deleted file mode 100644 index 1df2890999..0000000000 --- a/gnuradio-core/src/lib/general/gr_streams_to_vector.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_STREAMS_TO_VECTOR_H -#define INCLUDED_GR_STREAMS_TO_VECTOR_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_streams_to_vector; -typedef boost::shared_ptr<gr_streams_to_vector> gr_streams_to_vector_sptr; - -GR_CORE_API gr_streams_to_vector_sptr -gr_make_streams_to_vector (size_t item_size, size_t nstreams); - - -/*! - * \brief convert N streams of items to 1 stream of vector length N - * \ingroup slicedice_blk - */ -class GR_CORE_API gr_streams_to_vector : public gr_sync_block -{ - friend GR_CORE_API gr_streams_to_vector_sptr - gr_make_streams_to_vector (size_t item_size, size_t nstreams); - - protected: - gr_streams_to_vector (size_t item_size, size_t nstreams); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_STREAMS_TO_VECTOR_H */ diff --git a/gnuradio-core/src/lib/general/gr_streams_to_vector.i b/gnuradio-core/src/lib/general/gr_streams_to_vector.i deleted file mode 100644 index 4d5eca45ef..0000000000 --- a/gnuradio-core/src/lib/general/gr_streams_to_vector.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,streams_to_vector) - -gr_streams_to_vector_sptr -gr_make_streams_to_vector (size_t itemsize, size_t nstreams); - -class gr_streams_to_vector : public gr_sync_block -{ - protected: - gr_streams_to_vector (size_t itemsize, size_t nstreams); - - public: -}; diff --git a/gnuradio-core/src/lib/general/gr_tag_debug.cc b/gnuradio-core/src/lib/general/gr_tag_debug.cc index ecf1b65e1f..9c66e890af 100644 --- a/gnuradio-core/src/lib/general/gr_tag_debug.cc +++ b/gnuradio-core/src/lib/general/gr_tag_debug.cc @@ -84,8 +84,8 @@ gr_tag_debug::work(int noutput_items, sout << "Input Stream: " << std::setw(2) << std::setfill('0') << i << std::setfill(' ') << std::endl; for(d_tags_itr = d_tags.begin(); d_tags_itr != d_tags.end(); d_tags_itr++) { sout << std::setw(10) << "Offset: " << d_tags_itr->offset - << std::setw(10) << "Source: " << (pmt::pmt_is_symbol(d_tags_itr->srcid) ? pmt::pmt_symbol_to_string(d_tags_itr->srcid) : "n/a") - << std::setw(10) << "Key: " << pmt::pmt_symbol_to_string(d_tags_itr->key) + << std::setw(10) << "Source: " << (pmt::is_symbol(d_tags_itr->srcid) ? pmt::symbol_to_string(d_tags_itr->srcid) : "n/a") + << std::setw(10) << "Key: " << pmt::symbol_to_string(d_tags_itr->key) << std::setw(10) << "Value: "; sout << d_tags_itr->value << std::endl; } diff --git a/gnuradio-core/src/lib/general/gr_uchar_to_float.cc b/gnuradio-core/src/lib/general/gr_uchar_to_float.cc deleted file mode 100644 index 981a934400..0000000000 --- a/gnuradio-core/src/lib/general/gr_uchar_to_float.cc +++ /dev/null @@ -1,55 +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 <gr_uchar_to_float.h> -#include <gr_io_signature.h> -#include <gri_uchar_to_float.h> - -gr_uchar_to_float_sptr -gr_make_uchar_to_float () -{ - return gnuradio::get_initial_sptr(new gr_uchar_to_float ()); -} - -gr_uchar_to_float::gr_uchar_to_float () - : gr_sync_block ("gr_uchar_to_float", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (float))) -{ -} - -int -gr_uchar_to_float::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]; - float *out = (float *) output_items[0]; - - gri_uchar_to_float (in, out, noutput_items); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_uchar_to_float.h b/gnuradio-core/src/lib/general/gr_uchar_to_float.h deleted file mode 100644 index c02601cca6..0000000000 --- a/gnuradio-core/src/lib/general/gr_uchar_to_float.h +++ /dev/null @@ -1,52 +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_GR_UCHAR_TO_FLOAT_H -#define INCLUDED_GR_UCHAR_TO_FLOAT_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_uchar_to_float; -typedef boost::shared_ptr<gr_uchar_to_float> gr_uchar_to_float_sptr; - -GR_CORE_API gr_uchar_to_float_sptr -gr_make_uchar_to_float (); - -/*! - * \brief Convert stream of unsigned chars to a stream of float - * \ingroup converter_blk - */ - -class GR_CORE_API gr_uchar_to_float : public gr_sync_block -{ - friend GR_CORE_API gr_uchar_to_float_sptr gr_make_uchar_to_float (); - gr_uchar_to_float (); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_UCHAR_TO_FLOAT_H */ diff --git a/gnuradio-core/src/lib/general/gr_uchar_to_float.i b/gnuradio-core/src/lib/general/gr_uchar_to_float.i deleted file mode 100644 index b6cc353296..0000000000 --- a/gnuradio-core/src/lib/general/gr_uchar_to_float.i +++ /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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,uchar_to_float) - -gr_uchar_to_float_sptr gr_make_uchar_to_float (); - -class gr_uchar_to_float : public gr_sync_block -{ - gr_uchar_to_float (); -}; diff --git a/gnuradio-core/src/lib/general/gr_vector_to_stream.cc b/gnuradio-core/src/lib/general/gr_vector_to_stream.cc deleted file mode 100644 index 621b7ec581..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_to_stream.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 <gr_vector_to_stream.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_vector_to_stream_sptr -gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block) -{ - return gnuradio::get_initial_sptr(new gr_vector_to_stream (item_size, nitems_per_block)); -} - -gr_vector_to_stream::gr_vector_to_stream (size_t item_size, size_t nitems_per_block) - : gr_sync_interpolator ("vector_to_stream", - gr_make_io_signature (1, 1, item_size * nitems_per_block), - gr_make_io_signature (1, 1, item_size), - nitems_per_block) -{ -} - -int -gr_vector_to_stream::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - size_t block_size = output_signature()->sizeof_stream_item (0); - - const char *in = (const char *) input_items[0]; - char *out = (char *) output_items[0]; - - memcpy (out, in, noutput_items * block_size); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_vector_to_stream.h b/gnuradio-core/src/lib/general/gr_vector_to_stream.h deleted file mode 100644 index 9fc8030f5b..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_to_stream.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -#ifndef INCLUDED_GR_VECTOR_TO_STREAM_H -#define INCLUDED_GR_VECTOR_TO_STREAM_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_vector_to_stream; -typedef boost::shared_ptr<gr_vector_to_stream> gr_vector_to_stream_sptr; - -GR_CORE_API gr_vector_to_stream_sptr -gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block); - - -/*! - * \brief convert a stream of blocks of nitems_per_block items into a stream of items - * \ingroup slicedice_blk - */ -class GR_CORE_API gr_vector_to_stream : public gr_sync_interpolator -{ - friend GR_CORE_API gr_vector_to_stream_sptr - gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block); - - protected: - gr_vector_to_stream (size_t item_size, size_t nitems_per_block); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_VECTOR_TO_STREAM_H */ diff --git a/gnuradio-core/src/lib/general/gr_vector_to_stream.i b/gnuradio-core/src/lib/general/gr_vector_to_stream.i deleted file mode 100644 index 99776eeb86..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_to_stream.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,vector_to_stream) - -gr_vector_to_stream_sptr -gr_make_vector_to_stream (size_t itemsize, size_t nitems_per_block); - -class gr_vector_to_stream : public gr_sync_decimator -{ - protected: - gr_vector_to_stream (size_t itemsize, size_t nitems_per_block); - - public: -}; diff --git a/gnuradio-core/src/lib/general/gr_vector_to_streams.cc b/gnuradio-core/src/lib/general/gr_vector_to_streams.cc deleted file mode 100644 index 7ab352a4fb..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_to_streams.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 <gr_vector_to_streams.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_vector_to_streams_sptr -gr_make_vector_to_streams (size_t item_size, size_t nstreams) -{ - return gnuradio::get_initial_sptr(new gr_vector_to_streams (item_size, nstreams)); -} - -gr_vector_to_streams::gr_vector_to_streams (size_t item_size, size_t nstreams) - : gr_sync_block ("vector_to_streams", - gr_make_io_signature (1, 1, nstreams * item_size), - gr_make_io_signature (nstreams, nstreams, item_size)) -{ -} - -int -gr_vector_to_streams::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - size_t item_size = output_signature()->sizeof_stream_item(0); - int nstreams = output_items.size(); - - const char *in = (const char *) input_items[0]; - char **outv = (char **) &output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - for (int j = 0; j < nstreams; j++){ - memcpy(outv[j], in, item_size); - outv[j] += item_size; - in += item_size; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_vector_to_streams.h b/gnuradio-core/src/lib/general/gr_vector_to_streams.h deleted file mode 100644 index 8db4230536..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_to_streams.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_VECTOR_TO_STREAMS_H -#define INCLUDED_GR_VECTOR_TO_STREAMS_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_vector_to_streams; -typedef boost::shared_ptr<gr_vector_to_streams> gr_vector_to_streams_sptr; - -GR_CORE_API gr_vector_to_streams_sptr -gr_make_vector_to_streams (size_t item_size, size_t nstreams); - - -/*! - * \brief Convert 1 stream of vectors of length N to N streams of items - * \ingroup slicedice_blk - */ -class GR_CORE_API gr_vector_to_streams : public gr_sync_block -{ - friend GR_CORE_API gr_vector_to_streams_sptr - gr_make_vector_to_streams (size_t item_size, size_t nstreams); - - protected: - gr_vector_to_streams (size_t item_size, size_t nstreams); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_VECTOR_TO_STREAMS_H */ diff --git a/gnuradio-core/src/lib/general/gr_vector_to_streams.i b/gnuradio-core/src/lib/general/gr_vector_to_streams.i deleted file mode 100644 index d4123135bc..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_to_streams.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,vector_to_streams) - -gr_vector_to_streams_sptr -gr_make_vector_to_streams (size_t itemsize, size_t nstreams); - -class gr_vector_to_streams : public gr_sync_block -{ - protected: - gr_vector_to_streams (size_t itemsize, size_t nstreams); - - public: -}; diff --git a/gnuradio-core/src/lib/general/gri_agc2_cc.h b/gnuradio-core/src/lib/general/gri_agc2_cc.h deleted file mode 100644 index 55aa19b9ae..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_cc.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 _GRI_AGC2_CC_H_ -#define _GRI_AGC2_CC_H_ - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * For Power the absolute value of the complex number is used. - */ -class GR_CORE_API gri_agc2_cc { - - public: - gri_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; - -#if 0 - fprintf(stdout, "rate = %f\ttmp = %f\t gain = %f\n", rate, tmp, _gain); -#endif - - // 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 -}; - -#endif /* _GRI_AGC2_CC_H_ */ diff --git a/gnuradio-core/src/lib/general/gri_agc2_cc.i b/gnuradio-core/src/lib/general/gri_agc2_cc.i deleted file mode 100644 index 08716c6edc..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_cc.i +++ /dev/null @@ -1,47 +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. - */ - -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class with attack and decay rates - * - * For Power the absolute value of the complex number is used. - */ - - -class gri_agc2_cc { - - public: - gri_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); - float decay_rate (); - float attack_rate (); - float reference (); - float gain (); - float max_gain (); - void set_decay_rate (float rate); - void set_attack_rate (float rate); - void set_reference (float reference); - void set_gain (float gain); - void set_max_gain(float max_gain); - }; diff --git a/gnuradio-core/src/lib/general/gri_agc2_ff.h b/gnuradio-core/src/lib/general/gri_agc2_ff.h deleted file mode 100644 index a8b46bec5c..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_ff.h +++ /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. - */ - -#ifndef _GRI_AGC2_FF_H_ -#define _GRI_AGC2_FF_H_ - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class with attack and decay rate - * - * Power is approximated by absolute value - */ - -class GR_CORE_API gri_agc2_ff { - - public: - gri_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; - -#if 0 - fprintf(stdout, "rate = %f\ttmp = %f\t gain = %f\n", rate, tmp, _gain); -#endif - - // 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 -}; - -#endif /* _GRI_AGC2_FF_H_ */ diff --git a/gnuradio-core/src/lib/general/gri_agc2_ff.i b/gnuradio-core/src/lib/general/gri_agc2_ff.i deleted file mode 100644 index 9f97d8f0dd..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_ff.i +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * Power is approximated by absolute value - */ - - -class gri_agc2_ff { - - public: - gri_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); - float attack_rate (); - float decay_rate (); - float reference (); - float gain (); - float max_gain (); - void set_attack_rate (float rate); - void set_decay_rate (float rate); - void set_reference (float reference); - void set_gain (float gain); - void set_max_gain (float max_gain); - }; diff --git a/gnuradio-core/src/lib/general/gri_agc_cc.h b/gnuradio-core/src/lib/general/gri_agc_cc.h deleted file mode 100644 index 90edc5dcd2..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc_cc.h +++ /dev/null @@ -1,75 +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_AGC_CC_H -#define INCLUDED_GRI_AGC_CC_H - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * For Power the absolute value of the complex number is used. - */ - -class GR_CORE_API gri_agc_cc { - - public: - gri_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) {}; - - 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 -}; - -#endif /* INCLUDED_GRI_AGC_CC_H */ diff --git a/gnuradio-core/src/lib/general/gri_agc_cc.i b/gnuradio-core/src/lib/general/gri_agc_cc.i deleted file mode 100644 index d3dd9b61bc..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc_cc.i +++ /dev/null @@ -1,41 +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. - */ - -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * For Power the absolute value of the complex number is used. - */ - - -class gri_agc_cc { - - public: - gri_agc_cc (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - float rate (); - float reference (); - float gain (); - float max_gain (); - }; diff --git a/gnuradio-core/src/lib/general/gri_agc_ff.h b/gnuradio-core/src/lib/general/gri_agc_ff.h deleted file mode 100644 index 1c233c7461..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc_ff.h +++ /dev/null @@ -1,72 +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. - */ - -#ifndef INCLUDED_GRI_AGC_FF_H -#define INCLUDED_GRI_AGC_FF_H - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * Power is approximated by absolute value - */ -class GR_CORE_API gri_agc_ff { - - public: - gri_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) {}; - - 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 -}; - -#endif /* INCLUDED_GRI_AGC_FF_H */ - diff --git a/gnuradio-core/src/lib/general/gri_agc_ff.i b/gnuradio-core/src/lib/general/gri_agc_ff.i deleted file mode 100644 index df4acf7af8..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc_ff.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * Power is approximated by absolute value - */ - -class gri_agc_ff { - - public: - gri_agc_ff (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); -}; diff --git a/gnuradio-core/src/lib/general/gri_char_to_float.cc b/gnuradio-core/src/lib/general/gri_char_to_float.cc deleted file mode 100644 index fd9a6636a1..0000000000 --- a/gnuradio-core/src/lib/general/gri_char_to_float.cc +++ /dev/null @@ -1,40 +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. - */ - -#include <gri_char_to_float.h> - -void -gri_char_to_float (const char *in, float *out, int nsamples) -{ - while (nsamples >= 4){ - out[0] = in[0]; - out[1] = in[1]; - out[2] = in[2]; - out[3] = in[3]; - out += 4; - in += 4; - nsamples -= 4; - } - - while (nsamples-- > 0) - *out++ = *in++; -} diff --git a/gnuradio-core/src/lib/general/gri_char_to_float.h b/gnuradio-core/src/lib/general/gri_char_to_float.h deleted file mode 100644 index 8bd3bfde7d..0000000000 --- a/gnuradio-core/src/lib/general/gri_char_to_float.h +++ /dev/null @@ -1,34 +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_CHAR_TO_FLOAT_H -#define INCLUDED_GRI_CHAR_TO_FLOAT_H - -#include <gr_core_api.h> - -/* - * convert array of chars to floats - */ -GR_CORE_API void gri_char_to_float (const char *in, float *out, int nsamples); - - -#endif /* INCLUDED_GRI_CHAR_TO_FLOAT_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_control_loop.h b/gnuradio-core/src/lib/general/gri_control_loop.h index 304857ac75..46aa6ae243 100644 --- a/gnuradio-core/src/lib/general/gri_control_loop.h +++ b/gnuradio-core/src/lib/general/gri_control_loop.h @@ -34,6 +34,7 @@ class GR_CORE_API gri_control_loop float d_alpha, d_beta; public: + gri_control_loop() {}; gri_control_loop(float loop_bw, float max_freq, float min_freq); virtual ~gri_control_loop(); diff --git a/gnuradio-core/src/lib/general/gri_fft.cc b/gnuradio-core/src/lib/general/gri_fft.cc index 68e7e69519..78446ad39b 100644 --- a/gnuradio-core/src/lib/general/gri_fft.cc +++ b/gnuradio-core/src/lib/general/gri_fft.cc @@ -59,6 +59,12 @@ gri_fft_malloc_float(int size) return (float*)fftwf_malloc(sizeof(float)*size); } +double * +gri_fft_malloc_double(int size) +{ + return (double*)fftwf_malloc(sizeof(double)*size); +} + void gri_fft_free(void *b) { diff --git a/gnuradio-core/src/lib/general/gri_fft.h b/gnuradio-core/src/lib/general/gri_fft.h index 65e9d046e2..c6fbd4f43f 100644 --- a/gnuradio-core/src/lib/general/gri_fft.h +++ b/gnuradio-core/src/lib/general/gri_fft.h @@ -30,17 +30,21 @@ #include <gr_complex.h> #include <boost/thread.hpp> -/*! \brief Helper function for allocating complex fft buffers +/*! \brief Helper function for allocating complex* buffers */ -gr_complex* gri_fft_malloc_complex(int size); +GR_CORE_API gr_complex* gri_fft_malloc_complex(int size); -/*! \brief Helper function for allocating float fft buffers +/*! \brief Helper function for allocating float* buffers */ -float* gri_fft_malloc_float(int size); +GR_CORE_API float* gri_fft_malloc_float(int size); + +/*! \brief Helper function for allocating double* buffers + */ +GR_CORE_API double* gri_fft_malloc_double(int size); /*! \brief Helper function for freeing fft buffers */ -void gri_fft_free(void *b); +GR_CORE_API void gri_fft_free(void *b); /*! diff --git a/gnuradio-core/src/lib/general/gri_float_to_char.cc b/gnuradio-core/src/lib/general/gri_float_to_char.cc deleted file mode 100644 index 3e779b0e70..0000000000 --- a/gnuradio-core/src/lib/general/gri_float_to_char.cc +++ /dev/null @@ -1,46 +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 - -#define _ISOC9X_SOURCE -#include <gri_float_to_char.h> -#include <math.h> - -static const int MIN_CHAR = -128; -static const int MAX_CHAR = 127; - - -void -gri_float_to_char (const float *in, char *out, int nsamples) -{ - for (int i = 0; i < nsamples; i++){ - long int r = (long int) rint (in[i]); - if (r < MIN_CHAR) - r = MIN_CHAR; - else if (r > MAX_CHAR) - r = MAX_CHAR; - out[i] = r; - } -} diff --git a/gnuradio-core/src/lib/general/gri_float_to_char.h b/gnuradio-core/src/lib/general/gri_float_to_char.h deleted file mode 100644 index 172a7da651..0000000000 --- a/gnuradio-core/src/lib/general/gri_float_to_char.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 INCLUDED_GRI_FLOAT_TO_CHAR_H -#define INCLUDED_GRI_FLOAT_TO_CHAR_H - -#include <gr_core_api.h> - -/*! - * convert array of floats to chars with rounding and saturation. - */ -GR_CORE_API void gri_float_to_char (const float *in, char *out, int nsamples); - -#endif /* INCLUDED_GRI_FLOAT_TO_CHAR_H */ diff --git a/gnuradio-core/src/lib/general/gri_float_to_int.cc b/gnuradio-core/src/lib/general/gri_float_to_int.cc deleted file mode 100644 index 525ea675d2..0000000000 --- a/gnuradio-core/src/lib/general/gri_float_to_int.cc +++ /dev/null @@ -1,47 +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 - -#define _ISOC9X_SOURCE -#include <gri_float_to_int.h> -#include <math.h> -#include <stdint.h> - -static const int64_t MAX_INT = 2147483647; // (2^31)-1 -static const int64_t MIN_INT = -2147483647; // -(2^31)-1 - - -void -gri_float_to_int (const float *in, int *out, float scale, int nsamples) -{ - for (int i = 0; i < nsamples; i++){ - int64_t r = llrintf(scale * in[i]); - if (r < MIN_INT) - r = MIN_INT; - else if (r > MAX_INT) - r = MAX_INT; - out[i] = static_cast<int>(r); - } -} diff --git a/gnuradio-core/src/lib/general/gri_float_to_int.h b/gnuradio-core/src/lib/general/gri_float_to_int.h deleted file mode 100644 index 84f72a420d..0000000000 --- a/gnuradio-core/src/lib/general/gri_float_to_int.h +++ /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. - */ - -#ifndef INCLUDED_GRI_FLOAT_TO_INT_H -#define INCLUDED_GRI_FLOAT_TO_INT_H - -#include <gr_core_api.h> - -/*! - * convert array of floats to int with rounding and saturation. - */ -GR_CORE_API void gri_float_to_int (const float *in, int *out, float scale, int nsamples); - -#endif /* INCLUDED_GRI_FLOAT_TO_INT_H */ diff --git a/gnuradio-core/src/lib/general/gri_float_to_short.cc b/gnuradio-core/src/lib/general/gri_float_to_short.cc deleted file mode 100644 index 4508e37a7d..0000000000 --- a/gnuradio-core/src/lib/general/gri_float_to_short.cc +++ /dev/null @@ -1,46 +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 - -#define _ISOC9X_SOURCE -#include <gri_float_to_short.h> -#include <math.h> - -static const int MIN_SHORT = -32768; -static const int MAX_SHORT = 32767; - - -void -gri_float_to_short (const float *in, short *out, int nsamples) -{ - for (int i = 0; i < nsamples; i++){ - long int r = (long int) rint (in[i]); - if (r < MIN_SHORT) - r = MIN_SHORT; - else if (r > MAX_SHORT) - r = MAX_SHORT; - out[i] = r; - } -} diff --git a/gnuradio-core/src/lib/general/gri_float_to_short.h b/gnuradio-core/src/lib/general/gri_float_to_short.h deleted file mode 100644 index b9cdf685be..0000000000 --- a/gnuradio-core/src/lib/general/gri_float_to_short.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 INCLUDED_GRI_FLOAT_TO_SHORT_H -#define INCLUDED_GRI_FLOAT_TO_SHORT_H - -#include <gr_core_api.h> - -/*! - * convert array of floats to shorts with rounding and saturation. - */ -GR_CORE_API void gri_float_to_short (const float *in, short *out, int nsamples); - -#endif /* INCLUDED_GRI_FLOAT_TO_SHORT_H */ diff --git a/gnuradio-core/src/lib/general/gri_float_to_uchar.cc b/gnuradio-core/src/lib/general/gri_float_to_uchar.cc deleted file mode 100644 index 9ea42a31b5..0000000000 --- a/gnuradio-core/src/lib/general/gri_float_to_uchar.cc +++ /dev/null @@ -1,46 +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 - -#define _ISOC9X_SOURCE -#include <gri_float_to_uchar.h> -#include <math.h> - -static const int MIN_UCHAR = 0; -static const int MAX_UCHAR = 255; - - -void -gri_float_to_uchar (const float *in, unsigned char *out, int nsamples) -{ - for (int i = 0; i < nsamples; i++){ - long int r = (long int) rint (in[i]); - if (r < MIN_UCHAR) - r = MIN_UCHAR; - else if (r > MAX_UCHAR) - r = MAX_UCHAR; - out[i] = r; - } -} diff --git a/gnuradio-core/src/lib/general/gri_float_to_uchar.h b/gnuradio-core/src/lib/general/gri_float_to_uchar.h deleted file mode 100644 index e24b1973fd..0000000000 --- a/gnuradio-core/src/lib/general/gri_float_to_uchar.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 INCLUDED_GRI_FLOAT_TO_UCHAR_H -#define INCLUDED_GRI_FLOAT_TO_UCHAR_H - -#include <gr_core_api.h> - -/*! - * convert array of floats to unsigned chars with rounding and saturation. - */ -GR_CORE_API void gri_float_to_uchar (const float *in, unsigned char *out, int nsamples); - -#endif /* INCLUDED_GRI_FLOAT_TO_UCHAR_H */ diff --git a/gnuradio-core/src/lib/general/gri_glfsr.cc b/gnuradio-core/src/lib/general/gri_glfsr.cc deleted file mode 100644 index ba6951882b..0000000000 --- a/gnuradio-core/src/lib/general/gri_glfsr.cc +++ /dev/null @@ -1,67 +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. - */ - -#include <gri_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 gri_glfsr::glfsr_mask(int degree) -{ - if (degree < 1 || degree > 32) - throw std::runtime_error("gri_glfsr::glfsr_mask(): degree must be between 1 and 32 inclusive"); - return s_polynomial_masks[degree]; -} diff --git a/gnuradio-core/src/lib/general/gri_glfsr.h b/gnuradio-core/src/lib/general/gri_glfsr.h deleted file mode 100644 index 9aae2d9f17..0000000000 --- a/gnuradio-core/src/lib/general/gri_glfsr.h +++ /dev/null @@ -1,57 +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_GRI_GLFSR_H -#define INCLUDED_GRI_GLFSR_H - -#include <gr_core_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 GR_CORE_API gri_glfsr -{ - private: - int d_shift_register; - int d_mask; - - public: - - gri_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_GRI_GLFSR_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_int_to_float.cc b/gnuradio-core/src/lib/general/gri_int_to_float.cc deleted file mode 100644 index 91da08897f..0000000000 --- a/gnuradio-core/src/lib/general/gri_int_to_float.cc +++ /dev/null @@ -1,37 +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 - -#define _ISOC9X_SOURCE -#include <gri_int_to_float.h> -#include <math.h> - -void -gri_int_to_float (const int *in, float *out, int nsamples) -{ - for (int i = 0; i < nsamples; i++){ - out[i] = static_cast<float>(in[i]); - } -} diff --git a/gnuradio-core/src/lib/general/gri_int_to_float.h b/gnuradio-core/src/lib/general/gri_int_to_float.h deleted file mode 100644 index 4b08b7c6be..0000000000 --- a/gnuradio-core/src/lib/general/gri_int_to_float.h +++ /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. - */ - -#ifndef INCLUDED_GRI_INT_TO_FLOAT_H -#define INCLUDED_GRI_INT_TO_FLOAT_H - -#include <gr_core_api.h> - -/* - * convert array of ints to floats - */ -GR_CORE_API void gri_int_to_float (const int *in, float *out, int nsamples); - - -#endif /* INCLUDED_GRI_INT_TO_FLOAT_H */ diff --git a/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.cc b/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.cc deleted file mode 100644 index 7d0af0fc75..0000000000 --- a/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.cc +++ /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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gri_interleaved_short_to_complex.h> -#include <assert.h> - -void -gri_interleaved_short_to_complex (const short *in, - gr_complex *out, int nsamples) -{ - assert (nsamples % 2 == 0); - - for (int i = 0; i < nsamples/2; i++){ - out[i] = gr_complex (in[i*2 + 0], in[i*2 + 1]); - } -} diff --git a/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h b/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h deleted file mode 100644 index 8d8a0d16ef..0000000000 --- a/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.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_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H -#define INCLUDED_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H - -#include <gr_core_api.h> -#include <gr_complex.h> - -/* - * convert array of interleaved shorts to complex. - * the shorts contains real, imaginary, real, imaginary... - * nsamples is the number of shorts; it must be even. - */ -GR_CORE_API void gri_interleaved_short_to_complex (const short *in, gr_complex *out, int nsamples); - -#endif /* INCLUDED_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H */ - - diff --git a/gnuradio-core/src/lib/general/gri_lfsr.h b/gnuradio-core/src/lib/general/gri_lfsr.h deleted file mode 100644 index 4202360774..0000000000 --- a/gnuradio-core/src/lib/general/gri_lfsr.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_GRI_LFSR_H -#define INCLUDED_GRI_LFSR_H - -#include <gr_core_api.h> -#include <stdexcept> -#include <stdint.h> - -/*! - * \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: gri_lfsr(int mask, int seed, int reg_len); - * - * 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 - * - * 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. - * - * 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 GR_CORE_API gri_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: - - gri_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; } -}; - -#endif /* INCLUDED_GRI_LFSR_H */ diff --git a/gnuradio-core/src/lib/general/gri_short_to_float.cc b/gnuradio-core/src/lib/general/gri_short_to_float.cc deleted file mode 100644 index d5d0e786e3..0000000000 --- a/gnuradio-core/src/lib/general/gri_short_to_float.cc +++ /dev/null @@ -1,40 +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 <gri_short_to_float.h> - -void -gri_short_to_float (const short *in, float *out, int nsamples) -{ - while (nsamples >= 4){ - out[0] = in[0]; - out[1] = in[1]; - out[2] = in[2]; - out[3] = in[3]; - out += 4; - in += 4; - nsamples -= 4; - } - - while (nsamples-- > 0) - *out++ = *in++; -} diff --git a/gnuradio-core/src/lib/general/gri_short_to_float.h b/gnuradio-core/src/lib/general/gri_short_to_float.h deleted file mode 100644 index 2ffdbb45b8..0000000000 --- a/gnuradio-core/src/lib/general/gri_short_to_float.h +++ /dev/null @@ -1,34 +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_GRI_SHORT_TO_FLOAT_H -#define INCLUDED_GRI_SHORT_TO_FLOAT_H - -#include <gr_core_api.h> - -/* - * convert array of shorts to floats - */ -GR_CORE_API void gri_short_to_float (const short *in, float *out, int nsamples); - - -#endif /* INCLUDED_GRI_SHORT_TO_FLOAT_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_uchar_to_float.cc b/gnuradio-core/src/lib/general/gri_uchar_to_float.cc deleted file mode 100644 index 91f3e7336a..0000000000 --- a/gnuradio-core/src/lib/general/gri_uchar_to_float.cc +++ /dev/null @@ -1,40 +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. - */ - -#include <gri_uchar_to_float.h> - -void -gri_uchar_to_float (const unsigned char *in, float *out, int nsamples) -{ - while (nsamples >= 4){ - out[0] = in[0]; - out[1] = in[1]; - out[2] = in[2]; - out[3] = in[3]; - out += 4; - in += 4; - nsamples -= 4; - } - - while (nsamples-- > 0) - *out++ = *in++; -} diff --git a/gnuradio-core/src/lib/general/gri_uchar_to_float.h b/gnuradio-core/src/lib/general/gri_uchar_to_float.h deleted file mode 100644 index 633c5d4ce7..0000000000 --- a/gnuradio-core/src/lib/general/gri_uchar_to_float.h +++ /dev/null @@ -1,34 +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_UCHAR_TO_FLOAT_H -#define INCLUDED_GRI_UCHAR_TO_FLOAT_H - -#include <gr_core_api.h> - -/* - * convert array of unsigned chars to floats - */ -GR_CORE_API void gri_uchar_to_float (const unsigned char *in, float *out, int nsamples); - - -#endif /* INCLUDED_GRI_UCHAR_TO_FLOAT_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/qa_general.cc b/gnuradio-core/src/lib/general/qa_general.cc index 26b21983e6..75d59434d4 100644 --- a/gnuradio-core/src/lib/general/qa_general.cc +++ b/gnuradio-core/src/lib/general/qa_general.cc @@ -28,12 +28,10 @@ #include <qa_general.h> #include <qa_gr_firdes.h> #include <qa_gr_circular_file.h> -#include <qa_gr_cpm.h> #include <qa_gr_fxpt.h> #include <qa_gr_fxpt_nco.h> #include <qa_gr_fxpt_vco.h> #include <qa_gr_math.h> -#include <qa_gri_lfsr.h> CppUnit::TestSuite * qa_general::suite () @@ -42,12 +40,10 @@ qa_general::suite () s->addTest (qa_gr_firdes::suite ()); s->addTest (qa_gr_circular_file::suite ()); - s->addTest (qa_gr_cpm::suite ()); s->addTest (qa_gr_fxpt::suite ()); s->addTest (qa_gr_fxpt_nco::suite ()); s->addTest (qa_gr_fxpt_vco::suite ()); s->addTest (qa_gr_math::suite ()); - s->addTest (qa_gri_lfsr::suite ()); return s; } diff --git a/gnuradio-core/src/lib/general/qa_gr_cpm.cc b/gnuradio-core/src/lib/general/qa_gr_cpm.cc deleted file mode 100644 index ee3e2bdea0..0000000000 --- a/gnuradio-core/src/lib/general/qa_gr_cpm.cc +++ /dev/null @@ -1,140 +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. - */ - -#include <qa_gr_cpm.h> -#include <gr_cpm.h> -#include <cppunit/TestAssert.h> - -const double DELTA = 1e-5; -const int L = 5; -const int samples_per_sym = 4; -const float taps_lrc[20] = { - 0, 0.002447174185242, 0.009549150281253, 0.020610737385376, - 0.034549150281253, 0.050000000000000, 0.065450849718747, 0.079389262614624, - 0.090450849718747, 0.097552825814758, 0.100000000000000, 0.097552825814758, - 0.090450849718747, 0.079389262614624, 0.065450849718747, 0.050000000000000, - 0.034549150281253, 0.020610737385376, 0.009549150281253, 0.002447174185242 -}; - - -const float taps_lsrc[20] = { // beta = 0.2 - 0.000000000000000, 0.009062686687436, 0.019517618142920, 0.030875041875917, - 0.042552315421249, 0.053912556756416, 0.064308860403517, 0.073130584159352, - 0.079847961304114, 0.084051371489937, 0.085482007518284, 0.084051371489937, - 0.079847961304114, 0.073130584159352, 0.064308860403517, 0.053912556756416, - 0.042552315421249, 0.030875041875917, 0.019517618142920, 0.009062686687436 -}; - - -const float taps_tfm[20] = { - -0.003946522220317, -0.005147757690530, -0.003171631690177, 0.003959659609805, - 0.017498721302356, 0.037346982678383, 0.062251889790391, 0.087364237065604, - 0.110049050955117, 0.125677762224511, 0.132288693729399, 0.125677762224511, - 0.110049050955117, 0.087364237065604, 0.062251889790391, 0.037346982678383, - 0.017498721302356, 0.003959659609805, -0.003171631690177, -0.005147757690530 -}; - - -const float taps_gaussian[20] = { // BT = 0.3 - 0.000000743866524, 0.000009286258371, 0.000085441834550, 0.000581664421923, - 0.002945540765422, 0.011178079812344, 0.032117220937421, 0.070841188736816, - 0.122053715366673, 0.167389736919915, 0.185594670675172, 0.167389736919915, - 0.122053715366673, 0.070841188736816, 0.032117220937421, 0.011178079812344, - 0.002945540765422, 0.000581664421923, 0.000085441834550, 0.000009286258371 -}; - - -// Check LREC phase response -void -qa_gr_cpm::t1 () -{ - std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LREC, samples_per_sym, L)); - - for (int i = 0; i < L * samples_per_sym; i++) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], 0.05, DELTA); - } -} - - -// Check LRC phase response -void -qa_gr_cpm::t2 () -{ - std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LRC, samples_per_sym, L)); - float sum = 0; - - for (int i = 0; i < L * samples_per_sym; i++) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_lrc[i], DELTA); - sum += taps[i]; - } - - CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); -} - - -// Check LSRC phase response -void -qa_gr_cpm::t3 () -{ - std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LSRC, samples_per_sym, L, 0.2)); - float sum = 0; - - for (int i = 0; i < L * samples_per_sym; i++) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_lsrc[i], DELTA); - sum += taps[i]; - } - - CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); -} - - -// Check the TFM phase response -void -qa_gr_cpm::t4 () -{ - std::vector<float> taps(gr_cpm::phase_response(gr_cpm::TFM, samples_per_sym, L)); - float sum = 0; - - for (int i = 0; i < L * samples_per_sym; i++) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_tfm[i], DELTA); - sum += taps[i]; - } - - CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); -} - - -// Check the Gaussian phase response -void -qa_gr_cpm::t5 () -{ - std::vector<float> taps(gr_cpm::phase_response(gr_cpm::GAUSSIAN, samples_per_sym, L, 0.3)); - float sum = 0; - - for (int i = 0; i < L * samples_per_sym; i++) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_gaussian[i], DELTA); - sum += taps[i]; - } - - CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); -} - diff --git a/gnuradio-core/src/lib/general/qa_gr_cpm.h b/gnuradio-core/src/lib/general/qa_gr_cpm.h deleted file mode 100644 index 2f46b42a78..0000000000 --- a/gnuradio-core/src/lib/general/qa_gr_cpm.h +++ /dev/null @@ -1,49 +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 _QA_GR_CPM_H -#define _QA_GR_CPM_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_cpm : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_cpm); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST (t4); - CPPUNIT_TEST (t5); - CPPUNIT_TEST_SUITE_END (); - - private: - void t1 (); - void t2 (); - void t3 (); - void t4 (); - void t5 (); - -}; - - -#endif /* _QA_GR_CPM_H */ - diff --git a/gnuradio-core/src/lib/general/qa_gri_lfsr.cc b/gnuradio-core/src/lib/general/qa_gri_lfsr.cc deleted file mode 100644 index 87d610df68..0000000000 --- a/gnuradio-core/src/lib/general/qa_gri_lfsr.cc +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 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 <gri_lfsr.h> -#include <qa_gri_lfsr.h> -#include <cppunit/TestAssert.h> -#include <stdio.h> -#include <string.h> -#include <vector> - -void -qa_gri_lfsr::test_lfsr () -{ - int mask = 0x19; - int seed = 0x01; - int length = 5; - - gri_lfsr lfsr1(mask,seed,length); - gri_lfsr lfsr2(mask,seed,length); - - unsigned char expected[] = {1, 0, 1, 1, 0, 1, 0, 1, 0, 0}; - - for(unsigned int i=0; i<31; i++){ - lfsr1.next_bit(); - } - - // test that after one lfsr cycle we still match out uncycled lfsr - for (unsigned int i = 0; i < 41; i++) { - CPPUNIT_ASSERT_EQUAL((int) lfsr1.next_bit(), (int) lfsr2.next_bit()); - } - - // test the known correct values at the given shift offset - for(unsigned int i=0; i<10; i++){ - CPPUNIT_ASSERT_EQUAL((int) lfsr1.next_bit(), (int) expected[i]); - } - - // test for register length too long - CPPUNIT_ASSERT_THROW(gri_lfsr(mask, seed, 32), std::invalid_argument); -} - -void -qa_gri_lfsr::test_scrambler() -{ - // CCSDS 7-bit scrambler - int mask = 0x8A; - int seed = 0x7F; - int length = 7; - - gri_lfsr scrambler(mask, seed, length); - - // Impulse (1 and 126 more zeroes) - unsigned char src[] = - { 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, 0, 0, 0, 0, 0 }; // flush bits - - // Impulse response (including leading bits) - unsigned char expected[] = - { 1, 1, 1, 1, 1, 1, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, - 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, - 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, - 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, - 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, - 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, - 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, }; - - int len = sizeof(src); - std::vector<unsigned char> actual(len); - - for (int i = 0; i < len; i++) - actual[i] = scrambler.next_bit_scramble(src[i]); - - CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0); -} - -void -qa_gri_lfsr::test_descrambler() -{ - // CCSDS 7-bit scrambler - int mask = 0x8A; - int seed = 0x7F; - int length = 7; - - gri_lfsr descrambler(mask, seed, length); - - // Scrambled sequence (impulse response) - unsigned char src[] = - { 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, - 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, - 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, - 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, - 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, - 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, - 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0 }; - - // Original (garbage while synchronizing, them impulse) - unsigned char expected[] = - { 0, 1, 0, 0, 1, 0, - 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 }; - - int len = sizeof(src); - std::vector<unsigned char> actual(len); - - for (int i = 0; i < len; i++) - actual[i] = descrambler.next_bit_descramble(src[i]); - - CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0); -} diff --git a/gnuradio-core/src/lib/general/qa_gri_lfsr.h b/gnuradio-core/src/lib/general/qa_gri_lfsr.h deleted file mode 100644 index e91843bbb3..0000000000 --- a/gnuradio-core/src/lib/general/qa_gri_lfsr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ -#ifndef _QA_GRI_LFSR_H_ -#define _QA_GRI_LFSR_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_lfsr : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE(qa_gri_lfsr); - CPPUNIT_TEST(test_lfsr); - CPPUNIT_TEST(test_scrambler); - CPPUNIT_TEST(test_descrambler); - CPPUNIT_TEST_SUITE_END(); - - private: - void test_lfsr(); - void test_scrambler(); - void test_descrambler(); -}; - -#endif /* _QA_GRI_LFSR_H_ */ diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt index db3103a26a..d018876183 100644 --- a/gnuradio-core/src/lib/gengen/CMakeLists.txt +++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt @@ -84,32 +84,14 @@ endmacro(expand_h_cc_i) expand_h_cc_i(gr_vector_source_X b s i f c) expand_h_cc_i(gr_vector_insert_X b) expand_h_cc_i(gr_vector_sink_X b s i f c) -expand_h_cc_i(gr_noise_source_X s i f c) -expand_h_cc_i(gr_fastnoise_source_X s i f c) -expand_h_cc_i(gr_sig_source_X s i f c) expand_h_cc_i(gr_probe_signal_X b s i f c) expand_h_cc_i(gr_probe_signal_vX b s i f c) -expand_h_cc_i(gr_add_const_XX bb ss ii ff cc sf) -expand_h_cc_i(gr_multiply_const_XX ss ii) -expand_h_cc_i(gr_add_XX ss ii cc) -expand_h_cc_i(gr_sub_XX ss ii ff cc) -expand_h_cc_i(gr_multiply_XX ss ii) -expand_h_cc_i(gr_divide_XX ss ii ff cc) expand_h_cc_i(gr_mute_XX ss ii ff cc) -expand_h_cc_i(gr_add_const_vXX ss ii ff cc) -expand_h_cc_i(gr_multiply_const_vXX ss ii ff cc) -expand_h_cc_i(gr_integrate_XX ss ii ff cc) expand_h_cc_i(gr_moving_average_XX ss ii ff cc) -expand_h_cc_i(gr_chunks_to_symbols_XX bf bc sf sc if ic) expand_h_cc_i(gr_unpacked_to_packed_XX bb ss ii) expand_h_cc_i(gr_packed_to_unpacked_XX bb ss ii) -expand_h_cc_i(gr_xor_XX bb ss ii) -expand_h_cc_i(gr_and_XX bb ss ii) -expand_h_cc_i(gr_and_const_XX bb ss ii) -expand_h_cc_i(gr_or_XX bb ss ii) -expand_h_cc_i(gr_not_XX bb ss ii) expand_h_cc_i(gr_sample_and_hold_XX bb ss ii ff) expand_h_cc_i(gr_argmax_XX fs is ss) expand_h_cc_i(gr_max_XX ff ii ss) @@ -157,15 +139,13 @@ list(APPEND gnuradio_core_sources install(FILES ${generated_gengen_includes} ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_noise_type.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sig_source_waveform.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel" ) if(ENABLE_PYTHON) install(FILES - ${generated_gengen_swigs} + ${generated_gengen_swigs} ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.i ${CMAKE_CURRENT_SOURCE_DIR}/gengen.i ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py index 13d01b0f90..6a04a75d72 100755 --- a/gnuradio-core/src/lib/gengen/generate_common.py +++ b/gnuradio-core/src/lib/gengen/generate_common.py @@ -32,8 +32,6 @@ ss_signatures = ['s', 'i', 'f', 'c'] ss_roots = [ 'gr_vector_source_X', 'gr_vector_sink_X', - 'gr_noise_source_X', - 'gr_sig_source_X', 'gr_probe_signal_X', 'gr_probe_signal_vX' ] @@ -42,33 +40,18 @@ ss_roots = [ reg_signatures = ['ss', 'ii', 'ff', 'cc'] reg_roots = [ - 'gr_add_const_XX', - 'gr_sub_XX', - 'gr_divide_XX', 'gr_mute_XX', - 'gr_add_const_vXX', - 'gr_multiply_const_vXX', - 'gr_integrate_XX', 'gr_moving_average_XX', ] # other blocks others = ( - ('gr_chunks_to_symbols_XX', ('bf', 'bc', 'sf', 'sc', 'if', 'ic')), ('gr_unpacked_to_packed_XX', ('bb','ss','ii')), ('gr_packed_to_unpacked_XX', ('bb','ss','ii')), - ('gr_xor_XX', ('bb','ss','ii')), - ('gr_and_XX', ('bb','ss','ii')), - ('gr_and_const_XX', ('bb','ss','ii')), - ('gr_or_XX', ('bb','ss','ii')), - ('gr_not_XX', ('bb','ss','ii')), ('gr_sample_and_hold_XX', ('bb','ss','ii','ff')), ('gr_argmax_XX', ('fs','is','ss')), ('gr_max_XX', ('ff','ii','ss')), ('gr_peak_detector_XX', ('fb','ib','sb')), - ('gr_multiply_XX', ('ss','ii')), - ('gr_multiply_const_XX', ('ss','ii')), - ('gr_add_XX', ('ss','cc','ii')) ) @@ -82,7 +65,6 @@ def expand_h_cc_i (root, sig): def generate (): - expand_h_cc_i ('gr_add_const_XX', 'sf') # for MC4020 expand_h_cc_i ('gr_vector_sink_X', 'b') expand_h_cc_i ('gr_vector_source_X', 'b') expand_h_cc_i ('gr_probe_signal_X', 'b') diff --git a/gnuradio-core/src/lib/gengen/gengen.i b/gnuradio-core/src/lib/gengen/gengen.i index d1895bfa83..7d8c27fe68 100644 --- a/gnuradio-core/src/lib/gengen/gengen.i +++ b/gnuradio-core/src/lib/gengen/gengen.i @@ -22,12 +22,8 @@ %{ #include "gr_endianness.h" -#include "gr_sig_source_waveform.h" -#include "gr_noise_type.h" %} %include "gr_endianness.i" -%include "gr_sig_source_waveform.h" -%include "gr_noise_type.h" %include "gengen_generated.i" diff --git a/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t deleted file mode 100644 index 5a888125bf..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (size_t vlen) -{ - return gnuradio::get_initial_sptr (new @NAME@ (vlen)); -} - -@NAME@::@NAME@ (size_t vlen) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), - d_vlen (vlen) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int ninputs = input_items.size (); - - for (size_t i = 0; i < noutput_items*d_vlen; i++){ - @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i]; - for (int j = 1; j < ninputs; j++) - acc += ((@I_TYPE@ *) input_items[j])[i]; - - *optr++ = (@O_TYPE@) acc; - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_add_XX.h.t b/gnuradio-core/src/lib/gengen/gr_add_XX.h.t deleted file mode 100644 index cd6d80cd9a..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_add_XX.h.t +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); - -/*! - * \brief output = sum (input_0, input_1, ...) - * \ingroup math_blk - * - * Add across all input streams. - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); - - @NAME@ (size_t vlen); - - size_t d_vlen; - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_add_XX.i.t b/gnuradio-core/src/lib/gengen/gr_add_XX.i.t deleted file mode 100644 index b2c5106106..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_add_XX.i.t +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (size_t vlen); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_const_XX.cc.t deleted file mode 100644 index 3dccc86b80..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_add_const_XX.cc.t +++ /dev/null @@ -1,72 +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> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (@O_TYPE@ k) -{ - return gnuradio::get_initial_sptr (new @NAME@ (k)); -} - -@NAME@::@NAME@ (@O_TYPE@ k) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_k (k) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0]; - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int size = noutput_items; - - while (size >= 8){ - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - size -= 8; - } - - while (size-- > 0) - *optr++ = *iptr++ + d_k; - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_XX.h.t b/gnuradio-core/src/lib/gengen/gr_add_const_XX.h.t deleted file mode 100644 index 00d2c9b587..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_add_const_XX.h.t +++ /dev/null @@ -1,56 +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 <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); - -/*! - * \brief output = input + constant - * \ingroup math_blk - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); - - @O_TYPE@ d_k; // the constant - @NAME@ (@O_TYPE@ k); - - public: - @O_TYPE@ k () const { return d_k; } - void set_k (@O_TYPE@ k) { d_k = k; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_XX.i.t b/gnuradio-core/src/lib/gengen/gr_add_const_XX.i.t deleted file mode 100644 index b7921554e5..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_add_const_XX.i.t +++ /dev/null @@ -1,37 +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(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (@TYPE@ k); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (@TYPE@ k); - - public: - @TYPE@ k () const { return d_k; } - void set_k (@TYPE@ k) { d_k = k; } -}; diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t deleted file mode 100755 index b29f3014d8..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k) -{ - return gnuradio::get_initial_sptr (new @NAME@ (k)); -} - -@NAME@::@NAME@ (const std::vector<@I_TYPE@> &k) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof(@I_TYPE@)*k.size()), - gr_make_io_signature (1, 1, sizeof(@O_TYPE@)*k.size())) -{ - d_k = k; -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @I_TYPE@ *iptr = (@O_TYPE@ *)input_items[0]; - @O_TYPE@ *optr = (@O_TYPE@ *)output_items[0]; - - int nitems_per_block = output_signature()->sizeof_stream_item(0)/sizeof(@I_TYPE@); - - for (int i = 0; i < noutput_items; i++) - for (int j = 0; j < nitems_per_block; j++) - *optr++ = *iptr++ + d_k[j]; - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t deleted file mode 100644 index 438a84bfdd..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); - -/*! - * \brief output vector = input vector + constant vector - * \ingroup math_blk - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); - - std::vector<@I_TYPE@> d_k; // the constant - @NAME@ (const std::vector<@I_TYPE@> &k); - - public: - const std::vector<@I_TYPE@> k () const { return d_k; } - void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t deleted file mode 100755 index e0e6ae9051..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (const std::vector<@I_TYPE@> &k); - - public: - std::vector<@I_TYPE@> k () const { return d_k; } - void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; } -}; diff --git a/gnuradio-core/src/lib/gengen/gr_and_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_and_XX.cc.t deleted file mode 100644 index 9d60e092af..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_and_XX.cc.t +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ () -{ - return gnuradio::get_initial_sptr (new @NAME@ ()); -} - -@NAME@::@NAME@ () - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int ninputs = input_items.size (); - - for (int i = 0; i < noutput_items; i++) { - @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i]; - for (int j = 1; j < ninputs; j++) - acc = acc & ((@I_TYPE@ *) input_items[j])[i]; - - *optr++ = (@O_TYPE@) acc; - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_and_XX.h.t b/gnuradio-core/src/lib/gengen/gr_and_XX.h.t deleted file mode 100644 index 2247780968..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_and_XX.h.t +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); - -/*! - * \brief output = input_0 & input_1 & , ... & input_N) - * \ingroup math_blk - * - * bitwise boolean and across all input streams. - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); - - @NAME@ (); - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_and_XX.i.t b/gnuradio-core/src/lib/gengen/gr_and_XX.i.t deleted file mode 100644 index 06db5ca59d..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_and_XX.i.t +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_and_const_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_and_const_XX.cc.t deleted file mode 100644 index d4f9a4b613..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_and_const_XX.cc.t +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (@I_TYPE@ k) -{ - return gnuradio::get_initial_sptr (new @NAME@ (k)); -}; - -@NAME@::@NAME@ (@I_TYPE@ k) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_k (k) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0]; - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int size = noutput_items; - - while (size >= 8) { - *optr++ = *iptr++ & d_k; - *optr++ = *iptr++ & d_k; - *optr++ = *iptr++ & d_k; - *optr++ = *iptr++ & d_k; - *optr++ = *iptr++ & d_k; - *optr++ = *iptr++ & d_k; - *optr++ = *iptr++ & d_k; - *optr++ = *iptr++ & d_k; - size -= 8; - } - - while (size-- > 0) - *optr++ = *iptr++ & d_k; - - return (noutput_items); -} diff --git a/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t b/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t deleted file mode 100644 index b331f33ccd..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t +++ /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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); - -/*! - * \brief output_N = input_N & value - * \ingroup math_blk - * - * bitwise boolean and of const to the data stream. - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); - - @O_TYPE@ d_k; // the constant - @NAME@ (@O_TYPE@ k); - - public: - @O_TYPE@ k () const { return d_k; } - void set_k (@O_TYPE@ k) { d_k = k; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_and_const_XX.i.t b/gnuradio-core/src/lib/gengen/gr_and_const_XX.i.t deleted file mode 100644 index c797c45eb7..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_and_const_XX.i.t +++ /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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (@O_TYPE@ k); - - public: - @O_TYPE@ k () const { return d_k; } - void set_k (@O_TYPE@ k) { d_k = k; } -}; diff --git a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.cc.t deleted file mode 100644 index 4a642c13e2..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.cc.t +++ /dev/null @@ -1,74 +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 <string.h> - -@SPTR_NAME@ -gr_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/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t deleted file mode 100644 index 17d5688b86..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.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@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_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 onstellation points.in \p D dimensions (\p 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 gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc. - * \sa gr_chunks_to_symbols_sf, gr_chunks_to_symbols_sc. - */ - -class GR_CORE_API @NAME@ : public gr_sync_interpolator -{ - friend GR_CORE_API @SPTR_NAME@ gr_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/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.i.t b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.i.t deleted file mode 100644 index 14c8be4863..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.i.t +++ /dev/null @@ -1,37 +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(gr,@BASE_NAME@); - -@SPTR_NAME@ gr_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/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t deleted file mode 100644 index 63450cb3df..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (size_t vlen) -{ - return gnuradio::get_initial_sptr (new @NAME@ (vlen)); -} - -@NAME@::@NAME@ (size_t vlen) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), - d_vlen (vlen) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int ninputs = input_items.size (); - - if (ninputs == 1){ // compute reciprocal - for (size_t i = 0; i < noutput_items*d_vlen; i++) - *optr++ = (@O_TYPE@) ((@O_TYPE@) 1 / - ((@I_TYPE@ *) input_items[0])[i]); - } - - else { - for (size_t i = 0; i < noutput_items*d_vlen; i++){ - @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i]; - for (int j = 1; j < ninputs; j++) - acc /= ((@I_TYPE@ *) input_items[j])[i]; - - *optr++ = (@O_TYPE@) acc; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t deleted file mode 100644 index 40ee27a51d..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); - -/*! - * \brief output = input_0 / input_1 / input_x ...) - * \ingroup math_blk - * - * Divide across all input streams. - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); - - @NAME@ (size_t vlen); - - size_t d_vlen; - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t deleted file mode 100644 index b2c5106106..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (size_t vlen); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.cc.t deleted file mode 100644 index 7be7bdde86..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.cc.t +++ /dev/null @@ -1,116 +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 <stdexcept> - - -@NAME@_sptr -gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed, long samples) -{ - return gnuradio::get_initial_sptr(new @NAME@ (type, ampl, seed, samples)); -} - - -@NAME@::@NAME@ (gr_noise_type_t type, float ampl, long seed, long samples) - : 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) -{ - d_samples.resize(samples); - generate(); -} - -void -@NAME@::generate() -{ - int noutput_items = d_samples.size(); - switch (d_type){ -#if @IS_COMPLEX@ // complex? - - case GR_UNIFORM: - for (int i = 0; i < noutput_items; i++) - d_samples[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++) - d_samples[i] = d_ampl * d_rng.rayleigh_complex (); - break; - -#else // nope... - - case GR_UNIFORM: - for (int i = 0; i < noutput_items; i++) - d_samples[i] = (@TYPE@)(d_ampl * ((d_rng.ran1 () * 2.0) - 1.0)); - break; - - case GR_GAUSSIAN: - for (int i = 0; i < noutput_items; i++) - d_samples[i] = (@TYPE@)(d_ampl * d_rng.gasdev ()); - break; - - case GR_LAPLACIAN: - for (int i = 0; i < noutput_items; i++) - d_samples[i] = (@TYPE@)(d_ampl * d_rng.laplacian ()); - break; - - case GR_IMPULSE: // FIXME changeable impulse settings - for (int i = 0; i < noutput_items; i++) - d_samples[i] = (@TYPE@)(d_ampl * d_rng.impulse (9)); - break; -#endif - - default: - throw std::runtime_error ("invalid type"); - } - -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @TYPE@ *out = (@TYPE@ *) output_items[0]; - - for(int i=0; i<noutput_items; i++){ -#ifdef __USE_GNU - size_t idx = lrand48() % d_samples.size(); -#else - size_t idx = rand() % d_samples.size(); -#endif - out[i] = d_samples[idx]; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.h.t deleted file mode 100644 index 007e449759..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.h.t +++ /dev/null @@ -1,87 +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 <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_noise_type.h> -#include <gr_random.h> - - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @NAME@_sptr; - -/*! \brief Make a noise source - * \param type the random distribution to use (see gr_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. - * \param samples number of samples to pre-generate. - */ -GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples=1024*16); - -/*! - * \brief Random number source - * \ingroup source_blk - * - * \details - * Generate random values from different distributions. - * Currently, only Gaussian and uniform are enabled. - * - * \param type the random distribution to use (see gr_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. - * \param samples number of samples to pre-generate. - */ -class GR_CORE_API @NAME@ : public gr_sync_block { - friend GR_CORE_API @NAME@_sptr - - gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed, long samples); - - gr_noise_type_t d_type; - float d_ampl; - gr_random d_rng; - std::vector<@TYPE@> d_samples; - - @NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples=1024*16); - - public: - void set_type (gr_noise_type_t type) { d_type = type; generate(); } - void set_amplitude (float ampl) { d_ampl = ampl; generate(); } - void generate(); - - gr_noise_type_t type () const { return d_type; } - float amplitude () const { return d_ampl; } - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.i.t deleted file mode 100644 index e1f7c775be..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_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(gr,@BASE_NAME@); - -@NAME@_sptr -gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples = 1024*16); - -class @NAME@ : public gr_block { - private: - @NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples = 1024*16); - - public: - void set_type (gr_noise_type_t type) { d_type = type; } - void set_amplitude (float ampl) { d_ampl = ampl; } - - gr_noise_type_t type () const { return d_type; } - float amplitude () const { return d_ampl; } -}; diff --git a/gnuradio-core/src/lib/gengen/gr_integrate_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_integrate_XX.cc.t deleted file mode 100644 index 1dbee49db9..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_integrate_XX.cc.t +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (int decim) -{ - return gnuradio::get_initial_sptr (new @NAME@ (decim)); -} - -@NAME@::@NAME@ (int decim) - : gr_sync_decimator ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)), - decim), - d_decim(decim), - d_count(0) -{ -} - -@NAME@::~@NAME@ () -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) { - out[i] = (@O_TYPE@)0; - for (int j = 0; j < d_decim; j++) - out[i] += in[i*d_decim+j]; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_integrate_XX.h.t b/gnuradio-core/src/lib/gengen/gr_integrate_XX.h.t deleted file mode 100644 index abb13ea904..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_integrate_XX.h.t +++ /dev/null @@ -1,61 +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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class @NAME@; - -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decim); - -/*! - * \brief output = sum(input[0]...input[n]) - * \ingroup math_blk - * - * Integrate successive samples in input stream and decimate - */ -class GR_CORE_API @NAME@ : public gr_sync_decimator -{ -private: - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@(int decim); - - @NAME@ (int decim); - - int d_decim; - int d_count; - -public: - ~@NAME@ (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/gengen/gr_integrate_XX.i.t b/gnuradio-core/src/lib/gengen/gr_integrate_XX.i.t deleted file mode 100644 index a96e5fd29d..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_integrate_XX.i.t +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int decim); - -class @NAME@ : public gr_sync_decimator -{ -private: - @NAME@ (); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t deleted file mode 100644 index a60118e14c..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (size_t vlen) -{ - return gnuradio::get_initial_sptr (new @NAME@ (vlen)); -} - -@NAME@::@NAME@ (size_t vlen) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), - d_vlen (vlen) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int ninputs = input_items.size (); - - for (size_t i = 0; i < noutput_items*d_vlen; i++){ - @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i]; - for (int j = 1; j < ninputs; j++) - acc *= ((@I_TYPE@ *) input_items[j])[i]; - - *optr++ = (@O_TYPE@) acc; - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_XX.h.t b/gnuradio-core/src/lib/gengen/gr_multiply_XX.h.t deleted file mode 100644 index 18ec6d0beb..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_multiply_XX.h.t +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); - -/*! - * \brief output = prod (input_0, input_1, ...) - * \ingroup math_blk - * - * Multiply across all input streams. - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); - - @NAME@ (size_t vlen); - - size_t d_vlen; - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_XX.i.t b/gnuradio-core/src/lib/gengen/gr_multiply_XX.i.t deleted file mode 100644 index b2c5106106..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_multiply_XX.i.t +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (size_t vlen); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.cc.t deleted file mode 100644 index 424b62412c..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.cc.t +++ /dev/null @@ -1,72 +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> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (@O_TYPE@ k) -{ - return gnuradio::get_initial_sptr (new @NAME@ (k)); -} - -@NAME@::@NAME@ (@O_TYPE@ k) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_k (k) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0]; - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int size = noutput_items; - - while (size >= 8){ - *optr++ = *iptr++ * d_k; - *optr++ = *iptr++ * d_k; - *optr++ = *iptr++ * d_k; - *optr++ = *iptr++ * d_k; - *optr++ = *iptr++ * d_k; - *optr++ = *iptr++ * d_k; - *optr++ = *iptr++ * d_k; - *optr++ = *iptr++ * d_k; - size -= 8; - } - - while (size-- > 0) - *optr++ = *iptr++ * d_k; - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.h.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.h.t deleted file mode 100644 index 274fc3b998..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.h.t +++ /dev/null @@ -1,56 +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 <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); - -/*! - * \brief output = input * constant - * \ingroup math_blk - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); - - @O_TYPE@ d_k; // the constant - @NAME@ (@O_TYPE@ k); - - public: - @O_TYPE@ k () const { return d_k; } - void set_k (@O_TYPE@ k) { d_k = k; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.i.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.i.t deleted file mode 100644 index b7921554e5..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.i.t +++ /dev/null @@ -1,37 +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(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (@TYPE@ k); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (@TYPE@ k); - - public: - @TYPE@ k () const { return d_k; } - void set_k (@TYPE@ k) { d_k = k; } -}; diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t deleted file mode 100755 index eb896dee53..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k) -{ - return gnuradio::get_initial_sptr (new @NAME@ (k)); -} - -@NAME@::@NAME@ (const std::vector<@I_TYPE@> &k) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof(@I_TYPE@)*k.size()), - gr_make_io_signature (1, 1, sizeof(@O_TYPE@)*k.size())) -{ - d_k = k; -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @I_TYPE@ *iptr = (@O_TYPE@ *)input_items[0]; - @O_TYPE@ *optr = (@O_TYPE@ *)output_items[0]; - - int nitems_per_block = output_signature()->sizeof_stream_item(0)/sizeof(@I_TYPE@); - - for (int i = 0; i < noutput_items; i++) - for (int j = 0; j < nitems_per_block; j++) - *optr++ = *iptr++ * d_k[j]; - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t deleted file mode 100644 index 2c6edd3642..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); - -/*! - * \brief output vector = input vector * constant vector (element-wise) - * \ingroup math_blk - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); - - std::vector<@I_TYPE@> d_k; // the constant - @NAME@ (const std::vector<@I_TYPE@> &k); - - public: - const std::vector<@I_TYPE@> k () const { return d_k; } - void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t deleted file mode 100755 index e0e6ae9051..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (const std::vector<@I_TYPE@> &k); - - public: - std::vector<@I_TYPE@> k () const { return d_k; } - void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; } -}; diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_noise_source_X.cc.t deleted file mode 100644 index 3078f6366e..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_noise_source_X.cc.t +++ /dev/null @@ -1,99 +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 <stdexcept> - - -@NAME@_sptr -gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed) -{ - return gnuradio::get_initial_sptr(new @NAME@ (type, ampl, seed)); -} - - -@NAME@::@NAME@ (gr_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) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @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; -} diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t deleted file mode 100644 index 31ffb2b169..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t +++ /dev/null @@ -1,83 +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 <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_noise_type.h> -#include <gr_random.h> - - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @NAME@_sptr; - -/*! \brief Make a noise source - * \param type the random distribution to use (see gr_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. - */ -GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0); - -/*! - * \brief Random number source - * \ingroup source_blk - * - * \details - * Generate random values from different distributions. - * Currently, only Gaussian and uniform are enabled. - * - * \param type the random distribution to use (see gr_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. - */ -class GR_CORE_API @NAME@ : public gr_sync_block { - friend GR_CORE_API @NAME@_sptr - - gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed); - - gr_noise_type_t d_type; - float d_ampl; - gr_random d_rng; - - @NAME@ (gr_noise_type_t type, float ampl, long seed = 0); - - public: - void set_type (gr_noise_type_t type) { d_type = type; } - void set_amplitude (float ampl) { d_ampl = ampl; } - - gr_noise_type_t type () const { return d_type; } - float amplitude () const { return d_ampl; } - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t deleted file mode 100644 index df27ab79b6..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_noise_source_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(gr,@BASE_NAME@); - -@NAME@_sptr -gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0); - -class @NAME@ : public gr_block { - private: - @NAME@ (gr_noise_type_t type, float ampl, long seed = 0); - - public: - void set_type (gr_noise_type_t type) { d_type = type; } - void set_amplitude (float ampl) { d_ampl = ampl; } - - gr_noise_type_t type () const { return d_type; } - float amplitude () const { return d_ampl; } -}; diff --git a/gnuradio-core/src/lib/gengen/gr_noise_type.h b/gnuradio-core/src/lib/gengen/gr_noise_type.h deleted file mode 100644 index d2aba9b0c7..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_noise_type.h +++ /dev/null @@ -1,30 +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_GR_NOISE_TYPE_H -#define INCLUDED_GR_NOISE_TYPE_H - -typedef enum { - GR_UNIFORM = 200, GR_GAUSSIAN, GR_LAPLACIAN, GR_IMPULSE -} gr_noise_type_t; - -#endif /* INCLUDED_GR_NOISE_TYPE_H */ diff --git a/gnuradio-core/src/lib/gengen/gr_not_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_not_XX.cc.t deleted file mode 100644 index 4806b142f2..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_not_XX.cc.t +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ () -{ - return gnuradio::get_initial_sptr (new @NAME@ ()); -} - -@NAME@::@NAME@ () - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - const @I_TYPE@ *inptr = (const @I_TYPE@ *) input_items[0]; - - - for (int i = 0; i < noutput_items; i++) { - *optr++ = ~(inptr[i]); - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_not_XX.h.t b/gnuradio-core/src/lib/gengen/gr_not_XX.h.t deleted file mode 100644 index aff4211099..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_not_XX.h.t +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); - -/*! - * \brief output = ~input_0 - * \ingroup math_blk - * - * bitwise boolean not across input stream. - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); - - @NAME@ (); - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_not_XX.i.t b/gnuradio-core/src/lib/gengen/gr_not_XX.i.t deleted file mode 100644 index 06db5ca59d..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_not_XX.i.t +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_or_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_or_XX.cc.t deleted file mode 100644 index ee55eedda4..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_or_XX.cc.t +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ () -{ - return gnuradio::get_initial_sptr (new @NAME@ ()); -} - -@NAME@::@NAME@ () - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int ninputs = input_items.size (); - - for (int i = 0; i < noutput_items; i++) { - @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i]; - for (int j = 1; j < ninputs; j++) - acc = acc | ((@I_TYPE@ *) input_items[j])[i]; - - *optr++ = (@O_TYPE@) acc; - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_or_XX.h.t b/gnuradio-core/src/lib/gengen/gr_or_XX.h.t deleted file mode 100644 index 8860eedd50..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_or_XX.h.t +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); - -/*! - * \brief output = input_0 | input_1 | , ... | input_N) - * \ingroup math_blk - * - * bitwise boolean or across all input streams. - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); - - @NAME@ (); - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_or_XX.i.t b/gnuradio-core/src/lib/gengen/gr_or_XX.i.t deleted file mode 100644 index 06db5ca59d..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_or_XX.i.t +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t deleted file mode 100644 index 6959eac824..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t +++ /dev/null @@ -1,241 +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 <algorithm> -#include <gr_io_signature.h> -#include <stdexcept> -#include <algorithm> -#include <gr_complex.h> - - -@NAME@::@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); -} - -@NAME@_sptr -gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform, - double frequency, double ampl, @TYPE@ offset) -{ - return gnuradio::get_initial_sptr(new @NAME@ (sampling_freq, waveform, frequency, ampl, offset)); -} - -int -@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; -} - diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t deleted file mode 100644 index baa82dbe20..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t +++ /dev/null @@ -1,82 +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 <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_sig_source_waveform.h> -#include <gr_fxpt_nco.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @NAME@_sptr; - -/*! - * \brief signal generator with @TYPE@ output. - * \ingroup source_blk - */ - -class GR_CORE_API @NAME@ : public gr_sync_block { - friend GR_CORE_API @NAME@_sptr - gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform, - double frequency, double ampl, @TYPE@ offset); - - double d_sampling_freq; - gr_waveform_t d_waveform; - double d_frequency; - double d_ampl; - @TYPE@ d_offset; - gr_fxpt_nco d_nco; - - - @NAME@ (double sampling_freq, gr_waveform_t waveform, - double wave_freq, double ampl, @TYPE@ offset); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // ACCESSORS - 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; } - - // MANIPULATORS - 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); -}; - -GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform, - double wave_freq, double ampl, @TYPE@ offset = 0); - - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_sig_source_X.i.t deleted file mode 100644 index 7bd85fcb81..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_sig_source_X.i.t +++ /dev/null @@ -1,52 +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(gr,@BASE_NAME@); - -@NAME@_sptr -gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform, - double wave_freq, double ampl, @TYPE@ offset = 0); - - -class @NAME@ : public gr_sync_block { - private: - @NAME@ (double sampling_freq, gr_waveform_t waveform, - double wave_freq, double ampl, @TYPE@ offset); - - public: - - // ACCESSORS - 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; } - - // MANIPULATORS - 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); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h b/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h deleted file mode 100644 index 9fe233ba4a..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h +++ /dev/null @@ -1,29 +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_GR_SIG_SOURCE_WAVEFORM_H -#define INCLUDED_GR_SIG_SOURCE_WAVEFORM_H - -typedef enum { - GR_CONST_WAVE = 100, GR_SIN_WAVE, GR_COS_WAVE, GR_SQR_WAVE, GR_TRI_WAVE, GR_SAW_WAVE -} gr_waveform_t; - -#endif /* INCLUDED_GR_SIG_SOURCE_WAVEFORM_H */ diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t deleted file mode 100644 index 11eb7440e0..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (size_t vlen) -{ - return gnuradio::get_initial_sptr (new @NAME@ (vlen)); -} - -@NAME@::@NAME@ (size_t vlen) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)), - d_vlen (vlen) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int ninputs = input_items.size (); - - if (ninputs == 1){ // negate - for (size_t i = 0; i < noutput_items*d_vlen; i++) - *optr++ = (@O_TYPE@) -((@I_TYPE@ *) input_items[0])[i]; - } - - else { - for (size_t i = 0; i < noutput_items*d_vlen; i++){ - @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i]; - for (int j = 1; j < ninputs; j++) - acc -= ((@I_TYPE@ *) input_items[j])[i]; - - *optr++ = (@O_TYPE@) acc; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t deleted file mode 100644 index f96c934845..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); - -/*! - * \brief output = input_0 - input_1 - ...) - * \ingroup math_blk - * - * Subtract across all input streams. - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); - - @NAME@ (size_t vlen); - - size_t d_vlen; - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t deleted file mode 100644 index b2c5106106..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004, 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (size_t vlen); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_xor_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_xor_XX.cc.t deleted file mode 100644 index d6990aa4f5..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_xor_XX.cc.t +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ () -{ - return gnuradio::get_initial_sptr (new @NAME@ ()); -} - -@NAME@::@NAME@ () - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int ninputs = input_items.size (); - - for (int i = 0; i < noutput_items; i++) { - @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i]; - for (int j = 1; j < ninputs; j++) - acc = acc ^ ((@I_TYPE@ *) input_items[j])[i]; - - *optr++ = (@O_TYPE@) acc; - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_xor_XX.h.t b/gnuradio-core/src/lib/gengen/gr_xor_XX.h.t deleted file mode 100644 index 8fe47d9e00..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_xor_XX.h.t +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); - -/*! - * \brief output = input_0 ^ input_1 ^ , ... ^ input_N) - * \ingroup math_blk - * - * bitwise boolean xor across all input streams. - */ -class GR_CORE_API @NAME@ : public gr_sync_block -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); - - @NAME@ (); - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_xor_XX.i.t b/gnuradio-core/src/lib/gengen/gr_xor_XX.i.t deleted file mode 100644 index 06db5ca59d..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_xor_XX.i.t +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (); - -class @NAME@ : public gr_sync_block -{ - private: - @NAME@ (); -}; diff --git a/gnuradio-core/src/lib/hier/CMakeLists.txt b/gnuradio-core/src/lib/hier/CMakeLists.txt deleted file mode 100644 index 192dd5939a..0000000000 --- a/gnuradio-core/src/lib/hier/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# 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. - -######################################################################## -# This file included, use CMake directory variables -######################################################################## -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.cc -) - -install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "core_devel" -) - -if(ENABLE_PYTHON) - install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/hier.i - ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "core_swig" - ) -endif(ENABLE_PYTHON) diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.cc b/gnuradio-core/src/lib/hier/gr_channel_model.cc deleted file mode 100644 index 7da3578093..0000000000 --- a/gnuradio-core/src/lib/hier/gr_channel_model.cc +++ /dev/null @@ -1,126 +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. - */ - -#include <gr_channel_model.h> -#include <gr_io_signature.h> -#include <gr_sig_source_f.h> -#include <iostream> - -// Shared pointer constructor -gr_channel_model_sptr -gr_make_channel_model(double noise_voltage, - double frequency_offset, - double epsilon, - const std::vector<gr_complex> &taps, - double noise_seed) -{ - return gnuradio::get_initial_sptr(new gr_channel_model(noise_voltage, - frequency_offset, - epsilon, - taps, - noise_seed)); -} - -// Hierarchical block constructor -gr_channel_model::gr_channel_model(double noise_voltage, - double frequency_offset, - double epsilon, - const std::vector<gr_complex> &taps, - double noise_seed) - : gr_hier_block2("gr_channel_model", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))) -{ - d_taps = taps; - while(d_taps.size() < 2) { - d_taps.push_back(0); - } - - d_timing_offset = gr_make_fractional_interpolator_cc(0, epsilon); - - d_multipath = gr_make_fir_filter_ccc(1, d_taps); - - d_noise_adder = gr_make_add_cc(); - d_noise = gr_make_fastnoise_source_c(GR_GAUSSIAN, noise_voltage, noise_seed, 1024*8); - d_freq_offset = gr_make_sig_source_c(1, GR_SIN_WAVE, frequency_offset, 1.0, 0.0); - d_mixer_offset = gr_make_multiply_cc(); - - connect(self(), 0, d_timing_offset, 0); - connect(d_timing_offset, 0, d_multipath, 0); - connect(d_multipath, 0, d_mixer_offset, 0); - connect(d_freq_offset, 0, d_mixer_offset, 1); - connect(d_mixer_offset, 0, d_noise_adder, 1); - connect(d_noise, 0, d_noise_adder, 0); - connect(d_noise_adder, 0, self(), 0); -} - -void -gr_channel_model::set_noise_voltage(double noise_voltage) -{ - d_noise->set_amplitude(noise_voltage); -} - -void -gr_channel_model::set_frequency_offset(double frequency_offset) -{ - d_freq_offset->set_frequency(frequency_offset); -} - -void -gr_channel_model::set_taps(const std::vector<gr_complex> &taps) -{ - d_taps = taps; - while(d_taps.size() < 2) { - d_taps.push_back(0); - } - d_multipath->set_taps(d_taps); -} - -void -gr_channel_model::set_timing_offset(double epsilon) -{ - d_timing_offset->set_interp_ratio(epsilon); -} - - -double -gr_channel_model::noise_voltage() const -{ - return d_noise->amplitude(); -} - -double -gr_channel_model::frequency_offset() const -{ - return d_freq_offset->frequency(); -} - -std::vector<gr_complex> -gr_channel_model::taps() const -{ - return d_multipath->taps(); -} - -double -gr_channel_model::timing_offset() const -{ - return d_timing_offset->interp_ratio(); -} diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.h b/gnuradio-core/src/lib/hier/gr_channel_model.h deleted file mode 100644 index 5796a6db24..0000000000 --- a/gnuradio-core/src/lib/hier/gr_channel_model.h +++ /dev/null @@ -1,79 +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. - */ - -#include <gr_core_api.h> -#include <gr_top_block.h> -#include <gr_fractional_interpolator_cc.h> -#include <gr_sig_source_c.h> -#include <gr_fir_filter_ccc.h> -#include <gr_add_cc.h> -#include <gr_fastnoise_source_c.h> -#include <gr_multiply_cc.h> - -class gr_channel_model; -typedef boost::shared_ptr<gr_channel_model> gr_channel_model_sptr; - - -GR_CORE_API gr_channel_model_sptr gr_make_channel_model(double noise_voltage=0.0, - double frequency_offset=0.0, - double epsilon=1.0, - const std::vector<gr_complex> &taps=std::vector<gr_complex>(1, 1), - double noise_seed=0); - -/*! - * \brief channel simulator - * \ingroup misc_blk - */ -class GR_CORE_API gr_channel_model : public gr_hier_block2 -{ - private: - gr_channel_model(double noise_voltage, - double frequency_offset, - double epsilon, - const std::vector<gr_complex> &taps, - double noise_seed); - - friend GR_CORE_API gr_channel_model_sptr gr_make_channel_model(double noise_voltage, - double frequency_offset, - double epsilon, - const std::vector<gr_complex> &taps, - double noise_seed); - - gr_fractional_interpolator_cc_sptr d_timing_offset; - gr_sig_source_c_sptr d_freq_offset; - gr_fir_filter_ccc_sptr d_multipath; - gr_add_cc_sptr d_noise_adder; - gr_fastnoise_source_c_sptr d_noise; - gr_multiply_cc_sptr d_mixer_offset; - - std::vector<gr_complex> d_taps; - - public: - void set_noise_voltage(double noise_voltage); - void set_frequency_offset(double frequency_offset); - void set_taps(const std::vector<gr_complex> &taps); - void set_timing_offset(double epsilon); - - double noise_voltage() const; - double frequency_offset() const; - std::vector<gr_complex> taps() const; - double timing_offset() const; -}; diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.i b/gnuradio-core/src/lib/hier/gr_channel_model.i deleted file mode 100644 index 9aa6ebf5b0..0000000000 --- a/gnuradio-core/src/lib/hier/gr_channel_model.i +++ /dev/null @@ -1,50 +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(gr,channel_model) - -gr_channel_model_sptr gr_make_channel_model(double noise_voltage=0.0, - double frequency_offset=0.0, - double epsilon=1.0, - const std::vector<gr_complex> &taps=std::vector<gr_complex>(1, 1), - double noise_seed=0); - -class gr_channel_model : public gr_hier_block2 -{ - private: - gr_channel_model(double noise_voltage, - double frequency_offset, - double epsilon, - const std::vector<gr_complex> &taps, - double noise_seed); - - public: - void set_noise_voltage(double noise_voltage); - void set_frequency_offset(double frequency_offset); - void set_taps(const std::vector<gr_complex> &taps); - void set_timing_offset(double epsilon); - - double noise_voltage() const; - double frequency_offset() const; - std::vector<gr_complex> taps() const; - double timing_offset() const; -}; diff --git a/gnuradio-core/src/lib/hier/hier.i b/gnuradio-core/src/lib/hier/hier.i deleted file mode 100644 index 82044415e1..0000000000 --- a/gnuradio-core/src/lib/hier/hier.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. - */ - -%{ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_channel_model.h> -%} - -%include "gr_channel_model.i" - diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.cc b/gnuradio-core/src/lib/io/gr_message_burst_source.cc index e9e2dfd4dc..968df6ec38 100644 --- a/gnuradio-core/src/lib/io/gr_message_burst_source.cc +++ b/gnuradio-core/src/lib/io/gr_message_burst_source.cc @@ -58,7 +58,7 @@ gr_message_burst_source::gr_message_burst_source (size_t itemsize, int msgq_limi { std::stringstream id; id << name() << unique_id(); - d_me = pmt::pmt_string_to_symbol(id.str()); + d_me = pmt::string_to_symbol(id.str()); } gr_message_burst_source::gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq) @@ -69,7 +69,7 @@ gr_message_burst_source::gr_message_burst_source (size_t itemsize, gr_msg_queue_ { std::stringstream id; id << name() << unique_id(); - d_me = pmt::pmt_string_to_symbol(id.str()); + d_me = pmt::string_to_symbol(id.str()); } gr_message_burst_source::~gr_message_burst_source() @@ -107,8 +107,8 @@ gr_message_burst_source::work(int noutput_items, //tag end of burst add_item_tag(0, //stream ID abs_sample_count+nn-1, //sample number - pmt::pmt_string_to_symbol("tx_eob"), - pmt::pmt_from_bool(1), + pmt::string_to_symbol("tx_eob"), + pmt::from_bool(1), d_me //block src id ); } @@ -129,8 +129,8 @@ gr_message_burst_source::work(int noutput_items, //tag start of burst add_item_tag(0, //stream ID abs_sample_count+nn, //sample number - pmt::pmt_string_to_symbol("tx_sob"), - pmt::pmt_from_bool(1), + pmt::string_to_symbol("tx_sob"), + pmt::from_bool(1), d_me //block src id ); diff --git a/gnuradio-core/src/lib/io/gr_message_debug.cc b/gnuradio-core/src/lib/io/gr_message_debug.cc index 27f4c65fdc..a0abf4d093 100644 --- a/gnuradio-core/src/lib/io/gr_message_debug.cc +++ b/gnuradio-core/src/lib/io/gr_message_debug.cc @@ -47,7 +47,7 @@ void gr_message_debug::print(pmt::pmt_t msg) { std::cout << "******* MESSAGE DEBUG PRINT ********\n"; - pmt::pmt_print(msg); + pmt::print(msg); std::cout << "************************************\n"; } @@ -61,15 +61,15 @@ gr_message_debug::store(pmt::pmt_t msg) void gr_message_debug::print_verbose(pmt::pmt_t msg) { - pmt::pmt_t meta = pmt::pmt_car(msg); - pmt::pmt_t vector = pmt::pmt_cdr(msg); + pmt::pmt_t meta = pmt::car(msg); + pmt::pmt_t vector = pmt::cdr(msg); std::cout << "* MESSAGE DEBUG PRINT PDU VERBOSE *\n"; - pmt::pmt_print(meta); - size_t len = pmt::pmt_length(vector); + pmt::print(meta); + size_t len = pmt::length(vector); std::cout << "pdu_length = " << len << std::endl; std::cout << "contents = " << std::endl; size_t offset(0); - const uint8_t* d = (const uint8_t*) pmt_uniform_vector_elements(vector, offset); + const uint8_t* d = (const uint8_t*) uniform_vector_elements(vector, offset); for(size_t i=0; i<len; i+=16){ printf("%04x: ", i); for(size_t j=i; j<std::min(i+16,len); j++){ diff --git a/gnuradio-core/src/lib/io/gr_pdu.cc b/gnuradio-core/src/lib/io/gr_pdu.cc index 302fd7b9bb..fe5d9f690f 100644 --- a/gnuradio-core/src/lib/io/gr_pdu.cc +++ b/gnuradio-core/src/lib/io/gr_pdu.cc @@ -44,11 +44,11 @@ bool gr_pdu_type_matches(gr_pdu_vector_type type, pmt::pmt_t v){ switch(type){ case pdu_byte: - return pmt::pmt_is_u8vector(v); + return pmt::is_u8vector(v); case pdu_float: - return pmt::pmt_is_f32vector(v); + return pmt::is_f32vector(v); case pdu_complex: - return pmt::pmt_is_c32vector(v); + return pmt::is_c32vector(v); default: throw std::runtime_error("bad type!"); } @@ -58,22 +58,22 @@ pmt::pmt_t gr_pdu_make_vector(gr_pdu_vector_type type, const uint8_t* buf, size_t items){ switch(type){ case pdu_byte: - return pmt::pmt_init_u8vector(items, buf); + return pmt::init_u8vector(items, buf); case pdu_float: - return pmt::pmt_init_f32vector(items, (const float*)buf); + return pmt::init_f32vector(items, (const float*)buf); case pdu_complex: - return pmt::pmt_init_c32vector(items, (const gr_complex*)buf); + return pmt::init_c32vector(items, (const gr_complex*)buf); default: throw std::runtime_error("bad type!"); } } gr_pdu_vector_type type_from_pmt(pmt::pmt_t vector){ - if(pmt_is_u8vector(vector)) + if(is_u8vector(vector)) return pdu_byte; - if(pmt_is_f32vector(vector)) + if(is_f32vector(vector)) return pdu_float; - if(pmt_is_c32vector(vector)) + if(is_c32vector(vector)) return pdu_complex; throw std::runtime_error("bad type!"); } diff --git a/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc index 5c319dc39d..9354a1366d 100644 --- a/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc +++ b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc @@ -84,46 +84,46 @@ gr_pdu_to_tagged_stream::work(int noutput_items, } // make sure type is valid - if(!pmt::pmt_is_pair(msg)){ + if(!pmt::is_pair(msg)){ throw std::runtime_error("received a malformed pdu message!"); } // printf("got a msg\n"); -// pmt::pmt_print(msg); +// pmt::print(msg); // grab the components of the pdu message - pmt::pmt_t meta(pmt::pmt_car(msg)); // make sure this is NIL || Dict ? - pmt::pmt_t vect(pmt::pmt_cdr(msg)); // make sure this is a vector? + pmt::pmt_t meta(pmt::car(msg)); // make sure this is NIL || Dict ? + pmt::pmt_t vect(pmt::cdr(msg)); // make sure this is a vector? // compute offset for output tag uint64_t offset = nitems_written(0) + nout; // add a tag for pdu length - add_item_tag(0, offset, pdu_length_tag, pmt::pmt_from_long( pmt::pmt_length(vect) ), pmt::mp(alias())); + add_item_tag(0, offset, pdu_length_tag, pmt::from_long( pmt::length(vect) ), pmt::mp(alias())); // if we recieved metadata add it as tags - if( !pmt_eq(meta, pmt::PMT_NIL) ){ - pmt::pmt_t pair(pmt::pmt_dict_keys( meta )); - while( !pmt_eq(pair, pmt::PMT_NIL) ){ - pmt::pmt_t k(pmt::pmt_cdr(pair)); - pmt::pmt_t v(pmt::pmt_dict_ref(meta, k, pmt::PMT_NIL)); + if( !eq(meta, pmt::PMT_NIL) ){ + pmt::pmt_t pair(pmt::dict_keys( meta )); + while( !eq(pair, pmt::PMT_NIL) ){ + pmt::pmt_t k(pmt::cdr(pair)); + pmt::pmt_t v(pmt::dict_ref(meta, k, pmt::PMT_NIL)); add_item_tag(0, offset, k, v, pmt::mp(alias())); } } // copy vector output - size_t ncopy = std::min((size_t)noutput_items, (size_t)pmt::pmt_length(vect)); - size_t nsave = pmt::pmt_length(vect) - ncopy; + size_t ncopy = std::min((size_t)noutput_items, (size_t)pmt::length(vect)); + size_t nsave = pmt::length(vect) - ncopy; // copy output size_t io(0); nout += ncopy; - memcpy(out, pmt_uniform_vector_elements(vect,io), ncopy*d_itemsize); + memcpy(out, uniform_vector_elements(vect,io), ncopy*d_itemsize); // save leftover items if needed for next work call if(nsave > 0){ d_remain.resize(nsave*d_itemsize, 0); - memcpy(&d_remain[0], pmt_uniform_vector_elements(vect,ncopy), nsave*d_itemsize); + memcpy(&d_remain[0], uniform_vector_elements(vect,ncopy), nsave*d_itemsize); } } diff --git a/gnuradio-core/src/lib/io/gr_socket_pdu.cc b/gnuradio-core/src/lib/io/gr_socket_pdu.cc index bb374b3006..366ca507bc 100644 --- a/gnuradio-core/src/lib/io/gr_socket_pdu.cc +++ b/gnuradio-core/src/lib/io/gr_socket_pdu.cc @@ -114,8 +114,8 @@ void tcp_connection::handle_read(const boost::system::error_code& error/*error*/ { if(!error) { - pmt::pmt_t vector = pmt::pmt_init_u8vector(bytes_transferred, (const uint8_t*)&buf[0]); - pmt::pmt_t pdu = pmt::pmt_cons( pmt::PMT_NIL, vector); + pmt::pmt_t vector = pmt::init_u8vector(bytes_transferred, (const uint8_t*)&buf[0]); + pmt::pmt_t pdu = pmt::cons( pmt::PMT_NIL, vector); d_block->message_port_pub( pmt::mp("pdus"), pdu ); @@ -131,27 +131,27 @@ void tcp_connection::handle_read(const boost::system::error_code& error/*error*/ void gr_socket_pdu::tcp_server_send(pmt::pmt_t msg){ - pmt::pmt_t vector = pmt::pmt_cdr(msg); + pmt::pmt_t vector = pmt::cdr(msg); for(size_t i=0; i<d_tcp_connections.size(); i++){ d_tcp_connections[i]->send(vector); } } void gr_socket_pdu::tcp_client_send(pmt::pmt_t msg){ - pmt::pmt_t vector = pmt::pmt_cdr(msg); - size_t len = pmt::pmt_length(vector); + pmt::pmt_t vector = pmt::cdr(msg); + size_t len = pmt::length(vector); size_t offset(0); boost::array<char, 10000> txbuf; - memcpy(&txbuf[0], pmt::pmt_uniform_vector_elements(vector, offset), len); + memcpy(&txbuf[0], pmt::uniform_vector_elements(vector, offset), len); _tcp_socket->send(boost::asio::buffer(txbuf,len)); } void gr_socket_pdu::udp_send(pmt::pmt_t msg){ - pmt::pmt_t vector = pmt::pmt_cdr(msg); - size_t len = pmt::pmt_length(vector); + pmt::pmt_t vector = pmt::cdr(msg); + size_t len = pmt::length(vector); size_t offset(0); boost::array<char, 10000> txbuf; - memcpy(&txbuf[0], pmt::pmt_uniform_vector_elements(vector, offset), len); + memcpy(&txbuf[0], pmt::uniform_vector_elements(vector, offset), len); if(_udp_endpoint_other.address().to_string() != "0.0.0.0") _udp_socket->send_to(boost::asio::buffer(txbuf,len), _udp_endpoint_other); } diff --git a/gnuradio-core/src/lib/io/gr_socket_pdu.h b/gnuradio-core/src/lib/io/gr_socket_pdu.h index 2fedb317db..0940e3eb83 100644 --- a/gnuradio-core/src/lib/io/gr_socket_pdu.h +++ b/gnuradio-core/src/lib/io/gr_socket_pdu.h @@ -69,10 +69,10 @@ public: boost::bind(&tcp_connection::handle_read, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } void send(pmt::pmt_t vector){ - size_t len = pmt::pmt_length(vector); + size_t len = pmt::length(vector); size_t offset(0); boost::array<char, 10000> txbuf; - memcpy(&txbuf[0], pmt::pmt_uniform_vector_elements(vector, offset), len); + memcpy(&txbuf[0], pmt::uniform_vector_elements(vector, offset), len); boost::asio::async_write(socket_, boost::asio::buffer(txbuf, len), boost::bind(&tcp_connection::handle_write, shared_from_this(), boost::asio::placeholders::error, @@ -162,8 +162,8 @@ class GR_CORE_API gr_socket_pdu : public gr_stream_pdu_base void handle_udp_read(const boost::system::error_code& error/*error*/, size_t bytes_transferred){ if(!error){ - pmt::pmt_t vector = pmt::pmt_init_u8vector(bytes_transferred, (const uint8_t*)&rxbuf[0]); - pmt::pmt_t pdu = pmt::pmt_cons( pmt::PMT_NIL, vector); + pmt::pmt_t vector = pmt::init_u8vector(bytes_transferred, (const uint8_t*)&rxbuf[0]); + pmt::pmt_t pdu = pmt::cons( pmt::PMT_NIL, vector); message_port_pub( pmt::mp("pdus"), pdu ); @@ -179,8 +179,8 @@ class GR_CORE_API gr_socket_pdu : public gr_stream_pdu_base void handle_tcp_read(const boost::system::error_code& error/*error*/, size_t bytes_transferred){ if(!error) { - pmt::pmt_t vector = pmt::pmt_init_u8vector(bytes_transferred, (const uint8_t*)&rxbuf[0]); - pmt::pmt_t pdu = pmt::pmt_cons( pmt::PMT_NIL, vector); + pmt::pmt_t vector = pmt::init_u8vector(bytes_transferred, (const uint8_t*)&rxbuf[0]); + pmt::pmt_t pdu = pmt::cons( pmt::PMT_NIL, vector); message_port_pub( pmt::mp("pdus"), pdu ); diff --git a/gnuradio-core/src/lib/io/gr_stream_pdu_base.cc b/gnuradio-core/src/lib/io/gr_stream_pdu_base.cc index 7250c33e59..0a0038ea25 100644 --- a/gnuradio-core/src/lib/io/gr_stream_pdu_base.cc +++ b/gnuradio-core/src/lib/io/gr_stream_pdu_base.cc @@ -79,19 +79,19 @@ void gr_stream_pdu_base::run(){ if(not wait_ready()){ continue; } const int result = read( d_fd, &d_rxbuf[0], d_rxbuf.size() ); if(result <= 0){ throw std::runtime_error("gr_stream_pdu_base, bad socket read!"); } - pmt::pmt_t vector = pmt::pmt_init_u8vector(result, &d_rxbuf[0]); - pmt::pmt_t pdu = pmt::pmt_cons( pmt::PMT_NIL, vector); + pmt::pmt_t vector = pmt::init_u8vector(result, &d_rxbuf[0]); + pmt::pmt_t pdu = pmt::cons( pmt::PMT_NIL, vector); message_port_pub(rxport, pdu); } } void gr_stream_pdu_base::send(pmt::pmt_t msg){ - pmt::pmt_t vector = pmt::pmt_cdr(msg); + pmt::pmt_t vector = pmt::cdr(msg); size_t offset(0); size_t itemsize(gr_pdu_itemsize(type_from_pmt(vector))); - int len( pmt::pmt_length(vector)*itemsize ); + int len( pmt::length(vector)*itemsize ); - const int rv = write(d_fd, pmt::pmt_uniform_vector_elements(vector, offset), len); + const int rv = write(d_fd, pmt::uniform_vector_elements(vector, offset), len); if(rv != len){ std::cerr << boost::format("WARNING: gr_stream_pdu_base::send(pdu) write failed! (d_fd=%d, len=%d, rv=%d)") % d_fd % len % rv << std::endl; diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc index 6d642088e2..3288fcdd60 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc @@ -81,8 +81,8 @@ gr_tagged_file_sink::work (int noutput_items, uint64_t start_N = nitems_read(0); uint64_t end_N = start_N + (uint64_t)(noutput_items); - pmt::pmt_t bkey = pmt::pmt_string_to_symbol("burst"); - //pmt::pmt_t tkey = pmt::pmt_string_to_symbol("time"); // use gr_tags::key_time + pmt::pmt_t bkey = pmt::string_to_symbol("burst"); + pmt::pmt_t tkey = pmt::string_to_symbol("rx_time"); // use gr_tags::key_time std::vector<gr_tag_t> all_tags; get_tags_in_range(all_tags, 0, start_N, end_N); @@ -91,12 +91,26 @@ gr_tagged_file_sink::work (int noutput_items, std::vector<gr_tag_t>::iterator vitr = all_tags.begin(); + // Look for a time tag and initialize d_timeval. + std::vector<gr_tag_t> time_tags_outer; + get_tags_in_range(time_tags_outer, 0, start_N, end_N, tkey); + if (time_tags_outer.size() > 0) { + const gr_tag_t tag = time_tags_outer[0]; + uint64_t offset = tag.offset; + pmt::pmt_t time = tag.value; + uint64_t tsecs = pmt::to_uint64(pmt::tuple_ref(time, 0)); + double tfrac = pmt::to_double(pmt::tuple_ref(time, 1)); + double delta = (double)offset / d_sample_rate; + d_timeval = (double)tsecs + tfrac + delta; + d_last_N = offset; + } + int idx = 0, idx_stop = 0; while(idx < noutput_items) { if(d_state == NOT_IN_BURST) { while(vitr != all_tags.end()) { - if((pmt::pmt_eqv((*vitr).key, bkey)) && - pmt::pmt_is_true((*vitr).value)) { + if((pmt::eqv((*vitr).key, bkey)) && + pmt::is_true((*vitr).value)) { uint64_t N = (*vitr).offset; idx = (int)(N - start_N); @@ -108,8 +122,7 @@ gr_tagged_file_sink::work (int noutput_items, // to new time based on sample rate of this block. std::vector<gr_tag_t> time_tags; //get_tags_in_range(time_tags, 0, d_last_N, N, gr_tags::key_time); - get_tags_in_range(time_tags, 0, d_last_N, N, - pmt::pmt_string_to_symbol("time")); + get_tags_in_range(time_tags, 0, d_last_N, N, tkey); if(time_tags.size() > 0) { const gr_tag_t tag = time_tags[time_tags.size()-1]; @@ -117,8 +130,8 @@ gr_tagged_file_sink::work (int noutput_items, // Get time based on last time tag from USRP pmt::pmt_t time = tag.value; - int tsecs = pmt::pmt_to_long(pmt::pmt_tuple_ref(time, 0)); - double tfrac = pmt::pmt_to_double(pmt::pmt_tuple_ref(time, 1)); + uint64_t tsecs = pmt::to_uint64(pmt::tuple_ref(time, 0)); + double tfrac = pmt::to_double(pmt::tuple_ref(time, 1)); // Get new time from last time tag + difference in time to when // burst tag occured based on the sample rate @@ -174,8 +187,8 @@ gr_tagged_file_sink::work (int noutput_items, } else { // In burst while(vitr != all_tags.end()) { - if((pmt::pmt_eqv((*vitr).key, bkey)) && - pmt::pmt_is_false((*vitr).value)) { + if((pmt::eqv((*vitr).key, bkey)) && + pmt::is_false((*vitr).value)) { uint64_t N = (*vitr).offset; idx_stop = (int)N - start_N; diff --git a/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc index 8211b7672d..3493f6a389 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc @@ -70,14 +70,14 @@ gr_tagged_stream_to_pdu::work(int noutput_items, get_tags_in_range(d_tags, 0, abs_N, abs_N+1); bool found_length_tag(false); for(d_tags_itr = d_tags.begin(); (d_tags_itr != d_tags.end()) && (!found_length_tag); d_tags_itr++){ - if( pmt::pmt_equal( (*d_tags_itr).key, pdu_length_tag ) ){ + if( pmt::equal( (*d_tags_itr).key, pdu_length_tag ) ){ if( (*d_tags_itr).offset != abs_N ){ throw std::runtime_error("expected next pdu length tag on a different item..."); } found_length_tag = true; - d_pdu_length = pmt::pmt_to_long( (*d_tags_itr).value ); + d_pdu_length = pmt::to_long( (*d_tags_itr).value ); d_pdu_remain = d_pdu_length; - d_pdu_meta = pmt::pmt_make_dict(); + d_pdu_meta = pmt::make_dict(); break; } // if have length tag } // iter over tags @@ -91,8 +91,8 @@ gr_tagged_stream_to_pdu::work(int noutput_items, // copy any tags in this range into our meta object get_tags_in_range(d_tags, 0, abs_N, abs_N+ncopy); for(d_tags_itr = d_tags.begin(); d_tags_itr != d_tags.end(); d_tags_itr++){ - if( ! pmt_equal( (*d_tags_itr).key, pdu_length_tag ) ){ - d_pdu_meta = pmt_dict_add(d_pdu_meta, (*d_tags_itr).key, (*d_tags_itr).value); + if( ! equal( (*d_tags_itr).key, pdu_length_tag ) ){ + d_pdu_meta = dict_add(d_pdu_meta, (*d_tags_itr).key, (*d_tags_itr).value); } } @@ -122,11 +122,11 @@ gr_tagged_stream_to_pdu::work(int noutput_items, void gr_tagged_stream_to_pdu::send_message(){ - if(pmt::pmt_length(d_pdu_vector) != d_pdu_length){ + if(pmt::length(d_pdu_vector) != d_pdu_length){ throw std::runtime_error("msg length not correct"); } - pmt::pmt_t msg = pmt::pmt_cons( d_pdu_meta, d_pdu_vector ); + pmt::pmt_t msg = pmt::cons( d_pdu_meta, d_pdu_vector ); message_port_pub( pdu_port_id, msg ); d_pdu_meta = pmt::PMT_NIL; diff --git a/gnuradio-core/src/lib/reed-solomon/CMakeLists.txt b/gnuradio-core/src/lib/reed-solomon/CMakeLists.txt deleted file mode 100644 index f073249f62..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -# 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. - -######################################################################## -# This file included, use CMake directory variables -######################################################################## -#MSVC workaround: we cant have dynamically sized arrays. -#So ifdef a max array bounds that is larger than NN and NROOTS -#Its a bit of a hack, but if you look at the code, its so full of ifdefs, -#and lacks optimization where it should be pre-allocating these arrays. -if(MSVC) - set_source_files_properties( - ${CMAKE_CURRENT_SOURCE_DIR}/exercise.c - ${CMAKE_CURRENT_SOURCE_DIR}/decode_rs.c - PROPERTIES COMPILE_DEFINITIONS "MAX_ARRAY=256;" - ) -endif(MSVC) - -set(gr_core_rs_sources - ${CMAKE_CURRENT_SOURCE_DIR}/encode_rs.c - ${CMAKE_CURRENT_SOURCE_DIR}/decode_rs.c - ${CMAKE_CURRENT_SOURCE_DIR}/init_rs.c -) - -######################################################################## -# Setup sources and includes -######################################################################## -list(APPEND gnuradio_core_sources ${gr_core_rs_sources}) - -install( - FILES ${CMAKE_CURRENT_SOURCE_DIR}/rs.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "core_devel" -) - -######################################################################## -# Register unit tests -######################################################################## -if(ENABLE_TESTING) -add_executable(gr_core_rstest - ${gr_core_rs_sources} - ${CMAKE_CURRENT_SOURCE_DIR}/rstest.c - ${CMAKE_CURRENT_SOURCE_DIR}/exercise.c -) -add_test(gr-core-reed-solomon-test gr_core_rstest) -endif(ENABLE_TESTING) diff --git a/gnuradio-core/src/lib/reed-solomon/Makefile.in.karn b/gnuradio-core/src/lib/reed-solomon/Makefile.in.karn deleted file mode 100644 index 8550b41581..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/Makefile.in.karn +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright 2002 Phil Karn, KA9Q -# May be used under the terms of the GNU General Public License (GPL) -# @configure_input@ -srcdir = @srcdir@ -prefix = @prefix@ -exec_prefix=@exec_prefix@ -VPATH = @srcdir@ -CC=@CC@ - -CFLAGS=@CFLAGS@ @ARCH_OPTION@ -Wall - -LIB= encode_rs_char.o encode_rs_int.o encode_rs_8.o \ - decode_rs_char.o decode_rs_int.o decode_rs_8.o \ - init_rs_char.o init_rs_int.o ccsds_tab.o \ - encode_rs_ccsds.o decode_rs_ccsds.o ccsds_tal.o - -all: librs.a librs.so.@SO_VERSION@ - -test: rstest - ./rstest - -rstest: rstest.o exercise_int.o exercise_char.o exercise_8.o exercise_ccsds.o \ - librs.a - gcc -g -o $@ $^ - -install: all - install -D -m 644 -p librs.a librs.so.@SO_VERSION@ @libdir@ - (cd @libdir@;ln -f -s librs.so.@SO_VERSION@ librs.so) - ldconfig - install -m 644 -p rs.h @includedir@ - install -m 644 rs.3 @mandir@/man3 - -librs.a: $(LIB) - ar rv $@ $^ - -librs.so.@SO_VERSION@: librs.a - gcc -shared -Xlinker -soname=librs.so.@SO_NAME@ -o $@ -Wl,-whole-archive $^ -Wl,-no-whole-archive -lc - -encode_rs_char.o: encode_rs.c - gcc $(CFLAGS) -c -o $@ $^ - -encode_rs_int.o: encode_rs.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -encode_rs_8.o: encode_rs.c - gcc -DFIXED=1 $(CFLAGS) -c -o $@ $^ - -decode_rs_char.o: decode_rs.c - gcc $(CFLAGS) -c -o $@ $^ - -decode_rs_int.o: decode_rs.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -decode_rs_8.o: decode_rs.c - gcc -DFIXED=1 $(CFLAGS) -c -o $@ $^ - -init_rs_char.o: init_rs.c - gcc $(CFLAGS) -c -o $@ $^ - -init_rs_int.o: init_rs.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -ccsds_tab.o: ccsds_tab.c - -ccsds_tab.c: gen_ccsds - ./gen_ccsds > ccsds_tab.c - -gen_ccsds: gen_ccsds.o init_rs_char.o - gcc -o $@ $^ - -gen_ccsds.o: gen_ccsds.c - gcc $(CFLAGS) -c -o $@ $^ - -ccsds_tal.o: ccsds_tal.c - -ccsds_tal.c: gen_ccsds_tal - ./gen_ccsds_tal > ccsds_tal.c - -exercise_char.o: exercise.c - gcc $(CFLAGS) -c -o $@ $^ - -exercise_int.o: exercise.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -exercise_8.o: exercise.c - gcc -DFIXED=1 $(CFLAGS) -c -o $@ $^ - -exercise_ccsds.o: exercise.c - gcc -DCCSDS=1 $(CFLAGS) -c -o $@ $^ - - -clean: - rm -f *.o *.a ccsds_tab.c ccsds_tal.c gen_ccsds gen_ccsds_tal \ - rstest librs.so.@SO_VERSION@ - -distclean: clean - rm -f config.log config.cache config.status config.h makefile - - diff --git a/gnuradio-core/src/lib/reed-solomon/README b/gnuradio-core/src/lib/reed-solomon/README deleted file mode 100644 index 341832dbd5..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/README +++ /dev/null @@ -1,5 +0,0 @@ -This code is from http://people.qualcomm.com/karn/code/fec -It is based on reed-soloman-3.1.1 (1 Jan 2002). - -I has been converted to use automake, to better integrate with GNU -Radio's build strategy. diff --git a/gnuradio-core/src/lib/reed-solomon/README.karn b/gnuradio-core/src/lib/reed-solomon/README.karn deleted file mode 100644 index f30644ffea..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/README.karn +++ /dev/null @@ -1,22 +0,0 @@ -This package implements a general purpose Reed-Solomon encoding and decoding -facility. See the rs.3 man page for details. - -To install, simply do the following after extracting this tarball into -an empty directory: - -./configure -make -make install - -The command "make test" runs a battery of encode/decode tests using a -variety of RS codes using random data and random errors. Each test -should pass with an "OK"; if any fail, please let me know so I can -track down the problem. - -Phil Karn (karn@ka9q.net) 1 Jan 2002 - -Copyright 2002, Phil Karn, KA9Q -This software may be used under the terms of the GNU General Public License (GPL). - - - diff --git a/gnuradio-core/src/lib/reed-solomon/ccsds.h b/gnuradio-core/src/lib/reed-solomon/ccsds.h deleted file mode 100644 index 0f2bde6186..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/ccsds.h +++ /dev/null @@ -1 +0,0 @@ -extern unsigned char Taltab[],Tal1tab[]; diff --git a/gnuradio-core/src/lib/reed-solomon/char.h b/gnuradio-core/src/lib/reed-solomon/char.h deleted file mode 100644 index 7b2030a0b0..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/char.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Include file to configure the RS codec for character symbols - * - * Copyright 2002, Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ - -#define DTYPE unsigned char - -#include <gr_core_api.h> - -/* Reed-Solomon codec control block */ -struct rs { - unsigned int mm; /* Bits per symbol */ - unsigned int nn; /* Symbols per block (= (1<<mm)-1) */ - unsigned char *alpha_to; /* log lookup table */ - unsigned char *index_of; /* Antilog lookup table */ - unsigned char *genpoly; /* Generator polynomial */ - unsigned int nroots; /* Number of generator roots = number of parity symbols */ - unsigned char fcr; /* First consecutive root, index form */ - unsigned char prim; /* Primitive element, index form */ - unsigned char iprim; /* prim-th root of 1, index form */ -}; - -static inline unsigned int modnn(struct rs *rs, unsigned int x){ - while (x >= rs->nn) { - x -= rs->nn; - x = (x >> rs->mm) + (x & rs->nn); - } - return x; -} -#define MODNN(x) modnn(rs,x) - -#define MM (rs->mm) -#define NN (rs->nn) -#define ALPHA_TO (rs->alpha_to) -#define INDEX_OF (rs->index_of) -#define GENPOLY (rs->genpoly) -#define NROOTS (rs->nroots) -#define FCR (rs->fcr) -#define PRIM (rs->prim) -#define IPRIM (rs->iprim) -#define A0 (NN) - -#define ENCODE_RS encode_rs_char -#define DECODE_RS decode_rs_char -#define INIT_RS init_rs_char -#define FREE_RS free_rs_char - -GR_CORE_API void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity); -GR_CORE_API int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras); -GR_CORE_API void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, - unsigned int prim,unsigned int nroots); -GR_CORE_API void FREE_RS(void *p); - - - - diff --git a/gnuradio-core/src/lib/reed-solomon/decode_rs.c b/gnuradio-core/src/lib/reed-solomon/decode_rs.c deleted file mode 100644 index f9438cf266..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/decode_rs.c +++ /dev/null @@ -1,270 +0,0 @@ -/* Reed-Solomon decoder - * Copyright 2002 Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ - -#ifdef DEBUG -#include <stdio.h> -#endif - -#include <string.h> - -#define NULL ((void *)0) -#define min(a,b) ((a) < (b) ? (a) : (b)) - -#ifdef FIXED -#include "fixed.h" -#elif defined(BIGSYM) -#include "int.h" -#else -#include "char.h" -#endif - -int DECODE_RS( -#ifndef FIXED -void *p, -#endif -DTYPE *data, int *eras_pos, int no_eras){ - -#ifndef FIXED - struct rs *rs = (struct rs *)p; -#endif - int deg_lambda, el, deg_omega; - int i, j, r, k; -#ifdef MAX_ARRAY - DTYPE u,q,tmp,num1,num2,den,discr_r; - DTYPE lambda[MAX_ARRAY], s[MAX_ARRAY]; /* Err+Eras Locator poly - * and syndrome poly */ - DTYPE b[MAX_ARRAY], t[MAX_ARRAY], omega[MAX_ARRAY]; - DTYPE root[MAX_ARRAY], reg[MAX_ARRAY], loc[MAX_ARRAY]; -#else - DTYPE u,q,tmp,num1,num2,den,discr_r; - DTYPE lambda[NROOTS+1], s[NROOTS]; /* Err+Eras Locator poly - * and syndrome poly */ - DTYPE b[NROOTS+1], t[NROOTS+1], omega[NROOTS+1]; - DTYPE root[NROOTS], reg[NROOTS+1], loc[NROOTS]; -#endif - int syn_error, count; - - /* form the syndromes; i.e., evaluate data(x) at roots of g(x) */ - for(i=0;(unsigned int)i<NROOTS;i++) - s[i] = data[0]; - - for(j=1;(unsigned int)j<NN;j++){ - for(i=0;(unsigned int)i<NROOTS;i++){ - if(s[i] == 0){ - s[i] = data[j]; - } else { - s[i] = data[j] ^ ALPHA_TO[MODNN(INDEX_OF[s[i]] + (FCR+i)*PRIM)]; - } - } - } - - /* Convert syndromes to index form, checking for nonzero condition */ - syn_error = 0; - for(i=0;(unsigned int)i<NROOTS;i++){ - syn_error |= s[i]; - s[i] = INDEX_OF[s[i]]; - } - - if (!syn_error) { - /* if syndrome is zero, data[] is a codeword and there are no - * errors to correct. So return data[] unmodified - */ - count = 0; - goto finish; - } - memset(&lambda[1],0,NROOTS*sizeof(lambda[0])); - lambda[0] = 1; - - if (no_eras > 0) { - /* Init lambda to be the erasure locator polynomial */ - lambda[1] = ALPHA_TO[MODNN(PRIM*(NN-1-eras_pos[0]))]; - for (i = 1; i < no_eras; i++) { - u = MODNN(PRIM*(NN-1-eras_pos[i])); - for (j = i+1; j > 0; j--) { - tmp = INDEX_OF[lambda[j - 1]]; - if(tmp != A0) - lambda[j] ^= ALPHA_TO[MODNN(u + tmp)]; - } - } - -#if DEBUG >= 1 - /* Test code that verifies the erasure locator polynomial just constructed - Needed only for decoder debugging. */ - - /* find roots of the erasure location polynomial */ - for(i=1;i<=no_eras;i++) - reg[i] = INDEX_OF[lambda[i]]; - - count = 0; - for (i = 1,k=IPRIM-1; i <= NN; i++,k = MODNN(k+IPRIM)) { - q = 1; - for (j = 1; j <= no_eras; j++) - if (reg[j] != A0) { - reg[j] = MODNN(reg[j] + j); - q ^= ALPHA_TO[reg[j]]; - } - if (q != 0) - continue; - /* store root and error location number indices */ - root[count] = i; - loc[count] = k; - count++; - } - if (count != no_eras) { - printf("count = %d no_eras = %d\n lambda(x) is WRONG\n",count,no_eras); - count = -1; - goto finish; - } -#if DEBUG >= 2 - printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n"); - for (i = 0; i < count; i++) - printf("%d ", loc[i]); - printf("\n"); -#endif -#endif - } - for(i=0;(unsigned int)i<NROOTS+1;i++) - b[i] = INDEX_OF[lambda[i]]; - - /* - * Begin Berlekamp-Massey algorithm to determine error+erasure - * locator polynomial - */ - r = no_eras; - el = no_eras; - while ((unsigned int)(++r) <= NROOTS) { /* r is the step number */ - /* Compute discrepancy at the r-th step in poly-form */ - discr_r = 0; - for (i = 0; i < r; i++){ - if ((lambda[i] != 0) && (s[r-i-1] != A0)) { - discr_r ^= ALPHA_TO[MODNN(INDEX_OF[lambda[i]] + s[r-i-1])]; - } - } - discr_r = INDEX_OF[discr_r]; /* Index form */ - if (discr_r == A0) { - /* 2 lines below: B(x) <-- x*B(x) */ - memmove(&b[1],b,NROOTS*sizeof(b[0])); - b[0] = A0; - } else { - /* 7 lines below: T(x) <-- lambda(x) - discr_r*x*b(x) */ - t[0] = lambda[0]; - for (i = 0 ; (unsigned int)i < NROOTS; i++) { - if(b[i] != A0) - t[i+1] = lambda[i+1] ^ ALPHA_TO[MODNN(discr_r + b[i])]; - else - t[i+1] = lambda[i+1]; - } - if (2 * el <= r + no_eras - 1) { - el = r + no_eras - el; - /* - * 2 lines below: B(x) <-- inv(discr_r) * - * lambda(x) - */ - for (i = 0; (unsigned int)i <= NROOTS; i++) - b[i] = (lambda[i] == 0) ? A0 : MODNN(INDEX_OF[lambda[i]] - discr_r + NN); - } else { - /* 2 lines below: B(x) <-- x*B(x) */ - memmove(&b[1],b,NROOTS*sizeof(b[0])); - b[0] = A0; - } - memcpy(lambda,t,(NROOTS+1)*sizeof(t[0])); - } - } - - /* Convert lambda to index form and compute deg(lambda(x)) */ - deg_lambda = 0; - for(i=0;(unsigned int)i<NROOTS+1;i++){ - lambda[i] = INDEX_OF[lambda[i]]; - if(lambda[i] != A0) - deg_lambda = i; - } - /* Find roots of the error+erasure locator polynomial by Chien search */ - memcpy(®[1],&lambda[1],NROOTS*sizeof(reg[0])); - count = 0; /* Number of roots of lambda(x) */ - for (i = 1,k=IPRIM-1; (unsigned int)i <= NN; i++,k = MODNN(k+IPRIM)) { - q = 1; /* lambda[0] is always 0 */ - for (j = deg_lambda; j > 0; j--){ - if (reg[j] != A0) { - reg[j] = MODNN(reg[j] + j); - q ^= ALPHA_TO[reg[j]]; - } - } - if (q != 0) - continue; /* Not a root */ - /* store root (index-form) and error location number */ -#if DEBUG>=2 - printf("count %d root %d loc %d\n",count,i,k); -#endif - root[count] = i; - loc[count] = k; - /* If we've already found max possible roots, - * abort the search to save time - */ - if(++count == deg_lambda) - break; - } - if (deg_lambda != count) { - /* - * deg(lambda) unequal to number of roots => uncorrectable - * error detected - */ - count = -1; - goto finish; - } - /* - * Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo - * x**NROOTS). in index form. Also find deg(omega). - */ - deg_omega = 0; - for (i = 0; (unsigned int)i < NROOTS;i++){ - tmp = 0; - j = (deg_lambda < i) ? deg_lambda : i; - for(;j >= 0; j--){ - if ((s[i - j] != A0) && (lambda[j] != A0)) - tmp ^= ALPHA_TO[MODNN(s[i - j] + lambda[j])]; - } - if(tmp != 0) - deg_omega = i; - omega[i] = INDEX_OF[tmp]; - } - omega[NROOTS] = A0; - - /* - * Compute error values in poly-form. num1 = omega(inv(X(l))), num2 = - * inv(X(l))**(FCR-1) and den = lambda_pr(inv(X(l))) all in poly-form - */ - for (j = count-1; j >=0; j--) { - num1 = 0; - for (i = deg_omega; i >= 0; i--) { - if (omega[i] != A0) - num1 ^= ALPHA_TO[MODNN(omega[i] + i * root[j])]; - } - num2 = ALPHA_TO[MODNN(root[j] * (FCR - 1) + NN)]; - den = 0; - - /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ - for (i = (int)min((unsigned int)deg_lambda,NROOTS-1) & ~1; i >= 0; i -=2) { - if(lambda[i+1] != A0) - den ^= ALPHA_TO[MODNN(lambda[i+1] + i * root[j])]; - } - if (den == 0) { -#if DEBUG >= 1 - printf("\n ERROR: denominator = 0\n"); -#endif - count = -1; - goto finish; - } - /* Apply error to data */ - if (num1 != 0) { - data[loc[j]] ^= ALPHA_TO[MODNN(INDEX_OF[num1] + INDEX_OF[num2] + NN - INDEX_OF[den])]; - } - } - finish: - if(eras_pos != NULL){ - for(i=0;i<count;i++) - eras_pos[i] = loc[i]; - } - return count; -} diff --git a/gnuradio-core/src/lib/reed-solomon/decode_rs_ccsds.c b/gnuradio-core/src/lib/reed-solomon/decode_rs_ccsds.c deleted file mode 100644 index 2543d3a640..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/decode_rs_ccsds.c +++ /dev/null @@ -1,27 +0,0 @@ -/* This function wraps around the fixed 8-bit decoder, performing the - * basis transformations necessary to meet the CCSDS standard - * - * Copyright 2002, Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ -#define FIXED 1 -#include "fixed.h" -#include "ccsds.h" - -int decode_rs_ccsds(unsigned char *data,int *eras_pos,int no_eras){ - int i,r; - unsigned char cdata[NN]; - - /* Convert data from dual basis to conventional */ - for(i=0;i<NN;i++) - cdata[i] = Tal1tab[data[i]]; - - r = decode_rs_8(cdata,eras_pos,no_eras); - - if(r > 0){ - /* Convert from conventional to dual basis */ - for(i=0;i<NN;i++) - data[i] = Taltab[cdata[i]]; - } - return r; -} diff --git a/gnuradio-core/src/lib/reed-solomon/encode_rs.c b/gnuradio-core/src/lib/reed-solomon/encode_rs.c deleted file mode 100644 index cd31f32c6e..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/encode_rs.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Reed-Solomon encoder - * Copyright 2002, Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ -#include <string.h> - -#ifdef FIXED -#include "fixed.h" -#elif defined(BIGSYM) -#include "int.h" -#else -#include "char.h" -#endif - -void ENCODE_RS( -#ifndef FIXED -void *p, -#endif -DTYPE *data, DTYPE *bb){ -#ifndef FIXED - struct rs *rs = (struct rs *)p; -#endif - unsigned int i, j; - DTYPE feedback; - - memset(bb,0,NROOTS*sizeof(DTYPE)); - - for(i=0;i<NN-NROOTS;i++){ - feedback = INDEX_OF[data[i] ^ bb[0]]; - if(feedback != A0){ /* feedback term is non-zero */ -#ifdef UNNORMALIZED - /* This line is unnecessary when GENPOLY[NROOTS] is unity, as it must - * always be for the polynomials constructed by init_rs() - */ - feedback = MODNN(NN - GENPOLY[NROOTS] + feedback); -#endif - for(j=1;j<NROOTS;j++) - bb[j] ^= ALPHA_TO[MODNN(feedback + GENPOLY[NROOTS-j])]; - } - /* Shift */ - memmove(&bb[0],&bb[1],sizeof(DTYPE)*(NROOTS-1)); - if(feedback != A0) - bb[NROOTS-1] = ALPHA_TO[MODNN(feedback + GENPOLY[0])]; - else - bb[NROOTS-1] = 0; - } -} diff --git a/gnuradio-core/src/lib/reed-solomon/encode_rs_ccsds.c b/gnuradio-core/src/lib/reed-solomon/encode_rs_ccsds.c deleted file mode 100644 index a748b34689..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/encode_rs_ccsds.c +++ /dev/null @@ -1,24 +0,0 @@ -/* This function wraps around the fixed 8-bit encoder, performing the - * basis transformations necessary to meet the CCSDS standard - * - * Copyright 2002, Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ -#define FIXED -#include "fixed.h" -#include "ccsds.h" - -void encode_rs_ccsds(unsigned char *data,unsigned char *parity){ - int i; - unsigned char cdata[NN-NROOTS]; - - /* Convert data from dual basis to conventional */ - for(i=0;i<NN-NROOTS;i++) - cdata[i] = Tal1tab[data[i]]; - - encode_rs_8(cdata,parity); - - /* Convert parity from conventional to dual basis */ - for(i=0;i<NN-NROOTS;i++) - parity[i] = Taltab[parity[i]]; -} diff --git a/gnuradio-core/src/lib/reed-solomon/exercise.c b/gnuradio-core/src/lib/reed-solomon/exercise.c deleted file mode 100644 index de33a6bff3..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/exercise.c +++ /dev/null @@ -1,134 +0,0 @@ -/* Exercise an RS codec a specified number of times using random - * data and error patterns - * - * Copyright 2002 Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ -#define FLAG_ERASURE 1 /* Randomly flag 50% of errors as erasures */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#ifdef FIXED -#include "fixed.h" -#define EXERCISE exercise_8 -#elif defined(CCSDS) -#include "fixed.h" -#include "ccsds.h" -#define EXERCISE exercise_ccsds -#elif defined(BIGSYM) -#include "int.h" -#define EXERCISE exercise_int -#else -#include "char.h" -#define EXERCISE exercise_char -#endif - -#ifdef FIXED -#define PRINTPARM printf("(255,223):"); -#elif defined(CCSDS) -#define PRINTPARM printf("CCSDS (255,223):"); -#else -#define PRINTPARM printf("(%d,%d):",rs->nn,rs->nn-rs->nroots); -#endif - -/* Exercise the RS codec passed as an argument */ -int EXERCISE( -#if !defined(CCSDS) && !defined(FIXED) -void *p, -#endif -int trials){ -#if !defined(CCSDS) && !defined(FIXED) - struct rs *rs = (struct rs *)p; -#endif -#if MAX_ARRAY - DTYPE block[MAX_ARRAY],tblock[MAX_ARRAY]; - unsigned int i; - int errors; - int errlocs[MAX_ARRAY]; - int derrlocs[MAX_ARRAY]; -#else - DTYPE block[NN],tblock[NN]; - unsigned int i; - int errors; - int errlocs[NN]; - int derrlocs[NROOTS]; -#endif - int derrors; - int errval,errloc; - int erasures; - int decoder_errors = 0; - - while(trials-- != 0){ - /* Test up to the error correction capacity of the code */ - for(errors=0;(unsigned int)errors <= NROOTS/2;errors++){ - - /* Load block with random data and encode */ - for(i=0;i<NN-NROOTS;i++) - block[i] = random() & NN; - -#if defined(CCSDS) || defined(FIXED) - ENCODE_RS(&block[0],&block[NN-NROOTS]); -#else - ENCODE_RS(rs,&block[0],&block[NN-NROOTS]); -#endif - - /* Make temp copy, seed with errors */ - memcpy(tblock,block,sizeof(tblock)); - memset(errlocs,0,sizeof(errlocs)); - memset(derrlocs,0,sizeof(derrlocs)); - erasures=0; - for(i=0;i<(unsigned int)errors;i++){ - do { - errval = random() & NN; - } while(errval == 0); /* Error value must be nonzero */ - - do { - errloc = random() % NN; - } while(errlocs[errloc] != 0); /* Must not choose the same location twice */ - - errlocs[errloc] = 1; - -#if FLAG_ERASURE - if(random() & 1) /* 50-50 chance */ - derrlocs[erasures++] = errloc; -#endif - tblock[errloc] ^= errval; - } - - /* Decode the errored block */ -#if defined(CCSDS) || defined(FIXED) - derrors = DECODE_RS(tblock,derrlocs,erasures); -#else - derrors = DECODE_RS(rs,tblock,derrlocs,erasures); -#endif - - if(derrors != errors){ - PRINTPARM - printf(" decoder says %d errors, true number is %d\n",derrors,errors); - decoder_errors++; - } - for(i=0;i<(unsigned int)derrors;i++){ - if(errlocs[derrlocs[i]] == 0){ - PRINTPARM - printf(" decoder indicates error in location %d without error\n",i); - decoder_errors++; - } - } - if(memcmp(tblock,block,sizeof(tblock)) != 0){ - PRINTPARM - printf(" uncorrected errors! output ^ input:"); - decoder_errors++; - for(i=0;i<NN;i++) - printf(" %02x",tblock[i] ^ block[i]); - printf("\n"); - } - } - } - return decoder_errors; -} diff --git a/gnuradio-core/src/lib/reed-solomon/fixed.h b/gnuradio-core/src/lib/reed-solomon/fixed.h deleted file mode 100644 index 30091e7bf3..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/fixed.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Configure the RS codec with fixed parameters for CCSDS standard - * (255,223) code over GF(256). Note: the conventional basis is still - * used; the dual-basis mappings are performed in [en|de]code_rs_ccsds.c - * - * Copyright 2002 Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ -#define DTYPE unsigned char - -#include <gr_core_api.h> - -static inline int mod255(int x){ - while (x >= 255) { - x -= 255; - x = (x >> 8) + (x & 255); - } - return x; -} -#define MODNN(x) mod255(x) - -extern unsigned char CCSDS_alpha_to[]; -extern unsigned char CCSDS_index_of[]; -extern unsigned char CCSDS_poly[]; - -#define MM 8 -#define NN 255 -#define ALPHA_TO CCSDS_alpha_to -#define INDEX_OF CCSDS_index_of -#define GENPOLY CCSDS_poly -#define NROOTS 32 -#define FCR 112 -#define PRIM 11 -#define IPRIM 116 -#define A0 (NN) - -#define ENCODE_RS encode_rs_8 -#define DECODE_RS decode_rs_8 - -GR_CORE_API void ENCODE_RS(DTYPE *data,DTYPE *parity); -GR_CORE_API int DECODE_RS(DTYPE *data, int *eras_pos, int no_eras);
\ No newline at end of file diff --git a/gnuradio-core/src/lib/reed-solomon/gen_ccsds.c b/gnuradio-core/src/lib/reed-solomon/gen_ccsds.c deleted file mode 100644 index 1e4e4f5363..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/gen_ccsds.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Generate tables for CCSDS code - * Copyright 2002 Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ -#include <stdio.h> -#include "char.h" - -int main(){ - struct rs *rs; - int i; - - rs = init_rs_char(8,0x187,112,11,32); /* CCSDS standard */ - printf("unsigned char CCSDS_alpha_to[] = {"); - for(i=0;i<256;i++){ - if((i % 16) == 0) - printf("\n"); - printf("0x%02x,",rs->alpha_to[i]); - } - printf("\n};\n\nunsigned char CCSDS_index_of[] = {"); - for(i=0;i<256;i++){ - if((i % 16) == 0) - printf("\n"); - printf("%3d,",rs->index_of[i]); - } - printf("\n};\n\nunsigned char CCSDS_poly[] = {"); - for(i=0;i<33;i++){ - if((i % 16) == 0) - printf("\n"); - - printf("%3d,",rs->genpoly[i]); - } - printf("\n};\n"); - exit(0); -} diff --git a/gnuradio-core/src/lib/reed-solomon/gen_ccsds_tal.c b/gnuradio-core/src/lib/reed-solomon/gen_ccsds_tal.c deleted file mode 100644 index 9dde18917b..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/gen_ccsds_tal.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Conversion lookup tables from conventional alpha to Berlekamp's - * dual-basis representation. Used in the CCSDS version only. - * taltab[] -- convert conventional to dual basis - * tal1tab[] -- convert dual basis to conventional - - * Note: the actual RS encoder/decoder works with the conventional basis. - * So data is converted from dual to conventional basis before either - * encoding or decoding and then converted back. - * - * Copyright 2002 Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ -#include <stdio.h> -unsigned char Taltab[256],Tal1tab[256]; - -static unsigned char tal[] = { 0x8d, 0xef, 0xec, 0x86, 0xfa, 0x99, 0xaf, 0x7b }; - -/* Generate conversion lookup tables between conventional alpha representation - * (@**7, @**6, ...@**0) - * and Berlekamp's dual basis representation - * (l0, l1, ...l7) - */ -int main(){ - int i,j,k; - - for(i=0;i<256;i++){/* For each value of input */ - Taltab[i] = 0; - for(j=0;j<8;j++) /* for each column of matrix */ - for(k=0;k<8;k++){ /* for each row of matrix */ - if(i & (1<<k)) - Taltab[i] ^= tal[7-k] & (1<<j); - } - Tal1tab[Taltab[i]] = i; - } - printf("unsigned char Taltab[] = {\n"); - for(i=0;i<256;i++){ - if((i % 16) == 0) - printf("\n"); - printf("0x%02x,",Taltab[i]); - } - printf("\n};\n\nunsigned char Tal1tab[] = {"); - for(i=0;i<256;i++){ - if((i % 16) == 0) - printf("\n"); - printf("0x%02x,",Tal1tab[i]); - } - printf("\n};\n"); - exit(0); -} - diff --git a/gnuradio-core/src/lib/reed-solomon/init_rs.c b/gnuradio-core/src/lib/reed-solomon/init_rs.c deleted file mode 100644 index 4ec77cd723..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/init_rs.c +++ /dev/null @@ -1,129 +0,0 @@ -/* Initialize a RS codec - * - * Copyright 2002 Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ -#include <stdlib.h> - -#ifdef CCSDS -#include "ccsds.h" -#elif defined(BIGSYM) -#include "int.h" -#else -#include "char.h" -#endif - -#define NULL ((void *)0) - -void FREE_RS(void *p){ - struct rs *rs = (struct rs *)p; - - free(rs->alpha_to); - free(rs->index_of); - free(rs->genpoly); - free(rs); -} - -/* Initialize a Reed-Solomon codec - * symsize = symbol size, bits (1-8) - * gfpoly = Field generator polynomial coefficients - * fcr = first root of RS code generator polynomial, index form - * prim = primitive element to generate polynomial roots - * nroots = RS code generator polynomial degree (number of roots) - */ -void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned fcr,unsigned prim, - unsigned int nroots){ - struct rs *rs; - int sr,root,iprim; - unsigned int i, j; - - if(symsize > 8*sizeof(DTYPE)) - return NULL; /* Need version with ints rather than chars */ - - if(fcr >= (1u<<symsize)) - return NULL; - if(prim == 0 || prim >= (1u<<symsize)) - return NULL; - if(nroots >= (1u<<symsize)) - return NULL; /* Can't have more roots than symbol values! */ - - rs = (struct rs *)calloc(1,sizeof(struct rs)); - rs->mm = symsize; - rs->nn = (1<<symsize)-1; - - rs->alpha_to = (DTYPE *)malloc(sizeof(DTYPE)*(rs->nn+1)); - if(rs->alpha_to == NULL){ - free(rs); - return NULL; - } - rs->index_of = (DTYPE *)malloc(sizeof(DTYPE)*(rs->nn+1)); - if(rs->index_of == NULL){ - free(rs->alpha_to); - free(rs); - return NULL; - } - - /* Generate Galois field lookup tables */ - rs->index_of[0] = A0; /* log(zero) = -inf */ - rs->alpha_to[A0] = 0; /* alpha**-inf = 0 */ - sr = 1; - for(i=0;i<rs->nn;i++){ - rs->index_of[sr] = i; - rs->alpha_to[i] = sr; - sr <<= 1; - if(sr & (1<<symsize)) - sr ^= gfpoly; - sr &= rs->nn; - } - if(sr != 1){ - /* field generator polynomial is not primitive! */ - free(rs->alpha_to); - free(rs->index_of); - free(rs); - return NULL; - } - - /* Form RS code generator polynomial from its roots */ - rs->genpoly = (DTYPE *)malloc(sizeof(DTYPE)*(nroots+1)); - if(rs->genpoly == NULL){ - free(rs->alpha_to); - free(rs->index_of); - free(rs); - return NULL; - } - rs->fcr = fcr; - rs->prim = prim; - rs->nroots = nroots; - - /* Find prim-th root of 1, used in decoding */ - for(iprim=1;(iprim % prim) != 0;iprim += rs->nn) - ; - rs->iprim = iprim / prim; - - rs->genpoly[0] = 1; - for (i = 0,root=fcr*prim; i < nroots; i++,root += prim) { - rs->genpoly[i+1] = 1; - - /* Multiply rs->genpoly[] by @**(root + x) */ - for (j = i; j > 0; j--){ - if (rs->genpoly[j] != 0) - rs->genpoly[j] = rs->genpoly[j-1] ^ rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[j]] + root)]; - else - rs->genpoly[j] = rs->genpoly[j-1]; - } - /* rs->genpoly[0] can never be zero */ - rs->genpoly[0] = rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[0]] + root)]; - } - /* convert rs->genpoly[] to index form for quicker encoding */ - for (i = 0; i <= nroots; i++) - rs->genpoly[i] = rs->index_of[rs->genpoly[i]]; - -#if 0 - printf ("genpoly:\n"); - for (i = nroots; i >= 0; i--){ - printf (" %3d*X^%d\n", rs->alpha_to[rs->genpoly[i]], i); - } -#endif - - return rs; -} diff --git a/gnuradio-core/src/lib/reed-solomon/int.h b/gnuradio-core/src/lib/reed-solomon/int.h deleted file mode 100644 index 403d68757b..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/int.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Include file to configure the RS codec for integer symbols - * - * Copyright 2002, Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ -#define DTYPE int - -#include <gr_core_api.h> - -/* Reed-Solomon codec control block */ -struct GR_CORE_API rs { - unsigned int mm; /* Bits per symbol */ - unsigned int nn; /* Symbols per block (= (1<<mm)-1) */ - int *alpha_to; /* log lookup table */ - int *index_of; /* Antilog lookup table */ - int *genpoly; /* Generator polynomial */ - unsigned int nroots; /* Number of generator roots = number of parity symbols */ - unsigned int fcr; /* First consecutive root, index form */ - unsigned int prim; /* Primitive element, index form */ - unsigned int iprim; /* prim-th root of 1, index form */ -}; - -static inline int modnn(struct rs *rs,int x){ - while (x >= rs->nn) { - x -= rs->nn; - x = (x >> rs->mm) + (x & rs->nn); - } - return x; -} -#define MODNN(x) modnn(rs,x) - -#define MM (rs->mm) -#define NN (rs->nn) -#define ALPHA_TO (rs->alpha_to) -#define INDEX_OF (rs->index_of) -#define GENPOLY (rs->genpoly) -#define NROOTS (rs->nroots) -#define FCR (rs->fcr) -#define PRIM (rs->prim) -#define IPRIM (rs->iprim) -#define A0 (NN) - -#define ENCODE_RS encode_rs_int -#define DECODE_RS decode_rs_int -#define INIT_RS init_rs_int -#define FREE_RS free_rs_int - -GR_CORE_API void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity); -GR_CORE_API int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras); -void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, - unsigned int prim,unsigned int nroots); -GR_CORE_API void FREE_RS(void *p); - - - diff --git a/gnuradio-core/src/lib/reed-solomon/rs.3 b/gnuradio-core/src/lib/reed-solomon/rs.3 deleted file mode 100644 index c3953ce57a..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/rs.3 +++ /dev/null @@ -1,170 +0,0 @@ -.TH REED-SOLOMON 3 -.SH NAME -init_rs_int, encode_rs_int, decode_rs_int, free_rs_int, -init_rs_char, encode_rs_char, decode_rs_char, free_rs_char, -encode_rs_8, decode_rs_8, encode_rs_ccsds, decode_rs_ccsds -.SH SYNOPSIS -.nf -.ft B -#include "rs.h" - -void *init_rs_int(unsigned int symsize,unsigned int gfpoly,unsigned fcr, -unsigned prim,unsigned int nroots); -void encode_rs_int(void *rs,int *data,int *parity); -int decode_rs_int(void *rs,int *data,int *eras_pos,int no_eras); -void free_rs_int(void *rs); - -void *init_rs_char(unsigned int symsize,unsigned int gfpoly,unsigned fcr, -unsigned prim,unsigned int nroots); -void encode_rs_char(void *rs,unsigned char *data,unsigned char *parity); -int decode_rs_char(void *rs,unsigned char *data,int *eras_pos,int no_eras); -void free_rs_char(void *rs); - -void encode_rs_8(unsigned char *data,unsigned char *parity); -int decode_rs_8(unsigned char *data,int *eras_pos,int no_eras); - -void encode_rs_ccsds(unsigned char *data,unsigned char *parity); -int decode_rs_ccsds(unsigned char *data,int *eras_pos,int no_eras); - -unsigned char Taltab[256]; -unsigned char Tal1tab[256]; - -.fi - -.SH DESCRIPTION -These functions implement Reed-Solomon error control encoding and -decoding. For optimal performance in a variety of applications, three -sets of functions are supplied. To access these functions, add "-lrs" -to your linker command line. - -The functions with names ending in "_int" handle data in integer arrays, -permitting arbitrarily large codewords limited only by machine -resources. - -The functions with names ending in "_char" take unsigned char arrays and can -handle codes with symbols of 8 bits or less (i.e., with codewords of -255 symbols or less). - -\fBencode_rs_8\fR and \fBdecode_rs_8\fR implement a specific -(255,223) code with 8-bit symbols specified by the CCSDS: -a field generator of 1 + X + X^2 + X^7 + X^8 and a code -generator with first consecutive root = 112 and a primitive element of -11. These functions use the conventional -polynomial form, \fBnot\fR the dual-basis specified in -the CCSDS standard, to represent symbols. - -For full CCSDS compatibility, \fBencode_rs_ccsds\fR and -\fBdecode_rs_ccsds\fR are provided. These functions use two lookup -tables, \fBTaltab\fR to convert from conventional to dual-basis, and -\fBTal1tab\fR to perform the inverse mapping from dual-basis to -conventional form, before and after calls to \fBencode_rs_8\fR -and \fBdecode_rs_8\fR. - -The _8 and _ccsds functions do not require initialization. -To use the general purpose RS encoder or decoder (i.e., -the _char or _int versions), the user must first -call \fBinit_rs_int\fR or \fBinit_rs_char\fR as appropriate. The -arguments are as follows: - -\fBsymsize\fR gives the symbol size in bits, up to 8 for \fBinit_rs_char\fR -or 32 for \fBinit_rs_int\fR on a machine with 32-bit ints (though such a -huge code would exhaust memory limits on a 32-bit machine). The resulting -Reed-Solomon code word will have 2^\fBsymsize\fR - 1 symbols, -each containing \fBsymsize\fR bits. - -\fBgfpoly\fR gives the extended Galois field generator polynomial coefficients, -with the 0th coefficient in the low order bit. The polynomial -\fImust\fR be primitive; if not, the call will fail and NULL will be -returned. - -\fBfcr\fR gives, in index form, the first consecutive root of the -Reed Solomon code generator polynomial. - -\fBprim\fR gives, in index form, the primitive element in the Galois field -used to generate the Reed Solomon code generator polynomial. - -\fBnroots\fR gives the number of roots in the Reed Solomon code -generator polynomial. This equals the number of parity symbols -per code block. - -The resulting Reed-Solomon code has parameters (N,K), where -N = 2^\fBsymsize\fR-1 and K = N-\fBnroots\fR. - -The \fBencode_rs_char\fR and \fBencode_rs_int\fR functions accept -the pointer returned by \fBinit_rs_char\fR or -\fBinit_rs_int\fR, respectively, to -encode a block of data using the specified code. -The input data array is expected to -contain K symbols (of \fBsymsize\fR bits each, right justified -in each char or int) and \fBnroots\fR parity symbols will be placed -into the \fBparity\fR array, right justified. - -The \fBdecode_rs_char\fR and \fBdecode_rs_int\fR functions correct -the errors in a Reed-Solomon codeword up to the capability of the code. -An optional list of "erased" symbol indices may be given in the \fBeras_pos\fR -array to assist the decoder; this parameter may be NULL if no erasures -are given. The number of erased symbols must be given in the \fBno_eras\fR -parameter. - -To maximize performance, the encode and decode functions perform no -"sanity checking" of their inputs. Decoder failure may result if -\fBeras_pos\fR contains duplicate entries, and both encoder and -decoder will fail if an input symbol exceeds its allowable range. -(Symbol range overflow cannot occur with the _8 or _ccsds functions, -or with the _char functions when 8-bit symbols are specified.) - -The decoder corrects the symbols "in place", returning the number -of symbols in error. If the codeword is uncorrectable, -1 is returned -and the data block is unchanged. If \fBeras_pos\fR is non-null, it is -used to return a list of corrected symbol positions, in no particular -order. This means that the -array passed through this parameter \fImust\fR have at least \fBnroots\fR -elements to prevent a possible buffer overflow. - -The \fBfree_rs_int\fR and \fBfree_rs_char\fR functions free the internal -space allocated by the \fBinit_rs_int\fR and \fBinit_rs_char\fR functions, -respecitively. - -The functions \fBencode_rs_8\fR and \fBdecode_rs_8\fR do not have -corresponding \fBinit\fR and \fBfree\fR, nor do they take the -\fBrs\fR argument accepted by the other functions as their parameters -are statically compiled. These functions implement a code -equivalent to calling - -\fBinit_rs_char\fR(8,0x187,112,11,32); - -and using the resulting pointer with \fBencode_rs_char\fR and -\fBdecode_rs_char\fR. - -.SH RETURN VALUES -\fBinit_rs_int\fR and \fBinit_rs_char\fR return a pointer to an internal -control structure that must be passed to the corresponding encode, decode -and free functions. These functions return NULL on error. - -The decode functions return a count of corrected -symbols, or -1 if the block was uncorrectible. - -.SH AUTHOR -Phil Karn, KA9Q (karn@ka9q.net), based heavily on earlier work by Robert -Morelos-Zaragoza (rober@spectra.eng.hawaii.edu) and Hari Thirumoorthy -(harit@spectra.eng.hawaii.edu). - -.SH COPYRIGHT -Copyright 2002, Phil Karn, KA9Q. May be used under the terms of the -GNU General Public License (GPL). - -.SH SEE ALSO -CCSDS 101.0-B-5: Telemetry Channel Coding. -http://www.ccsds.org/documents/pdf/CCSDS-101.0-B-5.pdf - -.SH NOTE -CCSDS chose the "dual basis" symbol representation because it -simplified the implementation of a Reed-Solomon encoder in dedicated -hardware. However, this approach holds no advantages for a software -implementation on a general purpose computer, so use of the dual basis -is recommended only if compatibility with the CCSDS standard is needed, -e.g., to decode data from an existing spacecraft using the CCSDS -standard. If you just want a fast (255,223) RS codec without needing -to interoperate with a CCSDS standard code, use \fBencode_rs_8\fR -and \fBdecode_rs_8\fR. - diff --git a/gnuradio-core/src/lib/reed-solomon/rs.h b/gnuradio-core/src/lib/reed-solomon/rs.h deleted file mode 100644 index 97e78769ea..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/rs.h +++ /dev/null @@ -1,31 +0,0 @@ -#include <gr_core_api.h> -/* User include file for the Reed-Solomon codec - * Copyright 2002, Phil Karn KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ - -/* General purpose RS codec, 8-bit symbols */ -GR_CORE_API void encode_rs_char(void *rs,unsigned char *data,unsigned char *parity); -GR_CORE_API int decode_rs_char(void *rs,unsigned char *data,int *eras_pos, - int no_eras); -GR_CORE_API void *init_rs_char(unsigned int symsize,unsigned int gfpoly, - unsigned int fcr,unsigned int prim,unsigned int nroots); -GR_CORE_API void free_rs_char(void *rs); - -/* General purpose RS codec, integer symbols */ -GR_CORE_API void encode_rs_int(void *rs,int *data,int *parity); -GR_CORE_API int decode_rs_int(void *rs,int *data,int *eras_pos,int no_eras); -GR_CORE_API void *init_rs_int(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, - unsigned int prim,unsigned int nroots); -GR_CORE_API void free_rs_int(void *rs); - -/* CCSDS standard (255,223) RS codec with conventional (*not* dual-basis) - * symbol representation - */ -GR_CORE_API void encode_rs_8(unsigned char *data,unsigned char *parity); -GR_CORE_API int decode_rs_8(unsigned char *data,int *eras_pos,int no_eras); - -/* Tables to map from conventional->dual (Taltab) and - * dual->conventional (Tal1tab) bases - */ -extern unsigned char Taltab[],Tal1tab[]; diff --git a/gnuradio-core/src/lib/reed-solomon/rstest.c b/gnuradio-core/src/lib/reed-solomon/rstest.c deleted file mode 100644 index d8fc5448a7..0000000000 --- a/gnuradio-core/src/lib/reed-solomon/rstest.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Test the Reed-Solomon codecs - * for various block sizes and with random data and random error patterns - * - * Copyright 2002 Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <time.h> -#include "rs.h" - -int exercise_char(void *,int); - -#ifdef ALL_VERSIONS -int exercise_int(void *,int); -int exercise_8(int); -int exercise_ccsds(int); -#endif - -struct { - int symsize; - int genpoly; - int fcs; - int prim; - int nroots; - int ntrials; -} Tab[] = { - {2, 0x7, 1, 1, 1, 10 }, - {3, 0xb, 1, 1, 2, 10 }, - {4, 0x13, 1, 1, 4, 10 }, - {5, 0x25, 1, 1, 6, 10 }, - {6, 0x43, 1, 1, 8, 10 }, - {7, 0x89, 1, 1, 10, 10 }, - {8, 0x11d, 1, 1, 32, 10 }, - {8, 0x187, 112,11, 32, 10 }, /* Duplicates CCSDS codec */ -#ifdef ALL_VESIONS - {9, 0x211, 1, 1, 32, 10 }, - {10,0x409, 1, 1, 32, 10 }, - {11,0x805, 1, 1, 32, 10 }, - {12,0x1053, 1, 1, 32, 5 }, - {13,0x201b, 1, 1, 32, 2 }, - {14,0x4443, 1, 1, 32, 1 }, - {15,0x8003, 1, 1, 32, 1 }, - {16,0x1100b, 1, 1, 32, 1 }, -#endif - {0, 0, 0, 0, 0}, -}; - -int main(){ - void *handle; - int errs,terrs; - int i; - - terrs = 0; - srandom(time(NULL)); - -#ifdef ALL_VERSIONS - printf("Testing fixed (255,223) RS codec..."); - fflush(stdout); - errs = exercise_8(10); - terrs += errs; - if(errs == 0){ - printf("OK\n"); - } - printf("Testing CCSDS standard (255,223) RS codec..."); - fflush(stdout); - errs = exercise_ccsds(10); - terrs += errs; - if(errs == 0){ - printf("OK\n"); - } -#endif - - for(i=0;Tab[i].symsize != 0;i++){ - int nn,kk; - - nn = (1<<Tab[i].symsize) - 1; - kk = nn - Tab[i].nroots; - printf("Testing (%d,%d) RS codec...",nn,kk); - fflush(stdout); - if(Tab[i].symsize <= 8){ - if((handle = init_rs_char(Tab[i].symsize,Tab[i].genpoly,Tab[i].fcs,Tab[i].prim,Tab[i].nroots)) == NULL){ - printf("init_rs_char failed!\n"); - continue; - } - errs = exercise_char(handle,Tab[i].ntrials); - } else { -#ifdef ALL_VERSIONS - if((handle = init_rs_int(Tab[i].symsize,Tab[i].genpoly,Tab[i].fcs,Tab[i].prim,Tab[i].nroots)) == NULL){ - printf("init_rs_int failed!\n"); - continue; - } - errs = exercise_int(handle,Tab[i].ntrials); -#else - printf ("init_rs_init support is not enabled\n"); - exit (1); -#endif - - } - terrs += errs; - if(errs == 0){ - printf("OK\n"); - } - free_rs_char(handle); - } - if(terrs == 0) - printf("All codec tests passed!\n"); - - exit(0); -} - - diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt index 70938a0f17..11bfcfe279 100644 --- a/gnuradio-core/src/lib/runtime/CMakeLists.txt +++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt @@ -90,6 +90,20 @@ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/gr_select_handler.cc ) +if(ENABLE_GR_CTRLPORT) +list(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/ice_application_base.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_ice.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_ice.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_aggregator.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_aggregator.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_selector.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcpmtconverters_ice.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rpcmanager.cc +) +endif(ENABLE_GR_CTRLPORT) + + ######################################################################## # Append gnuradio-core test sources ######################################################################## @@ -157,6 +171,28 @@ install(FILES COMPONENT "core_devel" ) + +if(ENABLE_GR_CTRLPORT) +ADD_DEFINITIONS(-DGR_CTRLPORT) +INSTALL(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/ice_application_base.h + ${CMAKE_CURRENT_SOURCE_DIR}/ice_server_template.h + ${CMAKE_CURRENT_SOURCE_DIR}/rpccallbackregister_base.h + ${CMAKE_CURRENT_SOURCE_DIR}/rpcmanager_base.h + ${CMAKE_CURRENT_SOURCE_DIR}/rpcmanager.h + ${CMAKE_CURRENT_SOURCE_DIR}/rpcpmtconverters_ice.h + ${CMAKE_CURRENT_SOURCE_DIR}/rpcregisterhelpers.h + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_aggregator.h + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_base.h + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_aggregator.h + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_base.h + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_ice.h + ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_selector.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) +endif(ENABLE_GR_CTRLPORT) + ######################################################################## # Install swig headers ######################################################################## diff --git a/gnuradio-core/src/lib/runtime/ICE_LICENSE b/gnuradio-core/src/lib/runtime/ICE_LICENSE new file mode 100644 index 0000000000..43ea7572d9 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/ICE_LICENSE @@ -0,0 +1,54 @@ +Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. + +This copy of Ice is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 as +published by the Free Software Foundation. + +Ice is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public License version +2 along with this program; if not, see http://www.gnu.org/licenses. + +Linking Ice statically or dynamically with other software (such as a +library, module or application) is making a combined work based on Ice. +Thus, the terms and conditions of the GNU General Public License version +2 cover this combined work. + +If such software can only be used together with Ice, then not only the +combined work but the software itself is a work derived from Ice and as +such shall be licensed under the terms of the GNU General Public License +version 2. This includes the situation where Ice is only being used +through an abstraction layer. + +As a special exception to the above, ZeroC grants to the contributors for +the following projects the permission to license their Ice-based software +under the terms of the GNU Lesser General Public License (LGPL) version +2.1 or of the BSD license: + + - Orca Robotics (http://orca-robotics.sourceforge.net) + + - Mumble (http://mumble.sourceforge.net) + +This exception does not extend to the parts of Ice used by these +projects, or to any other derived work: as a whole, any work based on Ice +shall be licensed under the terms and conditions of the GNU General +Public License version 2. + +You may also combine Ice with any software not derived from Ice, provided +the license of such software is compatible with the GNU General Public +License version 2. In addition, as a special exception, ZeroC grants you +permission to combine Ice with: + + - the OpenSSL library, or with a modified version of the OpenSSL library + that uses the same license as OpenSSL + + - any library not derived from Ice and licensed under the terms of + the Apache License, version 2.0 + (http://www.apache.org/licenses/LICENSE-2.0.html) + +If you modify this copy of Ice, you may extend any of the exceptions +provided above to your version of Ice, but you are not obligated to +do so. diff --git a/gnuradio-core/src/lib/runtime/IcePy_Communicator.h b/gnuradio-core/src/lib/runtime/IcePy_Communicator.h new file mode 100644 index 0000000000..d613190d2c --- /dev/null +++ b/gnuradio-core/src/lib/runtime/IcePy_Communicator.h @@ -0,0 +1,35 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef ICEPY_COMMUNICATOR_H +#define ICEPY_COMMUNICATOR_H + +#include <Ice/CommunicatorF.h> +#include <gr_core_api.h> + +namespace IcePy +{ + +extern PyTypeObject CommunicatorType; + +GR_CORE_API bool initCommunicator(PyObject*); + +GR_CORE_API Ice::CommunicatorPtr getCommunicator(PyObject*); + +GR_CORE_API PyObject* createCommunicator(const Ice::CommunicatorPtr&); +GR_CORE_API PyObject* getCommunicatorWrapper(const Ice::CommunicatorPtr&); + +} + +extern "C" PyObject* IcePy_initialize(PyObject*, PyObject*); +extern "C" PyObject* IcePy_initializeWithProperties(PyObject*, PyObject*); +extern "C" PyObject* IcePy_initializeWithLogger(PyObject*, PyObject*); +extern "C" PyObject* IcePy_initializeWithPropertiesAndLogger(PyObject*, PyObject*); + +#endif diff --git a/gnuradio-core/src/lib/runtime/frontend.ice b/gnuradio-core/src/lib/runtime/frontend.ice new file mode 100644 index 0000000000..befb5b7a97 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/frontend.ice @@ -0,0 +1,102 @@ +/* + * 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 <gnuradio.ice> + +[["python:package:gnuradio.ctrlport"]] +module GNURadio { + module Frontend { + + exception NotSupported {}; + exception InvalidSetting { string msg; }; + exception ReceiverFailure { string msg; }; + exception NotExist {}; + dictionary<string, string> TunerArgs; + + struct TunerStatus { + int a2dbits; + float gain; + bool isInverted; + }; + + interface Tuner { + TunerStatus configureTuner(TunerArgs args); //ADDED + idempotent TunerStatus status(); + idempotent float setGain(float gain) throws NotSupported, InvalidSetting; + idempotent bool setInversion(bool inverted) throws NotSupported, InvalidSetting; + }; + + struct ChannelStatus { + string uid; + bool active; + float freq; + float bandwidth; + int payloadBits; + bool isComplex; + string signalName; + }; + + interface Channel extends Component { + idempotent ChannelStatus status(); + idempotent FeedInfo feed(); + idempotent bool active(); + void start(); + void stop(); + idempotent float setCenterFreq(float freq) throws NotSupported, InvalidSetting; + idempotent float setBandwidth(float bw) throws NotSupported, InvalidSetting; + idempotent int setPayloadBits(int bits) throws NotSupported, InvalidSetting; + idempotent bool setComplex(bool complex) throws NotSupported, InvalidSetting; + void removeChannel() throws NotSupported; + }; + + sequence<Tuner*> TunerSeq; + sequence<Channel*> ChannelSeq; + + struct ChannelizerStatus { + string uid; + string signalName; + }; + + interface Channelizer extends Component { + idempotent ChannelizerStatus status(); + idempotent Tuner* getTuner(); + idempotent ChannelSeq getChannels(); + idempotent ChannelSeq getActiveChannels(); + idempotent ChannelSeq getInactiveChannels(); + Channel* createChannel(float freq, float bw, int payloadBits, string address, int port) throws NotSupported; + }; + + sequence<Channelizer*> ChannelizerSeq; + + interface Receiver extends AbstractReceiver { + idempotent ChannelizerSeq getInputs(); +// idempotent ChannelizerSeq getActiveInputs(); +// idempotent ChannelizerSeq getInactiveInputs(); + idempotent Channel* getChannelByID(string id) throws NotExist; + idempotent Channelizer* getChannelizerByID(string id) throws NotExist; + }; + + + }; + + + +}; diff --git a/gnuradio-core/src/lib/runtime/gnuradio.ice b/gnuradio-core/src/lib/runtime/gnuradio.ice new file mode 100644 index 0000000000..971d8fa0e6 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gnuradio.ice @@ -0,0 +1,150 @@ +/* + * 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. + */ + +[["python:package:gnuradio.ctrlport"]] + +#ifndef GNURADIO_DEBUG +#define GNURADIO_DEBUG + +module GNURadio { +class Knob {}; +class KnobB extends Knob { bool value; }; +class KnobC extends Knob { byte value; }; +class KnobI extends Knob { int value; }; +class KnobF extends Knob { float value; }; +class KnobD extends Knob { double value; }; +class KnobL extends Knob { long value; }; +class KnobS extends Knob { string value; }; + +sequence<bool> VectorB; sequence<byte> VectorC; +sequence<int> VectorI; sequence<float> VectorF; +sequence<double> VectorD; sequence<string> VectorS; +sequence<long> VectorL; + +class KnobVecB extends Knob { VectorB value; }; +class KnobVecC extends Knob { VectorC value; }; +class KnobVecI extends Knob { VectorI value; }; +class KnobVecF extends Knob { VectorF value; }; +class KnobVecD extends Knob { VectorD value; }; +class KnobVecL extends Knob { VectorL value; }; +class KnobVecS extends Knob { VectorS value; }; + +enum KnobType { KNOBBOOL, KNOBCHAR, KNOBINT, KNOBFLOAT, + KNOBDOUBLE, KNOBSTRING, KNOBLONG, KNOBVECBOOL, + KNOBVECCHAR, KNOBVECINT, KNOBVECFLOAT, KNOBVECDOUBLE, + KNOBVECSTRING, KNOBVECLONG }; + +enum DisplayType { + DISPNULL, + DISPTIMESERIESF, + DISPTIMESERIESC, + DISPXYSCATTER, + DISPXYLINE +}; + +struct KnobProp { + KnobType type; + string units; + string description; + DisplayType display; + Knob min; + Knob max; + Knob defaultvalue; +}; + +sequence<string> KnobIDList; +dictionary<string, Knob> KnobMap; +dictionary<string, KnobProp> KnobPropMap; +dictionary<string, string> WaveformArgMap; + +interface StreamReceiver { + void push(VectorC data); +}; + +interface ControlPort { + void set(KnobMap knobs); + idempotent KnobMap get(KnobIDList knobs); + idempotent KnobPropMap properties(KnobIDList knobs); + void shutdown(); + +// string subscribe(StreamReceiver* proxy, string streamName, int requestedPeriod, int RequestedSize); +// idempotent void unsubscribe(string streamID); +}; + +struct FeedInfo { + string protocol; + string address; + string iface; + string port; +}; + +//TODO: convert this part to a Feed Info +struct ReceiverInfo { + string uid; + string signalType; + string signalName; + string allocatableObjectID; + string signalProtocol; + string signalAddress; + string signalInterface; + string signalPort; +}; + +interface Component { + void setName(string newName); +}; + +module Frontend { + interface AbstractReceiver extends Component { + idempotent ReceiverInfo getReceiverInfo(); + }; +}; + +module Booter { + dictionary<string, string> WaveformArgs; + + exception WaveformRunningError { + string waveformClass; + float centerFrequencyHz; + }; + exception SignalSourceError {string msg; }; + + interface WaveformBooter extends Frontend::AbstractReceiver { + string launchWaveform(string waveformClass, WaveformArgs args) + throws WaveformRunningError, SignalSourceError; + +// string launchWaveformWithSession(string waveformClass, WaveformArgs args, IceGrid::Session* session) +// throws WaveformRunningError; + WaveformArgMap getDriverEnum(); + WaveformArgMap getSourceInfo(); + idempotent bool waveformRunning(); + idempotent string getWaveformClass(); + void shutdown(); + }; +}; + +//interface Pingable { +// bool ping(); +//}; + +}; + +#endif diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.cc b/gnuradio-core/src/lib/runtime/gr_basic_block.cc index 6ff57a1d6c..35ea797167 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.cc @@ -30,8 +30,6 @@ #include <sstream> #include <iostream> -using namespace pmt; - static long s_next_id = 0; static long s_ncurrently_allocated = 0; @@ -51,7 +49,8 @@ gr_basic_block::gr_basic_block(const std::string &name, d_symbolic_id(global_block_registry.block_register(this)), d_symbol_name(global_block_registry.register_symbolic_name(this)), d_color(WHITE), - message_subscribers(pmt::pmt_make_dict()) + d_rpc_set(false), + message_subscribers(pmt::make_dict()) { s_ncurrently_allocated++; } @@ -80,7 +79,7 @@ gr_basic_block::set_block_alias(std::string name) void gr_basic_block::message_port_register_in(pmt::pmt_t port_id) { - if(!pmt::pmt_is_symbol(port_id)) { + if(!pmt::is_symbol(port_id)) { throw std::runtime_error("message_port_register_in: bad port id"); } msg_queue[port_id] = msg_queue_t(); @@ -90,10 +89,10 @@ gr_basic_block::message_port_register_in(pmt::pmt_t port_id) pmt::pmt_t gr_basic_block::message_ports_in() { - pmt::pmt_t port_names = pmt::pmt_make_vector(msg_queue.size(), pmt::PMT_NIL); + pmt::pmt_t port_names = pmt::make_vector(msg_queue.size(), pmt::PMT_NIL); msg_queue_map_itr itr = msg_queue.begin(); for(size_t i = 0; i < msg_queue.size(); i++) { - pmt::pmt_vector_set(port_names, i, (*itr).first); + pmt::vector_set(port_names, i, (*itr).first); itr++; } return port_names; @@ -103,23 +102,23 @@ gr_basic_block::message_ports_in() void gr_basic_block::message_port_register_out(pmt::pmt_t port_id) { - if(!pmt::pmt_is_symbol(port_id)) { + if(!pmt::is_symbol(port_id)) { throw std::runtime_error("message_port_register_out: bad port id"); } - if(pmt::pmt_dict_has_key(message_subscribers, port_id)) { + if(pmt::dict_has_key(message_subscribers, port_id)) { throw std::runtime_error("message_port_register_out: port already in use"); } - message_subscribers = pmt::pmt_dict_add(message_subscribers, port_id, pmt::PMT_NIL); + message_subscribers = pmt::dict_add(message_subscribers, port_id, pmt::PMT_NIL); } pmt::pmt_t gr_basic_block::message_ports_out() { - size_t len = pmt::pmt_length(message_subscribers); - pmt::pmt_t port_names = pmt::pmt_make_vector(len, pmt::PMT_NIL); - pmt::pmt_t keys = pmt::pmt_dict_keys(message_subscribers); + size_t len = pmt::length(message_subscribers); + pmt::pmt_t port_names = pmt::make_vector(len, pmt::PMT_NIL); + pmt::pmt_t keys = pmt::dict_keys(message_subscribers); for(size_t i = 0; i < len; i++) { - pmt::pmt_vector_set(port_names, i, pmt::pmt_nth(i, keys)); + pmt::vector_set(port_names, i, pmt::nth(i, keys)); } return port_names; } @@ -127,19 +126,19 @@ gr_basic_block::message_ports_out() // - publish a message on a message port void gr_basic_block::message_port_pub(pmt::pmt_t port_id, pmt::pmt_t msg) { - if(!pmt::pmt_dict_has_key(message_subscribers, port_id)) { + if(!pmt::dict_has_key(message_subscribers, port_id)) { throw std::runtime_error("port does not exist"); } - pmt::pmt_t currlist = pmt::pmt_dict_ref(message_subscribers, port_id, pmt::PMT_NIL); + pmt::pmt_t currlist = pmt::dict_ref(message_subscribers, port_id, pmt::PMT_NIL); // iterate through subscribers on port - while(pmt::pmt_is_pair(currlist)) { - pmt::pmt_t target = pmt::pmt_car(currlist); + while(pmt::is_pair(currlist)) { + pmt::pmt_t target = pmt::car(currlist); - pmt::pmt_t block = pmt::pmt_car(target); - pmt::pmt_t port = pmt::pmt_cdr(target); + pmt::pmt_t block = pmt::car(target); + pmt::pmt_t port = pmt::cdr(target); - currlist = pmt::pmt_cdr(currlist); + currlist = pmt::cdr(currlist); gr_basic_block_sptr blk = global_block_registry.block_lookup(block); //blk->post(msg); blk->post(port, msg); @@ -149,33 +148,33 @@ void gr_basic_block::message_port_pub(pmt::pmt_t port_id, pmt::pmt_t msg) // - subscribe to a message port void gr_basic_block::message_port_sub(pmt::pmt_t port_id, pmt::pmt_t target){ - if(!pmt::pmt_dict_has_key(message_subscribers, port_id)){ + if(!pmt::dict_has_key(message_subscribers, port_id)){ std::stringstream ss; - ss << "Port does not exist: \"" << pmt::pmt_write_string(port_id) << "\" on block: " << pmt::pmt_write_string(target) << std::endl; + ss << "Port does not exist: \"" << pmt::write_string(port_id) << "\" on block: " << pmt::write_string(target) << std::endl; throw std::runtime_error(ss.str()); } - pmt::pmt_t currlist = pmt::pmt_dict_ref(message_subscribers,port_id,pmt::PMT_NIL); + pmt::pmt_t currlist = pmt::dict_ref(message_subscribers,port_id,pmt::PMT_NIL); // ignore re-adds of the same target - if(!pmt::pmt_list_has(currlist, target)) - message_subscribers = pmt::pmt_dict_add(message_subscribers,port_id,pmt::pmt_list_add(currlist,target)); + if(!pmt::list_has(currlist, target)) + message_subscribers = pmt::dict_add(message_subscribers,port_id,pmt::list_add(currlist,target)); } void gr_basic_block::message_port_unsub(pmt::pmt_t port_id, pmt::pmt_t target){ - if(!pmt::pmt_dict_has_key(message_subscribers, port_id)){ + if(!pmt::dict_has_key(message_subscribers, port_id)){ std::stringstream ss; - ss << "Port does not exist: \"" << pmt::pmt_write_string(port_id) << "\" on block: " << pmt::pmt_write_string(target) << std::endl; + ss << "Port does not exist: \"" << pmt::write_string(port_id) << "\" on block: " << pmt::write_string(target) << std::endl; throw std::runtime_error(ss.str()); } // ignore unsubs of unknown targets - pmt::pmt_t currlist = pmt::pmt_dict_ref(message_subscribers,port_id,pmt::PMT_NIL); - message_subscribers = pmt::pmt_dict_add(message_subscribers,port_id,pmt::pmt_list_rm(currlist,target)); + pmt::pmt_t currlist = pmt::dict_ref(message_subscribers,port_id,pmt::PMT_NIL); + message_subscribers = pmt::dict_add(message_subscribers,port_id,pmt::list_rm(currlist,target)); } void -gr_basic_block::_post(pmt_t which_port, pmt_t msg) +gr_basic_block::_post(pmt::pmt_t which_port, pmt::pmt_t msg) { insert_tail(which_port, msg); } @@ -186,7 +185,7 @@ gr_basic_block::insert_tail(pmt::pmt_t which_port, pmt::pmt_t msg) gruel::scoped_lock guard(mutex); if( (msg_queue.find(which_port) == msg_queue.end()) || (msg_queue_ready.find(which_port) == msg_queue_ready.end())){ - std::cout << "target port = " << pmt::pmt_symbol_to_string(which_port) << std::endl; + std::cout << "target port = " << pmt::symbol_to_string(which_port) << std::endl; throw std::runtime_error("attempted to insert_tail on invalid queue!"); } @@ -197,7 +196,7 @@ gr_basic_block::insert_tail(pmt::pmt_t which_port, pmt::pmt_t msg) global_block_registry.notify_blk(alias()); } -pmt_t +pmt::pmt_t gr_basic_block::delete_head_nowait(pmt::pmt_t which_port) { gruel::scoped_lock guard(mutex); @@ -206,13 +205,13 @@ gr_basic_block::delete_head_nowait(pmt::pmt_t which_port) return pmt::pmt_t(); } - pmt_t m(msg_queue[which_port].front()); + pmt::pmt_t m(msg_queue[which_port].front()); msg_queue[which_port].pop_front(); return m; } -pmt_t +pmt::pmt_t gr_basic_block::delete_head_blocking(pmt::pmt_t which_port) { gruel::scoped_lock guard(mutex); @@ -221,7 +220,7 @@ gr_basic_block::delete_head_blocking(pmt::pmt_t which_port) msg_queue_ready[which_port]->wait(guard); } - pmt_t m(msg_queue[which_port].front()); + pmt::pmt_t m(msg_queue[which_port].front()); msg_queue[which_port].pop_front(); return m; } diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h index 9cc2ad7755..d4f5cb5941 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.h +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h @@ -38,6 +38,10 @@ #include <boost/thread/condition_variable.hpp> #include <iostream> +#ifdef GR_CTRLPORT +#include <rpcregisterhelpers.h> +#endif + /*! * \brief The abstract base class for all signal processing blocks. * \ingroup internal @@ -68,13 +72,13 @@ class GR_CORE_API gr_basic_block : public gr_msg_accepter, public boost::enable_ }; //msg_handler_t d_msg_handler; - typedef std::map<pmt::pmt_t , msg_handler_t, pmt::pmt_comperator> d_msg_handlers_t; + typedef std::map<pmt::pmt_t , msg_handler_t, pmt::comperator> d_msg_handlers_t; d_msg_handlers_t d_msg_handlers; typedef std::deque<pmt::pmt_t> msg_queue_t; - typedef std::map<pmt::pmt_t, msg_queue_t, pmt::pmt_comperator> msg_queue_map_t; - typedef std::map<pmt::pmt_t, msg_queue_t, pmt::pmt_comperator>::iterator msg_queue_map_itr; - std::map<pmt::pmt_t, boost::shared_ptr<boost::condition_variable>, pmt::pmt_comperator> msg_queue_ready; + typedef std::map<pmt::pmt_t, msg_queue_t, pmt::comperator> msg_queue_map_t; + typedef std::map<pmt::pmt_t, msg_queue_t, pmt::comperator>::iterator msg_queue_map_itr; + std::map<pmt::pmt_t, boost::shared_ptr<boost::condition_variable>, pmt::comperator> msg_queue_ready; gruel::mutex mutex; //< protects all vars @@ -93,7 +97,10 @@ class GR_CORE_API gr_basic_block : public gr_msg_accepter, public boost::enable_ std::string d_symbol_name; std::string d_symbol_alias; vcolor d_color; + bool d_rpc_set; + msg_queue_map_t msg_queue; + std::vector<boost::any> d_rpc_vars; // container for all RPC variables gr_basic_block(void){} //allows pure virtual interface sub-classes @@ -132,7 +139,7 @@ class GR_CORE_API gr_basic_block : public gr_msg_accepter, public boost::enable_ gr_basic_block_sptr to_basic_block(); // Needed for Python type coercion bool alias_set() { return !d_symbol_alias.empty(); } std::string alias(){ return alias_set()?d_symbol_alias:symbol_name(); } - pmt::pmt_t alias_pmt(){ return pmt::pmt_intern(alias()); } + pmt::pmt_t alias_pmt(){ return pmt::intern(alias()); } void set_block_alias(std::string name); // ** Message passing interface ** @@ -204,12 +211,53 @@ class GR_CORE_API gr_basic_block : public gr_msg_accepter, public boost::enable_ if(msg_queue.find(which_port) != msg_queue.end()){ return true; } - if(pmt::pmt_dict_has_key(message_subscribers, which_port)){ + if(pmt::dict_has_key(message_subscribers, which_port)){ return true; } return false; } - + +#ifdef GR_CTRLPORT + /*! + * \brief Add an RPC variable (get or set). + * + * Using controlport, we create new getters/setters and need to + * store them. Each block has a vector to do this, and these never + * need to be accessed again once they are registered with the RPC + * backend. This function takes a + * boost::shared_sptr<rpcbasic_base> so that when the block is + * deleted, all RPC registered variables are cleaned up. + * + * \param s an rpcbasic_sptr of the new RPC variable register to store. + */ + void add_rpc_variable(rpcbasic_sptr s) + { + d_rpc_vars.push_back(s); + } +#endif /* GR_CTRLPORT */ + + /*! + * \brief Set up the RPC registered variables. + * + * This must be overloaded by a block that wants to use + * controlport. This is where rpcbasic_register_{get,set} pointers + * are created, which then get wrapped as shared pointers + * (rpcbasic_sptr(...)) and stored using add_rpc_variable. + */ + virtual void setup_rpc() {}; + + /*! + * \brief Ask if this block has been registered to the RPC. + * + * We can only register a block once, so we use this to protect us + * from calling it multiple times. + */ + bool is_rpc_set() { return d_rpc_set; } + + /*! + * \brief When the block is registered with the RPC, set this. + */ + void rpc_set() { d_rpc_set = true; } /*! * \brief Confirm that ninputs and noutputs is an acceptable combination. @@ -252,9 +300,6 @@ class GR_CORE_API gr_basic_block : public gr_msg_accepter, public boost::enable_ * If the block inherits from gr_hier_block2, the runtime system will * ensure that no reentrant calls are made to msg_handler. */ - //template <typename T> void set_msg_handler(T msg_handler){ - // d_msg_handler = msg_handler_t(msg_handler); - //} template <typename T> void set_msg_handler(pmt::pmt_t which_port, T msg_handler){ if(msg_queue.find(which_port) == msg_queue.end()){ throw std::runtime_error("attempt to set_msg_handler() on bad input message port!"); } diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index fd82ab580e..33c460e1a0 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -44,6 +44,7 @@ gr_block::gr_block (const std::string &name, d_max_noutput_items_set(false), d_max_noutput_items(0), d_tag_propagation_policy(TPP_ALL_TO_ALL), + d_pc_rpc_set(false), d_max_output_buffer(std::max(output_signature->max_streams(),1), -1), d_min_output_buffer(std::max(output_signature->max_streams(),1), -1) { @@ -346,6 +347,43 @@ gr_block::pc_work_time() } } +void +gr_block::setup_pc_rpc() +{ + d_pc_rpc_set = true; +#ifdef GR_CTRLPORT + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( + alias(), "noutput_items", &gr_block::pc_noutput_items, + pmt::mp(0), pmt::mp(32768), pmt::mp(0), + "", "Average noutput items", RPC_PRIVLVL_MIN, DISPTIMESERIESF))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( + alias(), "nproduced", &gr_block::pc_nproduced, + pmt::mp(0), pmt::mp(32768), pmt::mp(0), + "", "Average items produced", RPC_PRIVLVL_MIN, DISPTIMESERIESF))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<gr_block, float>( + alias(), "work time", &gr_block::pc_work_time, + pmt::mp(0), pmt::mp(1e9), pmt::mp(0), + "", "Average clock cycles in call to work", RPC_PRIVLVL_MIN, DISPTIMESERIESF))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<gr_block, std::vector<float> >( + alias(), "input \% full", &gr_block::pc_input_buffers_full, + pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), + "", "Average of how full input buffers are", RPC_PRIVLVL_MIN, DISPTIMESERIESF))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<gr_block, std::vector<float> >( + alias(), "output \% full", &gr_block::pc_output_buffers_full, + pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0), + "", "Average of how full output buffers are", RPC_PRIVLVL_MIN, DISPTIMESERIESF))); +#endif /* GR_CTRLPORT */ +} + std::ostream& operator << (std::ostream& os, const gr_block *m) { diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index c9d2d8f530..96e07439ef 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -395,6 +395,24 @@ class GR_CORE_API gr_block : public gr_basic_block { */ float pc_work_time(); + /*! + * \brief Sets up export of perf. counters to ControlPort. Only + * called by the scheduler. + */ + void setup_pc_rpc(); + + /*! + * \brief Checks if this block is already exporting perf. counters + * to ControlPort. + */ + bool is_pc_rpc_set() { return d_pc_rpc_set; } + + /*! + * \brief If the block calls this in its constructor, it's + * perf. counters will not be exported. + */ + void no_pc_rpc() { d_pc_rpc_set = true; } + // ---------------------------------------------------------------------------- // Functions to handle thread affinity @@ -432,6 +450,7 @@ class GR_CORE_API gr_block : public gr_basic_block { int d_max_noutput_items; // value of max_noutput_items for this block tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream std::vector<unsigned int> d_affinity; // thread affinity proc. mask + bool d_pc_rpc_set; protected: gr_block (void){} //allows pure virtual interface sub-classes diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index ff20e0e85a..b151bd96d2 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -28,8 +28,6 @@ #include <gr_buffer.h> #include <iostream> -using namespace pmt; - static long s_ncurrently_allocated = 0; long @@ -151,8 +149,8 @@ gr_block_detail::nitems_written(unsigned int which_output) void gr_block_detail::add_item_tag(unsigned int which_output, const gr_tag_t &tag) { - if(!pmt_is_symbol(tag.key)) { - throw pmt_wrong_type("gr_block_detail::add_item_tag key", tag.key); + if(!pmt::is_symbol(tag.key)) { + throw pmt::wrong_type("gr_block_detail::add_item_tag key", tag.key); } else { // Add tag to gr_buffer's deque tags @@ -163,8 +161,8 @@ gr_block_detail::add_item_tag(unsigned int which_output, const gr_tag_t &tag) void gr_block_detail::remove_item_tag(unsigned int which_input, const gr_tag_t &tag) { - if(!pmt_is_symbol(tag.key)) { - throw pmt_wrong_type("gr_block_detail::add_item_tag key", tag.key); + if(!pmt::is_symbol(tag.key)) { + throw pmt::wrong_type("gr_block_detail::add_item_tag key", tag.key); } else { // Add tag to gr_buffer's deque tags @@ -187,7 +185,7 @@ gr_block_detail::get_tags_in_range(std::vector<gr_tag_t> &v, unsigned int which_input, uint64_t abs_start, uint64_t abs_end, - const pmt_t &key) + const pmt::pmt_t &key) { std::vector<gr_tag_t> found_items; @@ -197,11 +195,11 @@ gr_block_detail::get_tags_in_range(std::vector<gr_tag_t> &v, d_input[which_input]->get_tags_in_range(found_items, abs_start, abs_end); // Filter further by key name - pmt_t itemkey; + pmt::pmt_t itemkey; std::vector<gr_tag_t>::iterator itr; for(itr = found_items.begin(); itr != found_items.end(); itr++) { itemkey = (*itr).key; - if(pmt_eqv(key, itemkey)) { + if(pmt::eqv(key, itemkey)) { v.push_back(*itr); } } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index a8ed8da908..dd8be71c9c 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -182,7 +182,7 @@ class GR_CORE_API gr_block_detail { float pc_output_buffers_full(size_t which); std::vector<float> pc_output_buffers_full(); float pc_work_time(); - + gr_tpb_detail d_tpb; // used by thread-per-block scheduler int d_produce_or; diff --git a/gnuradio-core/src/lib/runtime/gr_block_registry.cc b/gnuradio-core/src/lib/runtime/gr_block_registry.cc index ff23d97eb2..eaa770dcaf 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_registry.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_registry.cc @@ -8,7 +8,7 @@ gr_block_registry global_block_registry; gr_block_registry::gr_block_registry(){ - d_ref_map = pmt::pmt_make_dict(); + d_ref_map = pmt::make_dict(); } long gr_block_registry::block_register(gr_basic_block* block){ @@ -29,9 +29,9 @@ long gr_block_registry::block_register(gr_basic_block* block){ void gr_block_registry::block_unregister(gr_basic_block* block){ d_map[block->name()].erase( d_map[block->name()].find(block->symbolic_id())); - d_ref_map = pmt::pmt_dict_delete(d_ref_map, pmt::pmt_intern(block->symbol_name())); + d_ref_map = pmt::dict_delete(d_ref_map, pmt::intern(block->symbol_name())); if(block->alias_set()){ - d_ref_map = pmt::pmt_dict_delete(d_ref_map, pmt::pmt_intern(block->alias())); + d_ref_map = pmt::dict_delete(d_ref_map, pmt::intern(block->alias())); } } @@ -44,18 +44,18 @@ std::string gr_block_registry::register_symbolic_name(gr_basic_block* block){ } void gr_block_registry::register_symbolic_name(gr_basic_block* block, std::string name){ - if(pmt_dict_has_key(d_ref_map, pmt::pmt_intern(name))){ + if(dict_has_key(d_ref_map, pmt::intern(name))){ throw std::runtime_error("symbol already exists, can not re-use!"); } - d_ref_map = pmt_dict_add(d_ref_map, pmt::pmt_intern(name), pmt::pmt_make_any(block)); + d_ref_map = dict_add(d_ref_map, pmt::intern(name), pmt::make_any(block)); } gr_basic_block_sptr gr_block_registry::block_lookup(pmt::pmt_t symbol){ - pmt::pmt_t ref = pmt_dict_ref(d_ref_map, symbol, pmt::PMT_NIL); - if(pmt::pmt_eq(ref, pmt::PMT_NIL)){ + pmt::pmt_t ref = dict_ref(d_ref_map, symbol, pmt::PMT_NIL); + if(pmt::eq(ref, pmt::PMT_NIL)){ throw std::runtime_error("block lookup failed! block not found!"); } - gr_basic_block* blk = boost::any_cast<gr_basic_block*>( pmt::pmt_any_ref(ref) ); + gr_basic_block* blk = boost::any_cast<gr_basic_block*>( pmt::any_ref(ref) ); return blk->shared_from_this(); } diff --git a/gnuradio-core/src/lib/runtime/gr_block_registry.h b/gnuradio-core/src/lib/runtime/gr_block_registry.h index 6a2d939e51..3ad457ee79 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_registry.h +++ b/gnuradio-core/src/lib/runtime/gr_block_registry.h @@ -1,6 +1,7 @@ #ifndef GR_BLOCK_REGISTRY_H #define GR_BLOCK_REGISTRY_H +#include <gr_core_api.h> #include <map> #ifndef GR_BASIC_BLOCK_H @@ -8,7 +9,7 @@ class gr_basic_block; class gr_block; #endif -class gr_block_registry { +class GR_CORE_API gr_block_registry { public: gr_block_registry(); @@ -36,7 +37,7 @@ class gr_block_registry { }; -extern gr_block_registry global_block_registry; +GR_CORE_API extern gr_block_registry global_block_registry; #endif diff --git a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc index 9294a5dca2..79b0b0f59d 100644 --- a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc +++ b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc @@ -78,7 +78,7 @@ gr_flat_flowgraph::setup_connections() std::cout << boost::format("flat_fg connecting msg primitives: (%s, %s)->(%s, %s)\n") % i->src().block() % i->src().port() % i->dst().block() % i->dst().port(); - i->src().block()->message_port_sub( i->src().port(), pmt::pmt_cons(i->dst().block()->alias_pmt(), i->dst().port()) ); + i->src().block()->message_port_sub( i->src().port(), pmt::cons(i->dst().block()->alias_pmt(), i->dst().port()) ); } } @@ -401,3 +401,15 @@ void gr_flat_flowgraph::replace_endpoint(const gr_msg_endpoint &e, const gr_msg_ } } +void +gr_flat_flowgraph::enable_pc_rpc() +{ +#ifdef GR_PERFORMANCE_COUNTERS + gr_basic_block_viter_t p; + for(p = d_blocks.begin(); p != d_blocks.end(); p++) { + gr_block_sptr block = cast_to_block_sptr(*p); + if(!block->is_pc_rpc_set()) + block->setup_pc_rpc(); + } +#endif /* GR_PERFORMANCE_COUNTERS */ +} diff --git a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h index 5c8268d7df..031564f2ec 100644 --- a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h +++ b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h @@ -60,6 +60,12 @@ public: void replace_endpoint(const gr_msg_endpoint &e, const gr_msg_endpoint &r, bool is_src); void clear_endpoint(const gr_msg_endpoint &e, bool is_src); + /*! + * Enables export of perf. counters to ControlPort on all blocks in + * the flowgraph. + */ + void enable_pc_rpc(); + private: gr_flat_flowgraph(); diff --git a/gnuradio-core/src/lib/runtime/gr_flowgraph.h b/gnuradio-core/src/lib/runtime/gr_flowgraph.h index bef70f626f..3c8cd3cb02 100644 --- a/gnuradio-core/src/lib/runtime/gr_flowgraph.h +++ b/gnuradio-core/src/lib/runtime/gr_flowgraph.h @@ -73,7 +73,7 @@ public: inline bool gr_msg_endpoint::operator==(const gr_msg_endpoint &other) const { return (d_basic_block == other.d_basic_block && - pmt::pmt_equal(d_port, other.d_port)); + pmt::equal(d_port, other.d_port)); } diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc index 8c2794c63c..9e924fdaf5 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc @@ -86,7 +86,7 @@ void gr_hier_block2::msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport, gr_basic_block_sptr dst, pmt::pmt_t dstport) { - if(!pmt::pmt_is_symbol(srcport)){throw std::runtime_error("bad port id"); } + if(!pmt::is_symbol(srcport)){throw std::runtime_error("bad port id"); } d_detail->msg_connect(src, srcport, dst, dstport); } @@ -101,7 +101,7 @@ void gr_hier_block2::msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcport, gr_basic_block_sptr dst, pmt::pmt_t dstport) { - if(!pmt::pmt_is_symbol(srcport)){throw std::runtime_error("bad port id"); } + if(!pmt::is_symbol(srcport)){throw std::runtime_error("bad port id"); } d_detail->msg_disconnect(src, srcport, dst, dstport); } diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.h b/gnuradio-core/src/lib/runtime/gr_hier_block2.h index f80dd73e4b..aa6b180cac 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.h +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.h @@ -175,28 +175,28 @@ public: return message_port_is_hier_in(port_id) || message_port_is_hier_out(port_id); } bool message_port_is_hier_in(pmt::pmt_t port_id){ - return pmt::pmt_list_has(hier_message_ports_in, port_id); + return pmt::list_has(hier_message_ports_in, port_id); } bool message_port_is_hier_out(pmt::pmt_t port_id){ - return pmt::pmt_list_has(hier_message_ports_out, port_id); + return pmt::list_has(hier_message_ports_out, port_id); } pmt::pmt_t hier_message_ports_in; pmt::pmt_t hier_message_ports_out; void message_port_register_hier_in(pmt::pmt_t port_id){ - if(pmt::pmt_list_has(hier_message_ports_in, port_id)) + if(pmt::list_has(hier_message_ports_in, port_id)) throw std::invalid_argument("hier msg in port by this name already registered"); if(msg_queue.find(port_id) != msg_queue.end()) throw std::invalid_argument("block already has a primitive input port by this name"); - hier_message_ports_in = pmt::pmt_list_add(hier_message_ports_in, port_id); + hier_message_ports_in = pmt::list_add(hier_message_ports_in, port_id); } void message_port_register_hier_out(pmt::pmt_t port_id){ - if(pmt::pmt_list_has(hier_message_ports_out, port_id)) + if(pmt::list_has(hier_message_ports_out, port_id)) throw std::invalid_argument("hier msg out port by this name already registered"); - if(pmt::pmt_dict_has_key(message_subscribers, port_id)) + if(pmt::dict_has_key(message_subscribers, port_id)) throw std::invalid_argument("block already has a primitive output port by this name"); - hier_message_ports_out = pmt::pmt_list_add(hier_message_ports_out, port_id); + hier_message_ports_out = pmt::list_add(hier_message_ports_out, port_id); } }; diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc index add6da0248..6850afa845 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc @@ -154,7 +154,7 @@ gr_hier_block2_detail::msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport, // register the subscription // this is done later... -// src->message_port_sub(srcport, pmt::pmt_cons(dst->alias_pmt(), dstport)); +// src->message_port_sub(srcport, pmt::cons(dst->alias_pmt(), dstport)); // add block uniquely to list to internal blocks if (std::find(d_blocks.begin(), d_blocks.end(), dst) == d_blocks.end()){ @@ -196,7 +196,7 @@ gr_hier_block2_detail::msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcpor std::cout << "disconnecting message port..." << std::endl; // unregister the subscription - if already subscribed - src->message_port_unsub(srcport, pmt::pmt_cons(dst->alias_pmt(), dstport)); + src->message_port_unsub(srcport, pmt::cons(dst->alias_pmt(), dstport)); // remove edge for this message connection bool hier_out = (d_owner == src.get()) && src->message_port_is_hier_out(srcport);; @@ -474,6 +474,23 @@ gr_hier_block2_detail::flatten_aux(gr_flat_flowgraph_sptr sfg) const gr_edge_viter_t p; gr_msg_edge_viter_t q,u; + // For every block (gr_block and gr_hier_block2), set up the RPC + // interface. + for(p = edges.begin(); p != edges.end(); p++) { + gr_basic_block_sptr b; + b = p->src().block(); + if(!b->is_rpc_set()) { + b->setup_rpc(); + b->rpc_set(); + } + + b = p->dst().block(); + if(!b->is_rpc_set()) { + b->setup_rpc(); + b->rpc_set(); + } + } + if (GR_HIER_BLOCK2_DETAIL_DEBUG) std::cout << "Flattening stream connections: " << std::endl; diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc index e47473edd8..f41fb4ebd8 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc @@ -113,3 +113,27 @@ gr_top_block::to_top_block() { return cast_to_top_block_sptr(shared_from_this()); } + +void +gr_top_block::setup_rpc() +{ +#ifdef GR_CTRLPORT + // Getters + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<gr_top_block, int>( + alias(), "max nouptut_items", + &gr_top_block::max_noutput_items, + pmt::mp(0), pmt::mp(8192), pmt::mp(8192), + "items", "Max number of output items", + RPC_PRIVLVL_MIN, DISPNULL))); + + // Setters + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<gr_top_block, int>( + alias(), "max noutput_items", + &gr_top_block::set_max_noutput_items, + pmt::mp(0), pmt::mp(8192), pmt::mp(8192), + "items", "Max number of output items", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ +} diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h index 04d1e95e57..10a21a6434 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block.h @@ -58,7 +58,7 @@ public: * allowed for any block in the flowgraph. This passes through to * the start function; see that function for more details. */ - void run(int max_noutput_items=100000); + void run(int max_noutput_items=100000000); /*! * Start the contained flowgraph. Creates one or more threads to @@ -71,7 +71,7 @@ public: * always be less than this, but this will cap it as a maximum. Use * this to adjust the maximum latency a flowgraph can exhibit. */ - void start(int max_noutput_items=100000); + void start(int max_noutput_items=100000000); /*! * Stop the running flowgraph. Notifies each thread created by the @@ -123,6 +123,8 @@ public: void set_max_noutput_items(int nmax); gr_top_block_sptr to_top_block(); // Needed for Python type coercion + + void setup_rpc(); }; inline gr_top_block_sptr cast_to_top_block_sptr(gr_basic_block_sptr block) { diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.i b/gnuradio-core/src/lib/runtime/gr_top_block.i index 6ae4c65a99..024582a301 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.i +++ b/gnuradio-core/src/lib/runtime/gr_top_block.i @@ -38,7 +38,7 @@ private: public: ~gr_top_block(); - void start(int max_noutput_items=100000) throw (std::runtime_error); + void start(int max_noutput_items=100000000) throw (std::runtime_error); void stop(); //void wait(); //void run() throw (std::runtime_error); diff --git a/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc b/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc index 4a3694163b..e563fbadb8 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc +++ b/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc @@ -108,6 +108,8 @@ gr_top_block_impl::start(int max_noutput_items) d_ffg->validate(); d_ffg->setup_connections(); + d_ffg->enable_pc_rpc(); + d_scheduler = make_scheduler(d_ffg, d_max_noutput_items); d_state = RUNNING; } diff --git a/gnuradio-core/src/lib/runtime/gr_top_block_impl.h b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h index f55c3f021b..c49bdabff6 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block_impl.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h @@ -42,7 +42,7 @@ public: ~gr_top_block_impl(); // Create and start scheduler threads - void start(int max_noutput_items=100000); + void start(int max_noutput_items=100000000); // Signal scheduler threads to stop void stop(); diff --git a/gnuradio-core/src/lib/runtime/ice_application_base.cc b/gnuradio-core/src/lib/runtime/ice_application_base.cc new file mode 100644 index 0000000000..88db6056c1 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/ice_application_base.cc @@ -0,0 +1,43 @@ +/* -*- 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 <ice_application_base.h> + +int ice_application_common::d_reacquire_attributes(0); +bool ice_application_common::d_main_called(false); +bool ice_application_common::d_have_ice_config(false); +boost::shared_ptr<boost::thread> ice_application_common::d_thread; +std::string ice_application_common::d_endpointStr(""); + +boost::shared_ptr<ice_application_common> +ice_application_common::Instance() +{ + static boost::shared_ptr<ice_application_common> + instance(new ice_application_common()); + return instance; +} + +int ice_application_common::run(int, char**) +{ + communicator()->waitForShutdown(); + return EXIT_SUCCESS; +} diff --git a/gnuradio-core/src/lib/runtime/ice_application_base.h b/gnuradio-core/src/lib/runtime/ice_application_base.h new file mode 100644 index 0000000000..44671f84b4 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/ice_application_base.h @@ -0,0 +1,242 @@ +/* -*- 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 ICE_APPLICATION_BASE_H +#define ICE_APPLICATION_BASE_H + +#include <gr_core_api.h> +#include <Ice/Ice.h> +#include <boost/thread.hpp> +#include <boost/thread/mutex.hpp> +#include <stdio.h> +#include <iostream> +#include <set> +#include <string> +#include <stdio.h> + +namespace { + static const unsigned int ICEAPPLICATION_ACTIVATION_TIMEOUT_MS(600); +}; + + +class GR_CORE_API ice_application_common : public Ice::Application +{ + public: + template<typename TserverBase, typename TserverClass> friend class ice_application_base; + static boost::shared_ptr<ice_application_common> Instance(); + ~ice_application_common() {;} + static int d_reacquire_attributes; + + protected: + static bool d_main_called, d_have_ice_config; + static std::string d_endpointStr; + static boost::shared_ptr<boost::thread> d_thread; + ice_application_common() {;} + int run(int, char*[]); +}; + +template<typename TserverBase, typename TserverClass> +class ice_application_base +{ +public: + boost::shared_ptr<ice_application_common> d_application; + ice_application_base(TserverClass* _this); + ~ice_application_base() {;} + + static TserverBase* i(); + static const std::vector<std::string> endpoints(); + +protected: + bool have_ice_config() { return d_application->d_have_ice_config; } + void set_endpoint(const std::string& endpoint) { d_application->d_endpointStr = endpoint;} + + //this one is the key... overwrite in templated/inherited variants + virtual TserverBase* i_impl() = 0; + + //tools for the i_impl... + //tell it when it has to resync with the communicator + virtual bool reacquire_sync(); + virtual void sync_reacquire(); + + static TserverClass* d_this; + + int d_reacquire; + //static int d_reacquire_attributes; + +private: + void starticeexample(); + + bool application_started(); + + int run(int, char*[]); + + static void kickoff(); +}; + +template<typename TserverBase, typename TserverClass> +TserverClass* ice_application_base<TserverBase, TserverClass>::d_this(0); + +//template<typename TserverBase, typename TserverClass> +//int ice_application_base<TserverBase, TserverClass>::d_reacquire_attributes(0); + +template<typename TserverBase, typename TserverClass> +ice_application_base<TserverBase, TserverClass>::ice_application_base(TserverClass* _this) + : d_reacquire(0) +{ + //d_reacquire_attributes = 0; + d_this = _this; + d_application = ice_application_common::Instance(); +} + +template<typename TserverBase, typename TserverClass> +void ice_application_base<TserverBase, TserverClass>::starticeexample() +{ + char derp[] = ""; char* argv[2]; argv[0]=derp; + char buf[1024]; buf[0] = 0; + const char iceconf[] = "--Ice.Config="; + FILE *fp; + + sprintf(buf, "/proc/%d/cmdline", getpid()); + + if(NULL == (fp = fopen(buf, "r"))) { + fprintf(stderr, "Cannot open file %s\n", buf); + exit(EXIT_FAILURE); + } + + unsigned int counter(0); + while(fread(buf, 1, 1, fp)) { + if(*buf == iceconf[counter]) { + if(++counter == sizeof(iceconf) - 1) { + int result = fread(buf, sizeof(buf), 1, fp); + if((result == 0) && (feof(fp) == 0)) { + fprintf(stderr, "ICE file read failur %d\n", ferror(fp)); + clearerr(fp); + exit(EXIT_FAILURE); + } + break; + } + } + } + fclose(fp); + + if(buf[0]) { + ice_application_common::d_have_ice_config = true; + ice_application_common::d_main_called = true; + d_application->main(0, argv, buf); + } + else { + ice_application_common::d_have_ice_config = false; + ice_application_common::d_main_called = true; + d_application->main(0, argv); + } +} + +template<typename TserverBase, typename TserverClass> +void ice_application_base<TserverBase, TserverClass>::kickoff() +{ + static bool run_once = false; + + //if(!d_this->application_started()) { + if(!run_once) { + ++d_this->d_application->d_reacquire_attributes; + + ice_application_common::d_thread = boost::shared_ptr<boost::thread> + (new boost::thread(boost::bind(&ice_application_base::starticeexample, d_this))); + + ::timespec timer_ts, rem_ts; + timer_ts.tv_sec = 0; timer_ts.tv_nsec = ICEAPPLICATION_ACTIVATION_TIMEOUT_MS*1000; + + int iter = 0; + while(!d_this->application_started()) { + ::nanosleep(&timer_ts, &rem_ts); + if(!d_this->application_started()) + std::cout << "@"; + if(iter++ > 100) { + std::cout << "ice_application_base::kickoff(), timeout waiting to get communicator() d_application->main() might have failed?!" << std::endl;; + break; + } + } + + run_once = true; + } + + return; +} + + +template<typename TserverBase, typename TserverClass> +bool ice_application_base<TserverBase, TserverClass>::reacquire_sync() +{ + return (d_this->d_reacquire != d_application->d_reacquire_attributes); +} + +template<typename TserverBase, typename TserverClass> +void ice_application_base<TserverBase, TserverClass>::sync_reacquire() +{ + d_this->d_reacquire = d_application->d_reacquire_attributes; +} + + +template<typename TserverBase, typename TserverClass> +const std::vector<std::string> ice_application_base<TserverBase, TserverClass>::endpoints() +{ + std::vector<std::string> ep; ep.push_back(d_this->d_application->d_endpointStr); return ep; +} + +template<typename TserverBase, typename TserverClass> +TserverBase* ice_application_base<TserverBase, TserverClass>::i() +{ + //printf("indacall\n"); + + assert(d_this != 0); + if(!d_this->application_started()) { + //printf("anotherkickoff\n"); + kickoff(); + } + //printf("donekickedoff\n"); + + /*else if(!d_proxy) { + d_proxy = d_this->i_impl(); + assert(d_proxy != 0); + }*/ + + return d_this->i_impl(); +} + +/*template<typename TserverBase, typename TserverClass> + int ice_application_base<TserverBase, TserverClass>::run(int argc, char* argv[]) { + int implreturn(run_impl(argc, argv)); + ice_application_base<TserverBase, TserverClass>::communicator()->waitForShutdown(); + return implreturn; + }*/ + +template<typename TserverBase, typename TImplClass> +bool ice_application_base<TserverBase, TImplClass>::application_started() +{ + return ice_application_base<TserverBase, TImplClass>::d_this->d_application->communicator(); +} + +/*template<typename TserverBase, typename TImplClass> +int ice_application_base<TserverBase, TImplClass>::run_impl(int argc, char* argv[]) { return EXIT_SUCCESS; } +*/ + +#endif diff --git a/gnuradio-core/src/lib/runtime/ice_server_template.h b/gnuradio-core/src/lib/runtime/ice_server_template.h new file mode 100644 index 0000000000..8ddb03cc8e --- /dev/null +++ b/gnuradio-core/src/lib/runtime/ice_server_template.h @@ -0,0 +1,96 @@ +/* -*- 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 ICE_SERVER_TEMPLATE_H +#define ICE_SERVER_TEMPLATE_H + +#include <ice_application_base.h> +#include <iostream> + +template<typename TserverBase, typename TserverClass, typename TImplClass, typename TIceClass> +class ice_server_template : public ice_application_base<TserverBase, TImplClass> +{ +public: + ice_server_template(TImplClass* _this, + const std::string& contolPortName, + const std::string& endpointName); + ~ice_server_template(); + +protected: + //virtual bool application_started(); + TserverBase* i_impl(); + friend class ice_application_base<TserverBase, TImplClass>; + +private: + //virtual int run_impl(int, char*[]); + Ice::ObjectAdapterPtr d_adapter; + TserverBase* d_iceserver; + const std::string d_contolPortName, d_endpointName; +}; + +template<typename TserverBase, typename TserverClass, typename TImplClass, typename TIceClass> +ice_server_template<TserverBase, TserverClass, TImplClass, TIceClass>::ice_server_template + (TImplClass* _this, const std::string& controlPortName, const std::string& endpointName) + : ice_application_base<TserverBase, TImplClass>(_this), + d_iceserver(0), + d_contolPortName(controlPortName), + d_endpointName(endpointName) +{;} + +template<typename TserverBase, typename TserverClass, typename TImplClass, typename TIceClass> +ice_server_template<TserverBase, TserverClass,TImplClass, TIceClass>::~ice_server_template() +{ + if(d_adapter) { + d_adapter->deactivate(); + delete(d_iceserver); + d_adapter = 0; + } +} + +template<typename TserverBase, typename TserverClass, typename TImplClass, typename TIceClass> +TserverBase* ice_server_template<TserverBase, TserverClass, TImplClass, TIceClass>::i_impl() +{ + if(ice_application_base<TserverBase, TImplClass>::d_this->reacquire_sync()) { + d_adapter = (ice_application_base<TserverBase, TImplClass>::d_this->have_ice_config()) ? + ice_application_base<TserverBase, TImplClass>::d_this->d_this->d_application->communicator()->createObjectAdapter(d_contolPortName) : + ice_application_base<TserverBase, TImplClass>::d_this->d_this->d_application->communicator()->createObjectAdapterWithEndpoints(d_contolPortName,"tcp -h *"); + + TserverClass* server_ice(new TserverClass()); + TIceClass obj(server_ice); + + Ice::Identity id(ice_application_base<TserverBase, TImplClass>::d_this->d_this->d_application->communicator()->stringToIdentity(d_endpointName)); + d_adapter->add(obj, id); + d_adapter->activate(); + ice_application_base<TserverBase, TImplClass>::d_this->set_endpoint(ice_application_common::communicator()->proxyToString(d_adapter->createDirectProxy(id))); + + std::cout << std::endl << "Ice Radio Endpoint: " + << ice_server_template<TserverBase, TserverClass, TImplClass, TIceClass>::endpoints()[0] + << std::endl; + + d_iceserver = (TserverBase*) server_ice; + ice_application_base<TserverBase, TImplClass>::d_this->sync_reacquire(); + } + + return d_iceserver; +} + +#endif /* ICE_SERVER_TEMPLATE_H */ diff --git a/gnuradio-core/src/lib/general/gr_multiply_ff.h b/gnuradio-core/src/lib/runtime/nop.h index ed628385ce..5b3166da7b 100644 --- a/gnuradio-core/src/lib/general/gr_multiply_ff.h +++ b/gnuradio-core/src/lib/runtime/nop.h @@ -1,9 +1,9 @@ /* -*- 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) @@ -20,37 +20,38 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GR_MULTIPLY_FF_H -#define INCLUDED_GR_MULTIPLY_FF_H +#ifndef INCLUDED_CTRLPORT_NOP_H +#define INCLUDED_CTRLPORT_NOP_H -#include <gr_core_api.h> +#include <ctrlport/api.h> #include <gr_sync_block.h> -class gr_multiply_ff; -typedef boost::shared_ptr<gr_multiply_ff> gr_multiply_ff_sptr; - -GR_CORE_API gr_multiply_ff_sptr -gr_make_multiply_ff (size_t vlen=1); - -/*! - * \brief Multiply streams of complex values - * \ingroup math_blk - */ - -class GR_CORE_API gr_multiply_ff : public gr_sync_block -{ - private: - friend GR_CORE_API gr_multiply_ff_sptr - gr_make_multiply_ff (size_t vlen); - gr_multiply_ff (size_t vlen); - - size_t d_vlen; - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - +namespace gr { + namespace ctrlport { + + /*! + * \brief A NOP block for testing ctrlport + * + */ + class CTRLPORT_API nop : virtual public gr_sync_block + { + public: + // gr::ctrlport::nop::sptr + typedef boost::shared_ptr<nop> sptr; + + /*! + * Build a simple test block + */ + static sptr make(size_t itemsize, int a, int b); + + virtual void set_a(int b) = 0; + virtual void set_b(int b) = 0; + virtual int a() const = 0; + virtual int b() const = 0; + }; + + } /* namespace ctrlport */ +} /* namespace gr */ + +#endif /* INCLUDED_CTRLPORT_NOP_H */ -#endif /* INCLUDED_GR_MULTIPLY_FF_H */ diff --git a/gnuradio-core/src/lib/runtime/nop_impl.cc b/gnuradio-core/src/lib/runtime/nop_impl.cc new file mode 100644 index 0000000000..b6764c2257 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/nop_impl.cc @@ -0,0 +1,119 @@ +/* -*- 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 "nop_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace ctrlport { + + nop::sptr + nop::make(size_t itemsize, int a, int b) + { + return gnuradio::get_initial_sptr + (new nop_impl(itemsize, a, b)); + } + + + nop_impl::nop_impl(size_t itemsize, int a, int b) + : gr_sync_block("nop", + gr_make_io_signature(1, 1, itemsize), + gr_make_io_signature(0, 0, 0)) + { + set_a(a); + set_b(b); + } + + nop_impl::~nop_impl() + { + } + + void + nop_impl::set_a(int a) + { + d_a = a; + } + + void + nop_impl::set_b(int b) + { + d_b = b; + } + + int + nop_impl::a() const + { + return d_a; + } + + int + nop_impl::b() const + { + return d_b; + } + + int + nop_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + return noutput_items; + } + + void + nop_impl::setup_rpc() + { + d_get_32i_rpcs.push_back(get_32i_sptr + (new get_32i_t(d_name, "a", this, unique_id(), + &nop_impl::a, + pmt::mp(-128), pmt::mp(127), pmt::mp(0), + "", "Value of a", + RPC_PRIVLVL_MIN, DISPTIMESERIESF))); + + d_get_32i_rpcs.push_back(get_32i_sptr + (new get_32i_t(d_name, "b", this, unique_id(), + &nop_impl::b, + pmt::mp(-128), pmt::mp(127), pmt::mp(0), + "", "Value of b", + RPC_PRIVLVL_MIN, DISPTIMESERIESF))); + + d_set_32i_rpcs.push_back(set_32i_sptr + (new set_32i_t(d_name, "a", this, unique_id(), + &nop_impl::set_a, + pmt::mp(-128), pmt::mp(127), pmt::mp(0), + "", "Value of a", + RPC_PRIVLVL_MIN, DISPNULL))); + + d_set_32i_rpcs.push_back(set_32i_sptr + (new set_32i_t(d_name, "b", this, unique_id(), + &nop_impl::set_b, + pmt::mp(-128), pmt::mp(127), pmt::mp(0), + "", "Value of b", + RPC_PRIVLVL_MIN, DISPNULL))); + } + + } /* namespace ctrlport */ +} /* namespace gr */ diff --git a/gnuradio-core/src/lib/runtime/nop_impl.h b/gnuradio-core/src/lib/runtime/nop_impl.h new file mode 100644 index 0000000000..a39ddac8f9 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/nop_impl.h @@ -0,0 +1,67 @@ +/* -*- 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 INCLUDED_CTRLPORT_NOP_IMPL_H +#define INCLUDED_CTRLPORT_NOP_IMPL_H + +#include <ctrlport/nop.h> +#include <ctrlport/rpcregisterhelpers.h> +#include <boost/thread/shared_mutex.hpp> + +namespace gr { + namespace ctrlport { + + class CTRLPORT_API nop_impl : public nop + { + private: + typedef rpcbasic_register_get<nop_impl, int> get_32i_t; + typedef rpcbasic_register_set<nop_impl, int> set_32i_t; + + typedef boost::shared_ptr<get_32i_t> get_32i_sptr; + typedef boost::shared_ptr<set_32i_t> set_32i_sptr; + + std::vector<get_32i_sptr> d_get_32i_rpcs; + std::vector<set_32i_sptr> d_set_32i_rpcs; + + void setup_rpc(); + + int d_a, d_b; + + public: + nop_impl(size_t itemsize, int a, int b); + ~nop_impl(); + + void set_a(int a); + void set_b(int b); + int a() const; + int b() const; + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace ctrlport */ +} /* namespace gr */ + +#endif /* INCLUDED_CTRLPORT_NOP_IMPL_H */ + diff --git a/gnuradio-core/src/lib/runtime/pycallback_object.h b/gnuradio-core/src/lib/runtime/pycallback_object.h new file mode 100644 index 0000000000..f6247c0c6d --- /dev/null +++ b/gnuradio-core/src/lib/runtime/pycallback_object.h @@ -0,0 +1,194 @@ +/* -*- 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 <iostream> +#include <rpcregisterhelpers.h> +#include <ice_application_base.h> +#include <IcePy_Communicator.h> +#include <pythread.h> + +enum pyport_t { + PYPORT_STRING, + PYPORT_FLOAT +}; + +class Instance +{ +public: + static boost::shared_ptr<ice_application_common> get_application() + { + return ice_application_common::Instance(); + } + static Ice::CommunicatorPtr get_swig_communicator() + { + return get_application()->communicator(); + } +}; + +int pycallback_object_count = 500; + +// a simple to-PMT converter template class-function +template <class myType> class pmt_assist +{ +public: + static pmt::pmt_t make(myType _val) + { + return pmt::mp(_val); + } +}; + +/* template specializations for vectors that cant use pmt::mp() */ +template<> +pmt::pmt_t pmt_assist<std::vector<float> >::make(std::vector<float> _val) +{ + return pmt::init_f32vector(_val.size(), &_val[0]); +} + +template<> +pmt::pmt_t pmt_assist<std::vector<gr_complex> >::make(std::vector<gr_complex> _val) +{ + return pmt::init_c32vector(_val.size(), &_val[0]); +} + +template <class myType> class pycallback_object +{ +public: + pycallback_object(std::string name, std::string functionbase, + std::string units, std::string desc, + myType min, myType max, myType deflt, + DisplayType dtype) : + d_callback(NULL), + d_functionbase(functionbase), d_units(units), d_desc(desc), + d_min(min), d_max(max), d_deflt(deflt), d_dtype(dtype) + { + d_callback = NULL; + } + + myType get() { + myType rVal; + if(d_callback == NULL) { + printf("WARNING: pycallback_object get() called without py callback set!\n"); + return rVal; + } + else { + // obtain PyGIL + PyGILState_STATE state = PyGILState_Ensure(); + + PyObject *func; + //PyObject *arglist; + PyObject *result; + + func = (PyObject *) d_callback; // Get Python function + //arglist = Py_BuildValue(""); // Build argument list + result = PyEval_CallObject(func,NULL); // Call Python + //result = PyEval_CallObject(func,arglist); // Call Python + //Py_DECREF(arglist); // Trash arglist + if(result) { // If no errors, return double + rVal = pyCast(result); + } + Py_XDECREF(result); + + // release PyGIL + PyGILState_Release(state); + return rVal; + } + } + + void set_callback(PyObject *cb) + { + d_callback = cb; + } + + void setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<pycallback_object, myType>( + alias(), d_functionbase.c_str(), + &pycallback_object::get, pmt_assist<myType>::make(d_min), + pmt_assist<myType>::make(d_max), pmt_assist<myType>::make(d_deflt), + d_units.c_str(), d_desc.c_str(), RPC_PRIVLVL_MIN, d_dtype))); +#endif /* GR_CTRLPORT */ + } + +private: + PyObject* d_callback; + std::string d_functionbase, d_units, d_desc; + myType d_min, d_max, d_deflt; + DisplayType d_dtype; + + myType pyCast(PyObject* obj) { + printf("TYPE NOT IMPLEMENTED!\n"); + assert(0); + }; +}; + + +// template specialization conversion functions +// get data out of the PyObject and into the real world +template<> +std::string pycallback_object<std::string>::pyCast(PyObject* obj) +{ + return std::string(PyString_AsString(obj)); +} + +template<> +double pycallback_object<double>::pyCast(PyObject* obj) +{ + return PyFloat_AsDouble(obj); +} + +template<> +float pycallback_object<float>::pyCast(PyObject* obj) +{ + return (float)PyFloat_AsDouble(obj); +} + +template<> +int pycallback_object<int>::pyCast(PyObject* obj) +{ + return PyInt_AsLong(obj); +} + +template<> +std::vector<float> pycallback_object<std::vector<float> >::pyCast(PyObject* obj) +{ + int size = PyObject_Size(obj); + std::vector<float> rval(size); + for(int i=0; i<size; i++) { + rval[i] = (float)PyFloat_AsDouble(PyList_GetItem(obj, i)); + } + return rval; +} + +template<> +std::vector<gr_complex> pycallback_object<std::vector<gr_complex> >::pyCast(PyObject* obj) +{ + int size = PyObject_Size(obj); + std::vector<gr_complex> rval(size); + for(int i=0; i<size; i++){ rval[i] = \ + gr_complex((float)PyComplex_RealAsDouble(PyList_GetItem(obj, i)), + (float)PyComplex_ImagAsDouble(PyList_GetItem(obj, i))); + } + return rval; +} +// TODO: add more template specializations as needed! diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index d6b1065e32..d3ae476027 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -31,15 +31,13 @@ #include <gr_head.h> #include <gr_annotator_alltoall.h> #include <gr_annotator_1to1.h> -#include <gr_keep_one_in_n.h> +//#include <gr_keep_one_in_n.h> #include <gr_firdes.h> #include <gr_tags.h> // ---------------------------------------------------------------- -using namespace pmt; - // set to 1 to turn on debug output // The debug output fully checks that the tags seen are what are expected. While // this behavior currently works with our implementation, there is no guarentee @@ -119,39 +117,39 @@ qa_block_tags::t1 () str1 << ann1->name() << ann1->unique_id(); str2 << ann2->name() << ann2->unique_id(); - pmt_t expected_tags3[8]; - expected_tags3[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags3[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags3[2] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags3[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags3[4] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags3[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags3[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags3[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - - pmt_t expected_tags4[8]; - expected_tags4[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); - expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); - expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); + pmt::pmt_t expected_tags3[8]; + expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); + expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); + expected_tags3[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags3[4] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(2)); + expected_tags3[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); + + pmt::pmt_t expected_tags4[8]; + expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); + expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); + expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); + expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags4[4] = mp(pmt::from_uint64(20000), mp(str2.str()), mp("seq"), mp(2)); + expected_tags4[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags4[6] = mp(pmt::from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); + expected_tags4[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); std::cout << std::endl << "qa_block_tags::t1" << std::endl; // For annotator 3, we know it gets tags from ann0 and ann1, test this for(size_t i = 0; i < tags3.size(); i++) { std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i])); + CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags3[i]), pmt::write_string(expected_tags3[i])); } // For annotator 4, we know it gets tags from ann0 and ann2, test this std::cout << std::endl; for(size_t i = 0; i < tags4.size(); i++) { std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); + CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i])); } #endif } @@ -209,33 +207,33 @@ qa_block_tags::t2 () str0 << ann0->name() << ann0->unique_id(); str1 << ann1->name() << ann1->unique_id(); - pmt_t expected_tags2[12]; - expected_tags2[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags2[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags2[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags2[3] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags2[4] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags2[5] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags2[6] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(6)); - expected_tags2[7] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags2[8] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags2[9] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(9)); - expected_tags2[10] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - expected_tags2[11] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - - pmt_t expected_tags4[12]; - expected_tags4[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(2)); - expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags4[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(5)); - expected_tags4[4] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[6] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(8)); - expected_tags4[7] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags4[8] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[9] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(11)); - expected_tags4[10] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - expected_tags4[11] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); + pmt::pmt_t expected_tags2[12]; + expected_tags2[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); + expected_tags2[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags2[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); + expected_tags2[3] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags2[4] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags2[5] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags2[6] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(6)); + expected_tags2[7] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags2[8] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags2[9] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(9)); + expected_tags2[10] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); + expected_tags2[11] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); + + pmt::pmt_t expected_tags4[12]; + expected_tags4[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(2)); + expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags4[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); + expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(5)); + expected_tags4[4] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags4[5] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags4[6] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(8)); + expected_tags4[7] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags4[8] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags4[9] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(11)); + expected_tags4[10] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); + expected_tags4[11] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); std::cout << std::endl << "qa_block_tags::t2" << std::endl; @@ -245,13 +243,13 @@ qa_block_tags::t2 () // inconceivable for ann3 to have it wrong. for(size_t i = 0; i < tags2.size(); i++) { std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i])); + CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags2[i]), pmt::write_string(expected_tags2[i])); } std::cout << std::endl; for(size_t i = 0; i < tags4.size(); i++) { std::cout << "tags2[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); + CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i])); } #endif } @@ -303,39 +301,39 @@ qa_block_tags::t3 () str1 << ann1->name() << ann1->unique_id(); str2 << ann2->name() << ann2->unique_id(); - pmt_t expected_tags3[8]; - expected_tags3[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags3[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags3[2] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags3[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags3[4] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags3[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags3[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags3[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - - pmt_t expected_tags4[8]; - expected_tags4[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); - expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); - expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); + pmt::pmt_t expected_tags3[8]; + expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); + expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); + expected_tags3[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags3[4] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(2)); + expected_tags3[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); + + pmt::pmt_t expected_tags4[8]; + expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); + expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); + expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); + expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags4[4] = mp(pmt::from_uint64(20000), mp(str2.str()), mp("seq"), mp(2)); + expected_tags4[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags4[6] = mp(pmt::from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); + expected_tags4[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); std::cout << std::endl << "qa_block_tags::t3" << std::endl; // For annotator 3, we know it gets tags from ann0 and ann1, test this for(size_t i = 0; i < tags3.size(); i++) { std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i])); + CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags3[i]), pmt::write_string(expected_tags3[i])); } // For annotator 4, we know it gets tags from ann0 and ann2, test this std::cout << std::endl; for(size_t i = 0; i < tags4.size(); i++) { std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); + CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i])); } #endif } @@ -370,6 +368,7 @@ qa_block_tags::t4 () } +/* void qa_block_tags::t5 () { @@ -411,23 +410,23 @@ qa_block_tags::t5 () str1 << ann1->name() << ann1->unique_id(); str2 << ann2->name() << ann2->unique_id(); - pmt_t expected_tags1[5]; - expected_tags1[0] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags1[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags1[2] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags1[3] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(3)); - - pmt_t expected_tags2[10]; - expected_tags2[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags2[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags2[2] = mp(pmt_from_uint64(1000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags2[3] = mp(pmt_from_uint64(1000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags2[4] = mp(pmt_from_uint64(2000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags2[5] = mp(pmt_from_uint64(2000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags2[6] = mp(pmt_from_uint64(3000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags2[7] = mp(pmt_from_uint64(3000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags2[8] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(4)); - expected_tags2[9] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(4)); + pmt::pmt_t expected_tags1[5]; + expected_tags1[0] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags1[1] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); + expected_tags1[2] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags1[3] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(3)); + + pmt::pmt_t expected_tags2[10]; + expected_tags2[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); + expected_tags2[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags2[2] = mp(pmt::from_uint64(1000), mp(str1.str()), mp("seq"), mp(1)); + expected_tags2[3] = mp(pmt::from_uint64(1000), mp(str0.str()), mp("seq"), mp(1)); + expected_tags2[4] = mp(pmt::from_uint64(2000), mp(str1.str()), mp("seq"), mp(2)); + expected_tags2[5] = mp(pmt::from_uint64(2000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags2[6] = mp(pmt::from_uint64(3000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags2[7] = mp(pmt::from_uint64(3000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags2[8] = mp(pmt::from_uint64(4000), mp(str1.str()), mp("seq"), mp(4)); + expected_tags2[9] = mp(pmt::from_uint64(4000), mp(str0.str()), mp("seq"), mp(4)); std::cout << std::endl << "qa_block_tags::t5" << std::endl; @@ -435,7 +434,7 @@ qa_block_tags::t5 () std::cout << "tags1.size(): " << tags1.size() << std::endl; for(size_t i = 0; i < tags1.size(); i++) { std::cout << "tags1[" << i << "] = " << tags1[i] << "\t\t" << expected_tags1[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags1[i]), pmt_write_string(expected_tags1[i])); + CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags1[i]), pmt::write_string(expected_tags1[i])); } // annotator 2 gets tags from annotators 0 and 1 @@ -443,8 +442,8 @@ qa_block_tags::t5 () std::cout << "tags2.size(): " << tags2.size() << std::endl; for(size_t i = 0; i < tags2.size(); i++) { std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i])); + CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags2[i]), pmt::write_string(expected_tags2[i])); } #endif } - +*/ diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h index 6b7e5975d1..039d345cdf 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.h +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.h @@ -35,7 +35,7 @@ class qa_block_tags : public CppUnit::TestCase { CPPUNIT_TEST (t2); CPPUNIT_TEST (t3); CPPUNIT_TEST (t4); - CPPUNIT_TEST (t5); + //CPPUNIT_TEST (t5); CPPUNIT_TEST_SUITE_END (); private: @@ -44,7 +44,7 @@ class qa_block_tags : public CppUnit::TestCase { void t2 (); void t3 (); void t4 (); - void t5 (); + //void t5 (); }; diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc index c84a219bd1..ac06a3f8bc 100644 --- a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc +++ b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc @@ -37,8 +37,6 @@ #define VERBOSE 0 -using namespace pmt; - /* * The gr_nop block has been instrumented so that it counts * the number of messages sent to it. We use this feature @@ -65,9 +63,9 @@ void qa_set_msg_handler::t0() tb->start(); // Send them... - pmt_t port(pmt_intern("port")); + pmt::pmt_t port(pmt::intern("port")); for (int i = 0; i < NMSGS; i++){ - send(nop, port, mp(mp("example-msg"), mp(i))); + send(nop, port, pmt::mp(pmt::mp("example-msg"), pmt::mp(i))); } // Give the messages a chance to be processed diff --git a/gnuradio-core/src/lib/runtime/rpccallbackregister_base.h b/gnuradio-core/src/lib/runtime/rpccallbackregister_base.h new file mode 100644 index 0000000000..c8f60b310c --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpccallbackregister_base.h @@ -0,0 +1,96 @@ +/* -*- 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 RPCCALLBACKREGISTER_BASE_H +#define RPCCALLBACKREGISTER_BASE_H + +#include <gruel/msg_accepter.h> +#include <gruel/msg_producer.h> + +enum DisplayType { + DISPNULL, + DISPTIMESERIESF, + DISPTIMESERIESC, + DISPXYSCATTER, + DISPXYLINE +}; + +enum priv_lvl_t { + RPC_PRIVLVL_ALL = 0, + RPC_PRIVLVL_MIN = 9, + RPC_PRIVLVL_NONE = 10 +}; + +enum KnobType { + KNOBBOOL, KNOBCHAR, KNOBINT, KNOBFLOAT, + KNOBDOUBLE, KNOBSTRING, KNOBLONG, KNOBVECBOOL, + KNOBVECCHAR, KNOBVECINT, KNOBVECFLOAT, KNOBVECDOUBLE, + KNOBVECSTRING, KNOBVECLONG +}; + +struct callbackregister_base +{ + struct callback_base_t + { + public: + callback_base_t(const priv_lvl_t priv_, const std::string& units_, + const DisplayType display_, const std::string& desc_, + const pmt::pmt_t min_, const pmt::pmt_t max_, const pmt::pmt_t def) + : priv(priv_), units(units_), description(desc_), + min(min_), max(max_), defaultvalue(def), display(display_) + { + } + + priv_lvl_t priv; + std::string units, description; + pmt::pmt_t min, max, defaultvalue; + DisplayType display; + }; + + template<typename T, typename Tsptr> + class callback_t : public callback_base_t + { + public: + callback_t(T* callback_, priv_lvl_t priv_, + const std::string& units_, const DisplayType display_, const:: std::string& desc_, + const pmt::pmt_t& min_, const pmt::pmt_t& max_, const pmt::pmt_t& def_) : + callback_base_t(priv_, units_, display_, desc_, min_, max_, def_), + callback(callback_) + { + } + + Tsptr callback; + }; + + typedef callback_t<gruel::msg_accepter, gruel::msg_accepter_sptr> configureCallback_t; + typedef callback_t<gruel::msg_producer, gruel::msg_producer_sptr> queryCallback_t; + + callbackregister_base() {;} + virtual ~callbackregister_base() {;} + + virtual void registerConfigureCallback(const std::string &id, const configureCallback_t callback) = 0; + virtual void unregisterConfigureCallback(const std::string &id) = 0; + virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback) = 0; + virtual void unregisterQueryCallback(const std::string &id) = 0; +}; + +#endif /* RPCCALLBACKREGISTER_BASE_H */ diff --git a/gnuradio-core/src/lib/runtime/rpcmanager.cc b/gnuradio-core/src/lib/runtime/rpcmanager.cc new file mode 100644 index 0000000000..4d164b63f3 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcmanager.cc @@ -0,0 +1,72 @@ +/* -*- 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 <rpcmanager.h> +#include <iostream> +#include <stdexcept> + +bool rpcmanager::booter_registered(false); +bool rpcmanager::aggregator_registered(false); +rpcserver_booter_base* rpcmanager::boot(0); +std::auto_ptr<rpcserver_booter_aggregator> rpcmanager::aggregator(0); + +rpcmanager::rpcmanager() {;} + +rpcmanager::~rpcmanager() +{ + if(boot) + delete boot; +} + +rpcserver_booter_base* +rpcmanager::get() +{ + if(aggregator_registered) { + return aggregator.get(); + } + else if(booter_registered) { + return boot; + } + assert(booter_registered || aggregator_registered); + return boot; +} + +void +rpcmanager::register_booter(rpcserver_booter_base* booter) +{ + if(make_aggregator && !aggregator_registered) { + aggregator.reset(new rpcserver_booter_aggregator()); + aggregator_registered = true; + } + + if(aggregator_registered) { + rpcmanager::rpcserver_booter_base_sptr bootreg(booter); + aggregator->agg()->registerServer(bootreg); + } + else if(!booter_registered) { + boot = booter; + booter_registered = true; + } + else { + throw std::runtime_error("rpcmanager: Aggregator not in use, and a rpc booter is already registered\n"); + } +} diff --git a/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.h b/gnuradio-core/src/lib/runtime/rpcmanager.h index 826e287714..8cb176b2e5 100644 --- a/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.h +++ b/gnuradio-core/src/lib/runtime/rpcmanager.h @@ -1,9 +1,9 @@ /* -*- 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) @@ -20,38 +20,40 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H -#define INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H +#ifndef RPCMANAGER_H +#define RPCMANAGER_H #include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_multiply_conjugate_cc; -typedef boost::shared_ptr<gr_multiply_conjugate_cc> -gr_multiply_conjugate_cc_sptr; +#include <rpcmanager_base.h> +#include <rpcserver_booter_aggregator.h> +#include <memory> +#include <iostream> -GR_CORE_API gr_multiply_conjugate_cc_sptr -gr_make_multiply_conjugate_cc (size_t vlen=1); +class GR_CORE_API rpcmanager : public virtual rpcmanager_base +{ + public: + rpcmanager(); + ~rpcmanager(); -/*! - * \brief Multiplies a stream by the conjugate of the second stream - * \ingroup math_blk - */ + static rpcserver_booter_base* get(); -class GR_CORE_API gr_multiply_conjugate_cc : public gr_sync_block -{ - private: - friend GR_CORE_API gr_multiply_conjugate_cc_sptr - gr_make_multiply_conjugate_cc (size_t vlen); - gr_multiply_conjugate_cc (size_t vlen); + static void register_booter(rpcserver_booter_base* booter); - size_t d_vlen; + template<typename T> class rpcserver_booter_register_helper + { + public: + rpcserver_booter_register_helper() { + rpcmanager::register_booter(new T()); + } + + //TODO: unregister + }; - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + private: + static bool make_aggregator, booter_registered, aggregator_registered; + static void rpcserver_booter_base_sptr_dest( rpcserver_booter_base* b) {;} + static rpcserver_booter_base* boot; + static std::auto_ptr<rpcserver_booter_aggregator> aggregator; }; - -#endif /* INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H */ +#endif /* RPCMANAGER_H */ diff --git a/gnuradio-core/src/lib/general/gr_keep_m_in_n.i b/gnuradio-core/src/lib/runtime/rpcmanager_base.h index f280c0248a..60425c4a15 100644 --- a/gnuradio-core/src/lib/general/gr_keep_m_in_n.i +++ b/gnuradio-core/src/lib/runtime/rpcmanager_base.h @@ -1,35 +1,46 @@ /* -*- 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. */ -GR_SWIG_BLOCK_MAGIC(gr,keep_m_in_n) +#ifndef RPCMANAGER_BASE_H +#define RPCMANAGER_BASE_H + +#include <boost/shared_ptr.hpp> -gr_keep_m_in_n_sptr -gr_make_keep_m_in_n (size_t itemsize, int m, int n, int offset); +class rpcserver_booter_base; +//class rpcserver_booter_aggregator; -class gr_keep_m_in_n : public gr_sync_block +class rpcmanager_base { - protected: - gr_keep_m_in_n (size_t itemsize, int m, int n, int offset); public: - void set_offset(int offset); + typedef boost::shared_ptr<rpcserver_booter_base> rpcserver_booter_base_sptr; + rpcmanager_base() {;} + ~rpcmanager_base() {;} + + //static rpcserver_booter_base* get(); + + //static void register_booter(rpcserver_booter_base_sptr booter); + +private: }; + +#endif /* RPCMANAGER_BASE_H */ diff --git a/gnuradio-core/src/lib/runtime/rpcpmtconverters_ice.cc b/gnuradio-core/src/lib/runtime/rpcpmtconverters_ice.cc new file mode 100644 index 0000000000..c5502c7362 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcpmtconverters_ice.cc @@ -0,0 +1,113 @@ +/* -*- 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 <rpcpmtconverters_ice.h> +#include <Ice/Ice.h> +#include <gnuradio.h> + +GNURadio::KnobPtr +rpcpmtconverter::from_pmt(const pmt::pmt_t& knob, const Ice::Current& c) +{ + if(pmt::is_real(knob)) { + return new GNURadio::KnobD(Ice::Double(pmt::to_double(knob))); + } + else if(pmt::is_symbol(knob)) { + std::string stuff = pmt::symbol_to_string(knob); + if(stuff.length() != 1) { + return new GNURadio::KnobS(stuff); + } + else { + return new GNURadio::KnobC(stuff[0]); + } + + //TODO: FLOAT!!! + } + else if(pmt::is_integer(knob)) { + return new GNURadio::KnobI(pmt::to_long(knob)); + } + else if(pmt::is_bool(knob)) { + return new GNURadio::KnobB(pmt::to_bool(knob)); + } + else if(pmt::is_uint64(knob)) { + return new GNURadio::KnobL(pmt::to_uint64(knob)); + //const std::complex<float> *c32vector_elements(pmt_t v, size_t &len); //< len is in elements + } + else if(pmt::is_c32vector(knob)) { // c32 sent as interleaved floats + size_t size(pmt::length(knob)); + const float* start((const float*) pmt::c32vector_elements(knob,size)); + return new GNURadio::KnobVecF(std::vector<float>(start,start+size*2)); + } + else if(pmt::is_f32vector(knob)) { + size_t size(pmt::length(knob)); + const float* start((const float*) pmt::f32vector_elements(knob,size)); + return new GNURadio::KnobVecF(std::vector<float>(start,start+size)); + } + else { + std::cerr << "Error: Don't know how to handle Knob Type (from): " << std::endl; assert(0);} + //TODO: VECTORS!!! + return new GNURadio::Knob(); +} + +pmt::pmt_t +rpcpmtconverter::to_pmt(const GNURadio::KnobPtr& knob, const Ice::Current& c) +{ + std::string id(knob->ice_id(c).substr(12)); + if(id == "KnobD") { + GNURadio::KnobDPtr k(GNURadio::KnobDPtr::dynamicCast(knob)); + return pmt::mp(k->value); + } + else if(id == "KnobF") { + GNURadio::KnobFPtr k(GNURadio::KnobFPtr::dynamicCast(knob)); + return pmt::mp(k->value); + } + else if(id == "KnobI") { + GNURadio::KnobIPtr k(GNURadio::KnobIPtr::dynamicCast(knob)); + return pmt::mp(k->value); + } + else if(id == "KnobS") { + GNURadio::KnobSPtr k(GNURadio::KnobSPtr::dynamicCast(knob)); + return pmt::string_to_symbol(k->value); + } + else if(id == "KnobB") { + GNURadio::KnobBPtr k(GNURadio::KnobBPtr::dynamicCast(knob)); + return pmt::mp(k->value); + } + else if(id == "KnobC") { + GNURadio::KnobCPtr k(GNURadio::KnobCPtr::dynamicCast(knob)); + return pmt::mp(k->value); + } + else if(id == "KnobL") { + GNURadio::KnobLPtr k(GNURadio::KnobLPtr::dynamicCast(knob)); + return pmt::mp((long)k->value); + } + //else if(id == "KnobVecF") { + // GNURadio::KnobVecFPtr k(GNURadio::KnobVecFPtr::dynamicCast(knob)); + // return pmt::mp(k->value); + //TODO: FLOAT!!! + //TODO: VECTORS!!! + + else { + std::cerr << "Error: Don't know how to handle Knob Type: " << id << std::endl; assert(0); + } + + return pmt::pmt_t(); +} diff --git a/gnuradio-core/src/lib/general/gr_multiply_cc.i b/gnuradio-core/src/lib/runtime/rpcpmtconverters_ice.h index f0faa3594c..4403b96a2a 100644 --- a/gnuradio-core/src/lib/general/gr_multiply_cc.i +++ b/gnuradio-core/src/lib/runtime/rpcpmtconverters_ice.h @@ -1,9 +1,9 @@ /* -*- 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) @@ -20,13 +20,16 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,multiply_cc) +#ifndef RPCPMTCONVERTERS_ICE_H +#define RPCPMTCONVERTERS_ICE_H -gr_multiply_cc_sptr -gr_make_multiply_cc (size_t vlen=1); +#include <gruel/pmt.h> +#include <gnuradio.h> -class gr_multiply_cc : public gr_sync_block +namespace rpcpmtconverter { -public: + pmt::pmt_t to_pmt(const GNURadio::KnobPtr& knob, const Ice::Current& c); + GNURadio::KnobPtr from_pmt(const pmt::pmt_t& knob, const Ice::Current& c); +} -}; +#endif /* RPCPMTCONVERTERS_ICE_H */ diff --git a/gnuradio-core/src/lib/runtime/rpcregisterhelpers.h b/gnuradio-core/src/lib/runtime/rpcregisterhelpers.h new file mode 100644 index 0000000000..411b660eaa --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcregisterhelpers.h @@ -0,0 +1,591 @@ +/* -*- 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 RPCREGISTERHELPERS_H +#define RPCREGISTERHELPERS_H + +#include <stdio.h> +#include <sstream> +#include <iostream> +#include <rpcserver_booter_base.h> +#include <rpcmanager.h> +#include <rpcserver_selector.h> +#include <rpcserver_base.h> +#include <gr_block_registry.h> + +// Base classes +template<typename T, typename Tto> class rpcextractor_base + : public virtual gruel::msg_accepter +{ +public: + rpcextractor_base(T* source, void (T::*func)(Tto)) : + _source(source), _func(func) {;} + ~rpcextractor_base() {;} + + void post(pmt::pmt_t which_port, pmt::pmt_t msg) { + throw std::runtime_error("rpcextractor_base: no post defined for this data type.\n"); + } + +protected: + T* _source; + void (T::*_func)(Tto); +}; + +template<typename T, typename Tto> +class rpcbasic_extractor : public virtual rpcextractor_base<T,Tto> +{ +public: + rpcbasic_extractor(T* source, void (T::*func)(Tto)) : + rpcextractor_base<T,Tto>(source, func) + {;} +}; + +template<typename T, typename Tfrom> +class rpcinserter_base : public virtual gruel::msg_producer +{ +public: + rpcinserter_base(T* source, Tfrom (T::*func)()) : _source(source), _func(func) {;} + rpcinserter_base() {;} + + pmt::pmt_t retrieve() { assert(0); return pmt::pmt_t(); } + +protected: + T* _source; + Tfrom (T::*_func)(); +}; + +template<typename T, typename Tfrom> +class rpcbasic_inserter : + public virtual rpcinserter_base<T,Tfrom> +{ +public: + rpcbasic_inserter(T* source, Tfrom (T::*func)()const) + : rpcinserter_base<T,Tfrom>(source, func) + {;} + + rpcbasic_inserter(T* source, Tfrom (T::*func)()) + : rpcinserter_base<T,Tfrom>(source, func) + {;} + + pmt::pmt_t retrieve() + { + return pmt::mp((rpcinserter_base<T,Tfrom>:: + _source->*rpcinserter_base<T,Tfrom>::_func)()); + } +}; + +// Specialized Extractor Templates +template<typename T> +class rpcbasic_extractor<T,double> : public virtual rpcextractor_base<T,double> +{ +public: + rpcbasic_extractor(T* source, void (T::*func)(double)) + : rpcextractor_base<T,double>(source, func) + {;} + + void post(pmt::pmt_t which_port, pmt::pmt_t msg) + { + (rpcextractor_base<T,double>::_source->*rpcextractor_base<T,double>::_func) + (pmt::to_double(msg)); + } +}; + +template<typename T> +class rpcbasic_extractor<T,float> : public virtual rpcextractor_base<T,float> +{ +public: + rpcbasic_extractor(T* source, void (T::*func)(float)) + : rpcextractor_base<T,float>(source, func) + {;} + + void post(pmt::pmt_t which_port, pmt::pmt_t msg) + { + (rpcextractor_base<T,float>::_source->*rpcextractor_base<T,float>::_func) + (pmt::to_double(msg)); + } +}; + +template<typename T> +class rpcbasic_extractor<T,long> : public virtual rpcextractor_base<T,long> +{ +public: + rpcbasic_extractor(T* source, void (T::*func)(long)) + : rpcextractor_base<T,long>(source, func) + {;} + + void post(pmt::pmt_t which_port, pmt::pmt_t msg) + { + (rpcextractor_base<T,long>::_source->*rpcextractor_base<T,long>::_func) + (pmt::to_long(msg)); + } +}; + +template<typename T> +class rpcbasic_extractor<T,int> : public virtual rpcextractor_base<T,int> +{ +public: + rpcbasic_extractor(T* source, void (T::*func)(int)) + : rpcextractor_base<T,int>(source, func) + {;} + + void post(pmt::pmt_t which_port, pmt::pmt_t msg) + { + (rpcextractor_base<T,int>::_source->*rpcextractor_base<T,int>::_func) + (pmt::to_long(msg)); + } +}; + +template<typename T> +class rpcbasic_extractor<T,bool> : public virtual rpcextractor_base<T,bool> +{ +public: + rpcbasic_extractor(T* source, void (T::*func)(bool)) + : rpcextractor_base<T,bool>(source, func) + {;} + + void post(pmt::pmt_t which_port, pmt::pmt_t msg) + { + (rpcextractor_base<T,bool>::_source->*rpcextractor_base<T,bool>::_func) + (pmt::to_bool(msg)); + } +}; + +template<typename T> +class rpcbasic_extractor<T,std::complex<double> > + : public virtual rpcextractor_base<T,std::complex<double> > +{ +public: + rpcbasic_extractor(T* source, void (T::*func)(std::complex<double>)) + : rpcextractor_base<T,std::complex<double> >(source, func) + {;} + + void post(pmt::pmt_t which_port, pmt::pmt_t msg) + { + (rpcextractor_base<T,std::complex<double> >:: + _source->*rpcextractor_base<T,std::complex<double> >::_func)(pmt::to_complex(msg)); + } +}; + +template<typename T> +class rpcbasic_extractor<T,std::string> + : public virtual rpcextractor_base<T,std::string> +{ +public: + rpcbasic_extractor(T* source, void (T::*func)(std::string)) + : rpcextractor_base<T,std::string>(source, func) + {;} + + void post(pmt::pmt_t which_port, pmt::pmt_t msg) + { + (rpcextractor_base<T,std::string>:: + _source->*rpcextractor_base<T,std::string>::_func)(pmt::symbol_to_string(msg)); + } +}; + +template<typename T> +class rpcbasic_inserter<T,uint64_t> : public virtual rpcinserter_base<T,uint64_t> +{ +public: + rpcbasic_inserter(T* source, uint64_t (T::*func)() const) + : rpcinserter_base<T,uint64_t>(source, func) + {;} + + rpcbasic_inserter(T* source, uint64_t (T::*func)()) + : rpcinserter_base<T,uint64_t>(source, func) + {;} + + pmt::pmt_t retrieve() + { + return pmt::from_uint64((rpcinserter_base<T,uint64_t>:: + _source->*rpcinserter_base<T,uint64_t>::_func)()); + } +}; + +template<typename T> +class rpcbasic_inserter<T,std::vector< std::complex<float> > > + : public virtual rpcinserter_base<T,std::vector< std::complex<float> > > +{ +public: + rpcbasic_inserter(T* source, std::vector<std::complex<float> > (T::*func)() const) + : rpcinserter_base<T,std::vector<std::complex<float> > >(source, func) + {;} + + rpcbasic_inserter(T* source, std::vector<std::complex<float> > (T::*func)()) + : rpcinserter_base<T,std::vector<std::complex<float> > >(source, func) + {;} + + pmt::pmt_t retrieve() + { + std::vector< std::complex<float> > + vec((rpcinserter_base<T,std::vector<std::complex<float> > >:: + _source->*rpcinserter_base<T,std::vector< std::complex<float> > >::_func)()); + return pmt::init_c32vector(vec.size(), &vec[0]); + } +}; + +template<typename T> +class rpcbasic_inserter<T,std::vector< float> > + : public virtual rpcinserter_base<T,std::vector< float > > +{ +public: + rpcbasic_inserter(T* source, std::vector<float> (T::*func)() const) + : rpcinserter_base<T,std::vector<float > >(source, func) + {;} + + rpcbasic_inserter(T* source, std::vector<float> (T::*func)()) + : rpcinserter_base<T,std::vector<float> >(source, func) + {;} + + pmt::pmt_t retrieve() + { + std::vector< float > vec((rpcinserter_base<T,std::vector<float> >:: + _source->*rpcinserter_base<T,std::vector< float> >::_func)()); + return pmt::init_f32vector(vec.size(), &vec[0]); + } +}; + +template <typename T> +struct rpc_register_base +{ + rpc_register_base() {count++;} +protected: static int count; +}; + +// Base class to inherit from and create universal shared pointers. +class rpcbasic_base +{ +public: + rpcbasic_base() {} + virtual ~rpcbasic_base() {}; +}; + +typedef boost::shared_ptr<rpcbasic_base> rpcbasic_sptr; + +template<typename T, typename Tto> +struct rpcbasic_register_set : public rpcbasic_base +{ + // Function used to add a 'set' RPC call using a gr_basic_block's alias. + rpcbasic_register_set(const std::string& block_alias, + const char* functionbase, + void (T::*function)(Tto), + const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, + const char* units_ = "", + const char* desc_ = "", + priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN, + DisplayType display_ = DISPNULL) + { + d_min = min; + d_max = max; + d_def = def; + d_units = units_; + d_desc = desc_; + d_minpriv = minpriv_; + d_display = display_; + d_object = dynamic_cast<T*>(global_block_registry.block_lookup(pmt::intern(block_alias)).get()); +#ifdef RPCSERVER_ENABLED + callbackregister_base::configureCallback_t + extractor(new rpcbasic_extractor<T,Tto>(d_object, function), + minpriv_, std::string(units_), + display_, std::string(desc_), min, max, def); + std::ostringstream oss(std::ostringstream::out); + oss << block_alias << "::" << functionbase; + d_id = oss.str(); + //std::cerr << "REGISTERING SET: " << d_id << " " << desc_ << std::endl; + rpcmanager::get()->i()->registerConfigureCallback(d_id, extractor); +#endif + } + + // Function used to add a 'set' RPC call using a name and the object + rpcbasic_register_set(const std::string& name, + const char* functionbase, + T* obj, + void (T::*function)(Tto), + const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, + const char* units_ = "", + const char* desc_ = "", + priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN, + DisplayType display_ = DISPNULL) + { + d_min = min; + d_max = max; + d_def = def; + d_units = units_; + d_desc = desc_; + d_minpriv = minpriv_; + d_display = display_; + d_object = obj; +#ifdef RPCSERVER_ENABLED + callbackregister_base::configureCallback_t + extractor(new rpcbasic_extractor<T,Tto>(d_object, function), + minpriv_, std::string(units_), + display_, std::string(desc_), min, max, def); + std::ostringstream oss(std::ostringstream::out); + oss << name << "::" << functionbase; + d_id = oss.str(); + //std::cerr << "REGISTERING SET: " << d_id << " " << desc_ << std::endl; + rpcmanager::get()->i()->registerConfigureCallback(d_id, extractor); +#endif + } + + ~rpcbasic_register_set() + { +#ifdef RPCSERVER_ENABLED + rpcmanager::get()->i()->unregisterConfigureCallback(d_id); +#endif + } + + + pmt::pmt_t min() const { return d_min; } + pmt::pmt_t max() const { return d_max; } + pmt::pmt_t def() const { return d_def; } + std::string units() const { return d_units; } + std::string description() const { return d_desc; } + priv_lvl_t privilege_level() const { return d_minpriv; } + DisplayType default_display() const { return d_display; } + + void set_min(pmt::pmt_t p) { d_min = p; } + void set_max(pmt::pmt_t p) { d_max = p; } + void set_def(pmt::pmt_t p) { d_def = p; } + void units(std::string u) { d_units = u; } + void description(std::string d) { d_desc = d; } + void privilege_level(priv_lvl_t p) { d_minpriv = p; } + void default_display(DisplayType d) { d_display = d; } + +private: + std::string d_id; + pmt::pmt_t d_min, d_max, d_def; + std::string d_units, d_desc; + priv_lvl_t d_minpriv; + DisplayType d_display; + T *d_object; +}; + + +template<typename T, typename Tfrom> +class rpcbasic_register_get : public rpcbasic_base +{ +public: + // Function used to add a 'set' RPC call using a gr_basic_block's alias. + // primary constructor to allow for T get() functions + rpcbasic_register_get(const std::string& block_alias, + const char* functionbase, + Tfrom (T::*function)(), + const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, + const char* units_ = "", + const char* desc_ = "", + priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN, + DisplayType display_ = DISPNULL) + { + d_min = min; + d_max = max; + d_def = def; + d_units = units_; + d_desc = desc_; + d_minpriv = minpriv_; + d_display = display_; + d_object = dynamic_cast<T*>(global_block_registry.block_lookup(pmt::intern(block_alias)).get()); +#ifdef RPCSERVER_ENABLED + callbackregister_base::queryCallback_t + inserter(new rpcbasic_inserter<T,Tfrom>(d_object, function), + minpriv_, std::string(units_), display_, std::string(desc_), min, max, def); + std::ostringstream oss(std::ostringstream::out); + oss << block_alias << "::" << functionbase; + d_id = oss.str(); + //std::cerr << "REGISTERING GET: " << d_id << " " << desc_ << std::endl; + rpcmanager::get()->i()->registerQueryCallback(d_id, inserter); +#endif + } + + + // alternate constructor to allow for T get() const functions + rpcbasic_register_get(const std::string& block_alias, + const char* functionbase, + Tfrom (T::*function)() const, + const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, + const char* units_ = "", + const char* desc_ = "", + priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN, + DisplayType display_ = DISPNULL) + { + d_min = min; + d_max = max; + d_def = def; + d_units = units_; + d_desc = desc_; + d_minpriv = minpriv_; + d_display = display_; + d_object = dynamic_cast<T*>(global_block_registry.block_lookup(pmt::intern(block_alias)).get()); +#ifdef RPCSERVER_ENABLED + callbackregister_base::queryCallback_t + inserter(new rpcbasic_inserter<T,Tfrom>(d_object, (Tfrom (T::*)())function), + minpriv_, std::string(units_), display_, std::string(desc_), min, max, def); + std::ostringstream oss(std::ostringstream::out); + oss << block_alias << "::" << functionbase; + d_id = oss.str(); + //std::cerr << "REGISTERING GET CONST: " << d_id << " " << desc_ << " " << display_ << std::endl; + rpcmanager::get()->i()->registerQueryCallback(d_id, inserter); +#endif + } + + // Function used to add a 'set' RPC call using a name and the object + // primary constructor to allow for T get() functions + rpcbasic_register_get(const std::string& name, + const char* functionbase, + T* obj, + Tfrom (T::*function)(), + const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, + const char* units_ = "", + const char* desc_ = "", + priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN, + DisplayType display_ = DISPNULL) + { + d_min = min; + d_max = max; + d_def = def; + d_units = units_; + d_desc = desc_; + d_minpriv = minpriv_; + d_display = display_; + d_object = obj; +#ifdef RPCSERVER_ENABLED + callbackregister_base::queryCallback_t + inserter(new rpcbasic_inserter<T,Tfrom>(d_object, function), + minpriv_, std::string(units_), display_, std::string(desc_), min, max, def); + std::ostringstream oss(std::ostringstream::out); + oss << name << "::" << functionbase; + d_id = oss.str(); + //std::cerr << "REGISTERING GET: " << d_id << " " << desc_ << std::endl; + rpcmanager::get()->i()->registerQueryCallback(d_id, inserter); +#endif + } + + + // alternate constructor to allow for T get() const functions + rpcbasic_register_get(const std::string& name, + const char* functionbase, + T* obj, + Tfrom (T::*function)() const, + const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, + const char* units_ = "", + const char* desc_ = "", + priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN, + DisplayType display_ = DISPNULL) + { + d_min = min; + d_max = max; + d_def = def; + d_units = units_; + d_desc = desc_; + d_minpriv = minpriv_; + d_display = display_; + d_object = obj; +#ifdef RPCSERVER_ENABLED + callbackregister_base::queryCallback_t + inserter(new rpcbasic_inserter<T,Tfrom>(d_object, (Tfrom (T::*)())function), + minpriv_, std::string(units_), display_, std::string(desc_), min, max, def); + std::ostringstream oss(std::ostringstream::out); + oss << name << "::" << functionbase; + d_id = oss.str(); + //std::cerr << "REGISTERING GET CONST: " << d_id << " " << desc_ << " " << display_ << std::endl; + rpcmanager::get()->i()->registerQueryCallback(d_id, inserter); +#endif + } + + ~rpcbasic_register_get() + { +#ifdef RPCSERVER_ENABLED + rpcmanager::get()->i()->unregisterQueryCallback(d_id); +#endif + } + + pmt::pmt_t min() const { return d_min; } + pmt::pmt_t max() const { return d_max; } + pmt::pmt_t def() const { return d_def; } + std::string units() const { return d_units; } + std::string description() const { return d_desc; } + priv_lvl_t privilege_level() const { return d_minpriv; } + DisplayType default_display() const { return d_display; } + + void set_min(pmt::pmt_t p) { d_min = p; } + void set_max(pmt::pmt_t p) { d_max = p; } + void set_def(pmt::pmt_t p) { d_def = p; } + void units(std::string u) { d_units = u; } + void description(std::string d) { d_desc = d; } + void privilege_level(priv_lvl_t p) { d_minpriv = p; } + void default_display(DisplayType d) { d_display = d; } + +private: + std::string d_id; + pmt::pmt_t d_min, d_max, d_def; + std::string d_units, d_desc; + priv_lvl_t d_minpriv; + DisplayType d_display; + T *d_object; +}; + +/* + * This class can wrap a pre-existing variable type for you + * it will define the getter and rpcregister call for you. + * + * It should be used for read-only getters. + * + */ +template<typename Tfrom> +class rpcbasic_register_variable : public rpcbasic_base +{ +private: + rpcbasic_register_get< rpcbasic_register_variable<Tfrom>, Tfrom > d_rpc_reg; + Tfrom *d_variable; + Tfrom get() { return *d_variable; } + +public: + // empty constructor which should never be called but needs to exist for ues in varous STL data structures + rpcbasic_register_variable() : + d_rpc_reg("FAIL", "FAIL", this, -1, &rpcbasic_register_variable::get, + pmt::PMT_NIL, pmt::PMT_NIL, pmt::PMT_NIL, DISPNULL, + "FAIL", "FAIL", RPC_PRIVLVL_MIN), + d_variable(NULL) + { + std::cerr << "ERROR: rpcbasic_register_variable called with no args. " + << "If this happens, someone has tried to use rpcbasic_register_variable incorrectly.\n"; + assert(0); + }; + + void set(Tfrom* _variable) { d_variable = _variable; } + + rpcbasic_register_variable(const std::string& namebase, + const char* functionbase, + Tfrom *variable, + const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, + const char* units_ = "", + const char* desc_ = "", + priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN, + DisplayType display_=DISPNULL) : + d_rpc_reg(namebase, functionbase, this, &rpcbasic_register_variable::get, + min, max, def, units_, desc_, minpriv_, display_), + d_variable(variable) + { + //std::cerr << "REGISTERING VAR: " << serial << " " << desc_ << std::endl; + } +}; + +#endif diff --git a/gnuradio-core/src/lib/runtime/rpcserver_aggregator.cc b/gnuradio-core/src/lib/runtime/rpcserver_aggregator.cc new file mode 100644 index 0000000000..d750d64905 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcserver_aggregator.cc @@ -0,0 +1,93 @@ +/* -*- 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 <rpcserver_aggregator.h> +#include <rpcserver_booter_base.h> +#include <iostream> +#include <sstream> +#include <stdexcept> + +rpcserver_aggregator::rpcserver_aggregator() + : d_type(std::string("aggregator")) +{;} + +rpcserver_aggregator::~rpcserver_aggregator() +{;} + +const std::string& +rpcserver_aggregator::type() +{ + return d_type; +} + +const std::vector<std::string>& +rpcserver_aggregator::registeredServers() +{ + return d_registeredServers; +} + +void +rpcserver_aggregator::registerConfigureCallback(const std::string &id, + const configureCallback_t callback) +{ + std::for_each(d_serverlist.begin(), d_serverlist.end(), + registerConfigureCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, configureCallback_t>(id, callback)); +} + +void +rpcserver_aggregator::unregisterConfigureCallback(const std::string &id) +{ + std::for_each(d_serverlist.begin(), d_serverlist.end(), + unregisterConfigureCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, configureCallback_t>(id)); +} + +void +rpcserver_aggregator::registerQueryCallback(const std::string &id, const queryCallback_t callback) +{ + std::for_each(d_serverlist.begin(), d_serverlist.end(), + registerQueryCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, queryCallback_t>(id, callback)); +} + +void +rpcserver_aggregator::unregisterQueryCallback(const std::string &id) +{ + std::for_each(d_serverlist.begin(), d_serverlist.end(), + unregisterQueryCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, queryCallback_t>(id)); +} + +void +rpcserver_aggregator::registerServer(rpcmanager_base::rpcserver_booter_base_sptr server) +{ + std::vector<std::string>::iterator it(std::find(d_registeredServers.begin(), + d_registeredServers.end(), + server->type())); + if(it != d_registeredServers.end()) { + d_serverlist.push_back(server); + d_registeredServers.push_back(server->type()); + } + else { + std::stringstream s; + s << "rpcserver_aggregator::registerServer: server of type " + << server->type() << " already registered" << std::endl; + throw std::runtime_error(s.str().c_str()); + } +} diff --git a/gnuradio-core/src/lib/runtime/rpcserver_aggregator.h b/gnuradio-core/src/lib/runtime/rpcserver_aggregator.h new file mode 100644 index 0000000000..050d9bb1e5 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcserver_aggregator.h @@ -0,0 +1,100 @@ +/* -*- 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 RPCSERVER_AGGREGATOR_H +#define RPCSERVER_AGGREGATOR_H + +#include <vector> +#include <string> +#include <rpcserver_base.h> +#include <rpcmanager_base.h> + +class rpcserver_aggregator : public virtual rpcserver_base +{ +public: + rpcserver_aggregator(); + virtual ~rpcserver_aggregator(); + + void registerConfigureCallback(const std::string &id, const configureCallback_t callback); + void unregisterConfigureCallback(const std::string &id); + + void registerQueryCallback(const std::string &id, const queryCallback_t callback); + void unregisterQueryCallback(const std::string &id); + + void registerServer(rpcmanager_base::rpcserver_booter_base_sptr server); + + const std::string& type(); + + const std::vector<std::string>& registeredServers(); + +private: + template<class T, typename Tcallback> + struct registerConfigureCallback_f: public std::unary_function<T,void> + { + registerConfigureCallback_f(const std::string &_id, const Tcallback _callback) + : id(_id), callback(_callback) + {;} + + void operator()(T& x) { x->i()->registerConfigureCallback(id, callback); } + const std::string& id; const Tcallback& callback; + }; + + template<class T, typename Tcallback> + struct unregisterConfigureCallback_f: public std::unary_function<T,void> + { + unregisterConfigureCallback_f(const std::string &_id) + : id(_id) + {;} + + void operator()(T& x) { x->i()->unregisterConfigureCallback(id); } + const std::string& id; + }; + + template<class T, typename Tcallback> + struct registerQueryCallback_f: public std::unary_function<T,void> + { + registerQueryCallback_f(const std::string &_id, const Tcallback _callback) + : id(_id), callback(_callback) + {;} + + void operator()(T& x) { x->i()->registerQueryCallback(id, callback); } + const std::string& id; const Tcallback& callback; + }; + + template<class T, typename Tcallback> + struct unregisterQueryCallback_f: public std::unary_function<T,void> + { + unregisterQueryCallback_f(const std::string &_id) + : id(_id) + {;} + + void operator()(T& x) { x->i()->unregisterQueryCallback(id); } + const std::string& id; + }; + + const std::string d_type; + typedef std::vector<rpcmanager_base::rpcserver_booter_base_sptr> rpcServerMap_t; + std::vector<std::string> d_registeredServers; + rpcServerMap_t d_serverlist; +}; + +#endif /* RPCSERVER_AGGREGATOR_H */ diff --git a/gnuradio-core/src/lib/runtime/rpcserver_base.h b/gnuradio-core/src/lib/runtime/rpcserver_base.h new file mode 100644 index 0000000000..bc985c8d53 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcserver_base.h @@ -0,0 +1,47 @@ +/* -*- 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 RPCSERVER_BASE_H +#define RPCSERVER_BASE_H + +#include <rpccallbackregister_base.h> + +class rpcserver_base : public virtual callbackregister_base +{ +public: + rpcserver_base() : cur_priv(RPC_PRIVLVL_ALL) {;} + virtual ~rpcserver_base() {;} + + virtual void registerConfigureCallback(const std::string &id, const configureCallback_t callback) = 0; + virtual void unregisterConfigureCallback(const std::string &id) = 0; + virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback) = 0; + virtual void unregisterQueryCallback(const std::string &id) = 0; + virtual void setCurPrivLevel(const priv_lvl_t priv) { cur_priv = priv; } + + typedef boost::shared_ptr<rpcserver_base> rpcserver_base_sptr; +protected: + priv_lvl_t cur_priv; + +private: +}; + +#endif /* RPCSERVER_BASE_H */ diff --git a/gnuradio-core/src/lib/general/gr_multiply_cc.h b/gnuradio-core/src/lib/runtime/rpcserver_booter_aggregator.cc index d25935b4ca..c4c1b03c15 100644 --- a/gnuradio-core/src/lib/general/gr_multiply_cc.h +++ b/gnuradio-core/src/lib/runtime/rpcserver_booter_aggregator.cc @@ -20,37 +20,43 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GR_MULTIPLY_CC_H -#define INCLUDED_GR_MULTIPLY_CC_H +#include <rpcserver_booter_aggregator.h> -#include <gr_core_api.h> -#include <gr_sync_block.h> +rpcserver_booter_aggregator::rpcserver_booter_aggregator() : + d_type(std::string("aggregator")), server(new rpcserver_aggregator()) +{;} + +rpcserver_booter_aggregator::~rpcserver_booter_aggregator() +{;} -class gr_multiply_cc; -typedef boost::shared_ptr<gr_multiply_cc> gr_multiply_cc_sptr; - -GR_CORE_API gr_multiply_cc_sptr -gr_make_multiply_cc (size_t vlen=1); - -/*! - * \brief Multiply streams of complex values - * \ingroup math_blk - */ - -class GR_CORE_API gr_multiply_cc : public gr_sync_block +rpcserver_base* +rpcserver_booter_aggregator::i() { - private: - friend GR_CORE_API gr_multiply_cc_sptr - gr_make_multiply_cc (size_t vlen); - gr_multiply_cc (size_t vlen); + return &(*server); +} - size_t d_vlen; +const std::string& +rpcserver_booter_aggregator::type() +{ + return d_type; +} - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +const std::vector<std::string> +rpcserver_booter_aggregator::endpoints() +{ + std::vector<std::string> ep; + ep.push_back(std::string("TODO")); + return ep; +} +const std::vector<std::string>& +rpcserver_booter_aggregator::registeredServers() +{ + return server->registeredServers(); +} -#endif /* INCLUDED_GR_MULTIPLY_CC_H */ +rpcserver_aggregator* +rpcserver_booter_aggregator::agg() +{ + return &(*server); +} diff --git a/gnuradio-core/src/lib/general/gr_add_ff.h b/gnuradio-core/src/lib/runtime/rpcserver_booter_aggregator.h index ff5604c97d..da190a0be1 100644 --- a/gnuradio-core/src/lib/general/gr_add_ff.h +++ b/gnuradio-core/src/lib/runtime/rpcserver_booter_aggregator.h @@ -1,9 +1,9 @@ /* -*- 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) @@ -20,37 +20,37 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GR_ADD_FF_H -#define INCLUDED_GR_ADD_FF_H +#ifndef RPCSERVER_BOOTER_AGGREGATOR +#define RPCSERVER_BOOTER_AGGREGATOR #include <gr_core_api.h> -#include <gr_sync_block.h> +#include <rpcserver_booter_base.h> +#include <rpcserver_aggregator.h> +#include <boost/shared_ptr.hpp> +#include <string> -class gr_add_ff; -typedef boost::shared_ptr<gr_add_ff> gr_add_ff_sptr; +class rpcserver_server; -GR_CORE_API gr_add_ff_sptr -gr_make_add_ff (size_t vlen=1); +class GR_CORE_API rpcserver_booter_aggregator : + public virtual rpcserver_booter_base +{ + public: + rpcserver_booter_aggregator(); + ~rpcserver_booter_aggregator(); -/*! - * \brief Add streams of complex values - * \ingroup math_blk - */ + rpcserver_base* i(); + const std::string& type(); + const std::vector<std::string> endpoints(); -class GR_CORE_API gr_add_ff : public gr_sync_block -{ - private: - friend GR_CORE_API gr_add_ff_sptr - gr_make_add_ff (size_t vlen); - gr_add_ff (size_t vlen); + const std::vector<std::string>& registeredServers(); - size_t d_vlen; + protected: + friend class rpcmanager; + rpcserver_aggregator* agg(); - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); +private: + std::string d_type; + boost::shared_ptr<rpcserver_aggregator> server; }; - -#endif /* INCLUDED_GR_ADD_FF_H */ +#endif /* RPCSERVER_BOOTER_AGGREGATOR */ diff --git a/gnuradio-core/src/lib/runtime/rpcserver_booter_base.h b/gnuradio-core/src/lib/runtime/rpcserver_booter_base.h new file mode 100644 index 0000000000..682944dada --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcserver_booter_base.h @@ -0,0 +1,44 @@ +/* -*- 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 RPCSERVER_BOOTER_BASE +#define RPCSERVER_BOOTER_BASE + +#include <string> +#include <vector> + +class rpcserver_base; + +class rpcserver_booter_base +{ +public: + rpcserver_booter_base() {;} + virtual ~rpcserver_booter_base() {;} + + virtual rpcserver_base* i()=0; + virtual const std::vector<std::string> endpoints()=0; + virtual const std::string& type()=0; + +private: +}; + +#endif /* RPCSERVER_BOOTER_BASE */ diff --git a/gnuradio-core/src/lib/runtime/rpcserver_booter_ice.cc b/gnuradio-core/src/lib/runtime/rpcserver_booter_ice.cc new file mode 100644 index 0000000000..7cc8cc8938 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcserver_booter_ice.cc @@ -0,0 +1,54 @@ +/* -*- 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 <rpcserver_ice.h> +#include <rpcserver_booter_ice.h> + +namespace { + static const char* const CONTROL_PORT_CLASS("ice"); + static const char* const CONTROL_PORT_NAME("ControlPort"); + static const char* const ENDPOINT_NAME("gnuradio"); +}; + +rpcserver_booter_ice::rpcserver_booter_ice() : + ice_server_template<rpcserver_base, rpcserver_ice, + rpcserver_booter_ice, GNURadio::ControlPortPtr> + (this, std::string(CONTROL_PORT_NAME), std::string(ENDPOINT_NAME)), + d_type(std::string(CONTROL_PORT_CLASS)) +{;} + +rpcserver_booter_ice::~rpcserver_booter_ice() +{;} + +rpcserver_base* +rpcserver_booter_ice::i() +{ + return ice_server_template<rpcserver_base, rpcserver_ice, + rpcserver_booter_ice, GNURadio::ControlPortPtr>::i(); +} + +const std::vector<std::string> +rpcserver_booter_ice::endpoints() +{ + return ice_server_template<rpcserver_base, rpcserver_ice, + rpcserver_booter_ice, GNURadio::ControlPortPtr>::endpoints(); +} diff --git a/gnuradio-core/src/lib/runtime/rpcserver_booter_ice.h b/gnuradio-core/src/lib/runtime/rpcserver_booter_ice.h new file mode 100644 index 0000000000..69dfcc7602 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcserver_booter_ice.h @@ -0,0 +1,49 @@ +/* -*- 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 RPCSERVER_BOOTER_ICE_H +#define RPCSERVER_BOOTER_ICE_H + +#include <rpcserver_booter_base.h> +#include <ice_server_template.h> +#include <gnuradio.h> + +class rpcserver_base; +class rpcserver_ice; + +class rpcserver_booter_ice : public virtual rpcserver_booter_base, + public virtual ice_server_template<rpcserver_base, rpcserver_ice, + rpcserver_booter_ice, GNURadio::ControlPortPtr> +{ +public: + rpcserver_booter_ice(); + ~rpcserver_booter_ice(); + + rpcserver_base* i(); + const std::string & type() {return d_type;} + const std::vector<std::string> endpoints(); + +private: + std::string d_type; +}; + +#endif /* RPCSERVER_BOOTER_ICE_H */ diff --git a/gnuradio-core/src/lib/runtime/rpcserver_ice.cc b/gnuradio-core/src/lib/runtime/rpcserver_ice.cc new file mode 100644 index 0000000000..12229a0688 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcserver_ice.cc @@ -0,0 +1,165 @@ +/* -*- 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 <rpcserver_ice.h> +#include <IceUtil/IceUtil.h> +#include <Ice/Ice.h> +#include <iostream> +#include <sstream> +#include <stdexcept> +#include <gruel/pmt.h> + +#define DEBUG 0 + +using namespace rpcpmtconverter; + +rpcserver_ice::rpcserver_ice() +{} + +rpcserver_ice::~rpcserver_ice() +{} + +void +rpcserver_ice::registerConfigureCallback(const std::string &id, + const configureCallback_t callback) +{ + { + ConfigureCallbackMap_t::const_iterator iter(d_setcallbackmap.find(id)); + if(iter != d_setcallbackmap.end()) { + std::stringstream s; + s << "rpcserver_ice:: rpcserver_ice ERROR registering set, already registered: " + << id << std::endl; + throw std::runtime_error(s.str().c_str()); + } + } + + if(DEBUG) + std::cout << "rpcserver_ice registering set: " << id << std::endl; + + d_setcallbackmap.insert(ConfigureCallbackMap_t::value_type(id, callback)); +} + +void +rpcserver_ice::unregisterConfigureCallback(const std::string &id) +{ + ConfigureCallbackMap_t::iterator iter(d_setcallbackmap.find(id)); + if(iter == d_setcallbackmap.end()) { + std::stringstream s; + s << "rpcserver_ice:: rpcserver_ice ERROR unregistering set, not registered: " + << id << std::endl; + throw std::runtime_error(s.str().c_str()); + } + + if(DEBUG) + std::cout << "rpcserver_ice unregistering set: " << id << std::endl; + + d_setcallbackmap.erase(iter); +} + +void +rpcserver_ice::registerQueryCallback(const std::string &id, + const queryCallback_t callback) +{ + { + QueryCallbackMap_t::const_iterator iter(d_getcallbackmap.find(id)); + if(iter != d_getcallbackmap.end()) { + std::stringstream s; + s << "rpcserver_ice:: rpcserver_ice ERROR registering get, already registered: " + << id << std::endl; + throw std::runtime_error(s.str().c_str()); + } + } + + if(DEBUG) + std::cout << "rpcserver_ice registering get: " << id << std::endl; + + d_getcallbackmap.insert(QueryCallbackMap_t::value_type(id, callback)); +} + +void +rpcserver_ice::unregisterQueryCallback(const std::string &id) +{ + QueryCallbackMap_t::iterator iter(d_getcallbackmap.find(id)); + if(iter == d_getcallbackmap.end()) { + std::stringstream s; + s << "rpcserver_ice:: rpcserver_ice ERROR unregistering get, registered: " + << id << std::endl; + throw std::runtime_error(s.str().c_str()); + } + + if(DEBUG) + std::cout << "rpcserver_ice unregistering get: " << id << std::endl; + + d_getcallbackmap.erase(iter); +} + +void +rpcserver_ice::set(const GNURadio::KnobMap& knobs, const Ice::Current& c) +{ + std::for_each(knobs.begin(), knobs.end(), + set_f<GNURadio::KnobMap::value_type,ConfigureCallbackMap_t> + (c, d_setcallbackmap, cur_priv)); +} + +GNURadio::KnobMap +rpcserver_ice::get(const GNURadio::KnobIDList& knobs, const Ice::Current& c) +{ + GNURadio::KnobMap outknobs; + + if(knobs.size() == 0) { + std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(), + get_all_f<QueryCallbackMap_t::value_type, QueryCallbackMap_t, GNURadio::KnobMap> + (c, d_getcallbackmap, cur_priv, outknobs)); + } + else { + std::for_each(knobs.begin(), knobs.end(), + get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t> + (c, d_getcallbackmap, cur_priv, outknobs)); + } + return outknobs; +} + +GNURadio::KnobPropMap +rpcserver_ice::properties(const GNURadio::KnobIDList& knobs, const Ice::Current& c) +{ + GNURadio::KnobPropMap outknobs; + + if(knobs.size() == 0) { + std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(), + properties_all_f<QueryCallbackMap_t::value_type, + QueryCallbackMap_t,GNURadio::KnobPropMap>(c, d_getcallbackmap, cur_priv, outknobs)); + } + else { + std::for_each(knobs.begin(), knobs.end(), + properties_f<GNURadio::KnobIDList::value_type, + QueryCallbackMap_t, GNURadio::KnobPropMap>(c, d_getcallbackmap, cur_priv, outknobs)); + } + return outknobs; +} + +void +rpcserver_ice::shutdown(const Ice::Current& c) +{ + if(DEBUG) + std::cout << "Shutting down..." << std::endl; + c.adapter->getCommunicator()->shutdown(); +} diff --git a/gnuradio-core/src/lib/runtime/rpcserver_ice.h b/gnuradio-core/src/lib/runtime/rpcserver_ice.h new file mode 100644 index 0000000000..98847bbe05 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcserver_ice.h @@ -0,0 +1,221 @@ +/* -*- 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 RPCSERVER_ICE_H +#define RPCSERVER_ICE_H + +#include <rpcserver_base.h> +#include <rpcpmtconverters_ice.h> +#include <string> +#include <map> +#include <gnuradio.h> +#include <Ice/Exception.h> + +class rpcserver_ice : public virtual rpcserver_base, public GNURadio::ControlPort +{ +public: + rpcserver_ice(); + virtual ~rpcserver_ice(); + + void registerConfigureCallback(const std::string &id, const configureCallback_t callback); + void unregisterConfigureCallback(const std::string &id); + + void registerQueryCallback(const std::string &id, const queryCallback_t callback); + void unregisterQueryCallback(const std::string &id); + + virtual void set(const GNURadio::KnobMap&, const Ice::Current&); + + GNURadio::KnobMap get(const GNURadio::KnobIDList&, const Ice::Current&); + + GNURadio::KnobPropMap properties(const GNURadio::KnobIDList&, const Ice::Current&); + + virtual void shutdown(const Ice::Current&); + +private: + typedef std::map<std::string, configureCallback_t> ConfigureCallbackMap_t; + ConfigureCallbackMap_t d_setcallbackmap; + + typedef std::map<std::string, queryCallback_t> QueryCallbackMap_t; + QueryCallbackMap_t d_getcallbackmap; + + template<typename T, typename TMap> struct set_f + : public std::unary_function<T,void> + { + set_f(const Ice::Current& _c, TMap& _setcallbackmap, const priv_lvl_t& _cur_priv) : + c(_c), d_setcallbackmap(_setcallbackmap), cur_priv(_cur_priv) + {;} + + void operator()(const T& p) + { + ConfigureCallbackMap_t::const_iterator iter(d_setcallbackmap.find(p.first)); + if(iter != d_setcallbackmap.end()) { + if(cur_priv <= iter->second.priv) { + (*iter->second.callback).post(pmt::PMT_NIL, rpcpmtconverter::to_pmt(p.second,c)); + } + else { + std::cout << "Key " << p.first << " requires PRIVLVL <= " + << iter->second.priv << " to set, currently at: " + << cur_priv << std::endl; + } + } + else { + throw IceUtil::NullHandleException(__FILE__, __LINE__); + } + } + + const Ice::Current& c; + TMap& d_setcallbackmap; + const priv_lvl_t& cur_priv; + }; + + template<typename T, typename TMap> + struct get_f : public std::unary_function<T,void> + { + get_f(const Ice::Current& _c, TMap& _getcallbackmap, + const priv_lvl_t& _cur_priv, GNURadio::KnobMap& _outknobs) : + c(_c), d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs) + {} + + void operator()(const T& p) + { + QueryCallbackMap_t::const_iterator iter(d_getcallbackmap.find(p)); + if(iter != d_getcallbackmap.end()) { + if(cur_priv <= iter->second.priv) { + outknobs[p] = rpcpmtconverter::from_pmt((*iter->second.callback).retrieve(), c); + } + else { + std::cout << "Key " << iter->first << " requires PRIVLVL: <= " + << iter->second.priv << " to get, currently at: " + << cur_priv << std::endl; + } + } + else { + throw IceUtil::NullHandleException(__FILE__, __LINE__); + } + } + + const Ice::Current& c; + TMap& d_getcallbackmap; + const priv_lvl_t& cur_priv; + GNURadio::KnobMap& outknobs; + }; + + template<typename T, typename TMap, typename TKnobMap> + struct get_all_f : public std::unary_function<T,void> + { + get_all_f(const Ice::Current& _c, TMap& _getcallbackmap, + const priv_lvl_t& _cur_priv, TKnobMap& _outknobs) : + c(_c), d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs) + {;} + + void operator()(const T& p) + { + if(cur_priv <= p.second.priv) { + outknobs[p.first] = rpcpmtconverter::from_pmt(p.second.callback->retrieve(), c); + } + else { + std::cout << "Key " << p.first << " requires PRIVLVL <= " + << p.second.priv << " to get, currently at: " + << cur_priv << std::endl; + } + } + + const Ice::Current& c; + TMap& d_getcallbackmap; + const priv_lvl_t& cur_priv; + TKnobMap& outknobs; + }; + + template<typename T, typename TMap, typename TKnobMap> + struct properties_all_f : public std::unary_function<T,void> + { + properties_all_f(const Ice::Current& _c, QueryCallbackMap_t& _getcallbackmap, + const priv_lvl_t& _cur_priv, GNURadio::KnobPropMap& _outknobs) : + c(_c), d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs) + {;} + + void operator()(const T& p) + { + if(cur_priv <= p.second.priv) { + GNURadio::KnobProp prop;//(new GNURadio::KnobProp()); + prop.type = GNURadio::KNOBDOUBLE; + prop.units = p.second.units; + prop.description = p.second.description; + prop.min = rpcpmtconverter::from_pmt(p.second.min, c); + prop.max = rpcpmtconverter::from_pmt(p.second.max, c); + prop.display = static_cast<GNURadio::DisplayType>(p.second.display); + outknobs[p.first] = prop; + } + else { + std::cout << "Key " << p.first << " requires PRIVLVL <= " + << p.second.priv << " to get, currently at: " + << cur_priv << std::endl; + } + } + + const Ice::Current& c; + TMap& d_getcallbackmap; + const priv_lvl_t& cur_priv; + TKnobMap& outknobs; + }; + + template<class T, typename TMap, typename TKnobMap> + struct properties_f : public std::unary_function<T,void> + { + properties_f(const Ice::Current& _c, TMap& _getcallbackmap, + const priv_lvl_t& _cur_priv, TKnobMap& _outknobs) : + c(_c), d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs) + {;} + + void operator()(const T& p) + { + typename TMap::const_iterator iter(d_getcallbackmap.find(p)); + if(iter != d_getcallbackmap.end()) { + if(cur_priv <= iter->second.priv) { + GNURadio::KnobProp prop; + prop.type = GNURadio::KNOBDOUBLE; + prop.units = iter->second.units; + prop.description = iter->second.description; + prop.min = rpcpmtconverter::from_pmt(iter->second.min, c); + prop.max = rpcpmtconverter::from_pmt(iter->second.max, c); + prop.display = static_cast<GNURadio::DisplayType>(iter->second.display); + //outknobs[iter->first] = prop; + outknobs[p] = prop; + } + else { + std::cout << "Key " << iter->first << " requires PRIVLVL: <= " << + iter->second.priv << " to get, currently at: " << cur_priv << std::endl; + } + } + else { + throw IceUtil::NullHandleException(__FILE__, __LINE__); + } + } + + const Ice::Current& c; + TMap& d_getcallbackmap; + const priv_lvl_t& cur_priv; + TKnobMap& outknobs; + }; +}; + +#endif /* RPCSERVER_ICE_H */ diff --git a/gnuradio-core/src/lib/runtime/rpcserver_selector.cc b/gnuradio-core/src/lib/runtime/rpcserver_selector.cc new file mode 100644 index 0000000000..362d5f060a --- /dev/null +++ b/gnuradio-core/src/lib/runtime/rpcserver_selector.cc @@ -0,0 +1,40 @@ +/* -*- 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 <rpcserver_booter_aggregator.h> +#include <rpcmanager.h> +#include <rpcserver_selector.h> + +bool rpcmanager::make_aggregator(false); + +#ifdef RPCSERVER_ICE + #include <rpcserver_booter_ice.h> + rpcmanager::rpcserver_booter_register_helper<rpcserver_booter_ice> boot_ice; +#endif + +#ifdef RPCSERVER_ERLANG + #error TODO ERLANG +#endif + +#ifdef RPCSERVER_XMLRPC + #error TODO XMLRPC +#endif diff --git a/gnuradio-core/src/lib/general/gr_add_ff.i b/gnuradio-core/src/lib/runtime/rpcserver_selector.h index 75a87651fa..fa63c9a2dc 100644 --- a/gnuradio-core/src/lib/general/gr_add_ff.i +++ b/gnuradio-core/src/lib/runtime/rpcserver_selector.h @@ -1,9 +1,9 @@ /* -*- 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) @@ -20,13 +20,13 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,add_ff) +#ifndef RPCSERVER_SELECTOR +#define RPCSERVER_SELECTOR -gr_add_ff_sptr -gr_make_add_ff (size_t vlen=1); +#define RPCSERVER_ENABLED -class gr_add_ff : public gr_sync_block -{ -public: +#define RPCSERVER_ICE +//#define RPCSERVER_ERLANG +//#define RPCSERVER_XMLRPC -}; +#endif diff --git a/gnuradio-core/src/lib/runtime/runtime.i b/gnuradio-core/src/lib/runtime/runtime.i index 8e35df8342..f9945e8060 100644 --- a/gnuradio-core/src/lib/runtime/runtime.i +++ b/gnuradio-core/src/lib/runtime/runtime.i @@ -67,3 +67,73 @@ %include <gr_sync_decimator.i> %include <gr_sync_interpolator.i> %include <gr_top_block.i> + + +#ifdef GR_CTRLPORT + +enum DisplayType { + DISPNULL, + DISPTIMESERIESF, + DISPTIMESERIESC, + DISPXYSCATTER, + DISPXYLINE +}; + +enum priv_lvl_t { + RPC_PRIVLVL_ALL = 0, + RPC_PRIVLVL_MIN = 9, + RPC_PRIVLVL_NONE = 10 +}; + +enum KnobType { + KNOBBOOL, KNOBCHAR, KNOBINT, KNOBFLOAT, + KNOBDOUBLE, KNOBSTRING, KNOBLONG, KNOBVECBOOL, + KNOBVECCHAR, KNOBVECINT, KNOBVECFLOAT, KNOBVECDOUBLE, + KNOBVECSTRING, KNOBVECLONG +}; + +%template(StrVector) std::vector<std::string>; + +%{ +#include <rpcserver_booter_base.h> +#include <rpcserver_booter_aggregator.h> +#include <pycallback_object.h> +%} + +%include <rpcserver_booter_base.h> +%include <rpcserver_booter_aggregator.h> +%include <pycallback_object.h> + +// Declare this class here but without the nested templated class +// inside (replaces include of rpcmanager.h) +class GR_CORE_API rpcmanager : public virtual rpcmanager_base +{ + public: + rpcmanager(); + ~rpcmanager(); + + static rpcserver_booter_base* get(); + + static void register_booter(rpcserver_booter_base* booter); +}; + + +// Attach a new python callback method to Python function +%extend pycallback_object { + // Set a Python function object as a callback function + // Note : PyObject *pyfunc is remapped with a typempap + void activate(PyObject *pyfunc) + { + self->set_callback(pyfunc); + Py_INCREF(pyfunc); + } +} + +%template(RPC_get_string) pycallback_object<std::string>; +%template(RPC_get_int) pycallback_object<int>; +%template(RPC_get_float) pycallback_object<float>; +%template(RPC_get_double) pycallback_object<double>; +%template(RPC_get_vector_float) pycallback_object<std::vector<float> >; +%template(RPC_get_vector_gr_complex) pycallback_object<std::vector<gr_complex> >; + +#endif /* GR_CTRLPORT */ diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt index d8a64cc0f6..021a62ab30 100644 --- a/gnuradio-core/src/lib/swig/CMakeLists.txt +++ b/gnuradio-core/src/lib/swig/CMakeLists.txt @@ -29,6 +29,12 @@ set(GR_SWIG_INCLUDE_DIRS ) set(GR_SWIG_LIBRARIES gnuradio-core) +if(ENABLE_GR_CTRLPORT) + list(APPEND GR_SWIG_FLAGS -DGR_CTRLPORT) + list(APPEND GR_SWIG_LIBRARIES ${ICE_LIBRARIES}) + list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) +endif(ENABLE_GR_CTRLPORT) + link_directories(${Boost_LIBRARY_DIRS}) ######################################################################## @@ -41,9 +47,10 @@ link_directories(${Boost_LIBRARY_DIRS}) # X86_64, g++'s resident set size was 650MB! # ---------------------------------------------------------------- -set(GR_SWIG_TARGET_DEPS general_generated gengen_generated filter_generated pmt_swig) +set(GR_SWIG_TARGET_DEPS gnuradio_core_generated_sources + general_generated gengen_generated filter_generated pmt_swig) -foreach(what runtime general gengen filter io hier) +foreach(what runtime general gengen io) SET(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${what}_swig_doc.i) SET(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../${what} ${CMAKE_CURRENT_BINARY_DIR}/../${what}) GR_SWIG_MAKE(gnuradio_core_${what} gnuradio_core_${what}.i) diff --git a/gnuradio-core/src/lib/swig/gnuradio_core.py b/gnuradio-core/src/lib/swig/gnuradio_core.py index 23de740778..1fd558a11b 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core.py +++ b/gnuradio-core/src/lib/swig/gnuradio_core.py @@ -23,6 +23,4 @@ from gnuradio_core_runtime import * from gnuradio_core_general import * from gnuradio_core_gengen import * -from gnuradio_core_filter import * from gnuradio_core_io import * -from gnuradio_core_hier import * diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i deleted file mode 100644 index e9a44e54b9..0000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i +++ /dev/null @@ -1,32 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -%include "filter_swig_doc.i" - -#ifndef SWIGIMPORTED -%module(directors="1") gnuradio_core_filter -#endif - - //%feature("autodoc", "1"); // generate python docstrings - -%include "gnuradio.i" // the common stuff - -%include "filter.i" diff --git a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i index 4016ae7727..6d1af6136d 100644 --- a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i +++ b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i @@ -48,3 +48,11 @@ BASE_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), BASE_NAME = BASE_NAME.make; %} %enddef + +%define GR_SWIG_BLOCK_MAGIC_FACTORY(PKG, BASE_NAME, FACTORY) +%template(FACTORY ## _sptr) boost::shared_ptr<gr:: ## PKG ## :: ## BASE_NAME>; +%pythoncode %{ +FACTORY ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id()) +FACTORY = BASE_NAME ## _make_ ## FACTORY; +%} +%enddef diff --git a/gnuradio-core/src/lib/viterbi/CMakeLists.txt b/gnuradio-core/src/lib/viterbi/CMakeLists.txt deleted file mode 100644 index add5c77e80..0000000000 --- a/gnuradio-core/src/lib/viterbi/CMakeLists.txt +++ /dev/null @@ -1,63 +0,0 @@ -# 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. - -######################################################################## -# This file included, use CMake directory variables -######################################################################## - -set(viterbi_sources - ${CMAKE_CURRENT_SOURCE_DIR}/metrics.c - ${CMAKE_CURRENT_SOURCE_DIR}/tab.c - ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.c -) - -######################################################################## -# define missing erf function with C linkage (hack for metrics.c) -######################################################################## -if(MSVC) -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc " -#include <boost/math/special_functions/erf.hpp> -extern \"C\" double erf(double x){ - return boost::math::erf(x); -} -") -list(APPEND viterbi_sources ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc) -endif(MSVC) - -######################################################################## -# Append gnuradio-core library sources -######################################################################## -list(APPEND gnuradio_core_sources ${viterbi_sources}) - -######################################################################## -# Install runtime headers -######################################################################## -install( - FILES ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "core_devel" -) - -######################################################################## -# Create some text executables (not registered tests) -# Its not much to build so the sources are just re-listed, -# rather than create a new library just for these two apps. -######################################################################## -#ADD_EXECUTABLE(viterbi_encode ${CMAKE_CURRENT_SOURCE_DIR}/encode.cc ${viterbi_sources}) -#ADD_EXECUTABLE(viterbi_decode ${CMAKE_CURRENT_SOURCE_DIR}/decode.cc ${viterbi_sources}) diff --git a/gnuradio-core/src/lib/viterbi/decode.cc b/gnuradio-core/src/lib/viterbi/decode.cc deleted file mode 100644 index 368e697134..0000000000 --- a/gnuradio-core/src/lib/viterbi/decode.cc +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -/* - * This is a minimal example demonstrating how to call the Viterbi decoder - * in continuous streaming mode. It accepts data on stdin and writes to - * stdout. - * - */ - -extern "C" { -#include "viterbi.h" -} - -#include <cstdio> -#include <cmath> - -#define MAXCHUNKSIZE 4096 -#define MAXENCSIZE MAXCHUNKSIZE*16 - -int main() -{ - unsigned char data[MAXCHUNKSIZE]; - signed char syms[MAXENCSIZE]; - int count = 0; - - // Initialize metric table - int mettab[2][256]; - int amp = 100; - float RATE=0.5; - float ebn0 = 12.0; - float esn0 = RATE*pow(10.0, ebn0/10); - gen_met(mettab, amp, esn0, 0.0, 4); - - // Initialize decoder state - struct viterbi_state state0[64]; - struct viterbi_state state1[64]; - unsigned char viterbi_in[16]; - viterbi_chunks_init(state0); - - while (!feof(stdin)) { - unsigned int n = fread(syms, 1, MAXENCSIZE, stdin); - unsigned char *out = data; - - for (unsigned int i = 0; i < n; i++) { - - // FIXME: This implements hard decoding by slicing the input stream - unsigned char sym = syms[i] > 0 ? -amp : amp; - - // Write the symbol to the decoder input - viterbi_in[count % 4] = sym; - - // Every four symbols, perform the butterfly2 operation - if ((count % 4) == 3) { - viterbi_butterfly2(viterbi_in, mettab, state0, state1); - - // Every sixteen symbols, perform the readback operation - if ((count > 64) && (count % 16) == 11) { - viterbi_get_output(state0, out); - fwrite(out++, 1, 1, stdout); - } - } - - count++; - } - } - - return 0; -} diff --git a/gnuradio-core/src/lib/viterbi/encode.cc b/gnuradio-core/src/lib/viterbi/encode.cc deleted file mode 100644 index 83a85fcacb..0000000000 --- a/gnuradio-core/src/lib/viterbi/encode.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -/* - * This is a minimal example demonstrating how to call the ECC encoder - * in continuous streaming mode. It accepts data on stdin and writes to - * stdout. - * - * FIXME: This does not flush the final bits out of the encoder. - * - */ - -extern "C" { -#include "viterbi.h" -} - -#include <cstdio> - -#define MAXCHUNKSIZE 4096 -#define MAXENCSIZE MAXCHUNKSIZE*16 - -int main() -{ - unsigned char encoder_state = 0; - unsigned char data[MAXCHUNKSIZE]; - unsigned char syms[MAXENCSIZE]; - - while (!feof(stdin)) { - unsigned int n = fread(data, 1, MAXCHUNKSIZE, stdin); - encoder_state = encode(syms, data, n, encoder_state); - fwrite(syms, 1, n*16, stdout); - } - - return 0; -} diff --git a/gnuradio-core/src/lib/viterbi/metrics.c b/gnuradio-core/src/lib/viterbi/metrics.c deleted file mode 100644 index 0d91c301ff..0000000000 --- a/gnuradio-core/src/lib/viterbi/metrics.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 1995 Phil Karn, KA9Q - * Copyright 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. - */ - -/* - * Generate metric tables for a soft-decision convolutional decoder - * assuming gaussian noise on a PSK channel. - * - * Works from "first principles" by evaluating the normal probability - * function and then computing the log-likelihood function - * for every possible received symbol value - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -/* Symbols are offset-binary, with 128 corresponding to an erased (no - * information) symbol - */ -#define OFFSET 128 - -#include <stdlib.h> -#include <math.h> - -//declare erf in case it was missing in math.h and provided for by the build system -extern double erf(double x); - -/* Normal function integrated from -Inf to x. Range: 0-1 */ -#define normal(x) (0.5 + 0.5*erf((x)/M_SQRT2)) - -/* Logarithm base 2 */ -#define gr_log2(x) (log(x)*M_LOG2E) - -/* Generate log-likelihood metrics for 8-bit soft quantized channel - * assuming AWGN and BPSK - */ -void -gen_met(int mettab[2][256], /* Metric table, [sent sym][rx symbol] */ - int amp, /* Signal amplitude, units */ - double esn0, /* Es/N0 ratio in dB */ - double bias, /* Metric bias; 0 for viterbi, rate for sequential */ - int scale) /* Scale factor */ -{ - double noise; - int s,bit; - double metrics[2][256]; - double p0,p1; - - /* Es/N0 as power ratio */ - esn0 = pow(10.,esn0/10); - - noise = 0.5/esn0; /* only half the noise for BPSK */ - noise = sqrt(noise); /* noise/signal Voltage ratio */ - - /* Zero is a special value, since this sample includes all - * lower samples that were clipped to this value, i.e., it - * takes the whole lower tail of the curve - */ - p1 = normal(((0-OFFSET+0.5)/amp - 1)/noise); /* P(s|1) */ - - /* Prob of this value occurring for a 0-bit */ /* P(s|0) */ - p0 = normal(((0-OFFSET+0.5)/amp + 1)/noise); - metrics[0][0] = gr_log2(2*p0/(p1+p0)) - bias; - metrics[1][0] = gr_log2(2*p1/(p1+p0)) - bias; - - for(s=1;s<255;s++){ - /* P(s|1), prob of receiving s given 1 transmitted */ - p1 = normal(((s-OFFSET+0.5)/amp - 1)/noise) - - normal(((s-OFFSET-0.5)/amp - 1)/noise); - - /* P(s|0), prob of receiving s given 0 transmitted */ - p0 = normal(((s-OFFSET+0.5)/amp + 1)/noise) - - normal(((s-OFFSET-0.5)/amp + 1)/noise); - -#ifdef notdef - printf("P(%d|1) = %lg, P(%d|0) = %lg\n",s,p1,s,p0); -#endif - metrics[0][s] = gr_log2(2*p0/(p1+p0)) - bias; - metrics[1][s] = gr_log2(2*p1/(p1+p0)) - bias; - } - /* 255 is also a special value */ - /* P(s|1) */ - p1 = 1 - normal(((255-OFFSET-0.5)/amp - 1)/noise); - /* P(s|0) */ - p0 = 1 - normal(((255-OFFSET-0.5)/amp + 1)/noise); - - metrics[0][255] = gr_log2(2*p0/(p1+p0)) - bias; - metrics[1][255] = gr_log2(2*p1/(p1+p0)) - bias; -#ifdef notdef - /* The probability of a raw symbol error is the probability - * that a 1-bit would be received as a sample with value - * 0-128. This is the offset normal curve integrated from -Inf to 0. - */ - printf("symbol Pe = %lg\n",normal(-1/noise)); -#endif - for(bit=0;bit<2;bit++){ - for(s=0;s<256;s++){ - /* Scale and round to nearest integer */ - mettab[bit][s] = floor(metrics[bit][s] * scale + 0.5); -#ifdef notdef - printf("metrics[%d][%d] = %lg, mettab = %d\n", - bit,s,metrics[bit][s],mettab[bit][s]); -#endif - } - } -} diff --git a/gnuradio-core/src/lib/viterbi/tab.c b/gnuradio-core/src/lib/viterbi/tab.c deleted file mode 100644 index 1c135acfee..0000000000 --- a/gnuradio-core/src/lib/viterbi/tab.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 1995 Phil Karn, KA9Q - * Copyright 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. - */ - -/* 8-bit parity lookup table, generated by partab.c */ -unsigned char Partab[] = { - 0, 1, 1, 0, 1, 0, 0, 1, - 1, 0, 0, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 1, 1, 0, - 0, 1, 1, 0, 1, 0, 0, 1, - 1, 0, 0, 1, 0, 1, 1, 0, - 0, 1, 1, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 1, 0, 0, 1, - 1, 0, 0, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 1, 1, 0, - 0, 1, 1, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 1, 0, 0, 1, - 1, 0, 0, 1, 0, 1, 1, 0, - 0, 1, 1, 0, 1, 0, 0, 1, - 1, 0, 0, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 1, 1, 0, - 0, 1, 1, 0, 1, 0, 0, 1, - 1, 0, 0, 1, 0, 1, 1, 0, - 0, 1, 1, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 1, 0, 0, 1, - 1, 0, 0, 1, 0, 1, 1, 0, - 0, 1, 1, 0, 1, 0, 0, 1, - 1, 0, 0, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 1, 1, 0, - 0, 1, 1, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 1, 0, 0, 1, - 1, 0, 0, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 1, 1, 0, - 0, 1, 1, 0, 1, 0, 0, 1, - 1, 0, 0, 1, 0, 1, 1, 0, - 0, 1, 1, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 1, 0, 0, 1, - 1, 0, 0, 1, 0, 1, 1, 0, -}; diff --git a/gnuradio-core/src/lib/viterbi/viterbi.c b/gnuradio-core/src/lib/viterbi/viterbi.c deleted file mode 100644 index fc88866035..0000000000 --- a/gnuradio-core/src/lib/viterbi/viterbi.c +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright 1995 Phil Karn, KA9Q - * Copyright 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. - */ - -/* - * Viterbi decoder for K=7 rate=1/2 convolutional code - * Some modifications from original Karn code by Matt Ettus - */ - -#include "viterbi.h" - -/* The two generator polynomials for the NASA Standard K=7 code. - * Since these polynomials are known to be optimal for this constraint - * length there is not much point in changing them. But if you do, you - * will have to regenerate the BUTTERFLY macro calls in viterbi() - */ -#define POLYA 0x6d -#define POLYB 0x4f - -/* The basic Viterbi decoder operation, called a "butterfly" - * operation because of the way it looks on a trellis diagram. Each - * butterfly involves an Add-Compare-Select (ACS) operation on the two nodes - * where the 0 and 1 paths from the current node merge at the next step of - * the trellis. - * - * The code polynomials are assumed to have 1's on both ends. Given a - * function encode_state() that returns the two symbols for a given - * encoder state in the low two bits, such a code will have the following - * identities for even 'n' < 64: - * - * encode_state(n) = encode_state(n+65) - * encode_state(n+1) = encode_state(n+64) = (3 ^ encode_state(n)) - * - * Any convolutional code you would actually want to use will have - * these properties, so these assumptions aren't too limiting. - * - * Doing this as a macro lets the compiler evaluate at compile time the - * many expressions that depend on the loop index and encoder state and - * emit them as immediate arguments. - * This makes an enormous difference on register-starved machines such - * as the Intel x86 family where evaluating these expressions at runtime - * would spill over into memory. - */ -#define BUTTERFLY(i,sym) { \ - int m0,m1;\ -\ - /* ACS for 0 branch */\ - m0 = state[i].metric + mets[sym]; /* 2*i */\ - m1 = state[i+32].metric + mets[3^sym]; /* 2*i + 64 */\ - if(m0 > m1){\ - next[2*i].metric = m0;\ - next[2*i].path = state[i].path << 1;\ - } else {\ - next[2*i].metric = m1;\ - next[2*i].path = (state[i+32].path << 1)|1;\ - }\ - /* ACS for 1 branch */\ - m0 = state[i].metric + mets[3^sym]; /* 2*i + 1 */\ - m1 = state[i+32].metric + mets[sym]; /* 2*i + 65 */\ - if(m0 > m1){\ - next[2*i+1].metric = m0;\ - next[2*i+1].path = state[i].path << 1;\ - } else {\ - next[2*i+1].metric = m1;\ - next[2*i+1].path = (state[i+32].path << 1)|1;\ - }\ -} - -extern unsigned char Partab[]; /* Parity lookup table */ - -/* Convolutionally encode data into binary symbols */ -unsigned char -encode(unsigned char *symbols, - unsigned char *data, - unsigned int nbytes, - unsigned char encstate) -{ - int i; - - while(nbytes-- != 0){ - for(i=7;i>=0;i--){ - encstate = (encstate << 1) | ((*data >> i) & 1); - *symbols++ = Partab[encstate & POLYA]; - *symbols++ = Partab[encstate & POLYB]; - } - data++; - } - - return encstate; -} - -/* Viterbi decoder */ -int -viterbi(unsigned long *metric, /* Final path metric (returned value) */ - unsigned char *data, /* Decoded output data */ - unsigned char *symbols, /* Raw deinterleaved input symbols */ - unsigned int nbits, /* Number of output bits */ - int mettab[2][256] /* Metric table, [sent sym][rx symbol] */ - ){ - unsigned int bitcnt = 0; - int mets[4]; - long bestmetric; - int beststate,i; - struct viterbi_state state0[64],state1[64],*state,*next; - - state = state0; - next = state1; - - /* Initialize starting metrics to prefer 0 state */ - state[0].metric = 0; - for(i=1;i<64;i++) - state[i].metric = -999999; - state[0].path = 0; - - for(bitcnt = 0;bitcnt < nbits;bitcnt++){ - /* Read input symbol pair and compute all possible branch - * metrics - */ - mets[0] = mettab[0][symbols[0]] + mettab[0][symbols[1]]; - mets[1] = mettab[0][symbols[0]] + mettab[1][symbols[1]]; - mets[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]]; - mets[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]]; - symbols += 2; - - /* These macro calls were generated by genbut.c */ - BUTTERFLY(0,0); - BUTTERFLY(1,1); - BUTTERFLY(2,3); - BUTTERFLY(3,2); - BUTTERFLY(4,3); - BUTTERFLY(5,2); - BUTTERFLY(6,0); - BUTTERFLY(7,1); - BUTTERFLY(8,0); - BUTTERFLY(9,1); - BUTTERFLY(10,3); - BUTTERFLY(11,2); - BUTTERFLY(12,3); - BUTTERFLY(13,2); - BUTTERFLY(14,0); - BUTTERFLY(15,1); - BUTTERFLY(16,2); - BUTTERFLY(17,3); - BUTTERFLY(18,1); - BUTTERFLY(19,0); - BUTTERFLY(20,1); - BUTTERFLY(21,0); - BUTTERFLY(22,2); - BUTTERFLY(23,3); - BUTTERFLY(24,2); - BUTTERFLY(25,3); - BUTTERFLY(26,1); - BUTTERFLY(27,0); - BUTTERFLY(28,1); - BUTTERFLY(29,0); - BUTTERFLY(30,2); - BUTTERFLY(31,3); - - /* Swap current and next states */ - if(bitcnt & 1){ - state = state0; - next = state1; - } else { - state = state1; - next = state0; - } - // ETTUS - //if(bitcnt > nbits-7){ - /* In tail, poison non-zero nodes */ - //for(i=1;i<64;i += 2) - // state[i].metric = -9999999; - //} - /* Produce output every 8 bits once path memory is full */ - if((bitcnt % 8) == 5 && bitcnt > 32){ - /* Find current best path */ - bestmetric = state[0].metric; - beststate = 0; - for(i=1;i<64;i++){ - if(state[i].metric > bestmetric){ - bestmetric = state[i].metric; - beststate = i; - } - } -#ifdef notdef - printf("metrics[%d] = %d state = %lx\n",beststate, - state[beststate].metric,state[beststate].path); -#endif - *data++ = state[beststate].path >> 24; - } - - } - /* Output remaining bits from 0 state */ - // ETTUS Find best state instead - bestmetric = state[0].metric; - beststate = 0; - for(i=1;i<64;i++){ - if(state[i].metric > bestmetric){ - bestmetric = state[i].metric; - beststate = i; - } - } - if((i = bitcnt % 8) != 6) - state[beststate].path <<= 6-i; - - *data++ = state[beststate].path >> 24; - *data++ = state[beststate].path >> 16; - *data++ = state[beststate].path >> 8; - *data = state[beststate].path; - //printf ("BS = %d\tBSM = %d\tM0 = %d\n",beststate,state[beststate].metric,state[0].metric); - *metric = state[beststate].metric; - return 0; -} - - -void -viterbi_chunks_init(struct viterbi_state* state) { - // Initialize starting metrics to prefer 0 state - int i; - state[0].metric = 0; - state[0].path = 0; - for(i=1;i<64;i++) - state[i].metric = -999999; -} - -void -viterbi_butterfly8(unsigned char *symbols, int mettab[2][256], struct viterbi_state *state0, struct viterbi_state *state1) -{ - unsigned int bitcnt; - int mets[4]; - - struct viterbi_state *state, *next; - state = state0; - next = state1; - // Operate on 16 symbols (8 bits) at a time - for(bitcnt = 0;bitcnt < 8;bitcnt++){ - // Read input symbol pair and compute all possible branch metrics - mets[0] = mettab[0][symbols[0]] + mettab[0][symbols[1]]; - mets[1] = mettab[0][symbols[0]] + mettab[1][symbols[1]]; - mets[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]]; - mets[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]]; - symbols += 2; - - // These macro calls were generated by genbut.c - BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2); - BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1); - BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2); - BUTTERFLY(12,3);BUTTERFLY(13,2);BUTTERFLY(14,0);BUTTERFLY(15,1); - BUTTERFLY(16,2);BUTTERFLY(17,3);BUTTERFLY(18,1);BUTTERFLY(19,0); - BUTTERFLY(20,1);BUTTERFLY(21,0);BUTTERFLY(22,2);BUTTERFLY(23,3); - BUTTERFLY(24,2);BUTTERFLY(25,3);BUTTERFLY(26,1);BUTTERFLY(27,0); - BUTTERFLY(28,1);BUTTERFLY(29,0);BUTTERFLY(30,2);BUTTERFLY(31,3); - - // Swap current and next states - if(bitcnt & 1){ - state = state0; - next = state1; - } else { - state = state1; - next = state0; - } - } -} - -void -viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], struct viterbi_state *state0, struct viterbi_state *state1) -{ - //unsigned int bitcnt; - int mets[4]; - - struct viterbi_state *state, *next; - state = state0; - next = state1; - // Operate on 4 symbols (2 bits) at a time - - // Read input symbol pair and compute all possible branch metrics - mets[0] = mettab[0][symbols[0]] + mettab[0][symbols[1]]; - mets[1] = mettab[0][symbols[0]] + mettab[1][symbols[1]]; - mets[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]]; - mets[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]]; - - // These macro calls were generated by genbut.c - BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2); - BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1); - BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2); - BUTTERFLY(12,3);BUTTERFLY(13,2);BUTTERFLY(14,0);BUTTERFLY(15,1); - BUTTERFLY(16,2);BUTTERFLY(17,3);BUTTERFLY(18,1);BUTTERFLY(19,0); - BUTTERFLY(20,1);BUTTERFLY(21,0);BUTTERFLY(22,2);BUTTERFLY(23,3); - BUTTERFLY(24,2);BUTTERFLY(25,3);BUTTERFLY(26,1);BUTTERFLY(27,0); - BUTTERFLY(28,1);BUTTERFLY(29,0);BUTTERFLY(30,2);BUTTERFLY(31,3); - - state = state1; - next = state0; - - // Read input symbol pair and compute all possible branch metrics - mets[0] = mettab[0][symbols[2]] + mettab[0][symbols[3]]; - mets[1] = mettab[0][symbols[2]] + mettab[1][symbols[3]]; - mets[2] = mettab[1][symbols[2]] + mettab[0][symbols[3]]; - mets[3] = mettab[1][symbols[2]] + mettab[1][symbols[3]]; - - // These macro calls were generated by genbut.c - BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2); - BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1); - BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2); - BUTTERFLY(12,3);BUTTERFLY(13,2);BUTTERFLY(14,0);BUTTERFLY(15,1); - BUTTERFLY(16,2);BUTTERFLY(17,3);BUTTERFLY(18,1);BUTTERFLY(19,0); - BUTTERFLY(20,1);BUTTERFLY(21,0);BUTTERFLY(22,2);BUTTERFLY(23,3); - BUTTERFLY(24,2);BUTTERFLY(25,3);BUTTERFLY(26,1);BUTTERFLY(27,0); - BUTTERFLY(28,1);BUTTERFLY(29,0);BUTTERFLY(30,2);BUTTERFLY(31,3); -} - -unsigned char -viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf) { - // Produce output every 8 bits once path memory is full - // if((bitcnt % 8) == 5 && bitcnt > 32) { - - // Find current best path - unsigned int i,beststate; - int bestmetric; - - bestmetric = state[0].metric; - beststate = 0; - for(i=1;i<64;i++) - if(state[i].metric > bestmetric) { - bestmetric = state[i].metric; - beststate = i; - } - *outbuf = state[beststate].path >> 24; - return bestmetric; -} - - -//printf ("BS = %d\tBSM = %d\tM0 = %d\n",beststate,state[beststate].metric,state[0].metric); -// In tail, poison non-zero nodes -//if(bits_out > packet_size-7) -// for(i=1;i<64;i += 2) -// state[i].metric = -9999999; - diff --git a/gnuradio-core/src/lib/viterbi/viterbi.h b/gnuradio-core/src/lib/viterbi/viterbi.h deleted file mode 100644 index bcdbe116d6..0000000000 --- a/gnuradio-core/src/lib/viterbi/viterbi.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 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. - */ - -/* The path memory for each state is 32 bits. This is slightly shorter - * than we'd like for K=7, especially since we chain back every 8 bits. - * But it fits so nicely into a 32-bit machine word... - */ - -#include <gr_core_api.h> - -struct viterbi_state { - unsigned long path; /* Decoded path to this state */ - long metric; /* Cumulative metric to this state */ -}; - -GR_CORE_API -int gen_met(int mettab[2][256], /* Metric table */ - int amp, /* Signal amplitude */ - double esn0, /* Es/N0 ratio in dB */ - double bias, /* Metric bias */ - int scale); /* Scale factor */ - -GR_CORE_API unsigned char -encode(unsigned char *symbols, unsigned char *data, - unsigned int nbytes,unsigned char encstate); - -GR_CORE_API void -viterbi_chunks_init(struct viterbi_state* state); - - GR_CORE_API void -viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], - struct viterbi_state *state0, struct viterbi_state *state1); - -GR_CORE_API unsigned char -viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf); diff --git a/gnuradio-core/src/python/gnuradio/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/CMakeLists.txt index bf696e0d34..9b75f20f33 100644 --- a/gnuradio-core/src/python/gnuradio/CMakeLists.txt +++ b/gnuradio-core/src/python/gnuradio/CMakeLists.txt @@ -22,8 +22,10 @@ include(GrPython) add_subdirectory(gr) add_subdirectory(gru) add_subdirectory(gruimpl) -add_subdirectory(blks2) -add_subdirectory(blks2impl) + +if(ENABLE_GR_CTRLPORT) +add_subdirectory(ctrlport) +endif(ENABLE_GR_CTRLPORT) GR_PYTHON_INSTALL(FILES __init__.py @@ -31,8 +33,6 @@ GR_PYTHON_INSTALL(FILES eng_option.py gr_unittest.py gr_xmlrunner.py - optfir.py - window.py DESTINATION ${GR_PYTHON_DIR}/gnuradio COMPONENT "core_python" ) diff --git a/gnuradio-core/src/python/gnuradio/__init__.py b/gnuradio-core/src/python/gnuradio/__init__.py index a4917cf64c..d55dac79db 100644 --- a/gnuradio-core/src/python/gnuradio/__init__.py +++ b/gnuradio-core/src/python/gnuradio/__init__.py @@ -1 +1,12 @@ -# make this a package +""" +GNU Radio is a free & open-source software development toolkit that provides signal processing blocks to implement software radios. It can be used with readily-available low-cost external RF hardware to create software-defined radios, or without hardware in a simulation-like environment. It is widely used in hobbyist, academic and commercial environments to support both wireless communications research and real-world radio systems. + +GNU Radio applications are primarily written using the Python programming language, while the supplied performance-critical signal-processing path is implemented in C++ using processor floating-point extensions, where available. Thus, the developer is able to implement real-time, high-throughput radio systems in a simple-to-use, rapid-application-development environment. + +While not primarily a simulation tool, GNU Radio does support development of signal processing algorithms using pre-recorded or generated data, avoiding the need for actual RF hardware. + +GNU Radio is licensed under the GNU General Public License (GPL) version 3. All of the code is copyright of the Free Software Foundation. +""" + +# This file makes gnuradio a package +# The docstring will be associated with the top level of the package. diff --git a/gnuradio-core/src/python/gnuradio/blks2/__init__.py b/gnuradio-core/src/python/gnuradio/blks2/__init__.py deleted file mode 100644 index 2dfdc77f46..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2/__init__.py +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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. -# - -import glob -import os.path - -# Semi-hideous kludge to import everything in the blksimpl2 directory -# into the gnuradio.blks2 namespace. This keeps us from having to remember -# to manually update this file. - -for p in __path__: - filenames = glob.glob (os.path.join (p, "..", "blks2impl", "*.py")) - for f in filenames: - f = os.path.basename(f).lower() - f = f[:-3] - if f == '__init__': - continue - # print f - exec "from gnuradio.blks2impl.%s import *" % (f,) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt deleted file mode 100644 index 61fcdda42d..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -# 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. - -include(GrPython) - -GR_PYTHON_INSTALL(FILES - __init__.py - am_demod.py - channel_model.py - filterbank.py - fm_demod.py - fm_emph.py - logpwrfft.py - nbfm_rx.py - nbfm_tx.py - pfb_arb_resampler.py - pfb_channelizer.py - pfb_decimator.py - pfb_interpolator.py - rational_resampler.py - standard_squelch.py - stream_to_vector_decimator.py - wfm_rcv.py - wfm_rcv_fmdet.py - wfm_rcv_pll.py - wfm_tx.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/blks2impl - COMPONENT "core_python" -) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/__init__.py b/gnuradio-core/src/python/gnuradio/blks2impl/__init__.py deleted file mode 100644 index a4917cf64c..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# make this a package diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py b/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py deleted file mode 100644 index 68d024565a..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py +++ /dev/null @@ -1,75 +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, optfir - -class am_demod_cf(gr.hier_block2): - """ - Generalized AM demodulation block with audio filtering. - - This block demodulates a band-limited, complex down-converted AM - channel into the the original baseband signal, applying low pass - filtering to the audio output. It produces a float stream in the - range [-1.0, +1.0]. - - @param channel_rate: incoming sample rate of the AM baseband - @type sample_rate: integer - @param audio_decim: input to output decimation rate - @type audio_decim: integer - @param audio_pass: audio low pass filter passband frequency - @type audio_pass: float - @param audio_stop: audio low pass filter stop frequency - @type audio_stop: float - """ - def __init__(self, channel_rate, audio_decim, audio_pass, audio_stop): - gr.hier_block2.__init__(self, "am_demod_cf", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Input signature - - MAG = gr.complex_to_mag() - DCR = gr.add_const_ff(-1.0) - - audio_taps = optfir.low_pass(0.5, # Filter gain - channel_rate, # Sample rate - audio_pass, # Audio passband - audio_stop, # Audio stopband - 0.1, # Passband ripple - 60) # Stopband attenuation - LPF = gr.fir_filter_fff(audio_decim, audio_taps) - - self.connect(self, MAG, DCR, LPF, self) - -class demod_10k0a3e_cf(am_demod_cf): - """ - AM demodulation block, 10 KHz channel. - - This block demodulates an AM channel conformant to 10K0A3E emission - standards, such as broadcast band AM transmissions. - - @param channel_rate: incoming sample rate of the AM baseband - @type sample_rate: integer - @param audio_decim: input to output decimation rate - @type audio_decim: integer - """ - def __init__(self, channel_rate, audio_decim): - am_demod_cf.__init__(self, channel_rate, audio_decim, - 5000, # Audio passband - 5500) # Audio stopband diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/channel_model.py b/gnuradio-core/src/python/gnuradio/blks2impl/channel_model.py deleted file mode 100644 index e5cd471df5..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/channel_model.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr - -# This block is now a C++ hierarchical block, gr.channel_model -channel_model = gr.channel_model diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/digital_voice.py.real b/gnuradio-core/src/python/gnuradio/blks2impl/digital_voice.py.real deleted file mode 100644 index 6ec66825c1..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/digital_voice.py.real +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -""" -Digital voice Tx and Rx using GSM 13kbit vocoder and GMSK. - -Runs channel at 32kbit/sec. Currently uses fake channel coding, -but there's room for a rate 1/2 coder. -""" - -from gnuradio import gr, gru -from gnuradio.blksimpl.gmsk import gmsk_mod, gmsk_demod - -from gnuradio.vocoder import gsm_full_rate - -# Size of gsm full rate speech encoder output packet in bytes - -GSM_FRAME_SIZE = 33 - -# Size of packet in bytes that we send to GMSK modulator: -# -# Target: 256kS/sec air rate. -# -# 256kS 1 sym 1 bit 1 byte 0.020 sec 80 bytes -# ---- * ----- * ----- * ------ * --------- = -------- -# sec 8 S 1 sym 8 bits frame frame -# -# gr_simple_framer add 10 bytes of overhead. - -AIR_FRAME_SIZE = 70 - - -class digital_voice_tx(gr.hier_block): - """ - Hierarchical block for digital voice tranmission. - - The input is 8kS/sec floating point audio in the range [-1,+1] - The output is 256kS/sec GMSK modulated complex baseband signal in the range [-1,+1]. - """ - def __init__(self, fg): - samples_per_symbol = 8 - symbol_rate = 32000 - bt = 0.3 # Gaussian filter bandwidth * symbol time - - src_scale = gr.multiply_const_ff(32767) - f2s = gr.float_to_short() - voice_coder = gsm_full_rate.encode_sp() - - channel_coder = gr.fake_channel_encoder_pp(GSM_FRAME_SIZE, AIR_FRAME_SIZE) - p2s = gr.parallel_to_serial(gr.sizeof_char, AIR_FRAME_SIZE) - - mod = gmsk_mod(fg, sps=samples_per_symbol, - symbol_rate=symbol_rate, bt=bt, - p_size=AIR_FRAME_SIZE) - - fg.connect(src_scale, f2s, voice_coder, channel_coder, p2s, mod) - gr.hier_block.__init__(self, fg, src_scale, mod) - - -class digital_voice_rx(gr.hier_block): - """ - Hierarchical block for digital voice reception. - - The input is 256kS/sec GMSK modulated complex baseband signal. - The output is 8kS/sec floating point audio in the range [-1,+1] - """ - def __init__(self, fg): - samples_per_symbol = 8 - symbol_rate = 32000 - - demod = gmsk_demod(fg, sps=samples_per_symbol, - symbol_rate=symbol_rate, - p_size=AIR_FRAME_SIZE) - - s2p = gr.serial_to_parallel(gr.sizeof_char, AIR_FRAME_SIZE) - channel_decoder = gr.fake_channel_decoder_pp(AIR_FRAME_SIZE, GSM_FRAME_SIZE) - - voice_decoder = gsm_full_rate.decode_ps() - s2f = gr.short_to_float () - sink_scale = gr.multiply_const_ff(1.0/32767.) - - fg.connect(demod, s2p, channel_decoder, voice_decoder, s2f, sink_scale) - gr.hier_block.__init__(self, fg, demod, sink_scale) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py b/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py deleted file mode 100644 index 08f1d450ba..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py +++ /dev/null @@ -1,169 +0,0 @@ -# -# Copyright 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. -# - -import sys -from gnuradio import gr, gru - -def _generate_synthesis_taps(mpoints): - return [] # FIXME - - -def _split_taps(taps, mpoints): - assert (len(taps) % mpoints) == 0 - result = [list() for x in range(mpoints)] - for i in xrange(len(taps)): - (result[i % mpoints]).append(taps[i]) - return [tuple(x) for x in result] - - -class synthesis_filterbank(gr.hier_block2): - """ - Uniformly modulated polyphase DFT filter bank: synthesis - - See http://cnx.org/content/m10424/latest - """ - def __init__(self, mpoints, taps=None): - """ - Takes M complex streams in, produces single complex stream out - that runs at M times the input sample rate - - @param mpoints: number of freq bins/interpolation factor/subbands - @param taps: filter taps for subband filter - - The channel spacing is equal to the input sample rate. - The total bandwidth and output sample rate are equal the input - sample rate * nchannels. - - Output stream to frequency mapping: - - channel zero is at zero frequency. - - if mpoints is odd: - - Channels with increasing positive frequencies come from - channels 1 through (N-1)/2. - - Channel (N+1)/2 is the maximum negative frequency, and - frequency increases through N-1 which is one channel lower - than the zero frequency. - - if mpoints is even: - - Channels with increasing positive frequencies come from - channels 1 through (N/2)-1. - - Channel (N/2) is evenly split between the max positive and - negative bins. - - Channel (N/2)+1 is the maximum negative frequency, and - frequency increases through N-1 which is one channel lower - than the zero frequency. - - Channels near the frequency extremes end up getting cut - off by subsequent filters and therefore have diminished - utility. - """ - item_size = gr.sizeof_gr_complex - gr.hier_block2.__init__(self, "synthesis_filterbank", - gr.io_signature(mpoints, mpoints, item_size), # Input signature - gr.io_signature(1, 1, item_size)) # Output signature - - - if taps is None: - taps = _generate_synthesis_taps(mpoints) - - # pad taps to multiple of mpoints - r = len(taps) % mpoints - if r != 0: - taps = taps + (mpoints - r) * (0,) - - # split in mpoints separate set of taps - sub_taps = _split_taps(taps, mpoints) - - self.ss2v = gr.streams_to_vector(item_size, mpoints) - self.ifft = gr.fft_vcc(mpoints, False, []) - self.v2ss = gr.vector_to_streams(item_size, mpoints) - # mpoints filters go in here... - self.ss2s = gr.streams_to_stream(item_size, mpoints) - - for i in range(mpoints): - self.connect((self, i), (self.ss2v, i)) - - self.connect(self.ss2v, self.ifft, self.v2ss) - - # build mpoints fir filters... - for i in range(mpoints): - f = gr.fft_filter_ccc(1, sub_taps[i]) - self.connect((self.v2ss, i), f) - self.connect(f, (self.ss2s, i)) - - self.connect(self.ss2s, self) - -class analysis_filterbank(gr.hier_block2): - """ - Uniformly modulated polyphase DFT filter bank: analysis - - See http://cnx.org/content/m10424/latest - """ - def __init__(self, mpoints, taps=None): - """ - Takes 1 complex stream in, produces M complex streams out - that runs at 1/M times the input sample rate - - @param mpoints: number of freq bins/interpolation factor/subbands - @param taps: filter taps for subband filter - - Same channel to frequency mapping as described above. - """ - item_size = gr.sizeof_gr_complex - gr.hier_block2.__init__(self, "analysis_filterbank", - gr.io_signature(1, 1, item_size), # Input signature - gr.io_signature(mpoints, mpoints, item_size)) # Output signature - - if taps is None: - taps = _generate_synthesis_taps(mpoints) - - # pad taps to multiple of mpoints - r = len(taps) % mpoints - if r != 0: - taps = taps + (mpoints - r) * (0,) - - # split in mpoints separate set of taps - sub_taps = _split_taps(taps, mpoints) - - # print >> sys.stderr, "mpoints =", mpoints, "len(sub_taps) =", len(sub_taps) - - self.s2ss = gr.stream_to_streams(item_size, mpoints) - # filters here - self.ss2v = gr.streams_to_vector(item_size, mpoints) - self.fft = gr.fft_vcc(mpoints, True, []) - self.v2ss = gr.vector_to_streams(item_size, mpoints) - - self.connect(self, self.s2ss) - - # build mpoints fir filters... - for i in range(mpoints): - f = gr.fft_filter_ccc(1, sub_taps[mpoints-i-1]) - self.connect((self.s2ss, i), f) - self.connect(f, (self.ss2v, i)) - self.connect((self.v2ss, i), (self, i)) - - self.connect(self.ss2v, self.fft, self.v2ss) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py b/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py deleted file mode 100644 index 6bc0d7ed0d..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py +++ /dev/null @@ -1,111 +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, optfir -from gnuradio.blks2impl.fm_emph import fm_deemph -from math import pi - -class fm_demod_cf(gr.hier_block2): - """ - Generalized FM demodulation block with deemphasis and audio - filtering. - - This block demodulates a band-limited, complex down-converted FM - channel into the the original baseband signal, optionally applying - deemphasis. Low pass filtering is done on the resultant signal. It - produces an output float strem in the range of [-1.0, +1.0]. - - @param channel_rate: incoming sample rate of the FM baseband - @type sample_rate: integer - @param deviation: maximum FM deviation (default = 5000) - @type deviation: float - @param audio_decim: input to output decimation rate - @type audio_decim: integer - @param audio_pass: audio low pass filter passband frequency - @type audio_pass: float - @param audio_stop: audio low pass filter stop frequency - @type audio_stop: float - @param gain: gain applied to audio output (default = 1.0) - @type gain: float - @param tau: deemphasis time constant (default = 75e-6), specify 'None' - to prevent deemphasis - """ - def __init__(self, channel_rate, audio_decim, deviation, - audio_pass, audio_stop, gain=1.0, tau=75e-6): - gr.hier_block2.__init__(self, "fm_demod_cf", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - k = channel_rate/(2*pi*deviation) - QUAD = gr.quadrature_demod_cf(k) - - audio_taps = optfir.low_pass(gain, # Filter gain - channel_rate, # Sample rate - audio_pass, # Audio passband - audio_stop, # Audio stopband - 0.1, # Passband ripple - 60) # Stopband attenuation - LPF = gr.fir_filter_fff(audio_decim, audio_taps) - - if tau is not None: - DEEMPH = fm_deemph(channel_rate, tau) - self.connect(self, QUAD, DEEMPH, LPF, self) - else: - self.connect(self, QUAD, LPF, self) - -class demod_20k0f3e_cf(fm_demod_cf): - """ - NBFM demodulation block, 20 KHz channels - - This block demodulates a complex, downconverted, narrowband FM - channel conforming to 20K0F3E emission standards, outputting - floats in the range [-1.0, +1.0]. - - @param sample_rate: incoming sample rate of the FM baseband - @type sample_rate: integer - @param audio_decim: input to output decimation rate - @type audio_decim: integer - """ - def __init__(self, channel_rate, audio_decim): - fm_demod_cf.__init__(self, channel_rate, audio_decim, - 5000, # Deviation - 3000, # Audio passband frequency - 4500) # Audio stopband frequency - -class demod_200kf3e_cf(fm_demod_cf): - """ - WFM demodulation block, mono. - - This block demodulates a complex, downconverted, wideband FM - channel conforming to 200KF3E emission standards, outputting - floats in the range [-1.0, +1.0]. - - @param sample_rate: incoming sample rate of the FM baseband - @type sample_rate: integer - @param audio_decim: input to output decimation rate - @type audio_decim: integer - """ - def __init__(self, channel_rate, audio_decim): - fm_demod_cf.__init__(self, channel_rate, audio_decim, - 75000, # Deviation - 15000, # Audio passband - 16000, # Audio stopband - 20.0) # Audio gain diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py b/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py deleted file mode 100644 index fc3f2d60d2..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py +++ /dev/null @@ -1,151 +0,0 @@ -# -# Copyright 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 -import math - - -# -# 1 -# H(s) = ------- -# 1 + s -# -# tau is the RC time constant. -# critical frequency: w_p = 1/tau -# -# We prewarp and use the bilinear z-transform to get our IIR coefficients. -# See "Digital Signal Processing: A Practical Approach" by Ifeachor and Jervis -# - -class fm_deemph(gr.hier_block2): - """ - FM Deemphasis IIR filter. - """ - - - def __init__(self, fs, tau=75e-6): - """ - @param fs: sampling frequency in Hz - @type fs: float - @param tau: Time constant in seconds (75us in US, 50us in EUR) - @type tau: float - """ - gr.hier_block2.__init__(self, "fm_deemph", - gr.io_signature(1, 1, gr.sizeof_float), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - w_p = 1/tau - w_pp = math.tan (w_p / (fs * 2)) # prewarped analog freq - - a1 = (w_pp - 1)/(w_pp + 1) - b0 = w_pp/(1 + w_pp) - b1 = b0 - - btaps = [b0, b1] - ataps = [1, a1] - - if 0: - print "btaps =", btaps - print "ataps =", ataps - global plot1 - plot1 = gru.gnuplot_freqz (gru.freqz (btaps, ataps), fs, True) - - deemph = gr.iir_filter_ffd(btaps, ataps) - self.connect(self, deemph, self) - -# -# 1 + s*t1 -# H(s) = ---------- -# 1 + s*t2 -# -# I think this is the right transfer function. -# -# -# This fine ASCII rendition is based on Figure 5-15 -# in "Digital and Analog Communication Systems", Leon W. Couch II -# -# -# R1 -# +-----||------+ -# | | -# o------+ +-----+--------o -# | C1 | | -# +----/\/\/\/--+ \ -# / -# \ R2 -# / -# \ -# | -# o--------------------------+--------o -# -# f1 = 1/(2*pi*t1) = 1/(2*pi*R1*C) -# -# 1 R1 + R2 -# f2 = ------- = ------------ -# 2*pi*t2 2*pi*R1*R2*C -# -# t1 is 75us in US, 50us in EUR -# f2 should be higher than our audio bandwidth. -# -# -# The Bode plot looks like this: -# -# -# /---------------- -# / -# / <-- slope = 20dB/decade -# / -# -------------/ -# f1 f2 -# -# We prewarp and use the bilinear z-transform to get our IIR coefficients. -# See "Digital Signal Processing: A Practical Approach" by Ifeachor and Jervis -# - -class fm_preemph(gr.hier_block2): - """ - FM Preemphasis IIR filter. - """ - def __init__(self, fs, tau=75e-6): - """ - @param fs: sampling frequency in Hz - @type fs: float - @param tau: Time constant in seconds (75us in US, 50us in EUR) - @type tau: float - """ - - gr.hier_block2.__init__(self, "fm_deemph", - gr.io_signature(1, 1, gr.sizeof_float), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - # FIXME make this compute the right answer - - btaps = [1] - ataps = [1] - - if 0: - print "btaps =", btaps - print "ataps =", ataps - global plot2 - plot2 = gru.gnuplot_freqz (gru.freqz (btaps, ataps), fs, True) - - preemph = gr.iir_filter_ffd(btaps, ataps) - self.connect(self, preemph, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py deleted file mode 100644 index 6f7fc520fa..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py +++ /dev/null @@ -1,155 +0,0 @@ -# -# Copyright 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, window -from stream_to_vector_decimator import stream_to_vector_decimator -import math - -class _logpwrfft_base(gr.hier_block2): - """ - Create a log10(abs(fft)) stream chain, with real or complex input. - """ - - def __init__(self, sample_rate, fft_size, ref_scale, frame_rate, avg_alpha, average, win=None): - """ - Create an log10(abs(fft)) stream chain. - Provide access to the setting the filter and sample rate. - @param sample_rate Incoming stream sample rate - @param fft_size Number of FFT bins - @param ref_scale Sets 0 dB value input amplitude - @param frame_rate Output frame rate - @param avg_alpha FFT averaging (over time) constant [0.0-1.0] - @param average Whether to average [True, False] - @param win the window taps generation function - """ - gr.hier_block2.__init__(self, self._name, - gr.io_signature(1, 1, self._item_size), # Input signature - gr.io_signature(1, 1, gr.sizeof_float*fft_size)) # Output signature - - self._sd = stream_to_vector_decimator(item_size=self._item_size, - sample_rate=sample_rate, - vec_rate=frame_rate, - vec_len=fft_size) - - if win is None: win = window.blackmanharris - fft_window = win(fft_size) - fft = self._fft_block[0](fft_size, True, fft_window) - window_power = sum(map(lambda x: x*x, fft_window)) - - c2magsq = gr.complex_to_mag_squared(fft_size) - self._avg = gr.single_pole_iir_filter_ff(1.0, fft_size) - self._log = gr.nlog10_ff(10, fft_size, - -20*math.log10(fft_size) # Adjust for number of bins - -10*math.log10(window_power/fft_size) # Adjust for windowing loss - -20*math.log10(ref_scale/2)) # Adjust for reference scale - self.connect(self, self._sd, fft, c2magsq, self._avg, self._log, self) - - self._average = average - self._avg_alpha = avg_alpha - self.set_avg_alpha(avg_alpha) - self.set_average(average) - - def set_decimation(self, decim): - """ - Set the decimation on stream decimator. - @param decim the new decimation - """ - self._sd.set_decimation(decim) - - def set_vec_rate(self, vec_rate): - """ - Set the vector rate on stream decimator. - @param vec_rate the new vector rate - """ - self._sd.set_vec_rate(vec_rate) - - def set_sample_rate(self, sample_rate): - """ - Set the new sampling rate - @param sample_rate the new rate - """ - self._sd.set_sample_rate(sample_rate) - - def set_average(self, average): - """ - Set the averaging filter on/off. - @param average true to set averaging on - """ - self._average = average - if self._average: - self._avg.set_taps(self._avg_alpha) - else: - self._avg.set_taps(1.0) - - def set_avg_alpha(self, avg_alpha): - """ - Set the average alpha and set the taps if average was on. - @param avg_alpha the new iir filter tap - """ - self._avg_alpha = avg_alpha - self.set_average(self._average) - - def sample_rate(self): - """ - Return the current sample rate. - """ - return self._sd.sample_rate() - - def decimation(self): - """ - Return the current decimation. - """ - return self._sd.decimation() - - def frame_rate(self): - """ - Return the current frame rate. - """ - return self._sd.frame_rate() - - def average(self): - """ - Return whether or not averaging is being performed. - """ - return self._average - - def avg_alpha(self): - """ - Return averaging filter constant. - """ - return self._avg_alpha - -class logpwrfft_f(_logpwrfft_base): - """ - Create an fft block chain, with real input. - """ - _name = "logpwrfft_f" - _item_size = gr.sizeof_float - _fft_block = (gr.fft_vfc, ) - -class logpwrfft_c(_logpwrfft_base): - """ - Create an fft block chain, with complex input. - """ - _name = "logpwrfft_c" - _item_size = gr.sizeof_gr_complex - _fft_block = (gr.fft_vcc, ) - diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py b/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py deleted file mode 100644 index 8bcb47ae19..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py +++ /dev/null @@ -1,88 +0,0 @@ -# -# 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. -# - -import math -from gnuradio import gr, optfir -from gnuradio.blks2impl.fm_emph import fm_deemph -#from gnuradio.blks2impl.standard_squelch import standard_squelch - -class nbfm_rx(gr.hier_block2): - def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3): - """ - Narrow Band FM Receiver. - - Takes a single complex baseband input stream and produces a single - float output stream of audio sample in the range [-1, +1]. - - @param audio_rate: sample rate of audio stream, >= 16k - @type audio_rate: integer - @param quad_rate: sample rate of output stream - @type quad_rate: integer - @param tau: preemphasis time constant (default 75e-6) - @type tau: float - @param max_dev: maximum deviation in Hz (default 5e3) - @type max_dev: float - - quad_rate must be an integer multiple of audio_rate. - - Exported sub-blocks (attributes): - squelch - quad_demod - deemph - audio_filter - """ - - gr.hier_block2.__init__(self, "nbfm_rx", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - # FIXME audio_rate and quad_rate ought to be exact rationals - audio_rate = int(audio_rate) - quad_rate = int(quad_rate) - - if quad_rate % audio_rate != 0: - raise ValueError, "quad_rate is not an integer multiple of audio_rate" - - squelch_threshold = 20 # dB - #self.squelch = gr.simple_squelch_cc(squelch_threshold, 0.001) - - # FM Demodulator input: complex; output: float - k = quad_rate/(2*math.pi*max_dev) - self.quad_demod = gr.quadrature_demod_cf(k) - - # FM Deemphasis IIR filter - self.deemph = fm_deemph (quad_rate, tau=tau) - - # compute FIR taps for audio filter - audio_decim = quad_rate // audio_rate - audio_taps = gr.firdes.low_pass (1.0, # gain - quad_rate, # sampling rate - 2.7e3, # Audio LPF cutoff - 0.5e3, # Transition band - gr.firdes.WIN_HAMMING) # filter type - - print "len(audio_taps) =", len(audio_taps) - - # Decimating audio filter - # input: float; output: float; taps: float - self.audio_filter = gr.fir_filter_fff(audio_decim, audio_taps) - - self.connect(self, self.quad_demod, self.deemph, self.audio_filter, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py b/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py deleted file mode 100644 index 839cf6784a..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py +++ /dev/null @@ -1,92 +0,0 @@ -# -# 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. -# - -import math -from gnuradio import gr, optfir -from gnuradio.blks2impl.fm_emph import fm_preemph - -#from gnuradio import ctcss - -class nbfm_tx(gr.hier_block2): - def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3): - """ - Narrow Band FM Transmitter. - - Takes a single float input stream of audio samples in the range [-1,+1] - and produces a single FM modulated complex baseband output. - - @param audio_rate: sample rate of audio stream, >= 16k - @type audio_rate: integer - @param quad_rate: sample rate of output stream - @type quad_rate: integer - @param tau: preemphasis time constant (default 75e-6) - @type tau: float - @param max_dev: maximum deviation in Hz (default 5e3) - @type max_dev: float - - quad_rate must be an integer multiple of audio_rate. - """ - - gr.hier_block2.__init__(self, "nbfm_tx", - gr.io_signature(1, 1, gr.sizeof_float), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - # FIXME audio_rate and quad_rate ought to be exact rationals - audio_rate = int(audio_rate) - quad_rate = int(quad_rate) - - if quad_rate % audio_rate != 0: - raise ValueError, "quad_rate is not an integer multiple of audio_rate" - - - do_interp = audio_rate != quad_rate - - if do_interp: - interp_factor = quad_rate / audio_rate - interp_taps = optfir.low_pass (interp_factor, # gain - quad_rate, # Fs - 4500, # passband cutoff - 7000, # stopband cutoff - 0.1, # passband ripple dB - 40) # stopband atten dB - - #print "len(interp_taps) =", len(interp_taps) - self.interpolator = gr.interp_fir_filter_fff (interp_factor, interp_taps) - - self.preemph = fm_preemph (quad_rate, tau=tau) - - k = 2 * math.pi * max_dev / quad_rate - self.modulator = gr.frequency_modulator_fc (k) - - if do_interp: - self.connect (self, self.interpolator, self.preemph, self.modulator, self) - else: - self.connect(self, self.preemph, self.modulator, self) - - -class ctcss_gen_f(gr.hier_block2): - def __init__(self, sample_rate, tone_freq): - gr.hier_block2.__init__(self, "ctcss_gen_f", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - self.plgen = gr.sig_source_f(sample_rate, gr.GR_SIN_WAVE, tone_freq, 0.1, 0.0) - self.connect(self.plgen, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py deleted file mode 100644 index e83c327fc8..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, optfir - -class pfb_arb_resampler_ccf(gr.hier_block2): - ''' - Convenience wrapper for the polyphase filterbank arbitrary resampler. - - The block takes a single complex stream in and outputs a single complex - stream out. As such, it requires no extra glue to handle the input/output - streams. This block is provided to be consistent with the interface to the - other PFB block. - ''' - def __init__(self, rate, taps=None, flt_size=32, atten=100): - gr.hier_block2.__init__(self, "pfb_arb_resampler_ccf", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - self._rate = rate - self._size = flt_size - - if taps is not None: - self._taps = taps - else: - # Create a filter that covers the full bandwidth of the input signal - bw = 0.4 - tb = 0.2 - ripple = 0.1 - #self._taps = gr.firdes.low_pass_2(self._size, self._size, bw, tb, atten) - made = False - while not made: - try: - self._taps = optfir.low_pass(self._size, self._size, bw, bw+tb, ripple, atten) - made = True - except RuntimeError: - ripple += 0.01 - made = False - print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple)) - - # Build in an exit strategy; if we've come this far, it ain't working. - if(ripple >= 1.0): - raise RuntimeError("optfir could not generate an appropriate filter.") - - self.pfb = gr.pfb_arb_resampler_ccf(self._rate, self._taps, self._size) - #print "PFB has %d taps\n" % (len(self._taps),) - - self.connect(self, self.pfb) - self.connect(self.pfb, self) - - # Note -- set_taps not implemented in base class yet - def set_taps(self, taps): - self.pfb.set_taps(taps) - - def set_rate(self, rate): - self.pfb.set_rate(rate) - - -class pfb_arb_resampler_fff(gr.hier_block2): - ''' - Convenience wrapper for the polyphase filterbank arbitrary resampler. - - The block takes a single float stream in and outputs a single float - stream out. As such, it requires no extra glue to handle the input/output - streams. This block is provided to be consistent with the interface to the - other PFB block. - ''' - def __init__(self, rate, taps=None, flt_size=32, atten=100): - gr.hier_block2.__init__(self, "pfb_arb_resampler_fff", - gr.io_signature(1, 1, gr.sizeof_float), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - self._rate = rate - self._size = flt_size - - if taps is not None: - self._taps = taps - else: - # Create a filter that covers the full bandwidth of the input signal - bw = 0.4 - tb = 0.2 - ripple = 0.1 - #self._taps = gr.firdes.low_pass_2(self._size, self._size, bw, tb, atten) - made = False - while not made: - try: - self._taps = optfir.low_pass(self._size, self._size, bw, bw+tb, ripple, atten) - made = True - except RuntimeError: - ripple += 0.01 - made = False - print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple)) - - # Build in an exit strategy; if we've come this far, it ain't working. - if(ripple >= 1.0): - raise RuntimeError("optfir could not generate an appropriate filter.") - - self.pfb = gr.pfb_arb_resampler_fff(self._rate, self._taps, self._size) - #print "PFB has %d taps\n" % (len(self._taps),) - - self.connect(self, self.pfb) - self.connect(self.pfb, self) - - # Note -- set_taps not implemented in base class yet - def set_taps(self, taps): - self.pfb.set_taps(taps) - - def set_rate(self, rate): - self.pfb.set_rate(rate) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py deleted file mode 100644 index 4bbe1bec6c..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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. -# - -from gnuradio import gr, optfir - -class pfb_channelizer_ccf(gr.hier_block2): - ''' - Make a Polyphase Filter channelizer (complex in, complex out, floating-point taps) - - This simplifies the interface by allowing a single input stream to connect to this block. - It will then output a stream for each channel. - ''' - def __init__(self, numchans, taps=None, oversample_rate=1, atten=100): - gr.hier_block2.__init__(self, "pfb_channelizer_ccf", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(numchans, numchans, gr.sizeof_gr_complex)) # Output signature - - self._nchans = numchans - self._oversample_rate = oversample_rate - - if taps is not None: - self._taps = taps - else: - # Create a filter that covers the full bandwidth of the input signal - bw = 0.4 - tb = 0.2 - ripple = 0.1 - made = False - while not made: - try: - self._taps = optfir.low_pass(1, self._nchans, bw, bw+tb, ripple, atten) - made = True - except RuntimeError: - ripple += 0.01 - made = False - print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple)) - - # Build in an exit strategy; if we've come this far, it ain't working. - if(ripple >= 1.0): - raise RuntimeError("optfir could not generate an appropriate filter.") - - self.s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, self._nchans) - self.pfb = gr.pfb_channelizer_ccf(self._nchans, self._taps, - self._oversample_rate) - self.connect(self, self.s2ss) - - for i in xrange(self._nchans): - self.connect((self.s2ss,i), (self.pfb,i)) - self.connect((self.pfb,i), (self,i)) - - def set_channel_map(self, newmap): - self.pfb.set_channel_map(newmap) - - diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py deleted file mode 100644 index adcdfe9ba1..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, optfir - -class pfb_decimator_ccf(gr.hier_block2): - ''' - Make a Polyphase Filter decimator (complex in, complex out, floating-point taps) - - This simplifies the interface by allowing a single input stream to connect to this block. - It will then output a stream that is the decimated output stream. - ''' - def __init__(self, decim, taps=None, channel=0, atten=100): - gr.hier_block2.__init__(self, "pfb_decimator_ccf", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - self._decim = decim - self._channel = channel - - if taps is not None: - self._taps = taps - else: - # Create a filter that covers the full bandwidth of the input signal - bw = 0.4 - tb = 0.2 - ripple = 0.1 - made = False - while not made: - try: - self._taps = optfir.low_pass(1, self._decim, bw, bw+tb, ripple, atten) - made = True - except RuntimeError: - ripple += 0.01 - made = False - print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple)) - - # Build in an exit strategy; if we've come this far, it ain't working. - if(ripple >= 1.0): - raise RuntimeError("optfir could not generate an appropriate filter.") - - self.s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, self._decim) - self.pfb = gr.pfb_decimator_ccf(self._decim, self._taps, self._channel) - - self.connect(self, self.s2ss) - - for i in xrange(self._decim): - self.connect((self.s2ss,i), (self.pfb,i)) - - self.connect(self.pfb, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py deleted file mode 100644 index 5492dfcac6..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, optfir - -class pfb_interpolator_ccf(gr.hier_block2): - ''' - Make a Polyphase Filter interpolator (complex in, complex out, floating-point taps) - - The block takes a single complex stream in and outputs a single complex - stream out. As such, it requires no extra glue to handle the input/output - streams. This block is provided to be consistent with the interface to the - other PFB block. - ''' - def __init__(self, interp, taps=None, atten=100): - gr.hier_block2.__init__(self, "pfb_interpolator_ccf", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - self._interp = interp - self._taps = taps - - if taps is not None: - self._taps = taps - else: - # Create a filter that covers the full bandwidth of the input signal - bw = 0.4 - tb = 0.2 - ripple = 0.99 - made = False - while not made: - try: - self._taps = optfir.low_pass(self._interp, self._interp, bw, bw+tb, ripple, atten) - made = True - except RuntimeError: - ripple += 0.01 - made = False - print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple)) - - # Build in an exit strategy; if we've come this far, it ain't working. - if(ripple >= 1.0): - raise RuntimeError("optfir could not generate an appropriate filter.") - - self.pfb = gr.pfb_interpolator_ccf(self._interp, self._taps) - - self.connect(self, self.pfb) - self.connect(self.pfb, self) - - - - diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/rational_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/rational_resampler.py deleted file mode 100644 index eea12af958..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/rational_resampler.py +++ /dev/null @@ -1,131 +0,0 @@ -# -# Copyright 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 - -_plot = None - -def design_filter(interpolation, decimation, fractional_bw): - """ - Given the interpolation rate, decimation rate and a fractional bandwidth, - design a set of taps. - - @param interpolation: interpolation factor - @type interpolation: integer > 0 - @param decimation: decimation factor - @type decimation: integer > 0 - @param fractional_bw: fractional bandwidth in (0, 0.5) 0.4 works well. - @type fractional_bw: float - @returns: sequence of numbers - """ - - if fractional_bw >= 0.5 or fractional_bw <= 0: - raise ValueError, "Invalid fractional_bandwidth, must be in (0, 0.5)" - - beta = 5.0 - trans_width = 0.5 - fractional_bw - mid_transition_band = 0.5 - trans_width/2 - - taps = gr.firdes.low_pass(interpolation, # gain - 1, # Fs - mid_transition_band/interpolation, # trans mid point - trans_width/interpolation, # transition width - gr.firdes.WIN_KAISER, - beta # beta - ) - - return taps - - - -class _rational_resampler_base(gr.hier_block2): - """ - base class for all rational resampler variants. - """ - def __init__(self, resampler_base, - interpolation, decimation, taps=None, fractional_bw=None): - """ - Rational resampling polyphase FIR filter. - - Either taps or fractional_bw may be specified, but not both. - If neither is specified, a reasonable default, 0.4, is used as - the fractional_bw. - - @param interpolation: interpolation factor - @type interpolation: integer > 0 - @param decimation: decimation factor - @type decimation: integer > 0 - @param taps: optional filter coefficients - @type taps: sequence - @param fractional_bw: fractional bandwidth in (0, 0.5), measured at final freq (use 0.4) - @type fractional_bw: float - """ - - if not isinstance(interpolation, int) or interpolation < 1: - raise ValueError, "interpolation must be an integer >= 1" - - if not isinstance(decimation, int) or decimation < 1: - raise ValueError, "decimation must be an integer >= 1" - - if taps is None and fractional_bw is None: - fractional_bw = 0.4 - - d = gru.gcd(interpolation, decimation) - interpolation = interpolation // d - decimation = decimation // d - - if taps is None: - taps = design_filter(interpolation, decimation, fractional_bw) - - resampler = resampler_base(interpolation, decimation, taps) - gr.hier_block2.__init__(self, "rational_resampler", - gr.io_signature(1, 1, resampler.input_signature().sizeof_stream_item(0)), - gr.io_signature(1, 1, resampler.output_signature().sizeof_stream_item(0))) - - self.connect(self, resampler, self) - - -class rational_resampler_fff(_rational_resampler_base): - def __init__(self, interpolation, decimation, taps=None, fractional_bw=None): - """ - Rational resampling polyphase FIR filter with - float input, float output and float taps. - """ - _rational_resampler_base.__init__(self, gr.rational_resampler_base_fff, - interpolation, decimation, taps, fractional_bw) - -class rational_resampler_ccf(_rational_resampler_base): - def __init__(self, interpolation, decimation, taps=None, fractional_bw=None): - """ - Rational resampling polyphase FIR filter with - complex input, complex output and float taps. - """ - _rational_resampler_base.__init__(self, gr.rational_resampler_base_ccf, - interpolation, decimation, taps, fractional_bw) - -class rational_resampler_ccc(_rational_resampler_base): - def __init__(self, interpolation, decimation, taps=None, fractional_bw=None): - """ - Rational resampling polyphase FIR filter with - complex input, complex output and complex taps. - """ - _rational_resampler_base.__init__(self, gr.rational_resampler_base_ccc, - interpolation, decimation, taps, fractional_bw) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py b/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py deleted file mode 100644 index bd7fb535ae..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py +++ /dev/null @@ -1,76 +0,0 @@ -# -# Copyright 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. -# - -import math -from gnuradio import gr, optfir - -class standard_squelch(gr.hier_block2): - def __init__(self, audio_rate): - gr.hier_block2.__init__(self, "standard_squelch", - gr.io_signature(1, 1, gr.sizeof_float), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - self.input_node = gr.add_const_ff(0) # FIXME kludge - - self.low_iir = gr.iir_filter_ffd((0.0193,0,-0.0193),(1,1.9524,-0.9615)) - self.low_square = gr.multiply_ff() - self.low_smooth = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate)) # 100ms time constant - - self.hi_iir = gr.iir_filter_ffd((0.0193,0,-0.0193),(1,1.3597,-0.9615)) - self.hi_square = gr.multiply_ff() - self.hi_smooth = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate)) - - self.sub = gr.sub_ff(); - self.add = gr.add_ff(); - self.gate = gr.threshold_ff(0.3,0.43,0) - self.squelch_lpf = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate)) - - self.div = gr.divide_ff() - self.squelch_mult = gr.multiply_ff() - - self.connect (self, self.input_node) - self.connect (self.input_node, (self.squelch_mult, 0)) - - self.connect (self.input_node,self.low_iir) - self.connect (self.low_iir,(self.low_square,0)) - self.connect (self.low_iir,(self.low_square,1)) - self.connect (self.low_square,self.low_smooth,(self.sub,0)) - self.connect (self.low_smooth, (self.add,0)) - - self.connect (self.input_node,self.hi_iir) - self.connect (self.hi_iir,(self.hi_square,0)) - self.connect (self.hi_iir,(self.hi_square,1)) - self.connect (self.hi_square,self.hi_smooth,(self.sub,1)) - self.connect (self.hi_smooth, (self.add,1)) - - self.connect (self.sub, (self.div, 0)) - self.connect (self.add, (self.div, 1)) - self.connect (self.div, self.gate, self.squelch_lpf, (self.squelch_mult,1)) - self.connect (self.squelch_mult, self) - - def set_threshold(self, threshold): - self.gate.set_hi(threshold) - - def threshold(self): - return self.gate.hi() - - def squelch_range(self): - return (0.0, 1.0, 1.0/100) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py b/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py deleted file mode 100644 index 8f75729c91..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py +++ /dev/null @@ -1,93 +0,0 @@ -# -# Copyright 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 - -class stream_to_vector_decimator(gr.hier_block2): - """ - Convert the stream to a vector, decimate the vector stream to achieve the vector rate. - """ - - def __init__(self, item_size, sample_rate, vec_rate, vec_len): - """ - Create the block chain. - @param item_size the number of bytes per sample - @param sample_rate the rate of incoming samples - @param vec_rate the rate of outgoing vectors (same units as sample_rate) - @param vec_len the length of the outgoing vectors in items - """ - self._vec_rate = vec_rate - self._vec_len = vec_len - self._sample_rate = sample_rate - - gr.hier_block2.__init__(self, "stream_to_vector_decimator", - gr.io_signature(1, 1, item_size), # Input signature - gr.io_signature(1, 1, item_size*vec_len)) # Output signature - - s2v = gr.stream_to_vector(item_size, vec_len) - self.one_in_n = gr.keep_one_in_n(item_size*vec_len, 1) - self._update_decimator() - self.connect(self, s2v, self.one_in_n, self) - - def set_sample_rate(self, sample_rate): - """ - Set the new sampling rate and update the decimator. - @param sample_rate the new rate - """ - self._sample_rate = sample_rate - self._update_decimator() - - def set_vec_rate(self, vec_rate): - """ - Set the new vector rate and update the decimator. - @param vec_rate the new rate - """ - self._vec_rate = vec_rate - self._update_decimator() - - def set_decimation(self, decim): - """ - Set the decimation parameter directly. - @param decim the new decimation - """ - self._decim = max(1, int(round(decim))) - self.one_in_n.set_n(self._decim) - - def _update_decimator(self): - self.set_decimation(self._sample_rate/self._vec_len/self._vec_rate) - - def decimation(self): - """ - Returns the actual decimation. - """ - return self._decim - - def sample_rate(self): - """ - Returns configured sample rate. - """ - return self._sample_rate - - def frame_rate(self): - """ - Returns actual frame rate - """ - return self._sample_rate/self._vec_len/self._decim diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py deleted file mode 100644 index d1cbcf9127..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py +++ /dev/null @@ -1,69 +0,0 @@ -# -# Copyright 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.blks2impl.fm_emph import fm_deemph -import math - -class wfm_rcv(gr.hier_block2): - def __init__ (self, quad_rate, audio_decimation): - """ - Hierarchical block for demodulating a broadcast FM signal. - - The input is the downconverted complex baseband signal (gr_complex). - The output is the demodulated audio (float). - - @param quad_rate: input sample rate of complex baseband input. - @type quad_rate: float - @param audio_decimation: how much to decimate quad_rate to get to audio. - @type audio_decimation: integer - """ - gr.hier_block2.__init__(self, "wfm_rcv", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - volume = 20. - - max_dev = 75e3 - fm_demod_gain = quad_rate/(2*math.pi*max_dev) - audio_rate = quad_rate / audio_decimation - - - # We assign to self so that outsiders can grab the demodulator - # if they need to. E.g., to plot its output. - # - # input: complex; output: float - self.fm_demod = gr.quadrature_demod_cf (fm_demod_gain) - - # input: float; output: float - self.deemph = fm_deemph (audio_rate) - - # compute FIR filter taps for audio filter - width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0, # gain - quad_rate, # sampling rate - audio_rate/2 - width_of_transition_band, - width_of_transition_band, - gr.firdes.WIN_HAMMING) - # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) - - self.connect (self, self.fm_demod, self.audio_filter, self.deemph, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py deleted file mode 100755 index e229bcc2e6..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py +++ /dev/null @@ -1,216 +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. -# - -from gnuradio import gr -from gnuradio.blks2impl.fm_emph import fm_deemph -import math - -class wfm_rcv_fmdet(gr.hier_block2): - def __init__ (self, demod_rate, audio_decimation): - """ - Hierarchical block for demodulating a broadcast FM signal. - - The input is the downconverted complex baseband signal - (gr_complex). The output is two streams of the demodulated - audio (float) 0=Left, 1=Right. - - @param demod_rate: input sample rate of complex baseband input. - @type demod_rate: float - @param audio_decimation: how much to decimate demod_rate to get to audio. - @type audio_decimation: integer - """ - gr.hier_block2.__init__(self, "wfm_rcv_fmdet", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(2, 2, gr.sizeof_float)) # Output signature - lowfreq = -125e3/demod_rate - highfreq = 125e3/demod_rate - audio_rate = demod_rate / audio_decimation - - # We assign to self so that outsiders can grab the demodulator - # if they need to. E.g., to plot its output. - # - # input: complex; output: float - - self.fm_demod = gr.fmdet_cf (demod_rate, lowfreq, highfreq, 0.05) - - # input: float; output: float - self.deemph_Left = fm_deemph (audio_rate) - self.deemph_Right = fm_deemph (audio_rate) - - # compute FIR filter taps for audio filter - width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0 , # gain - demod_rate, # sampling rate - 15000 , - width_of_transition_band, - gr.firdes.WIN_HAMMING) - - # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) - if 1: - # Pick off the stereo carrier/2 with this filter. It - # attenuated 10 dB so apply 10 dB gain We pick off the - # negative frequency half because we want to base band by - # it! - ## NOTE THIS WAS HACKED TO OFFSET INSERTION LOSS DUE TO - ## DEEMPHASIS - - stereo_carrier_filter_coeffs = gr.firdes.complex_band_pass(10.0, - demod_rate, - -19020, - -18980, - width_of_transition_band, - gr.firdes.WIN_HAMMING) - - #print "len stereo carrier filter = ",len(stereo_carrier_filter_coeffs) - #print "stereo carrier filter ", stereo_carrier_filter_coeffs - #print "width of transition band = ",width_of_transition_band, " audio rate = ", audio_rate - - # Pick off the double side band suppressed carrier - # Left-Right audio. It is attenuated 10 dB so apply 10 dB - # gain - - stereo_dsbsc_filter_coeffs = gr.firdes.complex_band_pass(20.0, - demod_rate, - 38000-15000/2, - 38000+15000/2, - width_of_transition_band, - gr.firdes.WIN_HAMMING) - #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) - #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs - - # construct overlap add filter system from coefficients - # for stereo carrier - self.stereo_carrier_filter = gr.fir_filter_fcc(audio_decimation, - stereo_carrier_filter_coeffs) - - # carrier is twice the picked off carrier so arrange to do - # a commplex multiply - self.stereo_carrier_generator = gr.multiply_cc(); - - # Pick off the rds signal - stereo_rds_filter_coeffs = gr.firdes.complex_band_pass(30.0, - demod_rate, - 57000 - 1500, - 57000 + 1500, - width_of_transition_band, - gr.firdes.WIN_HAMMING) - #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) - #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs - # construct overlap add filter system from coefficients for stereo carrier - - self.rds_signal_filter = gr.fir_filter_fcc(audio_decimation, - stereo_rds_filter_coeffs) - self.rds_carrier_generator = gr.multiply_cc(); - self.rds_signal_generator = gr.multiply_cc(); - self_rds_signal_processor = gr.null_sink(gr.sizeof_gr_complex); - - loop_bw = 2*math.pi/100.0 - max_freq = -2.0*math.pi*18990/audio_rate; - min_freq = -2.0*math.pi*19010/audio_rate; - self.stereo_carrier_pll_recovery = gr.pll_refout_cc(loop_bw, - max_freq, - min_freq); - - #self.stereo_carrier_pll_recovery.squelch_enable(False) - ##pll_refout does not have squelch yet, so disabled for - #now - - # set up mixer (multiplier) to get the L-R signal at - # baseband - - self.stereo_basebander = gr.multiply_cc(); - - # pick off the real component of the basebanded L-R - # signal. The imaginary SHOULD be zero - - self.LmR_real = gr.complex_to_real(); - self.Make_Left = gr.add_ff(); - self.Make_Right = gr.sub_ff(); - - self.stereo_dsbsc_filter = gr.fir_filter_fcc(audio_decimation, - stereo_dsbsc_filter_coeffs) - - - if 1: - - # send the real signal to complex filter to pick off the - # carrier and then to one side of a multiplier - self.connect (self, self.fm_demod, self.stereo_carrier_filter, - self.stereo_carrier_pll_recovery, - (self.stereo_carrier_generator,0)) - - # send the already filtered carrier to the otherside of the carrier - # the resulting signal from this multiplier is the carrier - # with correct phase but at -38000 Hz. - self.connect (self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1)) - - # send the new carrier to one side of the mixer (multiplier) - self.connect (self.stereo_carrier_generator, (self.stereo_basebander,0)) - - # send the demphasized audio to the DSBSC pick off filter, the complex - # DSBSC signal at +38000 Hz is sent to the other side of the mixer/multiplier - # the result is BASEBANDED DSBSC with phase zero! - self.connect (self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1)) - - # Pick off the real part since the imaginary is - # theoretically zero and then to one side of a summer - self.connect (self.stereo_basebander, self.LmR_real, (self.Make_Left,0)) - - #take the same real part of the DSBSC baseband signal and - #send it to negative side of a subtracter - self.connect (self.LmR_real,(self.Make_Right,1)) - - # Make rds carrier by taking the squared pilot tone and - # multiplying by pilot tone - self.connect (self.stereo_basebander,(self.rds_carrier_generator,0)) - self.connect (self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1)) - - # take signal, filter off rds, send into mixer 0 channel - self.connect (self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0)) - - # take rds_carrier_generator output and send into mixer 1 - # channel - self.connect (self.rds_carrier_generator,(self.rds_signal_generator,1)) - - # send basebanded rds signal and send into "processor" - # which for now is a null sink - self.connect (self.rds_signal_generator,self_rds_signal_processor) - - - if 1: - # pick off the audio, L+R that is what we used to have and - # send it to the summer - self.connect(self.fm_demod, self.audio_filter, (self.Make_Left, 1)) - - # take the picked off L+R audio and send it to the PLUS - # side of the subtractor - self.connect(self.audio_filter,(self.Make_Right, 0)) - - # The result of Make_Left gets (L+R) + (L-R) and results in 2*L - # The result of Make_Right gets (L+R) - (L-R) and results in 2*R - self.connect(self.Make_Left , self.deemph_Left, (self, 0)) - self.connect(self.Make_Right, self.deemph_Right, (self, 1)) - - # NOTE: mono support will require variable number of outputs in hier_block2s - # See ticket:174 in Trac database - #else: - # self.connect (self.fm_demod, self.audio_filter, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py deleted file mode 100644 index d4ce6d2231..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py +++ /dev/null @@ -1,190 +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. -# - -from gnuradio import gr -from gnuradio.blks2impl.fm_emph import fm_deemph -import math - -class wfm_rcv_pll(gr.hier_block2): - def __init__ (self, demod_rate, audio_decimation): - """ - Hierarchical block for demodulating a broadcast FM signal. - - The input is the downconverted complex baseband signal (gr_complex). - The output is two streams of the demodulated audio (float) 0=Left, 1=Right. - - @param demod_rate: input sample rate of complex baseband input. - @type demod_rate: float - @param audio_decimation: how much to decimate demod_rate to get to audio. - @type audio_decimation: integer - """ - gr.hier_block2.__init__(self, "wfm_rcv_pll", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(2, 2, gr.sizeof_float)) # Output signature - bandwidth = 250e3 - audio_rate = demod_rate / audio_decimation - - - # We assign to self so that outsiders can grab the demodulator - # if they need to. E.g., to plot its output. - # - # input: complex; output: float - loop_bw = 2*math.pi/100.0 - max_freq = 2.0*math.pi*90e3/demod_rate - self.fm_demod = gr.pll_freqdet_cf (loop_bw, max_freq,-max_freq) - - # input: float; output: float - self.deemph_Left = fm_deemph (audio_rate) - self.deemph_Right = fm_deemph (audio_rate) - - # compute FIR filter taps for audio filter - width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0 , # gain - demod_rate, # sampling rate - 15000 , - width_of_transition_band, - gr.firdes.WIN_HAMMING) - # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) - if 1: - # Pick off the stereo carrier/2 with this filter. It attenuated 10 dB so apply 10 dB gain - # We pick off the negative frequency half because we want to base band by it! - ## NOTE THIS WAS HACKED TO OFFSET INSERTION LOSS DUE TO DEEMPHASIS - - stereo_carrier_filter_coeffs = gr.firdes.complex_band_pass(10.0, - demod_rate, - -19020, - -18980, - width_of_transition_band, - gr.firdes.WIN_HAMMING) - - #print "len stereo carrier filter = ",len(stereo_carrier_filter_coeffs) - #print "stereo carrier filter ", stereo_carrier_filter_coeffs - #print "width of transition band = ",width_of_transition_band, " audio rate = ", audio_rate - - # Pick off the double side band suppressed carrier Left-Right audio. It is attenuated 10 dB so apply 10 dB gain - - stereo_dsbsc_filter_coeffs = gr.firdes.complex_band_pass(20.0, - demod_rate, - 38000-15000/2, - 38000+15000/2, - width_of_transition_band, - gr.firdes.WIN_HAMMING) - #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) - #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs - # construct overlap add filter system from coefficients for stereo carrier - - self.stereo_carrier_filter = gr.fir_filter_fcc(audio_decimation, stereo_carrier_filter_coeffs) - - # carrier is twice the picked off carrier so arrange to do a commplex multiply - - self.stereo_carrier_generator = gr.multiply_cc(); - - # Pick off the rds signal - - stereo_rds_filter_coeffs = gr.firdes.complex_band_pass(30.0, - demod_rate, - 57000 - 1500, - 57000 + 1500, - width_of_transition_band, - gr.firdes.WIN_HAMMING) - #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) - #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs - # construct overlap add filter system from coefficients for stereo carrier - - self.rds_signal_filter = gr.fir_filter_fcc(audio_decimation, stereo_rds_filter_coeffs) - - - - - - - self.rds_carrier_generator = gr.multiply_cc(); - self.rds_signal_generator = gr.multiply_cc(); - self_rds_signal_processor = gr.null_sink(gr.sizeof_gr_complex); - - - - loop_bw = 2*math.pi/100.0 - max_freq = -2.0*math.pi*18990/audio_rate; - min_freq = -2.0*math.pi*19010/audio_rate; - - self.stereo_carrier_pll_recovery = gr.pll_refout_cc(loop_bw, max_freq, min_freq); - #self.stereo_carrier_pll_recovery.squelch_enable(False) #pll_refout does not have squelch yet, so disabled for now - - - # set up mixer (multiplier) to get the L-R signal at baseband - - self.stereo_basebander = gr.multiply_cc(); - - # pick off the real component of the basebanded L-R signal. The imaginary SHOULD be zero - - self.LmR_real = gr.complex_to_real(); - self.Make_Left = gr.add_ff(); - self.Make_Right = gr.sub_ff(); - - self.stereo_dsbsc_filter = gr.fir_filter_fcc(audio_decimation, stereo_dsbsc_filter_coeffs) - - - if 1: - - # send the real signal to complex filter to pick off the carrier and then to one side of a multiplier - self.connect (self, self.fm_demod,self.stereo_carrier_filter,self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,0)) - # send the already filtered carrier to the otherside of the carrier - self.connect (self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1)) - # the resulting signal from this multiplier is the carrier with correct phase but at -38000 Hz. - - # send the new carrier to one side of the mixer (multiplier) - self.connect (self.stereo_carrier_generator, (self.stereo_basebander,0)) - # send the demphasized audio to the DSBSC pick off filter, the complex - # DSBSC signal at +38000 Hz is sent to the other side of the mixer/multiplier - self.connect (self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1)) - # the result is BASEBANDED DSBSC with phase zero! - - # Pick off the real part since the imaginary is theoretically zero and then to one side of a summer - self.connect (self.stereo_basebander, self.LmR_real, (self.Make_Left,0)) - #take the same real part of the DSBSC baseband signal and send it to negative side of a subtracter - self.connect (self.LmR_real,(self.Make_Right,1)) - - # Make rds carrier by taking the squared pilot tone and multiplying by pilot tone - self.connect (self.stereo_basebander,(self.rds_carrier_generator,0)) - self.connect (self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1)) - # take signal, filter off rds, send into mixer 0 channel - self.connect (self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0)) - # take rds_carrier_generator output and send into mixer 1 channel - self.connect (self.rds_carrier_generator,(self.rds_signal_generator,1)) - # send basebanded rds signal and send into "processor" which for now is a null sink - self.connect (self.rds_signal_generator,self_rds_signal_processor) - - - if 1: - # pick off the audio, L+R that is what we used to have and send it to the summer - self.connect(self.fm_demod, self.audio_filter, (self.Make_Left, 1)) - # take the picked off L+R audio and send it to the PLUS side of the subtractor - self.connect(self.audio_filter,(self.Make_Right, 0)) - # The result of Make_Left gets (L+R) + (L-R) and results in 2*L - # The result of Make_Right gets (L+R) - (L-R) and results in 2*R - self.connect(self.Make_Left , self.deemph_Left, (self, 0)) - self.connect(self.Make_Right, self.deemph_Right, (self, 1)) - # NOTE: mono support will require variable number of outputs in hier_block2s - # See ticket:174 in Trac database - #else: - # self.connect (self.fm_demod, self.audio_filter, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py deleted file mode 100644 index 3fcf98f891..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py +++ /dev/null @@ -1,79 +0,0 @@ -# -# Copyright 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. -# - -import math -from gnuradio import gr, optfir -from gnuradio.blks2impl.fm_emph import fm_preemph - -class wfm_tx(gr.hier_block2): - def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=75e3): - """ - Wide Band FM Transmitter. - - Takes a single float input stream of audio samples in the range [-1,+1] - and produces a single FM modulated complex baseband output. - - @param audio_rate: sample rate of audio stream, >= 16k - @type audio_rate: integer - @param quad_rate: sample rate of output stream - @type quad_rate: integer - @param tau: preemphasis time constant (default 75e-6) - @type tau: float - @param max_dev: maximum deviation in Hz (default 75e3) - @type max_dev: float - - quad_rate must be an integer multiple of audio_rate. - """ - gr.hier_block2.__init__(self, "wfm_tx", - gr.io_signature(1, 1, gr.sizeof_float), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - # FIXME audio_rate and quad_rate ought to be exact rationals - audio_rate = int(audio_rate) - quad_rate = int(quad_rate) - - if quad_rate % audio_rate != 0: - raise ValueError, "quad_rate is not an integer multiple of audio_rate" - - - do_interp = audio_rate != quad_rate - - if do_interp: - interp_factor = quad_rate / audio_rate - interp_taps = optfir.low_pass (interp_factor, # gain - quad_rate, # Fs - 16000, # passband cutoff - 18000, # stopband cutoff - 0.1, # passband ripple dB - 40) # stopband atten dB - - print "len(interp_taps) =", len(interp_taps) - self.interpolator = gr.interp_fir_filter_fff (interp_factor, interp_taps) - - self.preemph = fm_preemph (quad_rate, tau=tau) - - k = 2 * math.pi * max_dev / quad_rate - self.modulator = gr.frequency_modulator_fc (k) - - if do_interp: - self.connect (self, self.interpolator, self.preemph, self.modulator, self) - else: - self.connect(self, self.preemph, self.modulator, self) diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/ctrlport/CMakeLists.txt new file mode 100644 index 0000000000..994e3a48cf --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/ctrlport/CMakeLists.txt @@ -0,0 +1,112 @@ +# 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) + +EXECUTE_PROCESS( + COMMAND ${ICE_SLICE2PY} -I${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/runtime + --output-dir=${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/runtime/gnuradio.ice +) + +EXECUTE_PROCESS( + COMMAND ${ICE_SLICE2PY} -I${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/runtime + --output-dir=${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/runtime/frontend.ice +) + +GR_PYTHON_INSTALL( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py + ${CMAKE_CURRENT_SOURCE_DIR}/IceRadioClient.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/ + COMPONENT "core_python" +) + +# We don't want to install these in the root Python directory, but we +# aren't given a choice based on the way slice2py generates the +# information. +GR_PYTHON_INSTALL( + FILES + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python/gnuradio_ice.py + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python/frontend_ice.py + DESTINATION ${GR_PYTHON_DIR} + COMPONENT "core_python" +) + +GR_PYTHON_INSTALL( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/GNURadio/__init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/GNURadio + COMPONENT "core_python" +) + +GR_PYTHON_INSTALL( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/GNURadio/Booter/__init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/GNURadio/Booter + COMPONENT "core_python" +) + +GR_PYTHON_INSTALL( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/GNURadio/Frontend/__init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/GNURadio/Frontend + COMPONENT "core_python" +) + +install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/icon.png + DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport + COMPONENT "core_python" +) + +GR_PYTHON_INSTALL( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/GrDataPlotter.py + ${CMAKE_CURRENT_SOURCE_DIR}/monitor.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/ + COMPONENT "core_python" +) + +GR_PYTHON_INSTALL( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/gr-ctrlport-monitor + ${CMAKE_CURRENT_SOURCE_DIR}/gr-ctrlport-curses + DESTINATION ${GR_RUNTIME_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT "core_python" +) + +######################################################################## +# Handle the unit tests +######################################################################## +if(ENABLE_GR_CTRLPORT) + if(ENABLE_TESTING) + 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) + set(GR_TEST_TARGET_DEPS gruel gnuradio-core) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + endforeach(py_qa_test_file) + endif(ENABLE_TESTING) +endif(ENABLE_GR_CTRLPORT) diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py new file mode 100644 index 0000000000..f33160aca2 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py @@ -0,0 +1,423 @@ +#!/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 +import sys, time + +try: + from gnuradio import qtgui + from PyQt4 import QtGui, QtCore + import sip +except ImportError: + print "Error: Program requires PyQt4 and gr-qtgui." + sys.exit(1) + +class GrDataPlotterC(gr.top_block): + def __init__(self, name, rate, pmin=None, pmax=None): + gr.top_block.__init__(self) + + self._name = name + self._npts = 500 + samp_rate = 1.0 + + self._last_data = self._npts*[0,] + self._data_len = 0 + + self.src = gr.vector_source_c([]) + self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.snk = qtgui.time_sink_c(self._npts, samp_rate, + self._name, 1) + + if(pmin is not None or not pmax is None): + self.snk.set_y_axis(pmin, pmax) + + self.connect(self.src, self.thr, (self.snk, 0)) + + self.snk.set_line_label(0, "Real") + self.snk.set_line_label(1, "Imag") + + self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + + def __del__(self): + pass + + def qwidget(self): + return self.py_window + + def name(self): + return self._name + + def update(self, data): + # Ask GUI if there has been a change in nsamps + npts = self.snk.nsamps() + if(self._npts != npts): + + # Adjust buffers to accomodate new settings + if(npts < self._npts): + if(self._data_len < npts): + self._last_data = self._last_data[0:npts] + else: + self._last_data = self._last_data[self._data_len-npts:self._data_len] + self._data_len = npts + else: + self._last_data += (npts - self._npts)*[0,] + self._npts = npts + self.snk.reset() + + # Update the plot data depending on type + if(type(data) == list): + data_r = data[0::2] + data_i = data[1::2] + data = [complex(r,i) for r,i in zip(data_r, data_i)] + if(len(data) > self._npts): + self.src.set_data(data) + self._last_data = data[-self._npts:] + else: + newdata = self._last_data[-(self._npts-len(data)):] + newdata += data + self.src.set_data(newdata) + self._last_data = newdata + + else: # single value update + if(self._data_len < self._npts): + self._last_data[self._data_len] = data + self._data_len += 1 + else: + self._last_data = self._last_data[1:] + self._last_data.append(data) + self.src.set_data(self._last_data) + +class GrDataPlotterF(gr.top_block): + def __init__(self, name, rate, pmin=None, pmax=None): + gr.top_block.__init__(self) + + self._name = name + self._npts = 500 + samp_rate = 1.0 + + self._last_data = self._npts*[0,] + self._data_len = 0 + + self.src = gr.vector_source_f([]) + self.thr = gr.throttle(gr.sizeof_float, rate) + self.snk = qtgui.time_sink_f(self._npts, samp_rate, + self._name, 1) + + if(pmin is not None or not pmax is None): + self.snk.set_y_axis(pmin, pmax) + + self.connect(self.src, self.thr, (self.snk, 0)) + + self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + + def __del__(self): + pass + + def qwidget(self): + return self.py_window + + def name(self): + return self._name + + def update(self, data): + # Ask GUI if there has been a change in nsamps + npts = self.snk.nsamps() + if(self._npts != npts): + + # Adjust buffers to accomodate new settings + if(npts < self._npts): + if(self._data_len < npts): + self._last_data = self._last_data[0:npts] + else: + self._last_data = self._last_data[self._data_len-npts:self._data_len] + self._data_len = npts + else: + self._last_data += (npts - self._npts)*[0,] + self._npts = npts + self.snk.reset() + + # Update the plot data depending on type + if(type(data) == list): + if(len(data) > self._npts): + self.src.set_data(data) + self._last_data = data[-self._npts:] + else: + newdata = self._last_data[-(self._npts-len(data)):] + newdata += data + self.src.set_data(newdata) + self._last_data = newdata + + else: # single value update + if(self._data_len < self._npts): + self._last_data[self._data_len] = data + self._data_len += 1 + else: + self._last_data = self._last_data[1:] + self._last_data.append(data) + self.src.set_data(self._last_data) + + +class GrDataPlotterConst(gr.top_block): + def __init__(self, name, rate, pmin=None, pmax=None): + gr.top_block.__init__(self) + + self._name = name + self._npts = 500 + samp_rate = 1.0 + + self._last_data = self._npts*[0,] + self._data_len = 0 + + self.src = gr.vector_source_c([]) + self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.snk = qtgui.const_sink_c(self._npts, + self._name, 1) + + if(pmin is not None or not pmax is None): + self.snk.set_x_axis(pmin, pmax) + self.snk.set_y_axis(pmin, pmax) + + self.connect(self.src, self.thr, (self.snk, 0)) + + self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + + def __del__(self): + pass + + def qwidget(self): + return self.py_window + + def name(self): + return self._name + + def update(self, data): + # Ask GUI if there has been a change in nsamps + npts = self.snk.nsamps() + if(self._npts != npts): + + # Adjust buffers to accomodate new settings + if(npts < self._npts): + if(self._data_len < npts): + self._last_data = self._last_data[0:npts] + else: + self._last_data = self._last_data[self._data_len-npts:self._data_len] + self._data_len = npts + else: + self._last_data += (npts - self._npts)*[0,] + self._npts = npts + self.snk.reset() + + # Update the plot data depending on type + if(type(data) == list): + data_r = data[0::2] + data_i = data[1::2] + data = [complex(r,i) for r,i in zip(data_r, data_i)] + if(len(data) > self._npts): + self.src.set_data(data) + self._last_data = data[-self._npts:] + else: + newdata = self._last_data[-(self._npts-len(data)):] + newdata += data + self.src.set_data(newdata) + self._last_data = newdata + + else: # single value update + if(self._data_len < self._npts): + self._last_data[self._data_len] = data + self._data_len += 1 + else: + self._last_data = self._last_data[1:] + self._last_data.append(data) + self.src.set_data(self._last_data) + + +class GrDataPlotterPsdC(gr.top_block): + def __init__(self, name, rate, pmin=None, pmax=None): + gr.top_block.__init__(self) + + self._name = name + self._samp_rate = 1.0 + self._fftsize = 2048 + self._wintype = gr.firdes.WIN_BLACKMAN_hARRIS + self._fc = 0 + + self._last_data = self._fftsize*[0,] + self._data_len = 0 + + self.src = gr.vector_source_c([]) + self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.snk = qtgui.freq_sink_c(self._fftsize, self._wintype, + self._fc, self._samp_rate, + self._name, 1) + + if(pmin is not None or not pmax is None): + self.snk.set_y_axis(pmin, pmax) + + self.connect(self.src, self.thr, (self.snk, 0)) + + self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + + def __del__(self): + pass + + def qwidget(self): + return self.py_window + + def name(self): + return self._name + + def update(self, data): + # Ask GUI if there has been a change in nsamps + fftsize = self.snk.fft_size() + if(self._fftsize != fftsize): + + # Adjust buffers to accomodate new settings + if(fftsize < self._fftsize): + if(self._data_len < fftsize): + self._last_data = self._last_data[0:fftsize] + else: + self._last_data = self._last_data[self._data_len-fftsize:self._data_len] + self._data_len = fftsize + else: + self._last_data += (fftsize - self._fftsize)*[0,] + self._fftsize = fftsize + self.snk.reset() + + # Update the plot data depending on type + if(type(data) == list): + data_r = data[0::2] + data_i = data[1::2] + data = [complex(r,i) for r,i in zip(data_r, data_i)] + if(len(data) > self._fftsize): + self.src.set_data(data) + self._last_data = data[-self._fftsize:] + else: + newdata = self._last_data[-(self._fftsize-len(data)):] + newdata += data + self.src.set_data(newdata) + self._last_data = newdata + + else: # single value update + if(self._data_len < self._fftsize): + self._last_data[self._data_len] = data + self._data_len += 1 + else: + self._last_data = self._last_data[1:] + self._last_data.append(data) + self.src.set_data(self._last_data) + +class GrDataPlotterPsdF(gr.top_block): + def __init__(self, name, rate, pmin=None, pmax=None): + gr.top_block.__init__(self) + + self._name = name + self._samp_rate = 1.0 + self._fftsize = 2048 + self._wintype = gr.firdes.WIN_BLACKMAN_hARRIS + self._fc = 0 + + self._last_data = self._fftsize*[0,] + self._data_len = 0 + + self.src = gr.vector_source_f([]) + self.thr = gr.throttle(gr.sizeof_float, rate) + self.snk = qtgui.freq_sink_f(self._fftsize, self._wintype, + self._fc, self._samp_rate, + self._name, 1) + + if(pmin is not None or not pmax is None): + self.snk.set_y_axis(pmin, pmax) + + self.connect(self.src, self.thr, (self.snk, 0)) + + self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + + def __del__(self): + pass + + def qwidget(self): + return self.py_window + + def name(self): + return self._name + + def update(self, data): + # Ask GUI if there has been a change in nsamps + fftsize = self.snk.fft_size() + if(self._fftsize != fftsize): + + # Adjust buffers to accomodate new settings + if(fftsize < self._fftsize): + if(self._data_len < fftsize): + self._last_data = self._last_data[0:fftsize] + else: + self._last_data = self._last_data[self._data_len-fftsize:self._data_len] + self._data_len = fftsize + else: + self._last_data += (fftsize - self._fftsize)*[0,] + self._fftsize = fftsize + self.snk.reset() + + # Update the plot data depending on type + if(type(data) == list): + data_r = data[0::2] + data_i = data[1::2] + data = [complex(r,i) for r,i in zip(data_r, data_i)] + if(len(data) > self._fftsize): + self.src.set_data(data) + self._last_data = data[-self._fftsize:] + else: + newdata = self._last_data[-(self._fftsize-len(data)):] + newdata += data + self.src.set_data(newdata) + self._last_data = newdata + + else: # single value update + if(self._data_len < self._fftsize): + self._last_data[self._data_len] = data + self._data_len += 1 + else: + self._last_data = self._last_data[1:] + self._last_data.append(data) + self.src.set_data(self._last_data) + + +class GrDataPlotterValueTable: + def __init__(self, uid, parent, x, y, xsize, ysize, + headers=['Statistic Key ( Source Block :: Stat Name ) ', + 'Curent Value', 'Units', 'Description']): + # must encapsulate, cuz Qt's bases are not classes + self.uid = uid + self.treeWidget = QtGui.QTreeWidget(parent) + self.treeWidget.setColumnCount(len(headers)) + self.treeWidget.setGeometry(x,y,xsize,ysize) + self.treeWidget.setHeaderLabels(headers) + self.treeWidget.resizeColumnToContents(0) + + def updateItems(self, knobs, knobprops): + items = []; + self.treeWidget.clear() + for k, v in knobs.iteritems(): + items.append(QtGui.QTreeWidgetItem([str(k), str(v.value), + knobprops[k].units, + knobprops[k].description])) + self.treeWidget.insertTopLevelItems(0, items) diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/IceRadioClient.py b/gnuradio-core/src/python/gnuradio/ctrlport/IceRadioClient.py new file mode 100644 index 0000000000..0964b5a4ba --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/ctrlport/IceRadioClient.py @@ -0,0 +1,102 @@ +#!/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. +# + +import Ice, Glacier2 +from PyQt4 import QtGui, QtCore +import sys, time, Ice +from gnuradio import gr +from gnuradio.ctrlport import GNURadio + +class IceRadioClient(Ice.Application): + def __init__(self, parentClass): + self.parentClass = parentClass + + def getRadio(self, host, port): + radiostr = "gnuradio -t:tcp -h " + host + " -p " + port + " -t 3000" + base = self.communicator().stringToProxy(radiostr).ice_twoway() + radio = GNURadio.ControlPortPrx.checkedCast(base) + + if not radio: + sys.stderr.write("{0} : invalid proxy.\n".format(args[0])) + return None + + return radio + + def run(self,args): + if len(args) < 2: + print "useage: [glacierinstance glacierhost glacierport] host port" + return + if len(args) == 8: + self.useglacier = True + guser = args[1] + gpass = args[2] + ginst = args[3] + ghost = args[4] + gport = args[5] + host = args[6] + port = args[7] + else: + self.useglacier = False + host = args[1] + port = args[2] + + if self.useglacier: + gstring = ginst + "/router -t:tcp -h " + ghost + " -p " + gport + print "GLACIER: {0}".format(gstring) + + setrouter = Glacier2.RouterPrx.checkedCast(self.communicator().stringToProxy(gstring)) + self.communicator().setDefaultRouter(setrouter) + defaultRouter = self.communicator().getDefaultRouter() + #defaultRouter = self.communicator().stringToProxy(gstring) + if not defaultRouter: + print self.appName() + ": no default router set" + return 1 + else: + print str(defaultRouter) + router = Glacier2.RouterPrx.checkedCast(defaultRouter) + if not router: + print self.appName() + ": configured router is not a Glacier2 router" + return 1 + + while True: + print "This demo accepts any user-id / password combination." + if not guser == '' and not gpass == '': + id = guser + pw = gpass + else: + id = raw_input("user id: ") + pw = raw_input("password: ") + + try: + router.createSession(id, pw) + break + except Glacier2.PermissionDeniedException, ex: + print "permission denied:\n" + ex.reason + + radio = self.getRadio(host, port) + if(radio is None): + return 1 + + app = QtGui.QApplication(sys.argv) + ex = self.parentClass(radio, port, self) + ex.show(); + app.exec_() diff --git a/gnuradio-core/src/tests/benchmark_dotprod b/gnuradio-core/src/python/gnuradio/ctrlport/__init__.py index 82f3b5c3fc..031c3b424e 100755..100644 --- a/gnuradio-core/src/tests/benchmark_dotprod +++ b/gnuradio-core/src/python/gnuradio/ctrlport/__init__.py @@ -1,46 +1,30 @@ -#!/bin/sh -# -# Copyright 2008 Free Software Foundation, Inc. # +# 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 this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -DIR=. - -tests=" -benchmark_dotprod_fff -benchmark_dotprod_ccf -benchmark_dotprod_ccc -benchmark_dotprod_fcc -benchmark_dotprod_scc -benchmark_dotprod_fsf -" +# The presence of this file turns this directory into a Python package -echo "uname -a" -uname -a +import Ice, IcePy -if test -e /proc/cpuinfo -then - cat /proc/cpuinfo -fi +# import swig generated symbols into the ctrlport namespace +#from ctrlport_swig import * +from monitor import * -for t in $tests -do - echo - echo "$t": - $DIR/$t -done +# import any pure python here +#import GNURadio diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-curses b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-curses new file mode 100755 index 0000000000..1bee3b1a1e --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-curses @@ -0,0 +1,268 @@ +#!/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. +# + +import threading +import curses +import os, sys, time +from optparse import OptionParser + +import Ice +from gnuradio.ctrlport import GNURadio + +ENTER = chr(10) +UP_ARROW = chr(65) +DOWN_ARROW = chr(66) + +class modem_monitor(threading.Thread): + def __init__(self, cb_live, cb_exit, interface): + threading.Thread.__init__(self) + self.cb_live = cb_live + self.cb_exit = cb_exit + + self.running = True + + def __del__(self): + rx.close() + + def run(self): + while self.running: + time.sleep(0.5) + + def shutdown(self): + self.running = False + self.rx.close() + + def cb(self,contents): + (op, sep, payload) = contents.partition(":") + if(op == "live"): + print "live" + self.cb_live(payload) + elif(op == "exit"): + self.cb_exit(payload) + else: + print "unknown op arrived! garbage on multicast adx?" + +class modem_window(threading.Thread): + def __init__(self, locator): + threading.Thread.__init__(self) + self.locator = locator + + # curses init + self.win = curses.newwin(30,100,4,4) + + # Ice/GRCP init + self.comm = Ice.initialize() + proxy = self.comm.stringToProxy(locator) + self.radio = GNURadio.ControlPortPrx.checkedCast(proxy) + self.updateKnobs() + + # GUI init + self.running = True + self.ssel = 0 + self.start() + #self.updateGUI() + + # input loop + while(self.running): + self.getInput() + + # wait for update thread exit + self.join() + + def updateKnobs(self): + self.knobs = self.radio.get([]) + + def getInput(self): + a = self.win.getch() + if(a <= 256): + a = chr(a) + if(a == 'q'): + self.running = False + elif(a == UP_ARROW): + self.ssel = max(self.ssel-1, 0) + self.updateGUI() + elif(a == DOWN_ARROW): + self.ssel = max(min(self.ssel+1, len(self.knobs.keys())-1),0) + self.updateGUI() + self.updateGUI() + + def updateGUI(self): + self.win.clear() + self.win.border(0) + self.win.addstr(1, 2, "Modem Statistics :: %s"%(self.locator)) + self.win.addstr(2, 2, "---------------------------------------------------") + + maxnb = 0 + maxk = 0 + for k in self.knobs.keys(): + (nb,k) = k.split("::", 2) + maxnb = max(maxnb,len(nb)) + maxk = max(maxk,len(k)) + + offset = 3 + keys = self.knobs.keys() + keys.sort() + for k in keys: + (nb,sk) = k.split("::", 2) + v = self.knobs[k].value + sv = str(v) + if(len(sv) > 20): + sv = sv[0:20] + props = 0 + if(self.ssel == offset-3): + props = props | curses.A_REVERSE + self.win.addstr(offset, 2, "%s %s %s" % \ + (nb.rjust(maxnb," "), sk.ljust(maxk," "), sv),props) + offset = offset + 1 + self.win.refresh() + + def run(self): + while(self.running): + self.updateKnobs() + self.updateGUI() + time.sleep(1) + +class monitor_gui: + def __init__(self, interfaces, options): + + locator = None + + # Extract options into a locator + if(options.host and options.port): + locator = "{0} -t:{1} -h {2} -p {3}".format( + options.app, options.protocol, + options.host, options.port) + + # Set up GUI + self.locators = {} + + self.mode = 0 # modem index screen (modal keyboard input) + self.lsel = 0 # selected locator + self.scr = curses.initscr() + self.updateGUI() + + # Kick off initial monitors + self.monitors = [] + for i in interfaces: + self.monitors.append( modem_monitor(self.addModem, self.delModem, i) ) + self.monitors[-1].start() + + if not ((locator == None) or (locator == "")): + self.addModem(locator) + + # wait for user input + while(True): + self.getInput() + + def addModem(self, locator): + if(not self.locators.has_key(locator)): + self.locators[locator] = {} + self.locators[locator]["update_time"] = time.time() + self.locators[locator]["status"] = "live" + + self.updateGUI(); + + def delModem(self, locator): + #if(self.locators.has_key(locator)): + if(not self.locators.has_key(locator)): + self.locators[locator] = {} + self.locators[locator]["update_time"] = time.time() + self.locators[locator]["status"] = "exit" + + self.updateGUI() + + def updateGUI(self): + if(self.mode == 0): #redraw locators + self.scr.clear() + self.scr.border(0) + self.scr.addstr(1, 2, " GRCP-Curses Modem Monitor :: (A)dd (R)efresh, (Q)uit, ...") + for i in range(len(self.locators.keys())): + locator = self.locators.keys()[i] + lhash = self.locators[locator] + #self.scr.addstr(3+i, 5, locator + str(lhash)) + props = 0 + if(self.lsel == i): + props = props | curses.A_REVERSE + self.scr.addstr(3+i, 5, locator + str(lhash), props) + self.scr.refresh() + + def connectGUI(self): + self.scr.clear() + self.scr.addstr(1, 1, "Connect to radio:") + locator = self.scr.getstr(200) + self.addModem(locator) + self.updateGUI() + + def getInput(self): + a = self.scr.getch() + self.scr.addstr(20, 2, "got key (%d) " % (int(a))) + if(a <= 256): + a = chr(a) + if(a =='r'): + self.updateGUI() + elif(a == 'q'): + self.shutdown() + elif(a == 'a'): + self.connectGUI() + elif(a == UP_ARROW): + self.lsel = max(self.lsel-1, 0) + self.updateGUI() + elif(a == DOWN_ARROW): + self.lsel = max(min(self.lsel+1, len(self.locators.keys())-1),0) + self.updateGUI() + elif(a == ENTER): + try: + locator = self.locators.keys()[self.lsel] + self.mode = 1 + mwin = modem_window(locator) + self.mode = 0 + # pop up a new modem display ... + self.updateGUI() + except: + pass + + def shutdown(self): + curses.endwin() + os._exit(0) + +if __name__ == "__main__": + parser = OptionParser() + parser.add_option("-H", "--host", type="string", + help="Hostname of ControlPort server.") + parser.add_option("-p", "--port", type="int", + help="Port number of host's ControlPort endpoint.") + parser.add_option("-i", "--interfaces", type="string", + action="append", default=["lo"], + help="Interfaces to use. [default=%default]") + parser.add_option("-P", "--protocol", type="string", default="tcp", + help="Type of protocol to use (usually tcp). [default=%default]") + parser.add_option("-a", "--app", type="string", default="gnuradio", + help="Name of application [default=%default]") + (options, args) = parser.parse_args() + + if((options.host == None) ^ (options.port == None)): + print "Please set both a hostname and a port number.\n" + parser.print_help() + sys.exit(1) + + mg = monitor_gui(options.interfaces, options) + diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor new file mode 100755 index 0000000000..241b8a2043 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor @@ -0,0 +1,581 @@ +#!/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, ctrlport + +from PyQt4 import QtCore,Qt +import PyQt4.QtGui as QtGui +import sys, time + +import Ice +from gnuradio.ctrlport.IceRadioClient import * +from gnuradio.ctrlport.GrDataPlotter import * +from gnuradio.ctrlport import GNURadio + +class MAINWindow(QtGui.QMainWindow): + def minimumSizeHint(self): + return Qtgui.QSize(800,600) + + def __init__(self, radio, port, interface): + + super(MAINWindow, self).__init__() + self.conns = [] + self.plots = [] + self.knobprops = [] + self.interface = interface + + self.mdiArea = QtGui.QMdiArea() + self.mdiArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) + self.mdiArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) + self.setCentralWidget(self.mdiArea) + + self.mdiArea.subWindowActivated.connect(self.updateMenus) + self.windowMapper = QtCore.QSignalMapper(self) + self.windowMapper.mapped[QtGui.QWidget].connect(self.setActiveSubWindow) + + self.createActions() + self.createMenus() + self.createToolBars() + self.createStatusBar() + self.updateMenus() + + self.setWindowTitle("GNU Radio Control Port Monitor") + self.setUnifiedTitleAndToolBarOnMac(True) + + self.newCon(radio, port) + icon = QtGui.QIcon(ctrlport.__path__[0] + "/icon.png" ) + self.setWindowIcon(icon) + + def newCon(self, radio=None, port=None): + child = MForm(radio, port, len(self.conns), self) + if(child.radio is not None): + child.setWindowTitle(str(child.radio)) + self.mdiArea.addSubWindow(child) + child.showMaximized() + self.conns.append(child) + self.plots.append([]) + + def propertiesMenu(self, key, radio, uid): + r = str(radio).split(" ") + title = "{0}:{1}".format(r[3], r[5]) + + props = radio.properties([key]) + pmin = props[key].min.value + pmax = props[key].max.value + if pmin == []: + pmin = None + else: + pmin = 1.1*pmin + if pmax == []: + pmax = None + else: + pmax = 1.1*pmax + + def newUpdaterProxy(): + self.newUpdater(key, radio) + + def newPlotterFProxy(): + self.newPlotF(key, uid, title, pmin, pmax) + + def newPlotterCProxy(): + self.newPlotC(key, uid, title, pmin, pmax) + + def newPlotterConstProxy(): + self.newPlotConst(key, uid, title, pmin, pmax) + + def newPlotterPsdFProxy(): + self.newPlotPsdF(key, uid, title) + + def newPlotterPsdCProxy(): + self.newPlotPsdC(key, uid, title) + + menu = QtGui.QMenu(self) + menu.setTitle("Item Actions") + menu.setTearOffEnabled(False) + + # object properties + menu.addAction("Properties", newUpdaterProxy) + + # displays available if not complex + menu.addAction("Plot Time", newPlotterFProxy) + menu.addAction("Plot PSD", newPlotterPsdFProxy) + + # displays available if complex + menu.addAction("Plot Time (cpx)", newPlotterCProxy) + menu.addAction("Plot Constellation", newPlotterConstProxy) + menu.addAction("Plot PSD cpx", newPlotterPsdCProxy) + + menu.popup(QtGui.QCursor.pos()) + + def newUpdater(self, key, radio): + updater = UpdaterWindow(key, radio, None) + updater.setWindowTitle("Updater: " + key) + updater.setModal(False) + updater.exec_() + + def newSub(self, e): + tag = str(e.text(0)) + tree = e.treeWidget().parent() + uid = tree.uid + knobprop = self.knobprops[uid][tag] + + r = str(tree.radio).split(" ") + title = "{0}:{1}".format(r[3], r[5]) + pmin = knobprop.min.value + pmax = knobprop.max.value + if pmin == []: + pmin = None + else: + pmin = 1.1*pmin + if pmax == []: + pmax = None + else: + pmax = 1.1*pmax + + if(knobprop.display == GNURadio.DisplayType.DISPXYSCATTER): + self.newPlotConst(tag, uid, title, pmin, pmax) + elif(knobprop.display == GNURadio.DisplayType.DISPTIMESERIESF): + self.newPlotF(tag, uid, title, pmin, pmax) + elif(knobprop.display == GNURadio.DisplayType.DISPTIMESERIESC): + self.newPlotC(tag, uid, title, pmin, pmax) + + def createPlot(self, plot, uid, title): + plot.start() + self.plots[uid].append(plot) + + self.mdiArea.addSubWindow(plot.qwidget()) + plot.qwidget().setWindowTitle("{0}: {1}".format(title, plot.name())) + self.connect(plot.qwidget(), + QtCore.SIGNAL('destroyed(QObject*)'), + self.destroyPlot) + plot.qwidget().show() + + + def destroyPlot(self, obj): + for plots in self.plots: + for p in plots: + if p.qwidget() == obj: + plots.remove(p) + break + + def newPlotConst(self, tag, uid, title="", pmin=None, pmax=None): + plot = GrDataPlotterConst(tag, 32e6, pmin, pmax) + self.createPlot(plot, uid, title) + + def newPlotF(self, tag, uid, title="", pmin=None, pmax=None): + plot = GrDataPlotterF(tag, 32e6, pmin, pmax) + self.createPlot(plot, uid, title) + + def newPlotC(self, tag, uid, title="", pmin=None, pmax=None): + plot = GrDataPlotterC(tag, 32e6, pmin, pmax) + self.createPlot(plot, uid, title) + + def newPlotPsdF(self, tag, uid, title="", pmin=None, pmax=None): + plot = GrDataPlotterPsdF(tag, 32e6, pmin, pmax) + self.createPlot(plot, uid, title) + + def newPlotPsdC(self, tag, uid, title="", pmin=None, pmax=None): + plot = GrDataPlotterPsdC(tag, 32e6, pmin, pmax) + self.createPlot(plot, uid, title) + + def update(self, knobs, uid): + #sys.stderr.write("KNOB KEYS: {0}\n".format(knobs.keys())) + for plot in self.plots[uid]: + data = knobs[plot.name()].value + plot.update(data) + plot.stop() + plot.wait() + plot.start() + + def setActiveSubWindow(self, window): + if window: + self.mdiArea.setActiveSubWindow(window) + + + def createActions(self): + self.newConAct = QtGui.QAction("&New Connection", + self, shortcut=QtGui.QKeySequence.New, + statusTip="Create a new file", triggered=self.newCon) + #self.newAct = QtGui.QAction(QtGui.QIcon(':/images/new.png'), "&New Plot", + self.newPlotAct = QtGui.QAction("&New Plot", + self, + statusTip="Create a new file", triggered=self.newPlotF) + + self.exitAct = QtGui.QAction("E&xit", self, shortcut="Ctrl+Q", + statusTip="Exit the application", + triggered=QtGui.qApp.closeAllWindows) + + self.closeAct = QtGui.QAction("Cl&ose", self, shortcut="Ctrl+F4", + statusTip="Close the active window", + triggered=self.mdiArea.closeActiveSubWindow) + + self.closeAllAct = QtGui.QAction("Close &All", self, + statusTip="Close all the windows", + triggered=self.mdiArea.closeAllSubWindows) + + + qks = QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_T); + self.tileAct = QtGui.QAction("&Tile", self, + statusTip="Tile the windows", + triggered=self.mdiArea.tileSubWindows, + shortcut=qks) + + qks = QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_C); + self.cascadeAct = QtGui.QAction("&Cascade", self, + statusTip="Cascade the windows", shortcut=qks, + triggered=self.mdiArea.cascadeSubWindows) + + self.nextAct = QtGui.QAction("Ne&xt", self, + shortcut=QtGui.QKeySequence.NextChild, + statusTip="Move the focus to the next window", + triggered=self.mdiArea.activateNextSubWindow) + + self.previousAct = QtGui.QAction("Pre&vious", self, + shortcut=QtGui.QKeySequence.PreviousChild, + statusTip="Move the focus to the previous window", + triggered=self.mdiArea.activatePreviousSubWindow) + + self.separatorAct = QtGui.QAction(self) + self.separatorAct.setSeparator(True) + + self.aboutAct = QtGui.QAction("&About", self, + statusTip="Show the application's About box", + triggered=self.about) + + self.aboutQtAct = QtGui.QAction("About &Qt", self, + statusTip="Show the Qt library's About box", + triggered=QtGui.qApp.aboutQt) + + def createMenus(self): + self.fileMenu = self.menuBar().addMenu("&File") + self.fileMenu.addAction(self.newConAct) + self.fileMenu.addAction(self.newPlotAct) + self.fileMenu.addSeparator() + self.fileMenu.addAction(self.exitAct) + + self.windowMenu = self.menuBar().addMenu("&Window") + self.updateWindowMenu() + self.windowMenu.aboutToShow.connect(self.updateWindowMenu) + + self.menuBar().addSeparator() + + self.helpMenu = self.menuBar().addMenu("&Help") + self.helpMenu.addAction(self.aboutAct) + self.helpMenu.addAction(self.aboutQtAct) + + def createToolBars(self): + self.fileToolBar = self.addToolBar("File") + self.fileToolBar.addAction(self.newConAct) + self.fileToolBar.addAction(self.newPlotAct) + + self.fileToolBar = self.addToolBar("Window") + self.fileToolBar.addAction(self.tileAct) + self.fileToolBar.addAction(self.cascadeAct) + + def createStatusBar(self): + self.statusBar().showMessage("Ready") + + + def activeMdiChild(self): + activeSubWindow = self.mdiArea.activeSubWindow() + if activeSubWindow: + return activeSubWindow.widget() + return None + + def updateMenus(self): + hasMdiChild = (self.activeMdiChild() is not None) + self.closeAct.setEnabled(hasMdiChild) + self.closeAllAct.setEnabled(hasMdiChild) + self.tileAct.setEnabled(hasMdiChild) + self.cascadeAct.setEnabled(hasMdiChild) + self.nextAct.setEnabled(hasMdiChild) + self.previousAct.setEnabled(hasMdiChild) + self.separatorAct.setVisible(hasMdiChild) + + def updateWindowMenu(self): + self.windowMenu.clear() + self.windowMenu.addAction(self.closeAct) + self.windowMenu.addAction(self.closeAllAct) + self.windowMenu.addSeparator() + self.windowMenu.addAction(self.tileAct) + self.windowMenu.addAction(self.cascadeAct) + self.windowMenu.addSeparator() + self.windowMenu.addAction(self.nextAct) + self.windowMenu.addAction(self.previousAct) + self.windowMenu.addAction(self.separatorAct) + + def about(self): + about_info = \ +'''Copyright 2012 Free Software Foundation, Inc.\n +This program is part of GNU Radio.\n +GNU Radio is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.\n +GNU Radio is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n +You should have received a copy of the GNU General Public License along with GNU Radio; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA.''' + + QtGui.QMessageBox.about(None, "gr-ctrlport-monitor", about_info) + + +class ConInfoDialog(QtGui.QDialog): + def __init__(self, parent=None): + super(ConInfoDialog, self).__init__(parent) + + self.gridLayout = QtGui.QGridLayout(self) + + + self.host = QtGui.QLineEdit(self); + self.port = QtGui.QLineEdit(self); + self.host.setText("localhost"); + self.port.setText("43243"); + + self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) + + self.gridLayout.addWidget(self.host); + self.gridLayout.addWidget(self.port); + self.gridLayout.addWidget(self.buttonBox); + + self.buttonBox.accepted.connect(self.accept) + self.buttonBox.rejected.connect(self.reject) + + + def accept(self): + self.done(1); + + def reject(self): + self.done(0); + + +class UpdaterWindow(QtGui.QDialog): + def __init__(self, key, radio, parent): + QtGui.QDialog.__init__(self, parent) + + self.key = key; + self.radio = radio + + self.resize(300,200) + self.layout = QtGui.QVBoxLayout() + + self.props = radio.properties([key])[key] + info = str(self.props) + + self.infoLabel = QtGui.QLabel(info) + self.layout.addWidget(self.infoLabel) + + # Test here to make sure that a 'set' function + try: + a = radio.set(radio.get([key])) + has_set = True + except Ice.UnknownException: + has_set = False + + if(has_set is False): + self.cancelButton = QtGui.QPushButton("Ok") + self.cancelButton.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) + + self.buttonlayout = QtGui.QHBoxLayout() + self.buttonlayout.addWidget(self.cancelButton) + self.layout.addLayout(self.buttonlayout) + + else: # we have a set function + self.textInput = QtGui.QLineEdit() + self.layout.addWidget(self.textInput) + + self.applyButton = QtGui.QPushButton("Apply") + self.setButton = QtGui.QPushButton("OK") + self.cancelButton = QtGui.QPushButton("Cancel") + + rv = radio.get([key]) + self.textInput.setText(str(rv[key].value)) + self.sv = rv[key] + + self.applyButton.connect(self.applyButton, QtCore.SIGNAL('clicked()'), self._apply) + self.setButton.connect(self.setButton, QtCore.SIGNAL('clicked()'), self._set) + self.cancelButton.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) + + self.is_num = ((type(self.sv.value)==float) or (type(self.sv.value)==int)) + if(self.is_num): + self.sliderlayout = QtGui.QHBoxLayout() + + self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) + + self.sliderlayout.addWidget(QtGui.QLabel(str(self.props.min.value))) + self.sliderlayout.addWidget(self.slider) + self.sliderlayout.addWidget(QtGui.QLabel(str(self.props.max.value))) + + self.steps = 10000 + self.valspan = self.props.max.value - self.props.min.value + + self.slider.setRange(0, 10000) + self._set_slider_value(self.sv.value) + + self.connect(self.slider, QtCore.SIGNAL("sliderReleased()"), self._slide) + + self.layout.addLayout(self.sliderlayout) + + self.buttonlayout = QtGui.QHBoxLayout() + self.buttonlayout.addWidget(self.applyButton) + self.buttonlayout.addWidget(self.setButton) + self.buttonlayout.addWidget(self.cancelButton) + self.layout.addLayout(self.buttonlayout) + + # set layout and go... + self.setLayout(self.layout) + + def _set_slider_value(self, val): + self.slider.setValue(self.steps*(val-self.props.min.value)/self.valspan) + + def _slide(self): + val = (self.slider.value()*self.valspan + self.props.min.value)/float(self.steps) + self.textInput.setText(str(val)) + + def _apply(self): + if(type(self.sv.value) == str): + val = str(self.textInput.text()) + elif(type(self.sv.value) == int): + val = int(round(float(self.textInput.text()))) + elif(type(self.sv.value) == float): + val = float(self.textInput.text()) + else: + sys.stderr.write("set type not supported! ({0})\n".format(type(self.sv.value))) + sys.exit(-1) + + self.sv.value = val + km = {} + km[self.key] = self.sv + self.radio.set(km) + self._set_slider_value(self.sv.value) + + def _set(self): + self._apply() + self.done(0) + + +class MForm(QtGui.QWidget): + def update(self): + try: + st = time.time(); + knobs = self.radio.get([]); + ft = time.time(); + latency = ft-st; + self.parent.statusBar().showMessage("Current GNU Radio Control Port Query Latency: %f ms"%(latency*1000)) + + except Exception, e: + sys.stderr.write("ctrlport-monitor: radio.get threw exception ({0}).\n".format(e)) + if(type(self.parent) is MAINWindow): + # Find window of connection + remove = [] + for p in self.parent.mdiArea.subWindowList(): + if self.parent.conns[self.uid] == p.widget(): + remove.append(p) + + # Find any subplot windows of connection + for p in self.parent.mdiArea.subWindowList(): + for plot in self.parent.plots[self.uid]: + if plot.qwidget() == p.widget(): + remove.append(p) + + # Clean up local references to these + self.parent.conns.remove(self.parent.conns[self.uid]) + self.parent.plots.remove(self.parent.plots[self.uid]) + + # Remove subwindows for connection and plots + for r in remove: + self.parent.mdiArea.removeSubWindow(r) + + # Clean up self + self.close() + else: + sys.exit(1) + return + + tableitems = knobs.keys() + + #UPDATE TABLE: + self.table.updateItems(knobs, self.knobprops) + + #UPDATE PLOTS + self.parent.update(knobs, self.uid) + + + def __init__(self, radio=None, port=None, uid=0, parent=None): + + super(MForm, self).__init__() + + if(radio == None or port == None): + askinfo = ConInfoDialog(self); + if askinfo.exec_(): + host = str(askinfo.host.text()); + port = str(askinfo.port.text()); + radio = parent.interface.getRadio(host, port) + else: + self.radio = None + return + + self.uid = uid + self.parent = parent + self.horizontalLayout = QtGui.QVBoxLayout(self) + self.gridLayout = QtGui.QGridLayout() + + self.radio = radio + self.knobprops = self.radio.properties([]) + self.parent.knobprops.append(self.knobprops) + self.resize(775,500) + self.timer = QtCore.QTimer() + self.constupdatediv = 0 + self.tableupdatediv = 0 + plotsize=250 + + # make table + self.table = GrDataPlotterValueTable(uid, self, 0, 0, 400, 200) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) + self.table.treeWidget.setSizePolicy(sizePolicy) + self.table.treeWidget.setEditTriggers(QtGui.QAbstractItemView.EditKeyPressed) + self.table.treeWidget.setSortingEnabled(True) + self.table.treeWidget.setDragEnabled(True) + + # add things to layouts + self.horizontalLayout.addWidget(self.table.treeWidget) + + # set up timer + self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.update) + self.timer.start(1000) + + # set up context menu .. + self.table.treeWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + self.table.treeWidget.customContextMenuRequested.connect(self.openMenu) + + # Set up double-click to launch default plotter + self.connect(self.table.treeWidget, + QtCore.SIGNAL('itemDoubleClicked(QTreeWidgetItem*, int)'), + self.parent.newSub); + + def openMenu(self, pos): + index = self.table.treeWidget.selectedIndexes() + item = self.table.treeWidget.itemFromIndex(index[0]) + itemname = str(item.text(0)) + self.parent.propertiesMenu(itemname, self.radio, self.uid) + + +class MyClient(IceRadioClient): + def __init__(self): + IceRadioClient.__init__(self, MAINWindow) + +sys.exit(MyClient().main(sys.argv)) diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/icon.png b/gnuradio-core/src/python/gnuradio/ctrlport/icon.png Binary files differnew file mode 100644 index 0000000000..4beb204428 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/ctrlport/icon.png diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/monitor.py b/gnuradio-core/src/python/gnuradio/ctrlport/monitor.py new file mode 100644 index 0000000000..53a571a698 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/ctrlport/monitor.py @@ -0,0 +1,59 @@ +#!/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. +# + +import sys, subprocess, re, signal, time, atexit, os +from gnuradio import gr + +class monitor: + def __init__(self): + print "ControlPort Monitor running." + self.started = False + atexit.register(self.shutdown) + + def __del__(self): + if(self.started): + self.stop() + + def start(self): + print "monitor::endpoints() = %s" % (gr.rpcmanager_get().endpoints()) + try: + self.proc = subprocess.Popen(map(lambda a: ["gr-ctrlport-monitor", + re.search("\d+\.\d+\.\d+\.\d+",a).group(0), + re.search("-p (\d+)",a).group(1)], + gr.rpcmanager_get().endpoints())[0]) + self.started = True + except: + self.proc = None + print "failed to to start ControlPort Monitor on specified port" + + def stop(self): + if(self.proc): + if(self.proc.returncode == None): + print "\tcalling stop on shutdown" + self.proc.terminate() + else: + print "\tno proc to shut down, exiting" + + def shutdown(self): + print "ctrlport.monitor received shutdown signal" + if(self.started): + self.stop() diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py b/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py new file mode 100755 index 0000000000..34c7d0f5df --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py @@ -0,0 +1,170 @@ +#!/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. +# + +# +# This program tests mixed python and c++ ctrlport exports in a single app +# + +import Ice +import sys, time, random, numpy +from gnuradio import gr, gr_unittest + +from gnuradio.ctrlport import GNURadio +from gnuradio import ctrlport + +def get1(): + return "success" + +def get2(): + return "failure" + +class inc_class: + def __init__(self): + self.val = 1 + def pp(self): + self.val = self.val+1 + return self.val + +get3 = inc_class() + +def get4(): + random.seed(0) + rv = random.random() + return rv + +def get5(): + numpy.random.seed(0) + samp_t = numpy.random.randn(24)+1j*numpy.random.randn(24); + samp_f = numpy.fft.fft(samp_t); + log_pow_f = 20*numpy.log10(numpy.abs(samp_f)) + rv = list(log_pow_f) + return rv; + +def get6(): + numpy.random.seed(0) + samp_t = numpy.random.randn(1024)+1j*numpy.random.randn(1024); + rv = list(samp_t) + return rv; + +class test_cpp_py_binding(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_001(self): + v1 = gr.RPC_get_string("pyland", "v1", "unit_1_string", + "Python Exported String", "", "", "", + gr.DISPNULL) + v1.activate(get1) + + v2 = gr.RPC_get_string("pyland", "v2", "unit_2_string", + "Python Exported String", "", "", "", + gr.DISPNULL) + v2.activate(get2) + + v3 = gr.RPC_get_int("pyland", "v3", "unit_3_int", + "Python Exported Int", 0, 100, 1, + gr.DISPNULL) + v3.activate(get3.pp) + + v4 = gr.RPC_get_double("pyland", "time", "unit_4_time_double", + "Python Exported Double", 0, 1000, 1, + gr.DISPNULL) + v4.activate(get4) + + v5 = gr.RPC_get_vector_float("pyland", "fvec", "unit_5_float_vector", + "Python Exported Float Vector", [], [], [], + gr.DISPTIMESERIESC) + v5.activate(get5) + + v6 = gr.RPC_get_vector_gr_complex("pyland", "cvec", "unit_6_gr_complex_vector", + "Python Exported Complex Vector", [], [], [], + gr.DISPXYSCATTER) + v6.activate(get6) + + # print some variables locally + val = get1() + rval = v1.get() + self.assertEqual(val, rval) + + val = get2() + rval = v2.get() + self.assertEqual(val, rval) + + val = get3.pp() + rval = v3.get() + self.assertEqual(val+1, rval) + + val = get4() + rval = v4.get() + self.assertEqual(val, rval) + + val = get5() + rval = v5.get() + self.assertComplexTuplesAlmostEqual(val, rval, 5) + + val = get6() + rval = v6.get() + self.assertComplexTuplesAlmostEqual(val, rval, 5) + + def test_002(self): + data = range(1,9) + + self.src = gr.vector_source_c(data) + self.p1 = gr.ctrlport_probe_c("aaa","C++ exported variable") + self.p2 = gr.ctrlport_probe_c("bbb","C++ exported variable") + probe_name = self.p2.alias() + + self.tb.connect(self.src, self.p1) + self.tb.connect(self.src, self.p2) + self.tb.start() + + # Probes return complex values as list of floats with re, im + # Imaginary parts of this data set are 0. + expected_result = [1, 0, 2, 0, 3, 0, 4, 0, + 5, 0, 6, 0, 7, 0, 8, 0] + + # Make sure we have time for flowgraph to run + time.sleep(0.1) + + # Get available endpoint + ep = gr.rpcmanager_get().endpoints()[0] + + # Initialize a simple Ice client from endpoint + ic = Ice.initialize(sys.argv) + base = ic.stringToProxy(ep) + radio = GNURadio.ControlPortPrx.checkedCast(base) + + # Get all exported knobs + ret = radio.get([probe_name + "::bbb"]) + for name in ret.keys(): + result = ret[name].value + self.assertEqual(result, expected_result) + + self.tb.stop() + +if __name__ == '__main__': + gr_unittest.run(test_cpp_py_binding, "test_cpp_py_binding.xml") + diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding_set.py b/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding_set.py new file mode 100755 index 0000000000..8b1b15022c --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding_set.py @@ -0,0 +1,148 @@ +#!/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. +# + +# +# This program tests mixed python and c++ GRCP sets in a single app +# + +import Ice +import sys, time, random, numpy +from gnuradio import gr, gr_unittest + +from gnuradio.ctrlport import GNURadio +from gnuradio import ctrlport + +class inc_class: + def __init__(self,val): + self.val = val; + + def _get(self): + #print "returning get (val = %s)"%(str(self.val)); + return self.val; + + def _set(self,val): + #print "updating val to %s"%(str(val)); + self.val = val; + return; + +getset1 = inc_class(10); +getset2 = inc_class(100.0); +getset3 = inc_class("test"); + +class test_cpp_py_binding_set(gr_unittest.TestCase): + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_001(self): + + g1 = gr.RPC_get_int("pyland", "v1", "unit_1_int", + "Python Exported Int", 0, 100, 10, + gr.DISPNULL) + g1.activate(getset1._get) + s1 = gr.RPC_get_int("pyland", "v1", "unit_1_int", + "Python Exported Int", 0, 100, 10, + gr.DISPNULL) + s1.activate(getset1._set) + time.sleep(0.01) + + # test int variables + getset1._set(21) + val = getset1._get() + rval = g1.get() + self.assertEqual(val, rval) + + g2 = gr.RPC_get_float("pyland", "v2", "unit_2_float", + "Python Exported Float", -100, 1000.0, 100.0, + gr.DISPNULL) + g2.activate(getset2._get) + s2 = gr.RPC_get_float("pyland", "v2", "unit_2_float", + "Python Exported Float", -100, 1000.0, 100.0, + gr.DISPNULL) + s2.activate(getset2._set) + time.sleep(0.01) + + # test float variables + getset2._set(123.456) + val = getset2._get() + rval = g2.get() + self.assertAlmostEqual(val, rval, 4) + + g3 = gr.RPC_get_string("pyland", "v3", "unit_3_string", + "Python Exported String", "", "", "", + gr.DISPNULL) + g3.activate(getset3._get) + s3 = gr.RPC_get_string("pyland", "v3", "unit_3_string", + "Python Exported String", "", "", "", + gr.DISPNULL) + s3.activate(getset3._set) + time.sleep(0.01) + + # test string variables + getset3._set("third test") + val = getset3._get() + rval = g3.get() + self.assertEqual(val, rval) + + + def test_002(self): + data = range(1, 10) + + self.src = gr.vector_source_c(data, True) + self.p = gr.nop(gr.sizeof_gr_complex) + self.p.set_ctrlport_test(0); + probe_info = self.p.alias() + + self.tb.connect(self.src, self.p) + + # Get available endpoint + ep = gr.rpcmanager_get().endpoints()[0] + + # Initialize a simple Ice client from endpoint + ic = Ice.initialize(sys.argv) + base = ic.stringToProxy(ep) + radio = GNURadio.ControlPortPrx.checkedCast(base) + + self.tb.start() + + # Make sure we have time for flowgraph to run + time.sleep(0.1) + + # Get all exported knobs + key_name_test = probe_info+"::test" + ret = radio.get([key_name_test,]) + + ret[key_name_test].value = 10 + radio.set({key_name_test: ret[key_name_test]}) + + ret = radio.get([]) + result_test = ret[key_name_test].value + self.assertEqual(result_test, 10) + + self.tb.stop() + self.tb.wait() + +if __name__ == '__main__': + gr_unittest.run(test_cpp_py_binding_set, "test_cpp_py_binding_set.xml") + diff --git a/gnuradio-core/src/python/gnuradio/eng_notation.py b/gnuradio-core/src/python/gnuradio/eng_notation.py index c552a45f55..d23f9005f0 100644 --- a/gnuradio-core/src/python/gnuradio/eng_notation.py +++ b/gnuradio-core/src/python/gnuradio/eng_notation.py @@ -18,6 +18,9 @@ # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # +""" +Display numbers as strings using engineering notation. +""" scale_factor = {} scale_factor['E'] = 1e18 diff --git a/gnuradio-core/src/python/gnuradio/eng_option.py b/gnuradio-core/src/python/gnuradio/eng_option.py index 02e9b0b6df..5d8660f0f2 100644 --- a/gnuradio-core/src/python/gnuradio/eng_option.py +++ b/gnuradio-core/src/python/gnuradio/eng_option.py @@ -43,7 +43,8 @@ def check_subdev (option, opt, value): """ Value has the form: (A|B)(:0|1)? - @returns a 2-tuple (0|1, 0|1) + Returns: + a 2-tuple (0|1, 0|1) """ d = { 'A' : (0, 0), 'A:0' : (0, 0), 'A:1' : (0, 1), 'A:2' : (0, 2), 'B' : (1, 0), 'B:0' : (1, 0), 'B:1' : (1, 1), 'B:2' : (1, 2) } diff --git a/gnuradio-core/src/python/gnuradio/gr/__init__.py b/gnuradio-core/src/python/gnuradio/gr/__init__.py index f1b971e62d..e4dca5d98f 100644 --- a/gnuradio-core/src/python/gnuradio/gr/__init__.py +++ b/gnuradio-core/src/python/gnuradio/gr/__init__.py @@ -21,6 +21,10 @@ # The presence of this file turns this directory into a Python package +""" +Core contents. +""" + # This is the main GNU Radio python module. # We pull the swig output and the other modules into the gnuradio.gr namespace @@ -31,19 +35,5 @@ from top_block import * from gateway import basic_block, sync_block, decim_block, interp_block from tag_utils import tag_to_python, tag_to_pmt -# create a couple of aliases -serial_to_parallel = stream_to_vector -parallel_to_serial = vector_to_stream - # Force the preference database to be initialized from prefs import prefs - -#alias old gr_add_vXX and gr_multiply_vXX -add_vcc = add_cc -add_vff = add_ff -add_vii = add_ii -add_vss = add_ss -multiply_vcc = multiply_cc -multiply_vff = multiply_ff -multiply_vii = multiply_ii -multiply_vss = multiply_ss diff --git a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py index b957822381..ff39b3e709 100644 --- a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py +++ b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py @@ -20,6 +20,7 @@ # from gnuradio_core import hier_block2_swig + try: import pmt except ImportError: @@ -35,7 +36,9 @@ except ImportError: # class hier_block2(object): """ - Python wrapper around the C++ hierarchical block implementation. + Subclass this to create a python hierarchical block. + + This is a python wrapper around the C++ hierarchical block implementation. Provides convenience functions and allows proper Python subclassing. """ @@ -122,8 +125,8 @@ class hier_block2(object): self.primitive_msg_disconnect(src.to_basic_block(), srcport, dst.to_basic_block(), dstport); def message_port_register_hier_in(self, portname): - self.primitive_message_port_register_hier_in(pmt.pmt_intern(portname)); + self.primitive_message_port_register_hier_in(pmt.intern(portname)); def message_port_register_hier_out(self, portname): - self.primitive_message_port_register_hier_out(pmt.pmt_intern(portname)); + self.primitive_message_port_register_hier_out(pmt.intern(portname)); diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py b/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py deleted file mode 100755 index 7ccbbe8ad4..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py +++ /dev/null @@ -1,163 +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 - -class test_add_and_friends (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def help_ii (self, src_data, exp_data, op): - for s in zip (range (len (src_data)), src_data): - src = gr.vector_source_i (s[1]) - self.tb.connect (src, (op, s[0])) - dst = gr.vector_sink_i () - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (exp_data, result_data) - - def help_ff (self, src_data, exp_data, op): - for s in zip (range (len (src_data)), src_data): - src = gr.vector_source_f (s[1]) - self.tb.connect (src, (op, s[0])) - dst = gr.vector_sink_f () - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (exp_data, result_data) - - def help_cc (self, src_data, exp_data, op): - for s in zip (range (len (src_data)), src_data): - src = gr.vector_source_c (s[1]) - self.tb.connect (src, (op, s[0])) - dst = gr.vector_sink_c () - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (exp_data, result_data) - - def test_add_const_ii (self): - src_data = (1, 2, 3, 4, 5) - expected_result = (6, 7, 8, 9, 10) - op = gr.add_const_ii (5) - self.help_ii ((src_data,), expected_result, op) - - def test_add_const_cc (self): - src_data = (1, 2, 3, 4, 5) - expected_result = (1+5j, 2+5j, 3+5j, 4+5j, 5+5j) - op = gr.add_const_cc (5j) - self.help_cc ((src_data,), expected_result, op) - - def test_mult_const_ii (self): - src_data = (-1, 0, 1, 2, 3) - expected_result = (-5, 0, 5, 10, 15) - op = gr.multiply_const_ii (5) - self.help_ii ((src_data,), expected_result, op) - - def test_mult_const_ff (self): - src_data = (-1, 0, 1, 2, 3) - expected_result = (-5, 0, 5, 10, 15) - op = gr.multiply_const_cc (5) - self.help_cc ((src_data,), expected_result, op) - - def test_mult_const_cc (self): - src_data = (-1-1j, 0+0j, 1+1j, 2+2j, 3+3j) - expected_result = (-5-5j, 0+0j, 5+5j, 10+10j, 15+15j) - op = gr.multiply_const_cc (5) - self.help_cc ((src_data,), expected_result, op) - - def test_mult_const_cc2 (self): - src_data = (-1-1j, 0+0j, 1+1j, 2+2j, 3+3j) - expected_result = (-3-7j, 0+0j, 3+7j, 6+14j, 9+21j) - op = gr.multiply_const_cc (5+2j) - self.help_cc ((src_data,), expected_result, op) - - def test_add_ii (self): - src1_data = (1, 2, 3, 4, 5) - src2_data = (8, -3, 4, 8, 2) - expected_result = (9, -1, 7, 12, 7) - op = gr.add_ii () - self.help_ii ((src1_data, src2_data), - expected_result, op) - - def test_mult_ii (self): - src1_data = (1, 2, 3, 4, 5) - src2_data = (8, -3, 4, 8, 2) - expected_result = (8, -6, 12, 32, 10) - op = gr.multiply_ii () - self.help_ii ((src1_data, src2_data), - expected_result, op) - - def test_mult_ff (self): - src1_data = (1, 2, 3, 4, 5) - src2_data = (8, -3, 4, 8, 2) - expected_result = (8, -6, 12, 32, 10) - op = gr.multiply_ff () - self.help_ff ((src1_data, src2_data), - expected_result, op) - - def test_mult_cc (self): - src1_data = (1+1j, 2+2j, 3+3j, 4+4j, 5+5j) - src2_data = (8, -3, 4, 8, 2) - expected_result = (8+8j, -6-6j, 12+12j, 32+32j, 10+10j) - op = gr.multiply_cc () - self.help_cc ((src1_data, src2_data), - expected_result, op) - - def test_sub_ii_1 (self): - src1_data = (1, 2, 3, 4, 5) - expected_result = (-1, -2, -3, -4, -5) - op = gr.sub_ii () - self.help_ii ((src1_data,), - expected_result, op) - - def test_sub_ii_2 (self): - src1_data = (1, 2, 3, 4, 5) - src2_data = (8, -3, 4, 8, 2) - expected_result = (-7, 5, -1, -4, 3) - op = gr.sub_ii () - self.help_ii ((src1_data, src2_data), - expected_result, op) - - def test_div_ff_1 (self): - src1_data = (1, 2, 4, -8) - expected_result = (1, 0.5, 0.25, -.125) - op = gr.divide_ff () - self.help_ff ((src1_data,), - expected_result, op) - - def test_div_ff_2 (self): - src1_data = ( 5, 9, -15, 1024) - src2_data = (10, 3, -5, 64) - expected_result = (0.5, 3, 3, 16) - op = gr.divide_ff () - self.help_ff ((src1_data, src2_data), - expected_result, op) - - -if __name__ == '__main__': - gr_unittest.run(test_add_and_friends, "test_add_and_friends.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py b/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py deleted file mode 100755 index c8df47b392..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py +++ /dev/null @@ -1,353 +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 - -class test_add_v_and_friends(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def help_ss(self, size, src_data, exp_data, op): - for s in zip(range (len (src_data)), src_data): - src = gr.vector_source_s(s[1]) - srcv = gr.stream_to_vector(gr.sizeof_short, size) - self.tb.connect(src, srcv) - self.tb.connect(srcv, (op, s[0])) - rhs = gr.vector_to_stream(gr.sizeof_short, size) - dst = gr.vector_sink_s() - self.tb.connect(op, rhs, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(exp_data, result_data) - - def help_ii(self, size, src_data, exp_data, op): - for s in zip(range (len (src_data)), src_data): - src = gr.vector_source_i(s[1]) - srcv = gr.stream_to_vector(gr.sizeof_int, size) - self.tb.connect(src, srcv) - self.tb.connect(srcv, (op, s[0])) - rhs = gr.vector_to_stream(gr.sizeof_int, size) - dst = gr.vector_sink_i() - self.tb.connect(op, rhs, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(exp_data, result_data) - - def help_ff(self, size, src_data, exp_data, op): - for s in zip(range (len (src_data)), src_data): - src = gr.vector_source_f(s[1]) - srcv = gr.stream_to_vector(gr.sizeof_float, size) - self.tb.connect(src, srcv) - self.tb.connect(srcv, (op, s[0])) - rhs = gr.vector_to_stream(gr.sizeof_float, size) - dst = gr.vector_sink_f() - self.tb.connect(op, rhs, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(exp_data, result_data) - - def help_cc(self, size, src_data, exp_data, op): - for s in zip(range (len (src_data)), src_data): - src = gr.vector_source_c(s[1]) - srcv = gr.stream_to_vector(gr.sizeof_gr_complex, size) - self.tb.connect(src, srcv) - self.tb.connect(srcv, (op, s[0])) - rhs = gr.vector_to_stream(gr.sizeof_gr_complex, size) - dst = gr.vector_sink_c() - self.tb.connect(op, rhs, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(exp_data, result_data) - - def help_const_ss(self, src_data, exp_data, op): - src = gr.vector_source_s(src_data) - srcv = gr.stream_to_vector(gr.sizeof_short, len(src_data)) - rhs = gr.vector_to_stream(gr.sizeof_short, len(src_data)) - dst = gr.vector_sink_s() - self.tb.connect(src, srcv, op, rhs, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(exp_data, result_data) - - def help_const_ii(self, src_data, exp_data, op): - src = gr.vector_source_i(src_data) - srcv = gr.stream_to_vector(gr.sizeof_int, len(src_data)) - rhs = gr.vector_to_stream(gr.sizeof_int, len(src_data)) - dst = gr.vector_sink_i() - self.tb.connect(src, srcv, op, rhs, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(exp_data, result_data) - - def help_const_ff(self, src_data, exp_data, op): - src = gr.vector_source_f(src_data) - srcv = gr.stream_to_vector(gr.sizeof_float, len(src_data)) - rhs = gr.vector_to_stream(gr.sizeof_float, len(src_data)) - dst = gr.vector_sink_f() - self.tb.connect(src, srcv, op, rhs, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(exp_data, result_data) - - def help_const_cc(self, src_data, exp_data, op): - src = gr.vector_source_c(src_data) - srcv = gr.stream_to_vector(gr.sizeof_gr_complex, len(src_data)) - rhs = gr.vector_to_stream(gr.sizeof_gr_complex, len(src_data)) - dst = gr.vector_sink_c() - self.tb.connect(src, srcv, op, rhs, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(exp_data, result_data) - - - def test_add_vss_one(self): - src1_data = (1,) - src2_data = (2,) - src3_data = (3,) - expected_result = (6,) - op = gr.add_vss(1) - self.help_ss(1, (src1_data, src2_data, src3_data), expected_result, op) - - def test_add_vss_five(self): - src1_data = (1, 2, 3, 4, 5) - src2_data = (6, 7, 8, 9, 10) - src3_data = (11, 12, 13, 14, 15) - expected_result = (18, 21, 24, 27, 30) - op = gr.add_vss(5) - self.help_ss(5, (src1_data, src2_data, src3_data), expected_result, op) - - def test_add_vii_one(self): - src1_data = (1,) - src2_data = (2,) - src3_data = (3,) - expected_result = (6,) - op = gr.add_vii(1) - self.help_ii(1, (src1_data, src2_data, src3_data), expected_result, op) - - def test_add_vii_five(self): - src1_data = (1, 2, 3, 4, 5) - src2_data = (6, 7, 8, 9, 10) - src3_data = (11, 12, 13, 14, 15) - expected_result = (18, 21, 24, 27, 30) - op = gr.add_vii(5) - self.help_ii(5, (src1_data, src2_data, src3_data), expected_result, op) - - def test_add_vff_one(self): - src1_data = (1.0,) - src2_data = (2.0,) - src3_data = (3.0,) - expected_result = (6.0,) - op = gr.add_vff(1) - self.help_ff(1, (src1_data, src2_data, src3_data), expected_result, op) - - def test_add_vff_five(self): - src1_data = (1.0, 2.0, 3.0, 4.0, 5.0) - src2_data = (6.0, 7.0, 8.0, 9.0, 10.0) - src3_data = (11.0, 12.0, 13.0, 14.0, 15.0) - expected_result = (18.0, 21.0, 24.0, 27.0, 30.0) - op = gr.add_vff(5) - self.help_ff(5, (src1_data, src2_data, src3_data), expected_result, op) - - def test_add_vcc_one(self): - src1_data = (1.0+2.0j,) - src2_data = (3.0+4.0j,) - src3_data = (5.0+6.0j,) - expected_result = (9.0+12j,) - op = gr.add_vcc(1) - self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op) - - def test_add_vcc_five(self): - src1_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j) - src2_data = (11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j) - src3_data = (21.0+22.0j, 23.0+24.0j, 25.0+26.0j, 27.0+28.0j, 29.0+30.0j) - expected_result = (33.0+36.0j, 39.0+42.0j, 45.0+48.0j, 51.0+54.0j, 57.0+60.0j) - op = gr.add_vcc(5) - self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op) - - def test_add_const_vss_one(self): - src_data = (1,) - op = gr.add_const_vss((2,)) - exp_data = (3,) - self.help_const_ss(src_data, exp_data, op) - - def test_add_const_vss_five(self): - src_data = (1, 2, 3, 4, 5) - op = gr.add_const_vss((6, 7, 8, 9, 10)) - exp_data = (7, 9, 11, 13, 15) - self.help_const_ss(src_data, exp_data, op) - - def test_add_const_vii_one(self): - src_data = (1,) - op = gr.add_const_vii((2,)) - exp_data = (3,) - self.help_const_ii(src_data, exp_data, op) - - def test_add_const_vii_five(self): - src_data = (1, 2, 3, 4, 5) - op = gr.add_const_vii((6, 7, 8, 9, 10)) - exp_data = (7, 9, 11, 13, 15) - self.help_const_ii(src_data, exp_data, op) - - def test_add_const_vff_one(self): - src_data = (1.0,) - op = gr.add_const_vff((2.0,)) - exp_data = (3.0,) - self.help_const_ff(src_data, exp_data, op) - - def test_add_const_vff_five(self): - src_data = (1.0, 2.0, 3.0, 4.0, 5.0) - op = gr.add_const_vff((6.0, 7.0, 8.0, 9.0, 10.0)) - exp_data = (7.0, 9.0, 11.0, 13.0, 15.0) - self.help_const_ff(src_data, exp_data, op) - - def test_add_const_vcc_one(self): - src_data = (1.0+2.0j,) - op = gr.add_const_vcc((2.0+3.0j,)) - exp_data = (3.0+5.0j,) - self.help_const_cc(src_data, exp_data, op) - - def test_add_const_vcc_five(self): - src_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j) - op = gr.add_const_vcc((11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j)) - exp_data = (12.0+14.0j, 16.0+18.0j, 20.0+22.0j, 24.0+26.0j, 28.0+30.0j) - self.help_const_cc(src_data, exp_data, op) - - - def test_multiply_vss_one(self): - src1_data = (1,) - src2_data = (2,) - src3_data = (3,) - expected_result = (6,) - op = gr.multiply_vss(1) - self.help_ss(1, (src1_data, src2_data, src3_data), expected_result, op) - - def test_multiply_vss_five(self): - src1_data = (1, 2, 3, 4, 5) - src2_data = (6, 7, 8, 9, 10) - src3_data = (11, 12, 13, 14, 15) - expected_result = (66, 168, 312, 504, 750) - op = gr.multiply_vss(5) - self.help_ss(5, (src1_data, src2_data, src3_data), expected_result, op) - - def test_multiply_vii_one(self): - src1_data = (1,) - src2_data = (2,) - src3_data = (3,) - expected_result = (6,) - op = gr.multiply_vii(1) - self.help_ii(1, (src1_data, src2_data, src3_data), expected_result, op) - - def test_multiply_vii_five(self): - src1_data = (1, 2, 3, 4, 5) - src2_data = (6, 7, 8, 9, 10) - src3_data = (11, 12, 13, 14, 15) - expected_result = (66, 168, 312, 504, 750) - op = gr.multiply_vii(5) - self.help_ii(5, (src1_data, src2_data, src3_data), expected_result, op) - - def test_multiply_vff_one(self): - src1_data = (1.0,) - src2_data = (2.0,) - src3_data = (3.0,) - expected_result = (6.0,) - op = gr.multiply_vff(1) - self.help_ff(1, (src1_data, src2_data, src3_data), expected_result, op) - - def test_multiply_vff_five(self): - src1_data = (1.0, 2.0, 3.0, 4.0, 5.0) - src2_data = (6.0, 7.0, 8.0, 9.0, 10.0) - src3_data = (11.0, 12.0, 13.0, 14.0, 15.0) - expected_result = (66.0, 168.0, 312.0, 504.0, 750.0) - op = gr.multiply_vff(5) - self.help_ff(5, (src1_data, src2_data, src3_data), expected_result, op) - - def test_multiply_vcc_one(self): - src1_data = (1.0+2.0j,) - src2_data = (3.0+4.0j,) - src3_data = (5.0+6.0j,) - expected_result = (-85+20j,) - op = gr.multiply_vcc(1) - self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op) - - def test_multiply_vcc_five(self): - src1_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j) - src2_data = (11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j) - src3_data = (21.0+22.0j, 23.0+24.0j, 25.0+26.0j, 27.0+28.0j, 29.0+30.0j) - expected_result = (-1021.0+428.0j, -2647.0+1754.0j, -4945.0+3704.0j, -8011.0+6374.0j, -11941.0+9860.0j) - op = gr.multiply_vcc(5) - self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op) - - def test_multiply_const_vss_one(self): - src_data = (2,) - op = gr.multiply_const_vss((3,)) - exp_data = (6,) - self.help_const_ss(src_data, exp_data, op) - - def test_multiply_const_vss_five(self): - src_data = (1, 2, 3, 4, 5) - op = gr.multiply_const_vss((6, 7, 8, 9, 10)) - exp_data = (6, 14, 24, 36, 50) - self.help_const_ss(src_data, exp_data, op) - - def test_multiply_const_vii_one(self): - src_data = (2,) - op = gr.multiply_const_vii((3,)) - exp_data = (6,) - self.help_const_ii(src_data, exp_data, op) - - def test_multiply_const_vii_five(self): - src_data = (1, 2, 3, 4, 5) - op = gr.multiply_const_vii((6, 7, 8, 9, 10)) - exp_data = (6, 14, 24, 36, 50) - self.help_const_ii(src_data, exp_data, op) - - def test_multiply_const_vff_one(self): - src_data = (2.0,) - op = gr.multiply_const_vff((3.0,)) - exp_data = (6.0,) - self.help_const_ff(src_data, exp_data, op) - - def test_multiply_const_vff_five(self): - src_data = (1.0, 2.0, 3.0, 4.0, 5.0) - op = gr.multiply_const_vff((6.0, 7.0, 8.0, 9.0, 10.0)) - exp_data = (6.0, 14.0, 24.0, 36.0, 50.0) - self.help_const_ff(src_data, exp_data, op) - - def test_multiply_const_vcc_one(self): - src_data = (1.0+2.0j,) - op = gr.multiply_const_vcc((2.0+3.0j,)) - exp_data = (-4.0+7.0j,) - self.help_const_cc(src_data, exp_data, op) - - def test_multiply_const_vcc_five(self): - src_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j) - op = gr.multiply_const_vcc((11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j)) - exp_data = (-13.0+34.0j, -17.0+94.0j, -21.0+170.0j, -25.0+262.0j, -29.0+370.0j) - self.help_const_cc(src_data, exp_data, op) - - -if __name__ == '__main__': - gr_unittest.run(test_add_v_and_friends, "test_add_v_and_friends.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_agc.py b/gnuradio-core/src/python/gnuradio/gr/qa_agc.py deleted file mode 100755 index 9fd633576e..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_agc.py +++ /dev/null @@ -1,433 +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 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(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 = gr.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(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 = gr.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(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 = gr.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(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 = gr.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 = gr.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): # FIXME needs work - ''' Test complex feedforward agc with constant input ''' - input_data = 16*(0.0,) + 64*(1.0,) + 64*(0.0,) - expected_result = () - - src = gr.vector_source_c(input_data) - agc = gr.feedforward_agc_cc(16, 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 () - #self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4) - - -if __name__ == '__main__': - gr_unittest.run(test_agc, "test_agc.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py b/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py deleted file mode 100644 index 564eb620b0..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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 math - - -class test_arg_max (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - - def tearDown (self): - self.tb = None - - - def test_001(self): - tb = self.tb - - src1_data = (0,0.2,-0.3,0,12,0) - src2_data = (0,0.0,3.0,0,10,0) - src3_data = (0,0.0,3.0,0,1,0) - - src1 = gr.vector_source_f (src1_data) - s2v1 = gr.stream_to_vector(gr.sizeof_float, len(src1_data)) - tb.connect( src1, s2v1 ) - - src2 = gr.vector_source_f (src2_data) - s2v2 = gr.stream_to_vector(gr.sizeof_float, len(src1_data)) - tb.connect( src2, s2v2 ) - - src3 = gr.vector_source_f (src3_data) - s2v3 = gr.stream_to_vector(gr.sizeof_float, len(src1_data)) - tb.connect( src3, s2v3 ) - - dst1 = gr.vector_sink_s () - dst2 = gr.vector_sink_s () - argmax = gr.argmax_fs (len(src1_data)) - - tb.connect (s2v1, (argmax, 0)) - tb.connect (s2v2, (argmax, 1)) - tb.connect (s2v3, (argmax, 2)) - - tb.connect ((argmax,0), dst1) - tb.connect ((argmax,1), dst2) - - tb.run () - index = dst1.data () - source = dst2.data () - self.assertEqual ( index, (4,)) - self.assertEqual ( source, (0,)) - - - -if __name__ == '__main__': - gr_unittest.run(test_arg_max, "test_arg_max.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py b/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py deleted file mode 100755 index 8a6dd9056f..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py +++ /dev/null @@ -1,230 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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. -# - -from gnuradio import gr, gr_unittest -import random -import struct - -#import os -#print "pid =", os.getpid() -#raw_input("Attach gdb and press return...") - -""" -Note: The QA tests below have been disabled by renaming them from test_* -to xtest_*. See ticket:199 on http://gnuradio.org/trac/ticket/199 -""" - -class counter(gr.feval_dd): - def __init__(self, step_size=1): - gr.feval_dd.__init__(self) - self.step_size = step_size - self.count = 0 - - def eval(self, input): - #print "eval: self.count =", self.count - t = self.count - self.count = self.count + self.step_size - return t - - -class counter3(gr.feval_dd): - def __init__(self, f, step_size): - gr.feval_dd.__init__(self) - self.f = f - self.step_size = step_size - self.count = 0 - - def eval(self, input): - try: - #print "eval: self.count =", self.count - t = self.count - self.count = self.count + self.step_size - self.f(self.count) - except Exception, e: - print "Exception: ", e - return t - -def foobar3(new_t): - #print "foobar3: new_t =", new_t - pass - - -class counter4(gr.feval_dd): - def __init__(self, obj_instance, step_size): - gr.feval_dd.__init__(self) - self.obj_instance = obj_instance - self.step_size = step_size - self.count = 0 - - def eval(self, input): - try: - #print "eval: self.count =", self.count - t = self.count - self.count = self.count + self.step_size - self.obj_instance.foobar4(self.count) - except Exception, e: - print "Exception: ", e - return t - - -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) - self.data = struct.unpack('%df' % (self.vlen,), msg.to_string()) - -# FIXME: see ticket:199 -class xtest_bin_statistics(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block () - - def tearDown(self): - self.tb = None - - def xtest_001(self): - vlen = 4 - tune = counter(1) - tune_delay = 0 - dwell_delay = 1 - msgq = gr.msg_queue() - - src_data = tuple([float(x) for x in - ( 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16 - )]) - - expected_results = tuple([float(x) for x in - ( 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16 - )]) - - src = gr.vector_source_f(src_data, False) - s2v = gr.stream_to_vector(gr.sizeof_float, vlen) - stats = gr.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay) - self.tb.connect(src, s2v, stats) - self.tb.run() - self.assertEqual(4, msgq.count()) - for i in range(4): - m = parse_msg(msgq.delete_head()) - #print "m =", m.center_freq, m.data - self.assertEqual(expected_results[vlen*i:vlen*i + vlen], m.data) - - def xtest_002(self): - vlen = 4 - tune = counter(1) - tune_delay = 1 - dwell_delay = 2 - msgq = gr.msg_queue() - - src_data = tuple([float(x) for x in - ( 1, 2, 3, 4, - 9, 6, 11, 8, - 5, 10, 7, 12, - 13, 14, 15, 16 - )]) - - expected_results = tuple([float(x) for x in - ( 9, 10, 11, 12)]) - - src = gr.vector_source_f(src_data, False) - s2v = gr.stream_to_vector(gr.sizeof_float, vlen) - stats = gr.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay) - self.tb.connect(src, s2v, stats) - self.tb.run() - self.assertEqual(1, msgq.count()) - for i in range(1): - m = parse_msg(msgq.delete_head()) - #print "m =", m.center_freq, m.data - self.assertEqual(expected_results[vlen*i:vlen*i + vlen], m.data) - - - - def xtest_003(self): - vlen = 4 - tune = counter3(foobar3, 1) - tune_delay = 1 - dwell_delay = 2 - msgq = gr.msg_queue() - - src_data = tuple([float(x) for x in - ( 1, 2, 3, 4, - 9, 6, 11, 8, - 5, 10, 7, 12, - 13, 14, 15, 16 - )]) - - expected_results = tuple([float(x) for x in - ( 9, 10, 11, 12)]) - - src = gr.vector_source_f(src_data, False) - s2v = gr.stream_to_vector(gr.sizeof_float, vlen) - stats = gr.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay) - self.tb.connect(src, s2v, stats) - self.tb.run() - self.assertEqual(1, msgq.count()) - for i in range(1): - m = parse_msg(msgq.delete_head()) - #print "m =", m.center_freq, m.data - self.assertEqual(expected_results[vlen*i:vlen*i + vlen], m.data) - - - def foobar4(self, new_t): - #print "foobar4: new_t =", new_t - pass - - def xtest_004(self): - vlen = 4 - tune = counter4(self, 1) - tune_delay = 1 - dwell_delay = 2 - msgq = gr.msg_queue() - - src_data = tuple([float(x) for x in - ( 1, 2, 3, 4, - 9, 6, 11, 8, - 5, 10, 7, 12, - 13, 14, 15, 16 - )]) - - expected_results = tuple([float(x) for x in - ( 9, 10, 11, 12)]) - - src = gr.vector_source_f(src_data, False) - s2v = gr.stream_to_vector(gr.sizeof_float, vlen) - stats = gr.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay) - self.tb.connect(src, s2v, stats) - self.tb.run() - self.assertEqual(1, msgq.count()) - for i in range(1): - m = parse_msg(msgq.delete_head()) - #print "m =", m.center_freq, m.data - self.assertEqual(expected_results[vlen*i:vlen*i + vlen], m.data) - - -if __name__ == '__main__': - gr_unittest.run(xtest_bin_statistics, "test_bin_statistics.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py b/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py index 911879f6ff..2c8cba5439 100644 --- a/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py @@ -112,8 +112,8 @@ class tag_source(gr.sync_block): #make a new tag on the middle element every time work is called count = self.nitems_written(0) + num_output_items/2 - key = pmt.pmt_string_to_symbol("example_key") - value = pmt.pmt_string_to_symbol("example_value") + key = pmt.string_to_symbol("example_key") + value = pmt.string_to_symbol("example_value") self.add_item_tag(0, count, key, value) return num_output_items @@ -138,9 +138,9 @@ class tag_sink(gr.sync_block): tags = self.get_tags_in_range(0, nread, nread+num_input_items) for tag in tags: #print tag.offset - #print pmt.pmt_symbol_to_string(tag.key) - #print pmt.pmt_symbol_to_string(tag.value) - self.key = pmt.pmt_symbol_to_string(tag.key) + #print pmt.symbol_to_string(tag.key) + #print pmt.symbol_to_string(tag.value) + self.key = pmt.symbol_to_string(tag.key) return num_input_items @@ -158,6 +158,26 @@ class fc32_to_f32_2(gr.sync_block): output_items[0][::,1] = numpy.imag(input_items[0]) return len(output_items[0]) +class vector_to_stream(gr.interp_block): + def __init__(self, itemsize, nitems_per_block): + gr.interp_block.__init__( + self, + name = "vector_to_stream", + in_sig = [(itemsize, nitems_per_block)], + out_sig = [itemsize], + interp = nitems_per_block + ) + self.block_size = nitems_per_block + + def work(self, input_items, output_items): + n = 0 + for i in xrange(len(input_items[0])): + for j in xrange(self.block_size): + output_items[0][n] = input_items[0][i][j] + n += 1 + + return len(output_items[0]) + class test_block_gateway(gr_unittest.TestCase): def test_add_f32(self): @@ -224,7 +244,7 @@ class test_block_gateway(gr_unittest.TestCase): tb = gr.top_block() src = gr.vector_source_c([1+2j, 3+4j, 5+6j, 7+8j, 9+10j], False) convert = fc32_to_f32_2() - v2s = gr.vector_to_stream(gr.sizeof_float, 2) + v2s = vector_to_stream(numpy.float32, 2) sink = gr.vector_sink_f() tb.connect(src, convert, v2s, sink) tb.run() diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py b/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py deleted file mode 100755 index d7d134dcbe..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py +++ /dev/null @@ -1,162 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,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 - -class test_boolean_operators (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def help_ss (self, src_data, exp_data, op): - for s in zip (range (len (src_data)), src_data): - src = gr.vector_source_s (s[1]) - self.tb.connect (src, (op, s[0])) - dst = gr.vector_sink_s () - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (exp_data, result_data) - - def help_bb (self, src_data, exp_data, op): - for s in zip (range (len (src_data)), src_data): - src = gr.vector_source_b (s[1]) - self.tb.connect (src, (op, s[0])) - dst = gr.vector_sink_b () - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (exp_data, result_data) - - def help_ii (self, src_data, exp_data, op): - for s in zip (range (len (src_data)), src_data): - src = gr.vector_source_i (s[1]) - self.tb.connect (src, (op, s[0])) - dst = gr.vector_sink_i () - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (exp_data, result_data) - - def test_xor_ss (self): - src1_data = (1, 2, 3, 0x5004, 0x1150) - src2_data = (8, 2, 1 , 0x0508, 0x1105) - expected_result = (9, 0, 2, 0x550C, 0x0055) - op = gr.xor_ss () - self.help_ss ((src1_data, src2_data), - expected_result, op) - - def test_xor_bb (self): - src1_data = (1, 2, 3, 4, 0x50) - src2_data = (8, 2, 1 , 8, 0x05) - expected_result = (9, 0, 2, 0xC, 0x55) - op = gr.xor_bb () - self.help_bb ((src1_data, src2_data), - expected_result, op) - - - def test_xor_ii (self): - src1_data = (1, 2, 3, 0x5000004, 0x11000050) - src2_data = (8, 2, 1 , 0x0500008, 0x11000005) - expected_result = (9, 0, 2, 0x550000C, 0x00000055) - op = gr.xor_ii () - self.help_ii ((src1_data, src2_data), - expected_result, op) - - def test_and_ss (self): - src1_data = (1, 2, 3, 0x5004, 0x1150) - src2_data = (8, 2, 1 , 0x0508, 0x1105) - expected_result = (0, 2, 1, 0x0000, 0x1100) - op = gr.and_ss () - self.help_ss ((src1_data, src2_data), - expected_result, op) - - def test_and_bb (self): - src1_data = (1, 2, 2, 3, 0x04, 0x50) - src2_data = (8, 2, 2, 1, 0x08, 0x05) - src3_data = (8, 2, 1, 1, 0x08, 0x05) - expected_result = (0, 2, 0, 1, 0x00, 0x00) - op = gr.and_bb () - self.help_bb ((src1_data, src2_data, src3_data), - expected_result, op) - - def test_and_ii (self): - src1_data = (1, 2, 3, 0x50005004, 0x11001150) - src2_data = (8, 2, 1 , 0x05000508, 0x11001105) - expected_result = (0, 2, 1, 0x00000000, 0x11001100) - op = gr.and_ii () - self.help_ii ((src1_data, src2_data), - expected_result, op) - - def test_or_ss (self): - src1_data = (1, 2, 3, 0x5004, 0x1150) - src2_data = (8, 2, 1 , 0x0508, 0x1105) - expected_result = (9, 2, 3, 0x550C, 0x1155) - op = gr.or_ss () - self.help_ss ((src1_data, src2_data), - expected_result, op) - - def test_or_bb (self): - src1_data = (1, 2, 2, 3, 0x04, 0x50) - src2_data = (8, 2, 2, 1 , 0x08, 0x05) - src3_data = (8, 2, 1, 1 , 0x08, 0x05) - expected_result = (9, 2, 3, 3, 0x0C, 0x55) - op = gr.or_bb () - self.help_bb ((src1_data, src2_data, src3_data), - expected_result, op) - - def test_or_ii (self): - src1_data = (1, 2, 3, 0x50005004, 0x11001150) - src2_data = (8, 2, 1 , 0x05000508, 0x11001105) - expected_result = (9, 2, 3, 0x5500550C, 0x11001155) - op = gr.or_ii () - self.help_ii ((src1_data, src2_data), - expected_result, op) - - def test_not_ss (self): - src1_data = (1, 2, 3, 0x5004, 0x1150) - expected_result = (~1, ~2, ~3, ~0x5004, ~0x1150) - op = gr.not_ss () - self.help_ss ((((src1_data),)), - expected_result, op) - - def test_not_bb (self): - src1_data = (1, 2, 2, 3, 0x04, 0x50) - expected_result = (0xFE, 0xFD, 0xFD, 0xFC, 0xFB, 0xAF) - op = gr.not_bb () - self.help_bb (((src1_data), ), - expected_result, op) - - def test_not_ii (self): - src1_data = (1, 2, 3, 0x50005004, 0x11001150) - expected_result = (~1 , ~2, ~3, ~0x50005004, ~0x11001150) - op = gr.not_ii () - self.help_ii (((src1_data),), - expected_result, op) - - - -if __name__ == '__main__': - gr_unittest.run(test_boolean_operators, "test_boolean_operators.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_conjugate.py b/gnuradio-core/src/python/gnuradio/gr/qa_conjugate.py deleted file mode 100644 index 17fa891e21..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_conjugate.py +++ /dev/null @@ -1,53 +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 - -class test_conjugate (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_000 (self): - src_data = (-2-2j, -1-1j, -2+2j, -1+1j, - 2-2j, 1-1j, 2+2j, 1+1j, - 0+0j) - - exp_data = (-2+2j, -1+1j, -2-2j, -1-1j, - 2+2j, 1+1j, 2-2j, 1-1j, - 0-0j) - - src = gr.vector_source_c(src_data) - op = gr.conjugate_cc () - dst = gr.vector_sink_c () - - self.tb.connect(src, op) - self.tb.connect(op, dst) - self.tb.run() - result_data = dst.data () - self.assertEqual (exp_data, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_conjugate, "test_conjugate.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py b/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py deleted file mode 100755 index 1757358676..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py +++ /dev/null @@ -1,108 +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 - -class test_dc_blocker(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - ''' Test impulse response - long form, cc ''' - src_data = [1,] + 100*[0,] - expected_result = ((-0.02072429656982422+0j), (-0.02081298828125+0j), - (0.979156494140625+0j), (-0.02081298828125+0j), - (-0.02072429656982422+0j)) - - src = gr.vector_source_c(src_data) - op = gr.dc_blocker_cc(32, True) - dst = gr.vector_sink_c() - - self.tb.connect (src, op, dst) - self.tb.run() - - # only test samples around 2D-2 - result_data = dst.data()[60:65] - self.assertComplexTuplesAlmostEqual (expected_result, result_data) - - def test_002(self): - ''' Test impulse response - short form, cc ''' - src_data = [1,] + 100*[0,] - expected_result = ((-0.029296875+0j), (-0.0302734375+0j), - (0.96875+0j), (-0.0302734375+0j), - (-0.029296875+0j)) - - src = gr.vector_source_c(src_data) - op = gr.dc_blocker_cc(32, False) - dst = gr.vector_sink_c() - - self.tb.connect (src, op, dst) - self.tb.run() - - # only test samples around D-1 - result_data = dst.data()[29:34] - self.assertComplexTuplesAlmostEqual (expected_result, result_data) - - - def test_003(self): - ''' Test impulse response - long form, ff ''' - src_data = [1,] + 100*[0,] - expected_result = ((-0.02072429656982422), (-0.02081298828125), - (0.979156494140625), (-0.02081298828125), - (-0.02072429656982422)) - - src = gr.vector_source_f(src_data) - op = gr.dc_blocker_ff(32, True) - dst = gr.vector_sink_f() - - self.tb.connect (src, op, dst) - self.tb.run() - - # only test samples around 2D-2 - result_data = dst.data()[60:65] - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_004(self): - ''' Test impulse response - short form, ff ''' - src_data = [1,] + 100*[0,] - expected_result = ((-0.029296875), (-0.0302734375), - (0.96875), (-0.0302734375), - (-0.029296875)) - - src = gr.vector_source_f(src_data) - op = gr.dc_blocker_ff(32, False) - dst = gr.vector_sink_f() - - self.tb.connect (src, op, dst) - self.tb.run() - - # only test samples around D-1 - result_data = dst.data()[29:34] - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_dc_blocker, "test_dc_blocker.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py b/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py deleted file mode 100755 index c1fe2a7000..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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. -# - -from gnuradio import gr, gr_unittest -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 = gr.diff_encoder_bb(modulus) - dec = gr.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 = gr.diff_encoder_bb(modulus) - dec = gr.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 = gr.diff_encoder_bb(modulus) - dec = gr.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/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py deleted file mode 100755 index 41f96aa616..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py +++ /dev/null @@ -1,50 +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 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 = gr.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/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py b/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py deleted file mode 100755 index 29122ff3ed..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py +++ /dev/null @@ -1,50 +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 - -class test_ccsds_27 (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def xtest_ccsds_27 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - expected = (0, 0, 0, 0, 1, 2, 3, 4, 5, 6) - src = gr.vector_source_b(src_data) - enc = gr.encode_ccsds_27_bb() - b2f = gr.char_to_float() - add = gr.add_const_ff(-0.5) - mul = gr.multiply_const_ff(2.0) - dec = gr.decode_ccsds_27_fb() - dst = gr.vector_sink_b() - self.tb.connect(src, enc, b2f, add, mul, dec, dst) - self.tb.run() - dst_data = dst.data() - self.assertEqual(expected, dst_data) - - -if __name__ == '__main__': - gr_unittest.run(test_ccsds_27, "test_ccsds_27.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fft.py b/gnuradio-core/src/python/gnuradio/gr/qa_fft.py deleted file mode 100755 index 693d0e67c5..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_fft.py +++ /dev/null @@ -1,212 +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 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, gr_unittest -import sys -import random - -primes = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53, - 59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131, - 137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223, - 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311) - - -class test_fft(gr_unittest.TestCase): - - def setUp(self): - pass - - def tearDown(self): - pass - - def assert_fft_ok2(self, expected_result, result_data): - expected_result = expected_result[:len(result_data)] - self.assertComplexTuplesAlmostEqual2 (expected_result, result_data, - abs_eps=1e-9, rel_eps=4e-4) - - def assert_fft_float_ok2(self, expected_result, result_data, abs_eps=1e-9, rel_eps=4e-4): - expected_result = expected_result[:len(result_data)] - self.assertFloatTuplesAlmostEqual2 (expected_result, result_data, - abs_eps, rel_eps) - - def test_001(self): - tb = gr.top_block() - fft_size = 32 - src_data = tuple([complex(primes[2*i], primes[2*i+1]) for i in range(fft_size)]) - - expected_result = ((4377+4516j), - (-1706.1268310546875+1638.4256591796875j), - (-915.2083740234375+660.69427490234375j), - (-660.370361328125+381.59600830078125j), - (-499.96044921875+238.41630554199219j), - (-462.26748657226562+152.88948059082031j), - (-377.98440551757812+77.5928955078125j), - (-346.85821533203125+47.152004241943359j), - (-295+20j), - (-286.33609008789062-22.257017135620117j), - (-271.52999877929688-33.081821441650391j), - (-224.6358642578125-67.019538879394531j), - (-244.24473571777344-91.524826049804688j), - (-203.09068298339844-108.54627227783203j), - (-198.45195007324219-115.90768432617188j), - (-182.97744750976562-128.12318420410156j), - (-167-180j), - (-130.33688354492188-173.83778381347656j), - (-141.19784545898438-190.28807067871094j), - (-111.09677124023438-214.48896789550781j), - (-70.039543151855469-242.41630554199219j), - (-68.960540771484375-228.30015563964844j), - (-53.049201965332031-291.47097778320312j), - (-28.695289611816406-317.64553833007812j), - (57-300j), - (45.301143646240234-335.69509887695312j), - (91.936195373535156-373.32437133789062j), - (172.09465026855469-439.275146484375j), - (242.24473571777344-504.47515869140625j), - (387.81732177734375-666.6788330078125j), - (689.48553466796875-918.2142333984375j), - (1646.539306640625-1694.1956787109375j)) - - src = gr.vector_source_c(src_data) - s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_size) - fft = gr.fft_vcc(fft_size, True, [], False) - v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_size) - dst = gr.vector_sink_c() - tb.connect(src, s2v, fft, v2s, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - #self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - self.assert_fft_ok2(expected_result, result_data) - - def test_002(self): - tb = gr.top_block() - fft_size = 32 - - tmp_data = ((4377+4516j), - (-1706.1268310546875+1638.4256591796875j), - (-915.2083740234375+660.69427490234375j), - (-660.370361328125+381.59600830078125j), - (-499.96044921875+238.41630554199219j), - (-462.26748657226562+152.88948059082031j), - (-377.98440551757812+77.5928955078125j), - (-346.85821533203125+47.152004241943359j), - (-295+20j), - (-286.33609008789062-22.257017135620117j), - (-271.52999877929688-33.081821441650391j), - (-224.6358642578125-67.019538879394531j), - (-244.24473571777344-91.524826049804688j), - (-203.09068298339844-108.54627227783203j), - (-198.45195007324219-115.90768432617188j), - (-182.97744750976562-128.12318420410156j), - (-167-180j), - (-130.33688354492188-173.83778381347656j), - (-141.19784545898438-190.28807067871094j), - (-111.09677124023438-214.48896789550781j), - (-70.039543151855469-242.41630554199219j), - (-68.960540771484375-228.30015563964844j), - (-53.049201965332031-291.47097778320312j), - (-28.695289611816406-317.64553833007812j), - (57-300j), - (45.301143646240234-335.69509887695312j), - (91.936195373535156-373.32437133789062j), - (172.09465026855469-439.275146484375j), - (242.24473571777344-504.47515869140625j), - (387.81732177734375-666.6788330078125j), - (689.48553466796875-918.2142333984375j), - (1646.539306640625-1694.1956787109375j)) - - src_data = tuple([x/fft_size for x in tmp_data]) - - expected_result = tuple([complex(primes[2*i], primes[2*i+1]) for i in range(fft_size)]) - - src = gr.vector_source_c(src_data) - s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_size) - fft = gr.fft_vcc(fft_size, False, [], False) - v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_size) - dst = gr.vector_sink_c() - tb.connect(src, s2v, fft, v2s, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - #self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - self.assert_fft_ok2(expected_result, result_data) - - def test_003(self): - # Same test as above, only use 2 threads - - tb = gr.top_block() - fft_size = 32 - - tmp_data = ((4377+4516j), - (-1706.1268310546875+1638.4256591796875j), - (-915.2083740234375+660.69427490234375j), - (-660.370361328125+381.59600830078125j), - (-499.96044921875+238.41630554199219j), - (-462.26748657226562+152.88948059082031j), - (-377.98440551757812+77.5928955078125j), - (-346.85821533203125+47.152004241943359j), - (-295+20j), - (-286.33609008789062-22.257017135620117j), - (-271.52999877929688-33.081821441650391j), - (-224.6358642578125-67.019538879394531j), - (-244.24473571777344-91.524826049804688j), - (-203.09068298339844-108.54627227783203j), - (-198.45195007324219-115.90768432617188j), - (-182.97744750976562-128.12318420410156j), - (-167-180j), - (-130.33688354492188-173.83778381347656j), - (-141.19784545898438-190.28807067871094j), - (-111.09677124023438-214.48896789550781j), - (-70.039543151855469-242.41630554199219j), - (-68.960540771484375-228.30015563964844j), - (-53.049201965332031-291.47097778320312j), - (-28.695289611816406-317.64553833007812j), - (57-300j), - (45.301143646240234-335.69509887695312j), - (91.936195373535156-373.32437133789062j), - (172.09465026855469-439.275146484375j), - (242.24473571777344-504.47515869140625j), - (387.81732177734375-666.6788330078125j), - (689.48553466796875-918.2142333984375j), - (1646.539306640625-1694.1956787109375j)) - - src_data = tuple([x/fft_size for x in tmp_data]) - - expected_result = tuple([complex(primes[2*i], primes[2*i+1]) for i in range(fft_size)]) - - nthreads = 2 - - src = gr.vector_source_c(src_data) - s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_size) - fft = gr.fft_vcc(fft_size, False, [], False, nthreads) - v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_size) - dst = gr.vector_sink_c() - tb.connect(src, s2v, fft, v2s, dst) - tb.run() - result_data = dst.data() - self.assert_fft_ok2(expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_fft, "test_fft.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py b/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py deleted file mode 100755 index c0aadc306f..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py +++ /dev/null @@ -1,383 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,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 sys -import random - -def make_random_complex_tuple(L): - result = [] - for x in range(L): - result.append(complex(random.uniform(-1000,1000), - random.uniform(-1000,1000))) - return tuple(result) - -def make_random_float_tuple(L): - result = [] - for x in range(L): - result.append(float(int(random.uniform(-1000,1000)))) - return tuple(result) - - -def reference_filter_ccc(dec, taps, input): - """ - compute result using conventional fir filter - """ - tb = gr.top_block() - #src = gr.vector_source_c(((0,) * (len(taps) - 1)) + input) - src = gr.vector_source_c(input) - op = gr.fir_filter_ccc(dec, taps) - dst = gr.vector_sink_c() - tb.connect(src, op, dst) - tb.run() - return dst.data() - -def reference_filter_fff(dec, taps, input): - """ - compute result using conventional fir filter - """ - tb = gr.top_block() - #src = gr.vector_source_f(((0,) * (len(taps) - 1)) + input) - src = gr.vector_source_f(input) - op = gr.fir_filter_fff(dec, taps) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - return dst.data() - - -def print_complex(x): - for i in x: - i = complex(i) - sys.stdout.write("(%6.3f,%6.3fj), " % (i.real, i.imag)) - sys.stdout.write('\n') - - -class test_fft_filter(gr_unittest.TestCase): - - def setUp(self): - pass - - def tearDown(self): - pass - - def assert_fft_ok2(self, expected_result, result_data): - expected_result = expected_result[:len(result_data)] - self.assertComplexTuplesAlmostEqual2 (expected_result, result_data, - abs_eps=1e-9, rel_eps=4e-4) - - def assert_fft_float_ok2(self, expected_result, result_data, abs_eps=1e-9, rel_eps=4e-4): - expected_result = expected_result[:len(result_data)] - self.assertFloatTuplesAlmostEqual2 (expected_result, result_data, - abs_eps, rel_eps) - - #def test_ccc_000(self): - # self.assertRaises (RuntimeError, gr.fft_filter_ccc, 2, (1,)) - - def test_ccc_001(self): - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (1,) - expected_result = tuple([complex(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(1, taps) - dst = gr.vector_sink_c() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - - def test_ccc_002(self): - # Test nthreads - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (2,) - nthreads = 2 - expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(1, taps, nthreads) - dst = gr.vector_sink_c() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - def test_ccc_003(self): - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (2,) - expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(1, taps) - dst = gr.vector_sink_c() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - - def test_ccc_004(self): - random.seed(0) - for i in xrange(25): - # sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - src_len = 4*1024 - src_data = make_random_complex_tuple(src_len) - ntaps = int(random.uniform(2, 1000)) - taps = make_random_complex_tuple(ntaps) - expected_result = reference_filter_ccc(1, taps, src_data) - - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(1, taps) - dst = gr.vector_sink_c() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - del tb - - self.assert_fft_ok2(expected_result, result_data) - - def test_ccc_005(self): - random.seed(0) - for i in xrange(25): - # sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - dec = i + 1 - src_len = 4*1024 - src_data = make_random_complex_tuple(src_len) - ntaps = int(random.uniform(2, 100)) - taps = make_random_complex_tuple(ntaps) - expected_result = reference_filter_ccc(dec, taps, src_data) - - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(dec, taps) - dst = gr.vector_sink_c() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - del tb - result_data = dst.data() - - self.assert_fft_ok2(expected_result, result_data) - - def test_ccc_006(self): - # Test decimating with nthreads=2 - random.seed(0) - nthreads = 2 - for i in xrange(25): - # sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - dec = i + 1 - src_len = 4*1024 - src_data = make_random_complex_tuple(src_len) - ntaps = int(random.uniform(2, 100)) - taps = make_random_complex_tuple(ntaps) - expected_result = reference_filter_ccc(dec, taps, src_data) - - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(dec, taps, nthreads) - dst = gr.vector_sink_c() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - del tb - result_data = dst.data() - - self.assert_fft_ok2(expected_result, result_data) - - # ---------------------------------------------------------------- - # test _fff version - # ---------------------------------------------------------------- - - def test_fff_001(self): - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (1,) - expected_result = tuple([float(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5) - - - def test_fff_002(self): - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (2,) - expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5) - - def test_fff_003(self): - # Test 02 with nthreads - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (2,) - nthreads = 2 - expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(1, taps, nthreads) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5) - - def xtest_fff_004(self): - random.seed(0) - for i in xrange(25): - sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - src_len = 4096 - src_data = make_random_float_tuple(src_len) - ntaps = int(random.uniform(2, 1000)) - taps = make_random_float_tuple(ntaps) - expected_result = reference_filter_fff(1, taps, src_data) - - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - - #print "src_len =", src_len, " ntaps =", ntaps - try: - self.assert_fft_float_ok2(expected_result, result_data, abs_eps=1.0) - except: - expected = open('expected', 'w') - for x in expected_result: - expected.write(`x` + '\n') - actual = open('actual', 'w') - for x in result_data: - actual.write(`x` + '\n') - raise - - def xtest_fff_005(self): - random.seed(0) - for i in xrange(25): - sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - src_len = 4*1024 - src_data = make_random_float_tuple(src_len) - ntaps = int(random.uniform(2, 1000)) - taps = make_random_float_tuple(ntaps) - expected_result = reference_filter_fff(1, taps, src_data) - - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - - self.assert_fft_float_ok2(expected_result, result_data, abs_eps=2.0) - - def xtest_fff_006(self): - random.seed(0) - for i in xrange(25): - sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - dec = i + 1 - src_len = 4*1024 - src_data = make_random_float_tuple(src_len) - ntaps = int(random.uniform(2, 100)) - taps = make_random_float_tuple(ntaps) - expected_result = reference_filter_fff(dec, taps, src_data) - - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(dec, taps) - dst = gr.vector_sink_f() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - - self.assert_fft_float_ok2(expected_result, result_data) - - def xtest_fff_007(self): - # test decimation with nthreads - random.seed(0) - nthreads = 2 - for i in xrange(25): - sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - dec = i + 1 - src_len = 4*1024 - src_data = make_random_float_tuple(src_len) - ntaps = int(random.uniform(2, 100)) - taps = make_random_float_tuple(ntaps) - expected_result = reference_filter_fff(dec, taps, src_data) - - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(dec, taps, nthreads) - dst = gr.vector_sink_f() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - - self.assert_fft_float_ok2(expected_result, result_data) - - def test_fff_get0(self): - random.seed(0) - for i in xrange(25): - ntaps = int(random.uniform(2, 100)) - taps = make_random_float_tuple(ntaps) - - op = gr.fft_filter_fff(1, taps) - result_data = op.taps() - #print result_data - - self.assertEqual(taps, result_data) - - def test_ccc_get0(self): - random.seed(0) - for i in xrange(25): - ntaps = int(random.uniform(2, 100)) - taps = make_random_complex_tuple(ntaps) - - op = gr.fft_filter_ccc(1, taps) - result_data = op.taps() - #print result_data - - self.assertComplexTuplesAlmostEqual(taps, result_data, 4) - - -if __name__ == '__main__': - gr_unittest.run(test_fft_filter, "test_fft_filter.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py b/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py deleted file mode 100755 index 8d325fc3e6..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py +++ /dev/null @@ -1,317 +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 math - -class test_filter_delay_fc (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001_filter_delay_one_input (self): - - # expected result - expected_result = ( -1.4678005338941702e-11j, - -0.0011950774351134896j, - -0.0019336787518113852j, - -0.0034673355985432863j, - -0.0036765895783901215j, - -0.004916108213365078j, - -0.0042778430506587029j, - -0.006028641015291214j, - -0.005476709920912981j, - -0.0092810001224279404j, - -0.0095402700826525688j, - -0.016060983762145042j, - -0.016446959227323532j, - -0.02523401565849781j, - -0.024382550269365311j, - -0.035477779805660248j, - -0.033021725714206696j, - -0.048487484455108643j, - -0.04543270543217659j, - -0.069477587938308716j, - -0.066984444856643677j, - -0.10703597217798233j, - -0.10620346665382385j, - -0.1852707713842392j, - -0.19357112050056458j, - (7.2191945754696007e-09 -0.50004088878631592j), - (0.58778399229049683 -0.6155126690864563j), - (0.95105588436126709 -0.12377222627401352j), - (0.95105588436126709 +0.41524654626846313j), - (0.5877838134765625 +0.91611981391906738j), - (5.8516356205018383e-09 +1.0670661926269531j), - (-0.5877840518951416 +0.87856143712997437j), - (-0.95105588436126709 +0.35447561740875244j), - (-0.95105588436126709 -0.26055556535720825j), - (-0.5877838134765625 -0.77606213092803955j), - (-8.7774534307527574e-09 -0.96460390090942383j), - (0.58778399229049683 -0.78470128774642944j), - (0.95105588436126709 -0.28380891680717468j), - (0.95105588436126709 +0.32548999786376953j), - (0.5877838134765625 +0.82514488697052002j), - (1.4629089051254596e-08 +1.0096219778060913j), - (-0.5877840518951416 +0.81836479902267456j), - (-0.95105588436126709 +0.31451958417892456j), - (-0.95105588436126709 -0.3030143678188324j), - (-0.5877838134765625 -0.80480599403381348j), - (-1.7554906861505515e-08 -0.99516552686691284j), - (0.58778399229049683 -0.80540722608566284j), - (0.95105582475662231 -0.30557557940483093j), - (0.95105588436126709 +0.31097668409347534j), - (0.5877838134765625 +0.81027895212173462j), - (2.3406542482007353e-08 +1.0000816583633423j), - (-0.5877840518951416 +0.80908381938934326j), - (-0.95105588436126709 +0.30904293060302734j), - (-0.95105588436126709 -0.30904296040534973j), - (-0.5877838134765625 -0.80908387899398804j), - (-2.6332360292258272e-08 -1.0000815391540527j), - (0.58778399229049683 -0.80908381938934326j), - (0.95105582475662231 -0.30904299020767212j), - (0.95105588436126709 +0.30904293060302734j), - (0.5877838134765625 +0.80908381938934326j), - (3.218399768911695e-08 +1.0000815391540527j)) - - tb = self.tb - - sampling_freq = 100 - - ntaps = 51 - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 1.0) - head = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) - dst2 = gr.vector_sink_c () - - # calculate taps - taps = gr.firdes_hilbert (ntaps) - hd = gr.filter_delay_fc (taps) - - tb.connect (src1, head) - tb.connect (head, hd) - tb.connect (hd,dst2) - - tb.run () - - # get output - result_data = dst2.data () - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - def test_002_filter_delay_two_inputs (self): - - # giving the same signal to both the inputs should fetch the same results - # as above - - # expected result - expected_result = ( -1.4678005338941702e-11j, - -0.0011950774351134896j, - -0.0019336787518113852j, - -0.0034673355985432863j, - -0.0036765895783901215j, - -0.004916108213365078j, - -0.0042778430506587029j, - -0.006028641015291214j, - -0.005476709920912981j, - -0.0092810001224279404j, - -0.0095402700826525688j, - -0.016060983762145042j, - -0.016446959227323532j, - -0.02523401565849781j, - -0.024382550269365311j, - -0.035477779805660248j, - -0.033021725714206696j, - -0.048487484455108643j, - -0.04543270543217659j, - -0.069477587938308716j, - -0.066984444856643677j, - -0.10703597217798233j, - -0.10620346665382385j, - -0.1852707713842392j, - -0.19357112050056458j, - (7.2191945754696007e-09 -0.50004088878631592j), - (0.58778399229049683 -0.6155126690864563j), - (0.95105588436126709 -0.12377222627401352j), - (0.95105588436126709 +0.41524654626846313j), - (0.5877838134765625 +0.91611981391906738j), - (5.8516356205018383e-09 +1.0670661926269531j), - (-0.5877840518951416 +0.87856143712997437j), - (-0.95105588436126709 +0.35447561740875244j), - (-0.95105588436126709 -0.26055556535720825j), - (-0.5877838134765625 -0.77606213092803955j), - (-8.7774534307527574e-09 -0.96460390090942383j), - (0.58778399229049683 -0.78470128774642944j), - (0.95105588436126709 -0.28380891680717468j), - (0.95105588436126709 +0.32548999786376953j), - (0.5877838134765625 +0.82514488697052002j), - (1.4629089051254596e-08 +1.0096219778060913j), - (-0.5877840518951416 +0.81836479902267456j), - (-0.95105588436126709 +0.31451958417892456j), - (-0.95105588436126709 -0.3030143678188324j), - (-0.5877838134765625 -0.80480599403381348j), - (-1.7554906861505515e-08 -0.99516552686691284j), - (0.58778399229049683 -0.80540722608566284j), - (0.95105582475662231 -0.30557557940483093j), - (0.95105588436126709 +0.31097668409347534j), - (0.5877838134765625 +0.81027895212173462j), - (2.3406542482007353e-08 +1.0000816583633423j), - (-0.5877840518951416 +0.80908381938934326j), - (-0.95105588436126709 +0.30904293060302734j), - (-0.95105588436126709 -0.30904296040534973j), - (-0.5877838134765625 -0.80908387899398804j), - (-2.6332360292258272e-08 -1.0000815391540527j), - (0.58778399229049683 -0.80908381938934326j), - (0.95105582475662231 -0.30904299020767212j), - (0.95105588436126709 +0.30904293060302734j), - (0.5877838134765625 +0.80908381938934326j), - (3.218399768911695e-08 +1.0000815391540527j)) - - - tb = self.tb - - sampling_freq = 100 - ntaps = 51 - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 1.0) - head = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) - dst2 = gr.vector_sink_c () - - - # calculate taps - taps = gr.firdes_hilbert (ntaps) - hd = gr.filter_delay_fc (taps) - - tb.connect (src1, head) - tb.connect (head, (hd,0)) - tb.connect (head, (hd,1)) - tb.connect (hd,dst2) - tb.run () - - # get output - result_data = dst2.data () - - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - - def test_003_filter_delay_two_inputs (self): - - # give two different inputs - - # expected result - expected_result = ( -0.0020331963896751404j, - -0.0016448829555884004j, - -0.0032375147566199303j, - -0.0014826074475422502j, - -0.0033034090884029865j, - -0.00051144487224519253j, - -0.0043686260469257832j, - -0.0010198024101555347j, - -0.0082517862319946289j, - -0.003456643782556057j, - -0.014193611219525337j, - -0.005875137634575367j, - -0.020293503999710083j, - -0.0067503536120057106j, - -0.026798896491527557j, - -0.0073488112539052963j, - -0.037041611969470978j, - -0.010557252913713455j, - -0.055669989436864853j, - -0.018332764506340027j, - -0.089904911816120148j, - -0.033361352980136871j, - -0.16902604699134827j, - -0.074318811297416687j, - -0.58429563045501709j, - (7.2191945754696007e-09 -0.35892376303672791j), - (0.58778399229049683 +0.63660913705825806j), - (0.95105588436126709 +0.87681591510772705j), - (0.95105588436126709 +0.98705857992172241j), - (0.5877838134765625 +0.55447429418563843j), - (5.8516356205018383e-09 +0.026006083935499191j), - (-0.5877840518951416 -0.60616838932037354j), - (-0.95105588436126709 -0.9311758279800415j), - (-0.95105588436126709 -0.96169203519821167j), - (-0.5877838134765625 -0.57292771339416504j), - (-8.7774534307527574e-09 -0.0073488391935825348j), - (0.58778399229049683 +0.59720659255981445j), - (0.95105588436126709 +0.94438445568084717j), - (0.95105588436126709 +0.95582199096679688j), - (0.5877838134765625 +0.58196049928665161j), - (1.4629089051254596e-08 +0.0026587247848510742j), - (-0.5877840518951416 -0.59129220247268677j), - (-0.95105588436126709 -0.94841635227203369j), - (-0.95105588436126709 -0.95215457677841187j), - (-0.5877838134765625 -0.58535969257354736j), - (-1.7554906861505515e-08 -0.00051158666610717773j), - (0.58778399229049683 +0.58867418766021729j), - (0.95105582475662231 +0.94965213537216187j), - (0.95105588436126709 +0.95050644874572754j), - (0.5877838134765625 +0.58619076013565063j), - (2.3406542482007353e-08 +1.1920928955078125e-07j), - (-0.5877840518951416 -0.58783555030822754j), - (-0.95105588436126709 -0.95113480091094971j), - (-0.95105588436126709 -0.95113474130630493j), - (-0.5877838134765625 -0.58783555030822754j), - (-2.6332360292258272e-08 -8.1956386566162109e-08j), - (0.58778399229049683 +0.58783555030822754j), - (0.95105582475662231 +0.95113474130630493j), - (0.95105588436126709 +0.95113474130630493j), - (0.5877838134765625 +0.58783560991287231j), - (3.218399768911695e-08 +1.1920928955078125e-07j)) - - tb = self.tb - - sampling_freq = 100 - ntaps = 51 - - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE,sampling_freq * 0.10, 1.0) - src2 = gr.sig_source_f (sampling_freq, gr.GR_COS_WAVE,sampling_freq * 0.10, 1.0) - - head1 = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) - head2 = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) - - taps = gr.firdes_hilbert (ntaps) - hd = gr.filter_delay_fc (taps) - - dst2 = gr.vector_sink_c () - - tb.connect (src1, head1) - tb.connect (src2, head2) - - tb.connect (head1, (hd,0)) - tb.connect (head2, (hd,1)) - tb.connect (hd, dst2) - - tb.run () - - # get output - result_data = dst2.data () - - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - -if __name__ == '__main__': - gr_unittest.run(test_filter_delay_fc, "test_filter_delay_fc.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_char.py b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_char.py deleted file mode 100755 index 057e297f91..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_char.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -class test_float_to_char (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - - src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3) - expected_result = [0, 1, 2, 3, 4, 5, 255, 254, 253] - src = gr.vector_source_f(src_data) - op = gr.float_to_char() - dst = gr.vector_sink_b() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - - def test_002(self): - - src_data = ( 126.0, 127.0, 128.0) - expected_result = [ 126, 127, 127 ] - - src = gr.vector_source_f(src_data) - op = gr.float_to_char() - # Note: vector_sink_b returns uchar - dst = gr.vector_sink_b() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - - def test_003(self): - - scale = 2 - vlen = 3 - src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3) - expected_result = [0, 2, 4, 6, 8, 11, 254, 252, 250] - src = gr.vector_source_f(src_data) - s2v = gr.stream_to_vector(gr.sizeof_float, vlen) - op = gr.float_to_char(vlen, scale) - v2s = gr.vector_to_stream(gr.sizeof_char, vlen) - dst = gr.vector_sink_b() - - self.tb.connect(src, s2v, op, v2s, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_float_to_char, "test_float_to_char.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py deleted file mode 100755 index 5c7a412d2c..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py +++ /dev/null @@ -1,85 +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 - -class test_float_to_int (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - - src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3, -4.4, -5.5) - expected_result = [0, 1, 2, 3, 4, 6, -1, -2, -3, -4, -6] - - src = gr.vector_source_f(src_data) - op = gr.float_to_int() - dst = gr.vector_sink_i() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - - def test_002(self): - - src_data = ( 2147483647, 2147483648, 2200000000, - -2147483648, -2147483649, -2200000000) - expected_result = [ 2147483647, 2147483647, 2147483647, - -2147483647, -2147483647, -2147483647] - src = gr.vector_source_f(src_data) - op = gr.float_to_int() - dst = gr.vector_sink_i() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - - - def test_003(self): - - scale = 2 - vlen = 3 - src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3) - expected_result = [0, 2, 4, 7, 9, 11, -2, -4, -7,] - src = gr.vector_source_f(src_data) - s2v = gr.stream_to_vector(gr.sizeof_float, vlen) - op = gr.float_to_int(vlen, scale) - v2s = gr.vector_to_stream(gr.sizeof_int, vlen) - dst = gr.vector_sink_i() - - self.tb.connect(src, s2v, op, v2s, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_float_to_int, "test_float_to_int.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_short.py b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_short.py deleted file mode 100755 index 3f8b66975f..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_short.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import ctypes - -class test_float_to_short (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - - src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3, -4.4, -5.5) - expected_result = [0, 1, 2, 3, 4, 6, -1, -2, -3, -4, -6] - - src = gr.vector_source_f(src_data) - op = gr.float_to_short() - dst = gr.vector_sink_s() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - - def test_002(self): - - src_data = ( 32766, 32767, 32768, - -32767, -32768, -32769) - expected_result = [ 32766, 32767, 32767, - -32767, -32768, -32768 ] - - src = gr.vector_source_f(src_data) - op = gr.float_to_short() - dst = gr.vector_sink_s() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - - def test_003(self): - - scale = 2 - vlen = 3 - src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3) - expected_result = [0, 2, 4, 7, 9, 11, -2, -4, -7] - src = gr.vector_source_f(src_data) - s2v = gr.stream_to_vector(gr.sizeof_float, vlen) - op = gr.float_to_short(vlen, scale) - v2s = gr.vector_to_stream(gr.sizeof_short, vlen) - dst = gr.vector_sink_s() - - self.tb.connect(src, s2v, op, v2s, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_float_to_short, "test_float_to_short.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_uchar.py b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_uchar.py deleted file mode 100755 index 831bed93ef..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_uchar.py +++ /dev/null @@ -1,64 +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 ctypes - -class test_float_to_uchar (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - - src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3, -4.4, -5.5) - expected_result = [0, 1, 2, 3, 4, 6, 0, 0, 0, 0, 0] - src = gr.vector_source_f(src_data) - op = gr.float_to_uchar() - dst = gr.vector_sink_b() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - - def test_002(self): - - src_data = ( 254.0, 255.0, 256.0) - expected_result = [ 254, 255, 255 ] - src = gr.vector_source_f(src_data) - op = gr.float_to_uchar() - dst = gr.vector_sink_b() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_float_to_uchar, "test_float_to_uchar.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py b/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py deleted file mode 100755 index e19bb28f31..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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 - -class test_fractional_resampler (gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_000_make(self): - op = gr.fractional_interpolator_ff(0.0, 1.0) - op2 = gr.fractional_interpolator_cc(0.0, 1.0) - -if __name__ == '__main__': - gr_unittest.run(test_fractional_resampler, "test_fractional_resampler.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py b/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py deleted file mode 100755 index 23459fff3f..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py +++ /dev/null @@ -1,56 +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 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 = gr.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/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py b/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py deleted file mode 100755 index 95b8c06641..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py +++ /dev/null @@ -1,75 +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 math - -def sincos(x): - return math.cos(x) + math.sin(x) * 1j - -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 = gr.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) - - def test_simple_framer (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 = gr.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_bytes_to_syms, "test_bytes_to_syms.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py deleted file mode 100755 index 161e4a5cc1..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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 - -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 = gr.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 = gr.glfsr_source_b(degree, False) - b2f = gr.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 = gr.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 = gr.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/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py b/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py deleted file mode 100755 index 77f1b5f897..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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. -# - -from gnuradio import gr, gr_unittest -from math import pi, cos - -class test_goertzel(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def make_tone_data(self, rate, freq): - return [cos(2*pi*x*freq/rate) for x in range(rate)] - - def transform(self, src_data, rate, freq): - src = gr.vector_source_f(src_data, False) - dft = gr.goertzel_fc(rate, rate, freq) - dst = gr.vector_sink_c() - self.tb.connect(src, dft, dst) - self.tb.run() - return dst.data() - - def test_001(self): # Measure single tone magnitude - rate = 8000 - freq = 100 - bin = freq - src_data = self.make_tone_data(rate, freq) - expected_result = 0.5 - actual_result = abs(self.transform(src_data, rate, bin)[0]) - self.assertAlmostEqual(expected_result, actual_result, places=4) - - def test_002(self): # Measure off frequency magnitude - rate = 8000 - freq = 100 - bin = freq/2 - src_data = self.make_tone_data(rate, freq) - expected_result = 0.0 - actual_result = abs(self.transform(src_data, rate, bin)[0]) - self.assertAlmostEqual(expected_result, actual_result, places=4) - -if __name__ == '__main__': - gr_unittest.run(test_goertzel, "test_goertzel.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py index 3132d91b05..9ba48599af 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py @@ -1,6 +1,34 @@ #!/usr/bin/env python from gnuradio import gr, gr_unittest +import numpy + +class add_ff(gr.sync_block): + def __init__(self): + gr.sync_block.__init__( + self, + name = "add_ff", + in_sig = [numpy.float32, numpy.float32], + out_sig = [numpy.float32], + ) + + def work(self, input_items, output_items): + output_items[0][:] = input_items[0] + input_items[1] + return len(output_items[0]) + +class multiply_const_ff(gr.sync_block): + def __init__(self, k): + gr.sync_block.__init__( + self, + name = "multiply_ff", + in_sig = [numpy.float32], + out_sig = [numpy.float32], + ) + self.k = k + + def work(self, input_items, output_items): + output_items[0][:] = map(lambda x: self.k*x, input_items[0]) + return len(output_items[0]) class test_hier_block2(gr_unittest.TestCase): @@ -327,9 +355,9 @@ class test_hier_block2(gr_unittest.TestCase): hb = gr.hier_block2("hb", gr.io_signature(1, 1, gr.sizeof_float), gr.io_signature(1, 1, gr.sizeof_float)) - m1 = gr.multiply_const_ff(1.0) - m2 = gr.multiply_const_ff(2.0) - add = gr.add_ff() + m1 = multiply_const_ff(1.0) + m2 = multiply_const_ff(2.0) + add = add_ff() hb.connect(hb, m1) # m1 is connected to hb external input #0 hb.connect(hb, m2) # m2 is also connected to hb external input #0 hb.connect(m1, (add, 0)) @@ -350,9 +378,9 @@ class test_hier_block2(gr_unittest.TestCase): gr.io_signature(1, 1, gr.sizeof_float), gr.io_signature(1, 1, gr.sizeof_float)) - m1 = gr.multiply_const_ff(1.0) - m2 = gr.multiply_const_ff(2.0) - add = gr.add_ff() + m1 = multiply_const_ff(1.0) + m2 = multiply_const_ff(2.0) + add = add_ff() hb2.connect(hb2, m1) # m1 is connected to hb2 external input #0 hb2.connect(hb2, m2) # m2 is also connected to hb2 external input #0 hb2.connect(m1, (add, 0)) diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py b/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py deleted file mode 100755 index 27d01092bb..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py +++ /dev/null @@ -1,116 +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 math - -class test_hilbert (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_hilbert (self): - tb = self.tb - ntaps = 51 - sampling_freq = 100 - - expected_result = ( -1.4678005338941702e-11j, - -0.0011950774351134896j, - -0.0019336787518113852j, - -0.0034673355985432863j, - -0.0036765895783901215j, - -0.004916108213365078j, - -0.0042778430506587029j, - -0.006028641015291214j, - -0.005476709920912981j, - -0.0092810001224279404j, - -0.0095402700826525688j, - -0.016060983762145042j, - -0.016446959227323532j, - -0.02523401565849781j, - -0.024382550269365311j, - -0.035477779805660248j, - -0.033021725714206696j, - -0.048487484455108643j, - -0.04543270543217659j, - -0.069477587938308716j, - -0.066984444856643677j, - -0.10703597217798233j, - -0.10620346665382385j, - -0.1852707713842392j, - -0.19357112050056458j, - (7.2191945754696007e-09 -0.50004088878631592j), - (0.58778399229049683 -0.6155126690864563j), - (0.95105588436126709 -0.12377222627401352j), - (0.95105588436126709 +0.41524654626846313j), - (0.5877838134765625 +0.91611981391906738j), - (5.8516356205018383e-09 +1.0670661926269531j), - (-0.5877840518951416 +0.87856143712997437j), - (-0.95105588436126709 +0.35447561740875244j), - (-0.95105588436126709 -0.26055556535720825j), - (-0.5877838134765625 -0.77606213092803955j), - (-8.7774534307527574e-09 -0.96460390090942383j), - (0.58778399229049683 -0.78470128774642944j), - (0.95105588436126709 -0.28380891680717468j), - (0.95105588436126709 +0.32548999786376953j), - (0.5877838134765625 +0.82514488697052002j), - (1.4629089051254596e-08 +1.0096219778060913j), - (-0.5877840518951416 +0.81836479902267456j), - (-0.95105588436126709 +0.31451958417892456j), - (-0.95105588436126709 -0.3030143678188324j), - (-0.5877838134765625 -0.80480599403381348j), - (-1.7554906861505515e-08 -0.99516552686691284j), - (0.58778399229049683 -0.80540722608566284j), - (0.95105582475662231 -0.30557557940483093j), - (0.95105588436126709 +0.31097668409347534j), - (0.5877838134765625 +0.81027895212173462j), - (2.3406542482007353e-08 +1.0000816583633423j), - (-0.5877840518951416 +0.80908381938934326j), - (-0.95105588436126709 +0.30904293060302734j), - (-0.95105588436126709 -0.30904296040534973j), - (-0.5877838134765625 -0.80908387899398804j), - (-2.6332360292258272e-08 -1.0000815391540527j), - (0.58778399229049683 -0.80908381938934326j), - (0.95105582475662231 -0.30904299020767212j), - (0.95105588436126709 +0.30904293060302734j), - (0.5877838134765625 +0.80908381938934326j), - (3.218399768911695e-08 +1.0000815391540527j)) - - - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 1.0) - - head = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) - hilb = gr.hilbert_fc (ntaps) - dst1 = gr.vector_sink_c () - tb.connect (src1, head) - tb.connect (head, hilb) - tb.connect (hilb, dst1) - tb.run () - dst_data = dst1.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_hilbert, "test_hilbert.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_iir.py b/gnuradio-core/src/python/gnuradio/gr/qa_iir.py deleted file mode 100755 index 06b8d767ed..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_iir.py +++ /dev/null @@ -1,159 +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 - -class test_iir (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_iir_direct_001 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - fftaps = () - fbtaps = () - expected_result = (0, 0, 0, 0, 0, 0, 0, 0) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - 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) - - def test_iir_direct_002 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - fftaps = (2,) - fbtaps = (0,) - expected_result = (2, 4, 6, 8, 10, 12, 14, 16) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - 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) - - def test_iir_direct_003 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - fftaps = (2, 11) - fbtaps = (0, 0) - expected_result = (2, 15, 28, 41, 54, 67, 80, 93) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - 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) - - def test_iir_direct_004 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - fftaps = (2, 11) - fbtaps = (0, -1) - expected_result = (2, 13, 15, 26, 28, 39, 41, 52) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - 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) - - def test_iir_direct_005 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - fftaps = (2, 11, 0) - fbtaps = (0, -1, 3) - expected_result = (2, 13, 21, 59, 58, 186, 68, 583) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - 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) - - def test_iir_direct_006 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - expected_result = (2, 13, 21, 59, 58, 186, 68, 583) - fftaps = (2, 1) - fbtaps = (0, -1) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - fftaps = (2, 11, 0) - fbtaps = (0, -1, 3) - op.set_taps (fftaps, fbtaps) - 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) - - def test_iir_direct_007 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - expected_result = (2,2,5,5,8,8,11,11) - fftaps = (2, 1) - fbtaps = (0, -1) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - fftaps = (2,0,1) - fbtaps = (0, -1) - op.set_taps (fftaps, fbtaps) - 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) - - def test_iir_direct_008 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - expected_result = (2,4,4,10,18,14,26,56) - fftaps = (2,) - fbtaps = (0, 1) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - fftaps_data = (1) - fbtaps = (0,0, -1,3) - op.set_taps (fftaps, fbtaps) - 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) - - - - -if __name__ == '__main__': - gr_unittest.run(test_iir, "test_iir.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py b/gnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py deleted file mode 100755 index 7536b3820a..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py +++ /dev/null @@ -1,69 +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 - -class test_int_to_float (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, 2, 3, 4, 5, -1, -2, -3, -4, -5) - expected_result = [float(s) for s in src_data] - src = gr.vector_source_i(src_data) - op = gr.int_to_float() - dst = gr.vector_sink_f() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = dst.data() - - self.assertFloatTuplesAlmostEqual(expected_result, result_data) - - def test_002(self): - - vlen = 3 - src_data = ( 65000, 65001, 65002, 65003, 65004, 65005, - -65001, -65002, -65003) - expected_result = [ 65000.0, 65001.0, 65002.0, - 65003.0, 65004.0, 65005.0, - -65001.0, -65002.0, -65003.0] - src = gr.vector_source_i(src_data) - s2v = gr.stream_to_vector(gr.sizeof_int, vlen) - op = gr.int_to_float(vlen) - v2s = gr.vector_to_stream(gr.sizeof_float, vlen) - dst = gr.vector_sink_f() - - self.tb.connect(src, s2v, op, v2s, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_int_to_float, "test_int_to_float.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py b/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py deleted file mode 100755 index ddb1310b69..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py +++ /dev/null @@ -1,75 +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. -# - -from gnuradio import gr, gr_unittest -import math - -class test_integrate (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_000_ss(self): - src_data = (1, 2, 3, 4, 5, 6) - dst_data = (6, 15) - src = gr.vector_source_s(src_data) - itg = gr.integrate_ss(3) - dst = gr.vector_sink_s() - self.tb.connect(src, itg, dst) - self.tb.run() - self.assertEqual(dst_data, dst.data()) - - def test_001_ii(self): - src_data = (1, 2, 3, 4, 5, 6) - dst_data = (6, 15) - src = gr.vector_source_i(src_data) - itg = gr.integrate_ii(3) - dst = gr.vector_sink_i() - self.tb.connect(src, itg, dst) - self.tb.run() - self.assertEqual(dst_data, dst.data()) - - def test_002_ff(self): - src_data = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] - dst_data = [6.0, 15.0] - src = gr.vector_source_f(src_data) - itg = gr.integrate_ff(3) - dst = gr.vector_sink_f() - self.tb.connect(src, itg, dst) - self.tb.run() - self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6) - - def test_003_cc(self): - 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] - dst_data = [6.0+6.0j, 15.0+15.0j] - src = gr.vector_source_c(src_data) - itg = gr.integrate_cc(3) - dst = gr.vector_sink_c() - self.tb.connect(src, itg, dst) - self.tb.run() - self.assertComplexTuplesAlmostEqual(dst_data, dst.data(), 6) - -if __name__ == '__main__': - gr_unittest.run(test_integrate, "test_integrate.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py b/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py deleted file mode 100755 index 1ff1782519..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py +++ /dev/null @@ -1,81 +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 math - -class test_interleave (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_int_001 (self): - lenx = 64 - src0 = gr.vector_source_f (range (0, lenx, 4)) - src1 = gr.vector_source_f (range (1, lenx, 4)) - src2 = gr.vector_source_f (range (2, lenx, 4)) - src3 = gr.vector_source_f (range (3, lenx, 4)) - op = gr.interleave (gr.sizeof_float) - dst = gr.vector_sink_f () - - self.tb.connect (src0, (op, 0)) - self.tb.connect (src1, (op, 1)) - self.tb.connect (src2, (op, 2)) - self.tb.connect (src3, (op, 3)) - self.tb.connect (op, dst) - self.tb.run () - expected_result = tuple (range (lenx)) - result_data = dst.data () - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_deint_001 (self): - lenx = 64 - src = gr.vector_source_f (range (lenx)) - op = gr.deinterleave (gr.sizeof_float) - dst0 = gr.vector_sink_f () - dst1 = gr.vector_sink_f () - dst2 = gr.vector_sink_f () - dst3 = gr.vector_sink_f () - - self.tb.connect (src, op) - self.tb.connect ((op, 0), dst0) - self.tb.connect ((op, 1), dst1) - self.tb.connect ((op, 2), dst2) - self.tb.connect ((op, 3), dst3) - self.tb.run () - - expected_result0 = tuple (range (0, lenx, 4)) - expected_result1 = tuple (range (1, lenx, 4)) - expected_result2 = tuple (range (2, lenx, 4)) - expected_result3 = tuple (range (3, lenx, 4)) - - self.assertFloatTuplesAlmostEqual (expected_result0, dst0.data ()) - self.assertFloatTuplesAlmostEqual (expected_result1, dst1.data ()) - self.assertFloatTuplesAlmostEqual (expected_result2, dst2.data ()) - self.assertFloatTuplesAlmostEqual (expected_result3, dst3.data ()) - -if __name__ == '__main__': - gr_unittest.run(test_interleave, "test_interleave.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py b/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py deleted file mode 100755 index 9bd9977c75..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py +++ /dev/null @@ -1,54 +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 math - -class test_interp_fir_filter (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_fff (self): - taps = [1, 10, 100, 1000, 10000] - src_data = (0, 2, 3, 5, 7, 11, 13, 17) - interpolation = 3 - xr = (0,0,0,0,2,20,200,2003,20030,300,3005,30050,500,5007,50070,700,7011,70110,1100,11013,110130,1300,13017,130170) - expected_result = tuple ([float (x) for x in xr]) - - src = gr.vector_source_f (src_data) - op = gr.interp_fir_filter_fff (interpolation, taps) - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - L = min(len(result_data), len(expected_result)) - self.assertEqual (expected_result[0:L], result_data[0:L]) - - -if __name__ == '__main__': - gr_unittest.run(test_interp_fir_filter, "test_interp_fir_filter.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_keep_m_in_n.py b/gnuradio-core/src/python/gnuradio/gr/qa_keep_m_in_n.py deleted file mode 100755 index 922671d024..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_keep_m_in_n.py +++ /dev/null @@ -1,58 +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 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, gr_unittest -import sys -import random - -class test_keep_m_in_n(gr_unittest.TestCase): - - def setUp(self): - pass - - def tearDown(self): - pass - - def test_001(self): - self.maxDiff = None; - tb = gr.top_block() - src = gr.vector_source_b( range(0,100) ) - - # itemsize, M, N, offset - km2 = gr.keep_m_in_n( 1, 1, 2, 0 ); - km3 = gr.keep_m_in_n( 1, 1, 3, 1 ); - km7 = gr.keep_m_in_n( 1, 1, 7, 2 ); - snk2 = gr.vector_sink_b(); - snk3 = gr.vector_sink_b(); - snk7 = gr.vector_sink_b(); - tb.connect(src,km2,snk2); - tb.connect(src,km3,snk3); - tb.connect(src,km7,snk7); - tb.run(); - - self.assertEqual(range(0,100,2), list(snk2.data())); - self.assertEqual(range(1,100,3), list(snk3.data())); - self.assertEqual(range(2,100,7), list(snk7.data())); - - -if __name__ == '__main__': - gr_unittest.run(test_keep_m_in_n, "test_keep_m_in_n.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py b/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py index 39b5d781e2..f80188c9fc 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py @@ -30,10 +30,6 @@ class test_kludged_imports (gr_unittest.TestCase): def tearDown(self): pass - def test_blks_import(self): - # make sure that this somewhat magic import works - from gnuradio import blks2 - def test_gru_import(self): # make sure that this somewhat magic import works from gnuradio import gru diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_max.py b/gnuradio-core/src/python/gnuradio/gr/qa_max.py deleted file mode 100755 index f962df457d..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_max.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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 math - - -class test_max (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - - def tearDown (self): - self.tb = None - - - def test_001(self): - - src_data = (0,0.2,-0.3,0,12,0) - expected_result = (float(max(src_data)), ) - - src = gr.vector_source_f(src_data) - s2v = gr.stream_to_vector(gr.sizeof_float, len(src_data)) - op = gr.max_ff( len(src_data) ) - dst = gr.vector_sink_f() - - - self.tb.connect(src, s2v, op, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(expected_result, result_data) - - def test_002(self): - - src_data=(-100,-99,-98,-97,-96,-1) - expected_result = (float(max(src_data)), ) - - src = gr.vector_source_f(src_data) - s2v = gr.stream_to_vector(gr.sizeof_float, len(src_data)) - op = gr.max_ff( len(src_data) ) - dst = gr.vector_sink_f() - - self.tb.connect(src, s2v, op, dst) - self.tb.run() - result_data = dst.data() - self.assertEqual(expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_max, "test_max.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_multiply_conjugate.py b/gnuradio-core/src/python/gnuradio/gr/qa_multiply_conjugate.py deleted file mode 100644 index 1601a109e4..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_multiply_conjugate.py +++ /dev/null @@ -1,57 +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 - -class test_multiply_conjugate (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_000 (self): - src_data0 = (-2-2j, -1-1j, -2+2j, -1+1j, - 2-2j, 1-1j, 2+2j, 1+1j, - 0+0j) - src_data1 = (-3-3j, -4-4j, -3+3j, -4+4j, - 3-3j, 4-4j, 3+3j, 4+4j, - 0+0j) - - exp_data = (12+0j, 8+0j, 12+0j, 8+0j, - 12+0j, 8+0j, 12+0j, 8+0j, - 0+0j) - src0 = gr.vector_source_c(src_data0) - src1 = gr.vector_source_c(src_data1) - op = gr.multiply_conjugate_cc () - dst = gr.vector_sink_c () - - self.tb.connect(src0, (op,0)) - self.tb.connect(src1, (op,1)) - self.tb.connect(op, dst) - self.tb.run() - result_data = dst.data () - self.assertEqual (exp_data, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_multiply_conjugate, "test_multiply_conjugate.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py b/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py deleted file mode 100755 index a87ed87eef..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,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 - -class test_nlog10(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - src_data = (-10, 0, 10, 100, 1000, 10000, 100000) - expected_result = (-180, -180, 10, 20, 30, 40, 50) - src = gr.vector_source_f(src_data) - op = gr.nlog10_ff(10) - dst = gr.vector_sink_f() - self.tb.connect (src, op, dst) - self.tb.run() - result_data = dst.data() - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - -if __name__ == '__main__': - gr_unittest.run(test_nlog10, "test_nlog10.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_noise.py b/gnuradio-core/src/python/gnuradio/gr/qa_noise.py deleted file mode 100755 index e875191507..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_noise.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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 - -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 = gr.noise_source_f(gr.GR_GAUSSIAN, 10, 10) - - def test_002(self): - # Test get methods - set_type = gr.GR_GAUSSIAN - set_ampl = 10 - op = gr.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/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py b/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py index 572d8b1861..59f927fa19 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py @@ -46,23 +46,23 @@ class test_pdu(gr_unittest.TestCase): # Test that the right number of ports exist. pi = dbg.message_ports_in() po = dbg.message_ports_out() - self.assertEqual(pmt.pmt_length(pi), 2) - self.assertEqual(pmt.pmt_length(po), 0) + self.assertEqual(pmt.length(pi), 2) + self.assertEqual(pmt.length(po), 0) pi = snk3.message_ports_in() po = snk3.message_ports_out() - self.assertEqual(pmt.pmt_length(pi), 0) - self.assertEqual(pmt.pmt_length(po), 1) + self.assertEqual(pmt.length(pi), 0) + self.assertEqual(pmt.length(po), 1) #print "Message Debug input ports: " - #pmt.pmt_print(pi) + #pmt.print(pi) #print "Message Debug output ports: " - #pmt.pmt_print(po) + #pmt.print(po) #print "Stream to PDU input ports: " - #pmt.pmt_print(pi) + #pmt.print(pi) #print "Stream to PDU output ports: " - #pmt.pmt_print(po) + #pmt.print(po) time.sleep(0.1) self.tb.connect(src, snk) @@ -73,12 +73,12 @@ class test_pdu(gr_unittest.TestCase): self.tb.start() # make our reference and message pmts - port = pmt.pmt_intern("pdus") - msg = pmt.pmt_cons( pmt.PMT_NIL, pmt.pmt_make_u8vector(16, 0xFF) ) + port = pmt.intern("pdus") + msg = pmt.cons( pmt.PMT_NIL, pmt.make_u8vector(16, 0xFF) ) #print "printing port & msg" - #pmt.pmt_print(port) - #pmt.pmt_print(msg) + #print(port) + #print(msg) # post the message src.to_basic_block()._post( port, msg ) @@ -94,13 +94,13 @@ class test_pdu(gr_unittest.TestCase): # Get the vector of data from the message sink # Convert the message PMT as a pair into its vector result_msg = dbg.get_message(0) - msg_vec = pmt.pmt_cdr(result_msg) - pmt.pmt_print(msg_vec) + msg_vec = pmt.cdr(result_msg) + print(msg_vec) # Convert the PMT vector into a Python list msg_data = [] for i in xrange(16): - msg_data.append(pmt.pmt_u8vector_ref(msg_vec, i)) + msg_data.append(pmt.u8vector_ref(msg_vec, i)) actual_data = 16*[0xFF,] self.assertEqual(actual_data, list(result_data)) diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py b/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py deleted file mode 100755 index 1f24062b14..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,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 - -if 0: - import os - print "pid =", os.getpid() - raw_input("Attach, then press Enter to continue") - - -def calc_expected_result(src_data, n): - assert (len(src_data) % n) == 0 - result = [list() for x in range(n)] - #print "len(result) =", len(result) - for i in xrange(len(src_data)): - (result[i % n]).append(src_data[i]) - return [tuple(x) for x in result] - - -class test_pipe_fittings(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block () - - def tearDown(self): - self.tb = None - - def test_001(self): - """ - Test stream_to_streams. - """ - n = 8 - src_len = n * 8 - src_data = range(src_len) - - expected_results = calc_expected_result(src_data, n) - #print "expected results: ", expected_results - src = gr.vector_source_i(src_data) - op = gr.stream_to_streams(gr.sizeof_int, n) - self.tb.connect(src, op) - - dsts = [] - for i in range(n): - dst = gr.vector_sink_i() - self.tb.connect((op, i), (dst, 0)) - dsts.append(dst) - - self.tb.run() - - for d in range(n): - self.assertEqual(expected_results[d], dsts[d].data()) - - def test_002(self): - """ - Test streams_to_stream (using stream_to_streams). - """ - n = 8 - src_len = n * 8 - src_data = tuple(range(src_len)) - expected_results = src_data - - src = gr.vector_source_i(src_data) - op1 = gr.stream_to_streams(gr.sizeof_int, n) - op2 = gr.streams_to_stream(gr.sizeof_int, n) - dst = gr.vector_sink_i() - - self.tb.connect(src, op1) - for i in range(n): - self.tb.connect((op1, i), (op2, i)) - self.tb.connect(op2, dst) - - self.tb.run() - self.assertEqual(expected_results, dst.data()) - - def test_003(self): - """ - Test streams_to_vector (using stream_to_streams & vector_to_stream). - """ - n = 8 - src_len = n * 8 - src_data = tuple(range(src_len)) - expected_results = src_data - - src = gr.vector_source_i(src_data) - op1 = gr.stream_to_streams(gr.sizeof_int, n) - op2 = gr.streams_to_vector(gr.sizeof_int, n) - op3 = gr.vector_to_stream(gr.sizeof_int, n) - dst = gr.vector_sink_i() - - self.tb.connect(src, op1) - for i in range(n): - self.tb.connect((op1, i), (op2, i)) - self.tb.connect(op2, op3, dst) - - self.tb.run() - self.assertEqual(expected_results, dst.data()) - - def test_004(self): - """ - Test vector_to_streams. - """ - n = 8 - src_len = n * 8 - src_data = tuple(range(src_len)) - expected_results = src_data - - src = gr.vector_source_i(src_data) - op1 = gr.stream_to_vector(gr.sizeof_int, n) - op2 = gr.vector_to_streams(gr.sizeof_int, n) - op3 = gr.streams_to_stream(gr.sizeof_int, n) - dst = gr.vector_sink_i() - - self.tb.connect(src, op1, op2) - for i in range(n): - self.tb.connect((op2, i), (op3, i)) - self.tb.connect(op3, dst) - - self.tb.run() - self.assertEqual(expected_results, dst.data()) - -if __name__ == '__main__': - gr_unittest.run(test_pipe_fittings, "test_pipe_fittings.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py deleted file mode 100755 index 8964db53db..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py +++ /dev/null @@ -1,156 +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 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 = gr.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/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py deleted file mode 100755 index 219e9b84b6..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py +++ /dev/null @@ -1,160 +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 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 = gr.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/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py deleted file mode 100755 index f319f63814..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py +++ /dev/null @@ -1,156 +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. -# - -from gnuradio import gr, gr_unittest -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 = gr.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/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py deleted file mode 100755 index 6a62a6997b..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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 - -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 = gr.pn_correlator_cc(10) - - def test_001_correlate(self): - degree = 10 - length = 2**degree-1 - src = gr.glfsr_source_f(degree) - head = gr.head(gr.sizeof_float, length*length) - f2c = gr.float_to_complex() - corr = gr.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/gnuradio-core/src/python/gnuradio/gr/qa_probe_signal.py b/gnuradio-core/src/python/gnuradio/gr/qa_probe_signal.py deleted file mode 100644 index 4e10afdb64..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_probe_signal.py +++ /dev/null @@ -1,67 +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. -# - -import time - -from gnuradio import gr, gr_unittest - -class test_probe_signal (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - - def test_001(self): - - value = 12.3 - repeats = 100 - src_data = [value] * repeats - - src = gr.vector_source_f(src_data) - dst = gr.probe_signal_f() - - self.tb.connect(src, dst) - self.tb.run() - output = dst.level() - self.assertAlmostEqual(value, output, places=6) - - def test_002(self): - - vector_length = 10 - repeats = 10 - value = [0.5+i for i in range(0, vector_length)] - src_data = value * repeats - - src = gr.vector_source_f(src_data) - s2v = gr.stream_to_vector(gr.sizeof_float, vector_length) - dst = gr.probe_signal_vf(vector_length) - - self.tb.connect(src, s2v, dst) - self.tb.run() - output = dst.level() - self.assertEqual(len(output), vector_length) - self.assertAlmostEqual(value[3], output[3], places=6) - -if __name__ == '__main__': - gr_unittest.run(test_probe_signal, "test_probe_signal.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py b/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py deleted file mode 100755 index cc963d7572..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py +++ /dev/null @@ -1,298 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,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. -# - -from gnuradio import gr, gr_unittest -from gnuradio import blks2 -import math -import random -import sys - -#import os -#print os.getpid() -#raw_input('Attach with gdb, then press Enter: ') - - -def random_floats(n): - r = [] - for x in xrange(n): - r.append(float(random.randint(-32768, 32768))) - return tuple(r) - - -def reference_dec_filter(src_data, decim, taps): - tb = gr.top_block() - src = gr.vector_source_f(src_data) - op = gr.fir_filter_fff(decim, taps) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - tb = None - return result_data - -def reference_interp_filter(src_data, interp, taps): - tb = gr.top_block() - src = gr.vector_source_f(src_data) - op = gr.interp_fir_filter_fff(interp, taps) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - tb = None - return result_data - -def reference_interp_dec_filter(src_data, interp, decim, taps): - tb = gr.top_block() - src = gr.vector_source_f(src_data) - up = gr.interp_fir_filter_fff(interp, (1,)) - dn = gr.fir_filter_fff(decim, taps) - dst = gr.vector_sink_f() - tb.connect(src, up, dn, dst) - tb.run() - result_data = dst.data() - tb = None - return result_data - - -class test_rational_resampler (gr_unittest.TestCase): - - def setUp(self): - pass - - def tearDown(self): - pass - - # - # test the gr.rational_resampler_base primitives... - # - - def test_000_1_to_1(self): - taps = (-4, 5) - src_data = (234, -4, 23, -56, 45, 98, -23, -7) - xr = (-936, 1186, -112, 339, -460, -167, 582) - expected_result = tuple([float(x) for x in xr]) - - tb = gr.top_block() - src = gr.vector_source_f(src_data) - op = gr.rational_resampler_base_fff(1, 1, taps) - dst = gr.vector_sink_f() - tb.connect(src, op) - tb.connect(op, dst) - tb.run() - result_data = dst.data() - self.assertEqual(expected_result, result_data) - - def test_001_interp(self): - taps = [1, 10, 100, 1000, 10000] - src_data = (0, 2, 3, 5, 7, 11, 13, 17) - interpolation = 3 - xr = (0,0,0,0,2,20,200,2003,20030,300,3005,30050,500,5007,50070,700,7011,70110,1100,11013,110130,1300,13017,130170,1700.0,17000.0,170000.0) - expected_result = tuple([float(x) for x in xr]) - - tb = gr.top_block() - src = gr.vector_source_f(src_data) - op = gr.rational_resampler_base_fff(interpolation, 1, taps) - dst = gr.vector_sink_f() - tb.connect(src, op) - tb.connect(op, dst) - tb.run() - result_data = dst.data() - self.assertEqual(expected_result, result_data) - - def test_002_interp(self): - taps = random_floats(31) - #src_data = random_floats(10000) # FIXME the 10k case fails! - src_data = random_floats(1000) - interpolation = 3 - - expected_result = reference_interp_filter(src_data, interpolation, taps) - - tb = gr.top_block() - src = gr.vector_source_f(src_data) - op = gr.rational_resampler_base_fff(interpolation, 1, taps) - dst = gr.vector_sink_f() - tb.connect(src, op) - tb.connect(op, dst) - tb.run() - result_data = dst.data() - - L1 = len(result_data) - L2 = len(expected_result) - L = min(L1, L2) - if False: - sys.stderr.write('delta = %2d: ntaps = %d interp = %d ilen = %d\n' % - (L2 - L1, len(taps), interpolation, len(src_data))) - sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' % - (len(result_data), len(expected_result))) - #self.assertEqual(expected_result[0:L], result_data[0:L]) - # FIXME check first 3 answers - self.assertEqual(expected_result[3:L], result_data[3:L]) - - def test_003_interp(self): - taps = random_floats(31) - src_data = random_floats(10000) - decimation = 3 - - expected_result = reference_dec_filter(src_data, decimation, taps) - - tb = gr.top_block() - src = gr.vector_source_f(src_data) - op = gr.rational_resampler_base_fff(1, decimation, taps) - dst = gr.vector_sink_f() - tb.connect(src, op) - tb.connect(op, dst) - tb.run() - result_data = dst.data() - - L1 = len(result_data) - L2 = len(expected_result) - L = min(L1, L2) - if False: - sys.stderr.write('delta = %2d: ntaps = %d decim = %d ilen = %d\n' % - (L2 - L1, len(taps), decimation, len(src_data))) - sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' % - (len(result_data), len(expected_result))) - self.assertEqual(expected_result[0:L], result_data[0:L]) - - # FIXME disabled. Triggers hang on SuSE 10.0 - def xtest_004_decim_random_vals(self): - MAX_TAPS = 9 - MAX_DECIM = 7 - OUTPUT_LEN = 9 - - random.seed(0) # we want reproducibility - - for ntaps in xrange(1, MAX_TAPS + 1): - for decim in xrange(1, MAX_DECIM+1): - for ilen in xrange(ntaps + decim, ntaps + OUTPUT_LEN*decim): - src_data = random_floats(ilen) - taps = random_floats(ntaps) - expected_result = reference_dec_filter(src_data, decim, taps) - - tb = gr.top_block() - src = gr.vector_source_f(src_data) - op = gr.rational_resampler_base_fff(1, decim, taps) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - tb = None - result_data = dst.data() - L1 = len(result_data) - L2 = len(expected_result) - L = min(L1, L2) - if False: - sys.stderr.write('delta = %2d: ntaps = %d decim = %d ilen = %d\n' % (L2 - L1, ntaps, decim, ilen)) - sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' % - (len(result_data), len(expected_result))) - self.assertEqual(expected_result[0:L], result_data[0:L]) - - - # FIXME disabled. Triggers hang on SuSE 10.0 - def xtest_005_interp_random_vals(self): - MAX_TAPS = 9 - MAX_INTERP = 7 - INPUT_LEN = 9 - - random.seed(0) # we want reproducibility - - for ntaps in xrange(1, MAX_TAPS + 1): - for interp in xrange(1, MAX_INTERP+1): - for ilen in xrange(ntaps, ntaps + INPUT_LEN): - src_data = random_floats(ilen) - taps = random_floats(ntaps) - expected_result = reference_interp_filter(src_data, interp, taps) - - tb = gr.top_block() - src = gr.vector_source_f(src_data) - op = gr.rational_resampler_base_fff(interp, 1, taps) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - tb = None - result_data = dst.data() - L1 = len(result_data) - L2 = len(expected_result) - L = min(L1, L2) - #if True or abs(L1-L2) > 1: - if False: - sys.stderr.write('delta = %2d: ntaps = %d interp = %d ilen = %d\n' % (L2 - L1, ntaps, interp, ilen)) - #sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' % - # (len(result_data), len(expected_result))) - #self.assertEqual(expected_result[0:L], result_data[0:L]) - # FIXME check first ntaps+1 answers - self.assertEqual(expected_result[ntaps+1:L], result_data[ntaps+1:L]) - - - def test_006_interp_decim(self): - taps = (0,1,0,0) - src_data = range(10000) - interp = 3 - decimation = 2 - - expected_result = reference_interp_dec_filter(src_data, interp, decimation, taps) - - tb = gr.top_block() - src = gr.vector_source_f(src_data) - op = gr.rational_resampler_base_fff(interp, decimation, taps) - dst = gr.vector_sink_f() - tb.connect(src, op) - tb.connect(op, dst) - tb.run() - result_data = dst.data() - - L1 = len(result_data) - L2 = len(expected_result) - L = min(L1, L2) - if False: - sys.stderr.write('delta = %2d: ntaps = %d decim = %d ilen = %d\n' % - (L2 - L1, len(taps), decimation, len(src_data))) - sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' % - (len(result_data), len(expected_result))) - self.assertEqual(expected_result[1:L], result_data[1:L]) - - # - # test the blks2.rational_resampler_??? primitives... - # - - def test_101_interp(self): - taps = [1, 10, 100, 1000, 10000] - src_data = (0, 2, 3, 5, 7, 11, 13, 17) - interpolation = 3 - xr = (0,0,0,0,2,20,200,2003,20030,300,3005,30050,500,5007,50070,700,7011,70110,1100,11013,110130,1300,13017,130170,1700.0,17000.0,170000.0) - expected_result = tuple([float(x) for x in xr]) - - tb = gr.top_block() - src = gr.vector_source_f(src_data) - op = blks2.rational_resampler_fff(interpolation, 1, taps=taps) - dst = gr.vector_sink_f() - tb.connect(src, op) - tb.connect(op, dst) - tb.run() - result_data = dst.data() - self.assertEqual(expected_result, result_data) - - -if __name__ == '__main__': - pass - # FIXME: Disabled, see ticket:210 - # gr_unittest.run(test_rational_resampler, "test_rational_resampler.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py b/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py deleted file mode 100755 index 116f37115a..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py +++ /dev/null @@ -1,48 +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. -# - -from gnuradio import gr, gr_unittest -import math - -class test_repeat (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001_float(self): - src_data = [n*1.0 for n in range(100)]; - dst_data = [] - for n in range(100): - dst_data += [1.0*n, 1.0*n, 1.0*n] - - src = gr.vector_source_f(src_data) - rpt = gr.repeat(gr.sizeof_float, 3) - dst = gr.vector_sink_f() - self.tb.connect(src, rpt, dst) - self.tb.run() - self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6) - -if __name__ == '__main__': - gr_unittest.run(test_repeat, "test_repeat.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py b/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py deleted file mode 100755 index 5fe89bdc7f..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py +++ /dev/null @@ -1,64 +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. -# - -from gnuradio import gr, gr_unittest - -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 = gr.scrambler_bb(0x8a, 0x7F, 7) # CCSDS 7-bit scrambler - descrambler = gr.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 = gr.additive_scrambler_bb(0x8a, 0x7f, 7) - descrambler = gr.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 = gr.additive_scrambler_bb(0x8a, 0x7f, 7, 100) - descrambler = gr.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/gnuradio-core/src/python/gnuradio/gr/qa_short_to_char.py b/gnuradio-core/src/python/gnuradio/gr/qa_short_to_char.py deleted file mode 100755 index 490b149c7c..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_short_to_char.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import ctypes - -class test_short_to_char (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - - src_data = range(0, 32767, 32767/127) - src_data = [int(s) for s in src_data] - expected_result = range(0, 128) - src = gr.vector_source_s(src_data) - op = gr.short_to_char() - dst = gr.vector_sink_b() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - - def test_002(self): - - vlen = 3 - src_data = range(0, 32400, 32767/127) - src_data = [int(s) for s in src_data] - expected_result = range(0, 126) - src = gr.vector_source_s(src_data) - s2v = gr.stream_to_vector(gr.sizeof_short, vlen) - op = gr.short_to_char(vlen) - v2s = gr.vector_to_stream(gr.sizeof_char, vlen) - dst = gr.vector_sink_b() - - self.tb.connect(src, s2v, op, v2s, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_short_to_char, "test_short_to_char.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_short_to_float.py b/gnuradio-core/src/python/gnuradio/gr/qa_short_to_float.py deleted file mode 100755 index 130f034ec3..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_short_to_float.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, gr_unittest -import ctypes - -class test_short_to_float (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, 2, 3, 4, 5, -1, -2, -3, -4, -5) - expected_result = [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, - -1.0, -2.0, -3.0, -4.0, -5.0] - - src = gr.vector_source_s(src_data) - op = gr.short_to_float() - dst = gr.vector_sink_f() - - self.tb.connect(src, op, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - - def test_002(self): - - vlen = 3 - src_data = (0, 1, 2, 3, 4, 5, -1, -2, -3) - expected_result = [0.0, 1.0, 2.0, 3.0, 4.0, - 5.0, -1.0, -2.0, -3.0] - src = gr.vector_source_s(src_data) - s2v = gr.stream_to_vector(gr.sizeof_short, vlen) - op = gr.short_to_float(vlen) - v2s = gr.vector_to_stream(gr.sizeof_float, vlen) - dst = gr.vector_sink_f() - - self.tb.connect(src, s2v, op, v2s, dst) - self.tb.run() - result_data = list(dst.data()) - - self.assertEqual(expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_short_to_float, "test_short_to_float.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py deleted file mode 100755 index 122b169b7e..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py +++ /dev/null @@ -1,157 +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 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 = gr.sig_source_f (1e6, gr.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 = gr.sig_source_i (1e6, gr.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 = gr.sig_source_f (8, gr.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 = gr.sig_source_f (8, gr.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 = gr.sig_source_c (8, gr.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 = gr.sig_source_c (8, gr.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 = gr.sig_source_c (8, gr.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 = gr.sig_source_f (8, gr.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 = gr.sig_source_f (8, gr.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 = gr.sig_source_f (8, gr.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/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py deleted file mode 100755 index bfe2d8fc8c..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,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 - -class test_single_pole_iir(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - src_data = (0, 1000, 2000, 3000, 4000, 5000) - expected_result = src_data - src = gr.vector_source_f(src_data) - op = gr.single_pole_iir_filter_ff (1.0) - dst = gr.vector_sink_f() - self.tb.connect (src, op, dst) - self.tb.run() - result_data = dst.data() - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_002(self): - src_data = (0, 1000, 2000, 3000, 4000, 5000) - expected_result = (0, 125, 359.375, 689.453125, 1103.271484, 1590.36255) - src = gr.vector_source_f(src_data) - op = gr.single_pole_iir_filter_ff (0.125) - dst = gr.vector_sink_f() - self.tb.connect (src, op, dst) - self.tb.run() - result_data = dst.data() - self.assertFloatTuplesAlmostEqual (expected_result, result_data, 3) - - def test_003(self): - block_size = 2 - src_data = (0, 1000, 2000, 3000, 4000, 5000) - expected_result = (0, 125, 250, 484.375, 718.75, 1048.828125) - src = gr.vector_source_f(src_data) - s2p = gr.serial_to_parallel(gr.sizeof_float, block_size) - op = gr.single_pole_iir_filter_ff (0.125, block_size) - p2s = gr.parallel_to_serial(gr.sizeof_float, block_size) - dst = gr.vector_sink_f() - self.tb.connect (src, s2p, op, p2s, dst) - self.tb.run() - result_data = dst.data() - self.assertFloatTuplesAlmostEqual (expected_result, result_data, 3) - - -if __name__ == '__main__': - gr_unittest.run(test_single_pole_iir, "test_single_pole_iir.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py deleted file mode 100755 index 353df1bc0d..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,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. -# - -from gnuradio import gr, gr_unittest - -class test_single_pole_iir_cc(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - src_data = (0+0j, 1000+1000j, 2000+2000j, 3000+3000j, 4000+4000j, 5000+5000j) - expected_result = src_data - src = gr.vector_source_c(src_data) - op = gr.single_pole_iir_filter_cc (1.0) - dst = gr.vector_sink_c() - self.tb.connect (src, op, dst) - self.tb.run() - result_data = dst.data() - self.assertComplexTuplesAlmostEqual (expected_result, result_data) - - def test_002(self): - src_data = (complex(0,0), complex(1000,-1000), complex(2000,-2000), complex(3000,-3000), complex(4000,-4000), complex(5000,-5000)) - expected_result = (complex(0,0), complex(125,-125), complex(359.375,-359.375), complex(689.453125,-689.453125), complex(1103.271484,-1103.271484), complex(1590.36255,-1590.36255)) - src = gr.vector_source_c(src_data) - op = gr.single_pole_iir_filter_cc (0.125) - dst = gr.vector_sink_c() - self.tb.connect (src, op, dst) - self.tb.run() - result_data = dst.data() - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 3) - - def test_003(self): - block_size = 2 - src_data = (complex(0,0), complex(1000,-1000), complex(2000,-2000), complex(3000,-3000), complex(4000,-4000), complex(5000,-5000)) - expected_result = (complex(0,0), complex(125,-125), complex(250,-250), complex(484.375,-484.375), complex(718.75,-718.75), complex(1048.828125,-1048.828125)) - src = gr.vector_source_c(src_data) - s2p = gr.serial_to_parallel(gr.sizeof_gr_complex, block_size) - op = gr.single_pole_iir_filter_cc (0.125, block_size) - p2s = gr.parallel_to_serial(gr.sizeof_gr_complex, block_size) - dst = gr.vector_sink_c() - self.tb.connect (src, s2p, op, p2s, dst) - self.tb.run() - result_data = dst.data() - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 3) - - -if __name__ == '__main__': - gr_unittest.run(test_single_pole_iir_cc, "test_single_pole_iir_cc.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py b/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py deleted file mode 100755 index 779d0b25e3..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py +++ /dev/null @@ -1,168 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,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 - -class test_stream_mux (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def help_stream_2ff(self, N, stream_sizes): - v0 = gr.vector_source_f(N*[1,], False) - v1 = gr.vector_source_f(N*[2,], False) - - mux = gr.stream_mux(gr.sizeof_float, stream_sizes) - - dst = gr.vector_sink_f () - - self.tb.connect (v0, (mux,0)) - self.tb.connect (v1, (mux,1)) - self.tb.connect (mux, dst) - self.tb.run () - - return dst.data () - - def help_stream_ramp_2ff(self, N, stream_sizes): - r1 = range(N) - r2 = range(N) - r2.reverse() - - v0 = gr.vector_source_f(r1, False) - v1 = gr.vector_source_f(r2, False) - - mux = gr.stream_mux(gr.sizeof_float, stream_sizes) - - dst = gr.vector_sink_f () - - self.tb.connect (v0, (mux,0)) - self.tb.connect (v1, (mux,1)) - self.tb.connect (mux, dst) - self.tb.run () - - return dst.data () - - def test_stream_2NN_ff(self): - N = 40 - stream_sizes = [10, 10] - result_data = self.help_stream_2ff(N, stream_sizes) - - exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0) - self.assertEqual (exp_data, result_data) - - def test_stream_ramp_2NN_ff(self): - N = 40 - stream_sizes = [10, 10] - result_data = self.help_stream_ramp_2ff(N, stream_sizes) - - exp_data = ( 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, - 39.0, 38.0, 37.0, 36.0, 35.0, 34.0, 33.0, 32.0, 31.0, 30.0, - 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, - 29.0, 28.0, 27.0, 26.0, 25.0, 24.0, 23.0, 22.0, 21.0, 20.0, - 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, - 19.0, 18.0, 17.0, 16.0, 15.0, 14.0, 13.0, 12.0, 11.0, 10.0, - 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, - 9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0, 0.0) - self.assertEqual (exp_data, result_data) - - def test_stream_2NM_ff(self): - N = 40 - stream_sizes = [7, 9] - self.help_stream_2ff(N, stream_sizes) - - result_data = self.help_stream_2ff(N, stream_sizes) - - exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0) - - self.assertEqual (exp_data, result_data) - - - def test_stream_2MN_ff(self): - N = 37 - stream_sizes = [7, 9] - self.help_stream_2ff(N, stream_sizes) - - result_data = self.help_stream_2ff(N, stream_sizes) - - exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 2.0) - - self.assertEqual (exp_data, result_data) - - def test_stream_2N0_ff(self): - N = 30 - stream_sizes = [7, 0] - self.help_stream_2ff(N, stream_sizes) - - result_data = self.help_stream_2ff(N, stream_sizes) - - exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0) - - self.assertEqual (exp_data, result_data) - - def test_stream_20N_ff(self): - N = 30 - stream_sizes = [0, 9] - self.help_stream_2ff(N, stream_sizes) - - result_data = self.help_stream_2ff(N, stream_sizes) - - exp_data = (2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, - 2.0, 2.0, 2.0) - - self.assertEqual (exp_data, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_stream_mux, "test_stream_mux.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_tag_utils.py b/gnuradio-core/src/python/gnuradio/gr/qa_tag_utils.py index ca1184979b..de1b5aa002 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_tag_utils.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_tag_utils.py @@ -40,9 +40,9 @@ class test_tag_utils (gr_unittest.TestCase): def test_001(self): t = gr.gr_tag_t() t.offset = 10 - t.key = pmt.pmt_string_to_symbol('key') - t.value = pmt.pmt_from_long(23) - t.srcid = pmt.pmt_from_bool(False) + t.key = pmt.string_to_symbol('key') + t.value = pmt.from_long(23) + t.srcid = pmt.from_bool(False) pt = tag_utils.tag_to_python(t) self.assertEqual(pt.key, 'key') self.assertEqual(pt.value, 23) diff --git a/gnuradio-core/src/python/gnuradio/gr/top_block.py b/gnuradio-core/src/python/gnuradio/gr/top_block.py index dc1f443aa9..947e46bc55 100644 --- a/gnuradio-core/src/python/gnuradio/gr/top_block.py +++ b/gnuradio-core/src/python/gnuradio/gr/top_block.py @@ -85,6 +85,12 @@ class _top_block_waiter(_threading.Thread): # method in gr_top_block # class top_block(object): + """ + Top-level hierarchical block representing a flow-graph. + + This is a python wrapper around the C++ implementation to allow + python subclassing. + """ def __init__(self, name="top_block"): self._tb = top_block_swig(name) @@ -93,13 +99,13 @@ class top_block(object): raise RuntimeError("top_block: invalid state--did you forget to call gr.top_block.__init__ in a derived class?") return getattr(self._tb, name) - def start(self, max_noutput_items=100000): + def start(self, max_noutput_items=10000000): self._tb.start(max_noutput_items) def stop(self): self._tb.stop() - def run(self, max_noutput_items=100000): + def run(self, max_noutput_items=10000000): self.start(max_noutput_items) self.wait() diff --git a/gnuradio-core/src/python/gnuradio/gr_unittest.py b/gnuradio-core/src/python/gnuradio/gr_unittest.py index e4510a6eb9..c729566e88 100755 --- a/gnuradio-core/src/python/gnuradio/gr_unittest.py +++ b/gnuradio-core/src/python/gnuradio/gr_unittest.py @@ -19,6 +19,9 @@ # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # +""" +GNU radio specific extension of unittest. +""" import unittest import gr_xmlrunner diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py b/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py index 329fd2ed3d..489b6ab255 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py @@ -27,9 +27,12 @@ import sys def tcp_connect_or_die(sock_addr): """ - @param sock_addr: (host, port) to connect to - @type sock_addr: tuple - @returns: socket or exits + + Args: + sock_addr: (host, port) to connect to (tuple) + + Returns: + : socket or exits """ s = socket.socket (socket.AF_INET, socket.SOCK_STREAM) try: @@ -42,9 +45,12 @@ def tcp_connect_or_die(sock_addr): def udp_connect_or_die(sock_addr): """ - @param sock_addr: (host, port) to connect to - @type sock_addr: tuple - @returns: socket or exits + + Args: + sock_addr: (host, port) to connect to (tuple) + + Returns: + : socket or exits """ s = socket.socket (socket.AF_INET, socket.SOCK_DGRAM) try: diff --git a/gnuradio-core/src/python/gnuradio/optfir.py b/gnuradio-core/src/python/gnuradio/optfir.py deleted file mode 100644 index bbf9ead747..0000000000 --- a/gnuradio-core/src/python/gnuradio/optfir.py +++ /dev/null @@ -1,341 +0,0 @@ -# -# Copyright 2004,2005,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. -# - -''' -Routines for designing optimal FIR filters. - -For a great intro to how all this stuff works, see section 6.6 of -"Digital Signal Processing: A Practical Approach", Emmanuael C. Ifeachor -and Barrie W. Jervis, Adison-Wesley, 1993. ISBN 0-201-54413-X. -''' - -import math, cmath -from gnuradio import gr - -remez = gr.remez - -# ---------------------------------------------------------------- - -## Builds a low pass filter. -# @param gain Filter gain in the passband (linear) -# @param Fs Sampling rate (sps) -# @param freq1 End of pass band (in Hz) -# @param freq2 Start of stop band (in Hz) -# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) -# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) -# @param nextra_taps Extra taps to use in the filter (default=2) -def low_pass (gain, Fs, freq1, freq2, passband_ripple_db, stopband_atten_db, - nextra_taps=2): - passband_dev = passband_ripple_to_dev (passband_ripple_db) - stopband_dev = stopband_atten_to_dev (stopband_atten_db) - desired_ampls = (gain, 0) - (n, fo, ao, w) = remezord ([freq1, freq2], desired_ampls, - [passband_dev, stopband_dev], Fs) - # The remezord typically under-estimates the filter order, so add 2 taps by default - taps = gr.remez (n + nextra_taps, fo, ao, w, "bandpass") - return taps - -## Builds a band pass filter. -# @param gain Filter gain in the passband (linear) -# @param Fs Sampling rate (sps) -# @param freq_sb1 End of stop band (in Hz) -# @param freq_pb1 Start of pass band (in Hz) -# @param freq_pb2 End of pass band (in Hz) -# @param freq_sb2 Start of stop band (in Hz) -# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) -# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) -# @param nextra_taps Extra taps to use in the filter (default=2) -def band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2, - passband_ripple_db, stopband_atten_db, - nextra_taps=2): - passband_dev = passband_ripple_to_dev (passband_ripple_db) - stopband_dev = stopband_atten_to_dev (stopband_atten_db) - desired_ampls = (0, gain, 0) - desired_freqs = [freq_sb1, freq_pb1, freq_pb2, freq_sb2] - desired_ripple = [stopband_dev, passband_dev, stopband_dev] - (n, fo, ao, w) = remezord (desired_freqs, desired_ampls, - desired_ripple, Fs) - # The remezord typically under-estimates the filter order, so add 2 taps by default - taps = gr.remez (n + nextra_taps, fo, ao, w, "bandpass") - return taps - - -## Builds a band pass filter with complex taps by making an LPF and -# spinning it up to the right center frequency -# @param gain Filter gain in the passband (linear) -# @param Fs Sampling rate (sps) -# @param freq_sb1 End of stop band (in Hz) -# @param freq_pb1 Start of pass band (in Hz) -# @param freq_pb2 End of pass band (in Hz) -# @param freq_sb2 Start of stop band (in Hz) -# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) -# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) -# @param nextra_taps Extra taps to use in the filter (default=2) -def complex_band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2, - passband_ripple_db, stopband_atten_db, - nextra_taps=2): - center_freq = (freq_pb2 + freq_pb1) / 2.0 - lp_pb = (freq_pb2 - center_freq)/1.0 - lp_sb = freq_sb2 - center_freq - lptaps = low_pass(gain, Fs, lp_pb, lp_sb, passband_ripple_db, - stopband_atten_db, nextra_taps) - spinner = [cmath.exp(2j*cmath.pi*center_freq/Fs*i) for i in xrange(len(lptaps))] - taps = [s*t for s,t in zip(spinner, lptaps)] - return taps - - -## Builds a band reject filter -# spinning it up to the right center frequency -# @param gain Filter gain in the passband (linear) -# @param Fs Sampling rate (sps) -# @param freq_pb1 End of pass band (in Hz) -# @param freq_sb1 Start of stop band (in Hz) -# @param freq_sb2 End of stop band (in Hz) -# @param freq_pb2 Start of pass band (in Hz) -# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) -# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) -# @param nextra_taps Extra taps to use in the filter (default=2) -def band_reject (gain, Fs, freq_pb1, freq_sb1, freq_sb2, freq_pb2, - passband_ripple_db, stopband_atten_db, - nextra_taps=2): - passband_dev = passband_ripple_to_dev (passband_ripple_db) - stopband_dev = stopband_atten_to_dev (stopband_atten_db) - desired_ampls = (gain, 0, gain) - desired_freqs = [freq_pb1, freq_sb1, freq_sb2, freq_pb2] - desired_ripple = [passband_dev, stopband_dev, passband_dev] - (n, fo, ao, w) = remezord (desired_freqs, desired_ampls, - desired_ripple, Fs) - # Make sure we use an odd number of taps - if((n+nextra_taps)%2 == 1): - n += 1 - # The remezord typically under-estimates the filter order, so add 2 taps by default - taps = gr.remez (n + nextra_taps, fo, ao, w, "bandpass") - return taps - - -## Builds a high pass filter. -# @param gain Filter gain in the passband (linear) -# @param Fs Sampling rate (sps) -# @param freq1 End of stop band (in Hz) -# @param freq2 Start of pass band (in Hz) -# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) -# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) -# @param nextra_taps Extra taps to use in the filter (default=2) -def high_pass (gain, Fs, freq1, freq2, passband_ripple_db, stopband_atten_db, - nextra_taps=2): - passband_dev = passband_ripple_to_dev (passband_ripple_db) - stopband_dev = stopband_atten_to_dev (stopband_atten_db) - desired_ampls = (0, 1) - (n, fo, ao, w) = remezord ([freq1, freq2], desired_ampls, - [stopband_dev, passband_dev], Fs) - # For a HPF, we need to use an odd number of taps - # In gr.remez, ntaps = n+1, so n must be even - if((n+nextra_taps)%2 == 1): - n += 1 - - # The remezord typically under-estimates the filter order, so add 2 taps by default - taps = gr.remez (n + nextra_taps, fo, ao, w, "bandpass") - return taps - -# ---------------------------------------------------------------- - -def stopband_atten_to_dev (atten_db): - """Convert a stopband attenuation in dB to an absolute value""" - return 10**(-atten_db/20) - -def passband_ripple_to_dev (ripple_db): - """Convert passband ripple spec expressed in dB to an absolute value""" - return (10**(ripple_db/20)-1)/(10**(ripple_db/20)+1) - -# ---------------------------------------------------------------- - -def remezord (fcuts, mags, devs, fsamp = 2): - ''' - FIR order estimator (lowpass, highpass, bandpass, mulitiband). - - (n, fo, ao, w) = remezord (f, a, dev) - (n, fo, ao, w) = remezord (f, a, dev, fs) - - (n, fo, ao, w) = remezord (f, a, dev) finds the approximate order, - normalized frequency band edges, frequency band amplitudes, and - weights that meet input specifications f, a, and dev, to use with - the remez command. - - * f is a sequence of frequency band edges (between 0 and Fs/2, where - Fs is the sampling frequency), and a is a sequence specifying the - desired amplitude on the bands defined by f. The length of f is - twice the length of a, minus 2. The desired function is - piecewise constant. - - * dev is a sequence the same size as a that specifies the maximum - allowable deviation or ripples between the frequency response - and the desired amplitude of the output filter, for each band. - - Use remez with the resulting order n, frequency sequence fo, - amplitude response sequence ao, and weights w to design the filter b - which approximately meets the specifications given by remezord - input parameters f, a, and dev: - - b = remez (n, fo, ao, w) - - (n, fo, ao, w) = remezord (f, a, dev, Fs) specifies a sampling frequency Fs. - - Fs defaults to 2 Hz, implying a Nyquist frequency of 1 Hz. You can - therefore specify band edges scaled to a particular applications - sampling frequency. - - In some cases remezord underestimates the order n. If the filter - does not meet the specifications, try a higher order such as n+1 - or n+2. - ''' - # get local copies - fcuts = fcuts[:] - mags = mags[:] - devs = devs[:] - - for i in range (len (fcuts)): - fcuts[i] = float (fcuts[i]) / fsamp - - nf = len (fcuts) - nm = len (mags) - nd = len (devs) - nbands = nm - - if nm != nd: - raise ValueError, "Length of mags and devs must be equal" - - if nf != 2 * (nbands - 1): - raise ValueError, "Length of f must be 2 * len (mags) - 2" - - for i in range (len (mags)): - if mags[i] != 0: # if not stopband, get relative deviation - devs[i] = devs[i] / mags[i] - - # separate the passband and stopband edges - f1 = fcuts[0::2] - f2 = fcuts[1::2] - - n = 0 - min_delta = 2 - for i in range (len (f1)): - if f2[i] - f1[i] < min_delta: - n = i - min_delta = f2[i] - f1[i] - - if nbands == 2: - # lowpass or highpass case (use formula) - l = lporder (f1[n], f2[n], devs[0], devs[1]) - else: - # bandpass or multipass case - # try different lowpasses and take the worst one that - # goes through the BP specs - l = 0 - for i in range (1, nbands-1): - l1 = lporder (f1[i-1], f2[i-1], devs[i], devs[i-1]) - l2 = lporder (f1[i], f2[i], devs[i], devs[i+1]) - l = max (l, l1, l2) - - n = int (math.ceil (l)) - 1 # need order, not length for remez - - # cook up remez compatible result - ff = [0] + fcuts + [1] - for i in range (1, len (ff) - 1): - ff[i] *= 2 - - aa = [] - for a in mags: - aa = aa + [a, a] - - max_dev = max (devs) - wts = [1] * len(devs) - for i in range (len (wts)): - wts[i] = max_dev / devs[i] - - return (n, ff, aa, wts) - -# ---------------------------------------------------------------- - -def lporder (freq1, freq2, delta_p, delta_s): - ''' - FIR lowpass filter length estimator. freq1 and freq2 are - normalized to the sampling frequency. delta_p is the passband - deviation (ripple), delta_s is the stopband deviation (ripple). - - Note, this works for high pass filters too (freq1 > freq2), but - doesnt work well if the transition is near f == 0 or f == fs/2 - - From Herrmann et al (1973), Practical design rules for optimum - finite impulse response filters. Bell System Technical J., 52, 769-99 - ''' - df = abs (freq2 - freq1) - ddp = math.log10 (delta_p) - dds = math.log10 (delta_s) - - a1 = 5.309e-3 - a2 = 7.114e-2 - a3 = -4.761e-1 - a4 = -2.66e-3 - a5 = -5.941e-1 - a6 = -4.278e-1 - - b1 = 11.01217 - b2 = 0.5124401 - - t1 = a1 * ddp * ddp - t2 = a2 * ddp - t3 = a4 * ddp * ddp - t4 = a5 * ddp - - dinf=((t1 + t2 + a3) * dds) + (t3 + t4 + a6) - ff = b1 + b2 * (ddp - dds) - n = dinf / df - ff * df + 1 - return n - - -def bporder (freq1, freq2, delta_p, delta_s): - ''' - FIR bandpass filter length estimator. freq1 and freq2 are - normalized to the sampling frequency. delta_p is the passband - deviation (ripple), delta_s is the stopband deviation (ripple). - - From Mintzer and Liu (1979) - ''' - df = abs (freq2 - freq1) - ddp = math.log10 (delta_p) - dds = math.log10 (delta_s) - - a1 = 0.01201 - a2 = 0.09664 - a3 = -0.51325 - a4 = 0.00203 - a5 = -0.57054 - a6 = -0.44314 - - t1 = a1 * ddp * ddp - t2 = a2 * ddp - t3 = a4 * ddp * ddp - t4 = a5 * ddp - - cinf = dds * (t1 + t2 + a3) + t3 + t4 + a6 - ginf = -14.6 * math.log10 (delta_p / delta_s) - 16.9 - n = cinf / df + ginf * df + 1 - return n - diff --git a/gnuradio-core/src/python/gnuradio/window.py b/gnuradio-core/src/python/gnuradio/window.py deleted file mode 100644 index 4a1d0c5161..0000000000 --- a/gnuradio-core/src/python/gnuradio/window.py +++ /dev/null @@ -1,180 +0,0 @@ -# -# Copyright 2004,2005,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. -# - -''' -Routines for designing window functions. -''' - -import math -from gnuradio import gr - -def izero(x): - izeroepsilon = 1e-21 - halfx = x/2.0 - accum = u = n = 1 - while 1: - temp = halfx/n - n += 1 - temp *= temp - u *= temp - accum += u - if u >= IzeroEPSILON*sum: - break - return accum - -def midm1(fft_size): - return (fft_size - 1)/2 - -def midp1(fft_size): - return (fft_size+1)/2 - -def freq(fft_size): - return 2.0*math.pi/fft_size - -def rate(fft_size): - return 1.0/(fft_size >> 1) - -def expn(fft_size): - math.log(2.0)/(midn(fft_size) + 1.0) - -def hamming(fft_size): - window = [] - for index in xrange(fft_size): - window.append(0.54 - 0.46 * math.cos (2 * math.pi / fft_size * index)) # Hamming window - return window - -def hanning(fft_size): - window = [] - for index in xrange(fft_size): - window.append(0.5 - 0.5 * math.cos (2 * math.pi / fft_size * index)) # von Hann window - return window - -def welch(fft_size): - window = [0 for i in range(fft_size)] - j = fft_size-1 - for index in xrange(midn(fft_size)+1): - window[j] = window[index] = (1.0 - math.sqrt((index - midm1(fft_size)) / midp1(fft_size))) - j -= 1 - return window - -def parzen(fft_size): - window = [0 for i in range(fft_size)] - j = fft_size-1 - for index in xrange(midn(fft_size)+1): - window[j] = window[index] = (1.0 - math.abs((index - midm1(fft_size)) / midp1(fft_size))) - j -= 1 - return window - -def bartlett(fft_size): - mfrq = freq(fft_size) - angle = 0 - window = [0 for i in range(fft_size)] - j = fft_size-1 - for index in xrange(midn(fft_size)+1): - window[j] = window[index] = angle - angle += freq - j -= 1 - return window - -def blackman2(fft_size): - mfrq = freq(fft_size) - angle = 0 - window = [0 for i in range(fft_size)] - j = fft_size-1 - for index in xrange(midn(fft_size)+1): - cx = math.cos(angle) - window[j] = window[index] = (.34401 + (cx * (-.49755 + (cx * .15844)))) - angle += freq - j -= 1 - return window - -def blackman3(fft_size): - mfrq = freq(fft_size) - angle = 0 - window = [0 for i in range(fft_size)] - j = fft_size-1 - for index in xrange(midn(fft_size)+1): - cx = math.cos(angle) - window[j] = window[index] = (.21747 + (cx * (-.45325 + (cx * (.28256 - (cx * .04672)))))) - angle += freq - j -= 1 - return window - -def blackman4(fft_size): - mfrq = freq(fft_size) - angle = 0 - window = [0 for i in range(fft_size)] - j = fft_size-1 - for index in xrange(midn(fft_size)+1): - cx = math.cos(angle) - window[j] = window[index] = (.084037 + (cx * (-.29145 + (cx * (.375696 + (cx * (-.20762 + (cx * .041194)))))))) - angle += freq - j -= 1 - return window - -def exponential(fft_size): - expsum = 1.0 - window = [0 for i in range(fft_size)] - j = fft_size-1 - for index in xrange(midn(fft_size)+1): - window[j] = window[i] = (expsum - 1.0) - expsum *= expn(fft_size) - j -= 1 - return window - -def riemann(fft_size): - sr1 = freq(fft_size) - window = [0 for i in range(fft_size)] - j = fft_size-1 - for index in xrange(midn(fft_size)): - if index == midn(fft_size): - window[index] = window[j] = 1.0 - else: - cx = sr1*midn(fft_size) - index - window[index] = window[j] = math.sin(cx)/cx - j -= 1 - return window - -def kaiser(fft_size,beta): - ibeta = 1.0/izero(beta) - inm1 = 1.0/(fft_size) - window = [0 for i in range(fft_size)] - for index in xrange(fft_size): - window[index] = izero(beta*math.sqrt(1.0 - (index * inm1)*(index * inm1))) * ibeta - return window - -# Closure to generate functions to create cos windows - -def coswindow(coeffs): - def closure(fft_size): - window = [0] * fft_size - #print list(enumerate(coeffs)) - for w_index in range(fft_size): - for (c_index, coeff) in enumerate(coeffs): - window[w_index] += (-1)**c_index * coeff * math.cos(2.0*c_index*math.pi*(w_index+0.5)/(fft_size-1)) - return window - return closure - -blackmanharris = coswindow((0.35875,0.48829,0.14128,0.01168)) -nuttall = coswindow((0.3635819,0.4891775,0.1365995,0.0106411)) # Wikipedia calls this Blackman-Nuttall -nuttall_cfd = coswindow((0.355768,0.487396,0.144232,0.012604)) # Wikipedia calls this Nuttall, continuous first deriv -flattop = coswindow((1.0,1.93,1.29,0.388,0.032)) # Flat top window, coeffs from Wikipedia -rectangular = lambda fft_size: [1]*fft_size diff --git a/gnuradio-core/src/tests/CMakeLists.txt b/gnuradio-core/src/tests/CMakeLists.txt index dbd52f05c7..e99015d7f2 100644 --- a/gnuradio-core/src/tests/CMakeLists.txt +++ b/gnuradio-core/src/tests/CMakeLists.txt @@ -40,18 +40,10 @@ link_directories( # Build benchmarks and non-registered tests ######################################################################## set(tests_not_run #single source per test - benchmark_dotprod_fff.cc - benchmark_dotprod_fsf.cc - benchmark_dotprod_ccf.cc - benchmark_dotprod_fcc.cc - benchmark_dotprod_scc.cc - benchmark_dotprod_ccc.cc benchmark_nco.cc benchmark_vco.cc test_runtime.cc test_general.cc - test_filter.cc - #test_atsc.cc test_vmcircbuf.cc ) diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc deleted file mode 100644 index 8ef26a40dc..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc +++ /dev/null @@ -1,151 +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 <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_ccc.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_ccc* (*fir_maker_t)(const std::vector<gr_complex> &taps); -typedef gr_fir_ccc filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - gr_complex coeffs[NTAPS]; - //gr_complex input[BLOCK_SIZE + NTAPS]; // not always 16-bit aligned - gr_complex *input = new gr_complex[BLOCK_SIZE + NTAPS]; - long n; - gr_complex result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - - - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2); - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2); - - std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start= (double) clock() / CLOCKS_PER_SEC; -#endif - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter ((gr_complex*)&input[j]); - } - } - - // get ending CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end = (double) clock() / CLOCKS_PER_SEC; - double total = clock_end - clock_start; -#endif - - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; - delete [] input; -} - -static void -do_all () -{ - std::vector<gr_fir_ccc_info> info; - gr_fir_util::get_gr_fir_ccc_info (&info); // get all known CCC implementations - - for (std::vector<gr_fir_ccc_info>::iterator p = info.begin (); - p != info.end () ; - ++p){ - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc deleted file mode 100644 index ed3c491651..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc +++ /dev/null @@ -1,153 +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 <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_ccf.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_ccf* (*fir_maker_t)(const std::vector<float> &taps); -typedef gr_fir_ccf filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - float coeffs[NTAPS]; - //gr_complex input[BLOCK_SIZE + NTAPS]; // not always 16-bit aligned - gr_complex *input = new gr_complex[BLOCK_SIZE + NTAPS]; - long n; - gr_complex result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = random() - RANDOM_MAX/2; - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2); - - std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage - -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start= (double) clock() / CLOCKS_PER_SEC; -#endif - - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter (&input[j]); - } - } - - // get ending CPU usage - -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end= (double) clock() / CLOCKS_PER_SEC; - double total = clock_end - clock_start; -#endif - - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; - delete [] input; -} - -static void -do_all () -{ - std::vector<gr_fir_ccf_info> info; - gr_fir_util::get_gr_fir_ccf_info (&info); // get all known CCF implementations - - for (std::vector<gr_fir_ccf_info>::iterator p = info.begin (); - p != info.end () ; - ++p){ - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc b/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc deleted file mode 100644 index e9eeee43a1..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc +++ /dev/null @@ -1,152 +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 <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_fcc.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_fcc* (*fir_maker_t)(const std::vector<gr_complex> &taps); -typedef gr_fir_fcc filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - gr_complex coeffs[NTAPS]; - float input[BLOCK_SIZE + NTAPS]; - long n; - gr_complex result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - - - - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2); - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = random() - RANDOM_MAX/2; - - std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC); -#endif - - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter (&input[j]); - } - } - - // get ending CPU usage - -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end= (double) clock() * (1000000. / CLOCKS_PER_SEC); - double total = clock_end - clock_start; -#endif - - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; -} - -static void -do_all () -{ - std::vector<gr_fir_fcc_info> info; - gr_fir_util::get_gr_fir_fcc_info (&info); // get all known FCC implementations - - for (std::vector<gr_fir_fcc_info>::iterator p = info.begin (); - p != info.end () ; - ++p){ - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/benchmark_dotprod_fff.cc b/gnuradio-core/src/tests/benchmark_dotprod_fff.cc deleted file mode 100644 index 56e0645062..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_fff.cc +++ /dev/null @@ -1,148 +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 <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif - -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_fff.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_fff* (*fir_maker_t)(const std::vector<float> &taps); -typedef gr_fir_fff filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - float coeffs[NTAPS]; - float input[BLOCK_SIZE + NTAPS]; - long n; - float result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = random() - RANDOM_MAX/2; - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = random() - RANDOM_MAX/2; - - std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC); -#endif - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter (&input[j]); - } - } - - // get ending CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end = (double) clock () * (1000000. / CLOCKS_PER_SEC); - double total = clock_end -clock_start; -#endif - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; -} - -static void -do_all () -{ - std::vector<gr_fir_fff_info> info; - gr_fir_util::get_gr_fir_fff_info (&info); // get all known FFF implementations - - for (std::vector<gr_fir_fff_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc b/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc deleted file mode 100644 index a254a8eab4..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc +++ /dev/null @@ -1,151 +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 <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_fsf.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_fsf* (*fir_maker_t)(const std::vector<float> &taps); -typedef gr_fir_fsf filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - float coeffs[NTAPS]; - float input[BLOCK_SIZE + NTAPS]; - long n; - short result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = random() - RANDOM_MAX/2; - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = random() - RANDOM_MAX/2; - - std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start= (double) clock() * (1000000. / CLOCKS_PER_SEC); -#endif - - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter (&input[j]); - } - } - - // get ending CPU usage - -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end= (double) clock() * (1000000. / CLOCKS_PER_SEC); - double total = clock_end - clock_start; -#endif - - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; -} - -static void -do_all () -{ - std::vector<gr_fir_fsf_info> info; - gr_fir_util::get_gr_fir_fsf_info (&info); // get all known FFF implementations - - for (std::vector<gr_fir_fsf_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/benchmark_dotprod_scc.cc b/gnuradio-core/src/tests/benchmark_dotprod_scc.cc deleted file mode 100644 index 9a65bb4c62..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_scc.cc +++ /dev/null @@ -1,151 +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 <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_scc.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_scc* (*fir_maker_t)(const std::vector<gr_complex> &taps); -typedef gr_fir_scc filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - gr_complex coeffs[NTAPS]; - short input[BLOCK_SIZE + NTAPS]; - long n; - gr_complex result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - - - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2); - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = random() - RANDOM_MAX/2; - - std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage - -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC); -#endif - - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter (&input[j]); - } - } - - // get ending CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end= (double) clock () * (1000000. / CLOCKS_PER_SEC); - double total = clock_end -clock_start; -#endif - - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; -} - -static void -do_all () -{ - std::vector<gr_fir_scc_info> info; - gr_fir_util::get_gr_fir_scc_info (&info); // get all known SCC implementations - - for (std::vector<gr_fir_scc_info>::iterator p = info.begin (); - p != info.end () ; - ++p){ - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc index 8a1423e9ea..fb45cbf8f4 100644 --- a/gnuradio-core/src/tests/test_all.cc +++ b/gnuradio-core/src/tests/test_all.cc @@ -26,8 +26,6 @@ #include <gr_unittests.h> #include <qa_runtime.h> #include <qa_general.h> -#include <qa_filter.h> -// #include <qa_atsc.h> // FIXME add atsc back in. @@ -40,8 +38,6 @@ main (int argc, char **argv) runner.addTest (qa_runtime::suite ()); runner.addTest (qa_general::suite ()); - runner.addTest (qa_filter::suite ()); - // runner.addTest (qa_atsc::suite ()); runner.setOutputter(xmlout); bool was_successful = runner.run ("", false); diff --git a/gnuradio-core/src/tests/test_buffers.py b/gnuradio-core/src/tests/test_buffers.py index b867c727c6..2664c136c6 100755 --- a/gnuradio-core/src/tests/test_buffers.py +++ b/gnuradio-core/src/tests/test_buffers.py @@ -25,9 +25,14 @@ from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser -import time +import time, math import sys +def sig_source_f(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.sin(2.*math.pi*freq*x), t) + return y + # Test script to test setting up the buffers using gr_test # For very large buffers it will fail when you hit the circbuf memory limit. # On linux this limit is shmmax, it will fail when it tries to create a buffer > shmmax. @@ -60,10 +65,11 @@ class my_graph(gr.top_block): sample_rate = int(options.sample_rate) ampl = 0.1 + nsamples=int(sample_rate * seconds) #1 seconds - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl) + data = sig_source_f(sample_rate, 350, ampl, nsamples) + src0 = gr.vector_source_f(data) - nsamples=int(sample_rate * seconds) #1 seconds # gr.test (const std::string &name=std::string("gr_test"), # int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1, # int min_outputs=1, int max_outputs=1, unsigned int sizeof_output_item=1, @@ -93,9 +99,8 @@ class my_graph(gr.top_block): #unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0, #bool fixed_rate=false dst = audio.sink (sample_rate, options.audio_output) - head= gr.head(gr.sizeof_float, nsamples) - self.connect (src0,test,head,(dst, 0)) + self.connect (src0,test,(dst, 0)) if __name__ == '__main__': diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc deleted file mode 100644 index 8b17034c60..0000000000 --- a/gnuradio-core/src/tests/test_filter.cc +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 <cppunit/TextTestRunner.h> -#include <cppunit/XmlOutputter.h> - -#include <gr_unittests.h> -#include <qa_filter.h> - -int -main (int argc, char **argv) -{ - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(get_unittest_path("gnuradio_core_filter.xml").c_str()); - CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); - - runner.addTest (qa_filter::suite ()); - runner.setOutputter(xmlout); - - bool was_successful = runner.run ("", false); - - return was_successful ? 0 : 1; -} |