diff options
48 files changed, 15345 insertions, 135 deletions
diff --git a/.gitignore b/.gitignore index a18599872b..5140c03b1c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ *.pyc *.pyo build/ +.idea/ +*.npy +*.lprof @@ -1,139 +1,23 @@ -# -# Copyright 2001-2007,2009,2012 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# +ESA Summer of Code in Space 2015 POLAR Code implementation for GNU Radio +================ -Welcome to GNU Radio! +This is a GNU Radio clone which contains all the files for my POLAR code project for ESA Summer of Code in Space 2015. My name is Johannes Demel and I am a Master degree student at *Karlsruhe Institute of Technology (KIT)*. +Basics +---------- +The project is based on Erdal Arikan's 2009 paper *Channel Polarization: A Method for Constructing Capacity-Achieving Codes for Symmetric Binary-Input Memoryless Channels*. An in-depth explanation of my project is given in my project proposal <https://github.com/jdemel/socis-proposal>. -Please see http://gnuradio.org for the wiki, bug tracking, -and source code viewer. +Structure +---------- +The aim of the project is to add POLAR code encoder, decoder, channel construction capabilities to GNU Radio. POLAR codes are used for channel coding, thus all files shall reside within the *gr-fec* submodule. Also encoder and decoder shall use the FECAPI. The decision to do all development in-tree is driven by previous experience that out-of-tree modules are often terribly hard to merge later on and it may take years to do so. -If you've got questions about GNU Radio, please subscribe to the -discuss-gnuradio mailing list and post your questions there. -http://gnuradio.org/redmine/projects/gnuradio/wiki/MailingLists +Project +------- +A quick overview of my project timeline goes as follows. -There is also a "Build Guide" in the wiki that contains OS specific -recommendations: -http://gnuradio.org/redmine/projects/gnuradio/wiki/BuildGuide - - -The bleeding edge code can be found in our git repository at -http://gnuradio.org/git/gnuradio.git/. To checkout the latest, use -this command: - - $ git clone git://git.gnuradio.org/gnuradio - -For information about using Git, please see: -http://gnuradio.org/redmine/projects/gnuradio/wiki/DevelopingWithGit - - -How to Build GNU Radio: - -For more complete instructions, see the "Building GNU Radio" page in -the GNU Radio manual (can be built or found online at -http://gnuradio.org/doc/doxygen/build_guide.html). - -See these steps for a quick build guide. - - (1) Ensure that you've satisfied the external dependencies. These - dependencies are listed in the manual's build page and are not - presented here to reduce duplication errors. - - See the wiki at http://gnuradio.org for details. - - - (2) Building from cmake: - - $ mkdir $(builddir) - $ cd $(builddir) - $ cmake [OPTIONS] $(srcdir) - $ make - $ make test - $ sudo make install - - -That's it! - -Options: -Useful options include setting the install prefix and the build type: - - -DCMAKE_INSTALL_PREFIX=<directory to install to> - -DCMAKE_BUILD_TYPE="<type>" - -Currently, GNU Radio has a "Debug" type that builds with '-g -O2' -useful for debugging the software and a "Release" type that builds -with '-O3', which is the default. - - -------------------------------------------------------------------------------- - - KNOWN INCOMPATIBILITIES - - - GNU Radio triggers bugs in g++ 3.3 for X86. DO NOT USE GCC 3.3 on - the X86 platform. g++ 3.2, 3.4, and the 4.* series are known to work well. - -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- - - NOTES - -------------------------------------------------------------------------------- - -To run the examples you may need to set PYTHONPATH. Note that the -prefix and python version number in the path needs to match your -installed version of python. - - $ export PYTHONPATH=/usr/local/lib/python2.7/dist-packages - -You may want to add this to your shell init file (~/.bash_profile if -you use bash). - - -Another handy trick if for example your fftw includes and libs are -installed in, say ~/local/include and ~/local/lib, instead of -/usr/local is this: - - $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/local/lib - $ make CPPFLAGS="-I$HOME/local/include" - - -Sometimes the prerequisites are installed in a location which is not -included in the default compiler and linker search paths. This -happens with pkgsrc and NetBSD. To build, tell configure to use these -locations: - - LDFLAGS="-L/usr/pkg/lib -R/usr/pkg/lib" CPPFLAGS="-I/usr/pkg/include" ./configure --prefix=/usr/gnuradio - - -------------------------------------------------------------------------------- - - Legal Matters - -------------------------------------------------------------------------------- - -Some files have been changed many times throughout the -years. Copyright notices at the tops of these files list which years -changes have been made. For some files, changes have occurred in many -consecutive years. These files may often have the format of a year -range (e.g., "2006 - 2011"), which indicates that these files have had -copyrightable changes made during each year in the range, inclusive. +1. create Python testcode +2. implement encoder and decoder in C++ for FECAPI. +3. optimize blocks and create VOLK kernels. +4. implement channel construction algorithms. +This may get continuously updated and I will add more details during project development.
\ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000..8d6fc4b760 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +ESA Summer of Code in Space 2015 POLAR Code implementation for GNU Radio +================ + +This is a GNU Radio clone which contains all the files for my POLAR code project for ESA Summer of Code in Space 2015. My name is Johannes Demel and I am a Master degree student at *Karlsruhe Institute of Technology (KIT)*. + +Basics +---------- +The project is based on Erdal Arikan's 2009 paper *Channel Polarization: A Method for Constructing Capacity-Achieving Codes for Symmetric Binary-Input Memoryless Channels*. An in-depth explanation of my project is given in my project proposal <https://github.com/jdemel/socis-proposal>. + +Structure +---------- +The aim of the project is to add POLAR code encoder, decoder, channel construction capabilities to GNU Radio. POLAR codes are used for channel coding, thus all files shall reside within the *gr-fec* submodule. Also encoder and decoder shall use the FECAPI. The decision to do all development in-tree is driven by previous experience that out-of-tree modules are often terribly hard to merge later on and it may take years to do so. + +Project +------- +A quick overview of my project timeline goes as follows. + +1. create Python testcode +2. implement encoder and decoder in C++ for FECAPI. +3. optimize blocks and create VOLK kernels. +4. implement channel construction algorithms. + +This may get continuously updated and I will add more details during project development.
\ No newline at end of file diff --git a/gr-fec/doc/fec.dox b/gr-fec/doc/fec.dox index e886212e8d..33a825ac77 100644 --- a/gr-fec/doc/fec.dox +++ b/gr-fec/doc/fec.dox @@ -233,11 +233,14 @@ Coders: \li gr::fec::code::repetition_encoder \li gr::fec::code::cc_encoder \li gr::fec::code::ccsds_encoder +\li gr::fec::code::polar_encoder Decoders: \li gr::fec::code::dummy_decoder \li gr::fec::code::repetition_decoder \li gr::fec::code::cc_decoder +\li gr::fec::code::polar_decoder_sc +\li gr::fec::code::polar_decoder_sc_list When building a new FECAPI encoder or decoder variable, the dummy diff --git a/gr-fec/examples/.gitignore b/gr-fec/examples/.gitignore new file mode 100644 index 0000000000..c3393475b0 --- /dev/null +++ b/gr-fec/examples/.gitignore @@ -0,0 +1,3 @@ +*.py +callgrind.out.* +perf.* diff --git a/gr-fec/examples/CMakeLists.txt b/gr-fec/examples/CMakeLists.txt index 88d6d5c069..b396ba625b 100644 --- a/gr-fec/examples/CMakeLists.txt +++ b/gr-fec/examples/CMakeLists.txt @@ -32,6 +32,12 @@ install( fecapi_async_packed_decoders.grc fecapi_tagged_decoders.grc fecapi_tagged_encoders.grc + fecapi_cc_decoders.grc + fecapi_polar_async_packed_decoders.grc + fecapi_polar_decoders.grc + fecapi_polar_encoders.grc + polar_ber_curve_gen.grc + polar_code_example.grc tpc_ber_curve_gen.grc DESTINATION ${GR_PKG_FEC_EXAMPLES_DIR} COMPONENT "fec_python" diff --git a/gr-fec/examples/fecapi_polar_async_packed_decoders.grc b/gr-fec/examples/fecapi_polar_async_packed_decoders.grc new file mode 100644 index 0000000000..e7660cf5e2 --- /dev/null +++ b/gr-fec/examples/fecapi_polar_async_packed_decoders.grc @@ -0,0 +1,1626 @@ +<?xml version='1.0' encoding='utf-8'?> +<?grc format='1' created='3.7.9'?> +<flow_graph> + <timestamp>Tue Sep 22 15:36:05 2015</timestamp> + <block> + <key>options</key> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1920, 1080</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(8, 8)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>generate_options</key> + <value>qt_gui</value> + </param> + <param> + <key>id</key> + <value>fecapi_polar_decoder_examples</value> + </param> + <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>thread_safe_setters</key> + <value></value> + </param> + <param> + <key>title</key> + <value>Polar decoder examples</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value>codeword size of polar codes. + +MUST be a power of 2! +MUST be greater than 'frame_size'.</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(840, 499)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>block_size</value> + </param> + <param> + <key>value</key> + <value>512</value> + </param> + </block> + <block> + <key>variable_polar_code_configurator</key> + <param> + <key>num_info_bits</key> + <value>frame_size * 8</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>channel</key> + <value>polar.CHANNEL_TYPE_BEC</value> + </param> + <param> + <key>comment</key> + <value>Block is used to configure polar encoders and decoders. + +returns dictionary with requested configuration. + +most important dict values: 'values' and 'positions'</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(664, 499)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_config</value> + </param> + <param> + <key>design_snr</key> + <value>0.0</value> + </param> + <param> + <key>mu</key> + <value>32</value> + </param> + </block> + <block> + <key>variable_polar_decoder_sc_def</key> + <param> + <key>num_info_bits</key> + <value>frame_size * 8</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value>Standard 'Successive Cancellation' decoder. + +performs better with greater block size. +This is due to stronger polarization at higher block sizes.</value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(400, 651)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_decoder_sc</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_polar_encoder_def</key> + <param> + <key>num_info_bits</key> + <value>frame_size * 8</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(400, 507)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_encoder_sc</value> + </param> + <param> + <key>is_packed</key> + <value>False</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(8, 99)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>value</key> + <value>int(50e3)</value> + </param> + </block> + <block> + <key>analog_random_source_x</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>_coordinate</key> + <value>(136, 459)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + <param> + <key>id</key> + <value>analog_random_source_x_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>256</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>num_samps</key> + <value>1000</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(1176, 307)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_0_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(672, 235)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_1</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(656, 395)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_1_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_ctrlport_monitor_performance</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>en</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(384, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_ctrlport_monitor_performance_0</value> + </param> + </block> + <block> + <key>blocks_pdu_to_tagged_stream</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(952, 155)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_pdu_to_tagged_stream_0</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>tag</key> + <value>pkt_len</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_pdu_to_tagged_stream</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(976, 307)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_pdu_to_tagged_stream_0_0</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>tag</key> + <value>pkt_len</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_repack_bits_bb</key> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>l</key> + <value>1</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>endianness</key> + <value>gr.GR_MSB_FIRST</value> + </param> + <param> + <key>_coordinate</key> + <value>(920, 227)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + <param> + <key>id</key> + <value>blocks_repack_bits_bb_0</value> + </param> + <param> + <key>len_tag_key</key> + <value>pkt_len</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>align_output</key> + <value>False</value> + </param> + </block> + <block> + <key>blocks_stream_to_tagged_stream</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(168, 387)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_stream_to_tagged_stream_0_0</value> + </param> + <param> + <key>len_tag_key</key> + <value>pkt_len</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>packet_len</key> + <value>frame_size</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_tagged_stream_to_pdu</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(488, 155)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_tagged_stream_to_pdu_0</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>tag</key> + <value>pkt_len</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_tagged_stream_to_pdu</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(528, 307)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_tagged_stream_to_pdu_1</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>tag</key> + <value>pkt_len</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_throttle</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(168, 307)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_throttle_0</value> + </param> + <param> + <key>ignoretag</key> + <value>True</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_vector_source_x</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(136, 203)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + <param> + <key>id</key> + <value>blocks_vector_source_x_0_1_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>tags</key> + <value>[]</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>vector</key> + <value>(frame_size/15)*[0, 0, 1, 0, 3, 0, 7, 0, 15, 0, 31, 0, 63, 0, 127]</value> + </param> + </block> + <block> + <key>digital_map_bb</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(808, 235)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + <param> + <key>id</key> + <value>digital_map_bb_0</value> + </param> + <param> + <key>map</key> + <value>[-1,1]</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>fec_async_decoder</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>decoder</key> + <value>polar_decoder_sc</value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(736, 307)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_async_decoder_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>packed</key> + <value>True</value> + </param> + <param> + <key>rev_pack</key> + <value>False</value> + </param> + </block> + <block> + <key>fec_async_encoder</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>encoder</key> + <value>polar_encoder_sc</value> + </param> + <param> + <key>_coordinate</key> + <value>(712, 155)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_async_encoder_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>packed</key> + <value>True</value> + </param> + <param> + <key>rev_pack</key> + <value>False</value> + </param> + <param> + <key>rev_unpack</key> + <value>False</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(184, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>frame_size</value> + </param> + <param> + <key>label</key> + <value>Frame Size</value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>type</key> + <value>intx</value> + </param> + <param> + <key>value</key> + <value>30</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(296, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>puncpat</value> + </param> + <param> + <key>label</key> + <value></value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>type</key> + <value>string</value> + </param> + <param> + <key>value</key> + <value>'11'</value> + </param> + </block> + <block> + <key>qtgui_time_sink_x</key> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>ctrlpanel</key> + <value>False</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>entags</key> + <value>True</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1336, 363)</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>grid</key> + <value>False</value> + </param> + <param> + <key>id</key> + <value>qtgui_time_sink_x_0</value> + </param> + <param> + <key>legend</key> + <value>True</value> + </param> + <param> + <key>alpha1</key> + <value>1.0</value> + </param> + <param> + <key>color1</key> + <value>"blue"</value> + </param> + <param> + <key>label1</key> + <value>Decoded</value> + </param> + <param> + <key>marker1</key> + <value>-1</value> + </param> + <param> + <key>style1</key> + <value>1</value> + </param> + <param> + <key>width1</key> + <value>1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>alpha2</key> + <value>0.6</value> + </param> + <param> + <key>color2</key> + <value>"red"</value> + </param> + <param> + <key>label2</key> + <value>Input</value> + </param> + <param> + <key>marker2</key> + <value>-1</value> + </param> + <param> + <key>style2</key> + <value>1</value> + </param> + <param> + <key>width2</key> + <value>1</value> + </param> + <param> + <key>alpha3</key> + <value>1.0</value> + </param> + <param> + <key>color3</key> + <value>"green"</value> + </param> + <param> + <key>label3</key> + <value>Rep. (Rate=3)</value> + </param> + <param> + <key>marker3</key> + <value>-1</value> + </param> + <param> + <key>style3</key> + <value>1</value> + </param> + <param> + <key>width3</key> + <value>1</value> + </param> + <param> + <key>alpha4</key> + <value>1.0</value> + </param> + <param> + <key>color4</key> + <value>"black"</value> + </param> + <param> + <key>label4</key> + <value>CC (K=7, Rate=2)</value> + </param> + <param> + <key>marker4</key> + <value>-1</value> + </param> + <param> + <key>style4</key> + <value>1</value> + </param> + <param> + <key>width4</key> + <value>1</value> + </param> + <param> + <key>alpha5</key> + <value>1.0</value> + </param> + <param> + <key>color5</key> + <value>"cyan"</value> + </param> + <param> + <key>label5</key> + <value>CCSDS</value> + </param> + <param> + <key>marker5</key> + <value>-1</value> + </param> + <param> + <key>style5</key> + <value>1</value> + </param> + <param> + <key>width5</key> + <value>1</value> + </param> + <param> + <key>alpha6</key> + <value>1.0</value> + </param> + <param> + <key>color6</key> + <value>"magenta"</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>marker6</key> + <value>-1</value> + </param> + <param> + <key>style6</key> + <value>1</value> + </param> + <param> + <key>width6</key> + <value>1</value> + </param> + <param> + <key>alpha7</key> + <value>1.0</value> + </param> + <param> + <key>color7</key> + <value>"yellow"</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>marker7</key> + <value>-1</value> + </param> + <param> + <key>style7</key> + <value>1</value> + </param> + <param> + <key>width7</key> + <value>1</value> + </param> + <param> + <key>alpha8</key> + <value>1.0</value> + </param> + <param> + <key>color8</key> + <value>"dark red"</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>marker8</key> + <value>-1</value> + </param> + <param> + <key>style8</key> + <value>1</value> + </param> + <param> + <key>width8</key> + <value>1</value> + </param> + <param> + <key>alpha9</key> + <value>1.0</value> + </param> + <param> + <key>color9</key> + <value>"dark green"</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>marker9</key> + <value>-1</value> + </param> + <param> + <key>style9</key> + <value>1</value> + </param> + <param> + <key>width9</key> + <value>1</value> + </param> + <param> + <key>name</key> + <value></value> + </param> + <param> + <key>nconnections</key> + <value>2</value> + </param> + <param> + <key>size</key> + <value>512</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>tr_chan</key> + <value>0</value> + </param> + <param> + <key>tr_delay</key> + <value>0</value> + </param> + <param> + <key>tr_level</key> + <value>0.0</value> + </param> + <param> + <key>tr_mode</key> + <value>qtgui.TRIG_MODE_FREE</value> + </param> + <param> + <key>tr_slope</key> + <value>qtgui.TRIG_SLOPE_POS</value> + </param> + <param> + <key>tr_tag</key> + <value>""</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>update_time</key> + <value>0.01</value> + </param> + <param> + <key>ylabel</key> + <value>Amplitude</value> + </param> + <param> + <key>yunit</key> + <value>""</value> + </param> + <param> + <key>ymax</key> + <value>140</value> + </param> + <param> + <key>ymin</key> + <value>-1</value> + </param> + </block> + <connection> + <source_block_id>analog_random_source_x_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_0_0_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_1</source_block_id> + <sink_block_id>blocks_tagged_stream_to_pdu_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_1_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>blocks_pdu_to_tagged_stream_0</source_block_id> + <sink_block_id>blocks_repack_bits_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_pdu_to_tagged_stream_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_0_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_repack_bits_bb_0</source_block_id> + <sink_block_id>digital_map_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_stream_to_tagged_stream_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_stream_to_tagged_stream_0_0</source_block_id> + <sink_block_id>blocks_tagged_stream_to_pdu_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_tagged_stream_to_pdu_0</source_block_id> + <sink_block_id>fec_async_encoder_0</sink_block_id> + <source_key>pdus</source_key> + <sink_key>in</sink_key> + </connection> + <connection> + <source_block_id>blocks_tagged_stream_to_pdu_1</source_block_id> + <sink_block_id>fec_async_decoder_0</sink_block_id> + <source_key>pdus</source_key> + <sink_key>in</sink_key> + </connection> + <connection> + <source_block_id>blocks_throttle_0</source_block_id> + <sink_block_id>blocks_stream_to_tagged_stream_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_vector_source_x_0_1_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_map_bb_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_async_decoder_0</source_block_id> + <sink_block_id>blocks_pdu_to_tagged_stream_0_0</sink_block_id> + <source_key>out</source_key> + <sink_key>pdus</sink_key> + </connection> + <connection> + <source_block_id>fec_async_encoder_0</source_block_id> + <sink_block_id>blocks_pdu_to_tagged_stream_0</sink_block_id> + <source_key>out</source_key> + <sink_key>pdus</sink_key> + </connection> +</flow_graph> diff --git a/gr-fec/examples/fecapi_polar_decoders.grc b/gr-fec/examples/fecapi_polar_decoders.grc new file mode 100644 index 0000000000..83e86fde40 --- /dev/null +++ b/gr-fec/examples/fecapi_polar_decoders.grc @@ -0,0 +1,2102 @@ +<?xml version='1.0' encoding='utf-8'?> +<?grc format='1' created='3.7.9'?> +<flow_graph> + <timestamp>Tue Sep 22 15:13:38 2015</timestamp> + <block> + <key>options</key> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1920, 1080</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(8, 8)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>generate_options</key> + <value>qt_gui</value> + </param> + <param> + <key>id</key> + <value>fecapi_polar_decoders</value> + </param> + <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>thread_safe_setters</key> + <value></value> + </param> + <param> + <key>title</key> + <value>Polar Decoders Example</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value>codeword size of polar codes. + +MUST be a power of 2! +MUST be greater than 'frame_size'.</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1320, 547)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>block_size</value> + </param> + <param> + <key>value</key> + <value>512</value> + </param> + </block> + <block> + <key>variable_dummy_decoder_def</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>framebits</key> + <value>frame_size*8</value> + </param> + <param> + <key>_coordinate</key> + <value>(152, 643)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>dec_dummy</value> + </param> + <param> + <key>value</key> + <value>"ok"</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_dummy_encoder_def</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>4</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>framebits</key> + <value>frame_size*8</value> + </param> + <param> + <key>_coordinate</key> + <value>(152, 563)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>enc_dummy</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_polar_code_configurator</key> + <param> + <key>num_info_bits</key> + <value>frame_size * 8</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>channel</key> + <value>polar.CHANNEL_TYPE_BEC</value> + </param> + <param> + <key>comment</key> + <value>Block is used to configure polar encoders and decoders. + +returns dictionary with requested configuration. + +most important dict values: 'values' and 'positions'</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1144, 547)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_config</value> + </param> + <param> + <key>design_snr</key> + <value>0.0</value> + </param> + <param> + <key>mu</key> + <value>32</value> + </param> + </block> + <block> + <key>variable_polar_decoder_sc_def</key> + <param> + <key>num_info_bits</key> + <value>frame_size * 8</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value>Standard 'Successive Cancellation' decoder. + +performs better with greater block size. +This is due to stronger polarization at higher block sizes.</value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(408, 691)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_decoder_sc</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_polar_decoder_sc_list_def</key> + <param> + <key>num_info_bits</key> + <value>frame_size * 8</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value>Advanced 'Successive Cancellation List' decoder + +Greater list size usually results in better decoding performance. +But it is computationally more heavy.</value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(776, 691)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_decoder_scl</value> + </param> + <param> + <key>max_list_size</key> + <value>8</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_polar_encoder_def</key> + <param> + <key>num_info_bits</key> + <value>frame_size * 8</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(408, 547)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_encoder_sc</value> + </param> + <param> + <key>is_packed</key> + <value>False</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_polar_encoder_def</key> + <param> + <key>num_info_bits</key> + <value>frame_size * 8</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(776, 547)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_encoder_scl</value> + </param> + <param> + <key>is_packed</key> + <value>False</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(8, 107)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>value</key> + <value>50000</value> + </param> + </block> + <block> + <key>analog_random_source_x</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>_coordinate</key> + <value>(160, 459)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + <param> + <key>id</key> + <value>analog_random_source_x_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>256</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>num_samps</key> + <value>1000</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(768, 427)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1136, 427)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1136, 331)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1136, 235)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_0_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(432, 147)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_1</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(768, 331)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_2</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(768, 235)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_2_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_ctrlport_monitor_performance</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>en</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(392, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_ctrlport_monitor_performance_0</value> + </param> + </block> + <block> + <key>blocks_throttle</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(208, 267)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_throttle_0</value> + </param> + <param> + <key>ignoretag</key> + <value>True</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_unpack_k_bits_bb</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(224, 371)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_unpack_k_bits_bb_0</value> + </param> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_vector_source_x</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(168, 139)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + <param> + <key>id</key> + <value>blocks_vector_source_x_0_1_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>tags</key> + <value>[]</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>vector</key> + <value>(frame_size/15)*[0, 0, 1, 0, 3, 0, 7, 0, 15, 0, 31, 0, 63, 0, 127]</value> + </param> + </block> + <block> + <key>digital_map_bb</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(656, 427)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>digital_map_bb_0_0</value> + </param> + <param> + <key>map</key> + <value>[-1, 1]</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_map_bb</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(656, 331)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>digital_map_bb_0_0_0</value> + </param> + <param> + <key>map</key> + <value>[-1, 1]</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_map_bb</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(656, 235)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>digital_map_bb_0_0_0_0</value> + </param> + <param> + <key>map</key> + <value>[-1, 1]</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>fec_extended_decoder</key> + <param> + <key>ann</key> + <value>None</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>decoder_list</key> + <value>polar_decoder_scl</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(912, 403)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_extended_decoder_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>threadtype</key> + <value>none</value> + </param> + <param> + <key>value</key> + <value>fec_extended_decoder</value> + </param> + </block> + <block> + <key>fec_extended_decoder</key> + <param> + <key>ann</key> + <value>None</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>decoder_list</key> + <value>polar_decoder_sc</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(912, 307)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_extended_decoder_0_1</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>threadtype</key> + <value>none</value> + </param> + <param> + <key>value</key> + <value>fec_extended_decoder</value> + </param> + </block> + <block> + <key>fec_extended_decoder</key> + <param> + <key>ann</key> + <value>None</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>decoder_list</key> + <value>dec_dummy</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(912, 211)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_extended_decoder_0_1_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>threadtype</key> + <value>none</value> + </param> + <param> + <key>value</key> + <value>fec_extended_decoder</value> + </param> + </block> + <block> + <key>fec_extended_encoder</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>encoder_list</key> + <value>polar_encoder_scl</value> + </param> + <param> + <key>_coordinate</key> + <value>(432, 411)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_extended_encoder_1</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>threadtype</key> + <value>capillary</value> + </param> + </block> + <block> + <key>fec_extended_encoder</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>encoder_list</key> + <value>polar_encoder_sc</value> + </param> + <param> + <key>_coordinate</key> + <value>(432, 315)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_extended_encoder_1_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>threadtype</key> + <value>capillary</value> + </param> + </block> + <block> + <key>fec_extended_encoder</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>encoder_list</key> + <value>enc_dummy</value> + </param> + <param> + <key>_coordinate</key> + <value>(432, 219)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_extended_encoder_1_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>threadtype</key> + <value>capillary</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(200, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>frame_size</value> + </param> + <param> + <key>label</key> + <value>Frame Size</value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>type</key> + <value>intx</value> + </param> + <param> + <key>value</key> + <value>30</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(312, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>puncpat</value> + </param> + <param> + <key>label</key> + <value></value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>type</key> + <value>string</value> + </param> + <param> + <key>value</key> + <value>'11'</value> + </param> + </block> + <block> + <key>qtgui_time_sink_x</key> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>ctrlpanel</key> + <value>False</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>entags</key> + <value>True</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1408, 153)</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>grid</key> + <value>False</value> + </param> + <param> + <key>id</key> + <value>qtgui_time_sink_x_0</value> + </param> + <param> + <key>legend</key> + <value>True</value> + </param> + <param> + <key>alpha1</key> + <value>1.0</value> + </param> + <param> + <key>color1</key> + <value>"blue"</value> + </param> + <param> + <key>label1</key> + <value>Input</value> + </param> + <param> + <key>marker1</key> + <value>-1</value> + </param> + <param> + <key>style1</key> + <value>1</value> + </param> + <param> + <key>width1</key> + <value>1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>alpha2</key> + <value>0.6</value> + </param> + <param> + <key>color2</key> + <value>"red"</value> + </param> + <param> + <key>label2</key> + <value>Dummy</value> + </param> + <param> + <key>marker2</key> + <value>-1</value> + </param> + <param> + <key>style2</key> + <value>1</value> + </param> + <param> + <key>width2</key> + <value>1</value> + </param> + <param> + <key>alpha3</key> + <value>1.0</value> + </param> + <param> + <key>color3</key> + <value>"green"</value> + </param> + <param> + <key>label3</key> + <value>Polar with SC decoder</value> + </param> + <param> + <key>marker3</key> + <value>-1</value> + </param> + <param> + <key>style3</key> + <value>1</value> + </param> + <param> + <key>width3</key> + <value>1</value> + </param> + <param> + <key>alpha4</key> + <value>1.0</value> + </param> + <param> + <key>color4</key> + <value>"black"</value> + </param> + <param> + <key>label4</key> + <value>Polar with SC list decoder</value> + </param> + <param> + <key>marker4</key> + <value>-1</value> + </param> + <param> + <key>style4</key> + <value>1</value> + </param> + <param> + <key>width4</key> + <value>1</value> + </param> + <param> + <key>alpha5</key> + <value>1.0</value> + </param> + <param> + <key>color5</key> + <value>"cyan"</value> + </param> + <param> + <key>label5</key> + <value>CCSDS</value> + </param> + <param> + <key>marker5</key> + <value>-1</value> + </param> + <param> + <key>style5</key> + <value>1</value> + </param> + <param> + <key>width5</key> + <value>1</value> + </param> + <param> + <key>alpha6</key> + <value>1.0</value> + </param> + <param> + <key>color6</key> + <value>"magenta"</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>marker6</key> + <value>-1</value> + </param> + <param> + <key>style6</key> + <value>1</value> + </param> + <param> + <key>width6</key> + <value>1</value> + </param> + <param> + <key>alpha7</key> + <value>1.0</value> + </param> + <param> + <key>color7</key> + <value>"yellow"</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>marker7</key> + <value>-1</value> + </param> + <param> + <key>style7</key> + <value>1</value> + </param> + <param> + <key>width7</key> + <value>1</value> + </param> + <param> + <key>alpha8</key> + <value>1.0</value> + </param> + <param> + <key>color8</key> + <value>"dark red"</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>marker8</key> + <value>-1</value> + </param> + <param> + <key>style8</key> + <value>1</value> + </param> + <param> + <key>width8</key> + <value>1</value> + </param> + <param> + <key>alpha9</key> + <value>1.0</value> + </param> + <param> + <key>color9</key> + <value>"dark green"</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>marker9</key> + <value>-1</value> + </param> + <param> + <key>style9</key> + <value>1</value> + </param> + <param> + <key>width9</key> + <value>1</value> + </param> + <param> + <key>name</key> + <value></value> + </param> + <param> + <key>nconnections</key> + <value>4</value> + </param> + <param> + <key>size</key> + <value>2048</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>tr_chan</key> + <value>0</value> + </param> + <param> + <key>tr_delay</key> + <value>0</value> + </param> + <param> + <key>tr_level</key> + <value>0.0</value> + </param> + <param> + <key>tr_mode</key> + <value>qtgui.TRIG_MODE_FREE</value> + </param> + <param> + <key>tr_slope</key> + <value>qtgui.TRIG_SLOPE_POS</value> + </param> + <param> + <key>tr_tag</key> + <value>""</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>update_time</key> + <value>0.01</value> + </param> + <param> + <key>ylabel</key> + <value>Amplitude</value> + </param> + <param> + <key>yunit</key> + <value>""</value> + </param> + <param> + <key>ymax</key> + <value>1.5</value> + </param> + <param> + <key>ymin</key> + <value>-0.5</value> + </param> + </block> + <connection> + <source_block_id>analog_random_source_x_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0</source_block_id> + <sink_block_id>fec_extended_decoder_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>3</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_0_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>2</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_0_0_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_1</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_2</source_block_id> + <sink_block_id>fec_extended_decoder_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_2_0</source_block_id> + <sink_block_id>fec_extended_decoder_0_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_throttle_0</source_block_id> + <sink_block_id>blocks_unpack_k_bits_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>fec_extended_encoder_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>fec_extended_encoder_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>fec_extended_encoder_1_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_vector_source_x_0_1_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_map_bb_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_map_bb_0_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_2</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_map_bb_0_0_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_decoder_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_decoder_0_1</source_block_id> + <sink_block_id>blocks_char_to_float_0_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_decoder_0_1_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_0_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_encoder_1</source_block_id> + <sink_block_id>digital_map_bb_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_encoder_1_0</source_block_id> + <sink_block_id>digital_map_bb_0_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_encoder_1_0_0</source_block_id> + <sink_block_id>digital_map_bb_0_0_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-fec/examples/fecapi_polar_encoders.grc b/gr-fec/examples/fecapi_polar_encoders.grc new file mode 100644 index 0000000000..93036fd834 --- /dev/null +++ b/gr-fec/examples/fecapi_polar_encoders.grc @@ -0,0 +1,1808 @@ +<?xml version='1.0' encoding='utf-8'?> +<?grc format='1' created='3.7.9'?> +<flow_graph> + <timestamp>Tue Sep 22 15:53:02 2015</timestamp> + <block> + <key>options</key> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1920, 1080</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(8, 8)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>generate_options</key> + <value>qt_gui</value> + </param> + <param> + <key>id</key> + <value>fecapi_polar_encoders</value> + </param> + <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>thread_safe_setters</key> + <value></value> + </param> + <param> + <key>title</key> + <value>Polar encoder examples</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(8, 155)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>n_info_bits</value> + </param> + <param> + <key>value</key> + <value>frame_size * 8</value> + </param> + </block> + <block> + <key>variable_polar_code_configurator</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>channel</key> + <value>polar.CHANNEL_TYPE_BEC</value> + </param> + <param> + <key>comment</key> + <value>Block is used to configure polar encoders and decoders. + +returns dictionary with requested configuration. + +most important dict values: 'values' and 'positions'</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(704, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_config</value> + </param> + <param> + <key>design_snr</key> + <value>0.0</value> + </param> + <param> + <key>mu</key> + <value>32</value> + </param> + </block> + <block> + <key>variable_polar_encoder_def</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(1152, 635)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_encoder_async</value> + </param> + <param> + <key>is_packed</key> + <value>False</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_polar_encoder_def</key> + <param> + <key>num_info_bits</key> + <value>frame_size * 8</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(488, 635)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_encoder_stream</value> + </param> + <param> + <key>is_packed</key> + <value>False</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_polar_encoder_def</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(840, 635)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_encoder_tagged</value> + </param> + <param> + <key>is_packed</key> + <value>False</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(8, 91)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>value</key> + <value>int(50e3)</value> + </param> + </block> + <block> + <key>analog_random_source_x</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>_coordinate</key> + <value>(208, 483)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + <param> + <key>id</key> + <value>analog_random_source_x_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>256</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>num_samps</key> + <value>1000</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value>codeword size of polar codes. + +MUST be a power of 2! +MUST be greater than 'frame_size'.</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(296, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>block_size</value> + </param> + <param> + <key>label</key> + <value>Block size</value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>type</key> + <value>intx</value> + </param> + <param> + <key>value</key> + <value>512</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(1064, 499)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_1</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(1064, 259)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_1_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(1064, 339)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_1_0_0_1</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_ctrlport_monitor_performance</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>en</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(496, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_ctrlport_monitor_performance_0</value> + </param> + </block> + <block> + <key>blocks_pdu_to_tagged_stream</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(536, 499)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_pdu_to_tagged_stream_0</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>tag</key> + <value>pkt_len</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_repack_bits_bb</key> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>l</key> + <value>1</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>endianness</key> + <value>gr.GR_MSB_FIRST</value> + </param> + <param> + <key>_coordinate</key> + <value>(736, 491)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_repack_bits_bb_0</value> + </param> + <param> + <key>len_tag_key</key> + <value>pkt_len</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>align_output</key> + <value>False</value> + </param> + </block> + <block> + <key>blocks_repack_bits_bb</key> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>l</key> + <value>1</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>endianness</key> + <value>gr.GR_MSB_FIRST</value> + </param> + <param> + <key>_coordinate</key> + <value>(640, 331)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_repack_bits_bb_0_0</value> + </param> + <param> + <key>len_tag_key</key> + <value>length_tag</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>align_output</key> + <value>False</value> + </param> + </block> + <block> + <key>blocks_stream_to_tagged_stream</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(424, 331)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_stream_to_tagged_stream_0</value> + </param> + <param> + <key>len_tag_key</key> + <value>length_tag</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>packet_len</key> + <value>frame_size</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_stream_to_tagged_stream</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(424, 411)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_stream_to_tagged_stream_0_0</value> + </param> + <param> + <key>len_tag_key</key> + <value>pkt_len</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>packet_len</key> + <value>frame_size</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_tagged_stream_to_pdu</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(648, 419)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_tagged_stream_to_pdu_0</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>tag</key> + <value>pkt_len</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_throttle</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(216, 355)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_throttle_0</value> + </param> + <param> + <key>ignoretag</key> + <value>True</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_unpack_k_bits_bb</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(424, 259)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_unpack_k_bits_bb_0</value> + </param> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_vector_source_x</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(176, 251)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_vector_source_x_0_1_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>tags</key> + <value>[]</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>vector</key> + <value>(frame_size/15)*[0, 0, 1, 0, 3, 0, 7, 0, 15, 0, 31, 0, 63, 0, 127]</value> + </param> + </block> + <block> + <key>fec_async_encoder</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>encoder</key> + <value>polar_encoder_async</value> + </param> + <param> + <key>_coordinate</key> + <value>(872, 419)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_async_encoder_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>packed</key> + <value>True</value> + </param> + <param> + <key>rev_pack</key> + <value>False</value> + </param> + <param> + <key>rev_unpack</key> + <value>False</value> + </param> + </block> + <block> + <key>fec_extended_encoder</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>encoder_list</key> + <value>polar_encoder_stream</value> + </param> + <param> + <key>_coordinate</key> + <value>(568, 243)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_extended_encoder_0_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>threadtype</key> + <value>none</value> + </param> + </block> + <block> + <key>fec_extended_tagged_encoder</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>encoder_list</key> + <value>polar_encoder_tagged</value> + </param> + <param> + <key>_coordinate</key> + <value>(824, 323)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_extended_tagged_encoder_0_0</value> + </param> + <param> + <key>lentagname</key> + <value>length_tag</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(184, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>frame_size</value> + </param> + <param> + <key>label</key> + <value>Frame Size</value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>type</key> + <value>intx</value> + </param> + <param> + <key>value</key> + <value>30</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(408, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>puncpat</value> + </param> + <param> + <key>label</key> + <value></value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>type</key> + <value>string</value> + </param> + <param> + <key>value</key> + <value>'11'</value> + </param> + </block> + <block> + <key>qtgui_time_sink_x</key> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>ctrlpanel</key> + <value>False</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>entags</key> + <value>True</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1264, 313)</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>grid</key> + <value>False</value> + </param> + <param> + <key>id</key> + <value>qtgui_time_sink_x_0_0_1</value> + </param> + <param> + <key>legend</key> + <value>True</value> + </param> + <param> + <key>alpha1</key> + <value>1.0</value> + </param> + <param> + <key>color1</key> + <value>"blue"</value> + </param> + <param> + <key>label1</key> + <value>Polar extended encoder</value> + </param> + <param> + <key>marker1</key> + <value>-1</value> + </param> + <param> + <key>style1</key> + <value>1</value> + </param> + <param> + <key>width1</key> + <value>1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>alpha2</key> + <value>0.6</value> + </param> + <param> + <key>color2</key> + <value>"red"</value> + </param> + <param> + <key>label2</key> + <value>Polar extended tagged encoder</value> + </param> + <param> + <key>marker2</key> + <value>-1</value> + </param> + <param> + <key>style2</key> + <value>1</value> + </param> + <param> + <key>width2</key> + <value>1</value> + </param> + <param> + <key>alpha3</key> + <value>1.0</value> + </param> + <param> + <key>color3</key> + <value>"green"</value> + </param> + <param> + <key>label3</key> + <value>Polar async encoder</value> + </param> + <param> + <key>marker3</key> + <value>-1</value> + </param> + <param> + <key>style3</key> + <value>1</value> + </param> + <param> + <key>width3</key> + <value>1</value> + </param> + <param> + <key>alpha4</key> + <value>1.0</value> + </param> + <param> + <key>color4</key> + <value>"black"</value> + </param> + <param> + <key>label4</key> + <value></value> + </param> + <param> + <key>marker4</key> + <value>-1</value> + </param> + <param> + <key>style4</key> + <value>1</value> + </param> + <param> + <key>width4</key> + <value>1</value> + </param> + <param> + <key>alpha5</key> + <value>1.0</value> + </param> + <param> + <key>color5</key> + <value>"cyan"</value> + </param> + <param> + <key>label5</key> + <value></value> + </param> + <param> + <key>marker5</key> + <value>-1</value> + </param> + <param> + <key>style5</key> + <value>1</value> + </param> + <param> + <key>width5</key> + <value>1</value> + </param> + <param> + <key>alpha6</key> + <value>1.0</value> + </param> + <param> + <key>color6</key> + <value>"magenta"</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>marker6</key> + <value>-1</value> + </param> + <param> + <key>style6</key> + <value>1</value> + </param> + <param> + <key>width6</key> + <value>1</value> + </param> + <param> + <key>alpha7</key> + <value>1.0</value> + </param> + <param> + <key>color7</key> + <value>"yellow"</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>marker7</key> + <value>-1</value> + </param> + <param> + <key>style7</key> + <value>1</value> + </param> + <param> + <key>width7</key> + <value>1</value> + </param> + <param> + <key>alpha8</key> + <value>1.0</value> + </param> + <param> + <key>color8</key> + <value>"dark red"</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>marker8</key> + <value>-1</value> + </param> + <param> + <key>style8</key> + <value>1</value> + </param> + <param> + <key>width8</key> + <value>1</value> + </param> + <param> + <key>alpha9</key> + <value>1.0</value> + </param> + <param> + <key>color9</key> + <value>"dark green"</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>marker9</key> + <value>-1</value> + </param> + <param> + <key>style9</key> + <value>1</value> + </param> + <param> + <key>width9</key> + <value>1</value> + </param> + <param> + <key>name</key> + <value></value> + </param> + <param> + <key>nconnections</key> + <value>3</value> + </param> + <param> + <key>size</key> + <value>2050</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>tr_chan</key> + <value>0</value> + </param> + <param> + <key>tr_delay</key> + <value>0</value> + </param> + <param> + <key>tr_level</key> + <value>0.0</value> + </param> + <param> + <key>tr_mode</key> + <value>qtgui.TRIG_MODE_FREE</value> + </param> + <param> + <key>tr_slope</key> + <value>qtgui.TRIG_SLOPE_POS</value> + </param> + <param> + <key>tr_tag</key> + <value>packet_len</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>update_time</key> + <value>0.05</value> + </param> + <param> + <key>ylabel</key> + <value>Amplitude</value> + </param> + <param> + <key>yunit</key> + <value>""</value> + </param> + <param> + <key>ymax</key> + <value>1.5</value> + </param> + <param> + <key>ymin</key> + <value>-0.5</value> + </param> + </block> + <connection> + <source_block_id>analog_random_source_x_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_1</source_block_id> + <sink_block_id>qtgui_time_sink_x_0_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>2</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_1_0_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_1_0_0_1</source_block_id> + <sink_block_id>qtgui_time_sink_x_0_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>blocks_pdu_to_tagged_stream_0</source_block_id> + <sink_block_id>blocks_repack_bits_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_repack_bits_bb_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_repack_bits_bb_0_0</source_block_id> + <sink_block_id>fec_extended_tagged_encoder_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_stream_to_tagged_stream_0</source_block_id> + <sink_block_id>blocks_repack_bits_bb_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_stream_to_tagged_stream_0_0</source_block_id> + <sink_block_id>blocks_tagged_stream_to_pdu_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_tagged_stream_to_pdu_0</source_block_id> + <sink_block_id>fec_async_encoder_0</sink_block_id> + <source_key>pdus</source_key> + <sink_key>in</sink_key> + </connection> + <connection> + <source_block_id>blocks_throttle_0</source_block_id> + <sink_block_id>blocks_stream_to_tagged_stream_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_throttle_0</source_block_id> + <sink_block_id>blocks_stream_to_tagged_stream_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_throttle_0</source_block_id> + <sink_block_id>blocks_unpack_k_bits_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>fec_extended_encoder_0_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_vector_source_x_0_1_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_async_encoder_0</source_block_id> + <sink_block_id>blocks_pdu_to_tagged_stream_0</sink_block_id> + <source_key>out</source_key> + <sink_key>pdus</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_encoder_0_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_1_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_tagged_encoder_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_1_0_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-fec/examples/polar_ber_curve_gen.grc b/gr-fec/examples/polar_ber_curve_gen.grc new file mode 100644 index 0000000000..19fbaba4fc --- /dev/null +++ b/gr-fec/examples/polar_ber_curve_gen.grc @@ -0,0 +1,1602 @@ +<?xml version='1.0' encoding='utf-8'?> +<?grc format='1' created='3.7.9'?> +<flow_graph> + <timestamp>Fri Jul 17 15:23:09 2015</timestamp> + <block> + <key>options</key> + <param> + <key>author</key> + <value>Johannes Demel</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1920,1080</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>generate_options</key> + <value>qt_gui</value> + </param> + <param> + <key>id</key> + <value>polar_ber_curve_gen</value> + </param> + <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>thread_safe_setters</key> + <value></value> + </param> + <param> + <key>title</key> + <value>polar code BER curve generator</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(304, 35)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>block_size</value> + </param> + <param> + <key>value</key> + <value>1024</value> + </param> + </block> + <block> + <key>variable_cc_decoder_def</key> + <param> + <key>padding</key> + <value>False</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>k</key> + <value>k</value> + </param> + <param> + <key>dim1</key> + <value>len(esno)</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>state_end</key> + <value>-1</value> + </param> + <param> + <key>framebits</key> + <value>frame_size</value> + </param> + <param> + <key>_coordinate</key> + <value>(1368, 395)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>dec_cc</value> + </param> + <param> + <key>value</key> + <value>"ok"</value> + </param> + <param> + <key>ndim</key> + <value>2</value> + </param> + <param> + <key>polys</key> + <value>polys</value> + </param> + <param> + <key>rate</key> + <value>rate</value> + </param> + <param> + <key>state_start</key> + <value>0</value> + </param> + <param> + <key>mode</key> + <value>fec.CC_STREAMING</value> + </param> + </block> + <block> + <key>variable_cc_encoder_def</key> + <param> + <key>padding</key> + <value>False</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>k</key> + <value>k</value> + </param> + <param> + <key>dim1</key> + <value>len(esno)</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>framebits</key> + <value>frame_size</value> + </param> + <param> + <key>_coordinate</key> + <value>(1368, 187)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>enc_cc</value> + </param> + <param> + <key>ndim</key> + <value>2</value> + </param> + <param> + <key>polys</key> + <value>polys</value> + </param> + <param> + <key>rate</key> + <value>rate</value> + </param> + <param> + <key>state_start</key> + <value>0</value> + </param> + <param> + <key>mode</key> + <value>fec.CC_STREAMING</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(704, 19)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>esno</value> + </param> + <param> + <key>value</key> + <value>numpy.arange(-1, 4, 0.5)</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1440, 51)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>frame_size</value> + </param> + <param> + <key>value</key> + <value>block_size / 2</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1368, 115)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>k</value> + </param> + <param> + <key>value</key> + <value>7</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(536, 171)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>list_size</value> + </param> + <param> + <key>value</key> + <value>8</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(424, 35)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>n_info_bits</value> + </param> + <param> + <key>value</key> + <value>block_size / 2</value> + </param> + </block> + <block> + <key>variable_polar_code_configurator</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>channel</key> + <value>polar.CHANNEL_TYPE_BEC</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(328, 107)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_config</value> + </param> + <param> + <key>design_snr</key> + <value>0.0</value> + </param> + <param> + <key>mu</key> + <value>32</value> + </param> + </block> + <block> + <key>variable_polar_decoder_sc_def</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>len(esno)</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(192, 419)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_decoder</value> + </param> + <param> + <key>ndim</key> + <value>2</value> + </param> + </block> + <block> + <key>variable_polar_encoder_def</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>len(esno)</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(192, 251)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_encoder</value> + </param> + <param> + <key>is_packed</key> + <value>False</value> + </param> + <param> + <key>ndim</key> + <value>2</value> + </param> + </block> + <block> + <key>variable_polar_encoder_def</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>len(esno)</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(456, 243)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_encoder_scld</value> + </param> + <param> + <key>is_packed</key> + <value>False</value> + </param> + <param> + <key>ndim</key> + <value>2</value> + </param> + </block> + <block> + <key>variable_polar_decoder_sc_list_def</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>len(esno)</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(456, 411)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_scld</value> + </param> + <param> + <key>max_list_size</key> + <value>list_size</value> + </param> + <param> + <key>ndim</key> + <value>2</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1440, 115)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polys</value> + </param> + <param> + <key>value</key> + <value>[79, 109]</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1368, 51)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>rate</value> + </param> + <param> + <key>value</key> + <value>2</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(16, 107)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>value</key> + <value>350e3</value> + </param> + </block> + <block> + <key>fec_bercurve_generator</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>decoder_list</key> + <value>polar_decoder</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>encoder_list</key> + <value>polar_encoder</value> + </param> + <param> + <key>esno</key> + <value>esno</value> + </param> + <param> + <key>_coordinate</key> + <value>(808, 123)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_curve_gen_sc</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>seed</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>'11'</value> + </param> + <param> + <key>samp_rate</key> + <value>3200000</value> + </param> + <param> + <key>threadtype</key> + <value>"none"</value> + </param> + <bus_source>1</bus_source> + </block> + <block> + <key>fec_bercurve_generator</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>decoder_list</key> + <value>polar_scld</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>encoder_list</key> + <value>polar_encoder_scld</value> + </param> + <param> + <key>esno</key> + <value>esno</value> + </param> + <param> + <key>_coordinate</key> + <value>(808, 227)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_curve_gen_scld</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>seed</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>'11'</value> + </param> + <param> + <key>samp_rate</key> + <value>3200000</value> + </param> + <param> + <key>threadtype</key> + <value>"none"</value> + </param> + <bus_source>1</bus_source> + </block> + <block> + <key>fec_bercurve_generator</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>decoder_list</key> + <value>dec_cc</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>encoder_list</key> + <value>enc_cc</value> + </param> + <param> + <key>esno</key> + <value>esno</value> + </param> + <param> + <key>_coordinate</key> + <value>(808, 331)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_curve_gen_scld_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>seed</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>'11'</value> + </param> + <param> + <key>samp_rate</key> + <value>3200000</value> + </param> + <param> + <key>threadtype</key> + <value>"capillary"</value> + </param> + <bus_source>1</bus_source> + </block> + <block> + <key>qtgui_bercurve_sink</key> + <param> + <key>berlimit</key> + <value>-7.0</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>curvenames</key> + <value>['POLAR decoder', 'POLAR decoder list', 'CC']</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1176, 146)</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>qtgui_bercurve_sink_0</value> + </param> + <param> + <key>alpha1</key> + <value>1.0</value> + </param> + <param> + <key>color1</key> + <value>"blue"</value> + </param> + <param> + <key>label1</key> + <value>POLAR decoder</value> + </param> + <param> + <key>marker1</key> + <value>0</value> + </param> + <param> + <key>style1</key> + <value>1</value> + </param> + <param> + <key>width1</key> + <value>1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>marker10</key> + <value>0</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>alpha2</key> + <value>1.0</value> + </param> + <param> + <key>color2</key> + <value>"red"</value> + </param> + <param> + <key>label2</key> + <value>POLAR list decoder</value> + </param> + <param> + <key>marker2</key> + <value>0</value> + </param> + <param> + <key>style2</key> + <value>1</value> + </param> + <param> + <key>width2</key> + <value>1</value> + </param> + <param> + <key>alpha3</key> + <value>1.0</value> + </param> + <param> + <key>color3</key> + <value>"green"</value> + </param> + <param> + <key>label3</key> + <value>CC convolutional</value> + </param> + <param> + <key>marker3</key> + <value>0</value> + </param> + <param> + <key>style3</key> + <value>1</value> + </param> + <param> + <key>width3</key> + <value>1</value> + </param> + <param> + <key>alpha4</key> + <value>1.0</value> + </param> + <param> + <key>color4</key> + <value>"black"</value> + </param> + <param> + <key>label4</key> + <value></value> + </param> + <param> + <key>marker4</key> + <value>0</value> + </param> + <param> + <key>style4</key> + <value>1</value> + </param> + <param> + <key>width4</key> + <value>1</value> + </param> + <param> + <key>alpha5</key> + <value>1.0</value> + </param> + <param> + <key>color5</key> + <value>"cyan"</value> + </param> + <param> + <key>label5</key> + <value></value> + </param> + <param> + <key>marker5</key> + <value>0</value> + </param> + <param> + <key>style5</key> + <value>1</value> + </param> + <param> + <key>width5</key> + <value>1</value> + </param> + <param> + <key>alpha6</key> + <value>1.0</value> + </param> + <param> + <key>color6</key> + <value>"magenta"</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>marker6</key> + <value>0</value> + </param> + <param> + <key>style6</key> + <value>1</value> + </param> + <param> + <key>width6</key> + <value>1</value> + </param> + <param> + <key>alpha7</key> + <value>1.0</value> + </param> + <param> + <key>color7</key> + <value>"yellow"</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>marker7</key> + <value>0</value> + </param> + <param> + <key>style7</key> + <value>1</value> + </param> + <param> + <key>width7</key> + <value>1</value> + </param> + <param> + <key>alpha8</key> + <value>1.0</value> + </param> + <param> + <key>color8</key> + <value>"dark red"</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>marker8</key> + <value>0</value> + </param> + <param> + <key>style8</key> + <value>1</value> + </param> + <param> + <key>width8</key> + <value>1</value> + </param> + <param> + <key>alpha9</key> + <value>1.0</value> + </param> + <param> + <key>color9</key> + <value>"dark green"</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>marker9</key> + <value>0</value> + </param> + <param> + <key>style9</key> + <value>1</value> + </param> + <param> + <key>width9</key> + <value>1</value> + </param> + <param> + <key>berminerrors</key> + <value>100</value> + </param> + <param> + <key>num_curves</key> + <value>3</value> + </param> + <param> + <key>update_time</key> + <value>0.10</value> + </param> + <param> + <key>ymax</key> + <value>0</value> + </param> + <param> + <key>ymin</key> + <value>-10</value> + </param> + <param> + <key>esno</key> + <value>esno</value> + </param> + <bus_sink>1</bus_sink> + </block> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>20</source_key> + <sink_key>60</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>1</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>10</source_key> + <sink_key>10</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>11</source_key> + <sink_key>11</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>12</source_key> + <sink_key>12</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>13</source_key> + <sink_key>13</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>14</source_key> + <sink_key>14</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>15</source_key> + <sink_key>15</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>16</source_key> + <sink_key>16</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>17</source_key> + <sink_key>17</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>18</source_key> + <sink_key>18</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>19</source_key> + <sink_key>19</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>2</source_key> + <sink_key>2</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>3</source_key> + <sink_key>3</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>4</source_key> + <sink_key>4</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>5</source_key> + <sink_key>5</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>6</source_key> + <sink_key>6</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>7</source_key> + <sink_key>7</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>8</source_key> + <sink_key>8</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_sc</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>9</source_key> + <sink_key>9</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>20</source_key> + <sink_key>61</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>0</source_key> + <sink_key>20</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>1</source_key> + <sink_key>21</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>10</source_key> + <sink_key>30</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>11</source_key> + <sink_key>31</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>12</source_key> + <sink_key>32</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>13</source_key> + <sink_key>33</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>14</source_key> + <sink_key>34</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>15</source_key> + <sink_key>35</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>16</source_key> + <sink_key>36</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>17</source_key> + <sink_key>37</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>18</source_key> + <sink_key>38</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>19</source_key> + <sink_key>39</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>2</source_key> + <sink_key>22</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>3</source_key> + <sink_key>23</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>4</source_key> + <sink_key>24</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>5</source_key> + <sink_key>25</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>6</source_key> + <sink_key>26</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>7</source_key> + <sink_key>27</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>8</source_key> + <sink_key>28</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>9</source_key> + <sink_key>29</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>20</source_key> + <sink_key>62</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>0</source_key> + <sink_key>40</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>1</source_key> + <sink_key>41</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>10</source_key> + <sink_key>50</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>11</source_key> + <sink_key>51</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>12</source_key> + <sink_key>52</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>13</source_key> + <sink_key>53</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>14</source_key> + <sink_key>54</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>15</source_key> + <sink_key>55</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>16</source_key> + <sink_key>56</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>17</source_key> + <sink_key>57</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>18</source_key> + <sink_key>58</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>19</source_key> + <sink_key>59</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>2</source_key> + <sink_key>42</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>3</source_key> + <sink_key>43</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>4</source_key> + <sink_key>44</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>5</source_key> + <sink_key>45</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>6</source_key> + <sink_key>46</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>7</source_key> + <sink_key>47</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>8</source_key> + <sink_key>48</sink_key> + </connection> + <connection> + <source_block_id>polar_curve_gen_scld_0</source_block_id> + <sink_block_id>qtgui_bercurve_sink_0</sink_block_id> + <source_key>9</source_key> + <sink_key>49</sink_key> + </connection> +</flow_graph> diff --git a/gr-fec/examples/polar_code_example.grc b/gr-fec/examples/polar_code_example.grc new file mode 100644 index 0000000000..ff0a277de5 --- /dev/null +++ b/gr-fec/examples/polar_code_example.grc @@ -0,0 +1,3022 @@ +<?xml version='1.0' encoding='utf-8'?> +<?grc format='1' created='3.7.9'?> +<flow_graph> + <timestamp>Thu Jul 16 16:19:12 2015</timestamp> + <block> + <key>options</key> + <param> + <key>author</key> + <value>Johannes Demel</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1920, 1080</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>generate_options</key> + <value>qt_gui</value> + </param> + <param> + <key>id</key> + <value>polar_code_example</value> + </param> + <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>thread_safe_setters</key> + <value></value> + </param> + <param> + <key>title</key> + <value>POLAR code example flowgraph</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(192, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>block_size</value> + </param> + <param> + <key>value</key> + <value>1024</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(192, 75)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>n_info_bits</value> + </param> + <param> + <key>value</key> + <value>block_size / 2</value> + </param> + </block> + <block> + <key>variable_qtgui_range</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>value</key> + <value>0.1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(24, 275)</value> + </param> + <param> + <key>gui_hint</key> + <value>0,0,1,2</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>noise</value> + </param> + <param> + <key>label</key> + <value>Noive Voltage</value> + </param> + <param> + <key>min_len</key> + <value>200</value> + </param> + <param> + <key>orient</key> + <value>Qt.Horizontal</value> + </param> + <param> + <key>start</key> + <value>0</value> + </param> + <param> + <key>step</key> + <value>0.01</value> + </param> + <param> + <key>stop</key> + <value>2</value> + </param> + <param> + <key>rangeType</key> + <value>float</value> + </param> + <param> + <key>widget</key> + <value>counter_slider</value> + </param> + </block> + <block> + <key>variable_polar_code_configurator</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>channel</key> + <value>polar.CHANNEL_TYPE_BEC</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(296, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_config</value> + </param> + <param> + <key>design_snr</key> + <value>0.0</value> + </param> + <param> + <key>mu</key> + <value>32</value> + </param> + </block> + <block> + <key>variable_polar_decoder_sc_def</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(680, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_decoder</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_polar_encoder_def</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(504, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_encoder</value> + </param> + <param> + <key>is_packed</key> + <value>False</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_polar_decoder_sc_list_def</key> + <param> + <key>num_info_bits</key> + <value>n_info_bits</value> + </param> + <param> + <key>block_size</key> + <value>block_size</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>dim1</key> + <value>1</value> + </param> + <param> + <key>dim2</key> + <value>1</value> + </param> + <param> + <key>_enabled</key> + <value>0</value> + </param> + <param> + <key>frozen_bit_positions</key> + <value>polar_config['positions']</value> + </param> + <param> + <key>frozen_bit_values</key> + <value>polar_config['values']</value> + </param> + <param> + <key>_coordinate</key> + <value>(896, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>polar_scld</value> + </param> + <param> + <key>max_list_size</key> + <value>8</value> + </param> + <param> + <key>ndim</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(8, 107)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>value</key> + <value>350e3</value> + </param> + </block> + <block> + <key>analog_fastnoise_source_x</key> + <param> + <key>amp</key> + <value>noise</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(16, 403)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>analog_fastnoise_source_x_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>noise_type</key> + <value>analog.GR_GAUSSIAN</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>seed</key> + <value>0</value> + </param> + <param> + <key>samples</key> + <value>8192</value> + </param> + </block> + <block> + <key>analog_fastnoise_source_x</key> + <param> + <key>amp</key> + <value>noise</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(240, 667)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>analog_fastnoise_source_x_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>noise_type</key> + <value>analog.GR_GAUSSIAN</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>seed</key> + <value>0</value> + </param> + <param> + <key>samples</key> + <value>8192</value> + </param> + </block> + <block> + <key>analog_random_source_x</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(24, 171)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>analog_random_source_x_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>256</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>num_samps</key> + <value>2 ** 10 +1</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + </block> + <block> + <key>blocks_add_xx</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(480, 401)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_add_xx_0</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_add_xx</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(464, 633)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_add_xx_0_0</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1096, 507)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1.0</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(928, 803)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1.0</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1096, 451)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_1</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1.0</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(928, 755)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_1_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1.0</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(488, 507)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_float_0_2</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_short</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(328, 401)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_short_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_char_to_short</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(296, 633)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_char_to_short_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_pack_k_bits_bb</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(912, 507)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_pack_k_bits_bb_0</value> + </param> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_pack_k_bits_bb</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(112, 859)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_pack_k_bits_bb_0_0</value> + </param> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_short_to_char</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(608, 417)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_short_to_char_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_short_to_char</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(576, 649)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_short_to_char_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_unpack_k_bits_bb</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(240, 291)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_unpack_k_bits_bb_0</value> + </param> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_map_bb</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(344, 507)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>digital_map_bb_0</value> + </param> + <param> + <key>map</key> + <value>[-1, 1]</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + </block> + <block> + <key>fec_ber_bf</key> + <param> + <key>berlimit</key> + <value>-7.0</value> + </param> + <param> + <key>berminerrors</key> + <value>10000</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1112, 201)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_ber_bf_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>test_mode</key> + <value>False</value> + </param> + </block> + <block> + <key>fec_ber_bf</key> + <param> + <key>berlimit</key> + <value>-7.0</value> + </param> + <param> + <key>berminerrors</key> + <value>10000</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(912, 889)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_ber_bf_0_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>test_mode</key> + <value>False</value> + </param> + </block> + <block> + <key>fec_extended_decoder</key> + <param> + <key>ann</key> + <value>None</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>decoder_list</key> + <value>polar_decoder</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(656, 483)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_extended_decoder_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>'11'</value> + </param> + <param> + <key>threadtype</key> + <value>none</value> + </param> + <param> + <key>value</key> + <value>fec_extended_decoder</value> + </param> + </block> + <block> + <key>fec_extended_encoder</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>encoder_list</key> + <value>polar_encoder</value> + </param> + <param> + <key>_coordinate</key> + <value>(424, 275)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>fec_extended_encoder_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>puncpat</key> + <value>'11'</value> + </param> + <param> + <key>threadtype</key> + <value>none</value> + </param> + </block> + <block> + <key>qtgui_number_sink</key> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>avg</key> + <value>0</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1264, 187)</value> + </param> + <param> + <key>gui_hint</key> + <value>2,0,1,1</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>graph_type</key> + <value>qtgui.NUM_GRAPH_HORIZ</value> + </param> + <param> + <key>id</key> + <value>qtgui_number_sink_0</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>color1</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor1</key> + <value>1</value> + </param> + <param> + <key>label1</key> + <value>BER</value> + </param> + <param> + <key>unit1</key> + <value></value> + </param> + <param> + <key>color10</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor10</key> + <value>1</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>unit10</key> + <value></value> + </param> + <param> + <key>color2</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor2</key> + <value>1</value> + </param> + <param> + <key>label2</key> + <value></value> + </param> + <param> + <key>unit2</key> + <value></value> + </param> + <param> + <key>color3</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor3</key> + <value>1</value> + </param> + <param> + <key>label3</key> + <value></value> + </param> + <param> + <key>unit3</key> + <value></value> + </param> + <param> + <key>color4</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor4</key> + <value>1</value> + </param> + <param> + <key>label4</key> + <value></value> + </param> + <param> + <key>unit4</key> + <value></value> + </param> + <param> + <key>color5</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor5</key> + <value>1</value> + </param> + <param> + <key>label5</key> + <value></value> + </param> + <param> + <key>unit5</key> + <value></value> + </param> + <param> + <key>color6</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor6</key> + <value>1</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>unit6</key> + <value></value> + </param> + <param> + <key>color7</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor7</key> + <value>1</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>unit7</key> + <value></value> + </param> + <param> + <key>color8</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor8</key> + <value>1</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>unit8</key> + <value></value> + </param> + <param> + <key>color9</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor9</key> + <value>1</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>unit9</key> + <value></value> + </param> + <param> + <key>max</key> + <value>1</value> + </param> + <param> + <key>min</key> + <value>-1</value> + </param> + <param> + <key>name</key> + <value>Coded</value> + </param> + <param> + <key>nconnections</key> + <value>1</value> + </param> + <param> + <key>update_time</key> + <value>0.10</value> + </param> + </block> + <block> + <key>qtgui_number_sink</key> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>avg</key> + <value>0</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1096, 875)</value> + </param> + <param> + <key>gui_hint</key> + <value>2,1,1,1</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>graph_type</key> + <value>qtgui.NUM_GRAPH_HORIZ</value> + </param> + <param> + <key>id</key> + <value>qtgui_number_sink_0_0</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>color1</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor1</key> + <value>1</value> + </param> + <param> + <key>label1</key> + <value>BER</value> + </param> + <param> + <key>unit1</key> + <value></value> + </param> + <param> + <key>color10</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor10</key> + <value>1</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>unit10</key> + <value></value> + </param> + <param> + <key>color2</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor2</key> + <value>1</value> + </param> + <param> + <key>label2</key> + <value></value> + </param> + <param> + <key>unit2</key> + <value></value> + </param> + <param> + <key>color3</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor3</key> + <value>1</value> + </param> + <param> + <key>label3</key> + <value></value> + </param> + <param> + <key>unit3</key> + <value></value> + </param> + <param> + <key>color4</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor4</key> + <value>1</value> + </param> + <param> + <key>label4</key> + <value></value> + </param> + <param> + <key>unit4</key> + <value></value> + </param> + <param> + <key>color5</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor5</key> + <value>1</value> + </param> + <param> + <key>label5</key> + <value></value> + </param> + <param> + <key>unit5</key> + <value></value> + </param> + <param> + <key>color6</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor6</key> + <value>1</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>unit6</key> + <value></value> + </param> + <param> + <key>color7</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor7</key> + <value>1</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>unit7</key> + <value></value> + </param> + <param> + <key>color8</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor8</key> + <value>1</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>unit8</key> + <value></value> + </param> + <param> + <key>color9</key> + <value>("black", "black")</value> + </param> + <param> + <key>factor9</key> + <value>1</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>unit9</key> + <value></value> + </param> + <param> + <key>max</key> + <value>0</value> + </param> + <param> + <key>min</key> + <value>-10</value> + </param> + <param> + <key>name</key> + <value>Uncoded</value> + </param> + <param> + <key>nconnections</key> + <value>1</value> + </param> + <param> + <key>update_time</key> + <value>0.10</value> + </param> + </block> + <block> + <key>qtgui_time_sink_x</key> + <param> + <key>autoscale</key> + <value>True</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>ctrlpanel</key> + <value>False</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>entags</key> + <value>True</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1264, 451)</value> + </param> + <param> + <key>gui_hint</key> + <value>1,0,1,1</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>grid</key> + <value>False</value> + </param> + <param> + <key>id</key> + <value>qtgui_time_sink_x_0</value> + </param> + <param> + <key>legend</key> + <value>True</value> + </param> + <param> + <key>alpha1</key> + <value>1.0</value> + </param> + <param> + <key>color1</key> + <value>"blue"</value> + </param> + <param> + <key>label1</key> + <value>Transmitted</value> + </param> + <param> + <key>marker1</key> + <value>-1</value> + </param> + <param> + <key>style1</key> + <value>1</value> + </param> + <param> + <key>width1</key> + <value>1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>alpha2</key> + <value>1.0</value> + </param> + <param> + <key>color2</key> + <value>"red"</value> + </param> + <param> + <key>label2</key> + <value>Received</value> + </param> + <param> + <key>marker2</key> + <value>-1</value> + </param> + <param> + <key>style2</key> + <value>1</value> + </param> + <param> + <key>width2</key> + <value>1</value> + </param> + <param> + <key>alpha3</key> + <value>1.0</value> + </param> + <param> + <key>color3</key> + <value>"green"</value> + </param> + <param> + <key>label3</key> + <value></value> + </param> + <param> + <key>marker3</key> + <value>-1</value> + </param> + <param> + <key>style3</key> + <value>1</value> + </param> + <param> + <key>width3</key> + <value>1</value> + </param> + <param> + <key>alpha4</key> + <value>1.0</value> + </param> + <param> + <key>color4</key> + <value>"black"</value> + </param> + <param> + <key>label4</key> + <value></value> + </param> + <param> + <key>marker4</key> + <value>-1</value> + </param> + <param> + <key>style4</key> + <value>1</value> + </param> + <param> + <key>width4</key> + <value>1</value> + </param> + <param> + <key>alpha5</key> + <value>1.0</value> + </param> + <param> + <key>color5</key> + <value>"cyan"</value> + </param> + <param> + <key>label5</key> + <value></value> + </param> + <param> + <key>marker5</key> + <value>-1</value> + </param> + <param> + <key>style5</key> + <value>1</value> + </param> + <param> + <key>width5</key> + <value>1</value> + </param> + <param> + <key>alpha6</key> + <value>1.0</value> + </param> + <param> + <key>color6</key> + <value>"magenta"</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>marker6</key> + <value>-1</value> + </param> + <param> + <key>style6</key> + <value>1</value> + </param> + <param> + <key>width6</key> + <value>1</value> + </param> + <param> + <key>alpha7</key> + <value>1.0</value> + </param> + <param> + <key>color7</key> + <value>"yellow"</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>marker7</key> + <value>-1</value> + </param> + <param> + <key>style7</key> + <value>1</value> + </param> + <param> + <key>width7</key> + <value>1</value> + </param> + <param> + <key>alpha8</key> + <value>1.0</value> + </param> + <param> + <key>color8</key> + <value>"dark red"</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>marker8</key> + <value>-1</value> + </param> + <param> + <key>style8</key> + <value>1</value> + </param> + <param> + <key>width8</key> + <value>1</value> + </param> + <param> + <key>alpha9</key> + <value>1.0</value> + </param> + <param> + <key>color9</key> + <value>"dark green"</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>marker9</key> + <value>-1</value> + </param> + <param> + <key>style9</key> + <value>1</value> + </param> + <param> + <key>width9</key> + <value>1</value> + </param> + <param> + <key>name</key> + <value>Coded</value> + </param> + <param> + <key>nconnections</key> + <value>2</value> + </param> + <param> + <key>size</key> + <value>1024</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>tr_chan</key> + <value>0</value> + </param> + <param> + <key>tr_delay</key> + <value>0</value> + </param> + <param> + <key>tr_level</key> + <value>0.0</value> + </param> + <param> + <key>tr_mode</key> + <value>qtgui.TRIG_MODE_FREE</value> + </param> + <param> + <key>tr_slope</key> + <value>qtgui.TRIG_SLOPE_POS</value> + </param> + <param> + <key>tr_tag</key> + <value>""</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>update_time</key> + <value>0.10</value> + </param> + <param> + <key>ylabel</key> + <value>Amplitude</value> + </param> + <param> + <key>yunit</key> + <value>""</value> + </param> + <param> + <key>ymax</key> + <value>0</value> + </param> + <param> + <key>ymin</key> + <value>-10</value> + </param> + </block> + <block> + <key>qtgui_time_sink_x</key> + <param> + <key>autoscale</key> + <value>True</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>ctrlpanel</key> + <value>False</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>entags</key> + <value>True</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1096, 755)</value> + </param> + <param> + <key>gui_hint</key> + <value>1,1,1,1</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>grid</key> + <value>False</value> + </param> + <param> + <key>id</key> + <value>qtgui_time_sink_x_0_0</value> + </param> + <param> + <key>legend</key> + <value>True</value> + </param> + <param> + <key>alpha1</key> + <value>1.0</value> + </param> + <param> + <key>color1</key> + <value>"blue"</value> + </param> + <param> + <key>label1</key> + <value>Transmitted</value> + </param> + <param> + <key>marker1</key> + <value>-1</value> + </param> + <param> + <key>style1</key> + <value>1</value> + </param> + <param> + <key>width1</key> + <value>1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>alpha2</key> + <value>1.0</value> + </param> + <param> + <key>color2</key> + <value>"red"</value> + </param> + <param> + <key>label2</key> + <value>Received</value> + </param> + <param> + <key>marker2</key> + <value>-1</value> + </param> + <param> + <key>style2</key> + <value>1</value> + </param> + <param> + <key>width2</key> + <value>1</value> + </param> + <param> + <key>alpha3</key> + <value>1.0</value> + </param> + <param> + <key>color3</key> + <value>"green"</value> + </param> + <param> + <key>label3</key> + <value></value> + </param> + <param> + <key>marker3</key> + <value>-1</value> + </param> + <param> + <key>style3</key> + <value>1</value> + </param> + <param> + <key>width3</key> + <value>1</value> + </param> + <param> + <key>alpha4</key> + <value>1.0</value> + </param> + <param> + <key>color4</key> + <value>"black"</value> + </param> + <param> + <key>label4</key> + <value></value> + </param> + <param> + <key>marker4</key> + <value>-1</value> + </param> + <param> + <key>style4</key> + <value>1</value> + </param> + <param> + <key>width4</key> + <value>1</value> + </param> + <param> + <key>alpha5</key> + <value>1.0</value> + </param> + <param> + <key>color5</key> + <value>"cyan"</value> + </param> + <param> + <key>label5</key> + <value></value> + </param> + <param> + <key>marker5</key> + <value>-1</value> + </param> + <param> + <key>style5</key> + <value>1</value> + </param> + <param> + <key>width5</key> + <value>1</value> + </param> + <param> + <key>alpha6</key> + <value>1.0</value> + </param> + <param> + <key>color6</key> + <value>"magenta"</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>marker6</key> + <value>-1</value> + </param> + <param> + <key>style6</key> + <value>1</value> + </param> + <param> + <key>width6</key> + <value>1</value> + </param> + <param> + <key>alpha7</key> + <value>1.0</value> + </param> + <param> + <key>color7</key> + <value>"yellow"</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>marker7</key> + <value>-1</value> + </param> + <param> + <key>style7</key> + <value>1</value> + </param> + <param> + <key>width7</key> + <value>1</value> + </param> + <param> + <key>alpha8</key> + <value>1.0</value> + </param> + <param> + <key>color8</key> + <value>"dark red"</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>marker8</key> + <value>-1</value> + </param> + <param> + <key>style8</key> + <value>1</value> + </param> + <param> + <key>width8</key> + <value>1</value> + </param> + <param> + <key>alpha9</key> + <value>1.0</value> + </param> + <param> + <key>color9</key> + <value>"dark green"</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>marker9</key> + <value>-1</value> + </param> + <param> + <key>style9</key> + <value>1</value> + </param> + <param> + <key>width9</key> + <value>1</value> + </param> + <param> + <key>name</key> + <value>Uncoded</value> + </param> + <param> + <key>nconnections</key> + <value>2</value> + </param> + <param> + <key>size</key> + <value>1024</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>tr_chan</key> + <value>0</value> + </param> + <param> + <key>tr_delay</key> + <value>0</value> + </param> + <param> + <key>tr_level</key> + <value>0.0</value> + </param> + <param> + <key>tr_mode</key> + <value>qtgui.TRIG_MODE_FREE</value> + </param> + <param> + <key>tr_slope</key> + <value>qtgui.TRIG_SLOPE_POS</value> + </param> + <param> + <key>tr_tag</key> + <value>""</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>update_time</key> + <value>0.10</value> + </param> + <param> + <key>ylabel</key> + <value>Amplitude</value> + </param> + <param> + <key>yunit</key> + <value>""</value> + </param> + <param> + <key>ymax</key> + <value>1</value> + </param> + <param> + <key>ymin</key> + <value>-1</value> + </param> + </block> + <block> + <key>virtual_sink</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(240, 155)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>virtual_sink_0</value> + </param> + <param> + <key>stream_id</key> + <value>input_packed</value> + </param> + </block> + <block> + <key>virtual_sink</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(424, 227)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>virtual_sink_0_0</value> + </param> + <param> + <key>stream_id</key> + <value>input_unpacked</value> + </param> + </block> + <block> + <key>virtual_source</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(712, 883)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>virtual_source_0</value> + </param> + <param> + <key>stream_id</key> + <value>input_packed</value> + </param> + </block> + <block> + <key>virtual_source</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(1080, 395)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + <param> + <key>id</key> + <value>virtual_source_0_0</value> + </param> + <param> + <key>stream_id</key> + <value>input_packed</value> + </param> + </block> + <block> + <key>virtual_source</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(728, 755)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>virtual_source_0_0_0</value> + </param> + <param> + <key>stream_id</key> + <value>input_packed</value> + </param> + </block> + <block> + <key>virtual_source</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(80, 627)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>virtual_source_0_1</value> + </param> + <param> + <key>stream_id</key> + <value>input_unpacked</value> + </param> + </block> + <connection> + <source_block_id>analog_fastnoise_source_x_0</source_block_id> + <sink_block_id>blocks_add_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>analog_fastnoise_source_x_0_0</source_block_id> + <sink_block_id>blocks_add_xx_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>analog_random_source_x_0</source_block_id> + <sink_block_id>blocks_unpack_k_bits_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>analog_random_source_x_0</source_block_id> + <sink_block_id>fec_ber_bf_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>analog_random_source_x_0</source_block_id> + <sink_block_id>virtual_sink_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_add_xx_0</source_block_id> + <sink_block_id>blocks_short_to_char_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_add_xx_0_0</source_block_id> + <sink_block_id>blocks_short_to_char_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_1</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_1_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_2</source_block_id> + <sink_block_id>fec_extended_decoder_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_short_0</source_block_id> + <sink_block_id>blocks_add_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_short_0_0</source_block_id> + <sink_block_id>blocks_add_xx_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_pack_k_bits_bb_0</source_block_id> + <sink_block_id>blocks_char_to_float_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_pack_k_bits_bb_0</source_block_id> + <sink_block_id>fec_ber_bf_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>blocks_pack_k_bits_bb_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_pack_k_bits_bb_0_0</source_block_id> + <sink_block_id>fec_ber_bf_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>blocks_short_to_char_0</source_block_id> + <sink_block_id>digital_map_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_short_to_char_0_0</source_block_id> + <sink_block_id>blocks_pack_k_bits_bb_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>fec_extended_encoder_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>virtual_sink_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_map_bb_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_2</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_ber_bf_0</source_block_id> + <sink_block_id>qtgui_number_sink_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_ber_bf_0_0</source_block_id> + <sink_block_id>qtgui_number_sink_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_decoder_0</source_block_id> + <sink_block_id>blocks_pack_k_bits_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_encoder_0</source_block_id> + <sink_block_id>blocks_char_to_short_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>virtual_source_0</source_block_id> + <sink_block_id>fec_ber_bf_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>virtual_source_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>virtual_source_0_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>virtual_source_0_1</source_block_id> + <sink_block_id>blocks_char_to_short_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-fec/grc/fec_block_tree.xml b/gr-fec/grc/fec_block_tree.xml index 0fddcf3fab..65a4fc8a14 100644 --- a/gr-fec/grc/fec_block_tree.xml +++ b/gr-fec/grc/fec_block_tree.xml @@ -15,6 +15,8 @@ <block>variable_ldpc_decoder_def</block> <block>variable_tpc_decoder_def</block> <block>variable_dummy_decoder_def</block> + <block>variable_polar_decoder_sc_def</block> + <block>variable_polar_decoder_sc_list_def</block> </cat> <cat> <name>Encoders</name> @@ -24,6 +26,7 @@ <block>variable_ldpc_encoder_def</block> <block>variable_tpc_encoder_def</block> <block>variable_dummy_encoder_def</block> + <block>variable_polar_encoder_def</block> </cat> <block>fec_extended_encoder</block> <block>fec_extended_async_encoder</block> @@ -42,5 +45,6 @@ <block>fec_depuncture_bb</block> <block>fec_ber_bf</block> <block>fec_bercurve_generator</block> + <block>variable_polar_code_configurator</block> </cat> </cat> diff --git a/gr-fec/grc/variable_polar_code_configurator.xml b/gr-fec/grc/variable_polar_code_configurator.xml new file mode 100644 index 0000000000..dd28e494c2 --- /dev/null +++ b/gr-fec/grc/variable_polar_code_configurator.xml @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<block> + <name>POLAR code Configurator</name> + <key>variable_polar_code_configurator</key> + <import>from gnuradio.fec import polar</import> + <var_make>self.$(id) = $(id) = polar.load_frozen_bits_info(False, $channel, $block_size, $num_info_bits, $design_snr, $mu)</var_make> + <var_value>polar.load_frozen_bits_info(True, $channel, $block_size, $num_info_bits, $design_snr, $mu)</var_value> + <make></make> + + <param> + <name>Channel</name> + <key>channel</key> + <value>polar.CHANNEL_TYPE_BEC</value> + <type>string</type> + <option> + <name>BEC</name> + <key>polar.CHANNEL_TYPE_BEC</key> + </option> + <option> + <name>BSC</name> + <key>polar.CHANNEL_TYPE_BSC</key> + </option> + </param> + + <param> + <name>Block size (N)</name> + <key>block_size</key> + <type>int</type> + </param> + + <param> + <name>#Info Bits (K)</name> + <key>num_info_bits</key> + <type>int</type> + </param> + + <param> + <name>design SNR</name> + <key>design_snr</key> + <value>0.0</value> + <type>float</type> + </param> + + <param> + <name>mu</name> + <key>mu</key> + <value>16</value> + <type>int</type> + <hide>#if 'BEC' in $getVar('channel') then 'all' else 'none' #</hide> + </param> +</block>
\ No newline at end of file diff --git a/gr-fec/grc/variable_polar_decoder_sc.xml b/gr-fec/grc/variable_polar_decoder_sc.xml new file mode 100644 index 0000000000..4976afb4b6 --- /dev/null +++ b/gr-fec/grc/variable_polar_decoder_sc.xml @@ -0,0 +1,74 @@ +<?xml version="1.0"?> +<block> + <name>POLAR Decoder SC Definition</name> + <key>variable_polar_decoder_sc_def</key> + <import>from gnuradio import fec</import> + <var_make>#if int($ndim())==0 # +self.$(id) = $(id) = fec.polar_decoder_sc.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values) #slurp +#else if int($ndim())==1 # +self.$(id) = $(id) = map((lambda a: fec.polar_decoder_sc.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)), range(0, $dim1) ) #slurp +#else +self.$(id) = $(id) = map((lambda b: map((lambda a: fec.polar_decoder_sc.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)), range(0, $dim2))), range(0, $dim1)) #slurp +#end if</var_make> + <var_value>fec.polar_decoder_sc.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)</var_value> + <make></make> + + <param> + <name>Parallelism</name> + <key>ndim</key> + <value>0</value> + <type>enum</type> + <option> + <name>0</name> + <key>0</key> + </option> + <option> + <name>1</name> + <key>1</key> + </option> + <option> + <name>2</name> + <key>2</key> + </option> + </param> + + <param> + <name>Dimension 1</name> + <key>dim1</key> + <value>1</value> + <type>int</type> + <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide> + </param> + + <param> + <name>Dimension 2</name> + <key>dim2</key> + <value>4</value> + <type>int</type> + <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide> + </param> + + <param> + <name>Block size (N)</name> + <key>block_size</key> + <type>int</type> + </param> + + <param> + <name>#Info Bits (K)</name> + <key>num_info_bits</key> + <type>int</type> + </param> + + <param> + <name>Frozen Bit Positions</name> + <key>frozen_bit_positions</key> + <type>int_vector</type> + </param> + + <param> + <name>Frozen Bit Values</name> + <key>frozen_bit_values</key> + <type>int_vector</type> + </param> +</block> diff --git a/gr-fec/grc/variable_polar_decoder_sc_list.xml b/gr-fec/grc/variable_polar_decoder_sc_list.xml new file mode 100644 index 0000000000..2128110ad4 --- /dev/null +++ b/gr-fec/grc/variable_polar_decoder_sc_list.xml @@ -0,0 +1,80 @@ +<?xml version="1.0"?> +<block> + <name>POLAR Decoder SC List Definition</name> + <key>variable_polar_decoder_sc_list_def</key> + <import>from gnuradio import fec</import> + <var_make>#if int($ndim())==0 # +self.$(id) = $(id) = fec.polar_decoder_sc_list.make($max_list_size, $block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values) #slurp +#else if int($ndim())==1 # +self.$(id) = $(id) = map((lambda a: fec.polar_decoder_sc_list.make($max_list_size, $block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)), range(0, $dim1)) #slurp +#else +self.$(id) = $(id) = map((lambda b: map((lambda a: fec.polar_decoder_sc_list.make($max_list_size, $block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)), range(0, $dim2))), range(0, $dim1)) #slurp +#end if</var_make> + <var_value>fec.polar_decoder_sc_list.make($max_list_size, $block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)</var_value> + <make></make> + + <param> + <name>Parallelism</name> + <key>ndim</key> + <value>0</value> + <type>enum</type> + <option> + <name>0</name> + <key>0</key> + </option> + <option> + <name>1</name> + <key>1</key> + </option> + <option> + <name>2</name> + <key>2</key> + </option> + </param> + + <param> + <name>Dimension 1</name> + <key>dim1</key> + <value>1</value> + <type>int</type> + <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide> + </param> + + <param> + <name>Dimension 2</name> + <key>dim2</key> + <value>4</value> + <type>int</type> + <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide> + </param> + + <param> + <name>Maximum List Size (L)</name> + <key>max_list_size</key> + <type>int</type> + </param> + + <param> + <name>Block size (N)</name> + <key>block_size</key> + <type>int</type> + </param> + + <param> + <name>#Info Bits (K)</name> + <key>num_info_bits</key> + <type>int</type> + </param> + + <param> + <name>Frozen Bit Positions</name> + <key>frozen_bit_positions</key> + <type>int_vector</type> + </param> + + <param> + <name>Frozen Bit Values</name> + <key>frozen_bit_values</key> + <type>int_vector</type> + </param> +</block> diff --git a/gr-fec/grc/variable_polar_encoder.xml b/gr-fec/grc/variable_polar_encoder.xml new file mode 100644 index 0000000000..4147cf1edf --- /dev/null +++ b/gr-fec/grc/variable_polar_encoder.xml @@ -0,0 +1,89 @@ +<?xml version="1.0"?> +<block> + <name>POLAR Encoder Definition</name> + <key>variable_polar_encoder_def</key> + <import>from gnuradio import fec</import> + <var_make>#if int($ndim())==0 # +self.$(id) = $(id) = fec.polar_encoder.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values, $is_packed) #slurp +#else if int($ndim())==1 # +self.$(id) = $(id) = map((lambda a: fec.polar_encoder.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values, $is_packed)), range(0, $dim1)) #slurp +#else +self.$(id) = $(id) = map((lambda b: map((lambda a: fec.polar_encoder.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values, $is_packed)), range(0, $dim2))), range(0, $dim1)) #slurp +#end if</var_make> + <var_value>fec.polar_encoder.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values, $is_packed)</var_value> + <make></make> + + <param> + <name>Packed Bits</name> + <key>is_packed</key> + <value>False</value> + <type>enum</type> + <option> + <name>No</name> + <key>False</key> + </option> + <option> + <name>Yes</name> + <key>True</key> + </option> + </param> + + <param> + <name>Parallelism</name> + <key>ndim</key> + <value>0</value> + <type>enum</type> + <option> + <name>0</name> + <key>0</key> + </option> + <option> + <name>1</name> + <key>1</key> + </option> + <option> + <name>2</name> + <key>2</key> + </option> + </param> + + <param> + <name>Dimension 1</name> + <key>dim1</key> + <value>1</value> + <type>int</type> + <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide> + </param> + + <param> + <name>Dimension 2</name> + <key>dim2</key> + <value>4</value> + <type>int</type> + <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide> + </param> + + <param> + <name>Block size (N)</name> + <key>block_size</key> + <type>int</type> + </param> + + <param> + <name>#Info Bits (K)</name> + <key>num_info_bits</key> + <type>int</type> + </param> + + <param> + <name>Frozen Bit Positions</name> + <key>frozen_bit_positions</key> + <type>int_vector</type> + </param> + + <param> + <name>Frozen Bit Values</name> + <key>frozen_bit_values</key> + <type>int_vector</type> + </param> +</block> diff --git a/gr-fec/include/gnuradio/fec/CMakeLists.txt b/gr-fec/include/gnuradio/fec/CMakeLists.txt index 9c13f783b4..10782250d7 100644 --- a/gr-fec/include/gnuradio/fec/CMakeLists.txt +++ b/gr-fec/include/gnuradio/fec/CMakeLists.txt @@ -47,6 +47,10 @@ install(FILES puncture_bb.h puncture_ff.h depuncture_bb.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fec + polar_encoder.h + polar_decoder_sc.h + polar_common.h + polar_decoder_sc_list.h + polar_decoder_common.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fec COMPONENT "fec_devel" ) diff --git a/gr-fec/include/gnuradio/fec/polar_common.h b/gr-fec/include/gnuradio/fec/polar_common.h new file mode 100644 index 0000000000..7ef3e59b77 --- /dev/null +++ b/gr-fec/include/gnuradio/fec/polar_common.h @@ -0,0 +1,106 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef INCLUDED_FEC_POLAR_COMMON_H +#define INCLUDED_FEC_POLAR_COMMON_H + +#include <gnuradio/fec/api.h> + +// Forward declaration for those objects. SWIG doesn't like them to be #include'd. +namespace gr { + namespace blocks { + namespace kernel { + class unpack_k_bits; + } + } +} + +namespace gr { + namespace fec { + namespace code { + + /*! + * \brief POLAR code common operations and attributes + * \ingroup error_coding_blk + * + * \details + * Polar codes are based on this paper by Erdal Arikan "Channel + * Polarization: A Method for Contructing Capacity-Achieving Codes + * for Symmetric Binary-Input Memoryless Channels", 2009 block + * holds common information for encoders and decoders. All polar + * encoder/decoders inherit from polar_common. + * + * class holds common info. It is common to all encoders and decoders. + */ + class FEC_API polar_common + { + public: + /*! + * \param block_size codeword size. MUST be a power of 2. + * \param num_info_bits represents the number of information + * bits in a block. Also called frame_size. <= block_size + * \param frozen_bit_positions is an integer vector which + * defines the position of all frozen bits in a block. + * Its size MUST be equal to block_size - num_info_bits. + * Also it must be sorted and every position must only + * occur once. + * \param frozen_bit_values holds an unpacked byte for every + * frozen bit position. It defines if a frozen bit is + * fixed to '0' or '1'. Defaults to all ZERO. + */ + polar_common(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); + ~polar_common(); + + protected: + const int block_size()const {return d_block_size;}; + const int block_power()const {return d_block_power;}; + const int num_info_bits() const {return d_num_info_bits;}; + + // helper functions + long bit_reverse(long value, int active_bits) const; + void print_packed_bit_array(const unsigned char* printed_array, + const int num_bytes) const; + void print_unpacked_bit_array(const unsigned char* bits, + const unsigned int num_bytes) const; + + std::vector<int> d_frozen_bit_positions; + std::vector<char> d_frozen_bit_values; + std::vector<int> d_info_bit_positions; + + private: + int d_block_size; // depending on paper called 'N' or 'm' + int d_block_power; + int d_num_info_bits; // mostly abbreviated by 'K' + + void initialize_info_bit_position_vector(); + + gr::blocks::kernel::unpack_k_bits *d_unpacker; // convenience for 'print_packed_bit_array' function. + }; + + } //namespace code + } // namespace fec +} // namespace gr + +#endif /* INCLUDED_FEC_POLAR_COMMON_H */ diff --git a/gr-fec/include/gnuradio/fec/polar_decoder_common.h b/gr-fec/include/gnuradio/fec/polar_decoder_common.h new file mode 100644 index 0000000000..b0ecb85149 --- /dev/null +++ b/gr-fec/include/gnuradio/fec/polar_decoder_common.h @@ -0,0 +1,100 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef INCLUDED_FEC_POLAR_DECODER_COMMON_H +#define INCLUDED_FEC_POLAR_DECODER_COMMON_H + +#include <gnuradio/fec/api.h> +#include <gnuradio/fec/generic_decoder.h> +#include <gnuradio/fec/polar_common.h> + +namespace gr { + namespace fec { + namespace code { + + /*! + * \brief Class holds common methods and attributes for different + * decoder implementations + */ + class FEC_API polar_decoder_common : public generic_decoder, public polar_common + { + public: + /*! + * + * \param block_size codeword size. MUST be a power of 2. + * \param num_info_bits represents the number of information bits + * in a block. Also called frame_size. <= block_size + * \param frozen_bit_positions is an integer vector which defines + * the position of all frozen bits in a block. Its size + * MUST be equal to block_size - num_info_bits. Also it + * must be sorted and every position must only occur once. + * \param frozen_bit_values holds an unpacked byte for every + * frozen bit position. It defines if a frozen bit is + * fixed to '0' or '1'. Defaults to all ZERO. + */ + polar_decoder_common(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); + ~polar_decoder_common(); + + // FECAPI + double rate(){return (1.0 * get_output_size() / get_input_size());}; + int get_input_size(){return block_size();}; + int get_output_size(){return num_info_bits();}; + bool set_frame_size(unsigned int frame_size){return false;}; + + private: + static const float D_LLR_FACTOR = -2.19722458f; + unsigned int d_frozen_bit_counter; + + protected: + // calculate LLRs for stage + float llr_odd(const float la, const float lb) const; + float llr_even(const float la, const float lb, const unsigned char f) const; + unsigned char llr_bit_decision(const float llr) const {return (llr < 0.0f) ? 1 : 0;}; + + // control retrieval of frozen bits. + const bool is_frozen_bit(const int u_num) const; + const unsigned char next_frozen_bit(); + + // preparation for decoding + void initialize_decoder(unsigned char* u, float* llrs, const float* input); + + // basic algorithm methods + void butterfly(float* llrs, unsigned char* u, const int stage, const int u_num, const int row); + void butterfly_volk(float* llrs, unsigned char* u, const int stage, const int u_num, const int row); + void butterfly_generic(float* llrs, unsigned char* u, const int stage, const int u_num, const int row); + void even_u_values(unsigned char* u_even, const unsigned char* u, const int u_num); + void odd_xor_even_values(unsigned char* u_xor, const unsigned char* u, const int u_num); + void extract_info_bits(unsigned char* output, const unsigned char* input) const; + + // helper functions. + void print_pretty_llr_vector(const float* llr_vec) const; + + }; + + } // namespace code + } // namespace fec +} // namespace gr + +#endif /* INCLUDED_FEC_POLAR_DECODER_COMMON_H */ diff --git a/gr-fec/include/gnuradio/fec/polar_decoder_sc.h b/gr-fec/include/gnuradio/fec/polar_decoder_sc.h new file mode 100644 index 0000000000..3563a06574 --- /dev/null +++ b/gr-fec/include/gnuradio/fec/polar_decoder_sc.h @@ -0,0 +1,84 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef INCLUDED_FEC_POLAR_DECODER_SC_H +#define INCLUDED_FEC_POLAR_DECODER_SC_H + +#include <gnuradio/fec/api.h> +#include <gnuradio/fec/polar_decoder_common.h> + + +namespace gr { + namespace fec { + namespace code { + + /*! + * \brief Standard successive cancellation (SC) decoder for POLAR codes + * + * \details + * It expects float input with bits mapped 1 --> 1, 0 --> -1 + * Or: f = 2.0 * bit - 1.0 + * + */ + class FEC_API polar_decoder_sc : public polar_decoder_common + { + public: + + /*! + * \param block_size codeword size. MUST be a power of 2. + * \param num_info_bits represents the number of information + * bits in a block. Also called frame_size. <= block_size + * \param frozen_bit_positions is an integer vector which + * defines the position of all frozen bits in a block. + * Its size MUST be equal to block_size - num_info_bits. + * Also it must be sorted and every position must only + * occur once. + * \param frozen_bit_values holds an unpacked byte for every + * frozen bit position. It defines if a frozen bit is + * fixed to '0' or '1'. Defaults to all ZERO. + */ + static generic_decoder::sptr make(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); + ~polar_decoder_sc(); + + // FECAPI + void generic_work(void *in_buffer, void *out_buffer); + + private: + polar_decoder_sc(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); + + float* d_llr_vec; + unsigned char* d_u_hat_vec; + + unsigned char retrieve_bit_from_llr(float llr, const int pos); + void sc_decode(float* llrs, unsigned char* u); + }; + + } // namespace code + } // namespace fec +} // namespace gr + +#endif /* INCLUDED_FEC_POLAR_DECODER_SC_H */ diff --git a/gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h b/gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h new file mode 100644 index 0000000000..12b896e824 --- /dev/null +++ b/gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h @@ -0,0 +1,94 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef INCLUDED_POLAR_FEC_DECODER_SC_LIST_H +#define INCLUDED_POLAR_FEC_DECODER_SC_LIST_H + +#include <gnuradio/fec/api.h> +#include <gnuradio/fec/polar_decoder_common.h> + +namespace gr { + namespace fec { + namespace code { + + namespace polar { + class scl_list; + class path; + } + + /*! + * \brief Successive cancellation list (SCL) decoder for polar + * codes. + * + * \details + * Decoder is based on Tal, Vardy "List Decoding of Polar Codes", + * 2012 LLR version: Balatsoukas-Stimming, Parizi, Burg "LLR-based + * Successive Cancellation List Decoding of Polar Codes", 2015. + * + * Block expects float input with bits mapped 1 --> 1, 0 --> -1 + * Or: f = 2.0 * bit - 1.0 + */ + class FEC_API polar_decoder_sc_list : public polar_decoder_common + { + public: + /*! + * \param max_list_size caps number of followed decoding paths. + * \param block_size codeword size. MUST be a power of 2. + * \param num_info_bits represents the number of information + * bits in a block. Also called frame_size. <= block_size + * \param frozen_bit_positions is an integer vector which + * defines the position of all frozen bits in a block. + * Its size MUST be equal to block_size - num_info_bits. + * Also it must be sorted and every position must only + * occur once. + * \param frozen_bit_values holds an unpacked byte for every + * frozen bit position. It defines if a frozen bit is + * fixed to '0' or '1'. Defaults to all ZERO. + */ + static generic_decoder::sptr make(int max_list_size, int block_size, + int num_info_bits, std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); + ~polar_decoder_sc_list(); + + // FECAPI + void generic_work(void *in_buffer, void *out_buffer); + + private: + polar_decoder_sc_list(int max_list_size, int block_size, + int num_info_bits, std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); + + polar::scl_list* d_scl; + + void initialize_list(const float* in_buf); + const unsigned char* decode_list(); + void decode_bit(const int u_num); + void calculate_llrs_for_list(const int u_num); + void set_bit_in_list(const int u_num); + }; + + } // namespace code + } // namespace fec +} // namespace gr + +#endif /* INCLUDED_POLAR_FEC_DECODER_SC_LIST_H */ diff --git a/gr-fec/include/gnuradio/fec/polar_encoder.h b/gr-fec/include/gnuradio/fec/polar_encoder.h new file mode 100644 index 0000000000..f9541a203d --- /dev/null +++ b/gr-fec/include/gnuradio/fec/polar_encoder.h @@ -0,0 +1,120 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef INCLUDED_FEC_POLAR_ENCODER_H +#define INCLUDED_FEC_POLAR_ENCODER_H + +#include <gnuradio/fec/api.h> +#include <gnuradio/fec/generic_encoder.h> +#include <gnuradio/fec/polar_common.h> + +namespace gr { + namespace fec { + namespace code { + + /*! + * \brief POLAR encoder + * for basic details see 'polar_common' class. + * \ingroup error_coding_blk + * + * \details + * expects values with MSB first. It needs a full information word and encodes it in one pass. + * Output is a codeword of block_size. + */ + class FEC_API polar_encoder : public generic_encoder, public polar_common + { + public: + /*! + * Factory for a polar code encoder object. + * + * \param block_size defines the codeword size. It MUST be a + * power of 2. + * \param num_info_bits represents the number of information + * bits in a block. Also called frame_size. + * \param frozen_bit_positions is an integer vector which + * defines the position of all frozen bits in a block. + * Its size MUST be equal to block_size - num_info_bits. + * Also it must be sorted and every position must only + * occur once. + * \param frozen_bit_values holds an unpacked byte for every + * frozen bit position. It defines if a frozen bit is + * fixed to '0' or '1'. Defaults to all ZERO. + * \param is_packed choose 1 active bit/byte or 8 active + * bit/byte. if false, VOLK polar encoder is used. + */ + static generic_encoder::sptr make(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values, + bool is_packed = false); + ~polar_encoder(); + + // FECAPI + void generic_work(void *in_buffer, void *out_buffer); + double rate(){return (1.0 * get_input_size() / get_output_size());}; + int get_input_size(){return num_info_bits() / (d_is_packed ? 8 : 1);}; + int get_output_size(){return block_size() / (d_is_packed ? 8 : 1);}; + bool set_frame_size(unsigned int frame_size){return false;}; + const char* get_input_conversion(){return d_is_packed ? "pack" : "none";}; + const char* get_output_conversion(){return d_is_packed ? "packed_bits" : "none";}; + + private: + polar_encoder(int block_size, int num_info_bits, + std::vector<int>& frozen_bit_positions, + std::vector<char>& frozen_bit_values, bool is_packed); + std::vector<int> d_info_bit_reversed_positions; + bool d_is_packed; + + // c'tor method for packed algorithm setup. + void setup_frozen_bit_inserter(); + + // methods insert input bits and frozen bits into packed array for encoding + unsigned char* d_frozen_bit_prototype; // packed frozen bits are written onto it and later copies are used. + void insert_packed_frozen_bits_and_reverse(unsigned char* target, + const unsigned char* input) const; + void insert_unpacked_bit_into_packed_array_at_position(unsigned char* target, + const unsigned char bit, + const int pos) const; + void insert_packet_bit_into_packed_array_at_position(unsigned char* target, + const unsigned char bit, + const int target_pos, + const int bit_pos) const; + + // packed encoding methods + void encode_vector_packed(unsigned char* target) const; + void encode_vector_packed_subbyte(unsigned char* target) const; + void encode_packed_byte(unsigned char* target) const; + void encode_vector_packed_interbyte(unsigned char* target) const; + + // VOLK methods + void setup_volk_vectors(); + void volk_encode(unsigned char* out_buf, const unsigned char* in_buf); + unsigned char* d_temp; + unsigned char* d_frozen_bit_mask; + unsigned char* d_frozen_bits; + }; + + } // namespace code + } // namespace fec +} // namespace gr + +#endif /* INCLUDED_FEC_POLAR_ENCODER_H */ diff --git a/gr-fec/lib/CMakeLists.txt b/gr-fec/lib/CMakeLists.txt index 2c116fe726..0343ce3cfc 100644 --- a/gr-fec/lib/CMakeLists.txt +++ b/gr-fec/lib/CMakeLists.txt @@ -80,7 +80,13 @@ list(APPEND gnuradio_fec_sources alist.cc tpc_common.cc tpc_decoder.cc - tpc_encoder.cc + tpc_encoder.cc + polar_encoder.cc + polar_decoder_sc.cc + polar_common.cc + polar_decoder_sc_list.cc + polar_decoder_common.cc + scl_list.cc ) #Add Windows DLL resource file if using MSVC diff --git a/gr-fec/lib/polar_common.cc b/gr-fec/lib/polar_common.cc new file mode 100644 index 0000000000..ff78d3428e --- /dev/null +++ b/gr-fec/lib/polar_common.cc @@ -0,0 +1,136 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/io_signature.h> +#include <gnuradio/fec/polar_common.h> + +#include <gnuradio/blocks/pack_k_bits.h> +#include <gnuradio/blocks/unpack_k_bits.h> + +#include <cmath> +#include <stdexcept> +#include <iostream> +#include <vector> + +namespace gr { + namespace fec { + namespace code { + + polar_common::polar_common(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values) : + d_frozen_bit_positions(frozen_bit_positions), d_frozen_bit_values(frozen_bit_values), + d_block_size(block_size), d_block_power((int) log2(float(block_size))), + d_num_info_bits(num_info_bits) + { + if(pow(2, d_block_power) != d_block_size){ + throw std::runtime_error("block_size MUST be a power of 2!"); + } + + unsigned int num_frozen_bits = d_block_size - d_num_info_bits; + if(num_frozen_bits != d_frozen_bit_positions.size()){ + throw std::runtime_error( + "number of frozen bit positions must equal block_size - num_info_bits"); + } + + // According to papers frozen bits default to '0'. + while(d_frozen_bit_values.size() < num_frozen_bits){ + d_frozen_bit_values.push_back(0); + } + initialize_info_bit_position_vector(); + + d_unpacker = new gr::blocks::kernel::unpack_k_bits(8); + } + + void + polar_common::initialize_info_bit_position_vector() + { + int num_frozen_bit = 0; + int frozen_pos = d_frozen_bit_positions.at(num_frozen_bit); + for(int i = 0; i < d_block_size; i++) { + if(i != frozen_pos) { + d_info_bit_positions.push_back((int) i); + } + else { + num_frozen_bit++; + num_frozen_bit = std::min(num_frozen_bit, (int) (d_frozen_bit_positions.size() - 1)); + frozen_pos = d_frozen_bit_positions.at(num_frozen_bit); + } + } + + if((int) d_info_bit_positions.size() != num_info_bits()) { + throw std::runtime_error("polar_common: number of info bit positions MUST equal num_info_bits (K)!"); + } + } + + polar_common::~polar_common() + { + delete d_unpacker; + } + + long + polar_common::bit_reverse(long value, int active_bits) const + { + long r = 0; + for(int i = 0; i < active_bits; i++) { + r <<= 1; + r |= value & 1; + value >>= 1; + } + return r; + } + + void + polar_common::print_packed_bit_array(const unsigned char* printed_array, + const int num_bytes) const + { + int num_bits = num_bytes << 3; + unsigned char* temp = new unsigned char[num_bits]; + d_unpacker->unpack(temp, printed_array, num_bytes); + + std::cout << "["; + for(int i = 0; i < num_bits; i++) { + std::cout << (int) *(temp + i) << " "; + } + std::cout << "]" << std::endl; + + delete [] temp; + } + + void + polar_common::print_unpacked_bit_array(const unsigned char* bits, + const unsigned int num_bytes) const + { + std::cout << "( "; + for(unsigned int i = 0; i < num_bytes; i++){ + std::cout << (int) *bits++ << ", "; + } + std::cout << ")" << std::endl; + } + + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ diff --git a/gr-fec/lib/polar_decoder_common.cc b/gr-fec/lib/polar_decoder_common.cc new file mode 100644 index 0000000000..8fc2e37fb7 --- /dev/null +++ b/gr-fec/lib/polar_decoder_common.cc @@ -0,0 +1,193 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/io_signature.h> +#include <gnuradio/fec/polar_decoder_common.h> +#include <volk/volk.h> + +#include <cstdio> + +namespace gr { + namespace fec { + namespace code { + + polar_decoder_common::polar_decoder_common(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values) : + polar_common(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values), + d_frozen_bit_counter(0) + { + } + + polar_decoder_common::~polar_decoder_common() + { + } + + void + polar_decoder_common::initialize_decoder(unsigned char* u, float* llrs, const float* input) + { + volk_32f_s32f_multiply_32f(llrs + block_size() * block_power(), input, D_LLR_FACTOR, block_size()); + memset(u, 0, sizeof(unsigned char) * block_size() * block_power()); + d_frozen_bit_counter = 0; + } + + float + polar_decoder_common::llr_odd(const float la, const float lb) const + { + return copysignf(1.0f, la) * copysignf(1.0f, lb) * std::min(fabs(la), fabs(lb)); + } + + float + polar_decoder_common::llr_even(const float la, const float lb, const unsigned char f) const + { + switch(f){ + case 0: + return lb + la; + default: + return lb - la; + } + } + + void + polar_decoder_common::butterfly(float* llrs, unsigned char* u, const int stage, + const int u_num, const int row) + { + butterfly_volk(llrs, u, stage, u_num, row); + } + + void + polar_decoder_common::butterfly_generic(float* llrs, unsigned char* u, const int stage, + const int u_num, const int row) + { + const int next_stage = stage + 1; + const int half_stage_size = 0x01 << stage; + const int stage_size = half_stage_size << 1; + const bool is_upper_stage_half = row % stage_size < half_stage_size; + + // // this is a natural bit order impl + float* next_llrs = llrs + block_size(); // LLRs are stored in a consecutive array. + float* call_row_llr = llrs + row; + + const int section = row - (row % stage_size); + const int jump_size = ((row % half_stage_size) << 1) % stage_size; + + const int next_upper_row = section + jump_size; + const int next_lower_row = next_upper_row + 1; + + const float* upper_right_llr_ptr = next_llrs + next_upper_row; + const float* lower_right_llr_ptr = next_llrs + next_lower_row; + + if(!is_upper_stage_half){ + const int u_pos = u_num >> stage; + const unsigned char f = u[u_pos - 1]; + *call_row_llr = llr_even(*upper_right_llr_ptr, *lower_right_llr_ptr, f); + return; + } + + if(block_power() > next_stage){ + unsigned char* u_half = u + block_size(); + odd_xor_even_values(u_half, u, u_num); + butterfly(next_llrs, u_half, next_stage, u_num, next_upper_row); + + even_u_values(u_half, u, u_num); + butterfly(next_llrs, u_half, next_stage, u_num, next_lower_row); + } + + *call_row_llr = llr_odd(*upper_right_llr_ptr, *lower_right_llr_ptr); + } + + void + polar_decoder_common::butterfly_volk(float* llrs, unsigned char* u, const int stage, + const int u_num, const int row) + { + volk_32f_8u_polarbutterfly_32f(llrs, u, block_size(), block_power(), stage, u_num, row); + } + + + void + polar_decoder_common::even_u_values(unsigned char* u_even, const unsigned char* u, + const int u_num) + { + u++; + for(int i = 1; i < u_num; i += 2){ + *u_even++ = *u; + u += 2; + } + } + + void + polar_decoder_common::odd_xor_even_values(unsigned char* u_xor, const unsigned char* u, + const int u_num) + { + for(int i = 1; i < u_num; i += 2){ + *u_xor++ = *u ^ *(u + 1); + u += 2; + } + } + + const bool + polar_decoder_common::is_frozen_bit(const int u_num) const + { + return d_frozen_bit_counter < d_frozen_bit_positions.size() && u_num == d_frozen_bit_positions.at(d_frozen_bit_counter); + } + + + const unsigned char + polar_decoder_common::next_frozen_bit() + { + return d_frozen_bit_values[d_frozen_bit_counter++]; + } + + void + polar_decoder_common::extract_info_bits(unsigned char* output, const unsigned char* input) const + { + unsigned int frozenbit_num = 0; + for(int i = 0; i < block_size(); i++){ + if(frozenbit_num < d_frozen_bit_positions.size() && d_frozen_bit_positions.at(frozenbit_num) == i){ + frozenbit_num++; + } + else{ + *output++ = *input; + } + input++; + } + } + + void + polar_decoder_common::print_pretty_llr_vector(const float* llr_vec) const + { + for(int row = 0; row < block_size(); row++) { + std::cout << row << "->" << int(bit_reverse(row, block_power())) << ":\t"; + for(int stage = 0; stage < block_power() + 1; stage++) { + printf("%+4.2f, ", llr_vec[(stage * block_size()) + row]); + } + std::cout << std::endl; + } + } + + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ diff --git a/gr-fec/lib/polar_decoder_sc.cc b/gr-fec/lib/polar_decoder_sc.cc new file mode 100644 index 0000000000..c4ac8877ec --- /dev/null +++ b/gr-fec/lib/polar_decoder_sc.cc @@ -0,0 +1,97 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/io_signature.h> +#include <gnuradio/fec/polar_decoder_sc.h> +#include <volk/volk.h> + +#include <cmath> +#include <cstdio> + +namespace gr { + namespace fec { + namespace code { + + generic_decoder::sptr + polar_decoder_sc::make(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values) + { + return generic_decoder::sptr + (new polar_decoder_sc(block_size, num_info_bits, + frozen_bit_positions, + frozen_bit_values)); + } + + polar_decoder_sc::polar_decoder_sc(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values) : + polar_decoder_common(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + { + d_llr_vec = (float*) volk_malloc(sizeof(float) * block_size * (block_power() + 1), volk_get_alignment()); + memset(d_llr_vec, 0, sizeof(float) * block_size * (block_power() + 1)); + d_u_hat_vec = (unsigned char*) volk_malloc(block_size * (block_power() + 1), volk_get_alignment()); + memset(d_u_hat_vec, 0, sizeof(unsigned char) * block_size * (block_power() + 1)); + } + + polar_decoder_sc::~polar_decoder_sc() + { + volk_free(d_llr_vec); + volk_free(d_u_hat_vec); + } + + void + polar_decoder_sc::generic_work(void* in_buffer, void* out_buffer) + { + const float *in = (const float*) in_buffer; + unsigned char *out = (unsigned char*) out_buffer; + + initialize_decoder(d_u_hat_vec, d_llr_vec, in); + sc_decode(d_llr_vec, d_u_hat_vec); + extract_info_bits(out, d_u_hat_vec); + } + + void + polar_decoder_sc::sc_decode(float* llrs, unsigned char* u) + { + for(int i = 0; i < block_size(); i++){ + butterfly(llrs, u, 0, i, i); + u[i] = retrieve_bit_from_llr(llrs[i], i); + } + } + + unsigned char + polar_decoder_sc::retrieve_bit_from_llr(float llr, const int pos) + { + if(is_frozen_bit(pos)){ + return next_frozen_bit(); + } + return llr_bit_decision(llr); + } + + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ diff --git a/gr-fec/lib/polar_decoder_sc_list.cc b/gr-fec/lib/polar_decoder_sc_list.cc new file mode 100644 index 0000000000..903b9413da --- /dev/null +++ b/gr-fec/lib/polar_decoder_sc_list.cc @@ -0,0 +1,123 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/io_signature.h> +#include <gnuradio/fec/polar_decoder_sc_list.h> +#include <volk/volk.h> +#include <scl_list.h> + +#include <cmath> +#include <algorithm> + +namespace gr { + namespace fec { + namespace code { + + generic_decoder::sptr + polar_decoder_sc_list::make(int max_list_size, int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values) + { + return generic_decoder::sptr + (new polar_decoder_sc_list(max_list_size, block_size, num_info_bits, + frozen_bit_positions, + frozen_bit_values)); + } + + polar_decoder_sc_list::polar_decoder_sc_list(int max_list_size, int block_size, + int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values) + : polar_decoder_common(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + { + d_scl = new polar::scl_list(max_list_size, block_size, block_power()); + } + + polar_decoder_sc_list::~polar_decoder_sc_list() + { + delete d_scl; + } + + void + polar_decoder_sc_list::generic_work(void* in_buffer, void* out_buffer) + { + const float *in = (const float*) in_buffer; + unsigned char *out = (unsigned char*) out_buffer; + + initialize_list(in); + const unsigned char* temp = decode_list(); + extract_info_bits(out, temp); + } + + void + polar_decoder_sc_list::initialize_list(const float* in_buf) + { + polar::path* init_path = d_scl->initial_path(); + initialize_decoder(init_path->u_vec, init_path->llr_vec, in_buf); + } + + const unsigned char* + polar_decoder_sc_list::decode_list() + { + for(int u_num = 0; u_num < block_size(); u_num++){ + decode_bit(u_num); + } + return d_scl->optimal_path()->u_vec; + } + + void + polar_decoder_sc_list::decode_bit(const int u_num) + { + calculate_llrs_for_list(u_num); + set_bit_in_list(u_num); + } + + void + polar_decoder_sc_list::calculate_llrs_for_list(const int u_num) + { + for(unsigned int i = 0; i < d_scl->active_size(); i++){ + polar::path* current_path = d_scl->next_active_path(); + butterfly(current_path->llr_vec, current_path->u_vec, 0, u_num, u_num); + } + } + + void + polar_decoder_sc_list::set_bit_in_list(const int u_num) + { + // 1. if frozen bit, update with known value + if(is_frozen_bit(u_num)){ + const unsigned char frozen_bit = next_frozen_bit(); + d_scl->set_frozen_bit(frozen_bit, u_num); + } + // 2. info bit + else{ + d_scl->set_info_bit(u_num); + } + } + + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ diff --git a/gr-fec/lib/polar_encoder.cc b/gr-fec/lib/polar_encoder.cc new file mode 100644 index 0000000000..350f490487 --- /dev/null +++ b/gr-fec/lib/polar_encoder.cc @@ -0,0 +1,234 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/io_signature.h> +#include <gnuradio/fec/polar_encoder.h> +#include <cmath> +#include <stdexcept> +#include <volk/volk.h> + +#include <gnuradio/blocks/pack_k_bits.h> +#include <gnuradio/blocks/unpack_k_bits.h> + +namespace gr { + namespace fec { + namespace code { + + generic_encoder::sptr + polar_encoder::make(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values, bool is_packed) + { + return generic_encoder::sptr + (new polar_encoder(block_size, num_info_bits, + frozen_bit_positions, + frozen_bit_values, + is_packed)); + } + + polar_encoder::polar_encoder(int block_size, int num_info_bits, + std::vector<int>& frozen_bit_positions, + std::vector<char>& frozen_bit_values, bool is_packed) : + polar_common(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values), + d_is_packed(is_packed) + { + setup_frozen_bit_inserter(); + setup_volk_vectors(); + } + + void + polar_encoder::setup_frozen_bit_inserter() + { + d_frozen_bit_prototype = (unsigned char*) volk_malloc(block_size() >> 3, + volk_get_alignment()); + memset(d_frozen_bit_prototype, 0, block_size() >> 3); + + for(unsigned int i = 0; i < d_frozen_bit_positions.size(); i++) { + int rev_pos = (int) bit_reverse((long) d_frozen_bit_positions.at(i), block_power()); + unsigned char frozen_bit = (unsigned char) d_frozen_bit_values.at(i); + insert_unpacked_bit_into_packed_array_at_position(d_frozen_bit_prototype, frozen_bit, + rev_pos); + } + + for(unsigned int i = 0; i < d_info_bit_positions.size(); i++){ + d_info_bit_reversed_positions.push_back((int) bit_reverse((long) d_info_bit_positions.at(i), block_power())); + } + + if((int) d_info_bit_reversed_positions.size() != num_info_bits()) { + throw std::runtime_error("polar_encoder: number of info bit positions MUST equal num_info_bits (K)!"); + } + } + + void + polar_encoder::setup_volk_vectors() + { + int nfrozen = block_size() - num_info_bits(); + d_temp = (unsigned char*) volk_malloc(sizeof(unsigned char) * block_size(), volk_get_alignment()); + d_frozen_bit_mask = (unsigned char*) volk_malloc(sizeof(unsigned char) * block_size(), volk_get_alignment()); + d_frozen_bits = (unsigned char*) volk_malloc(sizeof(unsigned char) * nfrozen, volk_get_alignment()); + for(int i = 0; i < nfrozen; i++){ + d_frozen_bits[i] = d_frozen_bit_values[i]; + } + + int nfbit = 0; + for(int i = 0; i < block_size(); i++){ + unsigned char m = 0x00; + if(d_frozen_bit_positions[nfbit] == i){ + m = 0xFF; + nfbit++; + } + d_frozen_bit_mask[i] = m; + } + } + + polar_encoder::~polar_encoder() + { + volk_free(d_frozen_bit_prototype); + + volk_free(d_temp); + volk_free(d_frozen_bit_mask); + volk_free(d_frozen_bits); + } + + void + polar_encoder::generic_work(void* in_buffer, void* out_buffer) + { + const unsigned char *in = (const unsigned char*) in_buffer; + unsigned char *out = (unsigned char*) out_buffer; + + if(d_is_packed){ + insert_packed_frozen_bits_and_reverse(out, in); + encode_vector_packed(out); + } + else{ + volk_encode(out, in); + } + } + + void + polar_encoder::volk_encode(unsigned char* out_buf, const unsigned char* in_buf) + { + volk_8u_x3_encodepolar_8u_x2(out_buf, d_temp, d_frozen_bit_mask, d_frozen_bits, in_buf, block_size()); + } + + void + polar_encoder::encode_vector_packed(unsigned char* target) const + { + encode_vector_packed_subbyte(target); + encode_vector_packed_interbyte(target); + } + + void + polar_encoder::encode_vector_packed_subbyte(unsigned char* target) const + { + int num_bytes_per_block = block_size() >> 3; + while(num_bytes_per_block) { + encode_packed_byte(target); + ++target; + --num_bytes_per_block; + } + } + + void + polar_encoder::encode_packed_byte(unsigned char* target) const + { + // this method only produces correct results if block_size > 4. + // this is assumed to be the case. + *target ^= 0xaa & (*target << 1); + *target ^= 0xcc & (*target << 2); + *target ^= *target << 4; + } + + void + polar_encoder::encode_vector_packed_interbyte(unsigned char* target) const + { + int branch_byte_size = 1; + unsigned char* pos; + int n_branches = block_size() >> 4; + int byte = 0; + for(int stage = 3; stage < block_power(); ++stage) { + pos = target; + + for(int branch = 0; branch < n_branches; ++branch) { + + byte = 0; + while(byte < branch_byte_size) { + *pos ^= *(pos + branch_byte_size); + ++pos; + ++byte; + } + + pos += branch_byte_size; + } + + n_branches >>= 1; + branch_byte_size <<= 1; + } + } + + void + polar_encoder::insert_packed_frozen_bits_and_reverse(unsigned char* target, + const unsigned char* input) const + { + memcpy(target, d_frozen_bit_prototype, block_size() >> 3); + const int* info_bit_reversed_positions_ptr = &d_info_bit_reversed_positions[0]; + int bit_num = 0; + unsigned char byte = *input; + int bit_pos; + while(bit_num < num_info_bits()) { + bit_pos = *info_bit_reversed_positions_ptr++; + insert_packet_bit_into_packed_array_at_position(target, byte, bit_pos, bit_num % 8); + ++bit_num; + if(bit_num % 8 == 0) { + ++input; + byte = *input; + } + } + } + + void + polar_encoder::insert_unpacked_bit_into_packed_array_at_position(unsigned char* target, + const unsigned char bit, + const int pos) const + { + int byte_pos = pos >> 3; + int bit_pos = pos & 0x7; + *(target + byte_pos) ^= bit << (7 - bit_pos); + } + + void + polar_encoder::insert_packet_bit_into_packed_array_at_position(unsigned char* target, + const unsigned char bit, + const int target_pos, + const int bit_pos) const + { + insert_unpacked_bit_into_packed_array_at_position(target, (bit >> (7 - bit_pos)) & 0x01, + target_pos); + } + + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ diff --git a/gr-fec/lib/scl_list.cc b/gr-fec/lib/scl_list.cc new file mode 100644 index 0000000000..ab6e81d317 --- /dev/null +++ b/gr-fec/lib/scl_list.cc @@ -0,0 +1,193 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along 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 <scl_list.h> +#include <cstring> +#include <iostream> +#include <algorithm> +#include <volk/volk.h> + +namespace gr { + namespace fec { + namespace code { + namespace polar { + + scl_list::scl_list(const unsigned int size, + const unsigned int block_size, + const unsigned int block_power): + d_list_size(size), d_block_size(block_size), d_block_power(block_power), + d_num_buff_elements(block_size * (block_power + 1)) + { + for(unsigned int i = 0; i < 2 * size; i++){ + d_path_list.push_back(new path()); + } + + for(unsigned int i = 0; i < size; i++){ + d_path_list[i]->llr_vec = (float*) volk_malloc(sizeof(float) * d_num_buff_elements, volk_get_alignment()); + memset(d_path_list[i]->llr_vec, 0, sizeof(float) * d_num_buff_elements); + d_path_list[i]->u_vec = (unsigned char*) volk_malloc(sizeof(unsigned char) * d_num_buff_elements, volk_get_alignment()); + memset(d_path_list[i]->u_vec, 0, sizeof(unsigned char) * d_num_buff_elements); + d_path_list[i]->owns_vectors = true; + } + + d_path_list[0]->is_active = true; + d_active_path_counter = 1; + d_active_pos = 0; + } + + scl_list::~scl_list() + { + for(unsigned int i = 0; i < d_path_list.size(); i++){ + delete d_path_list[i]; + } + } + + + const path* + scl_list::optimal_path() + { + const path* temp = *std::min_element(d_path_list.begin(), d_path_list.begin() + d_active_path_counter, path_compare); + reset(); + return temp; + } + + void + scl_list::reset() + { + // leave 0th element active for next iteration + d_path_list[0]->path_metric = 0.0f; + for(unsigned int i = 1; i < d_path_list.size(); i++){ + d_path_list[i]->is_active = false; + d_path_list[i]->path_metric = 0.0f; + } + d_active_path_counter = 1; + d_active_pos = 0; + } + + void + scl_list::set_info_bit(const int bit_pos) + { + if(d_active_path_counter < d_list_size) { + const int offset = d_active_path_counter; + for(int i = 0; i < offset; i++) { + duplicate_path(d_path_list[i + offset], d_path_list[i]); + d_path_list[i]->path_metric = update_path_metric(d_path_list[i]->path_metric, + d_path_list[i]->llr_vec[bit_pos], 0); + d_path_list[i + offset]->path_metric = update_path_metric + (d_path_list[i + offset]->path_metric, d_path_list[i + offset]->llr_vec[bit_pos], 1); + d_path_list[i]->u_vec[bit_pos] = 0; + d_path_list[i + offset]->u_vec[bit_pos] = 1; + } + } + else { + + for(unsigned int i = 0; i < d_list_size; i++) { + branch_paths(d_path_list[i + d_list_size], d_path_list[i], d_path_list[i]->llr_vec[bit_pos]); + } + std::sort(d_path_list.begin(), d_path_list.end(), path_compare); + + for(unsigned int i = 0; i < d_list_size; i++) { + if(!d_path_list[i]->owns_vectors) { + int t_pos = d_list_size; + while(!d_path_list[t_pos]->owns_vectors) { + t_pos++; + } + steal_vector_ownership(d_path_list[i], d_path_list[t_pos]); + d_path_list[i]->u_vec[bit_pos] = 1; + } + else{ + d_path_list[i]->u_vec[bit_pos] = 0; + } + } + } + d_active_pos = 0; + } + + void + scl_list::branch_paths(path* target, path* original, const float llr) + { + target->path_metric = update_path_metric(original->path_metric, llr, 1); + original->path_metric = update_path_metric(original->path_metric, llr, 0); + target->llr_vec = original->llr_vec; + target->u_vec = original->u_vec; + } + + void + scl_list::steal_vector_ownership(path* target, path* original) + { + memcpy(original->llr_vec, target->llr_vec, sizeof(float) * d_num_buff_elements); + memcpy(original->u_vec, target->u_vec, sizeof(unsigned char) * d_num_buff_elements); + target->llr_vec = original->llr_vec; + target->u_vec = original->u_vec; + target->owns_vectors = true; + original->owns_vectors = false; + } + + void + scl_list::duplicate_path(path* target, const path* original) + { + memcpy(target->llr_vec, original->llr_vec, sizeof(float) * d_num_buff_elements); + memcpy(target->u_vec, original->u_vec, sizeof(unsigned char) * d_num_buff_elements); + target->path_metric = original->path_metric; + d_active_path_counter++; + target->is_active = true; + } + + float + scl_list::update_path_metric(const float last_pm, const float llr, + const float ui) const + { + if((ui == 0 && llr > 0.0f) || (ui == 1 && llr < 0.0f)){ + // if(ui == (unsigned char) (0.5 * 1 - copysignf(1.0f, llr))){ + return last_pm; + } + return last_pm + fabs(llr); + } + + void + scl_list::set_frozen_bit(const unsigned char frozen_bit, const int bit_pos) + { + for(unsigned int i = 0; i < d_active_path_counter; i++){ + d_path_list[i]->u_vec[bit_pos] = frozen_bit; + d_path_list[i]->path_metric = update_path_metric(d_path_list[i]->path_metric, + d_path_list[i]->llr_vec[bit_pos], + frozen_bit); + } + d_active_pos = 0; + } + + path::path(): + path_metric(0.0f), owns_vectors(false), is_active(false), llr_vec(NULL), u_vec(NULL) + { + } + + path::~path(){ + if(owns_vectors){ + volk_free(llr_vec); + volk_free(u_vec); + } + } + + } /* namespace polar */ + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ diff --git a/gr-fec/lib/scl_list.h b/gr-fec/lib/scl_list.h new file mode 100644 index 0000000000..8f3fa66ac1 --- /dev/null +++ b/gr-fec/lib/scl_list.h @@ -0,0 +1,87 @@ +/* -*- c++ -*- */ +/* + * Copyright 2015 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_FEC_SCL_LIST_H +#define INCLUDED_FEC_SCL_LIST_H + +#include <vector> + +namespace gr { + namespace fec { + namespace code { + namespace polar { + + struct path { + path(); + ~path(); + float path_metric; + bool owns_vectors; + bool is_active; + float* llr_vec; + unsigned char* u_vec; + }; + + /*! + * \brief List implementation for Successive Cancellation List decoders + * + */ + class scl_list{ + const unsigned int d_list_size; + const unsigned int d_block_size; + const unsigned int d_block_power; + const unsigned int d_num_buff_elements; + std::vector<path*> d_path_list; + unsigned int d_active_path_counter; + unsigned int d_active_pos; + + float update_path_metric(const float last_pm, const float llr, const float ui) const; + void duplicate_path(path* target, const path* original); + void branch_paths(path* target, path* original, const float llr); + void steal_vector_ownership(path* target, path* original); + void reset(); + + // comparator for std::sort + static bool path_compare(path* first, path* second) { + return first->path_metric < second->path_metric; + }; + + public: + scl_list(const unsigned int list_size, const unsigned int block_size, + const unsigned int block_power); + virtual + ~scl_list(); + const unsigned int size() const {return d_list_size;}; + const unsigned int active_size() const {return d_active_path_counter;}; + + path* initial_path() const {return d_path_list[0];}; + path* next_active_path(){return d_path_list[d_active_pos++];}; + void set_frozen_bit(const unsigned char frozen_bit, const int bit_pos); + void set_info_bit(const int bit_pos); + const path* optimal_path(); + }; + + } /* namespace polar */ + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ + +#endif /* INCLUDED_FEC_SCL_LIST_H */ diff --git a/gr-fec/python/fec/CMakeLists.txt b/gr-fec/python/fec/CMakeLists.txt index 032816866d..d5bebd7638 100644 --- a/gr-fec/python/fec/CMakeLists.txt +++ b/gr-fec/python/fec/CMakeLists.txt @@ -39,6 +39,8 @@ GR_PYTHON_INSTALL( COMPONENT "fec_python" ) +add_subdirectory(polar) + ######################################################################## # Handle the unit tests ######################################################################## diff --git a/gr-fec/python/fec/polar/CMakeLists.txt b/gr-fec/python/fec/polar/CMakeLists.txt new file mode 100644 index 0000000000..1362ce18bb --- /dev/null +++ b/gr-fec/python/fec/polar/CMakeLists.txt @@ -0,0 +1,41 @@ +# Copyright 2015 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along 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 + channel_construction.py + channel_construction_bsc.py + channel_construction_bec.py + helper_functions.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/fec/polar + COMPONENT "fec_python" +) + +GR_PYTHON_INSTALL( + PROGRAMS + polar_channel_construction + DESTINATION ${GR_RUNTIME_DIR} + COMPONENT "fec_python" +) + + diff --git a/gr-fec/python/fec/polar/README.md b/gr-fec/python/fec/polar/README.md new file mode 100644 index 0000000000..d425e8650d --- /dev/null +++ b/gr-fec/python/fec/polar/README.md @@ -0,0 +1,9 @@ +POLAR Code Python test functions module +=========== + +This directory contains all the necessary files for POLAR code testcode. +It serves as a reference for C++ implementations. + +'polar_channel_construction' exposes functionality to calculate polar channels for different sizes. +It may be used to calculate Bhattacharyya parameters once and store them in a file in '~/.gnuradio/polar'. +Frozen bit positions are recalculated on every run.
\ No newline at end of file diff --git a/gr-fec/python/fec/polar/__init__.py b/gr-fec/python/fec/polar/__init__.py new file mode 100644 index 0000000000..0b9c264a77 --- /dev/null +++ b/gr-fec/python/fec/polar/__init__.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# +# Copyright 2015 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +# turn this folder into a Python module + +import channel_construction as cc +from channel_construction_bec import bhattacharyya_bounds +from helper_functions import is_power_of_two + + +CHANNEL_TYPE_BSC = 'BSC' +CHANNEL_TYPE_BEC = 'BEC' + +def get_z_params(is_prototype, channel, block_size, design_snr, mu): + print('POLAR code channel construction called with parameters channel={0}, blocksize={1}, design SNR={2}, mu={3}'.format(channel, block_size, design_snr, mu)) + if not (channel == 'BSC' or channel == 'BEC'): + raise ValueError("channel is {0}, but only BEC and BSC are supported!".format(channel)) + if not is_power_of_two(block_size): + raise ValueError("block size={0} is not a power of 2!".format(block_size)) + if design_snr < -1.5917: + raise ValueError("design SNR={0} < -1.5917. MUST be greater!".format(design_snr)) + if not mu > 0: + raise ValueError("mu={0} < 1. MUST be > 1!".format(mu)) + if not is_prototype and channel == 'BSC': + z_params = cc.load_z_parameters(block_size, design_snr, mu) + print('Read Z-parameter file: {0}'.format(cc.default_dir() + cc.generate_filename(block_size, design_snr, mu))) + return z_params + return bhattacharyya_bounds(design_snr, block_size) + + +def load_frozen_bits_info(is_prototype, channel, block_size, num_info_bits, design_snr, mu): + num_frozen_bits = block_size - num_info_bits + if not mu > 0: + mu = 2 + z_params = get_z_params(is_prototype, channel, block_size, design_snr, mu) + data_set = { + 'positions': cc.get_frozen_bit_indices_from_z_parameters(z_params, num_frozen_bits), + 'values': [0, ] * num_frozen_bits, + 'block_size': block_size, + 'num_info_bits': num_info_bits, + 'num_frozenbits': num_frozen_bits, + 'design_snr': design_snr, + 'channel': channel, + 'mu': mu, + } + return data_set diff --git a/gr-fec/python/fec/polar/bit_reversed_polar_encoding_scheme.svg b/gr-fec/python/fec/polar/bit_reversed_polar_encoding_scheme.svg new file mode 100644 index 0000000000..84849c994e --- /dev/null +++ b/gr-fec/python/fec/polar/bit_reversed_polar_encoding_scheme.svg @@ -0,0 +1,1160 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="744.09448819" + height="1052.3622047" + id="svg2" + version="1.1" + inkscape:version="0.48.4 r9939" + sodipodi:docname="bit_reversed_polar_encoding_scheme.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.94" + inkscape:cx="186.70213" + inkscape:cy="520" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1920" + inkscape:window-height="1056" + inkscape:window-x="1920" + inkscape:window-y="24" + inkscape:window-maximized="1" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <flowRoot + xml:space="preserve" + id="flowRoot3755" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"><flowRegion + id="flowRegion3757"><rect + id="rect3759" + width="190.42554" + height="154.25533" + x="75.531914" + y="201.29836" /></flowRegion><flowPara + id="flowPara3761">000sfdgkzhlbx000000</flowPara></flowRoot> <g + id="g4231" + transform="translate(-11.702127,-12.23403)"> + <g + transform="translate(-77.659574,-114.89362)" + id="g3767"> + <rect + id="rect2985" + width="42.553192" + height="41.489372" + x="136.17021" + y="258.74515" + style="fill:none;stroke:#000000;stroke-opacity:1" /> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="144.68085" + y="293.85156" + id="text3763" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3765" + x="144.68085" + y="293.85156">0</tspan></text> + </g> + </g> + <g + id="g4225" + transform="translate(-5.319148,-34.650486)"> + <g + transform="translate(-84.042553,-23.936162)" + id="g3767-0"> + <rect + id="rect2985-6" + width="42.553192" + height="41.489372" + x="136.17021" + y="258.74515" + style="fill:none;stroke:#000000;stroke-opacity:1" /> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="144.68085" + y="293.85156" + id="text3763-6" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3765-8" + x="144.68085" + y="293.85156">4</tspan></text> + </g> + </g> + <g + id="g4219" + transform="translate(-10.638297,-24.62003)"> + <g + transform="translate(-78.723404,34.574476)" + id="g3767-8"> + <rect + id="rect2985-8" + width="42.553192" + height="41.489372" + x="136.17021" + y="258.74515" + style="fill:none;stroke:#000000;stroke-opacity:1" /> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="144.68085" + y="293.85156" + id="text3763-62" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3765-7" + x="144.68085" + y="293.85156">2</tspan></text> + </g> + </g> + <g + id="g4213" + transform="translate(-7.446808,-9.270503)"> + <g + transform="translate(-81.914893,87.765966)" + id="g3767-5"> + <rect + id="rect2985-3" + width="42.553192" + height="41.489372" + x="136.17021" + y="258.74515" + style="fill:none;stroke:#000000;stroke-opacity:1" /> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="144.68085" + y="293.85156" + id="text3763-7" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3765-81" + x="144.68085" + y="293.85156">6</tspan></text> + </g> + </g> + <g + id="g4207" + transform="translate(-5.319148,-12.00608)"> + <g + transform="translate(-84.042553,159.04256)" + id="g3767-1"> + <rect + id="rect2985-5" + width="42.553192" + height="41.489372" + x="136.17021" + y="258.74515" + style="fill:none;stroke:#000000;stroke-opacity:1" /> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="144.68085" + y="293.85156" + id="text3763-3" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3765-87" + x="144.68085" + y="293.85156">1</tspan></text> + </g> + </g> + <g + id="g4201" + transform="translate(-11.702127,0.15198)"> + <g + transform="translate(-77.659574,215.42554)" + id="g3767-54"> + <rect + id="rect2985-4" + width="42.553192" + height="41.489372" + x="136.17021" + y="258.74515" + style="fill:none;stroke:#000000;stroke-opacity:1" /> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="144.68085" + y="293.85156" + id="text3763-4" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3765-6" + x="144.68085" + y="293.85156">5</tspan></text> + </g> + </g> + <g + id="g4195" + transform="translate(-3.191489,-1.51975)"> + <g + transform="translate(-86.170212,285.63831)" + id="g3767-9"> + <rect + id="rect2985-7" + width="42.553192" + height="41.489372" + x="136.17021" + y="258.74515" + style="fill:none;stroke:#000000;stroke-opacity:1" /> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="144.68085" + y="293.85156" + id="text3763-8" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3765-0" + x="144.68085" + y="293.85156">3</tspan></text> + </g> + </g> + <g + id="g4189" + transform="translate(0,-2.12766)"> + <g + transform="translate(-89.361701,354.78724)" + id="g3767-6"> + <rect + id="rect2985-73" + width="42.553192" + height="41.489372" + x="136.17021" + y="258.74515" + style="fill:none;stroke:#000000;stroke-opacity:1" /> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="144.68085" + y="293.85156" + id="text3763-64" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3765-07" + x="144.68085" + y="293.85156">7</tspan></text> + </g> + </g> + <g + id="g3767-4" + transform="translate(188.08511,-127.12765)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-0" /> + <text + sodipodi:linespacing="125%" + id="text3763-38" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-9" + sodipodi:role="line">0</tspan></text> + </g> + <g + id="g3767-01" + transform="translate(188.08511,-58.586648)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-68" /> + <text + sodipodi:linespacing="125%" + id="text3763-40" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-69" + sodipodi:role="line">1</tspan></text> + </g> + <g + id="g3767-83" + transform="translate(188.08511,9.9544464)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-44" /> + <text + sodipodi:linespacing="125%" + id="text3763-9" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-1" + sodipodi:role="line">2</tspan></text> + </g> + <g + id="g3767-010" + transform="translate(188.08511,78.495463)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-9" /> + <text + sodipodi:linespacing="125%" + id="text3763-1" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-68" + sodipodi:role="line">3</tspan></text> + </g> + <g + id="g3767-7" + transform="translate(188.08511,147.03648)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-42" /> + <text + sodipodi:linespacing="125%" + id="text3763-93" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-89" + sodipodi:role="line">4</tspan></text> + </g> + <g + id="g3767-87" + transform="translate(188.08511,215.57752)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-1" /> + <text + sodipodi:linespacing="125%" + id="text3763-90" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-97" + sodipodi:role="line">5</tspan></text> + </g> + <g + id="g3767-79" + transform="translate(188.08511,284.11856)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-36" /> + <text + sodipodi:linespacing="125%" + id="text3763-99" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-3" + sodipodi:role="line">6</tspan></text> + </g> + <g + id="g3767-40" + transform="translate(188.08511,352.65958)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-66" /> + <text + sodipodi:linespacing="125%" + id="text3763-16" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-5" + sodipodi:role="line">7</tspan></text> + </g> + <g + id="g3767-544" + transform="translate(344.97872,-127.12765)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-2" /> + <text + sodipodi:linespacing="125%" + id="text3763-88" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-32" + sodipodi:role="line">0</tspan></text> + </g> + <g + id="g3767-94" + transform="translate(344.97872,-58.586648)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-08" /> + <text + sodipodi:linespacing="125%" + id="text3763-5" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-10" + sodipodi:role="line">1</tspan></text> + </g> + <g + id="g3767-59" + transform="translate(344.97872,9.9544464)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-76" /> + <text + sodipodi:linespacing="125%" + id="text3763-46" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-65" + sodipodi:role="line">2</tspan></text> + </g> + <g + id="g3767-12" + transform="translate(344.97872,78.495463)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-67" /> + <text + sodipodi:linespacing="125%" + id="text3763-87" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-56" + sodipodi:role="line">3</tspan></text> + </g> + <g + id="g3767-2" + transform="translate(344.97872,147.03648)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-92" /> + <text + sodipodi:linespacing="125%" + id="text3763-47" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-09" + sodipodi:role="line">4</tspan></text> + </g> + <g + id="g3767-11" + transform="translate(344.97872,215.57752)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-449" /> + <text + sodipodi:linespacing="125%" + id="text3763-95" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-06" + sodipodi:role="line">5</tspan></text> + </g> + <g + id="g3767-69" + transform="translate(344.97872,284.11856)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-31" /> + <text + sodipodi:linespacing="125%" + id="text3763-51" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-683" + sodipodi:role="line">6</tspan></text> + </g> + <g + id="g3767-47" + transform="translate(344.97872,352.65958)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-32" /> + <text + sodipodi:linespacing="125%" + id="text3763-2" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-94" + sodipodi:role="line">7</tspan></text> + </g> + <g + id="g3767-111" + transform="translate(502,-127.12765)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-14" /> + <text + sodipodi:linespacing="125%" + id="text3763-0" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-4" + sodipodi:role="line">0</tspan></text> + </g> + <g + id="g3767-56" + transform="translate(502,-58.586648)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-85" /> + <text + sodipodi:linespacing="125%" + id="text3763-66" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-74" + sodipodi:role="line">1</tspan></text> + </g> + <g + id="g3767-46" + transform="translate(502,9.9544464)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-75" /> + <text + sodipodi:linespacing="125%" + id="text3763-48" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-42" + sodipodi:role="line">2</tspan></text> + </g> + <g + id="g3767-18" + transform="translate(502,78.495463)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-27" /> + <text + sodipodi:linespacing="125%" + id="text3763-24" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-67" + sodipodi:role="line">3</tspan></text> + </g> + <g + id="g3767-80" + transform="translate(502,147.03648)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-89" /> + <text + sodipodi:linespacing="125%" + id="text3763-405" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-17" + sodipodi:role="line">4</tspan></text> + </g> + <g + id="g3767-66" + transform="translate(502,215.57752)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-52" /> + <text + sodipodi:linespacing="125%" + id="text3763-39" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-82" + sodipodi:role="line">5</tspan></text> + </g> + <g + id="g3767-946" + transform="translate(502,284.11856)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-70" /> + <text + sodipodi:linespacing="125%" + id="text3763-01" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-02" + sodipodi:role="line">6</tspan></text> + </g> + <g + id="g3767-837" + transform="translate(502,352.65958)"> + <rect + style="fill:none;stroke:#000000;stroke-opacity:1" + y="258.74515" + x="136.17021" + height="41.489372" + width="42.553192" + id="rect2985-60" /> + <text + sodipodi:linespacing="125%" + id="text3763-76" + y="293.85156" + x="144.68085" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="293.85156" + x="144.68085" + id="tspan3765-08" + sodipodi:role="line">7</tspan></text> + </g> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 89.361703,152.36218 234.893617,0" + id="path4237" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4231" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-4" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 366.80851,152.36218 114.34042,0" + id="path4239" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-4" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-544" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 523.70212,152.36218 114.46809,0" + id="path4241" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-544" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-111" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 89.361703,220.90319 234.893617,0" + id="path4243" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4225" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-01" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 366.80851,220.90319 114.34042,0" + id="path4245" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-01" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-94" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 523.70212,220.90319 114.46809,0" + id="path4247" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-94" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-56" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 89.361703,289.44428 234.893617,0" + id="path4249" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4219" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-83" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 366.80851,289.44428 114.34042,0" + id="path4251" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-83" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-59" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 523.70212,289.44428 114.46809,0" + id="path4253" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-59" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-46" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 89.361703,357.9853 234.893617,0" + id="path4255" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4213" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-010" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 366.80851,357.9853 114.34042,0" + id="path4257" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-010" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-12" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 523.70212,357.9853 114.46809,0" + id="path4259" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-12" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-18" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 89.361703,426.52631 234.893617,0" + id="path4261" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4207" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-7" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 366.80851,426.52631 114.34042,0" + id="path4263" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-7" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-2" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 523.70212,426.52631 114.46809,0" + id="path4265" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-2" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-80" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 89.361703,495.06735 234.893617,0" + id="path4267" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4201" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-87" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 366.80851,495.06735 114.34042,0" + id="path4269" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-87" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-11" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 523.70212,495.06735 114.46809,0" + id="path4271" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-11" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-66" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 366.80851,563.60839 114.34042,0" + id="path4275" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-79" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-69" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 523.70212,563.60839 114.46809,0" + id="path4277" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-69" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-946" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 366.80851,632.14941 114.34042,0" + id="path4285" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-40" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-47" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 523.70212,632.14941 114.46809,0" + id="path4287" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-47" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-837" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 89.361703,563.60839 234.893617,0" + id="path4289" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4195" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-79" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 89.361703,632.14941 234.893617,0" + id="path4291" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4189" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-40" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 523.70212,211.61579 638.17021,161.64958" + id="path4293" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-94" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-111" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 523.70212,348.6979 638.17021,298.73168" + id="path4295" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-12" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-46" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 523.70212,485.77995 638.17021,435.81372" + id="path4297" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-11" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-80" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 523.70212,622.86201 638.17021,572.89579" + id="path4299" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-47" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-946" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 366.80851,545.01847 481.14893,445.11624" + id="path4301" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-79" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-2" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 366.80851,613.55949 481.14893,513.65727" + id="path4303" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-40" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-11" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 366.80851,270.85436 481.14893,170.95211" + id="path4305" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-83" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-544" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 366.80851,339.39537 481.14893,239.49311" + id="path4307" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g3767-010" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-94" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 89.078178,405.78163 324.53885,173.10687" + id="path4309" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4207" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-4" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 89.078175,474.32267 324.53885,241.64787" + id="path4311" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4201" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-01" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 89.078179,542.86371 324.53885,310.18897" + id="path4313" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4195" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-83" + inkscape:connection-end-point="d4" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 89.078179,611.40473 324.53885,378.72998" + id="path4315" + inkscape:connector-type="polyline" + inkscape:connector-curvature="0" + inkscape:connection-start="#g4189" + inkscape:connection-start-point="d4" + inkscape:connection-end="#g3767-010" + inkscape:connection-end-point="d4" /> + </g> +</svg> diff --git a/gr-fec/python/fec/polar/channel_construction.py b/gr-fec/python/fec/polar/channel_construction.py new file mode 100644 index 0000000000..a7f048c5b9 --- /dev/null +++ b/gr-fec/python/fec/polar/channel_construction.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python +# +# Copyright 2015 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. +# + +''' +[0] Erdal Arikan: 'Channel Polarization: A Method for Constructing Capacity-Achieving Codes for Symmetric Binary-Input Memoryless Channels', 2009 +foundational paper for polar codes. +''' + + +from channel_construction_bec import calculate_bec_channel_capacities +from channel_construction_bec import design_snr_to_bec_eta +from channel_construction_bec import bhattacharyya_bounds +from channel_construction_bsc import tal_vardy_tpm_algorithm +from helper_functions import * +import matplotlib.pyplot as plt + + +Z_PARAM_FIRST_HEADER_LINE = "Bhattacharyya parameters (Z-parameters) for a polar code" + + +def get_frozen_bit_indices_from_capacities(chan_caps, nfrozen): + indexes = np.array([], dtype=int) + while indexes.size < nfrozen: + index = np.argmin(chan_caps) + indexes = np.append(indexes, index) + chan_caps[index] = 2.0 # make absolutely sure value is out of range! + return np.sort(indexes) + + +def get_frozen_bit_indices_from_z_parameters(z_params, nfrozen): + indexes = np.array([], dtype=int) + while indexes.size < nfrozen: + index = np.argmax(z_params) + indexes = np.append(indexes, index) + z_params[index] = -1.0 + return np.sort(indexes) + + +def get_bec_frozen_indices(nblock, kfrozen, eta): + bec_caps = calculate_bec_channel_capacities(eta, nblock) + positions = get_frozen_bit_indices_from_capacities(bec_caps, kfrozen) + return positions + + +def get_frozen_bit_mask(frozen_indices, block_size): + frozen_mask = np.zeros(block_size, dtype=int) + frozen_mask[frozen_indices] = 1 + return frozen_mask + + +def frozen_bit_positions(block_size, info_size, design_snr=0.0): + if not design_snr > -1.5917: + print('bad value for design_nsr, must be > -1.5917! default=0.0') + design_snr = 0.0 + eta = design_snr_to_bec_eta(design_snr) + return get_bec_frozen_indices(block_size, block_size - info_size, eta) + + +def generate_filename(block_size, design_snr, mu): + filename = "polar_code_z_parameters_N" + str(int(block_size)) + filename += "_SNR" + str(float(design_snr)) + "_MU" + str(int(mu)) + ".polar" + return filename + + +def default_dir(): + dir_def = "~/.gnuradio/polar/" + import os + path = os.path.expanduser(dir_def) + + try: + os.makedirs(path) + except OSError: + if not os.path.isdir(path): + raise + return path + + +def save_z_parameters(z_params, block_size, design_snr, mu): + path = default_dir() + filename = generate_filename(block_size, design_snr, mu) + header = Z_PARAM_FIRST_HEADER_LINE + "\n" + header += "Channel construction method: Tal-Vardy algorithm\n" + header += "Parameters:\n" + header += "block_size=" + str(block_size) + "\n" + header += "design_snr=" + str(design_snr) + "\n" + header += "mu=" + str(mu) + np.savetxt(path + filename, z_params, header=header) + + +def load_z_parameters(block_size, design_snr, mu): + path = default_dir() + filename = generate_filename(block_size, design_snr, mu) + full_file = path + filename + import os + if not os.path.isfile(full_file): + z_params = tal_vardy_tpm_algorithm(block_size, design_snr, mu) + save_z_parameters(z_params, block_size, design_snr, mu) + z_params = np.loadtxt(full_file) + return z_params + + +def main(): + np.set_printoptions(precision=3, linewidth=150) + print 'channel construction Bhattacharyya bounds by Arikan' + n = 10 + m = 2 ** n + k = m // 2 + design_snr = 0.0 + mu = 32 + + z_params = load_z_parameters(m, design_snr, mu) + z_bounds = bhattacharyya_bounds(design_snr, m) + print(z_params[-10:]) + plt.plot(z_params) + plt.plot(z_bounds) + plt.show() + + +if __name__ == '__main__': + main() + + diff --git a/gr-fec/python/fec/polar/channel_construction_bec.py b/gr-fec/python/fec/polar/channel_construction_bec.py new file mode 100644 index 0000000000..f8f960dfe7 --- /dev/null +++ b/gr-fec/python/fec/polar/channel_construction_bec.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python +# +# Copyright 2015 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. +# + +import numpy as np +import helper_functions as hf + + +def bec_channel(eta): + ''' + binary erasure channel (BEC) + for each y e Y + W(y|0) * W(y|1) = 0 or W(y|0) = W(y|1) + transistions are 1 -> 1 or 0 -> 0 or {0, 1} -> ? (erased symbol) + ''' + # looks like BSC but should be interpreted differently. + w = np.array((1 - eta, eta, 1 - eta), dtype=float) + return w + + +def odd_rec(iwn): + return iwn ** 2 + + +def even_rec(iwn): + return 2 * iwn - iwn ** 2 + + +def calc_one_recursion(iw0): + iw1 = np.zeros(2 * len(iw0)) # double values + for i in range(len(iw0)): + # careful indices screw you because paper is '1' based :( + iw1[2 * i] = odd_rec(iw0[i]) + iw1[2 * i + 1] = even_rec(iw0[i]) + return iw1 + + +def calculate_bec_channel_capacities(eta, block_size): + # compare [0, Arikan] eq. 6 + iw = 1 - eta # holds for BEC as stated in paper + iw = np.array([iw, ], dtype=float) + lw = hf.power_of_2_int(block_size) + for i in range(lw): + iw = calc_one_recursion(iw) + return iw + + +def calculate_z_parameters_one_recursion(z_params): + z_next = np.zeros(2 * z_params.size) + for i in range(z_params.size): + z_sq = z_params[i] ** 2 + z_next[2 * i] = 2 * z_params[i] - z_sq + z_next[2 * i + 1] = z_sq + return z_next + + +def calculate_bec_channel_z_parameters(eta, block_size): + # compare [0, Arikan] eq. 38 + block_power = hf.power_of_2_int(block_size) + z_params = np.array([eta, ], dtype=float) + for block_size in range(block_power): + z_params = calculate_z_parameters_one_recursion(z_params) + return z_params + + +def design_snr_to_bec_eta(design_snr): + s = 10. ** (design_snr / 10.) + return np.exp(-s) + + +def bhattacharyya_bounds(design_snr, block_size): + ''' + Harish Vangala, Emanuele Viterbo, Yi Hong: 'A Comparative Study of Polar Code Constructions for the AWGN Channel', 2015 + In this paper it is called Bhattacharyya bounds channel construction and is abbreviated PCC-0 + Best design SNR for block_size = 2048, R = 0.5, is 0dB. + Compare with Arikan: 'Channel Polarization: A Method for Constructing Capacity-Achieving Codes for Symmetric Binary-Input Memoryless Channels. + Proposition 5. inequalities turn into equalities for BEC channel. Otherwise they represent an upper bound. + Also compare [0, Arikan] eq. 6 and 38 + For BEC that translates to capacity(i) = 1 - bhattacharyya(i) + :return Z-parameters in natural bit-order. Choose according to desired rate. + ''' + # minimum design snr = -1.5917 corresponds to BER = 0.5 + s = 10 ** (design_snr / 10) # 'initial z parameter'. + eta = np.exp(-s) + return calculate_bec_channel_z_parameters(eta, block_size) + + +def main(): + print 'channel construction main' + n = 10 + block_size = 2 ** n + design_snr = 1.0 + eta = design_snr_to_bec_eta(design_snr) + print(calculate_bec_channel_z_parameters(eta, block_size)) + print(calculate_bec_channel_capacities(eta, block_size)) + + +if __name__ == '__main__': + main() diff --git a/gr-fec/python/fec/polar/channel_construction_bsc.py b/gr-fec/python/fec/polar/channel_construction_bsc.py new file mode 100755 index 0000000000..e16813fcb7 --- /dev/null +++ b/gr-fec/python/fec/polar/channel_construction_bsc.py @@ -0,0 +1,280 @@ +#!/usr/bin/env python +# +# Copyright 2015 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. +# + +''' +Based on 2 papers: +[1] Ido Tal, Alexander Vardy: 'How To Construct Polar Codes', 2013 +for an in-depth description of a widely used algorithm for channel construction. + +[2] Harish Vangala, Emanuele Viterbo, Yi Hong: 'A Comparative Study of Polar Code Constructions for the AWGN Channel', 2015 +for an overview of different approaches +''' + + +from scipy.optimize import fsolve +from scipy.special import erfc +from helper_functions import * +import matplotlib.pyplot as plt +from channel_construction_bec import bhattacharyya_bounds + + +def bsc_channel(p): + ''' + binary symmetric channel (BSC) + output alphabet Y = {0, 1} and + W(0|0) = W(1|1) and W(1|0) = W(0|1) + + this function returns a prob's vector for a BSC + p denotes an erroneous transistion + ''' + if not (p >= 0.0 and p <= 1.0): + print "given p is out of range!" + return np.array([], dtype=float) + + # 0 -> 0, 0 -> 1, 1 -> 0, 1 -> 1 + W = np.array([[1 - p, p], [p, 1 - p]], dtype=float) + return W + + +def solver_equation(val, s): + cw_lambda = codeword_lambda_callable(s) + ic_lambda = instantanious_capacity_callable() + return lambda y: ic_lambda(cw_lambda(y)) - val + + +def solve_capacity(a, s): + eq = solver_equation(a, s) + res = fsolve(eq, 1) + return np.abs(res[0]) # only positive values needed. + + +def codeword_lambda_callable(s): + return lambda y: np.exp(-2 * y * np.sqrt(2 * s)) + + +def codeword_lambda(y, s): + return codeword_lambda_callable(s)(y) + + +def instantanious_capacity_callable(): + return lambda x : 1 - np.log2(1 + x) + (x * np.log2(x) / (1 + x)) + + +def instantanious_capacity(x): + return instantanious_capacity_callable()(x) + + +def q_function(x): + # Q(x) = (1 / sqrt(2 * pi) ) * integral (x to inf) exp(- x ^ 2 / 2) dx + return .5 * erfc(x / np.sqrt(2)) + + +def discretize_awgn(mu, design_snr): + ''' + needed for Binary-AWGN channels. + in [1] described in Section VI + in [2] described as a function of the same name. + in both cases reduce infinite output alphabet to a finite output alphabet of a given channel. + idea: + 1. instantaneous capacity C(x) in interval [0, 1] + 2. split into mu intervals. + 3. find corresponding output alphabet values y of likelihood ratio function lambda(y) inserted into C(x) + 4. Calculate probability for each value given that a '0' or '1' is was transmitted. + ''' + s = 10 ** (design_snr / 10) + a = np.zeros(mu + 1, dtype=float) + a[-1] = np.inf + for i in range(1, mu): + a[i] = solve_capacity(1. * i / mu, s) + + factor = np.sqrt(2 * s) + tpm = np.zeros((2, mu)) + for j in range(mu): + tpm[0][j] = q_function(factor + a[j]) - q_function(factor + a[j + 1]) + tpm[1][j] = q_function(-1. * factor + a[j]) - q_function(-1. * factor + a[j + 1]) + return tpm + + +def instant_capacity_delta_callable(): + return lambda a, b: -1. * (a + b) * np.log2((a + b) / 2) + a * np.log2(a) + b * np.log2(b) + + +def capacity_delta_callable(): + c = instant_capacity_delta_callable() + return lambda a, b, at, bt: c(a, b) + c(at, bt) - c(a + at, b + bt) + + +def quantize_to_size(tpm, mu): + # This is a degrading merge, compare [1] + calculate_delta_I = capacity_delta_callable() + L = np.shape(tpm)[1] + if not mu < L: + print('WARNING: This channel gets too small!') + + # lambda works on vectors just fine. Use Numpy vector awesomeness. + delta_i_vec = calculate_delta_I(tpm[0, 0:-1], tpm[1, 0:-1], tpm[0, 1:], tpm[1, 1:]) + + for i in range(L - mu): + d = np.argmin(delta_i_vec) + ap = tpm[0, d] + tpm[0, d + 1] + bp = tpm[1, d] + tpm[1, d + 1] + if d > 0: + delta_i_vec[d - 1] = calculate_delta_I(tpm[0, d - 1], tpm[1, d - 1], ap, bp) + if d < delta_i_vec.size - 1: + delta_i_vec[d + 1] = calculate_delta_I(ap, bp, tpm[0, d + 1], tpm[1, d + 1]) + delta_i_vec = np.delete(delta_i_vec, d) + tpm = np.delete(tpm, d, axis=1) + tpm[0, d] = ap + tpm[1, d] = bp + return tpm + + +def upper_bound_z_params(z, block_size, design_snr): + upper_bound = bhattacharyya_bounds(design_snr, block_size) + z = np.minimum(z, upper_bound) + return z + + +def tal_vardy_tpm_algorithm(block_size, design_snr, mu): + block_power = power_of_2_int(block_size) + channels = np.zeros((block_size, 2, mu)) + channels[0] = discretize_awgn(mu, design_snr) * 2 + + print('Constructing polar code with Tal-Vardy algorithm') + print('(block_size = {0}, design SNR = {1}, mu = {2}'.format(block_size, design_snr, mu)) + show_progress_bar(0, block_size) + for j in range(0, block_power): + u = 2 ** j + for t in range(u): + show_progress_bar(u + t, block_size) + # print("(u={0}, t={1}) = {2}".format(u, t, u + t)) + ch1 = upper_convolve(channels[t], mu) + ch2 = lower_convolve(channels[t], mu) + channels[t] = quantize_to_size(ch1, mu) + channels[u + t] = quantize_to_size(ch2, mu) + + z = np.zeros(block_size) + for i in range(block_size): + # z[i] = np.sum(channels[i][1]) + z[i] = bhattacharyya_parameter(channels[i]) + + z = z[bit_reverse_vector(np.arange(block_size), block_power)] + z = upper_bound_z_params(z, block_size, design_snr) + show_progress_bar(block_size, block_size) + print('') + print('channel construction DONE') + return z + + +def merge_lr_based(q, mu): + lrs = q[0] / q[1] + vals, indices, inv_indices = np.unique(lrs, return_index=True, return_inverse=True) + # compare [1] (20). Ordering of representatives according to LRs. + temp = np.zeros((2, len(indices)), dtype=float) + if vals.size < mu: + return q + for i in range(len(indices)): + merge_pos = np.where(inv_indices == i)[0] + sum_items = q[:, merge_pos] + if merge_pos.size > 1: + sum_items = np.sum(q[:, merge_pos], axis=1) + temp[0, i] = sum_items[0] + temp[1, i] = sum_items[1] + return temp + + +def upper_convolve(tpm, mu): + q = np.zeros((2, mu ** 2)) + idx = -1 + for i in range(mu): + idx += 1 + q[0, idx] = (tpm[0, i] ** 2 + tpm[1, i] ** 2) / 2 + q[1, idx] = tpm[0, i] * tpm[1, i] + for j in range(i + 1, mu): + idx += 1 + q[0, idx] = tpm[0, i] * tpm[0, j] + tpm[1, i] * tpm[1, j] + q[1, idx] = tpm[0, i] * tpm[1, j] + tpm[1, i] * tpm[0, j] + if q[0, idx] < q[1, idx]: + q[0, idx], q[1, idx] = swap_values(q[0, idx], q[1, idx]) + + idx += 1 + q = np.delete(q, np.arange(idx, np.shape(q)[1]), axis=1) + q = merge_lr_based(q, mu) + q = normalize_q(q, tpm) + return q + + +def lower_convolve(tpm, mu): + q = np.zeros((2, mu * (mu + 1))) + idx = -1 + for i in range(0, mu): + idx += 1 + q[0, idx] = (tpm[0, i] ** 2) / 2 + q[1, idx] = (tpm[1, i] ** 2) / 2 + if q[0, idx] < q[1, idx]: + q[0, idx], q[1, idx] = swap_values(q[0, idx], q[1, idx]) + idx += 1 + q[0, idx] = tpm[0, i] * tpm[1, i] + q[1, idx] = q[0, idx] + + for j in range(i + 1, mu): + idx += 1 + q[0, idx] = tpm[0, i] * tpm[0, j] + q[1, idx] = tpm[1, i] * tpm[1, j] + if q[0, idx] < q[1, idx]: + q[0, idx], q[1, idx] = swap_values(q[0, idx], q[1, idx]) + idx += 1 + q[0, idx] = tpm[0, i] * tpm[1, j] + q[1, idx] = tpm[1, i] * tpm[0, j] + if q[0, idx] < q[1, idx]: + q[0, idx], q[1, idx] = swap_values(q[0, idx], q[1, idx]) + idx += 1 + q = np.delete(q, np.arange(idx, np.shape(q)[1]), axis=1) + q = merge_lr_based(q, mu) + q = normalize_q(q, tpm) + return q + + +def swap_values(first, second): + return second, first + + +def normalize_q(q, tpm): + original_factor = np.sum(tpm) + next_factor = np.sum(q) + factor = original_factor / next_factor + return q * factor + + +def main(): + print 'channel construction BSC main' + n = 8 + m = 2 ** n + design_snr = 0.0 + mu = 16 + + z_params = tal_vardy_tpm_algorithm(m, design_snr, mu) + print(z_params) + plt.plot(z_params) + plt.show() + + +if __name__ == '__main__': + main() diff --git a/gr-fec/python/fec/polar/common.py b/gr-fec/python/fec/polar/common.py new file mode 100644 index 0000000000..b4b152de61 --- /dev/null +++ b/gr-fec/python/fec/polar/common.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# +# Copyright 2015 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. +# + + +import numpy as np +from helper_functions import * + +''' +PolarCommon holds value checks and common initializer code for both Encoder and Decoder. +''' + + +class PolarCommon: + def __init__(self, n, k, frozen_bit_position, frozenbits=None): + if not is_power_of_two(n): + raise ValueError("n={0} is not a power of 2!".format(n)) + if frozenbits is None: + frozenbits = np.zeros(n - k, dtype=np.int) + if not len(frozenbits) == n - k: + raise ValueError("len(frozenbits)={0} is not equal to n-k={1}!".format(len(frozenbits), n - k)) + if not frozenbits.dtype == np.int: + frozenbits = frozenbits.astype(dtype=int) + if not len(frozen_bit_position) == (n - k): + raise ValueError("len(frozen_bit_position)={0} is not equal to n-k={1}!".format(len(frozen_bit_position), n - k)) + if not frozen_bit_position.dtype == np.int: + frozen_bit_position = frozen_bit_position.astype(dtype=int) + + self.bit_reverse_positions = self._vector_bit_reversed(np.arange(n, dtype=int), int(np.log2(n))) + self.N = n + self.power = int(np.log2(self.N)) + self.K = k + self.frozenbits = frozenbits + self.frozen_bit_position = frozen_bit_position + self.info_bit_position = np.delete(np.arange(self.N), self.frozen_bit_position) + + def _insert_frozen_bits(self, u): + prototype = np.empty(self.N, dtype=int) + prototype[self.frozen_bit_position] = self.frozenbits + prototype[self.info_bit_position] = u + return prototype + + def _extract_info_bits(self, y): + return y[self.info_bit_position] + + def _reverse_bits(self, vec): + return vec[self.bit_reverse_positions] + + def _vector_bit_reversed(self, vec, n): + return bit_reverse_vector(vec, n) + + def info_print(self): + print "POLAR code ({0}, {1})".format(self.N, self.K) diff --git a/gr-fec/python/fec/polar/decoder.py b/gr-fec/python/fec/polar/decoder.py new file mode 100644 index 0000000000..10eef9b6ed --- /dev/null +++ b/gr-fec/python/fec/polar/decoder.py @@ -0,0 +1,269 @@ +#!/usr/bin/env python +# +# Copyright 2015 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. +# + +import numpy as np +from common import PolarCommon + +# for dev +from encoder import PolarEncoder +from matplotlib import pyplot as plt + + +class PolarDecoder(PolarCommon): + def __init__(self, n, k, frozen_bit_position, frozenbits=None): + PolarCommon.__init__(self, n, k, frozen_bit_position, frozenbits) + + self.error_probability = 0.1 # this is kind of a dummy value. usually chosen individually. + self.bsc_lr = ((1 - self.error_probability) / self.error_probability, self.error_probability / (1 - self.error_probability)) + self.bsc_llrs = np.log(self.bsc_lr) + + def _llr_bit(self, bit): + return self.bsc_llrs[bit] + + def _llr_odd(self, la, lb): + # this functions uses the min-sum approximation + # exact formula: np.log((np.exp(la + lb) + 1) / (np.exp(la) + np.exp(lb))) + return np.sign(la) * np.sign(lb) * np.minimum(np.abs(la), np.abs(lb)) + + _f_vals = np.array((1.0, -1.0), dtype=float) + + def _llr_even(self, la, lb, f): + return (la * self._f_vals[f]) + lb + + def _llr_bit_decision(self, llr): + if llr < 0.0: + ui = int(1) + else: + ui = int(0) + return ui + + def _retrieve_bit_from_llr(self, lr, pos): + f_index = np.where(self.frozen_bit_position == pos)[0] + if not f_index.size == 0: + ui = self.frozenbits[f_index][0] + else: + ui = self._llr_bit_decision(lr) + return ui + + def _lr_bit(self, bit): + return self.bsc_lr[bit] + + def _lr_odd(self, la, lb): + # la is upper branch and lb is lower branch + return (la * lb + 1) / (la + lb) + + def _lr_even(self, la, lb, f): + # la is upper branch and lb is lower branch, f is last decoded bit. + return (la ** (1 - (2 * f))) * lb + + def _lr_bit_decision(self, lr): + if lr < 1: + return int(1) + return int(0) + + def _get_even_indices_values(self, u_hat): + # looks like overkill for some indexing, but zero and one based indexing mix-up gives you haedaches. + return u_hat[1::2] + + def _get_odd_indices_values(self, u_hat): + return u_hat[0::2] + + def _calculate_lrs(self, y, u): + ue = self._get_even_indices_values(u) + uo = self._get_odd_indices_values(u) + ya = y[0:y.size//2] + yb = y[(y.size//2):] + la = self._lr_decision_element(ya, (ue + uo) % 2) + lb = self._lr_decision_element(yb, ue) + return la, lb + + def _lr_decision_element(self, y, u): + if y.size == 1: + return self._llr_bit(y[0]) + if u.size % 2 == 0: # use odd branch formula + la, lb = self._calculate_lrs(y, u) + return self._llr_odd(la, lb) + else: + ui = u[-1] + la, lb = self._calculate_lrs(y, u[0:-1]) + return self._llr_even(la, lb, ui) + + def _retrieve_bit_from_lr(self, lr, pos): + f_index = np.where(self.frozen_bit_position == pos)[0] + if not f_index.size == 0: + ui = self.frozenbits[f_index][0] + else: + ui = self._lr_bit_decision(lr) + return ui + + def _lr_sc_decoder(self, y): + # this is the standard SC decoder as derived from the formulas. It sticks to natural bit order. + u = np.array([], dtype=int) + for i in range(y.size): + lr = self._lr_decision_element(y, u) + ui = self._retrieve_bit_from_llr(lr, i) + u = np.append(u, ui) + return u + + def _llr_retrieve_bit(self, llr, pos): + f_index = np.where(self.frozen_bit_position == pos)[0] + if not f_index.size == 0: + ui = self.frozenbits[f_index][0] + else: + ui = self._llr_bit_decision(llr) + return ui + + def _butterfly_decode_bits(self, pos, graph, u): + bit_num = u.size + llr = graph[pos][0] + ui = self._llr_retrieve_bit(llr, bit_num) + # ui = self._llr_bit_decision(llr) + u = np.append(u, ui) + lower_right = pos + (self.N // 2) + la = graph[pos][1] + lb = graph[lower_right][1] + graph[lower_right][0] = self._llr_even(la, lb, ui) + llr = graph[lower_right][0] + # ui = self._llr_bit_decision(llr) + ui = self._llr_retrieve_bit(llr, u.size) + u = np.append(u, ui) + return graph, u + + def _lr_sc_decoder_efficient(self, y): + graph = np.full((self.N, self.power + 1), np.NaN, dtype=float) + for i in range(self.N): + graph[i][self.power] = self._llr_bit(y[i]) + decode_order = self._vector_bit_reversed(np.arange(self.N), self.power) + decode_order = np.delete(decode_order, np.where(decode_order >= self.N // 2)) + u = np.array([], dtype=int) + for pos in decode_order: + graph = self._butterfly(pos, 0, graph, u) + graph, u = self._butterfly_decode_bits(pos, graph, u) + return u + + def _stop_propagation(self, bf_entry_row, stage): + # calculate break condition + modulus = 2 ** (self.power - stage) + # stage_size = self.N // (2 ** stage) + # half_stage_size = stage_size // 2 + half_stage_size = self.N // (2 ** (stage + 1)) + stage_pos = bf_entry_row % modulus + return stage_pos >= half_stage_size + + def _butterfly(self, bf_entry_row, stage, graph, u): + if not self.power > stage: + return graph + + if self._stop_propagation(bf_entry_row, stage): + upper_right = bf_entry_row - self.N // (2 ** (stage + 1)) + la = graph[upper_right][stage + 1] + lb = graph[bf_entry_row][stage + 1] + ui = u[-1] + graph[bf_entry_row][stage] = self._llr_even(la, lb, ui) + return graph + + # activate right side butterflies + u_even = self._get_even_indices_values(u) + u_odd = self._get_odd_indices_values(u) + graph = self._butterfly(bf_entry_row, stage + 1, graph, (u_even + u_odd) % 2) + lower_right = bf_entry_row + self.N // (2 ** (stage + 1)) + graph = self._butterfly(lower_right, stage + 1, graph, u_even) + + la = graph[bf_entry_row][stage + 1] + lb = graph[lower_right][stage + 1] + graph[bf_entry_row][stage] = self._llr_odd(la, lb) + return graph + + def decode(self, data, is_packed=False): + if not len(data) == self.N: + raise ValueError("len(data)={0} is not equal to n={1}!".format(len(data), self.N)) + if is_packed: + data = np.unpackbits(data) + data = self._lr_sc_decoder_efficient(data) + data = self._extract_info_bits(data) + if is_packed: + data = np.packbits(data) + return data + + +def test_reverse_enc_dec(): + n = 16 + k = 8 + frozenbits = np.zeros(n - k) + frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 8, 9), dtype=int) + bits = np.random.randint(2, size=k) + encoder = PolarEncoder(n, k, frozenbitposition, frozenbits) + decoder = PolarDecoder(n, k, frozenbitposition, frozenbits) + encoded = encoder.encode(bits) + print 'encoded:', encoded + rx = decoder.decode(encoded) + print 'bits:', bits + print 'rx :', rx + print (bits == rx).all() + + +def compare_decoder_impls(): + print '\nthis is decoder test' + n = 8 + k = 4 + frozenbits = np.zeros(n - k) + # frozenbitposition16 = np.array((0, 1, 2, 3, 4, 5, 8, 9), dtype=int) + frozenbitposition = np.array((0, 1, 2, 4), dtype=int) + bits = np.random.randint(2, size=k) + print 'bits:', bits + encoder = PolarEncoder(n, k, frozenbitposition, frozenbits) + decoder = PolarDecoder(n, k, frozenbitposition, frozenbits) + encoded = encoder.encode(bits) + print 'encoded:', encoded + rx_st = decoder._lr_sc_decoder(encoded) + rx_eff = decoder._lr_sc_decoder_efficient(encoded) + print 'standard :', rx_st + print 'efficient:', rx_eff + print (rx_st == rx_eff).all() + + +def main(): + power = 3 + n = 2 ** power + k = 4 + frozenbits = np.zeros(n - k, dtype=int) + frozenbitposition = np.array((0, 1, 2, 4), dtype=int) + frozenbitposition4 = np.array((0, 1), dtype=int) + + + encoder = PolarEncoder(n, k, frozenbitposition, frozenbits) + decoder = PolarDecoder(n, k, frozenbitposition, frozenbits) + + bits = np.ones(k, dtype=int) + print "bits: ", bits + evec = encoder.encode(bits) + print "froz: ", encoder._insert_frozen_bits(bits) + print "evec: ", evec + + evec[1] = 0 + deced = decoder._lr_sc_decoder(evec) + print 'SC decoded:', deced + + test_reverse_enc_dec() + compare_decoder_impls() + + +if __name__ == '__main__': + main() diff --git a/gr-fec/python/fec/polar/encoder.py b/gr-fec/python/fec/polar/encoder.py new file mode 100644 index 0000000000..3b5eea2a94 --- /dev/null +++ b/gr-fec/python/fec/polar/encoder.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python +# +# Copyright 2015 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. +# + +import numpy as np +from common import PolarCommon +import helper_functions as hf + + +class PolarEncoder(PolarCommon): + def __init__(self, n, k, frozen_bit_position, frozenbits=None): + PolarCommon.__init__(self, n, k, frozen_bit_position, frozenbits) + self.G = hf.get_Fn(n) + + def get_gn(self): + return self.G + + def _prepare_input_data(self, vec): + vec = self._insert_frozen_bits(vec) + vec = self._reverse_bits(vec) + return vec + + def _encode_matrix(self, data): + data = np.dot(data, self.G) % 2 + data = data.astype(dtype=int) + return data + + def _encode_efficient(self, vec): + n_stages = int(np.log2(self.N)) + pos = np.arange(self.N, dtype=int) + for i in range(n_stages): + splitted = np.reshape(pos, (2 ** (i + 1), -1)) + upper_branch = splitted[0::2].flatten() + lower_branch = splitted[1::2].flatten() + vec[upper_branch] = (vec[upper_branch] + vec[lower_branch]) % 2 + return vec + + def encode(self, data, is_packed=False): + if not len(data) == self.K: + raise ValueError("len(data)={0} is not equal to k={1}!".format(len(data), self.K)) + if is_packed: + data = np.unpackbits(data) + if np.max(data) > 1 or np.min(data) < 0: + raise ValueError("can only encode bits!") + data = self._prepare_input_data(data) + data = self._encode_efficient(data) + if is_packed: + data = np.packbits(data) + return data + + +def compare_results(encoder, ntests, k): + for n in range(ntests): + bits = np.random.randint(2, size=k) + preped = encoder._prepare_input_data(bits) + menc = encoder._encode_matrix(preped) + fenc = encoder._encode_efficient(preped) + if (menc == fenc).all() == False: + return False + return True + + +def test_pseudo_rate_1_encoder(encoder, ntests, k): + for n in range(ntests): + bits = np.random.randint(2, size=k) + u = encoder._prepare_input_data(bits) + fenc = encoder._encode_efficient(u) + u_hat = encoder._encode_efficient(fenc) + if not (u_hat == u).all(): + print('rate-1 encoder/decoder failed') + print u + print u_hat + return False + return True + + +def test_encoder_impls(): + print('Compare encoder implementations, matrix vs. efficient') + ntests = 1000 + n = 16 + k = 8 + frozenbits = np.zeros(n - k) + # frozenbitposition8 = np.array((0, 1, 2, 4), dtype=int) # keep it! + frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 8, 9), dtype=int) + encoder = PolarEncoder(n, k, frozenbitposition, frozenbits) + print 'result:', compare_results(encoder, ntests, k) + + print('Test rate-1 encoder/decoder chain results') + r1_test = test_pseudo_rate_1_encoder(encoder, ntests, k) + print 'Test rate-1 encoder/decoder:', r1_test + + +def main(): + test_encoder_impls() + + +if __name__ == '__main__': + main() diff --git a/gr-fec/python/fec/polar/helper_functions.py b/gr-fec/python/fec/polar/helper_functions.py new file mode 100644 index 0000000000..ca66bf4a50 --- /dev/null +++ b/gr-fec/python/fec/polar/helper_functions.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python +# +# Copyright 2015 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. +# + +import numpy as np +import time, sys +import copy + + +def power_of_2_int(num): + return int(np.log2(num)) + + +def is_power_of_two(num): + if type(num) != int: + return False # make sure we only compute integers. + return num != 0 and ((num & (num - 1)) == 0) + + +def bit_reverse(value, n): + # is this really missing in NumPy??? + seq = np.int(value) + rev = np.int(0) + rmask = np.int(1) + lmask = np.int(2 ** (n - 1)) + for i in range(n // 2): + shiftval = n - 1 - (i * 2) + rshift = np.left_shift(np.bitwise_and(seq, rmask), shiftval) + lshift = np.right_shift(np.bitwise_and(seq, lmask), shiftval) + rev = np.bitwise_or(rev, rshift) + rev = np.bitwise_or(rev, lshift) + rmask = np.left_shift(rmask, 1) + lmask = np.right_shift(lmask, 1) + if not n % 2 == 0: + rev = np.bitwise_or(rev, np.bitwise_and(seq, rmask)) + return rev + + +def bit_reverse_vector(vec, n): + return np.array([bit_reverse(e, n) for e in vec], dtype=vec.dtype) + + +def get_Bn(n): + # this is a bit reversal matrix. + lw = power_of_2_int(n) # number of used bits + indexes = [bit_reverse(i, lw) for i in range(n)] + Bn = np.zeros((n, n), type(n)) + for i, index in enumerate(indexes): + Bn[i][index] = 1 + return Bn + + +def get_Fn(n): + # this matrix defines the actual channel combining. + if n == 1: + return np.array([1, ]) + nump = power_of_2_int(n) - 1 # number of Kronecker products to calculate + F2 = np.array([[1, 0], [1, 1]], np.int) + Fn = F2 + for i in range(nump): + Fn = np.kron(Fn, F2) + return Fn + + +def get_Gn(n): + # this matrix is called generator matrix + if not is_power_of_two(n): + print "invalid input" + return None + if n == 1: + return np.array([1, ]) + Bn = get_Bn(n) + Fn = get_Fn(n) + Gn = np.dot(Bn, Fn) + return Gn + + +def unpack_byte(byte, nactive): + if np.amin(byte) < 0 or np.amax(byte) > 255: + return None + if not byte.dtype == np.uint8: + byte = byte.astype(np.uint8) + if nactive == 0: + return np.array([], dtype=np.uint8) + return np.unpackbits(byte)[-nactive:] + + +def pack_byte(bits): + if len(bits) == 0: + return 0 + if np.amin(bits) < 0 or np.amax(bits) > 1: # only '1' and '0' in bits array allowed! + return None + bits = np.concatenate((np.zeros(8 - len(bits), dtype=np.uint8), bits)) + res = np.packbits(bits)[0] + return res + + +def show_progress_bar(ndone, ntotal): + nchars = 50 + + fract = (1. * ndone / ntotal) + percentage = 100. * fract + ndone_chars = int(nchars * fract) + nundone_chars = nchars - ndone_chars + sys.stdout.write('\r[{0}{1}] {2:5.2f}% ({3} / {4})'.format('=' * ndone_chars, ' ' * nundone_chars, percentage, ndone, ntotal)) + + + +def mutual_information(w): + ''' + calculate mutual information I(W) + I(W) = sum over y e Y ( sum over x e X ( ... ) ) + .5 W(y|x) log frac { W(y|x) }{ .5 W(y|0) + .5 W(y|1) } + ''' + ydim, xdim = np.shape(w) + i = 0.0 + for y in range(ydim): + for x in range(xdim): + v = w[y][x] * np.log2(w[y][x] / (0.5 * w[y][0] + 0.5 * w[y][1])) + i += v + i /= 2.0 + return i + + +def bhattacharyya_parameter(w): + '''bhattacharyya parameter is a measure of similarity between two prob. distributions''' + # sum over all y e Y for sqrt( W(y|0) * W(y|1) ) + dim = np.shape(w) + ydim = dim[0] + z = 0.0 + for y in range(ydim): + z += np.sqrt(w[0, y] * w[1, y]) + # need all + return z + + +def main(): + print 'helper functions' + + for i in range(9): + print(i, 'is power of 2: ', is_power_of_two(i)) + n = 6 + m = 2 ** n + + + pos = np.arange(m) + rev_pos = bit_reverse_vector(pos, n) + print(pos) + print(rev_pos) + + +if __name__ == '__main__': + main() diff --git a/gr-fec/python/fec/polar/polar_channel_construction b/gr-fec/python/fec/polar/polar_channel_construction new file mode 100644 index 0000000000..0aca9c7ddc --- /dev/null +++ b/gr-fec/python/fec/polar/polar_channel_construction @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# +# Copyright 2015 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# +""" A tool for POLAR code channel construction.""" + +from optparse import OptionParser +import gnuradio.fec.polar as cc + + +def setup_parser(): + """ Init the option parser. If derived classes need to add options, + override this and call the parent function. """ + parser = OptionParser(add_help_option=False) + parser.usage = '%prog [blocksize] [designsnr] [mu]' + + parser.add_option("-h", "--help", action="help", help="Displays this help message.") + + parser.add_option("-c", "--channel", action="store", type="string", dest="channel", + help="specify channel, currently BEC or BSC (default='BEC')", default='BEC') + parser.add_option("-b", "--blocksize", action="store", type="int", dest="block_size", + help="specify block size of polar code (default=16)", default=16) + parser.add_option("-s", "--desgin-snr", action="store", type="float", dest="design_snr", + help="specify design SNR of polar code (default=0.0)", default=0.0) + parser.add_option("-k", "--mu", action="store", type="int", dest="mu", + help="specify block size of polar code (default=2)", default=2) + + return parser + + +def main(): + """ Here we go. Parse command, choose class and run. """ + print('POLAR code channel constructor commandline tool') + parser = setup_parser() + (options, args) = parser.parse_args() + + channel = str(options.channel) + block_size = int(options.block_size) + design_snr = float(options.design_snr) + mu = int(options.mu) + + if len(args) > 0: + channel = str(args[0]) + if len(args) > 1: + block_size = int(args[1]) + if len(args) > 2: + design_snr = float(args[2]) + if len(args) == 4: + mu = int(args[3]) + + z_params = cc.get_z_params(False, channel, block_size, design_snr, mu) + print(z_params) + + +if __name__ == '__main__': + try: + main() + except KeyboardInterrupt: + pass diff --git a/gr-fec/python/fec/polar/testbed.py b/gr-fec/python/fec/polar/testbed.py new file mode 100755 index 0000000000..d60c83e776 --- /dev/null +++ b/gr-fec/python/fec/polar/testbed.py @@ -0,0 +1,360 @@ +#!/usr/bin/env python +# +# Copyright 2015 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. +# + + +from encoder import PolarEncoder +from decoder import PolarDecoder +import channel_construction as cc +from helper_functions import * + +import matplotlib.pyplot as plt + + +def get_frozen_bit_position(): + # frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 16, 17, 18, 20, 24), dtype=int) + # frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 8, 9), dtype=int) + m = 256 + n_frozen = m // 2 + frozenbitposition = cc.get_frozen_bit_indices_from_z_parameters(cc.bhattacharyya_bounds(0.0, m), n_frozen) + print(frozenbitposition) + return frozenbitposition + + +def test_enc_dec_chain(): + ntests = 100 + n = 256 + k = n // 2 + frozenbits = np.zeros(n - k) + frozenbitposition = get_frozen_bit_position() + for i in range(ntests): + bits = np.random.randint(2, size=k) + encoder = PolarEncoder(n, k, frozenbitposition, frozenbits) + decoder = PolarDecoder(n, k, frozenbitposition, frozenbits) + encoded = encoder.encode(bits) + rx = decoder.decode(encoded) + if not is_equal(bits, rx): + raise ValueError('Test #', i, 'failed, input and output differ', bits, '!=', rx) + return + + +def is_equal(first, second): + if not (first == second).all(): + result = first == second + for i in range(len(result)): + print '{0:4}: {1:2} == {2:1} = {3}'.format(i, first[i], second[i], result[i]) + return False + return True + + +def exact_value(la, lb): + return np.log((np.exp(la + lb) + 1) / (np.exp(la) + np.exp(lb))) + + +def approx_value(la, lb): + return np.sign(la) * np.sign(lb) * np.minimum(np.abs(la), np.abs(lb)) + + +def path_metric_exact(last_pm, llr, ui): + return last_pm + np.log(1 + np.exp(-1. * llr * (1 - 2 * ui))) + + +def path_metric_approx(last_pm, llr, ui): + if ui == int(.5 * (1 - np.sign(llr))): + return last_pm + return last_pm + np.abs(llr) + + +def calculate_path_metric_vector(metric, llrs, us): + res = np.zeros(llrs.size) + res[0] = metric(0, llrs[0], us[0]) + for i in range(1, llrs.size): + res[i] = metric(res[i - 1], llrs[i], us[i]) + return res + + +def test_1024_rate_1_code(): + # effectively a Monte-Carlo simulation for channel polarization. + ntests = 10000 + n = 256 + k = n + transition_prob = 0.11 + num_transitions = int(k * transition_prob) + frozenbits = np.zeros(n - k) + frozenbitposition = np.array((), dtype=int) + encoder = PolarEncoder(n, k, frozenbitposition, frozenbits) + decoder = PolarDecoder(n, k, frozenbitposition, frozenbits) + + channel_counter = np.zeros(k) + possible_indices = np.arange(n, dtype=int) + for i in range(ntests): + bits = np.random.randint(2, size=k) + tx = encoder.encode(bits) + np.random.shuffle(possible_indices) + tx[possible_indices[0:num_transitions]] = (tx[possible_indices[0:num_transitions]] + 1) % 2 + rx = tx + recv = decoder.decode(rx) + channel_counter += (bits == recv) + + print channel_counter + print(np.min(channel_counter), np.max(channel_counter)) + + np.save('channel_counter_' + str(ntests) + '.npy', channel_counter) + + +def find_good_indices(res, nindices): + channel_counter = np.copy(res) + good_indices = np.zeros(channel_counter.size) + + for i in range(nindices): + idx = np.argmax(channel_counter) + good_indices[idx] = 1 + channel_counter[idx] = 0 + return good_indices + + +def channel_analysis(): + ntests = 10000 + filename = 'channel_counter_' + str(ntests) + '.npy' + channel_counter = np.load(filename) + print(np.min(channel_counter), np.max(channel_counter)) + channel_counter[0] = np.min(channel_counter) + good_indices = find_good_indices(channel_counter, channel_counter.size // 2) + info_bit_positions = np.where(good_indices > 0) + print(info_bit_positions) + frozen_bit_positions = np.delete(np.arange(channel_counter.size), info_bit_positions) + print(frozen_bit_positions) + np.save('frozen_bit_positions_n256_k128_p0.11.npy', frozen_bit_positions) + good_indices *= 2000 + good_indices += 4000 + + plt.plot(channel_counter) + plt.plot(good_indices) + plt.show() + + +def merge_first_stage(init_mask): + merged_frozen_mask = [] + for e in range(0, len(init_mask), 2): + v = [init_mask[e]['value'][0], init_mask[e + 1]['value'][0]] + s = init_mask[e]['size'] * 2 + if init_mask[e]['type'] == init_mask[e + 1]['type']: + t = init_mask[e]['type'] + merged_frozen_mask.append({'value': v, 'type': t, 'size': s}) + else: + t = 'RPT' + merged_frozen_mask.append({'value': v, 'type': t, 'size': s}) + return merged_frozen_mask + + +def merge_second_stage(init_mask): + merged_frozen_mask = [] + for e in range(0, len(init_mask), 2): + if init_mask[e]['type'] == init_mask[e + 1]['type']: + t = init_mask[e]['type'] + v = init_mask[e]['value'] + v.extend(init_mask[e + 1]['value']) + s = init_mask[e]['size'] * 2 + merged_frozen_mask.append({'value': v, 'type': t, 'size': s}) + elif init_mask[e]['type'] == 'ZERO' and init_mask[e + 1]['type'] == 'RPT': + t = init_mask[e + 1]['type'] + v = init_mask[e]['value'] + v.extend(init_mask[e + 1]['value']) + s = init_mask[e]['size'] * 2 + merged_frozen_mask.append({'value': v, 'type': t, 'size': s}) + elif init_mask[e]['type'] == 'RPT' and init_mask[e + 1]['type'] == 'ONE': + t = 'SPC' + v = init_mask[e]['value'] + v.extend(init_mask[e + 1]['value']) + s = init_mask[e]['size'] * 2 + merged_frozen_mask.append({'value': v, 'type': t, 'size': s}) + else: + merged_frozen_mask.append(init_mask[e]) + merged_frozen_mask.append(init_mask[e + 1]) + return merged_frozen_mask + + +def merge_stage_n(init_mask): + merged_frozen_mask = [] + n_elems = len(init_mask) - (len(init_mask) % 2) + for e in range(0, n_elems, 2): + if init_mask[e]['size'] == init_mask[e + 1]['size']: + if (init_mask[e]['type'] == 'ZERO' or init_mask[e]['type'] == 'ONE') and init_mask[e]['type'] == init_mask[e + 1]['type']: + t = init_mask[e]['type'] + v = init_mask[e]['value'] + v.extend(init_mask[e + 1]['value']) + s = init_mask[e]['size'] * 2 + merged_frozen_mask.append({'value': v, 'type': t, 'size': s}) + elif init_mask[e]['type'] == 'ZERO' and init_mask[e + 1]['type'] == 'RPT': + t = init_mask[e + 1]['type'] + v = init_mask[e]['value'] + v.extend(init_mask[e + 1]['value']) + s = init_mask[e]['size'] * 2 + merged_frozen_mask.append({'value': v, 'type': t, 'size': s}) + elif init_mask[e]['type'] == 'SPC' and init_mask[e + 1]['type'] == 'ONE': + t = init_mask[e]['type'] + v = init_mask[e]['value'] + v.extend(init_mask[e + 1]['value']) + s = init_mask[e]['size'] * 2 + merged_frozen_mask.append({'value': v, 'type': t, 'size': s}) + else: + merged_frozen_mask.append(init_mask[e]) + merged_frozen_mask.append(init_mask[e + 1]) + else: + merged_frozen_mask.append(init_mask[e]) + merged_frozen_mask.append(init_mask[e + 1]) + if n_elems < len(init_mask): + merged_frozen_mask.append(init_mask[-1]) + return merged_frozen_mask + + +def print_decode_subframes(subframes): + for e in subframes: + print(e) + + +def find_decoder_subframes(frozen_mask): + stages = power_of_2_int(len(frozen_mask)) + block_size = 2 ** stages + + lock_mask = np.zeros(block_size, dtype=int) + sub_mask = [] + + for e in frozen_mask: + if e == 1: + sub_mask.append(0) + else: + sub_mask.append(1) + sub_mask = np.array(sub_mask, dtype=int) + + for s in range(0, stages): + stage_size = 2 ** s + mask = np.reshape(sub_mask, (-1, stage_size)) + lock = np.reshape(lock_mask, (-1, stage_size)) + for p in range(0, (block_size // stage_size) - 1, 2): + l0 = lock[p] + l1 = lock[p + 1] + first = mask[p] + second = mask[p + 1] + print(l0, l1) + print(first, second) + if np.all(l0 == l1): + for eq in range(2): + if np.all(first == eq) and np.all(second == eq): + mask[p].fill(eq) + mask[p + 1].fill(eq) + lock[p].fill(s) + lock[p + 1].fill(s) + + if np.all(first == 0) and np.all(second == 2): + mask[p].fill(2) + mask[p + 1].fill(2) + lock[p].fill(s) + lock[p + 1].fill(s) + + if np.all(first == 3) and np.all(second == 1): + mask[p].fill(3) + mask[p + 1].fill(3) + lock[p].fill(s) + lock[p + 1].fill(s) + + if s == 0 and np.all(first == 0) and np.all(second == 1): + mask[p].fill(2) + mask[p + 1].fill(2) + lock[p].fill(s) + lock[p + 1].fill(s) + + if s == 1 and np.all(first == 2) and np.all(second == 1): + mask[p].fill(3) + mask[p + 1].fill(3) + lock[p].fill(s) + lock[p + 1].fill(s) + + sub_mask = mask.flatten() + lock_mask = lock.flatten() + + words = {0: 'ZERO', 1: 'ONE', 2: 'RPT', 3: 'SPC'} + ll = lock_mask[0] + sub_t = sub_mask[0] + for i in range(len(frozen_mask)): + v = frozen_mask[i] + t = words[sub_mask[i]] + l = lock_mask[i] + # if i % 8 == 0: + # print + if not l == ll or not sub_mask[i] == sub_t: + print('--------------------------') + ll = l + sub_t = sub_mask[i] + print('{0:4} lock {1:4} value: {2} in sub {3}'.format(i, 2 ** (l + 1), v, t)) + + +def load_file(filename): + z_params = [] + with open(filename, 'r') as f: + for line in f: + if 'Bhattacharyya:' in line: + l = line.split(' ') + l = l[10:-2] + l = l[0][:-1] + l = float(l) + z_params.append(l) + return np.array(z_params) + + +def main(): + n = 8 + m = 2 ** n + k = m // 2 + n_frozen = n - k + # n = 16 + # k = 8 + # frozenbits = np.zeros(n - k) + # frozenbitposition8 = np.array((0, 1, 2, 4), dtype=int) + # frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 8, 9), dtype=int) + # print frozenbitposition + + # test_enc_dec_chain() + # test_1024_rate_1_code() + # channel_analysis() + + frozen_indices = cc.get_bec_frozen_indices(m, n_frozen, 0.11) + frozen_mask = cc.get_frozen_bit_mask(frozen_indices, m) + find_decoder_subframes(frozen_mask) + + frozen_mask = np.zeros(m, dtype=int) + frozen_mask[frozen_indices] = 1 + + # filename = 'channel_z-parameters.txt' + # ido = load_file(filename) + # ido_frozen = cc.get_frozen_bit_indices_from_z_parameters(ido, k) + # ido_mask = np.zeros(m, dtype=int) + # ido_mask[ido_frozen] = 1 + # + # + # plt.plot(ido_mask) + # plt.plot(frozen_mask) + # for i in range(m): + # if not ido_mask[i] == frozen_mask[i]: + # plt.axvline(i, color='r') + # plt.show() + + +if __name__ == '__main__': + main()
\ No newline at end of file diff --git a/gr-fec/python/fec/qa_polar_decoder_sc.py b/gr-fec/python/fec/qa_polar_decoder_sc.py new file mode 100644 index 0000000000..1ef458082a --- /dev/null +++ b/gr-fec/python/fec/qa_polar_decoder_sc.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# +# Copyright 2015 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along 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, blocks +import fec_swig as fec + +import numpy as np +from extended_decoder import extended_decoder +from polar.encoder import PolarEncoder +import polar.channel_construction as cc + +# import os +# print('PID:', os.getpid()) +# raw_input('tell me smth') + + +class test_polar_decoder_sc(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_001_setup(self): + block_size = 16 + num_info_bits = 8 + frozen_bit_positions = np.arange(block_size - num_info_bits) + frozen_bit_values = np.array([],) + + polar_decoder = fec.polar_decoder_sc.make(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + + self.assertEqual(num_info_bits, polar_decoder.get_output_size()) + self.assertEqual(block_size, polar_decoder.get_input_size()) + self.assertFloatTuplesAlmostEqual((float(num_info_bits) / block_size, ), (polar_decoder.rate(), )) + self.assertFalse(polar_decoder.set_frame_size(10)) + + def test_002_one_vector(self): + block_power = 10 + block_size = 2 ** block_power + num_info_bits = 2 ** (block_power - 1) + num_frozen_bits = block_size - num_info_bits + frozen_bit_positions = cc.frozen_bit_positions(block_size, num_info_bits, 0.0) + frozen_bit_values = np.array([0] * num_frozen_bits,) + + bits, gr_data = self.generate_test_data(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values, 1, True) + + polar_decoder = fec.polar_decoder_sc.make(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + src = blocks.vector_source_f(gr_data, False) + dec_block = extended_decoder(polar_decoder, None) + snk = blocks.vector_sink_b(1) + + self.tb.connect(src, dec_block) + self.tb.connect(dec_block, snk) + self.tb.run() + + res = np.array(snk.data()).astype(dtype=int) + self.assertTupleEqual(tuple(res), tuple(bits)) + + def test_003_stream(self): + nframes = 3 + block_power = 8 + block_size = 2 ** block_power + num_info_bits = 2 ** (block_power - 1) + num_frozen_bits = block_size - num_info_bits + frozen_bit_positions = cc.frozen_bit_positions(block_size, num_info_bits, 0.0) + frozen_bit_values = np.array([0] * num_frozen_bits,) + + bits, gr_data = self.generate_test_data(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values, nframes, False) + + polar_decoder = fec.polar_decoder_sc.make(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + src = blocks.vector_source_f(gr_data, False) + dec_block = extended_decoder(polar_decoder, None) + snk = blocks.vector_sink_b(1) + + self.tb.connect(src, dec_block) + self.tb.connect(dec_block, snk) + self.tb.run() + + res = np.array(snk.data()).astype(dtype=int) + self.assertTupleEqual(tuple(res), tuple(bits)) + + def generate_test_data(self, block_size, num_info_bits, frozen_bit_positions, frozen_bit_values, nframes, onlyones): + encoder = PolarEncoder(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + bits = np.array([], dtype=int) + data = np.array([], dtype=int) + for n in range(nframes): + if onlyones: + b = np.ones(num_info_bits, dtype=int) + else: + b = np.random.randint(2, size=num_info_bits) + d = encoder.encode(b) + bits = np.append(bits, b) + data = np.append(data, d) + gr_data = 2.0 * data - 1.0 + return bits, gr_data + + +if __name__ == '__main__': + gr_unittest.run(test_polar_decoder_sc) + + diff --git a/gr-fec/python/fec/qa_polar_decoder_sc_list.py b/gr-fec/python/fec/qa_polar_decoder_sc_list.py new file mode 100644 index 0000000000..adbb736f01 --- /dev/null +++ b/gr-fec/python/fec/qa_polar_decoder_sc_list.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python +# +# Copyright 2015 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along 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, blocks +import fec_swig as fec +import numpy as np + +from extended_decoder import extended_decoder +from polar.encoder import PolarEncoder +import polar.channel_construction as cc + +# import os +# print('PID:', os.getpid()) +# raw_input('tell me smth') + + +class test_polar_decoder_sc_list(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_001_setup(self): + block_size = 16 + num_info_bits = 8 + max_list_size = 4 + frozen_bit_positions = np.arange(block_size - num_info_bits) + frozen_bit_values = np.array([],) + + polar_decoder = fec.polar_decoder_sc_list.make(max_list_size, block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + + self.assertEqual(num_info_bits, polar_decoder.get_output_size()) + self.assertEqual(block_size, polar_decoder.get_input_size()) + self.assertFloatTuplesAlmostEqual((float(num_info_bits) / block_size, ), (polar_decoder.rate(), )) + self.assertFalse(polar_decoder.set_frame_size(10)) + + def test_002_one_vector(self): + print "test_002_one_vector" + expo = 6 + block_size = 2 ** expo + num_info_bits = 2 ** (expo - 1) + max_list_size = 2 ** (expo - 2) + num_frozen_bits = block_size - num_info_bits + frozen_bit_positions = cc.frozen_bit_positions(block_size, num_info_bits, 0.0) + frozen_bit_values = np.array([0] * num_frozen_bits,) + + bits = np.random.randint(2, size=num_info_bits) + encoder = PolarEncoder(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + data = encoder.encode(bits) + gr_data = 2.0 * data - 1.0 + + polar_decoder = fec.polar_decoder_sc_list.make(max_list_size, block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + src = blocks.vector_source_f(gr_data, False) + dec_block = extended_decoder(polar_decoder, None) + snk = blocks.vector_sink_b(1) + + self.tb.connect(src, dec_block) + self.tb.connect(dec_block, snk) + self.tb.run() + + res = np.array(snk.data()).astype(dtype=int) + + print("\ninput -> result -> bits") + print(data) + print(res) + print(bits) + + self.assertTupleEqual(tuple(res), tuple(bits)) + + def test_003_stream(self): + print "test_003_stream" + nframes = 5 + expo = 8 + block_size = 2 ** expo + num_info_bits = 2 ** (expo - 1) + max_list_size = 2 ** (expo - 2) + num_frozen_bits = block_size - num_info_bits + frozen_bit_positions = cc.frozen_bit_positions(block_size, num_info_bits, 0.0) + frozen_bit_values = np.array([0] * num_frozen_bits,) + + encoder = PolarEncoder(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + + ref = np.array([], dtype=int) + data = np.array([], dtype=int) + for i in range(nframes): + b = np.random.randint(2, size=num_info_bits) + d = encoder.encode(b) + data = np.append(data, d) + ref = np.append(ref, b) + gr_data = 2.0 * data - 1.0 + + polar_decoder = fec.polar_decoder_sc_list.make(max_list_size, block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + src = blocks.vector_source_f(gr_data, False) + dec_block = extended_decoder(polar_decoder, None) + snk = blocks.vector_sink_b(1) + + self.tb.connect(src, dec_block) + self.tb.connect(dec_block, snk) + self.tb.run() + + res = np.array(snk.data()).astype(dtype=int) + self.assertTupleEqual(tuple(res), tuple(ref)) + + +if __name__ == '__main__': + gr_unittest.run(test_polar_decoder_sc_list) + + + diff --git a/gr-fec/python/fec/qa_polar_encoder.py b/gr-fec/python/fec/qa_polar_encoder.py new file mode 100644 index 0000000000..22d9b11fae --- /dev/null +++ b/gr-fec/python/fec/qa_polar_encoder.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python +# +# Copyright 2015 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along 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, blocks +import fec_swig as fec +import numpy as np + +from extended_encoder import extended_encoder +from polar.encoder import PolarEncoder +import polar.channel_construction as cc + +# import os +# print('PID:', os.getpid()) +# raw_input('tell me smth') + + +class test_polar_encoder(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_001_setup(self): + block_size = 16 + num_info_bits = 8 + frozen_bit_positions = cc.frozen_bit_positions(block_size, num_info_bits, 0.0) + frozen_bit_values = np.array([],) + + polar_encoder = fec.polar_encoder.make(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + + self.assertEqual(block_size, polar_encoder.get_output_size()) + self.assertEqual(num_info_bits, polar_encoder.get_input_size()) + self.assertFloatTuplesAlmostEqual((float(num_info_bits) / block_size, ), (polar_encoder.rate(), )) + self.assertFalse(polar_encoder.set_frame_size(10)) + + def test_002_work_function_packed(self): + is_packed = True + block_size = 256 + num_info_bits = block_size // 2 + + data, ref, polar_encoder = self.get_test_data(block_size, num_info_bits, 1, is_packed) + src = blocks.vector_source_b(data, False) + enc_block = extended_encoder(polar_encoder, None, '11') + snk = blocks.vector_sink_b(1) + + self.tb.connect(src, enc_block, snk) + self.tb.run() + + res = np.array(snk.data()).astype(dtype=int) + self.assertTupleEqual(tuple(res), tuple(ref)) + + def test_003_work_function_unpacked(self): + is_packed = False + block_size = 256 + num_info_bits = block_size // 2 + + data, ref, polar_encoder = self.get_test_data(block_size, num_info_bits, 1, is_packed) + src = blocks.vector_source_b(data, False) + enc_block = extended_encoder(polar_encoder, None, '11') + snk = blocks.vector_sink_b(1) + + self.tb.connect(src, enc_block, snk) + self.tb.run() + + res = np.array(snk.data()).astype(dtype=int) + self.assertTupleEqual(tuple(res), tuple(ref)) + + def test_004_big_input(self): + is_packed = False + num_blocks = 30 + block_size = 1024 + num_info_bits = block_size // 8 + + data, ref, polar_encoder = self.get_test_data(block_size, num_info_bits, num_blocks, is_packed) + src = blocks.vector_source_b(data, False) + enc_block = extended_encoder(polar_encoder, None, '11') + snk = blocks.vector_sink_b(1) + + self.tb.connect(src, enc_block, snk) + self.tb.run() + + res = np.array(snk.data()).astype(dtype=int) + self.assertTupleEqual(tuple(res), tuple(ref)) + + def get_test_data(self, block_size, num_info_bits, num_blocks, is_packed): + # helper function to set up test data and together with encoder object. + num_frozen_bits = block_size - num_info_bits + frozen_bit_positions = cc.frozen_bit_positions(block_size, num_info_bits, 0.0) + frozen_bit_values = np.array([0] * num_frozen_bits,) + python_encoder = PolarEncoder(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values) + + data = np.array([], dtype=int) + ref = np.array([], dtype=int) + for i in range(num_blocks): + d = np.random.randint(2, size=num_info_bits) + data = np.append(data, d) + ref = np.append(ref, python_encoder.encode(d)) + polar_encoder = fec.polar_encoder.make(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values, is_packed) + return data, ref, polar_encoder + + +if __name__ == '__main__': + gr_unittest.run(test_polar_encoder) + diff --git a/gr-fec/swig/fec_swig.i b/gr-fec/swig/fec_swig.i index abc78e3ced..a33e8d1efe 100644 --- a/gr-fec/swig/fec_swig.i +++ b/gr-fec/swig/fec_swig.i @@ -62,6 +62,11 @@ #include "gnuradio/fec/ldpc_decoder.h" #include "gnuradio/fec/tpc_encoder.h" #include "gnuradio/fec/tpc_decoder.h" +#include "gnuradio/fec/polar_encoder.h" +#include "gnuradio/fec/polar_decoder_sc.h" +#include "gnuradio/fec/polar_common.h" +#include "gnuradio/fec/polar_decoder_sc_list.h" +#include "gnuradio/fec/polar_decoder_common.h" %} %include "gnuradio/fec/generic_decoder.h" @@ -104,3 +109,8 @@ GR_SWIG_BLOCK_MAGIC2(fec, conv_bit_corr_bb); GR_SWIG_BLOCK_MAGIC2(fec, puncture_bb); GR_SWIG_BLOCK_MAGIC2(fec, puncture_ff); GR_SWIG_BLOCK_MAGIC2(fec, depuncture_bb); +%include "gnuradio/fec/polar_encoder.h" +%include "gnuradio/fec/polar_decoder_sc.h" +%include "gnuradio/fec/polar_common.h" +%include "gnuradio/fec/polar_decoder_sc_list.h" +%include "gnuradio/fec/polar_decoder_common.h" |