[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 16/57: fec: Merging fecapi with support for
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 16/57: fec: Merging fecapi with support for CC code. |
Date: |
Wed, 21 May 2014 03:10:25 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit 6f84515d6290230abeea6c13e1c605746a8a272c
Author: Tom Rondeau <address@hidden>
Date: Tue Mar 25 10:24:35 2014 -0700
fec: Merging fecapi with support for CC code.
Original code taken from next branch of Nick McCarthy's fecapi:
https://github.com/namccart/fecapi.git
Needs: examples, documentation, other tools.
---
gr-fec/CMakeLists.txt | 1 +
gr-fec/examples/ber_generator.grc | 1060 ++++++++++++++++++++
gr-fec/examples/cc_ber.grc | 840 ++++++++++++++++
gr-fec/examples/cc_bercurve.grc | 1009 +++++++++++++++++++
gr-fec/grc/fec_ber_bf.xml | 37 +
gr-fec/grc/fec_bercurve_generator.xml | 69 ++
gr-fec/grc/fec_block_tree.xml | 30 +-
gr-fec/grc/fec_decode_ccsds_27_fb.xml | 24 +-
gr-fec/grc/fec_decoder.xml | 91 ++
gr-fec/grc/fec_depuncture_bb.xml | 42 +
gr-fec/grc/fec_encoder.xml | 91 ++
gr-fec/grc/fec_extended_decoder.xml | 72 ++
gr-fec/grc/fec_extended_encoder.xml | 57 ++
gr-fec/grc/fec_puncture_ff.xml | 42 +
gr-fec/grc/variable_cc_decoder_def_list.xml | 144 +++
gr-fec/grc/variable_cc_encoder_def_list.xml | 144 +++
gr-fec/include/gnuradio/fec/CMakeLists.txt | 14 +-
.../fec_swig.i => include/gnuradio/fec/ber_bf.h} | 39 +-
.../gnuradio/fec/cc_common.h} | 34 +-
gr-fec/include/gnuradio/fec/cc_decoder.h | 59 ++
gr-fec/include/gnuradio/fec/cc_encoder.h | 55 +
gr-fec/include/gnuradio/fec/conv_bit_corr_bb.h | 62 ++
gr-fec/include/gnuradio/fec/decoder.h | 59 ++
.../gnuradio/fec/depuncture_bb.h} | 40 +-
gr-fec/include/gnuradio/fec/encoder.h | 56 ++
gr-fec/include/gnuradio/fec/generic_decoder.h | 73 ++
gr-fec/include/gnuradio/fec/generic_encoder.h | 53 +
.../gnuradio/fec/puncture_ff.h} | 31 +-
gr-fec/lib/CMakeLists.txt | 25 +-
gr-fec/lib/ber_bf_impl.cc | 115 +++
gr-fec/lib/ber_bf_impl.h | 55 +
gr-fec/lib/ber_tools.cc | 106 ++
gr-fec/lib/ber_tools.h | 73 ++
gr-fec/lib/cc_decoder_impl.cc | 505 ++++++++++
gr-fec/lib/cc_decoder_impl.h | 104 ++
gr-fec/lib/cc_encoder_impl.cc | 202 ++++
gr-fec/lib/cc_encoder_impl.h | 73 ++
gr-fec/lib/conv_bit_corr_bb_impl.cc | 258 +++++
gr-fec/lib/conv_bit_corr_bb_impl.h | 97 ++
gr-fec/lib/decoder_impl.cc | 121 +++
gr-fec/lib/decoder_impl.h | 57 ++
gr-fec/lib/depuncture_bb_impl.cc | 132 +++
gr-fec/lib/depuncture_bb_impl.h | 57 ++
gr-fec/lib/encoder_impl.cc | 106 ++
gr-fec/lib/encoder_impl.h | 57 ++
gr-fec/lib/generic_decoder.cc | 138 +++
gr-fec/{swig/fec_swig.i => lib/generic_encoder.cc} | 37 +-
gr-fec/lib/puncture_ff_impl.cc | 137 +++
gr-fec/lib/puncture_ff_impl.h | 59 ++
gr-fec/python/fec/CMakeLists.txt | 10 +
gr-fec/python/fec/__init__.py | 15 +-
gr-fec/python/fec/bercurve_generator.py | 100 ++
gr-fec/python/fec/bitflip.py | 80 ++
gr-fec/python/fec/capillary_threaded_decoder.py | 95 ++
gr-fec/python/fec/capillary_threaded_encoder.py | 95 ++
gr-fec/python/fec/extended_decoder.py | 159 +++
gr-fec/python/fec/extended_encoder.py | 54 +
gr-fec/python/fec/fec_raw_test.py | 91 ++
gr-fec/python/fec/fec_test.py | 107 ++
gr-fec/python/fec/threaded_decoder.py | 60 ++
gr-fec/python/fec/threaded_encoder.py | 59 ++
gr-fec/swig/fec_swig.i | 34 +-
62 files changed, 7709 insertions(+), 92 deletions(-)
diff --git a/gr-fec/CMakeLists.txt b/gr-fec/CMakeLists.txt
index b400237..d1e1e7b 100644
--- a/gr-fec/CMakeLists.txt
+++ b/gr-fec/CMakeLists.txt
@@ -28,6 +28,7 @@ include(GrBoost)
include(GrComponent)
GR_REGISTER_COMPONENT("gr-fec" ENABLE_GR_FEC
+ ENABLE_VOLK
Boost_FOUND
ENABLE_GNURADIO_RUNTIME
ENABLE_GR_BLOCKS
diff --git a/gr-fec/examples/ber_generator.grc
b/gr-fec/examples/ber_generator.grc
new file mode 100644
index 0000000..2e233a3
--- /dev/null
+++ b/gr-fec/examples/ber_generator.grc
@@ -0,0 +1,1060 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Tue Mar 25 12:37:24 2014</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>ber_generator</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>BER Generator</value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>2000, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>hb</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Error Coding</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>noise</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>numpy.sqrt((10.0**(-esno/10.0))/2.0)</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(673, 509)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_unpacked_to_packed_xx</key>
+ <param>
+ <key>id</key>
+ <value>blocks_unpacked_to_packed_xx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>bits_per_chunk</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>endianness</key>
+ <value>gr.GR_LSB_FIRST</value>
+ </param>
+ <param>
+ <key>num_ports</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(575, 331)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_unpacked_to_packed_xx</key>
+ <param>
+ <key>id</key>
+ <value>blocks_unpacked_to_packed_xx_0_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>bits_per_chunk</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>endianness</key>
+ <value>gr.GR_LSB_FIRST</value>
+ </param>
+ <param>
+ <key>num_ports</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(575, 258)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>pad_sink</key>
+ <param>
+ <key>id</key>
+ <value>pad_sink_0_1</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>out</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>num_streams</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>optional</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(1087, 322)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>fec_extended_encoder</key>
+ <param>
+ <key>id</key>
+ <value>fec_extended_encoder_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>encoder_list</key>
+ <value>generic_encoder</value>
+ </param>
+ <param>
+ <key>threadtype</key>
+ <value>capillary</value>
+ </param>
+ <param>
+ <key>puncpat</key>
+ <value>puncpat</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(588, 16)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>parameter</key>
+ <param>
+ <key>id</key>
+ <value>generic_encoder</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value></value>
+ </param>
+ <param>
+ <key>short_id</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(365, 542)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>parameter</key>
+ <param>
+ <key>id</key>
+ <value>generic_decoder</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value></value>
+ </param>
+ <param>
+ <key>short_id</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(364, 612)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>parameter</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>intx</value>
+ </param>
+ <param>
+ <key>short_id</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(122, 503)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>parameter</key>
+ <param>
+ <key>id</key>
+ <value>esno</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>EsNo</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>eng_float</value>
+ </param>
+ <param>
+ <key>short_id</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(22, 484)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>parameter</key>
+ <param>
+ <key>id</key>
+ <value>puncpat</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>'11'</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>string</value>
+ </param>
+ <param>
+ <key>short_id</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(232, 503)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>parameter</key>
+ <param>
+ <key>id</key>
+ <value>berlimit</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>-5.0</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>eng_float</value>
+ </param>
+ <param>
+ <key>short_id</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(146, 593)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>parameter</key>
+ <param>
+ <key>id</key>
+ <value>threading</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>capillary</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>string</value>
+ </param>
+ <param>
+ <key>short_id</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(246, 593)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>parameter</key>
+ <param>
+ <key>id</key>
+ <value>berminerrors</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>100</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>intx</value>
+ </param>
+ <param>
+ <key>short_id</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(21, 593)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>fec_puncture_ff</key>
+ <param>
+ <key>id</key>
+ <value>fec_puncture_ff_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>delay</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>puncpat</key>
+ <value>fec.read_bitlist(puncpat)</value>
+ </param>
+ <param>
+ <key>puncholes</key>
+ <value>puncpat.count('0')</value>
+ </param>
+ <param>
+ <key>puncsize</key>
+ <value>len(puncpat)</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(882, 7)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>fec_extended_decoder</key>
+ <param>
+ <key>id</key>
+ <value>fec_extended_decoder_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>fec_extended_decoder</value>
+ </param>
+ <param>
+ <key>decoder_list</key>
+ <value>generic_decoder</value>
+ </param>
+ <param>
+ <key>threadtype</key>
+ <value>none</value>
+ </param>
+ <param>
+ <key>ann</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>puncpat</key>
+ <value>puncpat</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(589, 115)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_add_xx</key>
+ <param>
+ <key>id</key>
+ <value>blocks_add_xx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>num_inputs</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(938, 130)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_head</key>
+ <param>
+ <key>id</key>
+ <value>blocks_head_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>num_items</key>
+ <value>14000</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(242, 151)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_throttle</key>
+ <param>
+ <key>id</key>
+ <value>blocks_throttle_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>ignoretag</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(132, 331)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>import</key>
+ <param>
+ <key>id</key>
+ <value>import_numpy</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>import</key>
+ <value>import numpy</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(228, 16)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>analog_fastnoise_source_x</key>
+ <param>
+ <key>id</key>
+ <value>analog_fastnoise_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>noise_type</key>
+ <value>analog.GR_GAUSSIAN</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>noise</value>
+ </param>
+ <param>
+ <key>seed</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>samples</key>
+ <value>8192</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(1100, 133)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>analog_random_source_x</key>
+ <param>
+ <key>id</key>
+ <value>analog_random_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>256</value>
+ </param>
+ <param>
+ <key>num_samps</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>repeat</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(22, 124)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>fec_ber_bf</key>
+ <param>
+ <key>id</key>
+ <value>fec_ber_bf_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>berminerrors</key>
+ <value>berminerrors</value>
+ </param>
+ <param>
+ <key>berlimit</key>
+ <value>-7.0</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(851, 310)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>pad_sink</key>
+ <param>
+ <key>id</key>
+ <value>pad_sink_1</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>enc</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>num_streams</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>optional</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(923, 219)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>fec_extended_decoder_0</source_block_id>
+ <sink_block_id>blocks_unpacked_to_packed_xx_0_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_unpacked_to_packed_xx_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_unpacked_to_packed_xx_0_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>fec_ber_bf_0</source_block_id>
+ <sink_block_id>pad_sink_0_1</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>fec_puncture_ff_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>fec_extended_encoder_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_unpacked_to_packed_xx_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>blocks_head_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_head_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>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>fec_puncture_ff_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</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_add_xx_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_add_xx_0</source_block_id>
+ <sink_block_id>pad_sink_1</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-fec/examples/cc_ber.grc b/gr-fec/examples/cc_ber.grc
new file mode 100644
index 0000000..785b1cc
--- /dev/null
+++ b/gr-fec/examples/cc_ber.grc
@@ -0,0 +1,840 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Tue Mar 25 13:12:29 2014</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>cc_ber</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>k</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>7</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(205, 11)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>35000000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(12, 85)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>framebits</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>4096</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(136, 85)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>polys</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>[79, 109]</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(248, 86)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(288, 12)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>esno</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(13, 158)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>ber_generator</key>
+ <param>
+ <key>id</key>
+ <value>ber_generator_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>generic_encoder</key>
+ <value>enc</value>
+ </param>
+ <param>
+ <key>generic_decoder</key>
+ <value>dec</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate_0</value>
+ </param>
+ <param>
+ <key>esno</key>
+ <value>esno</value>
+ </param>
+ <param>
+ <key>puncpat</key>
+ <value>'11'</value>
+ </param>
+ <param>
+ <key>berlimit</key>
+ <value>-5.0</value>
+ </param>
+ <param>
+ <key>threading</key>
+ <value>"None"</value>
+ </param>
+ <param>
+ <key>berminerrors</key>
+ <value>10000</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(438, 57)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_cc_encoder_def</key>
+ <param>
+ <key>id</key>
+ <value>enc</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>"ok"</value>
+ </param>
+ <param>
+ <key>ndim</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>dim1</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>dim2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>framebits</key>
+ <value>framebits</value>
+ </param>
+ <param>
+ <key>k</key>
+ <value>k</value>
+ </param>
+ <param>
+ <key>rate</key>
+ <value>rate</value>
+ </param>
+ <param>
+ <key>polys</key>
+ <value>polys</value>
+ </param>
+ <param>
+ <key>state_start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>state_end</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>strb</key>
+ <value>"streaming"</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(438, 274)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_cc_decoder_def</key>
+ <param>
+ <key>id</key>
+ <value>dec</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>"ok"</value>
+ </param>
+ <param>
+ <key>ndim</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>dim1</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>dim2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>framebits</key>
+ <value>framebits</value>
+ </param>
+ <param>
+ <key>k</key>
+ <value>k</value>
+ </param>
+ <param>
+ <key>rate</key>
+ <value>rate</value>
+ </param>
+ <param>
+ <key>polys</key>
+ <value>polys</value>
+ </param>
+ <param>
+ <key>state_start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>state_end</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>strb</key>
+ <value>"streaming"</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(675, 274)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_time_sink_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>srate</key>
+ <value>samp_rate_0</value>
+ </param>
+ <param>
+ <key>autoscale</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ymin</key>
+ <value>-1.25</value>
+ </param>
+ <param>
+ <key>ymax</key>
+ <value>1.25</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>update_time</key>
+ <value>0.10</value>
+ </param>
+ <param>
+ <key>entags</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></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_level</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>tr_delay</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>tr_chan</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>tr_tag</key>
+ <value>""</value>
+ </param>
+ <param>
+ <key>label1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width1</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color1</key>
+ <value>"blue"</value>
+ </param>
+ <param>
+ <key>style1</key>
+ <value>3</value>
+ </param>
+ <param>
+ <key>marker1</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>alpha1</key>
+ <value>0.5</value>
+ </param>
+ <param>
+ <key>label2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color2</key>
+ <value>"red"</value>
+ </param>
+ <param>
+ <key>style2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker2</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha2</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width3</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color3</key>
+ <value>"green"</value>
+ </param>
+ <param>
+ <key>style3</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker3</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha3</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width4</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color4</key>
+ <value>"black"</value>
+ </param>
+ <param>
+ <key>style4</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker4</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha4</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width5</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color5</key>
+ <value>"cyan"</value>
+ </param>
+ <param>
+ <key>style5</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker5</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha5</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width6</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color6</key>
+ <value>"magenta"</value>
+ </param>
+ <param>
+ <key>style6</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker6</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha6</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width7</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color7</key>
+ <value>"yellow"</value>
+ </param>
+ <param>
+ <key>style7</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker7</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha7</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label8</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width8</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color8</key>
+ <value>"dark red"</value>
+ </param>
+ <param>
+ <key>style8</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker8</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha8</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label9</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width9</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color9</key>
+ <value>"dark green"</value>
+ </param>
+ <param>
+ <key>style9</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker9</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha9</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(710, 123)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_number_sink</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_number_sink_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>autoscale</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>avg</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>graph_type</key>
+ <value>qtgui.NUM_GRAPH_HORIZ</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>-10</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>update_time</key>
+ <value>0.10</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>label1</key>
+ <value>BER</value>
+ </param>
+ <param>
+ <key>color1</key>
+ <value>("blue", "red")</value>
+ </param>
+ <param>
+ <key>label2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>color2</key>
+ <value>("black", "black")</value>
+ </param>
+ <param>
+ <key>label3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>color3</key>
+ <value>("black", "black")</value>
+ </param>
+ <param>
+ <key>label4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>color4</key>
+ <value>("black", "black")</value>
+ </param>
+ <param>
+ <key>label5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>color5</key>
+ <value>("black", "black")</value>
+ </param>
+ <param>
+ <key>label6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>color6</key>
+ <value>("black", "black")</value>
+ </param>
+ <param>
+ <key>label7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>color7</key>
+ <value>("black", "black")</value>
+ </param>
+ <param>
+ <key>label8</key>
+ <value></value>
+ </param>
+ <param>
+ <key>color8</key>
+ <value>("black", "black")</value>
+ </param>
+ <param>
+ <key>label9</key>
+ <value></value>
+ </param>
+ <param>
+ <key>color9</key>
+ <value>("black", "black")</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(708, 27)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>ber_generator_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>1</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>ber_generator_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>
+</flow_graph>
diff --git a/gr-fec/examples/cc_bercurve.grc b/gr-fec/examples/cc_bercurve.grc
new file mode 100644
index 0000000..a9c1bfb
--- /dev/null
+++ b/gr-fec/examples/cc_bercurve.grc
@@ -0,0 +1,1009 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Tue Mar 25 13:27:18 2014</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>cc_bercurve</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>polys</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>[79, 109]</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(248, 86)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>framebits</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>4096</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(136, 85)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>35000000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(12, 85)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(288, 12)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>k</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>7</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(205, 11)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>esno_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>numpy.arange(0, 8, .5) </value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(13, 158)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>esno_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>numpy.arange(0, 2, .5) </value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(14, 232)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_cc_decoder_def</key>
+ <param>
+ <key>id</key>
+ <value>dec</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>"ok"</value>
+ </param>
+ <param>
+ <key>ndim</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>dim1</key>
+ <value>len(esno_0)</value>
+ </param>
+ <param>
+ <key>dim2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>framebits</key>
+ <value>framebits</value>
+ </param>
+ <param>
+ <key>k</key>
+ <value>k</value>
+ </param>
+ <param>
+ <key>rate</key>
+ <value>rate</value>
+ </param>
+ <param>
+ <key>polys</key>
+ <value>polys</value>
+ </param>
+ <param>
+ <key>state_start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>state_end</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>strb</key>
+ <value>"streaming"</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(246, 431)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_cc_encoder_def</key>
+ <param>
+ <key>id</key>
+ <value>enc</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>"ok"</value>
+ </param>
+ <param>
+ <key>ndim</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>dim1</key>
+ <value>len(esno_0)</value>
+ </param>
+ <param>
+ <key>dim2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>framebits</key>
+ <value>framebits</value>
+ </param>
+ <param>
+ <key>k</key>
+ <value>k</value>
+ </param>
+ <param>
+ <key>rate</key>
+ <value>rate</value>
+ </param>
+ <param>
+ <key>polys</key>
+ <value>polys</value>
+ </param>
+ <param>
+ <key>state_start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>state_end</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>strb</key>
+ <value>"streaming"</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(9, 431)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>fec_bercurve_generator</key>
+ <param>
+ <key>id</key>
+ <value>fec_bercurve_generator_0_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>esno</key>
+ <value>esno_0</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate_0</value>
+ </param>
+ <param>
+ <key>encoder_list</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>decoder_list</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>puncpat</key>
+ <value>'11'</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(383, 131)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ <bus_source>1</bus_source>
+ </block>
+ <block>
+ <key>blocks_char_to_float</key>
+ <param>
+ <key>id</key>
+ <value>blocks_char_to_float_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>scale</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(914, 42)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_stream_to_streams</key>
+ <param>
+ <key>id</key>
+ <value>blocks_stream_to_streams_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>num_streams</key>
+ <value>len(esno_0)*2</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(654, 163)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ <bus_source>1</bus_source>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_time_sink_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>srate</key>
+ <value>samp_rate_0</value>
+ </param>
+ <param>
+ <key>autoscale</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ymin</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>ymax</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>len(esno_0)*2</value>
+ </param>
+ <param>
+ <key>update_time</key>
+ <value>0.10</value>
+ </param>
+ <param>
+ <key>entags</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></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_level</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>tr_delay</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>tr_chan</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>tr_tag</key>
+ <value>""</value>
+ </param>
+ <param>
+ <key>label1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width1</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color1</key>
+ <value>"blue"</value>
+ </param>
+ <param>
+ <key>style1</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker1</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha1</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color2</key>
+ <value>"red"</value>
+ </param>
+ <param>
+ <key>style2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker2</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha2</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width3</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color3</key>
+ <value>"green"</value>
+ </param>
+ <param>
+ <key>style3</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker3</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha3</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width4</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color4</key>
+ <value>"black"</value>
+ </param>
+ <param>
+ <key>style4</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker4</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha4</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width5</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color5</key>
+ <value>"cyan"</value>
+ </param>
+ <param>
+ <key>style5</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker5</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha5</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width6</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color6</key>
+ <value>"magenta"</value>
+ </param>
+ <param>
+ <key>style6</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker6</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha6</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width7</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color7</key>
+ <value>"yellow"</value>
+ </param>
+ <param>
+ <key>style7</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker7</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha7</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label8</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width8</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color8</key>
+ <value>"dark red"</value>
+ </param>
+ <param>
+ <key>style8</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker8</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha8</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label9</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width9</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color9</key>
+ <value>"dark green"</value>
+ </param>
+ <param>
+ <key>style9</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker9</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha9</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(1005, 183)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ <bus_sink>1</bus_sink>
+ </block>
+ <block>
+ <key>fec_bercurve_generator</key>
+ <param>
+ <key>id</key>
+ <value>fec_bercurve_generator_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>esno</key>
+ <value>esno_0</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate_0</value>
+ </param>
+ <param>
+ <key>encoder_list</key>
+ <value>enc</value>
+ </param>
+ <param>
+ <key>decoder_list</key>
+ <value>dec</value>
+ </param>
+ <param>
+ <key>puncpat</key>
+ <value>'11'</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(384, 15)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ <bus_source>1</bus_source>
+ </block>
+ <block>
+ <key>blocks_streams_to_stream</key>
+ <param>
+ <key>id</key>
+ <value>blocks_streams_to_stream_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>num_streams</key>
+ <value>len(esno_0)*2</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(676, 20)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ <bus_sink>1</bus_sink>
+ </block>
+ <connection>
+ <source_block_id>blocks_streams_to_stream_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_char_to_float_0</source_block_id>
+ <sink_block_id>blocks_stream_to_streams_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_stream_to_streams_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_stream_to_streams_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>1</source_key>
+ <sink_key>1</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_stream_to_streams_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>2</source_key>
+ <sink_key>2</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_stream_to_streams_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>3</source_key>
+ <sink_key>3</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_stream_to_streams_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>4</source_key>
+ <sink_key>4</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_stream_to_streams_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>5</source_key>
+ <sink_key>5</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_stream_to_streams_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>6</source_key>
+ <sink_key>6</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_stream_to_streams_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>7</source_key>
+ <sink_key>7</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_stream_to_streams_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>8</source_key>
+ <sink_key>8</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fec_bercurve_generator_0</source_block_id>
+ <sink_block_id>blocks_streams_to_stream_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fec_bercurve_generator_0</source_block_id>
+ <sink_block_id>blocks_streams_to_stream_0</sink_block_id>
+ <source_key>1</source_key>
+ <sink_key>1</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fec_bercurve_generator_0</source_block_id>
+ <sink_block_id>blocks_streams_to_stream_0</sink_block_id>
+ <source_key>2</source_key>
+ <sink_key>2</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fec_bercurve_generator_0</source_block_id>
+ <sink_block_id>blocks_streams_to_stream_0</sink_block_id>
+ <source_key>3</source_key>
+ <sink_key>3</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fec_bercurve_generator_0</source_block_id>
+ <sink_block_id>blocks_streams_to_stream_0</sink_block_id>
+ <source_key>4</source_key>
+ <sink_key>4</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fec_bercurve_generator_0</source_block_id>
+ <sink_block_id>blocks_streams_to_stream_0</sink_block_id>
+ <source_key>5</source_key>
+ <sink_key>5</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fec_bercurve_generator_0</source_block_id>
+ <sink_block_id>blocks_streams_to_stream_0</sink_block_id>
+ <source_key>6</source_key>
+ <sink_key>6</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fec_bercurve_generator_0</source_block_id>
+ <sink_block_id>blocks_streams_to_stream_0</sink_block_id>
+ <source_key>7</source_key>
+ <sink_key>7</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fec_bercurve_generator_0</source_block_id>
+ <sink_block_id>blocks_streams_to_stream_0</sink_block_id>
+ <source_key>8</source_key>
+ <sink_key>8</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-fec/grc/fec_ber_bf.xml b/gr-fec/grc/fec_ber_bf.xml
new file mode 100644
index 0000000..e4a070f
--- /dev/null
+++ b/gr-fec/grc/fec_ber_bf.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<block>
+ <name>BER</name>
+ <key>fec_ber_bf</key>
+ <import>from gnuradio import fec</import>
+ <make>fec.ber_bf($berminerrors, $berlimit)</make>
+
+ <param>
+ <name>BER Min. Errors</name>
+ <key>berminerrors</key>
+ <value>100</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>BER Limit</name>
+ <key>berlimit</key>
+ <value>-7.0</value>
+ <type>float</type>
+ </param>
+
+ <sink>
+ <name>in0</name>
+ <type>byte</type>
+ </sink>
+
+ <sink>
+ <name>in1</name>
+ <type>byte</type>
+ </sink>
+
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+
+</block>
\ No newline at end of file
diff --git a/gr-fec/grc/fec_bercurve_generator.xml
b/gr-fec/grc/fec_bercurve_generator.xml
new file mode 100644
index 0000000..d10a886
--- /dev/null
+++ b/gr-fec/grc/fec_bercurve_generator.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## BER Curve Generator
+###################################################
+ -->
+<block>
+ <name>BER Curve Gen.</name>
+ <key>fec_bercurve_generator</key>
+ <import>from gnuradio import fec</import>
+ <import>import numpy</import>
+ <make>fec.bercurve_generator(
+ $encoder_list, \#size
+ $decoder_list, \#name
+ $esno, \#range of esnos
+ $samp_rate, \#throttle
+ $puncpat \#puncture pattern
+)
+ </make>
+
+ <param>
+ <name>esno</name>
+ <key>esno</key>
+ <value>numpy.arange(0.0, 4.0, .5)</value>
+ <type>raw</type>
+ </param>
+
+ <param>
+ <name>samp_rate</name>
+ <key>samp_rate</key>
+ <value>3200000</value>
+ <type>raw</type>
+ </param>
+
+ <param>
+ <name>encoder_list</name>
+ <key>encoder_list</key>
+ <value>0</value>
+ <type>raw</type>
+ </param>
+
+ <param>
+ <name>decoder_list</name>
+ <key>decoder_list</key>
+ <value>0</value>
+ <type>raw</type>
+ </param>
+
+ <param>
+ <name>puncpat</name>
+ <key>puncpat</key>
+ <value>'11'</value>
+ <type>string</type>
+ </param>
+
+ <bus_source>1</bus_source>
+
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ <nports>len($esno)*2</nports>
+ </source>
+
+ <doc>
+ The GUI hint can be used to position the widget within the application. \
+ The hint is of the form address@hidden: [row, col, row_span, col_span]. \
+ Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-fec/grc/fec_block_tree.xml b/gr-fec/grc/fec_block_tree.xml
index 1a0d2ec..6ce8a6e 100644
--- a/gr-fec/grc/fec_block_tree.xml
+++ b/gr-fec/grc/fec_block_tree.xml
@@ -1,14 +1,30 @@
<?xml version="1.0"?>
<!--
###################################################
-##Block Tree for gr-fec
+## Block Tree for gr-fec
###################################################
-->
<cat>
- <name></name> <!-- Blank for Root Name -->
- <cat>
- <name>Error Coding</name>
- <block>fec_decode_ccsds_27_fb</block>
- <block>fec_encode_ccsds_27_bb</block>
- </cat>
+ <name></name> <!-- Blank for Root Name -->
+ <cat>
+ <name>Error Coding</name>
+ <cat>
+ <name>Decoders</name>
+ <block>variable_cc_decoder_def</block>
+ </cat>
+ <cat>
+ <name>Encoders</name>
+ <block>variable_cc_encoder_def</block>
+ </cat>
+ <block>fec_extended_encoder</block>
+ <block>fec_extended_decoder</block>
+ <block>fec_generic_encoder</block>
+ <block>fec_generic_decoder</block>
+ <block>fec_decode_ccsds_27_fb</block>
+ <block>fec_encode_ccsds_27_bb</block>
+ <block>fec_puncture_ff</block>
+ <block>fec_depuncture_ff</block>
+ <block>fec_ber_bf</block>
+ <block>fec_bercurve_generator</block>
+ </cat>
</cat>
diff --git a/gr-fec/grc/fec_decode_ccsds_27_fb.xml
b/gr-fec/grc/fec_decode_ccsds_27_fb.xml
index 4ea2a02..f7bd9d3 100644
--- a/gr-fec/grc/fec_decode_ccsds_27_fb.xml
+++ b/gr-fec/grc/fec_decode_ccsds_27_fb.xml
@@ -5,16 +5,16 @@
###################################################
-->
<block>
- <name>Decode CCSDS 27</name>
- <key>fec_decode_ccsds_27_fb</key>
- <import>from gnuradio import fec</import>
- <make>fec.decode_ccsds_27_fb()</make>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
+ <name>Decode CCSDS 27</name>
+ <key>fec_decode_ccsds_27_fb</key>
+ <import>from gnuradio import fec</import>
+ <make>fec.decode_ccsds_27_fb()</make>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
</block>
diff --git a/gr-fec/grc/fec_decoder.xml b/gr-fec/grc/fec_decoder.xml
new file mode 100644
index 0000000..dd9d08d
--- /dev/null
+++ b/gr-fec/grc/fec_decoder.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<block>
+ <name>FEC Decoder</name>
+ <key>fec_generic_decoder</key>
+ <import>from gnuradio import fec</import>
+ <make>fec.decoder($decoder, $itype.size, $otype.size)</make>
+
+ <param>
+ <name>Decoder Object</name>
+ <key>decoder</key>
+ <value>decoder_variable</value>
+ <type>raw</type>
+ </param>
+
+ <param>
+ <name>Input Type</name>
+ <key>itype</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+
+ <param>
+ <name>Output Type</name>
+ <key>otype</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+
+ <sink>
+ <name>in</name>
+ <type>$itype</type>
+ </sink>
+
+ <source>
+ <name>out</name>
+ <type>$otype</type>
+ </source>
+
+ <doc>
+ This is a GNU Radio adaptor for any FEC decoder following the
generic_decoder API in the fec module. Input and output are flexible to
accomodate decoders that, say, modulate their encoded results into complex or
float types.
+ </doc>
+
+</block>
\ No newline at end of file
diff --git a/gr-fec/grc/fec_depuncture_bb.xml b/gr-fec/grc/fec_depuncture_bb.xml
new file mode 100644
index 0000000..070dcb1
--- /dev/null
+++ b/gr-fec/grc/fec_depuncture_bb.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<block>
+ <name>Depuncture</name>
+ <key>fec_depuncture_ff</key>
+ <import>from gnuradio import fec</import>
+ <make>fec.depucture_bb($delay, $puncpat, $puncholes, $puncsize)</make>
+
+ <param>
+ <name>Delay</name>
+ <key>delay</key>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Puncture Pattern</name>
+ <key>puncpat</key>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Puncture Holes</name>
+ <key>puncholes</key>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Puncture Size</name>
+ <key>puncsize</key>
+ <type>int</type>
+ </param>
+
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+
+</block>
diff --git a/gr-fec/grc/fec_encoder.xml b/gr-fec/grc/fec_encoder.xml
new file mode 100644
index 0000000..defb7c3
--- /dev/null
+++ b/gr-fec/grc/fec_encoder.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<block>
+ <name>FEC Encoder</name>
+ <key>fec_generic_encoder</key>
+ <import>from gnuradio import fec</import>
+ <make>fec.encoder($encoder, $itype.size, $otype.size)</make>
+
+ <param>
+ <name>Constituent Encoder</name>
+ <key>encoder</key>
+ <value>encoder_variable</value>
+ <type>raw</type>
+ </param>
+
+ <param>
+ <name>Input Type</name>
+ <key>itype</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+
+ <param>
+ <name>Output Type</name>
+ <key>otype</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+
+ <sink>
+ <name>in</name>
+ <type>$itype</type>
+ </sink>
+
+ <source>
+ <name>out</name>
+ <type>$otype</type>
+ </source>
+
+ <doc>
+ This is a GNU Radio adaptor for any FEC encoder following the
generic_encoder API in the fec module. Input and output are flexible to
accomodate encoders that, say, modulate their encoded results into complex or
float types.
+ </doc>
+
+</block>
\ No newline at end of file
diff --git a/gr-fec/grc/fec_extended_decoder.xml
b/gr-fec/grc/fec_extended_decoder.xml
new file mode 100644
index 0000000..4262a39
--- /dev/null
+++ b/gr-fec/grc/fec_extended_decoder.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<block>
+ <name>FEC Extended Decoder</name>
+ <key>fec_extended_decoder</key>
+ <import>from gnuradio import fec</import>
+ <make>self.$(id) = $(id) =
fec.extended_decoder(decoder_obj_list=$decoder_list, threading=$threadtype.arg,
ann=$ann, puncpat=$puncpat, integration_period=10000)</make>
+
+ <param>
+ <name>fake val</name>
+ <key>value</key>
+ <value>fec_extended_decoder</value>
+ <type>string</type>
+ <hide>all</hide>
+ </param>
+
+ <param>
+ <name>Decoder Objects</name>
+ <key>decoder_list</key>
+ <value>decoder_variable</value>
+ <type>raw</type>
+ </param>
+
+ <param>
+ <name>Threading Type</name>
+ <key>threadtype</key>
+ <type>enum</type>
+ <option>
+ <name>Capillary</name>
+ <key>capillary</key>
+ <opt>arg:'capillary'</opt>
+ </option>
+ <option>
+ <name>Ordinary</name>
+ <key>ordinary</key>
+ <opt>arg:'ordinary'</opt>
+ </option>
+ <option>
+ <name>None</name>
+ <key>none</key>
+ <opt>arg: None</opt>
+ </option>
+ </param>
+
+ <param>
+ <name>Annihilator</name>
+ <key>ann</key>
+ <value>None</value>
+ <type>raw</type>
+ </param>
+
+ <param>
+ <name>Puncture Pattern</name>
+ <key>puncpat</key>
+ <value>'11'</value>
+ <type>string</type>
+ </param>
+
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+
+ <doc>
+
+ </doc>
+
+</block>
diff --git a/gr-fec/grc/fec_extended_encoder.xml
b/gr-fec/grc/fec_extended_encoder.xml
new file mode 100644
index 0000000..0ed3d31
--- /dev/null
+++ b/gr-fec/grc/fec_extended_encoder.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<block>
+ <name>FEC Extended Encoder</name>
+ <key>fec_extended_encoder</key>
+ <import>from gnuradio import fec</import>
+ <make>fec.extended_encoder(encoder_obj_list=$encoder_list,
threading=$threadtype.arg, puncpat=$puncpat, )</make>
+
+ <param>
+ <name>Encoder Objects</name>
+ <key>encoder_list</key>
+ <value>encoder_variable</value>
+ <type>raw</type>
+ </param>
+
+ <param>
+ <name>Threading Type</name>
+ <key>threadtype</key>
+ <type>enum</type>
+ <option>
+ <name>Capillary</name>
+ <key>capillary</key>
+ <opt>arg:'capillary'</opt>
+ </option>
+ <option>
+ <name>Ordinary</name>
+ <key>ordinary</key>
+ <opt>arg:'ordinary'</opt>
+ </option>
+ <option>
+ <name>None</name>
+ <key>none</key>
+ <opt>arg: None</opt>
+ </option>
+ </param>
+
+ <param>
+ <name>Puncture Pattern</name>
+ <key>puncpat</key>
+ <value>'11'</value>
+ <type>string</type>
+ </param>
+
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+
+ <doc>
+
+ </doc>
+
+</block>
diff --git a/gr-fec/grc/fec_puncture_ff.xml b/gr-fec/grc/fec_puncture_ff.xml
new file mode 100644
index 0000000..1442dd5
--- /dev/null
+++ b/gr-fec/grc/fec_puncture_ff.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<block>
+ <name>Puncture</name>
+ <key>fec_puncture_ff</key>
+ <import>from gnuradio import fec</import>
+ <make>fec.puncture_ff($delay, $puncpat, $puncholes, $puncsize)</make>
+
+ <param>
+ <name>Delay</name>
+ <key>delay</key>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Puncture Pattern</name>
+ <key>puncpat</key>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Puncture Holes</name>
+ <key>puncholes</key>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Puncture Size</name>
+ <key>puncsize</key>
+ <type>int</type>
+ </param>
+
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+
+</block>
diff --git a/gr-fec/grc/variable_cc_decoder_def_list.xml
b/gr-fec/grc/variable_cc_decoder_def_list.xml
new file mode 100644
index 0000000..52ec1c4
--- /dev/null
+++ b/gr-fec/grc/variable_cc_decoder_def_list.xml
@@ -0,0 +1,144 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+# FEC MAKING FOR GREAT JUSTICE
+###################################################
+ -->
+<block>
+ <name>CC Decoder Definition</name>
+ <key>variable_cc_decoder_def</key>
+ <import>from gnuradio import fec</import>
+ <var_make>
+#if int($ndim())==1 #
+self.$(id) = $(id) = map( (lambda a: fec.cc_decoder.make($framebits, $k,
$rate, $polys, $state_start, $state_end, $strb.tailbiting, $strb.terminated,
$strb.truncated, $strb.streaming )), range(0,$dim1) ); #slurp
+#else
+self.$(id) = $(id) = map( (lambda b: map( ( lambda a:
fec.cc_decoder.make($framebits, $k, $rate, $polys, $state_start, $state_end,
$strb.tailbiting, $strb.terminated, $strb.truncated, $strb.streaming )),
range(0,$dim2) ) ), range(0,$dim1)); #slurp
+#end if</var_make>
+ <make></make>
+
+ <param>
+ <name>Ignore Me</name>
+ <key>value</key>
+ <value>"ok"</value>
+ <type>raw</type>
+ <hide>all</hide>
+ </param>
+
+ <param>
+ <name>Threading Dimensions</name>
+ <key>ndim</key>
+ <value></value>
+ <type>enum</type>
+ <option>
+ <name>2</name>
+ <key>2</key>
+ </option>
+ <option>
+ <name>1</name>
+ <key>1</key>
+ </option>
+
+ </param>
+
+ <param>
+ <name>Dimension 1</name>
+ <key>dim1</key>
+ <value>4</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>Frame Bits</name>
+ <key>framebits</key>
+ <value>2048</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Constraint Length (K)</name>
+ <key>k</key>
+ <value>7</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Rate Inverse (1/R) (1/2) --> 2</name>
+ <key>rate</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Polynomials</name>
+ <key>polys</key>
+ <value>[79,109]</value>
+ <type>int_vector</type>
+ </param>
+
+ <param>
+ <name>Start State</name>
+ <key>state_start</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>End State</name>
+ <key>state_end</key>
+ <value>-1</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Streaming Behavior</name>
+ <key>strb</key>
+ <value></value>
+ <type>enum</type>
+ <option>
+ <name>Streaming</name>
+ <key>"streaming"</key>
+ <opt>streaming:True</opt>
+ <opt>tailbiting:False</opt>
+ <opt>terminated:False</opt>
+ <opt>truncated:False</opt>
+ </option>
+ <option>
+ <name>Tailbiting</name>
+ <key>"tailbiting"</key>
+ <opt>streaming:False</opt>
+ <opt>tailbiting:True</opt>
+ <opt>terminated:False</opt>
+ <opt>truncated:False</opt>
+ </option>
+ <option>
+ <name>Terminated</name>
+ <key>"terminated"</key>
+ <opt>streaming:False</opt>
+ <opt>tailbiting:False</opt>
+ <opt>terminated:True</opt>
+ <opt>truncated:False</opt>
+ </option>
+ <option>
+ <name>Truncated</name>
+ <key>"truncated"</key>
+ <opt>streaming:False</opt>
+ <opt>tailbiting:False</opt>
+ <opt>terminated:False</opt>
+ <opt>truncated:True</opt>
+ </option>
+ </param>
+
+ <doc>
+ This instantiates a 1-dim array of decoders or a 2-dim array of
decoders
+ See Nick if things break.
+ </doc>
+</block>
diff --git a/gr-fec/grc/variable_cc_encoder_def_list.xml
b/gr-fec/grc/variable_cc_encoder_def_list.xml
new file mode 100644
index 0000000..18bc251
--- /dev/null
+++ b/gr-fec/grc/variable_cc_encoder_def_list.xml
@@ -0,0 +1,144 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+# FEC MAKING FOR GREAT JUSTICE
+###################################################
+ -->
+<block>
+ <name>CC Encoder Definition</name>
+ <key>variable_cc_encoder_def</key>
+ <import>from gnuradio import fec</import>
+ <var_make>
+#if int($ndim())==1 #
+self.$(id) = $(id) = map( (lambda a: fec.cc_encoder_make($framebits, $k,
$rate, $polys, $state_start, $state_end, $strb.tailbiting, $strb.terminated,
$strb.truncated, $strb.streaming )), range(0,$dim1) ); #slurp
+#else
+self.$(id) = $(id) = map( (lambda b: map( ( lambda a:
fec.cc_encoder_make($framebits, $k, $rate, $polys, $state_start, $state_end,
$strb.tailbiting, $strb.terminated, $strb.truncated, $strb.streaming )),
range(0,$dim2) ) ), range(0,$dim1)); #slurp
+#end if</var_make>
+ <make></make>
+
+ <param>
+ <name>Ignore Me</name>
+ <key>value</key>
+ <value>"ok"</value>
+ <type>raw</type>
+ <hide>all</hide>
+ </param>
+
+ <param>
+ <name>Threading Dimensions</name>
+ <key>ndim</key>
+ <value></value>
+ <type>enum</type>
+ <option>
+ <name>2</name>
+ <key>2</key>
+ </option>
+ <option>
+ <name>1</name>
+ <key>1</key>
+ </option>
+
+ </param>
+
+ <param>
+ <name>Dimension 1</name>
+ <key>dim1</key>
+ <value>4</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>Frame Bits</name>
+ <key>framebits</key>
+ <value>2048</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Constraint Length (K)</name>
+ <key>k</key>
+ <value>7</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Rate Inverse (1/R) (1/2) --> 2</name>
+ <key>rate</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Polynomials</name>
+ <key>polys</key>
+ <value>[79,109]</value>
+ <type>int_vector</type>
+ </param>
+
+ <param>
+ <name>Start State</name>
+ <key>state_start</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>End State</name>
+ <key>state_end</key>
+ <value>-1</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Streaming Behavior</name>
+ <key>strb</key>
+ <value></value>
+ <type>enum</type>
+ <option>
+ <name>Streaming</name>
+ <key>"streaming"</key>
+ <opt>streaming:True</opt>
+ <opt>tailbiting:False</opt>
+ <opt>terminated:False</opt>
+ <opt>truncated:False</opt>
+ </option>
+ <option>
+ <name>Tailbiting</name>
+ <key>"tailbiting"</key>
+ <opt>streaming:False</opt>
+ <opt>tailbiting:True</opt>
+ <opt>terminated:False</opt>
+ <opt>truncated:False</opt>
+ </option>
+ <option>
+ <name>Terminated</name>
+ <key>"terminated"</key>
+ <opt>streaming:False</opt>
+ <opt>tailbiting:False</opt>
+ <opt>terminated:True</opt>
+ <opt>truncated:False</opt>
+ </option>
+ <option>
+ <name>Truncated</name>
+ <key>"truncated"</key>
+ <opt>streaming:False</opt>
+ <opt>tailbiting:False</opt>
+ <opt>terminated:False</opt>
+ <opt>truncated:True</opt>
+ </option>
+ </param>
+
+ <doc>
+ This instantiates a 1-dim array of encoders or a 2-dim array of
encoders
+ See Nick if things break.
+ </doc>
+</block>
diff --git a/gr-fec/include/gnuradio/fec/CMakeLists.txt
b/gr-fec/include/gnuradio/fec/CMakeLists.txt
index 7ab0498..a2d1ac2 100644
--- a/gr-fec/include/gnuradio/fec/CMakeLists.txt
+++ b/gr-fec/include/gnuradio/fec/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -47,7 +47,7 @@ macro(expand_h root)
string(REGEX REPLACE "X+" ${sig} name ${root})
list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
endforeach(sig)
-
+
#create a command to generate the files
add_custom_command(
OUTPUT ${expanded_files_h}
@@ -76,10 +76,20 @@ add_custom_target(fec_generated_includes DEPENDS
install(FILES
${generated_includes}
api.h
+ generic_decoder.h
+ generic_encoder.h
+ encoder.h
+ decoder.h
+ cc_encoder.h
+ cc_decoder.h
decode_ccsds_27_fb.h
encode_ccsds_27_bb.h
rs.h
viterbi.h
+ ber_bf.h
+ conv_bit_corr_bb.h
+ puncture_ff.h
+ depuncture_bb.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fec
COMPONENT "fec_devel"
)
diff --git a/gr-fec/swig/fec_swig.i b/gr-fec/include/gnuradio/fec/ber_bf.h
similarity index 54%
copy from gr-fec/swig/fec_swig.i
copy to gr-fec/include/gnuradio/fec/ber_bf.h
index 62bb767..9f3691f 100644
--- a/gr-fec/swig/fec_swig.i
+++ b/gr-fec/include/gnuradio/fec/ber_bf.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2013-2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,20 +20,33 @@
* Boston, MA 02110-1301, USA.
*/
-#define FEC_API
+#ifndef INCLUDED_FEC_BER_BF_H
+#define INCLUDED_FEC_BER_BF_H
-%include "gnuradio.i"
+#include <gnuradio/fec/api.h>
+#include <gnuradio/block.h>
-//load generated python docstrings
-%include "fec_swig_doc.i"
+namespace gr {
+ namespace fec {
-%{
-#include "gnuradio/fec/decode_ccsds_27_fb.h"
-#include "gnuradio/fec/encode_ccsds_27_bb.h"
-%}
+ /*!
+ * \brief BER block in FECAPI
+ * \ingroup error_coding_blk
+ *
+ * \details
+ *
+ * What does this block do?
+ */
+ class FEC_API ber_bf : virtual public block
+ {
+ public:
+ // gr::fec::ber_bf::sptr
+ typedef boost::shared_ptr<ber_bf> sptr;
-%include "gnuradio/fec/decode_ccsds_27_fb.h"
-%include "gnuradio/fec/encode_ccsds_27_bb.h"
+ static sptr make(int berminerrors = 100, float ber_limit = -7.0);
+ };
-GR_SWIG_BLOCK_MAGIC2(fec, decode_ccsds_27_fb);
-GR_SWIG_BLOCK_MAGIC2(fec, encode_ccsds_27_bb);
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_BER_BF_H */
diff --git a/gr-fec/swig/fec_swig.i b/gr-fec/include/gnuradio/fec/cc_common.h
similarity index 57%
copy from gr-fec/swig/fec_swig.i
copy to gr-fec/include/gnuradio/fec/cc_common.h
index 62bb767..33cf915 100644
--- a/gr-fec/swig/fec_swig.i
+++ b/gr-fec/include/gnuradio/fec/cc_common.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2013-2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,20 +20,28 @@
* Boston, MA 02110-1301, USA.
*/
-#define FEC_API
+#ifndef INCLUDED_FEC_CC_COMMON_H
+#define INCLUDED_FEC_CC_COMMON_H
-%include "gnuradio.i"
+typedef unsigned char DECISIONTYPE;
+typedef unsigned char COMPUTETYPE;
-//load generated python docstrings
-%include "fec_swig_doc.i"
+typedef union {
+ //decision_t is a BIT vector
+ DECISIONTYPE* t;
+ unsigned int* w;
+ unsigned short* s;
+ unsigned char* c;
+} decision_t;
-%{
-#include "gnuradio/fec/decode_ccsds_27_fb.h"
-#include "gnuradio/fec/encode_ccsds_27_bb.h"
-%}
+typedef union {
+ COMPUTETYPE* t;
+} metric_t;
-%include "gnuradio/fec/decode_ccsds_27_fb.h"
-%include "gnuradio/fec/encode_ccsds_27_bb.h"
+struct v {
+ COMPUTETYPE *metrics;
+ metric_t old_metrics,new_metrics,metrics1,metrics2; /* Pointers to path
metrics, swapped on every bit */
+ DECISIONTYPE *decisions;
+};
-GR_SWIG_BLOCK_MAGIC2(fec, decode_ccsds_27_fb);
-GR_SWIG_BLOCK_MAGIC2(fec, encode_ccsds_27_bb);
+#endif /*INCLUDED_FEC_CC_COMMON_H*/
diff --git a/gr-fec/include/gnuradio/fec/cc_decoder.h
b/gr-fec/include/gnuradio/fec/cc_decoder.h
new file mode 100644
index 0000000..821730c
--- /dev/null
+++ b/gr-fec/include/gnuradio/fec/cc_decoder.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_CC_DECODER_H
+#define INCLUDED_FEC_CC_DECODER_H
+
+#include <gnuradio/fec/api.h>
+#include <gnuradio/fec/generic_decoder.h>
+#include <map>
+#include <string>
+//#include <fec/cc_common.h>
+
+namespace gr {
+ namespace fec {
+ namespace code {
+
+ typedef void(*conv_kernel)(unsigned char *Y, unsigned char *X,
+ const unsigned char *syms, unsigned char *dec,
+ unsigned int framebits, unsigned int excess,
+ unsigned char *Branchtab);
+
+ class FEC_API cc_decoder : virtual public generic_decoder
+ {
+ public:
+ static generic_decoder::sptr make
+ (int framebits, int k,
+ int rate, std::vector<int> polys,
+ int start_state = 0, int end_state = -1,
+ bool tailbiting = false, bool terminated = false,
+ bool truncated = false, bool streaming = false);
+
+ virtual void set_framebits(int framebits) = 0;
+ virtual void generic_work(void *inBuffer, void *outbuffer) = 0;
+ };
+
+ } /* namespace code */
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_CC_DECODER_H */
diff --git a/gr-fec/include/gnuradio/fec/cc_encoder.h
b/gr-fec/include/gnuradio/fec/cc_encoder.h
new file mode 100644
index 0000000..1857e92
--- /dev/null
+++ b/gr-fec/include/gnuradio/fec/cc_encoder.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_CC_ENCODER_H
+#define INCLUDED_FEC_CC_ENCODER_H
+
+#include <gnuradio/fec/api.h>
+#include <gnuradio/fec/encoder.h>
+#include <gnuradio/fec/cc_common.h>
+#include <map>
+#include <string>
+
+namespace gr {
+ namespace fec {
+ namespace code {
+
+ /*!
+ * \brief Convolutional Code Encoding block
+ * \ingroup error_coding_blk
+ */
+ class FEC_API cc_encoder : virtual public generic_encoder
+ {
+ public:
+ static generic_encoder::sptr make
+ (int framebits, int k,
+ int rate, std::vector<int> polys,
+ int start_state = 0, int end_state = 0,
+ bool tailbiting = false, bool terminated = false,
+ bool truncated = false, bool streaming = true);
+ };
+
+ } /* namespace code */
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_CC_ENCODER_H */
diff --git a/gr-fec/include/gnuradio/fec/conv_bit_corr_bb.h
b/gr-fec/include/gnuradio/fec/conv_bit_corr_bb.h
new file mode 100644
index 0000000..87ab768
--- /dev/null
+++ b/gr-fec/include/gnuradio/fec/conv_bit_corr_bb.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_CONV_BIT_CORR_BB_H
+#define INCLUDED_FEC_CONV_BIT_CORR_BB_H
+
+#include <gnuradio/fec/api.h>
+#include <gnuradio/block.h>
+#include <vector>
+
+namespace gr {
+ namespace fec {
+
+ /*!
+ * \brief Correlate block in FECAPI
+ * \ingroup error_coding_blk
+ *
+ * \details
+ *
+ * What does this block do?
+ */
+ class FEC_API conv_bit_corr_bb : virtual public block
+ {
+ public:
+ // gr::fec::conv_bit_corr_bb::sptr
+ typedef boost::shared_ptr<conv_bit_corr_bb> sptr;
+
+ static sptr make(std::vector<unsigned long long> correlator,
+ int corr_sym, int corr_len, int cut,
+ int flush, float thresh);
+
+ /*!
+ * This subroutine will find the encoded data garble rate
+ * corresponding to a syndrome density of `target', that is created
+ * with an annihilating polynomial with 'taps' number of taps.
+ */
+ virtual float data_garble_rate(int taps, float syn_density) = 0;
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_CONV_BIT_CORR_BB_H */
diff --git a/gr-fec/include/gnuradio/fec/decoder.h
b/gr-fec/include/gnuradio/fec/decoder.h
new file mode 100644
index 0000000..a4cbf36
--- /dev/null
+++ b/gr-fec/include/gnuradio/fec/decoder.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_DECODER_H
+#define INCLUDED_FEC_DECODER_H
+
+#include <gnuradio/fec/api.h>
+#include <gnuradio/fec/generic_decoder.h>
+#include <gnuradio/block.h>
+#include <boost/shared_ptr.hpp>
+#include <boost/shared_array.hpp>
+#include <boost/format.hpp>
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API decoder : virtual public block
+ {
+ public:
+ typedef boost::shared_ptr<decoder> sptr;
+ typedef boost::shared_array<unsigned char> buf_sptr;
+
+ static sptr make(generic_decoder::sptr my_decoder,
+ size_t input_item_size,
+ size_t output_item_size);
+
+ virtual int general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items) = 0;
+ virtual int fixed_rate_ninput_to_noutput(int ninput) = 0;
+ virtual int fixed_rate_noutput_to_ninput(int noutput) = 0;
+ virtual void forecast(int noutput_items,
+ gr_vector_int& ninput_items_required) = 0;
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_DECODER_H */
diff --git a/gr-fec/swig/fec_swig.i
b/gr-fec/include/gnuradio/fec/depuncture_bb.h
similarity index 51%
copy from gr-fec/swig/fec_swig.i
copy to gr-fec/include/gnuradio/fec/depuncture_bb.h
index 62bb767..e7ee51a 100644
--- a/gr-fec/swig/fec_swig.i
+++ b/gr-fec/include/gnuradio/fec/depuncture_bb.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2013-2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,20 +20,34 @@
* Boston, MA 02110-1301, USA.
*/
-#define FEC_API
+#ifndef INCLUDED_FEC_DEPUNCTURE_BB_H
+#define INCLUDED_FEC_DEPUNCTURE_BB_H
-%include "gnuradio.i"
+#include <gnuradio/fec/api.h>
+#include <gnuradio/block.h>
-//load generated python docstrings
-%include "fec_swig_doc.i"
+namespace gr {
+ namespace fec {
-%{
-#include "gnuradio/fec/decode_ccsds_27_fb.h"
-#include "gnuradio/fec/encode_ccsds_27_bb.h"
-%}
+ /*!
+ * \brief Depuncture block in FECAPI
+ * \ingroup error_coding_blk
+ *
+ * \details
+ *
+ * What does this block do?
+ */
+ class FEC_API depuncture_bb : virtual public block
+ {
+ public:
+ // gr::fec::depuncture_bb::sptr
+ typedef boost::shared_ptr<depuncture_bb> sptr;
-%include "gnuradio/fec/decode_ccsds_27_fb.h"
-%include "gnuradio/fec/encode_ccsds_27_bb.h"
+ static sptr make(int delay, int puncpat,
+ int puncholes, int puncsize);
+ };
-GR_SWIG_BLOCK_MAGIC2(fec, decode_ccsds_27_fb);
-GR_SWIG_BLOCK_MAGIC2(fec, encode_ccsds_27_bb);
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_DEPUNCTURE_BB_H */
diff --git a/gr-fec/include/gnuradio/fec/encoder.h
b/gr-fec/include/gnuradio/fec/encoder.h
new file mode 100644
index 0000000..821c213
--- /dev/null
+++ b/gr-fec/include/gnuradio/fec/encoder.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_ENCODER_H
+#define INCLUDED_FEC_ENCODER_H
+
+#include <gnuradio/fec/api.h>
+#include <gnuradio/fec/generic_encoder.h>
+#include <gnuradio/block.h>
+#include <boost/shared_ptr.hpp>
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API encoder : virtual public block
+ {
+ public:
+ typedef boost::shared_ptr<encoder> sptr;
+
+ static sptr make(generic_encoder::sptr my_encoder,
+ size_t input_item_size,
+ size_t output_item_size);
+
+ virtual int general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items) = 0;
+ virtual int fixed_rate_ninput_to_noutput(int ninput) = 0;
+ virtual int fixed_rate_noutput_to_ninput(int noutput) = 0;
+ virtual void forecast(int noutput_items,
+ gr_vector_int& ninput_items_required) = 0;
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_ENCODER_H */
diff --git a/gr-fec/include/gnuradio/fec/generic_decoder.h
b/gr-fec/include/gnuradio/fec/generic_decoder.h
new file mode 100644
index 0000000..335ee85
--- /dev/null
+++ b/gr-fec/include/gnuradio/fec/generic_decoder.h
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_GENERIC_DECODER_H
+#define INCLUDED_FEC_GENERIC_DECODER_H
+
+#include <gnuradio/fec/api.h>
+#include <boost/shared_ptr.hpp>
+#include <boost/format.hpp>
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API generic_decoder
+ {
+ public:
+ friend class decoder;
+ virtual void generic_work(void *inBuffer, void *outBuffer) = 0;
+ static int base_unique_id;
+ int my_id;
+ int unique_id();
+ std::string d_name;
+ std::string alias(){ return
(boost::format("%s%d")%d_name%unique_id()).str(); }
+
+ public:
+ typedef boost::shared_ptr<generic_decoder> sptr;
+
+ generic_decoder(void) {};
+ generic_decoder(std::string name);
+ virtual ~generic_decoder();
+
+ virtual int get_input_size() = 0;
+ virtual int get_output_size() = 0;
+ virtual int get_history();
+ virtual float get_shift();
+ virtual const char* get_conversion();
+ virtual int get_input_item_size();
+ virtual int get_output_item_size();
+ virtual const char* get_output_conversion();
+ };
+
+ FEC_API int get_decoder_output_size(generic_decoder::sptr my_decoder);
+ FEC_API int get_decoder_input_size(generic_decoder::sptr my_decoder);
+ FEC_API float get_shift(generic_decoder::sptr my_decoder);
+ FEC_API int get_history(generic_decoder::sptr my_decoder);
+ FEC_API int get_decoder_output_item_size(generic_decoder::sptr my_decoder);
+ FEC_API int get_decoder_input_item_size(generic_decoder::sptr my_decoder);
+ FEC_API const char* get_conversion(generic_decoder::sptr my_decoder);
+ FEC_API const char* get_output_conversion(generic_decoder::sptr
my_decoder);
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_GENRIC_DECODER_H */
diff --git a/gr-fec/include/gnuradio/fec/generic_encoder.h
b/gr-fec/include/gnuradio/fec/generic_encoder.h
new file mode 100644
index 0000000..25f35a6
--- /dev/null
+++ b/gr-fec/include/gnuradio/fec/generic_encoder.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_GENERIC_ENCODER_H
+#define INCLUDED_FEC_GENERIC_ENCODER_H
+
+#include <gnuradio/fec/api.h>
+#include <gnuradio/block.h>
+#include <boost/shared_ptr.hpp>
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API generic_encoder
+ {
+ public:
+ friend class encoder;
+ virtual void generic_work(void *inBuffer, void *outBuffer) = 0;
+ public:
+ typedef boost::shared_ptr<generic_encoder> sptr;
+
+ virtual int get_input_size() = 0;
+ virtual int get_output_size() = 0;
+ generic_encoder(void) {};
+ virtual ~generic_encoder();
+ };
+
+ FEC_API int get_encoder_output_size(generic_encoder::sptr my_encoder);
+ FEC_API int get_encoder_input_size(generic_encoder::sptr my_encoder);
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_GENERIC_ENCODER_H */
diff --git a/gr-fec/swig/fec_swig.i b/gr-fec/include/gnuradio/fec/puncture_ff.h
similarity index 58%
copy from gr-fec/swig/fec_swig.i
copy to gr-fec/include/gnuradio/fec/puncture_ff.h
index 62bb767..927fc0b 100644
--- a/gr-fec/swig/fec_swig.i
+++ b/gr-fec/include/gnuradio/fec/puncture_ff.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2013-2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,20 +20,25 @@
* Boston, MA 02110-1301, USA.
*/
-#define FEC_API
+#ifndef INCLUDED_FEC_PUNCTURE_FF_H
+#define INCLUDED_FEC_PUNCTURE_FF_H
-%include "gnuradio.i"
+#include <gnuradio/fec/api.h>
+#include <gnuradio/block.h>
-//load generated python docstrings
-%include "fec_swig_doc.i"
+namespace gr {
+ namespace fec {
-%{
-#include "gnuradio/fec/decode_ccsds_27_fb.h"
-#include "gnuradio/fec/encode_ccsds_27_bb.h"
-%}
+ class FEC_API puncture_ff : virtual public block
+ {
+ public:
+ // gr::fec::puncture_ff::sptr
+ typedef boost::shared_ptr<puncture_ff> sptr;
-%include "gnuradio/fec/decode_ccsds_27_fb.h"
-%include "gnuradio/fec/encode_ccsds_27_bb.h"
+ static sptr make(int delay, int puncpat, int puncholes, int puncsize);
+ };
-GR_SWIG_BLOCK_MAGIC2(fec, decode_ccsds_27_fb);
-GR_SWIG_BLOCK_MAGIC2(fec, encode_ccsds_27_bb);
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_PUNCTURE_FF_H */
diff --git a/gr-fec/lib/CMakeLists.txt b/gr-fec/lib/CMakeLists.txt
index 34c0746..9d1e7d9 100644
--- a/gr-fec/lib/CMakeLists.txt
+++ b/gr-fec/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012-2013 Free Software Foundation, Inc.
+# Copyright 2012-2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -30,6 +30,8 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${GR_FEC_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
+ ${VOLK_INCLUDE_DIRS}
+ ${LOG4CPP_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
@@ -38,14 +40,28 @@ if(ENABLE_GR_CTRLPORT)
include_directories(${ICE_INCLUDE_DIR})
endif(ENABLE_GR_CTRLPORT)
-link_directories(${Boost_LIBRARY_DIRS})
+link_directories(
+ ${Boost_LIBRARY_DIRS}
+ ${LOG4CPP_LIBRARIES}
+)
########################################################################
# Setup library
########################################################################
list(APPEND gnuradio_fec_sources
- decode_ccsds_27_fb_impl.cc
- encode_ccsds_27_bb_impl.cc
+ generic_decoder.cc
+ generic_encoder.cc
+ encoder_impl.cc
+ decoder_impl.cc
+ cc_decoder_impl.cc
+ cc_encoder_impl.cc
+ decode_ccsds_27_fb_impl.cc
+ encode_ccsds_27_bb_impl.cc
+ ber_tools.cc
+ ber_bf_impl.cc
+ conv_bit_corr_bb_impl.cc
+ puncture_ff_impl.cc
+ depuncture_bb_impl.cc
)
#Add Windows DLL resource file if using MSVC
@@ -64,6 +80,7 @@ endif(MSVC)
list(APPEND gnuradio_fec_libs
gnuradio-runtime
+ volk
${Boost_LIBRARIES}
)
diff --git a/gr-fec/lib/ber_bf_impl.cc b/gr-fec/lib/ber_bf_impl.cc
new file mode 100644
index 0000000..566b70b
--- /dev/null
+++ b/gr-fec/lib/ber_bf_impl.cc
@@ -0,0 +1,115 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ber_bf_impl.h"
+#include "ber_tools.h"
+#include <gnuradio/io_signature.h>
+#include <math.h>
+
+namespace gr {
+ namespace fec {
+
+ ber_bf::sptr
+ ber_bf::make(int berminerrors, float ber_limit)
+ {
+ return gnuradio::get_initial_sptr
+ (new ber_bf_impl(berminerrors, ber_limit));
+ }
+
+ ber_bf_impl::ber_bf_impl(int berminerrors, float ber_limit)
+ : block("fec_ber_bf",
+ io_signature::make(2, 2, sizeof(unsigned char)),
+ io_signature::make(1, 1, sizeof(float))),
+ d_total_errors(0), d_berminerrors(berminerrors),
+ d_ber_limit(ber_limit), d_total(0)
+ {
+ }
+
+ ber_bf_impl::~ber_bf_impl()
+ {
+ }
+
+ void
+ ber_bf_impl::forecast(int noutput_items,
+ gr_vector_int& ninput_items_required)
+ {
+ ninput_items_required[0] = 1<<10 * noutput_items;
+ ninput_items_required[1] = 1<<10 * noutput_items;
+ }
+
+ int
+ ber_bf_impl::general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ if(d_total_errors >= d_berminerrors) {
+ return -1;
+ }
+ else {
+ unsigned char *inbuffer0 = (unsigned char *)input_items[0];
+ unsigned char *inbuffer1 = (unsigned char *)input_items[1];
+ float *outbuffer = (float *)output_items[0];
+
+ int items = ninput_items[0] <= ninput_items[1] ? ninput_items[0] :
ninput_items[1];
+
+ if(items > 0) {
+ /*
+ for(int i = 0; i < items; ++i) {
+ if(inbuffer0[i] != inbuffer1[i]) {
+ GR_LOG_INFO(d_logger, boost::format("%1%/%2%: %3% versus %4%")
\
+ % i % items % inbuffer0[i] % inbuffer1[i]);
+ }
+ }
+ GR_LOG_INFO(d_logger, boost::format("%1% errors") \
+ % (compber(inbuffer0, inbuffer1, items)));
+ */
+
+ d_total_errors += compber(inbuffer0, inbuffer1, items);
+ d_total += items;
+ }
+ consume_each(items);
+
+ if(d_total_errors >= d_berminerrors) {
+ outbuffer[0] = log10(((double)d_total_errors)/(d_total * 8.0));
+ GR_LOG_INFO(d_logger, boost::format(" %1% over %2% --> %3%") \
+ % d_total_errors % (d_total * 8) % outbuffer[0]);
+ return 1;
+ }
+ else if(log10(((double)d_berminerrors)/(d_total * 8.0)) < d_ber_limit) {
+ GR_LOG_INFO(d_logger, " Min. BER limit reached");
+ outbuffer[0] = d_ber_limit;
+ d_total_errors = d_berminerrors + 1;
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+ }
+
+ } /* namespace fec */
+}/* namespace gr */
diff --git a/gr-fec/lib/ber_bf_impl.h b/gr-fec/lib/ber_bf_impl.h
new file mode 100644
index 0000000..326c6be
--- /dev/null
+++ b/gr-fec/lib/ber_bf_impl.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_BER_BF_IMPL_H
+#define INCLUDED_FEC_BER_BF_IMPL_H
+
+#include <gnuradio/fec/ber_bf.h>
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API ber_bf_impl : public ber_bf
+ {
+ private:
+ int d_total_errors;
+ int d_berminerrors;
+ float d_ber_limit;
+ int d_total;
+
+ public:
+ ber_bf_impl(int berminerrors = 100, float ber_limit = -7.0);
+ ~ber_bf_impl();
+
+ int general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ void forecast(int noutput_items,
+ gr_vector_int& ninput_items_required);
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_BER_BF_IMPL_H */
diff --git a/gr-fec/lib/ber_tools.cc b/gr-fec/lib/ber_tools.cc
new file mode 100644
index 0000000..675932a
--- /dev/null
+++ b/gr-fec/lib/ber_tools.cc
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along 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 "ber_tools.h"
+
+inline int
+putbit(int word, int loc, int bit)
+{
+ return (((word)&(~((1)<<(loc))))^((bit)<<(loc)));
+}
+
+void
+gaussnoise(float *inbuffer, int buffsize, float sigma)
+{
+ int i;
+ float udrn1=0.0, udrn2=0.0, noise=0.0;
+
+ for(i = 0; i < buffsize;i++) {
+ while((udrn1 = (float)drand48()) < 0.0000001);
+ udrn2 = (float)drand48();
+ noise = sigma*sqrt(-2*log(udrn1))*cos(2*M_PI*udrn2);
+ inbuffer[i] += noise;
+ }
+}
+
+
+int
+compber(unsigned char *inbuffer1, unsigned char *inbuffer2, int buffsize)
+{
+ int i, totaldiff=0;
+ int popcnt[256] =
+ {
+ 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
+ 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+ 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+ 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+ 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+ 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+ 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+ 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
+ };
+
+ for(i = 0; i < buffsize; i++) {
+ totaldiff += popcnt[inbuffer1[i]^inbuffer2[i]];
+ }
+
+ return totaldiff;
+}
+
+void randbuffer(unsigned char *databuffer,int buffsize, int charout)
+{
+ int i;
+ unsigned char randbit;
+
+ for(i = 0; i < buffsize; i++) {
+ // generate random element
+ randbit = (unsigned char)((0x000010000&rand())>>16);
+ // place in the data buffer
+ if(charout == 0)
+ databuffer[i>>3] = putbit(databuffer[i>>3],7-(i&0x7),randbit);
+ else
+ databuffer[i] = randbit;
+ }
+}
+
+void
+char2bin(unsigned char *inbuffer,int buffSize)
+{
+ int i;
+ unsigned char fbit=0;
+
+ for(i = 0; i < buffSize; i++) {
+ if(inbuffer[i] == 0)
+ fbit = 0;
+ else
+ fbit = 1;
+ inbuffer[i>>3] = putbit(inbuffer[i>>3],7-(i&0x7),fbit);
+ }
+}
diff --git a/gr-fec/lib/ber_tools.h b/gr-fec/lib/ber_tools.h
new file mode 100644
index 0000000..038b362
--- /dev/null
+++ b/gr-fec/lib/ber_tools.h
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GNURADIO_FEC_BER_TOOLS_H
+#define INCLUDED_GNURADIO_FEC_BER_TOOLS_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#define BERMINFRAMES (10000)
+#define BERMINERRORS (100)
+#define BERMAXBITS (1000000000)
+
+/*!
+ * Add BPSK gaussian noise with standard deviation equal to sigma to a
+ * floating point input buffer.
+ *
+ * \param inbuffer (float*) buffer containing data to receive additive
+ * gaussian noise
+ * \param buffsize (int) size of \p inbuffer
+ * \param sigma (float) noise power of the guassian random variables
+ */
+void gaussnoise(float *inbuffer, int buffsize, float sigma);
+
+/*!
+ * Compute the number of bit differences between input buffers
+ *
+ * \param inbuffer1 input stream 1 to compare against \p inbuffer2
+ * \param inbuffer2 input stream 2 to be compared against
+ * \param buffsize number of elements in each buffer
+ */
+int compber(unsigned char *inbuffer1, unsigned char *inbuffer2, int buffsize);
+
+/*!
+ * Generate a random buffer of data
+ *
+ * \param databuffer pointer to buffer containing random data
+ * \param buffsize number of elements in each buffer
+ */
+void randbuffer(unsigned char *databuffer, int buffsize, int charout);
+
+/*!
+ * Pack the character buffer
+ *
+ * \param databuffer pointer to buffer containing unpacked chars
+ * \param buffsize number of elements in each buffer
+ */
+void char2bin(unsigned char *inbuffer, int buffsize);
+
+#endif /* INCLUDED_GNURADIO_FEC_BER_TOOLS_H */
+
+
diff --git a/gr-fec/lib/cc_decoder_impl.cc b/gr-fec/lib/cc_decoder_impl.cc
new file mode 100644
index 0000000..1941306
--- /dev/null
+++ b/gr-fec/lib/cc_decoder_impl.cc
@@ -0,0 +1,505 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cc_decoder_impl.h"
+#include <math.h>
+#include <boost/assign/list_of.hpp>
+//#include <volk/volk_typedefs.h>
+#include <volk/volk.h>
+#include <sstream>
+#include <stdio.h>
+#include <vector>
+
+namespace gr {
+ namespace fec {
+ namespace code {
+
+ generic_decoder::sptr
+ cc_decoder::make(int framebits, int k,
+ int rate, std::vector<int> polys,
+ int start_state, int end_state,
+ bool tailbiting, bool terminated,
+ bool truncated, bool streaming)
+ {
+ return generic_decoder::sptr
+ (new cc_decoder_impl(framebits, k, rate, polys,
+ start_state, end_state,
+ tailbiting, terminated,
+ truncated, streaming));
+ }
+
+ cc_decoder_impl::cc_decoder_impl(int framebits, int k,
+ int rate, std::vector<int> polys,
+ int start_state, int end_state,
+ bool tailbiting, bool terminated,
+ bool truncated, bool streaming)
+ : generic_decoder("cc_decoder"),
+ d_tailbiting(tailbiting),
+ d_terminated(terminated),
+ d_truncated(truncated),
+ d_streaming(streaming),
+ d_framebits(framebits),
+ d_k(k),
+ d_rate(rate),
+ d_partial_rate(rate),
+ d_polys(polys),
+ d_start_state_chaining(start_state),
+ d_start_state_nonchaining(start_state),
+ d_end_state_nonchaining(end_state)
+ {
+ d_vp = new struct v;
+
+ d_numstates = 1 << (d_k - 1);
+
+ d_decision_t_size = d_numstates/8; //packed bit array
+
+ if(d_tailbiting) {
+ d_end_state = &d_end_state_chaining;
+ d_veclen = d_framebits + (6 * (d_k - 1));
+ if(posix_memalign((void**)&d_managed_in, 16, d_veclen * d_rate *
sizeof(COMPUTETYPE))) {
+ printf("allocation failed\n");
+ exit(1);
+ }
+ }
+ /*
+ else if(d_trunc_intrinsic) {
+ d_end_state = &d_end_state_nonchaining;
+ d_veclen = d_framebits + d_k - 1;
+ if(posix_memalign((void**)&d_managed_in, 16, d_veclen * d_rate *
sizeof(COMPUTETYPE))){
+ printf("allocation failed\n");
+ exit(1);
+ }
+ int cnt = 0;
+ for(int i = 0; i < d_rate; ++i) {
+ if (d_polys[i] != 1) {
+ cnt++;
+ }
+ }
+ d_partial_rate = cnt;
+ }
+ */
+ else if(d_truncated) {
+ d_end_state = &d_end_state_chaining;
+ d_veclen = d_framebits;
+ }
+ else if(d_terminated) {
+ d_end_state = (end_state == -1) ? &d_end_state_chaining :
&d_end_state_nonchaining;
+ d_veclen = d_framebits + d_k - 1;
+ }
+
+ //streaming
+ else {
+ d_end_state = &d_end_state_chaining;
+ d_veclen = d_framebits + d_k - 1;
+ }
+
+ if(posix_memalign((void**)&d_vp->metrics, 16, 2 * d_numstates *
sizeof(COMPUTETYPE))) {
+ printf("allocation failed\n");
+ exit(1);
+ }
+
+ d_vp->metrics1.t = d_vp->metrics;
+ d_vp->metrics2.t = d_vp->metrics + d_numstates;
+
+ if(posix_memalign((void**)&d_vp->decisions,
16,d_veclen*d_decision_t_size)) {
+ printf("allocation failed\n");
+ exit(1);
+ }
+
+ if(posix_memalign((void**)&Branchtab, 16, sizeof(COMPUTETYPE) *
d_numstates/2*rate)) {
+ printf("allocation failed\n");
+ exit(1);
+ }
+
+ create_viterbi();
+
+ if(d_k-1<8) {
+ d_ADDSHIFT = (8-(d_k-1));
+ d_SUBSHIFT = 0;
+ }
+ else if(d_k-1>8) {
+ d_ADDSHIFT = 0;
+ d_SUBSHIFT = ((d_k-1)-8);
+ }
+ else {
+ d_ADDSHIFT = 0;
+ d_SUBSHIFT = 0;
+ }
+
+ yp_kernel = boost::assign::map_list_of("k=7r=2",
volk_8u_x4_conv_k7_r2_8u);
+
+ std::string k_ = "k=";
+ std::string r_ = "r=";
+
+ std::ostringstream kerneltype;
+ kerneltype << k_ << d_k << r_ << d_rate;
+
+ d_kernel = yp_kernel[kerneltype.str()];
+ }
+
+ cc_decoder_impl::~cc_decoder_impl()
+ {
+ free(d_vp->decisions);
+ free(Branchtab);
+ free(d_vp->metrics);
+ }
+
+ int
+ cc_decoder_impl::get_output_size()
+ {
+ //unpacked bits
+ return d_framebits;
+ }
+
+ int
+ cc_decoder_impl::get_input_size()
+ {
+ if(d_terminated) {
+ return d_rate * (d_framebits + d_k - 1);
+ }
+ /*
+ else if(d_trunc_intrinsic) {
+ int cnt = 0;
+ for(int i = 0; i < d_rate; ++i) {
+ if (d_polys[i] != 1) {
+ cnt++;
+ }
+ }
+ return (d_rate * (d_framebits)) + (cnt * (d_k - 1));
+ }
+ */
+ else {
+ return d_rate * d_framebits;
+ }
+ }
+
+ int
+ cc_decoder_impl::get_input_item_size()
+ {
+ return 1;
+ }
+
+ int
+ cc_decoder_impl::get_history()
+ {
+ if(d_streaming) {
+ return d_rate * (d_k - 1);
+ }
+ else {
+ return 0;
+ }
+ }
+
+ /*const char* cc_decoder_impl::get_output_conversion() {
+ return "unpack";
+ }*/
+
+ float
+ cc_decoder_impl::get_shift()
+ {
+ return 128.0;
+ }
+
+ const char*
+ cc_decoder_impl::get_conversion()
+ {
+ return "uchar";
+ }
+
+ void
+ cc_decoder_impl::create_viterbi()
+ {
+ int state;
+ unsigned int i;
+ partab_init();
+ for(state = 0; state < d_numstates/2; state++) {
+ for(i = 0; i < d_rate; i++) {
+ Branchtab[i*d_numstates/2+state] = (d_polys[i] < 0) ^
parity((2*state) & abs(d_polys[i])) ? 255 : 0;
+ }
+ }
+
+ if(d_streaming) {
+ //printf("streaming\n");
+ d_start_state = &d_start_state_chaining;
+ init_viterbi_unbiased(d_vp);
+ }
+ else if(d_tailbiting) {
+ //printf("tailbiting\n");
+ d_start_state = &d_start_state_nonchaining;
+ init_viterbi_unbiased(d_vp);
+ }
+ else {
+ //printf("other!\n");
+ d_start_state = &d_start_state_nonchaining;
+ init_viterbi(d_vp, *d_start_state);
+ }
+
+ return;
+ }
+
+ int
+ cc_decoder_impl::parity(int x)
+ {
+ x ^= (x >> 16);
+ x ^= (x >> 8);
+ return parityb(x);
+ }
+
+ int
+ cc_decoder_impl::parityb(unsigned char x)
+ {
+ return Partab[x];
+ }
+
+ void
+ cc_decoder_impl::partab_init(void)
+ {
+ int i,cnt,ti;
+
+ /* Initialize parity lookup table */
+ for(i=0;i<256;i++){
+ cnt = 0;
+ ti = i;
+ while(ti){
+ if(ti & 1)
+ cnt++;
+ ti >>= 1;
+ }
+ Partab[i] = cnt & 1;
+ }
+ }
+
+ int
+ cc_decoder_impl::init_viterbi(struct v* vp, int starting_state)
+ {
+ int i;
+
+ if(vp == NULL)
+ return -1;
+ for(i = 0; i < d_numstates; i++) {
+ vp->metrics1.t[i] = 63;
+ }
+
+ vp->old_metrics = vp->metrics1;
+ vp->new_metrics = vp->metrics2;
+ vp->old_metrics.t[starting_state & (d_numstates-1)] = 0; /* Bias known
start state */
+ return 0;
+ }
+
+ int
+ cc_decoder_impl::init_viterbi_unbiased(struct v* vp)
+ {
+ int i;
+
+ if(vp == NULL)
+ return -1;
+ for(i=0;i<d_numstates;i++)
+ vp->metrics1.t[i] = 31;
+
+ vp->old_metrics = vp->metrics1;
+ vp->new_metrics = vp->metrics2;
+ //no bias step
+ return 0;
+ }
+
+ int
+ cc_decoder_impl::find_endstate()
+ {
+ COMPUTETYPE* met = (d_k%2 == 0)? d_vp->new_metrics.t :
d_vp->old_metrics.t;
+ COMPUTETYPE min = met[0];
+ int state = 0;
+ for(int i = 1; i < d_numstates; ++i) {
+ if(met[i] < min) {
+ min = met[i];
+ state = i;
+ }
+ }
+ return state;
+ }
+
+ int
+ cc_decoder_impl::update_viterbi_blk(const COMPUTETYPE* syms, int nbits)
+ {
+ DECISIONTYPE *d;
+
+ d = d_vp->decisions;
+ //going to have to use nbits for tailbiting?
+ //memset(d,0,d_decision_t_size * (d_framebits+d_k-1));//use volk here?
+ memset(d,0,d_decision_t_size * nbits);//use volk here?
+
+ //d_kernel( d_vp->new_metrics.t, d_vp->old_metrics.t, syms, d,
d_framebits, d_k - 1, Branchtab);
+ d_kernel( d_vp->new_metrics.t, d_vp->old_metrics.t, syms, d, nbits -
(d_k - 1), d_k -1, Branchtab);
+
+ return 0;
+ }
+
+ int
+ cc_decoder_impl::chainback_viterbi(DECISIONTYPE* data,
+ unsigned int nbits,
+ unsigned int endstate,
+ unsigned int tailsize)
+ {
+ DECISIONTYPE *d;
+
+ /* ADDSHIFT and SUBSHIFT make sure that the thing returned is a byte.
*/
+ d = d_vp->decisions;
+ /* Make room beyond the end of the encoder register so we can
+ * accumulate a full byte of decoded data
+ */
+
+ endstate = (endstate%d_numstates) << d_ADDSHIFT;
+
+ /* The store into data[] only needs to be done every 8 bits.
+ * But this avoids a conditional branch, and the writes will
+ * combine in the cache anyway
+ */
+
+ d += tailsize * d_decision_t_size ; /* Look past tail */
+ int retval;
+ int dif = tailsize - (d_k - 1);
+ //printf("break, %d, %d\n", dif, (nbits+dif)%d_framebits);
+ decision_t dec;
+ while(nbits-- > d_framebits - (d_k - 1)) {
+ int k;
+ dec.t = &d[nbits * d_decision_t_size];
+ k = (dec.w[(endstate>>d_ADDSHIFT)/32] >>
((endstate>>d_ADDSHIFT)%32)) & 1;
+
+ endstate = (endstate >> 1) | (k << (d_k-2+d_ADDSHIFT));
+ //data[((nbits+dif)%nbits)>>3] = endstate>>d_SUBSHIFT;
+ //printf("%d, %d\n", k, (nbits+dif)%d_framebits);
+ data[((nbits+dif)%d_framebits)] = k;
+
+ retval = endstate;
+ }
+ nbits += 1;
+
+ while(nbits-- != 0) {
+ int k;
+
+ dec.t = &d[nbits * d_decision_t_size];
+
+ k = (dec.w[(endstate>>d_ADDSHIFT)/32] >>
((endstate>>d_ADDSHIFT)%32)) & 1;
+
+ endstate = (endstate >> 1) | (k << (d_k-2+d_ADDSHIFT));
+ data[((nbits+dif)%d_framebits)] = k;
+ }
+ //printf("%d, %d, %d, %d, %d, %d, %d, %d\n",
data[4095],data[4094],data[4093],data[4092],data[4091],data[4090],data[4089],data[4088]);
+ return retval >> d_ADDSHIFT;
+ }
+
+ void
+ cc_decoder_impl::set_framebits(int framebits)
+ {
+ d_framebits = framebits;
+ if(d_tailbiting) {
+ d_veclen = d_framebits + (6 * (d_k - 1));
+ }
+ else if(d_truncated) {
+ d_veclen = d_framebits;
+ }
+ else {
+ d_veclen = d_framebits + d_k - 1;
+ }
+ }
+
+ void
+ cc_decoder_impl::generic_work(void *inBuffer, void *outBuffer)
+ {
+ const COMPUTETYPE *in = (const COMPUTETYPE *) inBuffer;
+ DECISIONTYPE *out = (DECISIONTYPE *) outBuffer;
+
+ if(d_tailbiting) {
+ memcpy(d_managed_in, in, d_framebits * d_rate * sizeof(COMPUTETYPE));
+ memcpy(d_managed_in + d_framebits * d_rate * sizeof(COMPUTETYPE), in,
+ (d_veclen - d_framebits) * d_rate * sizeof(COMPUTETYPE));
+ /*for(int i = 0; i < d_veclen * d_rate; ++i) {
+ printf("%u...%d\n", d_managed_in[i], i);
+ }*/
+ update_viterbi_blk(d_managed_in, d_veclen);
+ d_end_state_chaining = find_endstate();
+ chainback_viterbi(&out[0], d_framebits, *d_end_state, d_veclen -
d_framebits);
+ init_viterbi_unbiased(d_vp);
+ }
+
+ /*
+ else if(d_trunc_intrinsic) {
+ memcpy(d_managed_in, in, d_framebits * d_rate * sizeof(COMPUTETYPE));
+ for(int i = 0; i < (d_k - 1); ++i) {
+ int cnt = 0;
+ for(int j = 0; j < d_rate; ++j) {
+ if(d_polys[j] != 1) {
+
+ d_managed_in[(d_framebits * d_rate) + (i * d_rate) + j] =
+ in[(d_framebits * d_rate) + (i * d_partial_rate) + cnt++];
+ }
+ else {
+
+ d_managed_in[(d_framebits * d_rate) + (i * d_rate) + j] =
+ (((*d_end_state) >> (d_k - 2 - i)) & 1) * ((1 <<
(sizeof(COMPUTETYPE) * 8)) - 1);
+ }
+ }
+ }
+ update_viterbi_blk(d_managed_in, d_veclen);
+ d_end_state_chaining = find_endstate();
+ chainback_viterbi(&out[0], d_framebits, *d_end_state, d_veclen -
d_framebits);
+ init_viterbi(d_vp, *d_start_state);
+ }
+ */
+
+ else if(d_truncated) {
+ update_viterbi_blk(&in[0], d_veclen);
+ d_end_state_chaining = find_endstate();
+ //printf("...end %d\n", d_end_state_chaining);
+ for(unsigned int i = 0; i < d_k-1; ++i) {
+ out[d_veclen - 1 - i] = ((*d_end_state) >> i) & 1;
+ }
+ d_start_state_chaining = chainback_viterbi(&out[0], d_framebits -
(d_k - 1),
+ *d_end_state, d_k - 1);
+ init_viterbi(d_vp, *d_start_state);
+ /*for(int i = d_framebits - 25; i < d_framebits; ++i) {
+ //for(int i = 0; i < 25; ++i) {
+ printf("%u... : %u\n", out[i], i);
+ }*/
+ }
+ //terminated or streaming
+ else {
+ update_viterbi_blk(&in[0], d_veclen);
+ d_end_state_chaining = find_endstate();
+ //printf("es: %d\n", d_end_state_chaining);
+ d_start_state_chaining = chainback_viterbi(&out[0], d_framebits,
*d_end_state,
+ d_veclen - d_framebits);
+
+ init_viterbi(d_vp, *d_start_state);
+ /*for(int i = d_framebits * d_rate - 25; i < d_framebits * d_rate;
++i) {
+ printf("%u... : %u\n", in[i], i);
+ }*/
+ }
+ }
+
+ } /* namespace code */
+ } /* namespace fec */
+} /* namespace gr */
+
diff --git a/gr-fec/lib/cc_decoder_impl.h b/gr-fec/lib/cc_decoder_impl.h
new file mode 100644
index 0000000..cad1df9
--- /dev/null
+++ b/gr-fec/lib/cc_decoder_impl.h
@@ -0,0 +1,104 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_CC_DECODER_IMPL_H
+#define INCLUDED_FEC_CC_DECODER_IMPL_H
+
+#include <map>
+#include <string>
+#include <gnuradio/fec/cc_decoder.h>
+#include <gnuradio/fec/cc_common.h>
+
+namespace gr {
+ namespace fec {
+ namespace code {
+
+ class FEC_API cc_decoder_impl : public cc_decoder
+ {
+ private:
+ //plug into the generic fec api
+ int get_output_size();
+ int get_input_size();
+ int get_history();
+ float get_shift();
+ int get_input_item_size();
+ const char* get_conversion();
+ //const char* get_output_conversion();
+
+ //everything else...
+ void create_viterbi();
+ int init_viterbi(struct v* vp, int starting_state);
+ int init_viterbi_unbiased(struct v* vp);
+ int update_viterbi_blk(const COMPUTETYPE* syms, int nbits);
+ int chainback_viterbi(unsigned char* data, unsigned int nbits,
+ unsigned int endstate, unsigned int tailsize);
+ int find_endstate();
+ int tester[12];
+
+ COMPUTETYPE *Branchtab;
+ unsigned char Partab[256];
+
+ bool d_tailbiting;
+ bool d_terminated;
+ bool d_truncated;
+ bool d_streaming;
+ int d_ADDSHIFT;
+ int d_SUBSHIFT;
+ conv_kernel d_kernel;
+ unsigned int d_framebits;
+ unsigned int d_k;
+ unsigned int d_rate;
+ unsigned int d_partial_rate;
+ std::vector<int> d_polys;
+ struct v* d_vp;
+ COMPUTETYPE* d_managed_in;
+ int d_numstates;
+ int d_decision_t_size;
+ int *d_start_state;
+ int d_start_state_chaining;
+ int d_start_state_nonchaining;
+ int *d_end_state;
+ int d_end_state_chaining;
+ int d_end_state_nonchaining;
+ unsigned int d_veclen;
+ int parity(int x);
+ int parityb(unsigned char x);
+ void partab_init(void);
+ std::map<std::string, conv_kernel> yp_kernel;
+
+ public:
+ cc_decoder_impl(int framebits, int k,
+ int rate, std::vector<int> polys,
+ int start_state = 0, int end_state = -1,
+ bool tailbiting = false, bool terminated = false,
+ bool truncated = false, bool streaming = false);
+ ~cc_decoder_impl();
+
+ void set_framebits(int framebits);
+ void generic_work(void *inBuffer, void *outbuffer);
+ };
+
+ } /* namespace code */
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_CC_DECODER_IMPL_H */
diff --git a/gr-fec/lib/cc_encoder_impl.cc b/gr-fec/lib/cc_encoder_impl.cc
new file mode 100644
index 0000000..4e5e001
--- /dev/null
+++ b/gr-fec/lib/cc_encoder_impl.cc
@@ -0,0 +1,202 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cc_encoder_impl.h"
+#include <math.h>
+#include <boost/assign/list_of.hpp>
+#include <volk/volk_typedefs.h>
+#include <volk/volk.h>
+#include <sstream>
+#include <stdio.h>
+#include <vector>
+#include <gnuradio/fec/generic_encoder.h>
+#include <gnuradio/fec/cc_common.h>
+
+namespace gr {
+ namespace fec {
+ namespace code {
+
+ generic_encoder::sptr
+ cc_encoder::make(int framebits, int k,
+ int rate, std::vector<int> polys,
+ int start_state, int end_state,
+ bool tailbiting, bool terminated,
+ bool truncated, bool streaming)
+ {
+ return generic_encoder::sptr
+ (new cc_encoder_impl(framebits, k,
+ rate, polys,
+ start_state, end_state,
+ tailbiting, terminated,
+ truncated, streaming));
+ }
+
+ cc_encoder_impl::cc_encoder_impl(int framebits, int k,
+ int rate, std::vector<int> polys,
+ int start_state, int end_state,
+ bool tailbiting, bool terminated,
+ bool truncated, bool streaming)
+ : d_framebits(framebits),
+ d_rate(rate), d_k(k), d_polys(polys),
+ d_start_state(start_state),
+ d_tailbiting(tailbiting), d_terminated(terminated),
+ d_truncated(truncated), d_streaming(streaming)
+ {
+ partab_init();
+ }
+
+ cc_encoder_impl::~cc_encoder_impl()
+ {
+ }
+
+ int
+ cc_encoder_impl::get_output_size()
+ {
+ if(d_terminated) {
+ return d_rate * (d_framebits + d_k - 1);
+ }
+ /*
+ else if(d_trunc_intrinsic) {
+ int cnt = 0;
+ for(int i = 0; i < d_rate; ++i) {
+ if (d_polys[i] != 1) {
+ cnt++;
+ }
+ }
+ return (d_rate * (d_framebits)) + (cnt * (d_k - 1));
+ }
+ */
+ else {
+ return d_rate * d_framebits;
+ }
+ }
+
+ int
+ cc_encoder_impl::get_input_size()
+ {
+ return d_framebits;
+ }
+
+ int
+ cc_encoder_impl::parity(int x)
+ {
+ x ^= (x >> 16);
+ x ^= (x >> 8);
+ return parityb(x);
+ }
+
+ int
+ cc_encoder_impl::parityb(unsigned char x)
+ {
+ return Partab[x];
+ }
+
+ void
+ cc_encoder_impl::partab_init(void)
+ {
+ int i,cnt,ti;
+
+ /* Initialize parity lookup table */
+ for(i=0;i<256;i++){
+ cnt = 0;
+ ti = i;
+ while(ti){
+ if(ti & 1)
+ cnt++;
+ ti >>= 1;
+ }
+ Partab[i] = cnt & 1;
+ }
+ }
+
+ void
+ cc_encoder_impl::generic_work(void *inBuffer, void *outBuffer)
+ {
+ const unsigned char *in = (const unsigned char *) inBuffer;
+ float *out = (float *) outBuffer;
+
+ int my_state = d_start_state;
+ //printf("ms: %d\n", my_state);
+
+ if(d_tailbiting) {
+ for(unsigned int i = 0; i < d_k - 1; ++i) {
+ my_state = (my_state << 1) | (in[d_framebits - (d_k - 1) + i] &
1);
+ }
+ }
+ //printf("start... %d\n", my_state & ((1 << (d_k - 1)) - 1));
+
+ for(unsigned int i = 0; i < d_framebits; ++i) {
+ my_state = (my_state << 1) | (in[i] & 1);
+ for(unsigned int j = 0; j < d_rate; ++j) {
+ out[i * d_rate + j] = parity(my_state & d_polys[j]) == 0 ? -1.0 :
1.0;
+ }
+ }
+
+ if(d_terminated) {
+ for(unsigned int i = 0; i < d_k - 1; ++i) {
+ my_state = (my_state << 1) | ((d_start_state >> (d_k - 2 - i)) &
1);
+ for(unsigned int j = 0; j < d_rate; ++j) {
+ out[(i + d_framebits) * d_rate + j] = parity(my_state &
d_polys[j]) == 0 ? -1.0 : 1.0;
+ }
+ }
+ }
+
+ /*
+ if(d_trunc_intrinsic) {
+ for(int i = 0; i < d_k - 1; ++i) {
+ my_state = (my_state << 1) | ((d_start_state >> d_k - 2 - i) & 1);
+ int cnt = 0;
+ for(int j = 0; j < d_rate; ++j) {
+ if(d_polys[j] != 1) {
+ out[(i + d_framebits) * d_rate + cnt] = parity(my_state &
d_polys[j]) == 0 ? -1.0 : 1.0;
+ cnt++;
+ }
+ }
+ }
+ }
+ */
+
+ if(d_truncated) {
+ //printf("end... %d\n", my_state & ((1 << (d_k - 1)) - 1));
+ my_state = d_start_state;
+ }
+
+ d_start_state = my_state;
+ //d_start_state = my_state & (1 << d_k -1) - 1;
+ //printf("ms: %d\n", d_start_state);
+
+ /*
+ for(int i = d_framebits * d_rate - 25; i < d_framebits * d_rate; ++i) {
+ //for(int i = 0; i < 25; ++i) {
+ printf("...%f : %u\n", out[i], i);
+ }
+ */
+ }
+
+ } /* namespace code */
+ } /* namespace fec */
+} /* namespace gr */
+
diff --git a/gr-fec/lib/cc_encoder_impl.h b/gr-fec/lib/cc_encoder_impl.h
new file mode 100644
index 0000000..e7a17bd
--- /dev/null
+++ b/gr-fec/lib/cc_encoder_impl.h
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_CC_ENCODER_IMPL_H
+#define INCLUDED_FEC_CC_ENCODER_IMPL_H
+
+#include <map>
+#include <string>
+#include <gnuradio/fec/cc_encoder.h>
+
+namespace gr {
+ namespace fec {
+ namespace code {
+
+ class FEC_API cc_encoder_impl : public cc_encoder
+ {
+ private:
+ //plug into the generic fec api
+ void generic_work(void *inBuffer, void *outbuffer);
+ int get_output_size();
+ int get_input_size();
+
+ //everything else...
+ unsigned char Partab[256];
+ unsigned int d_framebits;
+ unsigned int d_rate;
+ unsigned int d_k;
+ std::vector<int> d_polys;
+ struct v* d_vp;
+ int d_numstates;
+ int d_decision_t_size;
+ int d_start_state;
+ bool d_tailbiting;
+ bool d_terminated;
+ bool d_truncated;
+ bool d_streaming;
+ int parity(int x);
+ int parityb(unsigned char x);
+ void partab_init(void);
+
+ public:
+ cc_encoder_impl(int framebits, int k,
+ int rate, std::vector<int> polys,
+ int start_state = 0, int end_state = 0,
+ bool tailbiting = false, bool terminated = false,
+ bool truncated = false, bool streaming = true);
+ ~cc_encoder_impl();
+ };
+
+ } /* namespace code */
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_CC_ENCODER_IMPL_H */
diff --git a/gr-fec/lib/conv_bit_corr_bb_impl.cc
b/gr-fec/lib/conv_bit_corr_bb_impl.cc
new file mode 100644
index 0000000..48de061
--- /dev/null
+++ b/gr-fec/lib/conv_bit_corr_bb_impl.cc
@@ -0,0 +1,258 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "conv_bit_corr_bb_impl.h"
+#include <gnuradio/io_signature.h>
+#include <gnuradio/messages/msg_passing.h>
+#include <stdio.h>
+
+namespace gr {
+ namespace fec {
+
+ conv_bit_corr_bb::sptr
+ conv_bit_corr_bb::make(std::vector<unsigned long long> correlator,
+ int corr_sym, int corr_len, int cut,
+ int flush, float thresh)
+ {
+ return gnuradio::get_initial_sptr
+ (new conv_bit_corr_bb_impl(correlator, corr_sym, corr_len,
+ cut, flush, thresh));
+ }
+
+ conv_bit_corr_bb_impl::conv_bit_corr_bb_impl(std::vector<unsigned long
long> correlator,
+ int corr_sym, int corr_len,
int cut,
+ int flush, float thresh)
+ : block("conv_bit_corr_bb",
+ io_signature::make(1, 1, sizeof(unsigned char)),
+ io_signature::make(1, 1, sizeof(unsigned char))),
+ d_acquire(-1),
+ d_produce(0),
+ d_message(0),
+ d_thresh(cut * thresh),
+ d_corr_len(corr_len),
+ d_corr_sym(corr_sym),
+ d_lane(0),
+ d_op(0),
+ d_flush(flush),
+ d_flush_count(0),
+ d_cut(cut),
+ d_counter(cut),
+ d_data_garble_rate(0.0),
+ d_havelock(false)
+ //d_acquire_track(-1)
+
+// d_msgrecv_rpc(alias(), "messages_recieved", &d_msgrecv,
+// pmt::mp(0), pmt::mp(65536), pmt::mp(0),
+// "messages", "Asynch Messages Recieved",
+// RPC_PRIVLVL_MIN, DISPTIME | DISPOPTSTRIP),
+// d_msgsent_rpc(alias(), "messages_sent", &d_msgsent,
+// pmt::mp(0), pmt::mp(65536), pmt::mp(0),
+// "messages", "Asynch Messages Sent",
+// RPC_PRIVLVL_MIN, DISPTIME | DISPOPTSTRIP),
+// d_flush_rpc(alias(), "flush_constant", (int*)&d_flush,
+// pmt::mp(0), pmt::mp(1), pmt::mp(0),
+// "int", "Flush Distance",
+// RPC_PRIVLVL_MIN, DISPTIME | DISPOPTSTRIP),
+// d_cut_rpc(alias(), "integration_period", &d_cut,
+// pmt::from_uint64(0), pmt::from_uint64(65536),
pmt::from_uint64(d_cut),
+// "uint64_t", "Integration Time"),
+// d_data_garble_rate_rpc(alias(), "norm_garble_rate",
&d_data_garble_rate,
+// pmt::mp(0.0f), pmt::mp(0.0f), pmt::mp(1.0f),
+// "normalized_garble_rate", "Normalized Data
Garble Rate",
+// RPC_PRIVLVL_MIN),
+// d_havelock_rpc(alias(), "locked", &d_havelock,
+// pmt::mp(0), pmt::mp(1), pmt::mp(0),
+// "bool","Sync Locked",
+// RPC_PRIVLVL_MIN, DISPTIME)
+ {
+ //big correlator mode (ugh)
+ std::vector<unsigned char> temp;
+ for(unsigned int k = 0; k < d_corr_sym; ++k) {
+ d_acc.push_back(0);
+ }
+ for(unsigned int i = 0; i < d_corr_len; ++i) {
+ if((correlator[i/64] >> (64 - (i%64) - 1)) & 1) {
+ temp.push_back(i);
+ }
+ }
+ d_correlator.push_back(temp);
+
+ for(unsigned int j = 0; j < d_correlator.size(); ++j) {
+ std::vector<int> temp(d_corr_sym);
+ d_score_keeper.push_back(temp);
+ }
+
+ set_history(d_corr_len + d_corr_sym);
+ d_flush_count = d_corr_len + d_corr_sym - 1;
+ set_output_multiple(d_corr_sym);
+ }
+
+ conv_bit_corr_bb_impl::~conv_bit_corr_bb_impl()
+ {
+ }
+
+ void
+ conv_bit_corr_bb_impl::catch_msg(pmt::pmt_t msg)
+ {
+ //stub code
+ d_msgrecv++;
+ }
+
+ int
+ conv_bit_corr_bb_impl::general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ if(d_flush_count > 0) {
+ int items = (ninput_items[0] > static_cast<int>(d_flush_count)) ?
d_flush_count : ninput_items[0];
+ consume_each(items);
+ d_flush_count -= items;
+ return 0;
+ }
+
+ const uint8_t *in = (const uint8_t *) input_items[0];
+ uint8_t *score_in = (uint8_t *) input_items[0];
+
+ //counting on 1:1 forecast + history to provide enough ninput_items...
may need to insert check
+ //printf("%d, %d, %d\n", ninput_items[0], noutput_items, d_counter);
+ int correlation_cycles = (noutput_items/output_multiple() <=
static_cast<int>(d_counter)) ? \
+ noutput_items/output_multiple() : d_counter;
+
+
+ for(int p = 0; p < correlation_cycles; ++p) {
+ //reset scores
+ for(unsigned int j = 0; j < d_correlator.size(); ++j) {
+ for(unsigned int i = 0; i < d_corr_sym; ++i) {
+ d_score_keeper[j][i] = 0;
+ }
+ }
+
+ //correlate against each correlation constant
+ for(unsigned int j = 0; j < d_correlator.size(); ++j) {
+ for(unsigned int k = 0; k < d_corr_sym; ++k) {
+ for(unsigned int i = 0; i < d_correlator[j].size(); ++i) {
+ d_score_keeper[j][k] += (score_in[d_correlator[j][i] + k] >=
128) ? 1 : 0;
+ }
+ }
+
+ for(unsigned int k = 0; k < d_corr_sym; ++k) {
+ d_acc[j * (d_corr_sym) + k] += d_score_keeper[j][k] % 2;
+ }
+ }
+ score_in += d_corr_sym;
+ }
+
+ //decrement the cut counter
+
+ d_counter -= correlation_cycles;
+
+ //d_counter == 0: check the accumulator and update states
+ if(d_counter == 0) {
+ d_message = 1;
+ d_produce = 0;
+ float my_min = 1.0;
+ for(unsigned int i = 0; (i < d_correlator.size()) && (!d_produce); ++i)
{
+ for(unsigned int k = 0; k < d_corr_sym; ++k) {
+
+ my_min = (d_acc[i * (d_corr_sym) + k]/(float)d_cut < my_min) ? \
+ d_acc[i * (d_corr_sym) + k]/(float)d_cut:my_min;
+
+ if(d_acc[i * (d_corr_sym) + k] < d_thresh) {
+ d_produce = 1;
+ d_message = 0;
+ d_acquire = k;
+ d_lane = i + 1;
+ d_op = 1;
+ //printf("winner: lane %u, punc_cycle %u, pos/neg corr %d\n", i,
k, d_op);
+ break;
+ }
+ else if(d_acc[i * (d_corr_sym) + k] > (d_cut - d_thresh)) {
+ d_acquire = k;
+ d_lane = i + 1;
+ d_op = -1;
+ //printf("winner: lane %u, punc_cycle %u, pos/neg corr %d\n", i,
k, d_op);
+ break;
+ }
+ }
+ d_data_garble_rate = 100.0 *
data_garble_rate(d_correlator[i].size(), my_min);
+ d_havelock = d_data_garble_rate < 3;
+ }
+
+ //clear the accumulator, reset the counter
+ d_counter = d_cut;
+ for(unsigned int i = 0; i < d_correlator.size(); ++i) {
+ for(unsigned int k = 0; k < d_corr_sym; ++k) {
+ d_acc[i * (d_corr_sym) + k] = 0;
+ }
+ }
+
+ //examine the new states and react to environment, make a final
production decision
+ if(d_message) {
+ d_msgsent++;
+ //stub code
+ d_message = 0;
+ }
+ }
+ //states are set
+
+ if(d_produce) {
+ //printf("producing\n");
+ unsigned char *out = (unsigned char *) output_items[0];
+ memcpy(out, &(in[d_acquire]),
correlation_cycles*d_corr_sym*sizeof(unsigned char));
+
+ consume_each(d_corr_sym * correlation_cycles);
+ return d_corr_sym * correlation_cycles;
+ }
+
+ else {
+ consume_each(d_corr_sym * correlation_cycles);
+ return 0;
+ }
+ }
+
+ float
+ conv_bit_corr_bb_impl::data_garble_rate(int taps, float target)
+ {
+ double base,expo,answer;
+
+ if(target > 0.5)
+ target=1-target;
+
+ base=1.0-2.0*target;
+ expo=(double) 1/taps;
+ answer=0.5*(1-pow(base,expo));
+
+ if((errno==EDOM) || (errno==ERANGE)) {
+ fprintf(stderr,"Out of range errors while computing garble rate.\n");
+ exit(-1);
+ }
+ return answer;
+ }
+
+ } /* namespace fec */
+} /* namespace gr */
+
diff --git a/gr-fec/lib/conv_bit_corr_bb_impl.h
b/gr-fec/lib/conv_bit_corr_bb_impl.h
new file mode 100644
index 0000000..509ad6f
--- /dev/null
+++ b/gr-fec/lib/conv_bit_corr_bb_impl.h
@@ -0,0 +1,97 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_CONV_BIT_CORR_BB_IMPL_H
+#define INCLUDED_FEC_CONV_BIT_CORR_BB_IMPL_H
+
+#include <gnuradio/fec/conv_bit_corr_bb.h>
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API conv_bit_corr_bb_impl : public conv_bit_corr_bb
+ {
+ private:
+ std::vector< std::vector<int> > d_score_keeper;
+
+ int d_angry_fop;
+ int d_acquire;
+ //int d_acquire_track;
+ unsigned int d_produce;
+ unsigned int d_message;
+ unsigned int d_thresh;
+ unsigned int d_corr_len;
+ unsigned int d_corr_sym;
+ unsigned int d_lane;
+ unsigned int d_op;
+ unsigned int d_flush;
+ unsigned int d_flush_count;
+ std::vector< std::vector<unsigned char> > d_correlator;
+ std::vector<unsigned int> d_acc;
+ uint64_t d_cut;
+ uint64_t d_counter;
+ float d_data_garble_rate;
+
+ void alert_fops();
+
+// //rpcbasic_register_get<conv_bit_corr_bb, std::vector< int> >
d_correlator_rpc;
+// rpcbasic_register_variable_rw<uint64_t> d_cut_rpc; // integration
period
+// rpcbasic_register_variable_rw<int> d_flush_rpc; // time to flush
+// rpcbasic_register_variable<uint64_t> d_msgsent_rpc;
+// rpcbasic_register_variable<uint64_t> d_msgrecv_rpc;
+// rpcbasic_register_variable<float> d_data_garble_rate_rpc;
+
+ uint64_t d_msgsent,d_msgrecv;
+ std::vector<int> get_corr()
+ {
+ std::vector<int> bits;
+ if(d_correlator.size() < 1) {
+ return bits;
+ }
+ for(size_t i = 0; i < d_correlator[0].size(); i++) {
+ bits.push_back(d_correlator[0][i]);
+ }
+ return bits;
+ }
+
+ bool d_havelock;
+ //rpcbasic_register_variable<bool> d_havelock_rpc;
+
+ public:
+ conv_bit_corr_bb_impl(std::vector<unsigned long long> correlator,
+ int corr_sym, int corr_len, int cut,
+ int flush, float thresh);
+ ~conv_bit_corr_bb_impl();
+
+ void catch_msg(pmt::pmt_t msg);
+ int general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ float data_garble_rate(int taps, float target);
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_CONV_BIT_CORR_BB_IMPL_H */
diff --git a/gr-fec/lib/decoder_impl.cc b/gr-fec/lib/decoder_impl.cc
new file mode 100644
index 0000000..30132d0
--- /dev/null
+++ b/gr-fec/lib/decoder_impl.cc
@@ -0,0 +1,121 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "decoder_impl.h"
+#include <gnuradio/io_signature.h>
+#include <stdio.h>
+
+namespace gr {
+ namespace fec {
+
+ decoder::sptr
+ decoder::make(generic_decoder::sptr my_decoder,
+ size_t input_item_size,
+ size_t output_item_size)
+ {
+ return gnuradio::get_initial_sptr
+ ( new decoder_impl(my_decoder, input_item_size, output_item_size));
+ }
+
+ decoder_impl::decoder_impl(generic_decoder::sptr my_decoder,
+ size_t input_item_size,
+ size_t output_item_size)
+ : block("fec_decoder",
+ io_signature::make(1, 1, input_item_size),
+ io_signature::make(1, 1, output_item_size)),
+ d_input_item_size(input_item_size),
d_output_item_size(output_item_size)
+ {
+ set_fixed_rate(true);
+
set_relative_rate((double)(my_decoder->get_output_size())/my_decoder->get_input_size());
+
+ //want to guarantee you have enough to run at least one time...
+ //remember! this is not a sync block... set_output_multiple does not
+ //actually guarantee the output multiple... it DOES guarantee how many
+ //outputs (hence inputs) are made available... this is WEIRD to do in
+ //GNU Radio, and the algorithm is sensitive to this value
+ set_output_multiple(my_decoder->get_output_size() +
(my_decoder->get_history() ) );
+ d_inbuf = buf_sptr(new unsigned char[(my_decoder->get_input_size() +
my_decoder->get_history())*input_item_size]);
+ d_decoder = my_decoder;
+ }
+
+ int
+ decoder_impl::fixed_rate_ninput_to_noutput(int ninput)
+ {
+ return
(int)(((d_decoder->get_output_size()/(double)d_decoder->get_input_size()) *
ninput) + .5);
+ }
+
+ int
+ decoder_impl::fixed_rate_noutput_to_ninput(int noutput)
+ {
+ return
(int)(((d_decoder->get_input_size()/(double)d_decoder->get_output_size()) *
noutput) + .5);
+ }
+
+ void
+ decoder_impl::forecast(int noutput_items,
+ gr_vector_int& ninput_items_required)
+ {
+ ninput_items_required[0] =
(int)(((d_decoder->get_input_size()/(double)d_decoder->get_output_size()) *
noutput_items) + .5);
+ }
+
+ int
+ decoder_impl::general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *inBuffer = (unsigned char*)input_items[0];
+ unsigned char *outBuffer = (unsigned char *)output_items[0];
+
+ int outnum = (int)(((1.0/relative_rate()) * noutput_items) + .5);
+ int innum = (int)(relative_rate() * (ninput_items[0] -
d_decoder->get_history()) + .5)/(output_multiple() - d_decoder->get_history());
+
+ int items = (outnum <= ninput_items[0] - d_decoder->get_history()) ?
+ noutput_items/(output_multiple() - d_decoder->get_history()) :
+ innum;
+
+ //GR_LOG_DEBUG(d_debug_logger, boost::formt("%1%, %2%, %3%") \
+ // % outnum % ninput_items[0] % items);
+
+ for(int i = 0; i < items; ++i) {
+ memcpy((void *)d_inbuf.get(),
+ inBuffer+(i*(d_decoder->get_input_size()) * d_input_item_size),
+ (d_decoder->get_input_size() + d_decoder->get_history()) *
d_input_item_size);
+
+ d_decoder->generic_work((void*)d_inbuf.get(),
+
(void*)(outBuffer+(i*d_decoder->get_output_size()*d_output_item_size)));
+ }
+
+ // GR_LOG_DEBUG(d_debug_logger, boost::format("consumed %1%") \
+ // % (int)(((1.0/relative_rate())*items*(output_multiple() -
d_decoder->get_history())) + .5));
+ // GR_LOG_DEBUG(d_debug_logger, boost::format("returned %1%") \
+ // % (items * (output_multiple() -
d_decoder->get_history())));
+
+ consume_each((int)(((1.0/relative_rate()) * items * (output_multiple() -
d_decoder->get_history())) + .5));
+ return items * (output_multiple() - d_decoder->get_history());
+ }
+
+ } /* namespace fec */
+} /* namespace gr */
diff --git a/gr-fec/lib/decoder_impl.h b/gr-fec/lib/decoder_impl.h
new file mode 100644
index 0000000..92cc537
--- /dev/null
+++ b/gr-fec/lib/decoder_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_DECODER_IMPL_H
+#define INCLUDED_FEC_DECODER_IMPL_H
+
+#include <gnuradio/fec/decoder.h>
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API decoder_impl : public decoder
+ {
+ private:
+ generic_decoder::sptr d_decoder;
+ size_t d_input_item_size;
+ size_t d_output_item_size;
+ buf_sptr d_inbuf;
+
+ public:
+ decoder_impl(generic_decoder::sptr my_decoder,
+ size_t input_item_size,
+ size_t output_item_size);
+
+ int general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ int fixed_rate_ninput_to_noutput(int ninput);
+ int fixed_rate_noutput_to_ninput(int noutput);
+ void forecast(int noutput_items,
+ gr_vector_int& ninput_items_required);
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_DECODER_IMPL_H */
diff --git a/gr-fec/lib/depuncture_bb_impl.cc b/gr-fec/lib/depuncture_bb_impl.cc
new file mode 100644
index 0000000..b353f99
--- /dev/null
+++ b/gr-fec/lib/depuncture_bb_impl.cc
@@ -0,0 +1,132 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "depuncture_bb_impl.h"
+#include <gnuradio/io_signature.h>
+#include <boost/bind.hpp>
+#include <pmt/pmt.h>
+#include <string>
+#include <stdio.h>
+
+namespace gr {
+ namespace fec {
+
+ depuncture_bb::sptr
+ depuncture_bb::make(int delay, int puncpat, int puncholes, int puncsize)
+ {
+ return gnuradio::get_initial_sptr
+ (new depuncture_bb_impl(delay, puncpat, puncholes, puncsize));
+ }
+
+ depuncture_bb_impl::depuncture_bb_impl(int delay, int puncpat,
+ int puncholes, int puncsize)
+ : block("depuncture_bb",
+ io_signature::make(1, 1, sizeof(unsigned char)),
+ io_signature::make(1, 1, sizeof(unsigned char))),
+ d_delay(delay), d_puncholes(puncholes), d_puncsize(puncsize)
+ {
+ for(int i = 0; i < d_delay; ++i) {
+ puncpat = ((puncpat & 1) << (d_puncsize - 1)) + (puncpat >> 1);
+ }
+ d_puncpat = puncpat;
+
+ set_fixed_rate(true);
+ set_relative_rate((double)d_puncsize/(d_puncsize - d_puncholes));
+ set_output_multiple(d_puncsize);
+ //set_msg_handler(boost::bind(&depuncture_bb_impl::catch_msg, this, _1));
+ }
+
+ depuncture_bb_impl::~depuncture_bb_impl()
+ {
+ }
+
+ int
+ depuncture_bb_impl::fixed_rate_ninput_to_noutput(int ninput)
+ {
+ return (int)(((d_puncsize/(double)(d_puncsize - d_puncholes)) * ninput)
+ .5);
+ }
+
+ int
+ depuncture_bb_impl::fixed_rate_noutput_to_ninput(int noutput)
+ {
+ return (int)((((d_puncsize - d_puncholes)/(double)(d_puncsize)) *
noutput) + .5);
+ }
+
+ void
+ depuncture_bb_impl::forecast(int noutput_items,
+ gr_vector_int& ninput_items_required)
+ {
+ ninput_items_required[0] = (int)((((d_puncsize -
d_puncholes)/(double)(d_puncsize)) * noutput_items) + .5);
+ }
+
+ /*
+ void depuncture_bb_impl::catch_msg(pmt::pmt_t msg)
+ {
+ long mlong = pmt::pmt_to_long(msg);
+ for(int i = 0; i < mlong; ++i) {
+ d_puncholes = (d_puncholes >> 1) | ((d_puncholes & 1) << (d_puncsize -
1));
+ }
+ }
+ */
+
+ int
+ depuncture_bb_impl::general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const uint8_t *in = (const uint8_t*)input_items[0];
+ uint8_t *out = (uint8_t*)output_items[0];
+
+ for(int i=0, k=0; i < noutput_items/output_multiple(); ++i) {
+ for(int j = 0; j < output_multiple(); ++j) {
+ out[i*output_multiple() + j] = ((d_puncpat >> (d_puncsize - 1 - j)) &
1) ? in[k++] : 127;
+ }
+ }
+
+ /*
+ printf(">>>>>>start\n");
+ for(int i = 0, k=0; i < noutput_items; ++i) {
+ if((d_puncpat >> (d_puncsize - 1 - (i % d_puncsize))) & 1) {
+ printf("%d...%d\n", out[i], in[k++]);
+ }
+ else {
+ printf("snit %d\n", out[i]);
+ }
+ }
+ */
+
+ /*printf("comp: %d, %d\n", noutput_items, ninput_items[0]);
+ printf("consuming %d\n", (int)(((1.0/relative_rate()) * noutput_items) +
.5));*/
+
+ consume_each((int)(((1.0/relative_rate()) * noutput_items) + .5));
+ return noutput_items;
+ }
+
+ } /* namespace fec */
+} /* namespace gr */
+
+
diff --git a/gr-fec/lib/depuncture_bb_impl.h b/gr-fec/lib/depuncture_bb_impl.h
new file mode 100644
index 0000000..9e21012
--- /dev/null
+++ b/gr-fec/lib/depuncture_bb_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_REINFLATE_BB_IMPL_H
+#define INCLUDED_FEC_REINFLATE_BB_IMPL_H
+
+#include <gnuradio/fec/depuncture_bb.h>
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API depuncture_bb_impl : public depuncture_bb
+ {
+ private:
+ int d_delay;
+ int d_puncholes;
+ int d_puncsize;
+ int d_puncpat;
+
+ public:
+ depuncture_bb_impl(int delay, int puncpat,
+ int puncholes, int puncsize);
+ ~depuncture_bb_impl();
+
+ int general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ int fixed_rate_ninput_to_noutput(int ninput);
+ int fixed_rate_noutput_to_ninput(int noutput);
+ void forecast(int noutput_items,
+ gr_vector_int& ninput_items_required);
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_DEPUNCTURE_BB_IMPL_H */
diff --git a/gr-fec/lib/encoder_impl.cc b/gr-fec/lib/encoder_impl.cc
new file mode 100644
index 0000000..6a075b4
--- /dev/null
+++ b/gr-fec/lib/encoder_impl.cc
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "encoder_impl.h"
+#include <gnuradio/io_signature.h>
+#include <stdio.h>
+
+namespace gr {
+ namespace fec {
+
+ encoder::sptr
+ encoder::make(generic_encoder::sptr my_encoder,
+ size_t input_item_size,
+ size_t output_item_size)
+ {
+ return gnuradio::get_initial_sptr
+ (new encoder_impl(my_encoder, input_item_size,
+ output_item_size));
+ }
+
+ encoder_impl::encoder_impl(generic_encoder::sptr my_encoder,
+ size_t input_item_size,
+ size_t output_item_size)
+ : block("fec_encoder",
+ io_signature::make(1, 1, input_item_size),
+ io_signature::make(1, 1, output_item_size)),
+ d_input_item_size(input_item_size),
+ d_output_item_size(output_item_size)
+ {
+ set_fixed_rate(true);
+
set_relative_rate((double)my_encoder->get_output_size()/my_encoder->get_input_size());
+ set_output_multiple(my_encoder->get_output_size());
+ d_encoder = my_encoder;
+ }
+
+ encoder_impl::~encoder_impl()
+ {
+ }
+
+ int
+ encoder_impl::fixed_rate_ninput_to_noutput(int ninput)
+ {
+ return
(int)(((d_encoder->get_output_size()/(double)d_encoder->get_input_size()) *
ninput) + .5);
+ }
+
+ int
+ encoder_impl::fixed_rate_noutput_to_ninput(int noutput)
+ {
+ return
(int)(((d_encoder->get_input_size()/(double)d_encoder->get_output_size()) *
noutput) + .5);
+ }
+
+ void
+ encoder_impl::forecast(int noutput_items,
+ gr_vector_int& ninput_items_required)
+ {
+ ninput_items_required[0] =
(int)(((d_encoder->get_input_size()/(double)d_encoder->get_output_size()) *
noutput_items) + .5);
+ }
+
+ int
+ encoder_impl::general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ char *inBuffer = (char*)input_items[0];
+ char *outBuffer = (char*)output_items[0];
+
+ for(int i = 0; i < noutput_items/output_multiple(); ++i) {
+ //printf("%u inp %u oup\n", d_input_item_size, d_output_item_size);
+ //printf("%u, %u\n",
(i*d_encoder->get_input_size()*d_input_item_size),
(i*d_encoder->get_output_size()*d_output_item_size));
+
+
d_encoder->generic_work((void*)(inBuffer+(i*d_encoder->get_input_size()*d_input_item_size)),
+
(void*)(outBuffer+(i*d_encoder->get_output_size()*d_output_item_size)));
+ }
+
+ //printf("%d, %u, %u\n", (int)(((1.0/relative_rate()) * noutput_items) +
.5), noutput_items, output_multiple());
+
+ consume_each((int)(((1.0/relative_rate()) * noutput_items) + .5));
+ return noutput_items;
+ }
+
+ } /* namespace fec */
+} /* namespace gr */
diff --git a/gr-fec/lib/encoder_impl.h b/gr-fec/lib/encoder_impl.h
new file mode 100644
index 0000000..300f1c0
--- /dev/null
+++ b/gr-fec/lib/encoder_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_ENCODER_IMPL_H
+#define INCLUDED_FEC_ENCODER_IMPL_H
+
+#include <gnuradio/fec/encoder.h>
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API encoder_impl : public encoder
+ {
+ private:
+ generic_encoder::sptr d_encoder;
+ size_t d_input_item_size;
+ size_t d_output_item_size;
+
+ public:
+ encoder_impl(generic_encoder::sptr my_encoder,
+ size_t input_item_size,
+ size_t output_item_size);
+ ~encoder_impl();
+
+ int general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ int fixed_rate_ninput_to_noutput(int ninput);
+ int fixed_rate_noutput_to_ninput(int noutput);
+ void forecast(int noutput_items,
+ gr_vector_int& ninput_items_required);
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_ENCODER_IMPL_H */
diff --git a/gr-fec/lib/generic_decoder.cc b/gr-fec/lib/generic_decoder.cc
new file mode 100644
index 0000000..e9a5fc1
--- /dev/null
+++ b/gr-fec/lib/generic_decoder.cc
@@ -0,0 +1,138 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, 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/fec/generic_decoder.h>
+#include <stdio.h>
+
+namespace gr {
+ namespace fec {
+
+ generic_decoder::generic_decoder(std::string name)
+ {
+ d_name = name;
+ my_id = base_unique_id++;
+ }
+
+ generic_decoder::~generic_decoder()
+ {
+ }
+
+ int
+ generic_decoder::get_history()
+ {
+ return 0;
+ }
+
+ float
+ generic_decoder::get_shift()
+ {
+ return 0.0;
+ }
+
+ const char*
+ generic_decoder::get_conversion()
+ {
+ return "none";
+ }
+
+ int
+ generic_decoder::get_input_item_size()
+ {
+ return 4;
+ }
+
+ int
+ generic_decoder::get_output_item_size()
+ {
+ return 1;
+ }
+
+ const char*
+ generic_decoder::get_output_conversion()
+ {
+ return "none";
+ }
+
+ int generic_decoder::base_unique_id = 1;
+ int
+ generic_decoder::unique_id()
+ {
+ return my_id;
+ }
+
+ /*******************************************************
+ * Static functions
+ ******************************************************/
+ int
+ get_decoder_output_size(generic_decoder::sptr my_decoder)
+ {
+ return my_decoder->get_output_size();
+ }
+
+ int
+ get_history(generic_decoder::sptr my_decoder)
+ {
+ return my_decoder->get_history();
+ }
+
+ int
+ get_decoder_input_size(generic_decoder::sptr my_decoder)
+ {
+ return my_decoder->get_input_size();
+ }
+
+ int
+ get_decoder_output_item_size(generic_decoder::sptr my_decoder)
+ {
+ return my_decoder->get_output_item_size();
+ }
+
+ int
+ get_decoder_input_item_size(generic_decoder::sptr my_decoder)
+ {
+ return my_decoder->get_input_item_size();
+ }
+
+ float
+ get_shift(generic_decoder::sptr my_decoder)
+ {
+ return my_decoder->get_shift();
+ }
+
+ const char*
+ get_conversion(generic_decoder::sptr my_decoder)
+ {
+ return my_decoder->get_conversion();
+ }
+
+ const char*
+ get_output_conversion(generic_decoder::sptr my_decoder)
+ {
+ return my_decoder->get_output_conversion();
+ }
+
+ } /* namespace fec */
+} /* namespace gr */
diff --git a/gr-fec/swig/fec_swig.i b/gr-fec/lib/generic_encoder.cc
similarity index 58%
copy from gr-fec/swig/fec_swig.i
copy to gr-fec/lib/generic_encoder.cc
index 62bb767..9402b66 100644
--- a/gr-fec/swig/fec_swig.i
+++ b/gr-fec/lib/generic_encoder.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2013-2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,20 +20,31 @@
* Boston, MA 02110-1301, USA.
*/
-#define FEC_API
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
-%include "gnuradio.i"
+#include <gnuradio/fec/generic_encoder.h>
+#include <stdio.h>
-//load generated python docstrings
-%include "fec_swig_doc.i"
+namespace gr {
+ namespace fec {
-%{
-#include "gnuradio/fec/decode_ccsds_27_fb.h"
-#include "gnuradio/fec/encode_ccsds_27_bb.h"
-%}
+ generic_encoder::~generic_encoder()
+ {
+ }
-%include "gnuradio/fec/decode_ccsds_27_fb.h"
-%include "gnuradio/fec/encode_ccsds_27_bb.h"
+ int
+ get_encoder_output_size(generic_encoder::sptr my_encoder)
+ {
+ return my_encoder->get_output_size();
+ }
-GR_SWIG_BLOCK_MAGIC2(fec, decode_ccsds_27_fb);
-GR_SWIG_BLOCK_MAGIC2(fec, encode_ccsds_27_bb);
+ int
+ get_encoder_input_size(generic_encoder::sptr my_encoder)
+ {
+ return my_encoder->get_input_size();
+ }
+
+ } /* namespace fec */
+} /* namespace gr */
diff --git a/gr-fec/lib/puncture_ff_impl.cc b/gr-fec/lib/puncture_ff_impl.cc
new file mode 100644
index 0000000..a534bef
--- /dev/null
+++ b/gr-fec/lib/puncture_ff_impl.cc
@@ -0,0 +1,137 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "puncture_ff_impl.h"
+#include <gnuradio/io_signature.h>
+#include <boost/bind.hpp>
+#include <pmt/pmt.h>
+#include <string>
+#include <stdio.h>
+
+namespace gr {
+ namespace fec {
+
+ puncture_ff::sptr
+ puncture_ff::make(int delay, int puncpat,
+ int puncholes, int puncsize)
+ {
+ return gnuradio::get_initial_sptr
+ (new puncture_ff_impl(delay, puncpat,
+ puncholes, puncsize));
+ }
+
+ puncture_ff_impl::puncture_ff_impl(int delay, int puncpat,
+ int puncholes, int puncsize)
+ : block("puncture_ff",
+ io_signature::make(1, 1, sizeof(float)),
+ io_signature::make(1, 1, sizeof(float))),
+ d_delay(delay), d_puncholes(puncholes), d_puncsize(puncsize)
+ {
+ for(int i = 0; i < d_delay; ++i) {
+ puncpat = ((puncpat & 1) << (d_puncsize - 1)) + (puncpat >> 1);
+ }
+ d_puncpat = puncpat;
+
+ set_fixed_rate(true);
+ set_relative_rate((double)(d_puncsize - d_puncholes)/d_puncsize);
+ set_output_multiple(d_puncsize - d_puncholes);
+ //set_msg_handler(boost::bind(&puncture_ff_impl::catch_msg, this, _1));
+ }
+
+ puncture_ff_impl::~puncture_ff_impl()
+ {
+ }
+
+ int
+ puncture_ff_impl::fixed_rate_ninput_to_noutput(int ninput)
+ {
+ return (int)((((d_puncsize - d_puncholes)/(double)(d_puncsize)) *
ninput) + .5);
+ }
+
+ int
+ puncture_ff_impl::fixed_rate_noutput_to_ninput(int noutput)
+ {
+ return (int)(((d_puncsize/(double)(d_puncsize-d_puncholes)) * noutput) +
.5);
+ }
+
+ void
+ puncture_ff_impl::forecast(int noutput_items,
+ gr_vector_int& ninput_items_required)
+ {
+ ninput_items_required[0] =
(int)(((d_puncsize/(double)(d_puncsize-d_puncholes)) * noutput_items) + .5);
+ }
+
+ /*
+ void
+ puncture_ff_impl::catch_msg(pmt::pmt_t msg)
+ {
+ long mlong = pmt::pmt_to_long(msg);
+ for(int i = 0; i < mlong; ++i) {
+ d_puncholes = (d_puncholes >> 1) | ((d_puncholes & 1) << (d_puncsize -
1));
+ }
+ }
+ */
+
+ int
+ puncture_ff_impl::general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ for(int i=0, k=0; i < noutput_items/output_multiple(); ++i) {
+ for(int j = 0; j < d_puncsize; ++j) {
+ if((d_puncpat >> (d_puncsize - 1 - j)) & 1) {
+ out[k++] = in[i*d_puncsize + j];
+ }
+ }
+ }
+
+ GR_LOG_DEBUG(d_debug_logger, ">>>>>> start");
+ for(int i = 0, k=0; i < noutput_items; ++i) {
+ if((d_puncpat >> (d_puncsize - 1 - (i % d_puncsize))) & 1) {
+ GR_LOG_DEBUG(d_debug_logger, boost::format("%1%...%2%") \
+ % out[k++] % in[i]);
+ }
+ else {
+ GR_LOG_DEBUG(d_debug_logger, boost::format("snit %1%") % in[i]);
+ }
+ }
+
+ GR_LOG_DEBUG(d_debug_logger, boost::format("comp: %1%, %2%\n") \
+ % noutput_items % ninput_items[0]);
+ GR_LOG_DEBUG(d_debug_logger, boost::format("consuming %1%") \
+ % ((int)(((1.0/relative_rate()) * noutput_items) + .5)));
+
+ consume_each((int)(((1.0/relative_rate()) * noutput_items) + .5));
+ return noutput_items;
+ }
+
+ } /* namespace fec */
+}/* namespace gr */
+
diff --git a/gr-fec/lib/puncture_ff_impl.h b/gr-fec/lib/puncture_ff_impl.h
new file mode 100644
index 0000000..bea6673
--- /dev/null
+++ b/gr-fec/lib/puncture_ff_impl.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU 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_PUNCTURE_FF_IMPL_H
+#define INCLUDED_FEC_PUNCTURE_FF_IMPL_H
+
+#include <gnuradio/fec/puncture_ff.h>
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API puncture_ff_impl : public puncture_ff
+ {
+ private:
+ int d_delay;
+ int d_puncholes;
+ int d_puncsize;
+ int d_puncpat;
+
+ public:
+ puncture_ff_impl(int delay, int puncpat,
+ int puncholes, int puncsize);
+ ~puncture_ff_impl();
+
+ //void catch_msg(pmt::pmt_t msg);
+
+ int general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ int fixed_rate_ninput_to_noutput(int ninput);
+ int fixed_rate_noutput_to_ninput(int noutput);
+ void forecast(int noutput_items,
+ gr_vector_int& ninput_items_required);
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_PUNCTURE_FF_IMPL_H */
diff --git a/gr-fec/python/fec/CMakeLists.txt b/gr-fec/python/fec/CMakeLists.txt
index a7eefaa..c8694f4 100644
--- a/gr-fec/python/fec/CMakeLists.txt
+++ b/gr-fec/python/fec/CMakeLists.txt
@@ -23,6 +23,16 @@ include(GrPython)
GR_PYTHON_INSTALL(
FILES
__init__.py
+ bitflip.py
+ extended_encoder.py
+ extended_decoder.py
+ capillary_threaded_decoder.py
+ capillary_threaded_encoder.py
+ threaded_decoder.py
+ threaded_encoder.py
+ fec_test.py
+ fec_raw_test.py
+ bercurve_generator.py
DESTINATION ${GR_PYTHON_DIR}/gnuradio/fec
COMPONENT "fec_python"
)
diff --git a/gr-fec/python/fec/__init__.py b/gr-fec/python/fec/__init__.py
index bfec694..7600856 100644
--- a/gr-fec/python/fec/__init__.py
+++ b/gr-fec/python/fec/__init__.py
@@ -1,5 +1,5 @@
#
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -30,3 +30,16 @@ except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
from fec_swig import *
+
+from bitflip import *
+from extended_encoder import extended_encoder
+from extended_decoder import extended_decoder
+from threaded_encoder import threaded_encoder
+from threaded_decoder import threaded_decoder
+from capillary_threaded_decoder import capillary_threaded_decoder
+from capillary_threaded_encoder import capillary_threaded_encoder
+
+
+from fec_test import fec_test
+from fec_raw_test import fec_raw_test
+from bercurve_generator import bercurve_generator
diff --git a/gr-fec/python/fec/bercurve_generator.py
b/gr-fec/python/fec/bercurve_generator.py
new file mode 100644
index 0000000..0f0ef7e
--- /dev/null
+++ b/gr-fec/python/fec/bercurve_generator.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along 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, blocks
+import numpy
+
+from fec_test import fec_test
+from fec_raw_test import fec_raw_test
+
+class bercurve_generator(gr.hier_block2):
+
+ def __init__(self, encoder_list, decoder_list, esno=numpy.arange(0.0, 3.0,
.25),
+ samp_rate=3200000, threading='capillary', puncpat='11'):
+ gr.hier_block2.__init__(
+ self, "ber_curve_generator",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(len(esno) * 2, len(esno) * 2, gr.sizeof_char*1))
+
+ self.esno = esno
+ self.samp_rate = samp_rate
+ self.encoder_list = encoder_list
+ self.decoder_list = decoder_list
+ self.puncpat = puncpat
+
+ self.random_gen_b_0 = blocks.vector_source_b(map(int,
numpy.random.randint(0, 256, 100000)), True)
+ self.deinterleave = blocks.deinterleave(gr.sizeof_char*1)
+ self.connect(self.random_gen_b_0, self.deinterleave)
+ self.ber_generators = []
+ for i in range(0, len(esno)):
+ if(encoder_list is None):
+ ber_generator_temp = fec_raw_test(
+ esno=esno[i],
+ samp_rate=samp_rate)
+ else:
+ ber_generator_temp = fec_test(
+ generic_encoder=encoder_list[i],
+ generic_decoder=decoder_list[i],
+ esno=esno[i],
+ samp_rate=samp_rate,
+ threading=threading,
+ puncpat=puncpat)
+ self.ber_generators.append(ber_generator_temp);
+
+ for i in range(0, len(esno)):
+ self.connect((self.deinterleave, i), (self.ber_generators[i]))
+ self.connect((self.ber_generators[i], 0), (self, i*2));
+ self.connect((self.ber_generators[i], 1), (self, i*2 + 1));
+
+ def get_esno(self):
+ return self.esno
+
+ def set_esno(self, esno):
+ self.esno = esno
+ self.ber_generator_0.set_esno(self.esno)
+
+ def get_samp_rate(self):
+ return self.samp_rate
+
+ def set_samp_rate(self, samp_rate):
+ self.samp_rate = samp_rate
+ self.ber_generator_0.set_samp_rate(self.samp_rate)
+
+ def get_encoder_list(self):
+ return self.encoder_list
+
+ def set_encoder_list(self, encoder_list):
+ self.encoder_list = encoder_list
+ self.ber_generator_0.set_generic_encoder(self.encoder_list)
+
+ def get_decoder_list(self):
+ return self.decoder_list
+
+ def set_decoder_list(self, decoder_list):
+ self.decoder_list = decoder_list
+ self.ber_generator_0.set_generic_decoder(self.decoder_list)
+
+ def get_puncpat(self):
+ return self.puncpat
+
+ def set_puncpat(self, puncpat):
+ self.puncpat = puncpat
diff --git a/gr-fec/python/fec/bitflip.py b/gr-fec/python/fec/bitflip.py
new file mode 100644
index 0000000..235dc19
--- /dev/null
+++ b/gr-fec/python/fec/bitflip.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+def bitreverse(mint):
+ res = 0;
+ while mint != 0:
+ res = res << 1;
+ res += mint & 1;
+ mint = mint >> 1;
+ return res;
+
+const_lut = [2];
+specinvert_lut = [[0, 2, 1, 3]];
+
+def bitflip(mint, bitflip_lut, index, csize):
+ res = 0;
+ cnt = 0;
+ mask = (1 << const_lut[index]) - 1;
+ while (cnt < csize):
+ res += (bitflip_lut[(mint >> cnt) & (mask)]) << cnt;
+ cnt += const_lut[index];
+ return res;
+
+
+def read_bitlist(bitlist):
+ res = 0;
+ for i in range(len(bitlist)):
+ if int(bitlist[i]) == 1:
+ res += 1 << (len(bitlist) - i - 1);
+ return res;
+
+
+def read_big_bitlist(bitlist):
+ ret = []
+ for j in range(0, len(bitlist)/64):
+ res = 0;
+ for i in range(0, 64):
+ if int(bitlist[j*64+i]) == 1:
+ res += 1 << (64 - i - 1);
+ ret.append(res);
+ res = 0;
+ j = 0;
+ for i in range(len(bitlist)%64):
+ if int(bitlist[len(ret)*64+i]) == 1:
+ res += 1 << (64 - j - 1);
+ j += 1;
+ ret.append(res);
+ return ret;
+
+def generate_symmetries(symlist):
+ retlist = []
+ if len(symlist) == 1:
+ for i in range(len(symlist[0])):
+ retlist.append(symlist[0][i:] + symlist[0][0:i]);
+ invlist = symlist[0];
+ for i in range(1, len(symlist[0])/2):
+ invlist[i] = symlist[0][i + len(symlist[0])/2];
+ invlist[i + len(symlist[0])/2] = symlist[0][i];
+ for i in range(len(symlist[0])):
+ retlist.append(symlist[0][i:] + symlist[0][0:i]);
+ return retlist;
diff --git a/gr-fec/python/fec/capillary_threaded_decoder.py
b/gr-fec/python/fec/capillary_threaded_decoder.py
new file mode 100644
index 0000000..67c3979
--- /dev/null
+++ b/gr-fec/python/fec/capillary_threaded_decoder.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along 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, blocks
+import fec_swig as fec
+import math
+
+class capillary_threaded_decoder(gr.hier_block2):
+ def __init__(self, decoder_list_0, input_size, output_size):
+ gr.hier_block2.__init__(
+ self, "Capillary Threaded Decoder",
+ gr.io_signature(1, 1, input_size*1),
+ gr.io_signature(1, 1, output_size*1))
+
+ self.decoder_list_0 = decoder_list_0
+
+ self.deinterleaves_0 = []
+ for i in range(int(math.log(len(decoder_list_0), 2))):
+ for j in range(int(math.pow(2, i))):
+ self.deinterleaves_0.append(blocks.deinterleave(input_size,
+
fec.get_decoder_input_size(decoder_list_0[0])))
+
+ self.generic_decoders_0 = []
+ for i in range(len(decoder_list_0)):
+ self.generic_decoders_0.append(fec.decoder(decoder_list_0[i],
input_size, output_size))
+
+ self.interleaves_0 = []
+ for i in range(int(math.log(len(decoder_list_0), 2))):
+ for j in range(int(math.pow(2, i))):
+ self.interleaves_0.append(fec.interleave(output_size,
+
fec.get_decoder_output_size(decoder_list_0[0])))
+
+ rootcount = 0
+ branchcount = 1
+ for i in range(int(math.log(len(decoder_list_0), 2)) - 1):
+ for j in range(int(math.pow(2, i))):
+ self.connect((self.deinterleaves_0[rootcount], 0),
(self.deinterleaves_0[branchcount], 0))
+ self.connect((self.deinterleaves_0[rootcount], 1),
(self.deinterleaves_0[branchcount + 1], 0))
+ rootcount += 1
+ branchcount += 2
+
+ codercount = 0
+ for i in range(len(decoder_list_0)/2):
+ self.connect((self.deinterleaves_0[rootcount], 0),
(self.generic_decoders_0[codercount], 0))
+ self.connect((self.deinterleaves_0[rootcount], 1),
(self.generic_decoders_0[codercount + 1], 0))
+ rootcount += 1
+ codercount += 2
+
+ rootcount = 0
+ branchcount = 1
+ for i in range(int(math.log(len(decoder_list_0), 2)) - 1):
+ for j in range(int(math.pow(2, i))):
+ self.connect((self.interleaves_0[branchcount], 0),
(self.interleaves_0[rootcount], 0))
+ self.connect((self.interleaves_0[branchcount + 1], 0),
(self.interleaves_0[rootcount], 1))
+ rootcount += 1
+ branchcount += 2
+
+ codercount = 0
+ for i in range(len(decoder_list_0)/2):
+ self.connect((self.generic_decoders_0[codercount], 0),
(self.interleaves_0[rootcount], 0))
+ self.connect((self.generic_decoders_0[codercount + 1], 0),
(self.interleaves_0[rootcount], 1))
+ rootcount += 1
+ codercount += 2
+
+ if ((len(self.decoder_list_0)) > 1):
+ self.connect((self, 0), (self.deinterleaves_0[0], 0))
+ self.connect((self.interleaves_0[0], 0), (self, 0))
+ else:
+ self.connect((self, 0), (self.generic_decoders_0[0], 0))
+ self.connect((self.generic_decoders_0[0], 0), (self, 0))
+
+ def get_decoder_list_0(self):
+ return self.decoder_list_0
+
+ def set_decoder_list_0(self, decoder_list_0):
+ self.decoder_list_0 = decoder_list_0
diff --git a/gr-fec/python/fec/capillary_threaded_encoder.py
b/gr-fec/python/fec/capillary_threaded_encoder.py
new file mode 100644
index 0000000..dc2321a
--- /dev/null
+++ b/gr-fec/python/fec/capillary_threaded_encoder.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along 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, blocks
+import fec_swig as fec
+import math
+
+class capillary_threaded_encoder(gr.hier_block2):
+ def __init__(self, encoder_list_0, input_size=gr.sizeof_char,
output_size=gr.sizeof_float):
+ gr.hier_block2.__init__(
+ self, "Capillary Threaded Encoder",
+ gr.io_signature(1, 1, input_size),
+ gr.io_signature(1, 1, output_size))
+
+ self.encoder_list_0 = encoder_list_0
+
+ self.deinterleaves_0 = [];
+ for i in range(int(math.log(len(encoder_list_0), 2))):
+ for j in range(int(math.pow(2, i))):
+ self.deinterleaves_0.append(blocks.deinterleave(input_size,
fec.get_encoder_input_size(encoder_list_0[0])))
+
+ self.generic_encoders_0 = [];
+ for i in range(len(encoder_list_0)):
+ self.generic_encoders_0.append(fec.encoder(encoder_list_0[i],
input_size, output_size))
+
+ self.interleaves_0 = [];
+ for i in range(int(math.log(len(encoder_list_0), 2))):
+ for j in range(int(math.pow(2, i))):
+ self.interleaves_0.append(blocks.interleave(output_size,
fec.get_encoder_output_size(encoder_list_0[0])))
+
+ rootcount = 0;
+ branchcount = 1;
+ for i in range(int(math.log(len(encoder_list_0), 2)) - 1):
+ for j in range(int(math.pow(2, i))):
+ self.connect((self.deinterleaves_0[rootcount], 0),
(self.deinterleaves_0[branchcount], 0))
+ self.connect((self.deinterleaves_0[rootcount], 1),
(self.deinterleaves_0[branchcount + 1], 0))
+ rootcount += 1;
+ branchcount += 2;
+
+ codercount = 0;
+ for i in range(len(encoder_list_0)/2):
+ self.connect((self.deinterleaves_0[rootcount], 0),
(self.generic_encoders_0[codercount], 0))
+ self.connect((self.deinterleaves_0[rootcount], 1),
(self.generic_encoders_0[codercount + 1], 0))
+ rootcount += 1;
+ codercount += 2;
+
+
+ rootcount = 0;
+ branchcount = 1;
+ for i in range(int(math.log(len(encoder_list_0), 2)) - 1):
+ for j in range(int(math.pow(2, i))):
+ self.connect((self.interleaves_0[branchcount], 0),
(self.interleaves_0[rootcount], 0))
+ self.connect((self.interleaves_0[branchcount + 1], 0),
(self.interleaves_0[rootcount], 1))
+ rootcount += 1;
+ branchcount += 2;
+
+
+ codercount = 0;
+ for i in range(len(encoder_list_0)/2):
+ self.connect((self.generic_encoders_0[codercount], 0),
(self.interleaves_0[rootcount], 0))
+ self.connect((self.generic_encoders_0[codercount + 1], 0),
(self.interleaves_0[rootcount], 1))
+ rootcount += 1;
+ codercount += 2;
+
+ if((len(self.encoder_list_0)) > 1):
+ self.connect((self, 0), (self.deinterleaves_0[0], 0))
+ self.connect((self.interleaves_0[0], 0), (self, 0))
+ else:
+ self.connect((self, 0), (self.generic_encoders_0[0], 0))
+ self.connect((self.generic_encoders_0[0], 0), (self, 0))
+
+ def get_encoder_list_0(self):
+ return self.encoder_list_0
+
+ def set_encoder_list_0(self, encoder_list_0):
+ self.encoder_list_0 = encoder_list_0
diff --git a/gr-fec/python/fec/extended_decoder.py
b/gr-fec/python/fec/extended_decoder.py
new file mode 100644
index 0000000..7f08a10
--- /dev/null
+++ b/gr-fec/python/fec/extended_decoder.py
@@ -0,0 +1,159 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along 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, blocks, digital
+import fec_swig as fec
+
+from threaded_decoder import threaded_decoder
+from capillary_threaded_decoder import capillary_threaded_decoder
+
+class extended_decoder(gr.hier_block2):
+
+#solution to log_(1-2*t)(1-2*.0335) = 1/taps where t is thresh (syndrome
density)
+#for i in numpy.arange(.1, .499, .01):
+ #print str(log((1-(2 * .035)), (1-(2 * i)))) + ':' + str(i);
+ garbletable = {
+ 0.310786835319:0.1,
+ 0.279118162802:0.11,
+ 0.252699589071:0.12,
+ 0.230318516016:0.13,
+ 0.211108735347:0.14,
+ 0.194434959095:0.15,
+ 0.179820650401:0.16,
+ 0.166901324951:0.17,
+ 0.15539341766:0.18,
+ 0.145072979886:0.19,
+ 0.135760766313:0.2,
+ 0.127311581396:0.21,
+ 0.119606529806:0.22,
+ 0.112547286766:0.23,
+ 0.106051798775:0.24,
+ 0.10005101381:0.25,
+ 0.0944863633098:0.26,
+ 0.0893078003966:0.27,
+ 0.084472254501:0.28,
+ 0.0799424008658:0.29,
+ 0.0756856701944:0.3,
+ 0.0716734425668:0.31,
+ 0.0678803831565:0.32,
+ 0.0642838867856:0.33,
+ 0.0608636049994:0.34,
+ 0.0576010337489:0.35,
+ 0.0544791422522:0.36,
+ 0.0514820241933:0.37,
+ 0.0485945507251:0.38,
+ 0.0458019998183:0.39,
+ 0.0430896262596:0.4,
+ 0.0404421166935:0.41,
+ 0.0378428350972:0.42,
+ 0.0352726843274:0.43,
+ 0.0327082350617:0.44,
+ 0.0301183562535:0.45,
+ 0.0274574540266:0.46,
+ 0.0246498236897:0.47,
+ 0.0215448131298:0.48,
+ 0.0177274208353:0.49,
+ }
+
+ def __init__(self, decoder_obj_list, threading, ann=None, puncpat='11',
+ integration_period=10000, flush=None, rotator=None):
+ gr.hier_block2.__init__(
+ self, "extended_decoder",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_char))
+ self.blocks=[]
+ self.ann=ann
+ self.puncpat=puncpat
+ self.flush=flush
+
+ message_collector_connected=False
+
+ ##anything going through the annihilator needs shifted, uchar vals
+ if fec.get_conversion(decoder_obj_list[0]) == "uchar" or
fec.get_conversion(decoder_obj_list[0]) == "packed_bits":
+ self.blocks.append(blocks.multiply_const_ff(48.0))
+
+ if fec.get_shift(decoder_obj_list[0]) != 0.0:
+
self.blocks.append(blocks.add_const_ff(fec.get_shift(decoder_obj_list[0])))
+ elif fec.get_conversion(decoder_obj_list[0]) == "packed_bits":
+ self.blocks.append(blocks.add_const_ff(128.0))
+
+ if fec.get_conversion(decoder_obj_list[0]) == "uchar" or
fec.get_conversion(decoder_obj_list[0]) == "packed_bits":
+ self.blocks.append(blocks.float_to_uchar());
+
+ const_index = 0; #index that corresponds to mod order for specinvert
purposes
+
+ if not self.flush:
+ flush = 10000;
+ else:
+ flush = self.flush;
+ if self.ann: #ann and puncpat are strings of 0s and 1s
+ cat = fec.ULLVector();
+ for i in fec.read_big_bitlist(ann):
+ cat.append(i);
+
+ synd_garble = .49
+ idx_list = self.garbletable.keys()
+ idx_list.sort()
+ for i in idx_list:
+ if 1.0/self.ann.count('1') >= i:
+ synd_garble = self.garbletable[i]
+ print 'using syndrom garble threshold ' + str(synd_garble) + 'for
corr_bb'
+ print 'ceiling: .0335 data garble rate'
+ self.blocks.append(fec.corr_bb(cat, len(puncpat) -
puncpat.count('0'),
+ len(ann), integration_period,
flush, synd_garble))
+
+ #print puncpat
+ if self.puncpat != '11':
+ self.blocks.append(fec.reinflate_bb(0, fec.read_bitlist(puncpat),
+ puncpat.count('0'),
len(puncpat)))
+
+ if fec.get_conversion(decoder_obj_list[0]) == "packed_bits":
+ self.blocks.append(blocks.uchar_to_float())
+ self.blocks.append(blocks.add_const_ff(-128.0))
+ self.blocks.append(digital.binary_slicer_fb())
+ self.blocks.append(blocks.unpacked_to_packed_bb(1,0))
+
+ if(len(decoder_obj_list) > 1):
+ assert fec.get_history(decoder_obj_list[0]) == 0
+ if threading == 'capillary':
+ self.blocks.append(capillary_threaded_decoder(decoder_obj_list,
+
fec.get_decoder_input_item_size(decoder_obj_list[0]),
+
fec.get_decoder_output_item_size(decoder_obj_list[0])))
+
+ elif threading == 'ordinary':
+ self.blocks.append(threaded_decoder(decoder_obj_list,
+
fec.get_decoder_input_item_size(decoder_obj_list[0]),
+
fec.get_decoder_output_item_size(decoder_obj_list[0])))
+
+ else:
+ self.blocks.append(fec.decoder(decoder_obj_list[0],
+
fec.get_decoder_input_item_size(decoder_obj_list[0]),
+
fec.get_decoder_output_item_size(decoder_obj_list[0])))
+
+ if fec.get_output_conversion(decoder_obj_list[0]) == "unpack":
+ self.blocks.append(blocks.packed_to_unpacked_bb(1,
gr.GR_MSB_FIRST));
+
+ self.connect((self, 0), (self.blocks[0], 0));
+ self.connect((self.blocks[-1], 0), (self, 0));
+
+ for i in range(len(self.blocks) - 1):
+ self.connect((self.blocks[i], 0), (self.blocks[i+1], 0));
diff --git a/gr-fec/python/fec/extended_encoder.py
b/gr-fec/python/fec/extended_encoder.py
new file mode 100644
index 0000000..e9576fa
--- /dev/null
+++ b/gr-fec/python/fec/extended_encoder.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr
+
+import fec_swig as fec
+from threaded_encoder import threaded_encoder
+from capillary_threaded_encoder import capillary_threaded_encoder
+
+class extended_encoder(gr.hier_block2):
+ def __init__(self, encoder_obj_list, threading, puncpat=None):
+ gr.hier_block2.__init__(
+ self, "extended_encoder",
+ gr.io_signature(1, 1, gr.sizeof_char),
+ gr.io_signature(1, 1, gr.sizeof_float))
+
+ self.blocks=[]
+ self.puncpat=puncpat
+ if threading == 'capillary':
+ self.blocks.append(capillary_threaded_encoder(encoder_obj_list))
+ elif threading == 'ordinary':
+ self.blocks.append(threaded_encoder(encoder_obj_list))
+ else:
+ self.blocks.append(fec.encoder(encoder_obj_list[0]))
+
+ if self.puncpat != '11':
+ self.blocks.append(fec.puncture_ff(0, fec.read_bitlist(puncpat),
+ puncpat.count('0'),
len(puncpat)))
+
+ self.connect((self, 0), (self.blocks[0], 0));
+ self.connect((self.blocks[-1], 0), (self, 0));
+
+ for i in range(len(self.blocks) - 1):
+ self.connect((self.blocks[i], 0), (self.blocks[i+1], 0));
+
diff --git a/gr-fec/python/fec/fec_raw_test.py
b/gr-fec/python/fec/fec_raw_test.py
new file mode 100644
index 0000000..e6df0f0
--- /dev/null
+++ b/gr-fec/python/fec/fec_raw_test.py
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along 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, blocks
+import math
+
+class fec_raw_test(gr.hier_block2):
+
+ def __init__(self, esno=0, samp_rate=3200000):
+ gr.hier_block2.__init__(
+ self, "fec_raw_test",
+ gr.io_signature(1, 1, gr.sizeof_char*1),
+ gr.io_signature(2, 2, gr.sizeof_char*1))
+
+ self.esno = esno
+ self.samp_rate = samp_rate
+
+ self.gr_unpacked_to_packed_xx_0_0 = blocks.unpacked_to_packed_bb(1,
gr.GR_LSB_FIRST)
+ self.gr_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(1,
gr.GR_LSB_FIRST)
+ self.char_to_float = blocks.char_to_float()
+ self.float_to_char = blocks.float_to_char()
+ self.gr_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate)
+
+ noise = math.sqrt((10.0**(-esno/10.0))/2.0)
+ self.fastnoise = analog.fastnoise_source_f(analog.GR_GAUSSIAN, noise,
0, 8192)
+ self.gaussnoise_ff_0 = blocks.add_ff(1)
+ self.connect(self.fastnoise, (self.gaussnoise_ff_0,1))
+
+ self.connect((self.gr_unpacked_to_packed_xx_0_0, 0), (self, 0))
+ self.connect((self.gr_unpacked_to_packed_xx_0, 0), (self, 1))
+ self.connect((self.gr_throttle_0, 0),
(self.gr_unpacked_to_packed_xx_0, 0))
+ self.connect((self.gaussnoise_ff_0, 0), (self.float_to_char, 0))
+ self.connect((self.float_to_char, 0),
(self.gr_unpacked_to_packed_xx_0_0, 0))
+ self.connect(self, (self.gr_throttle_0, 0))
+ self.connect((self.gr_throttle_0, 0), (self.char_to_float, 0))
+ self.connect((self.char_to_float, 0), (self.gaussnoise_ff_0, 0))
+
+ def get_generic_encoder(self):
+ return None
+
+ def set_generic_encoder(self, generic_encoder):
+ pass
+
+ def get_generic_decoder(self):
+ return None
+
+ def set_generic_decoder(self, generic_decoder):
+ pass
+
+ def get_esno(self):
+ return self.esno
+
+ def set_esno(self, esno):
+ self.esno = esno
+
+ def get_samp_rate(self):
+ return self.samp_rate
+
+ def set_samp_rate(self, samp_rate):
+ self.samp_rate = samp_rate
+
+ def get_threading(self):
+ return None
+
+ def set_threading(self, threading):
+ pass
+
+ def get_puncpat(self):
+ return None
+
+ def set_puncpat(self, puncpat):
+ pass
diff --git a/gr-fec/python/fec/fec_test.py b/gr-fec/python/fec/fec_test.py
new file mode 100644
index 0000000..b1bad94
--- /dev/null
+++ b/gr-fec/python/fec/fec_test.py
@@ -0,0 +1,107 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along 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.fec.bitflip import read_bitlist
+from gnuradio import gr, blocks, analog
+import math
+
+from extended_encoder import extended_encoder
+from extended_decoder import extended_decoder
+
+class fec_test(gr.hier_block2):
+
+ def __init__(self, generic_encoder=0, generic_decoder=0, esno=0,
+ samp_rate=3200000, threading="capillary", puncpat='11'):
+ gr.hier_block2.__init__(
+ self, "fec_test",
+ gr.io_signature(1, 1, gr.sizeof_char*1),
+ gr.io_signature(2, 2, gr.sizeof_char*1))
+
+ self.generic_encoder = generic_encoder
+ self.generic_decoder = generic_decoder
+ self.esno = esno
+ self.samp_rate = samp_rate
+ self.threading = threading
+ self.puncpat = puncpat
+
+ self.gr_unpacked_to_packed_xx_0_0 = blocks.unpacked_to_packed_bb(1,
gr.GR_LSB_FIRST)
+ self.gr_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(1,
gr.GR_LSB_FIRST)
+ self.gr_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate)
+ self.encoder_interface_0 =
extended_encoder(encoder_obj_list=generic_encoder,
+ threading='capillary',
+ puncpat=puncpat)
+
+ noise = math.sqrt((10.0**(-esno/10.0))/2.0)
+ self.fastnoise = analog.fastnoise_source_f(analog.GR_GAUSSIAN, noise,
0, 8192)
+ self.gaussnoise_ff_0 = blocks.add_ff(1)
+ self.connect(self.fastnoise, (self.gaussnoise_ff_0,1))
+
+ self.decoder_interface_0 =
extended_decoder(decoder_obj_list=generic_decoder,
+ threading='capillary',
+ ann=None, puncpat=puncpat,
+ integration_period=10000,
rotator=None)
+
+ self.connect((self.gr_unpacked_to_packed_xx_0_0, 0), (self, 0))
+ self.connect((self.gr_unpacked_to_packed_xx_0, 0), (self, 1))
+ self.connect((self.gr_throttle_0, 0),
(self.gr_unpacked_to_packed_xx_0, 0))
+
+ self.connect((self.decoder_interface_0, 0),
(self.gr_unpacked_to_packed_xx_0_0, 0))
+ self.connect((self.gaussnoise_ff_0, 0), (self.decoder_interface_0, 0))
+ self.connect(self, (self.gr_throttle_0, 0))
+ self.connect((self.gr_throttle_0, 0), (self.encoder_interface_0, 0))
+ self.connect((self.encoder_interface_0, 0), (self.gaussnoise_ff_0, 0))
+
+ def get_generic_encoder(self):
+ return self.generic_encoder
+
+ def set_generic_encoder(self, generic_encoder):
+ self.generic_encoder = generic_encoder
+
+ def get_generic_decoder(self):
+ return self.generic_decoder
+
+ def set_generic_decoder(self, generic_decoder):
+ self.generic_decoder = generic_decoder
+
+ def get_esno(self):
+ return self.esno
+
+ def set_esno(self, esno):
+ self.esno = esno
+
+ def get_samp_rate(self):
+ return self.samp_rate
+
+ def set_samp_rate(self, samp_rate):
+ self.samp_rate = samp_rate
+
+ def get_threading(self):
+ return self.threading
+
+ def set_threading(self, threading):
+ self.threading = threading
+
+ def get_puncpat(self):
+ return self.puncpat
+
+ def set_puncpat(self, puncpat):
+ self.puncpat = puncpat
diff --git a/gr-fec/python/fec/threaded_decoder.py
b/gr-fec/python/fec/threaded_decoder.py
new file mode 100644
index 0000000..115ad7b
--- /dev/null
+++ b/gr-fec/python/fec/threaded_decoder.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along 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, blocks
+import fec_swig as fec
+
+class threaded_decoder(gr.hier_block2):
+ def __init__(self, decoder_list_0, input_size, output_size):
+ gr.hier_block2.__init__(
+ self, "Threaded Decoder",
+ gr.io_signature(1, 1, input_size*1),
+ gr.io_signature(1, 1, output_size*1))
+
+ self.decoder_list_0 = decoder_list_0
+
+ self.deinterleave_0 = blocks.deinterleave(input_size,
+
fec.get_decoder_input_size(decoder_list_0[0]))
+
+ self.generic_decoders_0 = []
+ for i in range(len(decoder_list_0)):
+ self.generic_decoders_0.append(fec.decoder(decoder_list_0[i],
+ input_size,
output_size))
+
+ self.interleave_0 = blocks.interleave(output_size,
+
fec.get_decoder_output_size(decoder_list_0[0]))
+
+ for i in range(len(decoder_list_0)):
+ self.connect((self.deinterleave_0, i),
(self.generic_decoders_0[i], 0))
+
+ for i in range(len(decoder_list_0)):
+ self.connect((self.generic_decoders_0[i], 0), (self.interleave_0,
i))
+
+
+ self.connect((self, 0), (self.deinterleave_0, 0))
+ self.connect((self.interleave_0, 0), (self, 0))
+
+ def get_decoder_list_0(self):
+ return self.decoder_list_0
+
+ def set_decoder_list_0(self, decoder_list_0):
+ self.decoder_list_0 = decoder_list_0
diff --git a/gr-fec/python/fec/threaded_encoder.py
b/gr-fec/python/fec/threaded_encoder.py
new file mode 100644
index 0000000..b20a07a
--- /dev/null
+++ b/gr-fec/python/fec/threaded_encoder.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr
+import fec_swig as fec
+
+class threaded_encoder(gr.hier_block2):
+ def __init__(self, encoder_list_0, input_size, output_size):
+ gr.hier_block2.__init__(
+ self, "Threaded Encoder",
+ gr.io_signature(1, 1, input_size*1),
+ gr.io_signature(1, 1, output_size*1))
+
+ self.encoder_list_0 = encoder_list_0
+
+ self.fec_deinterleave_0 = fec.deinterleave(input_size,
+
fec.get_encoder_input_size(encoder_list_0[0]))
+
+ self.generic_encoders_0 = [];
+ for i in range(len(encoder_list_0)):
+ self.generic_encoders_0.append(fec.encoder(encoder_list_0[i],
+ input_size,
output_size))
+
+ self.fec_interleave_0 = fec.interleave(output_size,
+
fec.get_encoder_output_size(encoder_list_0[0]))
+
+ for i in range(len(encoder_list_0)):
+ self.connect((self.fec_deinterleave_0, i),
(self.generic_encoders_0[i], 0))
+
+ for i in range(len(encoder_list_0)):
+ self.connect((self.generic_encoders_0[i], 0),
(self.fec_interleave_0, i))
+
+ self.connect((self, 0), (self.fec_deinterleave_0, 0))
+ self.connect((self.fec_interleave_0, 0), (self, 0))
+
+ def get_encoder_list_0(self):
+ return self.encoder_list_0
+
+ def set_encoder_list_0(self, encoder_list_0):
+ self.encoder_list_0 = encoder_list_0
diff --git a/gr-fec/swig/fec_swig.i b/gr-fec/swig/fec_swig.i
index 62bb767..506ea99 100644
--- a/gr-fec/swig/fec_swig.i
+++ b/gr-fec/swig/fec_swig.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,13 +27,45 @@
//load generated python docstrings
%include "fec_swig_doc.i"
+%nodefaultctor gr::fec::generic_encoder;
+%template(generic_encoder_sptr) boost::shared_ptr<gr::fec::generic_encoder>;
+
+%nodefaultctor gr::fec::generic_decoder;
+%template(generic_decoder_sptr) boost::shared_ptr<gr::fec::generic_decoder>;
+
%{
+#include "gnuradio/fec/generic_encoder.h"
+#include "gnuradio/fec/generic_decoder.h"
+#include "gnuradio/fec/encoder.h"
+#include "gnuradio/fec/decoder.h"
+#include "gnuradio/fec/cc_encoder.h"
+#include "gnuradio/fec/cc_decoder.h"
#include "gnuradio/fec/decode_ccsds_27_fb.h"
#include "gnuradio/fec/encode_ccsds_27_bb.h"
+#include "gnuradio/fec/ber_bf.h"
+#include "gnuradio/fec/conv_bit_corr_bb.h"
+#include "gnuradio/fec/puncture_ff.h"
+#include "gnuradio/fec/depuncture_bb.h"
%}
+%include "gnuradio/fec/generic_encoder.h"
+%include "gnuradio/fec/generic_decoder.h"
+%include "gnuradio/fec/encoder.h"
+%include "gnuradio/fec/decoder.h"
+%include "gnuradio/fec/cc_encoder.h"
+%include "gnuradio/fec/cc_decoder.h"
%include "gnuradio/fec/decode_ccsds_27_fb.h"
%include "gnuradio/fec/encode_ccsds_27_bb.h"
+%include "gnuradio/fec/ber_bf.h"
+%include "gnuradio/fec/conv_bit_corr_bb.h"
+%include "gnuradio/fec/puncture_ff.h"
+%include "gnuradio/fec/depuncture_bb.h"
+GR_SWIG_BLOCK_MAGIC2(fec, encoder);
+GR_SWIG_BLOCK_MAGIC2(fec, decoder);
GR_SWIG_BLOCK_MAGIC2(fec, decode_ccsds_27_fb);
GR_SWIG_BLOCK_MAGIC2(fec, encode_ccsds_27_bb);
+GR_SWIG_BLOCK_MAGIC2(fec, ber_bf);
+GR_SWIG_BLOCK_MAGIC2(fec, conv_bit_corr_bb);
+GR_SWIG_BLOCK_MAGIC2(fec, puncture_ff);
+GR_SWIG_BLOCK_MAGIC2(fec, depuncture_bb);
- [Commit-gnuradio] [gnuradio] 53/57: fec: wip: adding qa code., (continued)
- [Commit-gnuradio] [gnuradio] 53/57: fec: wip: adding qa code., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 50/57: fec: wip: adding concept of padding for CC encoder/decoder., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 54/57: fec: mostly documentation updates, spell check, etc., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 55/57: fec: wip: fixing up allocated memory; allowing async encoder deployment to be used with CCSDS (packed input requirement)., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 41/57: digital: adding an async message passsing CRC32 calc/check block for PDUs., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 38/57: fec: wip: cleaning up tagged decoder, rep code., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 57/57: digital: fixing up some work done in the fec api development., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 40/57: fec: wip: adding async (PDU) encoder and decoder blocks., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 36/57: fec: wip: mods for ber plotting. Now adding theoretical BPSK in AWGN curve., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 52/57: fec: wip: async encoder/decoder working deployments., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 16/57: fec: Merging fecapi with support for CC code.,
git <=
- [Commit-gnuradio] [gnuradio] 33/57: fec: wip: adding a dummy encoder/decoder and repetition code to exercise the API., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 49/57: blocks: adding reverse packing/unpacking functions., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 28/57: fec: updating puncturing, adding documentation, adding CCSDS encoder., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 05/57: codec2 library update, git, 2014/05/20