diff options
57 files changed, 9560 insertions, 706 deletions
diff --git a/gnuradio-runtime/include/gnuradio/logger.h.in b/gnuradio-runtime/include/gnuradio/logger.h.in index 7fcc5190d5..073a6162fb 100644 --- a/gnuradio-runtime/include/gnuradio/logger.h.in +++ b/gnuradio-runtime/include/gnuradio/logger.h.in @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2012-2013 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -69,9 +69,9 @@ namespace gr { #define GR_LOG_ASSIGN_LOGPTR(logger,name) #define GR_CONFIG_LOGGER(config) #define GR_CONFIG_AND_WATCH_LOGGER(config,period) -#define GR_LOG_GETLOGGER(logger, name) +#define GR_LOG_GETLOGGER(logger, name) #define GR_SET_LEVEL(name, level) -#define GR_LOG_SET_LEVEL(logger, level) +#define GR_LOG_SET_LEVEL(logger, level) #define GR_GET_LEVEL(name, level) #define GR_LOG_GET_LEVEL(logger, level) #define GR_ADD_APPENDER(name,appender) @@ -299,11 +299,11 @@ namespace gr { namespace gr { /*! - * \brief Class to control configuration of logger. + * \brief Class to control configuration of logger. * This is a singleton that cna launch a thread to wathc a config file for changes * \ingroup logging */ - class logger_config + class GR_RUNTIME_API logger_config { private: /*! \brief filename of logger config file */ @@ -313,7 +313,7 @@ namespace gr { /*! \brief Pointer to watch thread for config file changes */ boost::thread *watch_thread; - /*! \brief Watcher thread method + /*! \brief Watcher thread method * /param filename Name of configuration file * /param watch_period Seconds between checks for changes in config file */ @@ -568,7 +568,7 @@ namespace gr { * * Add rolling file appender to a given logger * - * \return vector of string names of loggers + * \return vector of string names of loggers */ GR_RUNTIME_API std::vector<std::string> logger_get_logger_names(void); @@ -587,9 +587,9 @@ namespace gr { #define GR_LOG_ASSIGN_LOGPTR(logger,name) #define GR_CONFIG_LOGGER(config) #define GR_CONFIG_AND_WATCH_LOGGER(config,period) -#define GR_LOG_GETLOGGER(logger, name) +#define GR_LOG_GETLOGGER(logger, name) #define GR_SET_LEVEL(name, level) -#define GR_LOG_SET_LEVEL(logger, level) +#define GR_LOG_SET_LEVEL(logger, level) #define GR_GET_LEVEL(name, level) #define GR_LOG_GET_LEVEL(logger, level) #define GR_ADD_APPENDER(name,appender) @@ -640,7 +640,7 @@ namespace gr { * \ingroup logging * */ - class logger + class GR_RUNTIME_API logger { private: /*! \brief logger pointer to logger associated wiith this wrapper class */ @@ -726,7 +726,7 @@ namespace gr { /**************** Start Configuration Class and Methods for Python ************/ /*! - * \brief Function to call configuration macro from python. + * \brief Function to call configuration macro from python. * Note: Configuration is only updated if filename or watch_period has changed. * \param config_filename Name of configuration file * \param watch_period Seconds to wait between checking for changes in conf file. @@ -744,7 +744,7 @@ GR_RUNTIME_API std::vector<std::string> gr_logger_get_logger_names(void); /*! * \brief Function to reset logger configuration from python - * + * */ GR_RUNTIME_API void gr_logger_reset_config(void); diff --git a/gr-digital/examples/demod/fec_corr_and_sync.grc b/gr-digital/examples/demod/fec_corr_and_sync.grc index dae7094552..91a0beb554 100644 --- a/gr-digital/examples/demod/fec_corr_and_sync.grc +++ b/gr-digital/examples/demod/fec_corr_and_sync.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Apr 10 11:46:45 2014</timestamp> + <timestamp>Thu May 1 13:24:23 2014</timestamp> <block> <key>options</key> <param> @@ -76,7 +76,7 @@ </param> <param> <key>_coordinate</key> - <value>(148, 1020)</value> + <value>(146, 1146)</value> </param> <param> <key>_rotation</key> @@ -99,7 +99,7 @@ </param> <param> <key>_coordinate</key> - <value>(175, 948)</value> + <value>(173, 1074)</value> </param> <param> <key>_rotation</key> @@ -122,7 +122,7 @@ </param> <param> <key>_coordinate</key> - <value>(34, 1020)</value> + <value>(32, 1146)</value> </param> <param> <key>_rotation</key> @@ -145,7 +145,7 @@ </param> <param> <key>_coordinate</key> - <value>(93, 947)</value> + <value>(91, 1073)</value> </param> <param> <key>_rotation</key> @@ -156,7 +156,7 @@ <key>variable</key> <param> <key>id</key> - <value>bb_filter</value> + <value>nfilts</value> </param> <param> <key>_enabled</key> @@ -164,11 +164,11 @@ </param> <param> <key>value</key> - <value>firdes.root_raised_cosine(sps, sps, 1, eb, 101)</value> + <value>32</value> </param> <param> <key>_coordinate</key> - <value>(509, 16)</value> + <value>(1301, 12)</value> </param> <param> <key>_rotation</key> @@ -179,7 +179,7 @@ <key>variable</key> <param> <key>id</key> - <value>matched_filter</value> + <value>rrc_taps</value> </param> <param> <key>_enabled</key> @@ -187,11 +187,11 @@ </param> <param> <key>value</key> - <value>firdes.root_raised_cosine(nfilts, nfilts, 1, eb, int(11*sps*nfilts))</value> + <value>firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), eb, 5*sps*nfilts)</value> </param> <param> <key>_coordinate</key> - <value>(510, 87)</value> + <value>(1301, 82)</value> </param> <param> <key>_rotation</key> @@ -202,7 +202,7 @@ <key>variable</key> <param> <key>id</key> - <value>preamble</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> @@ -210,11 +210,11 @@ </param> <param> <key>value</key> - <value>[1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,1,1,-1,-1]</value> + <value>100000</value> </param> <param> <key>_coordinate</key> - <value>(317, 16)</value> + <value>(11, 86)</value> </param> <param> <key>_rotation</key> @@ -225,7 +225,7 @@ <key>variable</key> <param> <key>id</key> - <value>sps</value> + <value>payload_size</value> </param> <param> <key>_enabled</key> @@ -233,11 +233,11 @@ </param> <param> <key>value</key> - <value>4</value> + <value>120</value> </param> <param> <key>_coordinate</key> - <value>(328, 87)</value> + <value>(119, 87)</value> </param> <param> <key>_rotation</key> @@ -248,7 +248,7 @@ <key>variable</key> <param> <key>id</key> - <value>eb</value> + <value>gap</value> </param> <param> <key>_enabled</key> @@ -256,11 +256,11 @@ </param> <param> <key>value</key> - <value>0.35</value> + <value>500</value> </param> <param> <key>_coordinate</key> - <value>(409, 87)</value> + <value>(240, 87)</value> </param> <param> <key>_rotation</key> @@ -271,7 +271,7 @@ <key>variable</key> <param> <key>id</key> - <value>gap</value> + <value>eb</value> </param> <param> <key>_enabled</key> @@ -279,11 +279,11 @@ </param> <param> <key>value</key> - <value>500</value> + <value>0.35</value> </param> <param> <key>_coordinate</key> - <value>(240, 87)</value> + <value>(409, 87)</value> </param> <param> <key>_rotation</key> @@ -294,7 +294,7 @@ <key>variable</key> <param> <key>id</key> - <value>payload_size</value> + <value>sps</value> </param> <param> <key>_enabled</key> @@ -302,11 +302,11 @@ </param> <param> <key>value</key> - <value>120</value> + <value>4</value> </param> <param> <key>_coordinate</key> - <value>(119, 87)</value> + <value>(328, 87)</value> </param> <param> <key>_rotation</key> @@ -317,7 +317,7 @@ <key>variable</key> <param> <key>id</key> - <value>samp_rate</value> + <value>preamble</value> </param> <param> <key>_enabled</key> @@ -325,11 +325,11 @@ </param> <param> <key>value</key> - <value>100000</value> + <value>[1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,1,1,-1,-1]</value> </param> <param> <key>_coordinate</key> - <value>(11, 86)</value> + <value>(317, 16)</value> </param> <param> <key>_rotation</key> @@ -340,7 +340,7 @@ <key>variable</key> <param> <key>id</key> - <value>rrc_taps</value> + <value>matched_filter</value> </param> <param> <key>_enabled</key> @@ -348,11 +348,11 @@ </param> <param> <key>value</key> - <value>firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), eb, 5*sps*nfilts)</value> + <value>firdes.root_raised_cosine(nfilts, nfilts, 1, eb, int(11*sps*nfilts))</value> </param> <param> <key>_coordinate</key> - <value>(1301, 82)</value> + <value>(510, 87)</value> </param> <param> <key>_rotation</key> @@ -363,7 +363,7 @@ <key>variable</key> <param> <key>id</key> - <value>nfilts</value> + <value>bb_filter</value> </param> <param> <key>_enabled</key> @@ -371,11 +371,11 @@ </param> <param> <key>value</key> - <value>32</value> + <value>firdes.root_raised_cosine(sps, sps, 1, eb, 101)</value> </param> <param> <key>_coordinate</key> - <value>(1301, 12)</value> + <value>(509, 16)</value> </param> <param> <key>_rotation</key> @@ -1288,6 +1288,30 @@ <value>1.0</value> </param> <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> <key>affinity</key> <value>0</value> </param> @@ -1571,6 +1595,30 @@ <value>1.0</value> </param> <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>color10</key> + <value>"red"</value> + </param> + <param> + <key>style10</key> + <value>0</value> + </param> + <param> + <key>marker10</key> + <value>0</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> <key>affinity</key> <value></value> </param> @@ -1744,104 +1792,6 @@ </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>16</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>"terminated"</value> - </param> - <param> - <key>_coordinate</key> - <value>(257, 947)</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>(159, 1091)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>digital_correlate_access_code_xx_ts</key> <param> <key>id</key> @@ -1899,6 +1849,14 @@ <value>True</value> </param> <param> + <key>_coordinate</key> + <value>(68, 297)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> <key>constel</key> <value>constel</value> </param> @@ -1938,14 +1896,6 @@ <key>maxoutbuf</key> <value>0</value> </param> - <param> - <key>_coordinate</key> - <value>(68, 297)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> </block> <block> <key>variable_qtgui_range</key> @@ -2336,6 +2286,30 @@ <value>1.0</value> </param> <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> <key>affinity</key> <value></value> </param> @@ -2431,6 +2405,225 @@ </param> </block> <block> + <key>blocks_char_to_float</key> + <param> + <key>id</key> + <value>blocks_char_to_float_0_0_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>(773, 815)</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>(157, 1217)</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>16</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>"terminated"</value> + </param> + <param> + <key>_coordinate</key> + <value>(269, 1073)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </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>(779, 903)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_sub_xx</key> + <param> + <key>id</key> + <value>blocks_sub_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>num_inputs</key> + <value>2</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>(1309, 931)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> <key>qtgui_time_sink_x</key> <param> <key>id</key> @@ -2725,94 +2918,36 @@ <value>1.0</value> </param> <param> - <key>affinity</key> + <key>label10</key> <value></value> </param> <param> - <key>_coordinate</key> - <value>(1349, 808)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blocks_sub_xx</key> - <param> - <key>id</key> - <value>blocks_sub_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>vlen</key> + <key>width10</key> <value>1</value> </param> <param> - <key>num_inputs</key> - <value>2</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>(1192, 819)</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> + <key>color10</key> + <value>"blue"</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>style10</key> + <value>1</value> </param> <param> - <key>berminerrors</key> - <value>100</value> + <key>marker10</key> + <value>-1</value> </param> <param> - <key>berlimit</key> - <value>-7.0</value> + <key>alpha10</key> + <value>1.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>(1125, 916)</value> + <value>(1466, 920)</value> </param> <param> <key>_rotation</key> @@ -2938,51 +3073,20 @@ <value>("black", "black")</value> </param> <param> - <key>affinity</key> + <key>label10</key> <value></value> </param> <param> - <key>_coordinate</key> - <value>(1349, 913)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blocks_char_to_float</key> - <param> - <key>id</key> - <value>blocks_char_to_float_0_0_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> + <key>color10</key> + <value>("black", "black")</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>(773, 815)</value> + <value>(1486, 1071)</value> </param> <param> <key>_rotation</key> @@ -2990,22 +3094,26 @@ </param> </block> <block> - <key>blocks_char_to_float</key> + <key>fec_ber_bf</key> <param> <key>id</key> - <value>blocks_char_to_float_0</value> + <value>fec_ber_bf_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>test_mode</key> + <value>False</value> </param> <param> - <key>scale</key> - <value>1</value> + <key>berminerrors</key> + <value>100</value> + </param> + <param> + <key>berlimit</key> + <value>-7.0</value> </param> <param> <key>affinity</key> @@ -3021,7 +3129,7 @@ </param> <param> <key>_coordinate</key> - <value>(773, 862)</value> + <value>(1249, 1080)</value> </param> <param> <key>_rotation</key> @@ -3149,28 +3257,22 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>fec_extended_decoder_0</source_block_id> - <sink_block_id>fec_ber_bf_0</sink_block_id> + <source_block_id>blocks_char_to_float_0_0_0</source_block_id> + <sink_block_id>blocks_sub_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>mod_with_ac_0</source_block_id> - <sink_block_id>fec_ber_bf_0</sink_block_id> - <source_key>1</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>digital_binary_slicer_fb_0</source_block_id> - <sink_block_id>fec_ber_bf_0</sink_block_id> + <source_block_id>fec_ber_bf_0</source_block_id> + <sink_block_id>qtgui_number_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>blocks_char_to_float_0_0_0</source_block_id> + <source_block_id>blocks_char_to_float_0</source_block_id> <sink_block_id>blocks_sub_xx_0</sink_block_id> <source_key>0</source_key> - <sink_key>0</sink_key> + <sink_key>1</sink_key> </connection> <connection> <source_block_id>blocks_sub_xx_0</source_block_id> @@ -3179,14 +3281,20 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>blocks_char_to_float_0</source_block_id> - <sink_block_id>blocks_sub_xx_0</sink_block_id> + <source_block_id>digital_binary_slicer_fb_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>mod_with_ac_0</source_block_id> + <sink_block_id>fec_ber_bf_0</sink_block_id> + <source_key>1</source_key> <sink_key>1</sink_key> </connection> <connection> - <source_block_id>fec_ber_bf_0</source_block_id> - <sink_block_id>qtgui_number_sink_0</sink_block_id> + <source_block_id>fec_extended_decoder_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> diff --git a/gr-fec/CMakeLists.txt b/gr-fec/CMakeLists.txt index d1e1e7b786..393e5423e0 100644 --- a/gr-fec/CMakeLists.txt +++ b/gr-fec/CMakeLists.txt @@ -41,6 +41,8 @@ GR_SET_GLOBAL(GR_FEC_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ) +SET(GR_PKG_FEC_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/fec) + ######################################################################## # Begin conditional configuration ######################################################################## @@ -90,7 +92,7 @@ if(ENABLE_PYTHON) add_subdirectory(python/fec) add_subdirectory(grc) endif(ENABLE_PYTHON) -#add_subdirectory(examples) +add_subdirectory(examples) add_subdirectory(doc) ######################################################################## diff --git a/gr-fec/examples/CMakeLists.txt b/gr-fec/examples/CMakeLists.txt new file mode 100644 index 0000000000..b5f253b9a1 --- /dev/null +++ b/gr-fec/examples/CMakeLists.txt @@ -0,0 +1,30 @@ +# 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. + +include(GrPython) + +install( + FILES + fecapi_decoders.grc + fecapi_encoders.grc + fecapi_tagged_decoders.grc + fecapi_tagged_encoders.grc + DESTINATION ${GR_PKG_FEC_EXAMPLES_DIR} + COMPONENT "fec_python" +) diff --git a/gr-fec/examples/fecapi_decoders.grc b/gr-fec/examples/fecapi_decoders.grc new file mode 100644 index 0000000000..1782b0f4e2 --- /dev/null +++ b/gr-fec/examples/fecapi_decoders.grc @@ -0,0 +1,2148 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Wed May 7 19:28:14 2014</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>fecapi_decoders</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>3000,2000</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>50000</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(9, 95)</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(347, 716)</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>[109, 79]</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(163, 804)</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(246, 719)</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>False</value> + </param> + <param> + <key>value</key> + <value>[79, 109]</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(305, 801)</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(420, 9)</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>enc_cc</value> + </param> + <param> + <key>threadtype</key> + <value>capillary</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>lentagname</key> + <value>None</value> + </param> + <param> + <key>alias</key> + <value></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>(440, 498)</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>alias</key> + <value></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>(102, 328)</value> + </param> + <param> + <key>_rotation</key> + <value>0</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>False</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>alias</key> + <value></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>(57, 525)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> + <block> + <key>digital_map_bb</key> + <param> + <key>id</key> + <value>digital_map_bb_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>map</key> + <value>[-1, 1]</value> + </param> + <param> + <key>alias</key> + <value></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>(755, 528)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_map_bb</key> + <param> + <key>id</key> + <value>digital_map_bb_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>map</key> + <value>[-1, 1]</value> + </param> + <param> + <key>alias</key> + <value></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>(747, 349)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </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>alias</key> + <value></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>(940, 350)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>id</key> + <value>blocks_char_to_float_1</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>alias</key> + <value></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, 529)</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>dec_ccsds</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>lentagname</key> + <value>None</value> + </param> + <param> + <key>alias</key> + <value></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>(1188, 308)</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_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>dec_cc</value> + </param> + <param> + <key>threadtype</key> + <value>capillary</value> + </param> + <param> + <key>ann</key> + <value>None</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>lentagname</key> + <value>None</value> + </param> + <param> + <key>alias</key> + <value></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>(1192, 488)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>id</key> + <value>blocks_char_to_float_1_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>alias</key> + <value></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>(1562, 487)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_delay</key> + <param> + <key>id</key> + <value>blocks_delay_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>delay</key> + <value>32</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>alias</key> + <value></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>(1634, 592)</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>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>2048</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>ymin</key> + <value>-0.5</value> + </param> + <param> + <key>ymax</key> + <value>1.5</value> + </param> + <param> + <key>nconnections</key> + <value>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>CCSDS</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>CC</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>0.6</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>label10</key> + <value></value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(1889, 404)</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_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>encoder_list</key> + <value>enc_ccsds</value> + </param> + <param> + <key>threadtype</key> + <value>capillary</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>lentagname</key> + <value>None</value> + </param> + <param> + <key>alias</key> + <value></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>(440, 318)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>id</key> + <value>blocks_char_to_float_0_1</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>alias</key> + <value></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>(441, 228)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_delay</key> + <param> + <key>id</key> + <value>blocks_delay_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>delay</key> + <value>32</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>alias</key> + <value></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>(696, 228)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_unpack_k_bits_bb</key> + <param> + <key>id</key> + <value>blocks_unpack_k_bits_bb_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>alias</key> + <value></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>(105, 430)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_vector_source_x</key> + <param> + <key>id</key> + <value>blocks_vector_source_x_0_1_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vector</key> + <value>(frame_size/15)*[1, 0, 1, 0, 3, 0, 7, 0, 15, 0, 31, 0, 63, 0, 127]</value> + </param> + <param> + <key>tags</key> + <value>[]</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>alias</key> + <value></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>(59, 200)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> + <block> + <key>variable_cc_encoder_def</key> + <param> + <key>id</key> + <value>enc_cc</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>frame_size*8</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>mode</key> + <value>fec.CC_STREAMING</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(443, 720)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_cc_decoder_def</key> + <param> + <key>id</key> + <value>dec_cc</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>4</value> + </param> + <param> + <key>framebits</key> + <value>frame_size*8</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>mode</key> + <value>fec.CC_STREAMING</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(739, 718)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_ccsds_encoder_def</key> + <param> + <key>id</key> + <value>enc_ccsds</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>4</value> + </param> + <param> + <key>framebits</key> + <value>frame_size*8</value> + </param> + <param> + <key>state_start</key> + <value>0</value> + </param> + <param> + <key>mode</key> + <value>fec.CC_STREAMING</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(1161, 742)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_ccsds_decoder_def</key> + <param> + <key>id</key> + <value>dec_ccsds</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>4</value> + </param> + <param> + <key>framebits</key> + <value>frame_size*8</value> + </param> + <param> + <key>state_start</key> + <value>0</value> + </param> + <param> + <key>end_state</key> + <value>-1</value> + </param> + <param> + <key>mode</key> + <value>fec.CC_STREAMING</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(1449, 735)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>id</key> + <value>blocks_char_to_float_0_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>alias</key> + <value></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>(1492, 350)</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_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>2048</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>ymin</key> + <value>-0.5</value> + </param> + <param> + <key>ymax</key> + <value>1.5</value> + </param> + <param> + <key>nconnections</key> + <value>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>Input</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>CCSDS</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>0.6</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>label10</key> + <value></value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(1885, 216)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_ctrlport_monitor_performance</key> + <param> + <key>id</key> + <value>blocks_ctrlport_monitor_performance_0</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>en</key> + <value>True</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(557, 17)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>id</key> + <value>frame_size</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Frame Size</value> + </param> + <param> + <key>value</key> + <value>60</value> + </param> + <param> + <key>type</key> + <value>intx</value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(249, 7)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>blocks_vector_source_x_0_1_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>analog_random_source_x_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_throttle_0</source_block_id> + <sink_block_id>blocks_unpack_k_bits_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>fec_extended_encoder_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_delay_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0</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>fec_extended_encoder_1</source_block_id> + <sink_block_id>digital_map_bb_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_map_bb_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>fec_extended_encoder_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_encoder_0</source_block_id> + <sink_block_id>digital_map_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_map_bb_0</source_block_id> + <sink_block_id>blocks_char_to_float_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_1</source_block_id> + <sink_block_id>fec_extended_decoder_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_delay_0_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_decoder_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_decoder_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_1_0</source_block_id> + <sink_block_id>blocks_delay_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_1</source_block_id> + <sink_block_id>blocks_delay_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-fec/examples/fecapi_encoders.grc b/gr-fec/examples/fecapi_encoders.grc new file mode 100644 index 0000000000..f2d320b416 --- /dev/null +++ b/gr-fec/examples/fecapi_encoders.grc @@ -0,0 +1,1198 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Wed May 7 19:04:31 2014</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>fecapi_encoders</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>2000,2000</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>50000</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(7, 95)</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(353, 695)</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>False</value> + </param> + <param> + <key>value</key> + <value>[79, 109]</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(412, 777)</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>[109, 79]</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(270, 780)</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(454, 692)</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(420, 9)</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>alias</key> + <value></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>(105, 331)</value> + </param> + <param> + <key>_rotation</key> + <value>0</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>False</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>alias</key> + <value></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>(111, 523)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> + <block> + <key>blocks_unpack_k_bits_bb</key> + <param> + <key>id</key> + <value>blocks_unpack_k_bits_bb_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>alias</key> + <value></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>(118, 440)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>id</key> + <value>frame_size</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Frame Size</value> + </param> + <param> + <key>value</key> + <value>60</value> + </param> + <param> + <key>type</key> + <value>intx</value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(249, 9)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_vector_source_x</key> + <param> + <key>id</key> + <value>blocks_vector_source_x_0_1_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vector</key> + <value>(frame_size/15)*[0, 0, 1, 0, 3, 0, 7, 0, 15, 0, 31, 0, 63, 0, 127]</value> + </param> + <param> + <key>tags</key> + <value>[]</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>alias</key> + <value></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>(133, 190)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> + <block> + <key>variable_cc_encoder_def</key> + <param> + <key>id</key> + <value>enc_cc</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>frame_size*8</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>mode</key> + <value>fec.CC_TERMINATED</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(550, 696)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_ccsds_encoder_def</key> + <param> + <key>id</key> + <value>enc_ccsds</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>4</value> + </param> + <param> + <key>framebits</key> + <value>frame_size*8</value> + </param> + <param> + <key>state_start</key> + <value>0</value> + </param> + <param> + <key>mode</key> + <value>fec.CC_TERMINATED</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(869, 700)</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_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>encoder_list</key> + <value>enc_ccsds</value> + </param> + <param> + <key>threadtype</key> + <value>none</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>lentagname</key> + <value>None</value> + </param> + <param> + <key>alias</key> + <value></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>(482, 287)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </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>alias</key> + <value></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>(818, 318)</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>enc_cc</value> + </param> + <param> + <key>threadtype</key> + <value>none</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>lentagname</key> + <value>None</value> + </param> + <param> + <key>alias</key> + <value></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>(481, 498)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>id</key> + <value>blocks_char_to_float_1</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>alias</key> + <value></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>(807, 527)</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>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>2048</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>ymin</key> + <value>-0.5</value> + </param> + <param> + <key>ymax</key> + <value>1.5</value> + </param> + <param> + <key>nconnections</key> + <value>2</value> + </param> + <param> + <key>update_time</key> + <value>0.05</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>CCSDS</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>CC</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>0.6</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>label10</key> + <value></value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(1163, 381)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_ctrlport_monitor_performance</key> + <param> + <key>id</key> + <value>blocks_ctrlport_monitor_performance_0</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>en</key> + <value>True</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(549, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>blocks_vector_source_x_0_1_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>analog_random_source_x_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_throttle_0</source_block_id> + <sink_block_id>blocks_unpack_k_bits_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>fec_extended_encoder_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_1</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0</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>fec_extended_encoder_0</source_block_id> + <sink_block_id>blocks_char_to_float_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_encoder_1</source_block_id> + <sink_block_id>blocks_char_to_float_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0</source_block_id> + <sink_block_id>fec_extended_encoder_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-fec/examples/fecapi_tagged_decoders.grc b/gr-fec/examples/fecapi_tagged_decoders.grc new file mode 100644 index 0000000000..b9936b8f41 --- /dev/null +++ b/gr-fec/examples/fecapi_tagged_decoders.grc @@ -0,0 +1,1439 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Wed May 7 19:28:30 2014</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>fecapi_tagged_decoders</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>3000,2000</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>alias</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>length_tag</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>"packet_len"</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(202, 112)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>50000</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(9, 95)</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(562, 734)</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(663, 731)</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>[109, 79]</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(479, 819)</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>False</value> + </param> + <param> + <key>value</key> + <value>[79, 109]</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(621, 816)</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(248, 9)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>id</key> + <value>MTU</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>MTU</value> + </param> + <param> + <key>value</key> + <value>1500</value> + </param> + <param> + <key>type</key> + <value>intx</value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(365, 9)</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_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>dec_cc</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>lentagname</key> + <value>length_tag</value> + </param> + <param> + <key>alias</key> + <value></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>(923, 464)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>id</key> + <value>blocks_char_to_float_1_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>alias</key> + <value></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>(1265, 506)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>id</key> + <value>blocks_char_to_float_1</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>alias</key> + <value></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>(678, 506)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_map_bb</key> + <param> + <key>id</key> + <value>digital_map_bb_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>map</key> + <value>[-1, 1]</value> + </param> + <param> + <key>alias</key> + <value></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>(493, 506)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>id</key> + <value>blocks_char_to_float_0_1</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>alias</key> + <value></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>(1014, 340)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_unpack_k_bits_bb</key> + <param> + <key>id</key> + <value>blocks_unpack_k_bits_bb_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>alias</key> + <value></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>(359, 341)</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>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>2048</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>ymin</key> + <value>-0.5</value> + </param> + <param> + <key>ymax</key> + <value>1.5</value> + </param> + <param> + <key>nconnections</key> + <value>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>Input</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>CC</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>0.6</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>label10</key> + <value></value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(1530, 372)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_vector_source_x</key> + <param> + <key>id</key> + <value>blocks_vector_source_x_0_1_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vector</key> + <value>4*[0, 0, 1, 0, 3, 0, 7, 0, 15, 0, 31, 0, 63, 0, 127]</value> + </param> + <param> + <key>tags</key> + <value>[]</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>alias</key> + <value></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>(123, 218)</value> + </param> + <param> + <key>_rotation</key> + <value>180</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>alias</key> + <value></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>(100, 341)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_stream_to_tagged_stream</key> + <param> + <key>id</key> + <value>blocks_stream_to_tagged_stream_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>packet_len</key> + <value>frame_size*8</value> + </param> + <param> + <key>len_tag_key</key> + <value>length_tag</value> + </param> + <param> + <key>alias</key> + <value></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>(595, 331)</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>enc_cc</value> + </param> + <param> + <key>threadtype</key> + <value>none</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>lentagname</key> + <value>length_tag</value> + </param> + <param> + <key>alias</key> + <value></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>(138, 474)</value> + </param> + <param> + <key>_rotation</key> + <value>0</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>False</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>alias</key> + <value></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>(99, 633)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> + <block> + <key>variable_cc_encoder_def</key> + <param> + <key>id</key> + <value>enc_cc</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>MTU*8</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>mode</key> + <value>fec.CC_STREAMING</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(759, 735)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_cc_decoder_def</key> + <param> + <key>id</key> + <value>dec_cc</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>4</value> + </param> + <param> + <key>framebits</key> + <value>MTU*8</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>mode</key> + <value>fec.CC_STREAMING</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(1060, 727)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_ctrlport_monitor_performance</key> + <param> + <key>id</key> + <value>blocks_ctrlport_monitor_performance_0</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>en</key> + <value>True</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(651, 15)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>id</key> + <value>frame_size</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Frame Size</value> + </param> + <param> + <key>value</key> + <value>6000</value> + </param> + <param> + <key>type</key> + <value>intx</value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(484, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>analog_random_source_x_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_vector_source_x_0_1_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_map_bb_0</source_block_id> + <sink_block_id>blocks_char_to_float_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_1</source_block_id> + <sink_block_id>fec_extended_decoder_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_decoder_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_1_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_encoder_0</source_block_id> + <sink_block_id>digital_map_bb_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_stream_to_tagged_stream_0_0</source_block_id> + <sink_block_id>fec_extended_encoder_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_stream_to_tagged_stream_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_0_1</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0_0</source_block_id> + <sink_block_id>blocks_stream_to_tagged_stream_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_throttle_0</source_block_id> + <sink_block_id>blocks_unpack_k_bits_bb_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-fec/examples/fecapi_tagged_encoders.grc b/gr-fec/examples/fecapi_tagged_encoders.grc new file mode 100644 index 0000000000..d6a05046a6 --- /dev/null +++ b/gr-fec/examples/fecapi_tagged_encoders.grc @@ -0,0 +1,1656 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Wed May 7 19:01:11 2014</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>fecapi_tagged_encoders</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>2000,2000</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 9)</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(421, 692)</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>[109, 79]</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(335, 777)</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>False</value> + </param> + <param> + <key>value</key> + <value>[79, 109]</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(479, 781)</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(522, 694)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>50000</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(13, 88)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>length_tag</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>"packet_len"</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(152, 116)</value> + </param> + <param> + <key>_rotation</key> + <value>0</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>False</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>alias</key> + <value></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>(92, 616)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> + <block> + <key>blocks_unpack_k_bits_bb</key> + <param> + <key>id</key> + <value>blocks_unpack_k_bits_bb_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>k</key> + <value>8</value> + </param> + <param> + <key>alias</key> + <value></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>(128, 428)</value> + </param> + <param> + <key>_rotation</key> + <value>180</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>alias</key> + <value></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>(120, 355)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_vector_source_x</key> + <param> + <key>id</key> + <value>blocks_vector_source_x_0_1_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vector</key> + <value>4*[0, 0, 1, 0, 3, 0, 7, 0, 15, 0, 31, 0, 63, 0, 127]</value> + </param> + <param> + <key>tags</key> + <value>[]</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>alias</key> + <value></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>(94, 226)</value> + </param> + <param> + <key>_rotation</key> + <value>180</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>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(247, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>id</key> + <value>MTU</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>MTU</value> + </param> + <param> + <key>value</key> + <value>1500</value> + </param> + <param> + <key>type</key> + <value>intx</value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(364, 9)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_stream_to_tagged_stream</key> + <param> + <key>id</key> + <value>blocks_stream_to_tagged_stream_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>packet_len</key> + <value>frame_size*8</value> + </param> + <param> + <key>len_tag_key</key> + <value>length_tag</value> + </param> + <param> + <key>alias</key> + <value></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>(158, 515)</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>enc_cc</value> + </param> + <param> + <key>threadtype</key> + <value>none</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>lentagname</key> + <value>length_tag</value> + </param> + <param> + <key>alias</key> + <value></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>(540, 494)</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_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>encoder_list</key> + <value>enc_ccsds</value> + </param> + <param> + <key>threadtype</key> + <value>none</value> + </param> + <param> + <key>puncpat</key> + <value>puncpat</value> + </param> + <param> + <key>lentagname</key> + <value>length_tag</value> + </param> + <param> + <key>alias</key> + <value></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>(541, 339)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_cc_encoder_def</key> + <param> + <key>id</key> + <value>enc_cc</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>MTU*8</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>mode</key> + <value>fec.CC_TERMINATED</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(621, 693)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_ccsds_encoder_def</key> + <param> + <key>id</key> + <value>enc_ccsds</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>4</value> + </param> + <param> + <key>framebits</key> + <value>MTU*8</value> + </param> + <param> + <key>state_start</key> + <value>0</value> + </param> + <param> + <key>mode</key> + <value>fec.CC_TERMINATED</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(915, 695)</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_0_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>2048</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>ymin</key> + <value>-0.5</value> + </param> + <param> + <key>ymax</key> + <value>1.5</value> + </param> + <param> + <key>nconnections</key> + <value>1</value> + </param> + <param> + <key>update_time</key> + <value>0.05</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>packet_len</value> + </param> + <param> + <key>label1</key> + <value>CCSDS</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>CC</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>0.6</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>label10</key> + <value></value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(1106, 494)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>id</key> + <value>frame_size</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Frame Size</value> + </param> + <param> + <key>value</key> + <value>60</value> + </param> + <param> + <key>type</key> + <value>intx</value> + </param> + <param> + <key>short_id</key> + <value></value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(483, 10)</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_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>2048</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>ymin</key> + <value>-0.5</value> + </param> + <param> + <key>ymax</key> + <value>1.5</value> + </param> + <param> + <key>nconnections</key> + <value>1</value> + </param> + <param> + <key>update_time</key> + <value>0.05</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>packet_len</value> + </param> + <param> + <key>label1</key> + <value>CCSDS</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>CC</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>0.6</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>label10</key> + <value></value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(1111, 339)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>id</key> + <value>blocks_char_to_float_1_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>alias</key> + <value></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>(880, 370)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_char_to_float</key> + <param> + <key>id</key> + <value>blocks_char_to_float_1</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>alias</key> + <value></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>(881, 525)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blocks_ctrlport_monitor_performance</key> + <param> + <key>id</key> + <value>blocks_ctrlport_monitor_performance_0</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>en</key> + <value>True</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(651, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>blocks_stream_to_tagged_stream_0_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_stream_to_tagged_stream_0_0</source_block_id> + <sink_block_id>fec_extended_encoder_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_encoder_0</source_block_id> + <sink_block_id>blocks_char_to_float_1</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>blocks_vector_source_x_0_1_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_unpack_k_bits_bb_0_0</source_block_id> + <sink_block_id>blocks_stream_to_tagged_stream_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_throttle_0</source_block_id> + <sink_block_id>blocks_unpack_k_bits_bb_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_1</source_block_id> + <sink_block_id>qtgui_time_sink_x_0_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_char_to_float_1_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fec_extended_encoder_0_0</source_block_id> + <sink_block_id>blocks_char_to_float_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-fec/grc/fec_block_tree.xml b/gr-fec/grc/fec_block_tree.xml index de975ca5c2..4d1a51aef7 100644 --- a/gr-fec/grc/fec_block_tree.xml +++ b/gr-fec/grc/fec_block_tree.xml @@ -11,10 +11,12 @@ <cat> <name>Decoders</name> <block>variable_cc_decoder_def</block> + <block>variable_ccsds_decoder_def</block> </cat> <cat> <name>Encoders</name> <block>variable_cc_encoder_def</block> + <block>variable_ccsds_encoder_def</block> </cat> <block>fec_extended_encoder</block> <block>fec_extended_decoder</block> diff --git a/gr-fec/grc/fec_depuncture_bb.xml b/gr-fec/grc/fec_depuncture_bb.xml index 37173b35ba..1a7615d176 100644 --- a/gr-fec/grc/fec_depuncture_bb.xml +++ b/gr-fec/grc/fec_depuncture_bb.xml @@ -3,11 +3,11 @@ <name>Depuncture</name> <key>fec_depuncture_bb</key> <import>from gnuradio import fec</import> - <make>fec.depucture_bb($delay, $puncpat, $puncholes, $puncsize)</make> + <make>fec.depucture_bb($delay, $puncpat, $puncholes, $puncsize, $sym)</make> <param> - <name>Delay</name> - <key>delay</key> + <name>Puncture Size</name> + <key>puncsize</key> <type>int</type> </param> @@ -18,15 +18,18 @@ </param> <param> - <name>Puncture Holes</name> - <key>puncholes</key> + <name>Delay</name> + <key>delay</key> + <value>0</value> <type>int</type> </param> <param> - <name>Puncture Size</name> - <key>puncsize</key> + <name>Symbol</name> + <key>sym</key> + <value>127</value> <type>int</type> + <hide>part</hide> </param> <sink> diff --git a/gr-fec/grc/fec_extended_decoder.xml b/gr-fec/grc/fec_extended_decoder.xml index 4262a395ae..b41c18a9ea 100644 --- a/gr-fec/grc/fec_extended_decoder.xml +++ b/gr-fec/grc/fec_extended_decoder.xml @@ -3,7 +3,7 @@ <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> + <make>self.$(id) = $(id) = fec.extended_decoder(decoder_obj_list=$decoder_list, threading=$threadtype.arg, ann=$ann, puncpat=$puncpat, integration_period=10000, lentagname=$lentagname)</make> <param> <name>fake val</name> @@ -55,6 +55,13 @@ <type>string</type> </param> + <param> + <name>Length Tag Name</name> + <key>lentagname</key> + <value>None</value> + <type>string</type> + </param> + <sink> <name>in</name> <type>float</type> diff --git a/gr-fec/grc/fec_extended_encoder.xml b/gr-fec/grc/fec_extended_encoder.xml index 5055ca08d5..2c785c7d83 100644 --- a/gr-fec/grc/fec_extended_encoder.xml +++ b/gr-fec/grc/fec_extended_encoder.xml @@ -3,7 +3,7 @@ <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> + <make>fec.extended_encoder(encoder_obj_list=$encoder_list, threading=$threadtype.arg, puncpat=$puncpat, lentagname=$lentagname)</make> <param> <name>Encoder Objects</name> @@ -40,6 +40,13 @@ <type>string</type> </param> + <param> + <name>Length Tag Name</name> + <key>lentagname</key> + <value>None</value> + <type>string</type> + </param> + <sink> <name>in</name> <type>byte</type> diff --git a/gr-fec/grc/variable_cc_decoder_def_list.xml b/gr-fec/grc/variable_cc_decoder_def_list.xml index 52ec1c49c0..57d8ef563d 100644 --- a/gr-fec/grc/variable_cc_decoder_def_list.xml +++ b/gr-fec/grc/variable_cc_decoder_def_list.xml @@ -10,9 +10,9 @@ <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 +self.$(id) = $(id) = map( (lambda a: fec.cc_decoder.make($framebits, $k, $rate, $polys, $state_start, $state_end, $mode)), 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 +self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.cc_decoder.make($framebits, $k, $rate, $polys, $state_start, $state_end, $mode)), range(0,$dim2) ) ), range(0,$dim1)); #slurp #end if</var_make> <make></make> @@ -100,45 +100,27 @@ self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.cc_decoder.make($frame <param> <name>Streaming Behavior</name> - <key>strb</key> + <key>mode</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> + <key>fec.CC_STREAMING</key> </option> <option> - <name>Tailbiting</name> - <key>"tailbiting"</key> - <opt>streaming:False</opt> - <opt>tailbiting:True</opt> - <opt>terminated:False</opt> - <opt>truncated:False</opt> + <name>Terminated</name> + <key>fec.CC_TERMINATED</key> </option> <option> - <name>Terminated</name> - <key>"terminated"</key> - <opt>streaming:False</opt> - <opt>tailbiting:False</opt> - <opt>terminated:True</opt> - <opt>truncated:False</opt> + <name>Tailbiting</name> + <key>fec.CC_TAILBITING</key> </option> <option> <name>Truncated</name> - <key>"truncated"</key> - <opt>streaming:False</opt> - <opt>tailbiting:False</opt> - <opt>terminated:False</opt> - <opt>truncated:True</opt> + <key>fec.CC_TRUNCATED</key> </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 index 18bc2515a1..6b20401b47 100644 --- a/gr-fec/grc/variable_cc_encoder_def_list.xml +++ b/gr-fec/grc/variable_cc_encoder_def_list.xml @@ -10,9 +10,9 @@ <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 +self.$(id) = $(id) = map( (lambda a: fec.cc_encoder_make($framebits, $k, $rate, $polys, $state_start, $mode)), 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 +self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.cc_encoder_make($framebits, $k, $rate, $polys, $state_start, $mode)), range(0,$dim2) ) ), range(0,$dim1)); #slurp #end if</var_make> <make></make> @@ -92,48 +92,25 @@ self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.cc_encoder_make($frame </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> + <key>mode</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> + <key>fec.CC_STREAMING</key> </option> <option> - <name>Tailbiting</name> - <key>"tailbiting"</key> - <opt>streaming:False</opt> - <opt>tailbiting:True</opt> - <opt>terminated:False</opt> - <opt>truncated:False</opt> + <name>Terminated</name> + <key>fec.CC_TERMINATED</key> </option> <option> - <name>Terminated</name> - <key>"terminated"</key> - <opt>streaming:False</opt> - <opt>tailbiting:False</opt> - <opt>terminated:True</opt> - <opt>truncated:False</opt> + <name>Tailbiting</name> + <key>fec.CC_TAILBITING</key> </option> <option> <name>Truncated</name> - <key>"truncated"</key> - <opt>streaming:False</opt> - <opt>tailbiting:False</opt> - <opt>terminated:False</opt> - <opt>truncated:True</opt> + <key>fec.CC_TRUNCATED</key> </option> </param> diff --git a/gr-fec/grc/variable_ccsds_decoder_def_list.xml b/gr-fec/grc/variable_ccsds_decoder_def_list.xml new file mode 100644 index 0000000000..1017a81725 --- /dev/null +++ b/gr-fec/grc/variable_ccsds_decoder_def_list.xml @@ -0,0 +1,93 @@ +<?xml version="1.0"?> +<!-- +################################################### +# FEC CCSDS Decoder +################################################### + --> +<block> + <name>CCSDS Decoder Definition</name> + <key>variable_ccsds_decoder_def</key> + <import>from gnuradio import fec</import> + <var_make> +#if int($ndim())==1 # +self.$(id) = $(id) = map( (lambda a: fec.ccsds_decoder.make($framebits, $state_start, $end_state, $mode)), range(0,$dim1) ); #slurp +#else +self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.ccsds_decoder.make($framebits, $state_start, $end_state, $mode)), 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>Start State</name> + <key>state_start</key> + <value>0</value> + <type>int</type> + </param> + + <param> + <name>End State</name> + <key>end_state</key> + <value>-1</value> + <type>int</type> + </param> + + <param> + <name>Streaming Behavior</name> + <key>mode</key> + <value></value> + <type>enum</type> + <option> + <name>Streaming</name> + <key>fec.CC_STREAMING</key> + </option> + </param> + + <doc> + </doc> +</block> diff --git a/gr-fec/grc/variable_ccsds_encoder_def_list.xml b/gr-fec/grc/variable_ccsds_encoder_def_list.xml new file mode 100644 index 0000000000..72623a6410 --- /dev/null +++ b/gr-fec/grc/variable_ccsds_encoder_def_list.xml @@ -0,0 +1,98 @@ +<?xml version="1.0"?> +<!-- +################################################### +# FEC MAKING FOR GREAT JUSTICE +################################################### + --> +<block> + <name>CCSDS Encoder Definition</name> + <key>variable_ccsds_encoder_def</key> + <import>from gnuradio import fec</import> + <var_make> +#if int($ndim())==1 # +self.$(id) = $(id) = map( (lambda a: fec.ccsds_encoder_make($framebits, $state_start, $mode)), range(0,$dim1) ); #slurp +#else +self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.ccsds_encoder_make($framebits, $state_start, $mode)), 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>Start State</name> + <key>state_start</key> + <value>0</value> + <type>int</type> + </param> + + <param> + <name>Streaming Behavior</name> + <key>mode</key> + <value></value> + <type>enum</type> + <option> + <name>Streaming</name> + <key>fec.CC_STREAMING</key> + </option> + <option> + <name>Terminated</name> + <key>fec.CC_TERMINATED</key> + </option> + <option> + <name>Tailbiting</name> + <key>fec.CC_TAILBITING</key> + </option> + <option> + <name>Truncated</name> + <key>fec.CC_TRUNCATED</key> + </option> + </param> + + <doc> + </doc> +</block> diff --git a/gr-fec/include/gnuradio/fec/CMakeLists.txt b/gr-fec/include/gnuradio/fec/CMakeLists.txt index 68aae6a862..01b1e71946 100644 --- a/gr-fec/include/gnuradio/fec/CMakeLists.txt +++ b/gr-fec/include/gnuradio/fec/CMakeLists.txt @@ -78,10 +78,14 @@ install(FILES api.h generic_decoder.h generic_encoder.h - encoder.h decoder.h - cc_encoder.h + encoder.h + tagged_decoder.h + tagged_encoder.h cc_decoder.h + cc_encoder.h + ccsds_decoder.h + ccsds_encoder.h decode_ccsds_27_fb.h encode_ccsds_27_bb.h rs.h diff --git a/gr-fec/include/gnuradio/fec/cc_common.h b/gr-fec/include/gnuradio/fec/cc_common.h index 33cf9152e1..8abf565d4a 100644 --- a/gr-fec/include/gnuradio/fec/cc_common.h +++ b/gr-fec/include/gnuradio/fec/cc_common.h @@ -23,25 +23,29 @@ #ifndef INCLUDED_FEC_CC_COMMON_H #define INCLUDED_FEC_CC_COMMON_H -typedef unsigned char DECISIONTYPE; -typedef unsigned char COMPUTETYPE; +typedef enum _cc_mode_t { + CC_STREAMING = 0, + CC_TERMINATED, + CC_TRUNCATED, + CC_TAILBITING +} cc_mode_t; typedef union { //decision_t is a BIT vector - DECISIONTYPE* t; + unsigned char* t; unsigned int* w; unsigned short* s; unsigned char* c; } decision_t; typedef union { - COMPUTETYPE* t; + unsigned char* t; } metric_t; struct v { - COMPUTETYPE *metrics; + unsigned char *metrics; metric_t old_metrics,new_metrics,metrics1,metrics2; /* Pointers to path metrics, swapped on every bit */ - DECISIONTYPE *decisions; + unsigned char *decisions; }; #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 index 3babb5e9bd..11f21123ba 100644 --- a/gr-fec/include/gnuradio/fec/cc_decoder.h +++ b/gr-fec/include/gnuradio/fec/cc_decoder.h @@ -25,32 +25,94 @@ #include <gnuradio/fec/api.h> #include <gnuradio/fec/generic_decoder.h> +#include <gnuradio/fec/cc_common.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, - 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; - }; + typedef void(*conv_kernel)(unsigned char *Y, unsigned char *X, + unsigned char *syms, unsigned char *dec, + unsigned int framebits, unsigned int excess, + unsigned char *Branchtab); + + /*! + * \brief Convolutional Code Decoding class. + * \ingroup error_coding_blk + * + * \details + * This class performs convolutional decoding via the Viterbi + * algorithm. While it is set up to take variable values for K, + * rate, and the polynomials, currently, the block is only + * capable of handling the following settings: + * + * \li K = 7 + * \li rate = 1/2 (given as 2 to the constructor) + * \li polynomials = [109, 79] + * + * This is the well-known convolutional part of the Voyager code + * implemented in the CCSDS encoder. See + * gr::fec::code::ccsds_decoder for another variation on this + * block. + * + * Currently, in profiling tests run, the VOLK-accelerated + * Viterbi code used in this block specific to the CCSDS code + * runs faster than the ccsds_decoder version. Furthenr, due to + * I/O issues, the ccsds_decoder does not fully handle all + * streaming behaviors, only 'Streaming' mode. This block + * enables all four streaming modes. + * + * The intent of having both FECAPI code classes is to + * eventually allow this block to take on generic settings, much + * like the cc_encoder class. The ccsds_decoder would then + * handle this specific code case as optimized as possible. + * + * The encoder is set up wtih a number of bits per frame in the + * constructor. When not being used in a tagged stream mode, + * this encoder will only process frames of the length provided + * here. If used in a tagged stream block, this setting becomes + * the maximum allowable frame size that the block may process. + */ + class FEC_API cc_decoder : virtual public generic_decoder + { + public: + + /*! + * Build a convolutional code decoding FECAPI object. + * + * \param frame_size Number of bits per frame. If using in the + * tagged stream style, this is the maximum allowable + * number of bits per frame. + * \param k Constraint length (K) of the encoder. + * \param rate Inverse of the coder's rate + * (rate=2 means 2 output bits per 1 input). + * \param polys Vector of polynomials as integers. + * \param start_state Initialization state of the shift register. + * \param end_state Ending state of the shift register. + * \param mode cc_mode_t mode of the encoding. + */ + static generic_decoder::sptr make + (int frame_size, int k, + int rate, std::vector<int> polys, + int start_state=0, int end_state=-1, + cc_mode_t mode=CC_STREAMING); + + /*! + * Sets the uncoded frame size to \p frame_size. If \p + * frame_size is greater than the value given to the + * constructor, the frame size will be capped by that initial + * value and this function will return false. Otherwise, it + * returns true. + */ + virtual bool set_frame_size(unsigned int frame_size) = 0; + + /*! + * Returns the coding rate of this encoder. + */ + virtual double rate() = 0; + }; } /* namespace code */ } /* namespace fec */ diff --git a/gr-fec/include/gnuradio/fec/cc_encoder.h b/gr-fec/include/gnuradio/fec/cc_encoder.h index 1857e92c9c..28dd5f4db2 100644 --- a/gr-fec/include/gnuradio/fec/cc_encoder.h +++ b/gr-fec/include/gnuradio/fec/cc_encoder.h @@ -34,18 +34,101 @@ namespace gr { namespace code { /*! - * \brief Convolutional Code Encoding block + * \brief Convolutional Code Encoding class. * \ingroup error_coding_blk + * + * \details + * This class performs convolutional encoding for unpacked bits + * for frames of a constant length. This class is general in its + * application of the convolutional encoding and allows us to + * specify the constraint length, the coding rate, and the + * polynomials used in the coding process. + * + * The parameter \p k sets the constraint length directly. We + * set the coding rate by setting \p rate to R given a desired + * rate of 1/R. That is, for a rate 1/2 coder, we would set \p + * rate to 2. And the polynomial is specified as a vector of + * integers, where each integer represents the coding polynomial + * for a different arm of the code. The number of polynomials + * given must be the same as the value \p rate. + * + * The encoding object holds a shift register that takes in each + * bit from the input stream and then ANDs the shift register + * with each polynomial, and places the parity of the result + * into the output stream. The output stream is therefore also + * unpakced bits. + * + * The encoder is set up wtih a number of bits per frame in the + * constructor. When not being used in a tagged stream mode, + * this encoder will only process frames of the length provided + * here. If used in a tagged stream block, this setting becomes + * the maximum allowable frame size that the block may process. + * + * The \p mode is a cc_mode_t that specifies how the convolutional + * encoder will behave and under what conditions. + * + * \li 'CC_STREAMING': mode expects an uninterrupted flow of + * samples into the encoder, and the output stream is + * continually encoded. + * + * \li 'CC_TERMINATED': is a mode designed for packet-based + * systems. This mode adds rate*(k-1) bits to the output as a + * way to help flush the decoder. + * + * \li 'CC_TAILBITING': is another packet-based method. Instead of + * adding bits onto the end of the packet, this mode will + * continue the code between the payloads of packets by + * pre-initializing the state of the new packet based on the + * state of the last packet for (k-1) bits. + * + * \li 'CC_TRUNCATED': a truncated code always resets the registers + * to the \p start_state between frames. + * + * A common convolutional encoder uses K=7, Rate=1/2, + * Polynomials=[109, 79]. This is the Voyager code from NASA: + * \li 109: b(1101101) --> 1 + x + x^3 + x^4 + x^6 + * \li 79: b(1001111) --> 1 + x^3 + x^4 + x^5 + x^6 + * + * Another encoder class is providee with gr-fec called the + * gr::fec::code::ccsds_encoder, which implements the above code + * that is more highly optimized for just those specific + * settings. */ class FEC_API cc_encoder : virtual public generic_encoder { public: + + /*! + * Build a convolutional code encoding FECAPI object. + * + * \param frame_size Number of bits per frame. If using in the + * tagged stream style, this is the maximum allowable + * number of bits per frame. + * \param k Constraint length (K) of the encoder. + * \param rate Inverse of the coder's rate + * (rate=2 means 2 output bits per 1 input). + * \param polys Vector of polynomials as integers. + * \param start_state Initialization state of the shift register. + * \param mode cc_mode_t mode of the encoding. + */ 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); + (int frame_size, int k, int rate, + std::vector<int> polys, int start_state = 0, + cc_mode_t mode=CC_STREAMING); + + /*! + * Sets the uncoded frame size to \p frame_size. If \p + * frame_size is greater than the value given to the + * constructor, the frame size will be capped by that initial + * value and this function will return false. Otherwise, it + * returns true. + */ + virtual bool set_frame_size(unsigned int frame_size) = 0; + + /*! + * Returns the coding rate of this encoder. + */ + virtual double rate() = 0; }; } /* namespace code */ diff --git a/gr-fec/include/gnuradio/fec/ccsds_decoder.h b/gr-fec/include/gnuradio/fec/ccsds_decoder.h new file mode 100644 index 0000000000..84212b4021 --- /dev/null +++ b/gr-fec/include/gnuradio/fec/ccsds_decoder.h @@ -0,0 +1,99 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#ifndef INCLUDED_FEC_CCSDS_DECODER_H +#define INCLUDED_FEC_CCSDS_DECODER_H + +#include <gnuradio/fec/api.h> +#include <gnuradio/fec/generic_decoder.h> +#include <gnuradio/fec/cc_common.h> +#include <map> +#include <string> + +namespace gr { + namespace fec { + namespace code { + + /*! + * \brief Convolutional Code Decoding class. + * \ingroup error_coding_blk + * + * \details + * This class performs convolutional decoding via the Viterbi + * algorithm specific to the CCSDS code: + * + * \li K = 7 + * \li rate = 1/2 + * \li polynomials = [109, 79] + * + * This is the well-known convolutional part of the Voyager + * code. See the discussion in gr::fec::code::cc_decoder for + * the current state of convolutional decoding. + * + * Currently, this block is transitional and only implements + * parts of the FECAPI. + * + * The encoder is set up wtih a number of bits per frame in the + * constructor. When not being used in a tagged stream mode, + * this encoder will only process frames of the length provided + * here. If used in a tagged stream block, this setting becomes + * the maximum allowable frame size that the block may process. + */ + class FEC_API ccsds_decoder : virtual public generic_decoder + { + public: + + /*! + * Build a convolutional code decoding FECAPI object. + * + * \param frame_size Number of bits per frame. If using in the + * tagged stream style, this is the maximum allowable + * number of bits per frame. + * \param start_state Initialization state of the shift register. + * \param end_state Ending state of the shift register. + * \param mode cc_mode_t mode of the encoding. + */ + static generic_decoder::sptr make + (int frame_size, + int start_state=0, int end_state=-1, + cc_mode_t mode=CC_STREAMING); + + /*! + * Sets the uncoded frame size to \p frame_size. If \p + * frame_size is greater than the value given to the + * constructor, the frame size will be capped by that initial + * value and this function will return false. Otherwise, it + * returns true. + */ + virtual bool set_frame_size(unsigned int frame_size) = 0; + + /*! + * Returns the coding rate of this encoder. + */ + virtual double rate() = 0; + }; + + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ + +#endif /* INCLUDED_FEC_CCSDS_DECODER_H */ diff --git a/gr-fec/include/gnuradio/fec/ccsds_encoder.h b/gr-fec/include/gnuradio/fec/ccsds_encoder.h new file mode 100644 index 0000000000..9fa364a42e --- /dev/null +++ b/gr-fec/include/gnuradio/fec/ccsds_encoder.h @@ -0,0 +1,117 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#ifndef INCLUDED_FEC_CCSDS_ENCODER_H +#define INCLUDED_FEC_CCSDS_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 CCSDS Encoding class for convolutional encoding with + * rate 1/2, K=7, and polynomials [109, 79]. + * \ingroup error_coding_blk + * + * \details + * + * Uses Phil Karn's (KA9Q) implementation of the CCSDS encoder + * for rate 1/2, K=7, and CC polynomial [109, 79]. These are + * non-adjustable in this encoder. For an adjustable CC encoder + * where we can set the rate, constraint length, and polynomial, + * see gr::fec::code::cc_encoder. + * + * The encoder is set up wtih a number of bits per frame in the + * constructor. When not being used in a tagged stream mode, + * this encoder will only process frames of the length provided + * here. If used in a tagged stream block, this setting becomes + * the maximum allowable frame size that the block may process. + * + * The \p mode is a cc_mode_t that specifies how the convolutional + * encoder will behave and under what conditions. + * + * \li 'CC_STREAMING': mode expects an uninterrupted flow of + * samples into the encoder, and the output stream is + * continually encoded. + * + * \li 'CC_TERMINATED': is a mode designed for packet-based + * systems. This mode adds rate*(k-1) bits to the output as a + * way to help flush the decoder. + * + * \li 'CC_TAILBITING': is another packet-based method. Instead of + * adding bits onto the end of the packet, this mode will + * continue the code between the payloads of packets by + * pre-initializing the state of the new packet based on the + * state of the last packet for (k-1) bits. + * + * \li 'CC_TRUNCATED': a truncated code always resets the registers + * to the \p start_state between frames. + * + * A common convolutional encoder uses K=7, Rate=1/2, + * Polynomials=[109, 79]. This is the Voyager code from NASA: + * \li 109: b(1101101) --> 1 + x + x^3 + x^4 + x^6 + * \li 79: b(1001111) --> 1 + x^3 + x^4 + x^5 + x^6 + */ + class FEC_API ccsds_encoder : virtual public generic_encoder + { + public: + + /*! + * Build the CCSDS (rate=1/2, K=7, polys=[109,79] + * convolutional code FECAPI object. + * + * \param frame_size Number of bits per frame. If using in the + * tagged stream style, this is the maximum allowable + * number of bits per frame. + * \param start_state Initialization state of the shift register. + * \param mode cc_mode_t mode of the encoding. + */ + static generic_encoder::sptr make + (int frame_size, int start_state = 0, + cc_mode_t mode=CC_STREAMING); + + /*! + * Sets the uncoded frame size to \p frame_size. If \p + * frame_size is greater than the value given to the + * constructor, the frame size will be capped by that initial + * value and this function will return false. Otherwise, it + * returns true. + */ + virtual bool set_frame_size(unsigned int frame_size) = 0; + + /*! + * Returns the coding rate of this encoder. + */ + virtual double rate() = 0; + }; + + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ + +#endif /* INCLUDED_FEC_CCSDS_ENCODER_H */ diff --git a/gr-fec/include/gnuradio/fec/decoder.h b/gr-fec/include/gnuradio/fec/decoder.h index a4cbf36db6..79eeef2197 100644 --- a/gr-fec/include/gnuradio/fec/decoder.h +++ b/gr-fec/include/gnuradio/fec/decoder.h @@ -33,12 +33,50 @@ namespace gr { namespace fec { + /*! + * \brief General FEC decoding block that takes in a decoder + * variable object (derived from gr::fec::general_decoder) for use + * in a flowgraph. + * + * \ingroup error_coding_blk + * + * \details + * This block uses a decoder variable object (derived from + * gr::fec::generic_decoder) to decode data within a + * flowgraph. This block interacts with the general FECAPI + * architecture to handle all passing all input and output data in + * a flowgraph. The decoder variable takes care of understanding + * the requirements, data types and sizes, and boundary conditions + * of the specific FEC decoding algorithm. + * + * Generally, this block is used within the fec.extended_decoder + * Python block to handle some input/output formatting issues. In + * the FECAPI, the decoder variable sets properties like the input + * and output types and sizes and whether the output is packed or + * unpacked bytes. The fec.extended_decoder uses this information + * to set up an gr::hier_block2 structure to make sure the I/O to + * the variable is handled consistently, such as to make sure all + * inputs are floats with one soft symbol per item and the outputs + * are unpacked bytes with the bit in the LSB. + * + * See gr::fec::generic_decoder for detail on what information an + * FECAPI variable object can set if using this block directly and + * not as part of the fec.extended_decoder. + */ class FEC_API decoder : virtual public block { public: typedef boost::shared_ptr<decoder> sptr; typedef boost::shared_array<unsigned char> buf_sptr; + /*! + * Create the FEC decoder block by taking in the FECAPI decoder + * object as well as input and output sizes. + * + * \param my_decoder An FECAPI decoder object (See gr::fec::generic_decoder). + * \param input_item_size The size of the input items (often the my_decoder object can tell us this). + * \param output_item_size The size of the output items (often the my_decoder object can tell us this). + */ static sptr make(generic_decoder::sptr my_decoder, size_t input_item_size, size_t output_item_size); diff --git a/gr-fec/include/gnuradio/fec/depuncture_bb.h b/gr-fec/include/gnuradio/fec/depuncture_bb.h index e7ee51a0f4..de11defd2a 100644 --- a/gr-fec/include/gnuradio/fec/depuncture_bb.h +++ b/gr-fec/include/gnuradio/fec/depuncture_bb.h @@ -30,12 +30,62 @@ namespace gr { namespace fec { /*! - * \brief Depuncture block in FECAPI + * \brief Depuncture a stream of samples. * \ingroup error_coding_blk * * \details + + * Depuncture a given block of input samples of \p puncsize. The + * items produced is based on the pattern \p puncpat. Basically, + * if: + * + * \code + * k = 0 + * if _puncpat[i] == 1: + * out[i] = input[k++] + * else: + * out[i] = symbol # default sym=127 + * \endcode + * + * This block is designed for unpacked bits - that is, every + * input sample is a bit, either a 1 or 0. It's possible to use + * packed bits as symbols, but the depuncturing will be done on + * the symbol level, not the bit level. + * + * \p puncpat is specified as a 32-bit integer that we can + * convert into the vector _puncpat used in the algorithm above: + * + * \code + * _puncpat = [0,...] + * for i in puncsize: + * _puncpat[i] = puncpat >> (puncsize-1-i) + * \endcode + * + * Example: + * \code + * puncsize = 8 + * puncpat = 0xEF --> [1,1,1,0,1,1,1,1] + * input = [a, b, c, d, e, f, g, h] + * output = [a, b, c, 127, e, f, g, h] + * \endcode + * + * The gr.fec Python module provides a read_bitlist function + * that can turn a string of a puncture pattern into the correct + * integer form. The pattern of 0xEF could be specified as + * fec.readbitlist("11101111"). Also, this allows us to use + * puncsize=len("11101111") to make sure that our sizes are set + * up correctly for the pattern we want. + * + * The fec.extended_decoder takes in the puncture pattern + * directly as a string and uses the readbitlist inside to do + * the conversion. * - * What does this block do? + * The \p delay parameter delays the application of the puncture + * pattern. This is equivalent to circularly rotating the \p + * puncpat by \p delay. Note that because of the circular shift, + * the delay should be between 0 and \p puncsize, but this is + * not enforced; the effective delay will simply be \p delay mod + * \p puncsize. A negative value here is ignored. */ class FEC_API depuncture_bb : virtual public block { @@ -43,8 +93,16 @@ namespace gr { // gr::fec::depuncture_bb::sptr typedef boost::shared_ptr<depuncture_bb> sptr; - static sptr make(int delay, int puncpat, - int puncholes, int puncsize); + /*! + * \brief Constructs a depuncture block. + * + * \param puncsize Size of block of bits to puncture + * \param puncpat The puncturing pattern + * \param delay Delayed the puncturing pattern by shifting it + * \param symbol The symbol to reinsert into the stream (def=127) + */ + static sptr make(int puncsize, int puncpat, + int delay=0, char symbol=127); }; } /* namespace fec */ diff --git a/gr-fec/include/gnuradio/fec/encoder.h b/gr-fec/include/gnuradio/fec/encoder.h index 821c213896..fae4bdfdda 100644 --- a/gr-fec/include/gnuradio/fec/encoder.h +++ b/gr-fec/include/gnuradio/fec/encoder.h @@ -31,11 +31,31 @@ namespace gr { namespace fec { + /*! + * \brief Creates the encoder block for use in GNU Radio + * flowgraphs from a given FECAPI object derived from the + * generic_encoder class. + * \ingroup error_coding_blk + * + * \details + * + * Generally, we would use the fec.extended_encoder Python + * implementation to instantiate this. The extended_encoder wraps + * up a few more details, like taking care of puncturing as well + * as the encoder itself. + */ class FEC_API encoder : virtual public block { public: typedef boost::shared_ptr<encoder> sptr; + /*! + * Build the FEC encoder block from an FECAPI encoder object. + * + * \param my_encoder An FECAPI encoder object child of the generic_encoder class. + * \param input_item_size size of a block of data for the encoder. + * \param output_item_size size of a block of data the encoder will produce. + */ static sptr make(generic_encoder::sptr my_encoder, size_t input_item_size, size_t output_item_size); diff --git a/gr-fec/include/gnuradio/fec/generic_decoder.h b/gr-fec/include/gnuradio/fec/generic_decoder.h index 335ee85ac8..0e14d49e76 100644 --- a/gr-fec/include/gnuradio/fec/generic_decoder.h +++ b/gr-fec/include/gnuradio/fec/generic_decoder.h @@ -24,17 +24,47 @@ #define INCLUDED_FEC_GENERIC_DECODER_H #include <gnuradio/fec/api.h> +#include <gnuradio/logger.h> #include <boost/shared_ptr.hpp> #include <boost/format.hpp> namespace gr { namespace fec { + /*! + * \brief Parent class for FECAPI objects. + * + * \ingroup error_coding_blk + * + * \details + * + * Parent of a decoder variable class for FECAPI that will fit + * into the gr::fec::decoder block to handle FEC decoding. This + * class provides the basic information required to fit into the + * FECAPI structure. It provides information about input and + * output data types, potential data conversions, and a few other + * parameters useful to establish the decoder's behavior. + * + * We create objects from FECAPI-derived classes to go into the + * actual GNU Radio decoder block. Each object contains its own + * state and so there should be a one-to-one mapping of an FECAPI + * object and a GR decoder block. Sharing these objects is not + * guaranteed to be thread-safe. + * + * This is a pure virtual class and must be derived from by a + * child class. + * + * \sa gr::fec::code::cc_decoder + * \sa gr::fec::code::ccsds_decoder + */ class FEC_API generic_decoder { + protected: + gr::logger_ptr d_logger; + public: friend class decoder; - virtual void generic_work(void *inBuffer, void *outBuffer) = 0; + virtual void generic_work(void *inbuffer, void *outbuffer) = 0; static int base_unique_id; int my_id; int unique_id(); @@ -48,24 +78,163 @@ namespace gr { generic_decoder(std::string name); virtual ~generic_decoder(); + /*! + * Returns the rate of the code. For every r input bits, there + * is 1 output bit, so the rate is 1/r. Used for setting things + * like the encoder block's relative rate. + * + * This function MUST be reimplemented by the child class. + */ + virtual double rate() = 0; + + /*! + * Returns the input size in items that the decoder object uses + * to decode a full frame. Often, this number is the number of + * bits per frame if the input format is unpacked. If the block + * expects packed bytes, then this value should be the number of + * bytes (number of bits / 8) per input frame. + * + * The child class MUST implement this function. + */ virtual int get_input_size() = 0; + + /*! + * Returns the output size in items that the decoder object + * produces after decoding a full frame. Often, this number is + * the number of bits in the outputted frame if the input format + * is unpacked. If the block produces packed bytes, then this + * value should be the number of bytes (number of bits / 8) per + * frame produced. This value is generally something like + * get_input_size()/R for a 1/R rate code. + * + * The child class MUST implement this function. + */ virtual int get_output_size() = 0; + + /*! + * Sets up history for the decoder when the decoder is required + * to look ahead in the data stream in order to finish + * its processing. + * + * The child class MAY implement this function. If not + * reimplemented, it returns 0. + */ virtual int get_history(); + + /*! + * Some decoders require the input items to float around a + * particular soft value. We can set that floating value by + * setting this value to return some non-zero number. + * + * The fec.extended_decoder block will use this to create an + * add_const_ff block before the decoder block to adjust all + * input samples appropriately. + * + * The child class MAY implement this function. If not + * reimplemented, it returns 0. + */ virtual float get_shift(); - virtual const char* get_conversion(); + + /*! + * Sets the size of an input item, as in the size of a char or + * float item. + * + * The child class SHOULD implement this function. If not + * reimplemented, it returns sizeof(float) as the decoders + * typically expect floating point input types. + */ virtual int get_input_item_size(); + + /*! + * Sets the size of an output item, as in the size of a char or + * float item. + * + * The child class SHOULD implement this function. If not + * reimplemented, it returns sizeof(char) as the decoders + * typically expect to produce bits or bytes. + */ virtual int get_output_item_size(); + + /*! + * Set up a conversion type required to setup the data properly + * for this decoder. The decoder itself will not implement the + * conversion and expects an external wrapper (e.g., + * fec.extended_decoder) to read this value and "do the right + * thing" to format the data. + * + * The default behavior is 'none', which means no conversion is + * required. Whatever the get_input_item_size() value returns, + * the input is expected to conform directly to this. + * + * This may also return 'uchar', which indicates that the + * wrapper should convert the standard float samples to unsigned + * characters, either hard sliced or 8-bit soft symbols. See + * gr::fec::code::cc_decoder as an example decoder that uses + * this conversion format. + * + * If 'packed_bits', the block expects the inputs to be packed + * hard bits. Each input item is a unsigned char where each of + * the 8-bits is a hard bit value. + * + * The child class SHOULD implement this function. If not + * reimplemented, it returns "none". + */ + virtual const char* get_input_conversion(); + + /*! + * Set up a conversion type required to understand the output + * style of this decoder. Generally, follow-on processing + * expects unpacked bits, so we specify the conversion type here + * to indicate what the wrapper (e.g., fec.extended_decoder) + * should do to convert the output samples from the decoder into + * unpacked bits. + * + * The default behavior is 'none', which means no conversion is + * required. This should mean that the output data is produced + * from this decoder as unpacked bit. + * + * If 'unpack', the block produces packed bytes that should be + * unpacked by the wrapper. See gr::fec::code::ccsds_decoder as + * an example of a decoder that produces packed bytes. + * + * The child class SHOULD implement this function. If not + * reimplemented, it returns "none". + */ virtual const char* get_output_conversion(); + + /*! + * Updates the size of a decoded frame. + * + * The child class MUST implement this function and interpret + * how the \p frame_size information affects the block's + * behavior. It should also provide bounds checks. + */ + virtual bool set_frame_size(unsigned int frame_size) = 0; }; + /*! see generic_decoder::get_output_size() */ FEC_API int get_decoder_output_size(generic_decoder::sptr my_decoder); + + /*! see generic_decoder::get_input_size() */ FEC_API int get_decoder_input_size(generic_decoder::sptr my_decoder); + + /*! see generic_decoder::get_shift() */ FEC_API float get_shift(generic_decoder::sptr my_decoder); + + /*! see generic_decoder::get_history() */ FEC_API int get_history(generic_decoder::sptr my_decoder); - FEC_API int get_decoder_output_item_size(generic_decoder::sptr my_decoder); + + /*! see generic_decoder::get_input_item_size() */ 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); + + /*! see generic_decoder::get_output_item_size() */ + FEC_API int get_decoder_output_item_size(generic_decoder::sptr my_decoder); + + /*! see generic_decoder::get_input_conversion() */ + FEC_API const char* get_decoder_input_conversion(generic_decoder::sptr my_decoder); + + /*! see generic_decoder::get_output_conversion() */ + FEC_API const char* get_decoder_output_conversion(generic_decoder::sptr my_decoder); } /* namespace fec */ } /* namespace gr */ diff --git a/gr-fec/include/gnuradio/fec/generic_encoder.h b/gr-fec/include/gnuradio/fec/generic_encoder.h index 4812873596..7c5e08e5d0 100644 --- a/gr-fec/include/gnuradio/fec/generic_encoder.h +++ b/gr-fec/include/gnuradio/fec/generic_encoder.h @@ -25,6 +25,7 @@ #include <gnuradio/fec/api.h> #include <gnuradio/block.h> +#include <gnuradio/logger.h> #include <boost/shared_ptr.hpp> namespace gr { @@ -32,21 +33,119 @@ namespace gr { class FEC_API generic_encoder { + protected: + gr::logger_ptr d_logger; + public: friend class encoder; virtual void generic_work(void *in_buffer, void *out_buffer) = 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_encoder> sptr; + /*! + * Returns the rate of the code. For every 1 input bit, there + * are r output bits, so the rate is 1/r. Used for setting + * things like the encoder block's relative rate. + * + * This function MUST be reimplemented by the child class. + */ + virtual double rate() = 0; + + /*! + * Returns the input size in items that the encoder object uses + * to encode a full frame. Often, this number is the number of + * bits per frame if the input format is unpacked. If the block + * expects packed bytes, then this value should be the number of + * bytes (number of bits / 8) per input frame. + * + * The child class MUST implement this function. + */ virtual int get_input_size() = 0; + + /*! + * Returns the output size in items that the encoder object + * produces after encoding a full frame. Often, this number is + * the number of bits in the outputted frame if the input format + * is unpacked. If the block produces packed bytes, then this + * value should be the number of bytes (number of bits / 8) per + * frame produced. This value is generally something like + * R*get_input_size() for a 1/R rate code. + * + * The child class MUST implement this function. + */ virtual int get_output_size() = 0; + + /*! + * Set up a conversion type required to setup the data properly + * for this encoder. The encoder itself will not implement the + * conversion and expects an external wrapper (e.g., + * fec.extended_encoder) to read this value and "do the right + * thing" to format the data. + * + * The default behavior is 'none', which means no conversion is + * required. Whatever the get_input_item_size() value returns, + * the input is expected to conform directly to this. Generally, + * this means unpacked bytes. + * + * If 'pack', the block expects the inputs to be packed + * bytes. The wrapper should implement a + * gr::blocks::pack_k_bits_bb(8) block for this. + * + * The child class MAY implement this function. If not + * reimplemented, it returns "none". + */ + virtual const char* get_input_conversion(); + + /*! + * Set up a conversion type required to understand the output + * style of this encoder. Generally an encoder will produce + * unpacked bytes with a bit set in the LSB. + * + * The default behavior is 'none', which means no conversion is + * required and the encoder produces unpacked bytes. + * + * If 'packed_bits', the block produces packed bits and the + * wrapper should unpack these (using, for instance, + * gr::block::unpack_k_bits_bb(8)). + * + * The child class MAY implement this function. If not + * reimplemented, it returns "none". + */ + virtual const char* get_output_conversion(); + + /*! + * Updates the size of the frame to encode. + * + * The child class MUST implement this function and interpret + * how the \p frame_size information affects the block's + * behavior. It should also provide bounds checks. + */ + virtual bool set_frame_size(unsigned int frame_size) = 0; + generic_encoder(void) {}; + generic_encoder(std::string name); virtual ~generic_encoder(); }; + /*! see generic_encoder::get_output_size() */ FEC_API int get_encoder_output_size(generic_encoder::sptr my_encoder); + + /*! see generic_encoder::get_input_size() */ FEC_API int get_encoder_input_size(generic_encoder::sptr my_encoder); + /*! see generic_encoder::get_input_conversion() */ + FEC_API const char* get_encoder_input_conversion(generic_encoder::sptr my_encoder); + + /*! see generic_encoder::get_output_conversion() */ + FEC_API const char* get_encoder_output_conversion(generic_encoder::sptr my_encoder); + + } /* namespace fec */ } /* namespace gr */ diff --git a/gr-fec/include/gnuradio/fec/puncture_bb.h b/gr-fec/include/gnuradio/fec/puncture_bb.h index b803297d78..3fc8d7ee9b 100644 --- a/gr-fec/include/gnuradio/fec/puncture_bb.h +++ b/gr-fec/include/gnuradio/fec/puncture_bb.h @@ -34,8 +34,8 @@ namespace gr { * \ingroup error_coding_blk * * \details - * For a given block of input samples of \p puncsize, the items - * produced is based on \p puncpat. Basically, if: + * Puncture a given block of input samples of \p puncsize. The + * items produced is based on pattern \p puncpat. Basically, if: * * \code * k = 0 diff --git a/gr-fec/include/gnuradio/fec/tagged_decoder.h b/gr-fec/include/gnuradio/fec/tagged_decoder.h new file mode 100644 index 0000000000..6249037579 --- /dev/null +++ b/gr-fec/include/gnuradio/fec/tagged_decoder.h @@ -0,0 +1,96 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#ifndef INCLUDED_FEC_TAGGED_DECODER_H +#define INCLUDED_FEC_TAGGED_DECODER_H + +#include <gnuradio/fec/api.h> +#include <gnuradio/fec/generic_decoder.h> +#include <gnuradio/tagged_stream_block.h> +#include <boost/shared_ptr.hpp> +#include <boost/shared_array.hpp> +#include <boost/format.hpp> + +namespace gr { + namespace fec { + + /*! + * \brief General FEC decoding block that takes in a decoder + * variable object (derived from gr::fec::general_decoder) for use + * in a flowgraph. + * + * \ingroup error_coding_blk + * + * \details + * This block uses a decoder variable object (derived from + * gr::fec::generic_decoder) to decode data within a + * flowgraph. This block interacts with the general FECAPI + * architecture to handle all passing all input and output data in + * a flowgraph. The decoder variable takes care of understanding + * the requirements, data types and sizes, and boundary conditions + * of the specific FEC decoding algorithm. + * + * Generally, this block is used within the fec.extended_decoder + * Python block to handle some input/output formatting issues. In + * the FECAPI, the decoder variable sets properties like the input + * and output types and sizes and whether the output is packed or + * unpacked bytes. The fec.extended_decoder uses this information + * to set up an gr::hier_block2 structure to make sure the I/O to + * the variable is handled consistently, such as to make sure all + * inputs are floats with one soft symbol per item and the outputs + * are unpacked bytes with the bit in the LSB. + * + * See gr::fec::generic_decoder for detail on what information an + * FECAPI variable object can set if using this block directly and + * not as part of the fec.extended_decoder. + */ + class FEC_API tagged_decoder : virtual public tagged_stream_block + { + public: + typedef boost::shared_ptr<tagged_decoder> sptr; + typedef boost::shared_array<unsigned char> buf_sptr; + + /*! + * Create the FEC decoder block by taking in the FECAPI decoder + * object as well as input and output sizes. + * + * \param my_decoder An FECAPI decoder object (See gr::fec::generic_decoder). + * \param input_item_size The size of the input items (often the my_decoder object can tell us this). + * \param output_item_size The size of the output items (often the my_decoder object can tell us this). + * \param lengthtagname Key name of the tagged stream frame size. + */ + static sptr make(generic_decoder::sptr my_decoder, + size_t input_item_size, + size_t output_item_size, + const std::string &lengthtagname="packet_len"); + + virtual int 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 calculate_output_stream_length(const gr_vector_int &ninput_items) = 0; + }; + + } /* namespace fec */ +} /* namespace gr */ + +#endif /* INCLUDED_FEC_TAGGED_DECODER_H */ diff --git a/gr-fec/include/gnuradio/fec/tagged_encoder.h b/gr-fec/include/gnuradio/fec/tagged_encoder.h new file mode 100644 index 0000000000..86c2603edc --- /dev/null +++ b/gr-fec/include/gnuradio/fec/tagged_encoder.h @@ -0,0 +1,75 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#ifndef INCLUDED_FEC_TAGGED_ENCODER_H +#define INCLUDED_FEC_TAGGED_ENCODER_H + +#include <gnuradio/fec/api.h> +#include <gnuradio/fec/generic_encoder.h> +#include <gnuradio/tagged_stream_block.h> +#include <boost/shared_ptr.hpp> + +namespace gr { + namespace fec { + + /*! + * \brief Creates the encoder block for use in GNU Radio + * flowgraphs from a given FECAPI object derived from the + * generic_encoder class. + * \ingroup error_coding_blk + * + * \details + * + * Generally, we would use the fec.extended_encoder Python + * implementation to instantiate this. The extended_encoder wraps + * up a few more details, like taking care of puncturing as well + * as the encoder itself. + */ + class FEC_API tagged_encoder : virtual public tagged_stream_block + { + public: + typedef boost::shared_ptr<tagged_encoder> sptr; + + /*! + * Build the FEC encoder block from an FECAPI encoder object. + * + * \param my_encoder An FECAPI encoder object child of the generic_encoder class. + * \param input_item_size size of a block of data for the encoder. + * \param output_item_size size of a block of data the encoder will produce. + * \param lengthtagname Key name of the tagged stream frame size. + */ + static sptr make(generic_encoder::sptr my_encoder, + size_t input_item_size, + size_t output_item_size, + const std::string& lengthtagname="packet_len"); + + virtual int 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 calculate_output_stream_length(const gr_vector_int &ninput_items) = 0; + }; + + } /* namespace fec */ +} /* namespace gr */ + +#endif /* INCLUDED_FEC_TAGGED_ENCODER_H */ diff --git a/gr-fec/lib/CMakeLists.txt b/gr-fec/lib/CMakeLists.txt index cc187d57b1..aa3f977cc0 100644 --- a/gr-fec/lib/CMakeLists.txt +++ b/gr-fec/lib/CMakeLists.txt @@ -42,7 +42,7 @@ endif(ENABLE_GR_CTRLPORT) link_directories( ${Boost_LIBRARY_DIRS} - ${LOG4CPP_LIBRARIES} + ${LOG4CPP_LIBRARY_DIRS} ) ######################################################################## @@ -51,10 +51,14 @@ link_directories( list(APPEND gnuradio_fec_sources generic_decoder.cc generic_encoder.cc - encoder_impl.cc decoder_impl.cc + encoder_impl.cc + tagged_decoder_impl.cc + tagged_encoder_impl.cc cc_decoder_impl.cc cc_encoder_impl.cc + ccsds_decoder_impl.cc + ccsds_encoder_impl.cc decode_ccsds_27_fb_impl.cc encode_ccsds_27_bb_impl.cc ber_tools.cc @@ -83,9 +87,9 @@ list(APPEND gnuradio_fec_libs gnuradio-runtime volk ${Boost_LIBRARIES} + ${LOG4CPP_LIBRARIES} ) add_library(gnuradio-fec SHARED ${gnuradio_fec_sources}) target_link_libraries(gnuradio-fec ${gnuradio_fec_libs}) GR_LIBRARY_FOO(gnuradio-fec RUNTIME_COMPONENT "fec_runtime" DEVEL_COMPONENT "fec_devel") - diff --git a/gr-fec/lib/cc_decoder_impl.cc b/gr-fec/lib/cc_decoder_impl.cc index e8d8671e5f..efaf6c002d 100644 --- a/gr-fec/lib/cc_decoder_impl.cc +++ b/gr-fec/lib/cc_decoder_impl.cc @@ -27,7 +27,6 @@ #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> @@ -38,38 +37,35 @@ namespace gr { namespace code { generic_decoder::sptr - cc_decoder::make(int framebits, int k, + cc_decoder::make(int frame_size, int k, int rate, std::vector<int> polys, int start_state, int end_state, - bool tailbiting, bool terminated, - bool truncated, bool streaming) + cc_mode_t mode) { return generic_decoder::sptr - (new cc_decoder_impl(framebits, k, rate, polys, - start_state, end_state, - tailbiting, terminated, - truncated, streaming)); + (new cc_decoder_impl(frame_size, k, rate, polys, + start_state, end_state, mode)); } - cc_decoder_impl::cc_decoder_impl(int framebits, int k, + cc_decoder_impl::cc_decoder_impl(int frame_size, int k, int rate, std::vector<int> polys, int start_state, int end_state, - bool tailbiting, bool terminated, - bool truncated, bool streaming) + cc_mode_t mode) : 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_mode(mode), d_start_state_chaining(start_state), d_start_state_nonchaining(start_state), d_end_state_nonchaining(end_state) { + // Set max frame size here; all buffers and settings will be + // based on this value. + d_max_frame_size = frame_size; + set_frame_size(frame_size); + d_vp = new struct v; d_numstates = 1 << (d_k - 1); @@ -77,56 +73,54 @@ namespace gr { d_decision_t_size = d_numstates/8; //packed bit array d_managed_in_size = 0; - if(d_tailbiting) { + switch(d_mode) { + case(CC_TAILBITING): d_end_state = &d_end_state_chaining; - d_veclen = d_framebits + (6 * (d_k - 1)); - d_managed_in = (COMPUTETYPE*)volk_malloc(d_veclen*d_rate*sizeof(COMPUTETYPE), - volk_get_alignment()); + d_managed_in = (unsigned char*)volk_malloc(d_veclen*d_rate*sizeof(unsigned char), + volk_get_alignment()); d_managed_in_size = d_veclen * d_rate; if(d_managed_in == NULL) { - throw std::runtime_error("bad alloc for d_managed_in!\n"); + throw std::runtime_error("cc_decoder: bad alloc for d_managed_in\n"); } - } - - else if(d_truncated) { + break; + + case(CC_TRUNCATED): d_end_state = &d_end_state_chaining; - d_veclen = d_framebits; - } - else if(d_terminated) { + break; + + case(CC_TERMINATED): d_end_state = (end_state == -1) ? &d_end_state_chaining : &d_end_state_nonchaining; - d_veclen = d_framebits + d_k - 1; - } + break; - //streaming - else { + case(CC_STREAMING): d_end_state = &d_end_state_chaining; - d_veclen = d_framebits + d_k - 1; + break; + + default: + throw std::runtime_error("cc_decoder: mode not recognized"); } - d_vp->metrics = (COMPUTETYPE*) volk_malloc(2 * sizeof(COMPUTETYPE) * d_numstates, volk_get_alignment()); + d_vp->metrics = (unsigned char*)volk_malloc(2*sizeof(unsigned char)*d_numstates, + volk_get_alignment()); if(d_vp->metrics == NULL) { throw std::runtime_error("bad alloc for d_vp->metrics!\n"); } - - d_vp->metrics1.t = d_vp->metrics; d_vp->metrics2.t = d_vp->metrics + d_numstates; - d_vp->decisions = (DECISIONTYPE*) volk_malloc(d_veclen*d_decision_t_size, volk_get_alignment()); + d_vp->decisions = (unsigned char*)volk_malloc(d_veclen*d_decision_t_size, + volk_get_alignment()); if(d_vp->decisions == NULL) { throw std::runtime_error("bad alloc for d_vp->decisions!\n"); } - - - Branchtab = (COMPUTETYPE*) volk_malloc(sizeof(COMPUTETYPE) * d_numstates/2*rate, volk_get_alignment()); + Branchtab = (unsigned char*)volk_malloc(sizeof(unsigned char)*d_numstates/2*rate, + volk_get_alignment()); if(Branchtab == NULL) { throw std::runtime_error("bad alloc for d_vp->decisions!\n"); } - - create_viterbi(); if(d_k-1<8) { @@ -164,18 +158,17 @@ namespace gr { cc_decoder_impl::get_output_size() { //unpacked bits - return d_framebits; + return d_frame_size; } int cc_decoder_impl::get_input_size() { - if(d_terminated) { - return d_rate * (d_framebits + d_k - 1); + if(d_mode == CC_TERMINATED) { + return d_rate * (d_frame_size + d_k - 1); } - else { - return d_rate * d_framebits; + return d_rate * d_frame_size; } } @@ -188,7 +181,7 @@ namespace gr { int cc_decoder_impl::get_history() { - if(d_streaming) { + if(d_mode == CC_STREAMING) { return d_rate * (d_k - 1); } else { @@ -196,8 +189,6 @@ namespace gr { } } - - float cc_decoder_impl::get_shift() { @@ -205,7 +196,7 @@ namespace gr { } const char* - cc_decoder_impl::get_conversion() + cc_decoder_impl::get_input_conversion() { return "uchar"; } @@ -222,20 +213,25 @@ namespace gr { } } - if(d_streaming) { - //printf("streaming\n"); + switch(d_mode) { + case(CC_STREAMING): d_start_state = &d_start_state_chaining; init_viterbi_unbiased(d_vp); - } - else if(d_tailbiting) { - //printf("tailbiting\n"); + break; + + case(CC_TAILBITING): d_start_state = &d_start_state_nonchaining; init_viterbi_unbiased(d_vp); - } - else { - //printf("other!\n"); + break; + + case(CC_TRUNCATED): + case(CC_TERMINATED): d_start_state = &d_start_state_nonchaining; init_viterbi(d_vp, *d_start_state); + break; + + default: + throw std::runtime_error("cc_decoder: mode not recognized"); } return; @@ -309,9 +305,9 @@ namespace gr { int cc_decoder_impl::find_endstate() { - COMPUTETYPE* met = ((d_k + d_veclen)%2 == 0)? d_vp->new_metrics.t : d_vp->old_metrics.t; + unsigned char* met = ((d_k + d_veclen)%2 == 0)? d_vp->new_metrics.t : d_vp->old_metrics.t; - COMPUTETYPE min = met[0]; + unsigned char min = met[0]; int state = 0; for(int i = 1; i < d_numstates; ++i) { if(met[i] < min) { @@ -319,35 +315,34 @@ namespace gr { state = i; } - + } //printf("min %d\n", state); return state; } int - cc_decoder_impl::update_viterbi_blk(COMPUTETYPE* syms, int nbits) + cc_decoder_impl::update_viterbi_blk(unsigned char* syms, int nbits) { - DECISIONTYPE *d; + unsigned char *d; d = d_vp->decisions; - memset(d,0,d_decision_t_size * nbits); - - d_kernel( d_vp->new_metrics.t, d_vp->old_metrics.t, syms, d, nbits - (d_k - 1), 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, + cc_decoder_impl::chainback_viterbi(unsigned char* data, unsigned int nbits, unsigned int endstate, unsigned int tailsize) { - DECISIONTYPE *d; + unsigned char *d; /* ADDSHIFT and SUBSHIFT make sure that the thing returned is a byte. */ d = d_vp->decisions; @@ -365,17 +360,17 @@ namespace gr { 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); + //printf("break, %d, %d\n", dif, (nbits+dif)%d_frame_size); decision_t dec; - while(nbits-- > d_framebits - (d_k - 1)) { + while(nbits-- > d_frame_size - (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; + //printf("%d, %d\n", k, (nbits+dif)%d_frame_size); + data[((nbits+dif)%d_frame_size)] = k; retval = endstate; } @@ -389,82 +384,100 @@ namespace gr { 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; + data[((nbits+dif)%d_frame_size)] = 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) + bool + cc_decoder_impl::set_frame_size(unsigned int frame_size) { - d_framebits = framebits; - if(d_tailbiting) { - d_veclen = d_framebits + (6 * (d_k - 1)); + bool ret = true; + if(frame_size > d_max_frame_size) { + GR_LOG_INFO(d_logger, boost::format("tried to set frame to %1%; max possible is %2%") \ + % frame_size % d_max_frame_size); + frame_size = d_max_frame_size; + ret = false; + } + + d_frame_size = frame_size; + + switch(d_mode) { + case(CC_TAILBITING): + d_veclen = d_frame_size + (6 * (d_k - 1)); if(d_veclen * d_rate > d_managed_in_size) { throw std::runtime_error("attempt to resize beyond d_managed_in buffer size!\n"); } + break; + + case(CC_TRUNCATED): + d_veclen = d_frame_size; + break; + + case(CC_STREAMING): + case(CC_TERMINATED): + d_veclen = d_frame_size + d_k - 1; + break; + + default: + throw std::runtime_error("cc_decoder: mode not recognized"); } - else if(d_truncated) { - d_veclen = d_framebits; - } - else { - d_veclen = d_framebits + d_k - 1; - } + + return ret; + } + + double + cc_decoder_impl::rate() + { + return 1.0/static_cast<double>(d_rate); } void - cc_decoder_impl::generic_work(void *inBuffer, void *outBuffer) + 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); - }*/ + const unsigned char *in = (const unsigned char *) inbuffer; + unsigned char *out = (unsigned char *) outbuffer; + + switch(d_mode) { + + case(CC_TAILBITING): + memcpy(d_managed_in, in, d_frame_size * d_rate * sizeof(unsigned char)); + memcpy(d_managed_in + d_frame_size * d_rate * sizeof(unsigned char), in, + (d_veclen - d_frame_size) * d_rate * sizeof(unsigned char)); 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); + chainback_viterbi(&out[0], d_frame_size, *d_end_state, d_veclen - d_frame_size); init_viterbi_unbiased(d_vp); - } + break; - - else if(d_truncated) { - update_viterbi_blk((COMPUTETYPE*)(&in[0]), d_veclen); + case(CC_TRUNCATED): + update_viterbi_blk((unsigned char*)(&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_start_state_chaining = chainback_viterbi(&out[0], d_frame_size - (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((COMPUTETYPE*)(&in[0]), d_veclen); + break; + + case(CC_STREAMING): + case(CC_TERMINATED): + update_viterbi_blk((unsigned char*)(&in[0]), d_veclen); d_end_state_chaining = find_endstate(); - //printf("es: %d, %d\n", d_end_state_chaining, *d_end_state); - d_start_state_chaining = chainback_viterbi(&out[0], d_framebits, *d_end_state, - d_veclen - d_framebits); + d_start_state_chaining = chainback_viterbi(&out[0], d_frame_size, *d_end_state, + d_veclen - d_frame_size); 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); - }*/ + break; + + default: + throw std::runtime_error("cc_decoder: mode not recognized"); } } } /* namespace code */ } /* namespace fec */ } /* namespace gr */ - diff --git a/gr-fec/lib/cc_decoder_impl.h b/gr-fec/lib/cc_decoder_impl.h index 725a27d10a..d0b1af35a3 100644 --- a/gr-fec/lib/cc_decoder_impl.h +++ b/gr-fec/lib/cc_decoder_impl.h @@ -26,7 +26,6 @@ #include <map> #include <string> #include <gnuradio/fec/cc_decoder.h> -#include <gnuradio/fec/cc_common.h> namespace gr { namespace fec { @@ -41,36 +40,36 @@ namespace gr { int get_history(); float get_shift(); int get_input_item_size(); - const char* get_conversion(); + const char* get_input_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(COMPUTETYPE* syms, int nbits); + int update_viterbi_blk(unsigned char* 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 *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_max_frame_size; + unsigned int d_frame_size; unsigned int d_k; unsigned int d_rate; unsigned int d_partial_rate; std::vector<int> d_polys; + cc_mode_t d_mode; + struct v* d_vp; - COMPUTETYPE* d_managed_in; + unsigned char* d_managed_in; unsigned int d_managed_in_size; int d_numstates; int d_decision_t_size; @@ -81,21 +80,22 @@ namespace gr { 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, + cc_decoder_impl(int frame_size, 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_mode_t mode=CC_STREAMING); ~cc_decoder_impl(); - void set_framebits(int framebits); - void generic_work(void *inBuffer, void *outbuffer); + void generic_work(void *inbuffer, void *outbuffer); + bool set_frame_size(unsigned int frame_size); + double rate(); }; } /* namespace code */ diff --git a/gr-fec/lib/cc_encoder_impl.cc b/gr-fec/lib/cc_encoder_impl.cc index bf8617d939..abbf1a8f1b 100644 --- a/gr-fec/lib/cc_encoder_impl.cc +++ b/gr-fec/lib/cc_encoder_impl.cc @@ -40,32 +40,32 @@ namespace gr { 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) + cc_encoder::make(int frame_size, int k, int rate, + std::vector<int> polys, int start_state, + cc_mode_t mode) { return generic_encoder::sptr - (new cc_encoder_impl(framebits, k, - rate, polys, - start_state, end_state, - tailbiting, terminated, - truncated, streaming)); + (new cc_encoder_impl(frame_size, k, rate, + polys, start_state, + mode)); } - 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), + cc_encoder_impl::cc_encoder_impl(int frame_size, int k, int rate, + std::vector<int> polys, int start_state, + cc_mode_t mode) + : generic_encoder("cc_encoder"), 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) + d_mode(mode) { + if(static_cast<size_t>(d_rate) != d_polys.size()) { + throw std::runtime_error("cc_encoder: Number of polynomials must be the same as the value of rate"); + } + partab_init(); + + d_max_frame_size = frame_size; + set_frame_size(frame_size); } cc_encoder_impl::~cc_encoder_impl() @@ -75,8 +75,30 @@ namespace gr { int cc_encoder_impl::get_output_size() { - if(d_terminated) { - return d_rate * (d_framebits + d_k - 1); + return d_output_size; + } + + int + cc_encoder_impl::get_input_size() + { + return d_frame_size; + } + + bool + cc_encoder_impl::set_frame_size(unsigned int frame_size) + { + bool ret = true; + if(frame_size > d_max_frame_size) { + GR_LOG_INFO(d_logger, boost::format("tried to set frame to %1%; max possible is %2%") \ + % frame_size % d_max_frame_size); + frame_size = d_max_frame_size; + ret = false; + } + + d_frame_size = frame_size; + + if(d_mode == CC_TERMINATED) { + d_output_size = d_rate * (d_frame_size + d_k - 1); } /* else if(d_trunc_intrinsic) { @@ -86,18 +108,20 @@ namespace gr { cnt++; } } - return (d_rate * (d_framebits)) + (cnt * (d_k - 1)); + d_output_size = (d_rate * (d_frame_size)) + (cnt * (d_k - 1)); } */ else { - return d_rate * d_framebits; + d_output_size = d_rate * d_frame_size; } + + return ret; } - int - cc_encoder_impl::get_input_size() + double + cc_encoder_impl::rate() { - return d_framebits; + return 1.0/static_cast<double>(d_rate); } int @@ -138,65 +162,37 @@ namespace gr { const unsigned char *in = (const unsigned char *) in_buffer; unsigned char *out = (unsigned char *) out_buffer; - int my_state = d_start_state; - //printf("ms: %d\n", my_state); + unsigned char my_state = d_start_state; - if(d_tailbiting) { + if(d_mode == CC_TAILBITING) { for(unsigned int i = 0; i < d_k - 1; ++i) { - my_state = (my_state << 1) | (in[d_framebits - (d_k - 1) + i] & 1); + my_state = (my_state << 1) | (in[d_frame_size - (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) { + for(unsigned int i = 0; i < d_frame_size; ++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 ? 0 : 1; } } - if(d_terminated) { + if(d_mode == CC_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 ? 0 : 1; - } - } - } - - /* - 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 ? 0 : 1; - cnt++; - } + out[(i + d_frame_size) * d_rate + j] = parity(my_state & d_polys[j]) == 0 ? 0 : 1; } } } - */ - if(d_truncated) { - //printf("end... %d\n", my_state & ((1 << (d_k - 1)) - 1)); + if(d_mode == CC_TRUNCATED) { 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("...%d : %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 index e7a17bd358..008887559b 100644 --- a/gr-fec/lib/cc_encoder_impl.h +++ b/gr-fec/lib/cc_encoder_impl.h @@ -14,7 +14,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License +p * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. @@ -35,13 +35,14 @@ namespace gr { { private: //plug into the generic fec api - void generic_work(void *inBuffer, void *outbuffer); + 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_frame_size; + unsigned int d_max_frame_size; unsigned int d_rate; unsigned int d_k; std::vector<int> d_polys; @@ -49,21 +50,21 @@ namespace gr { int d_numstates; int d_decision_t_size; int d_start_state; - bool d_tailbiting; - bool d_terminated; - bool d_truncated; - bool d_streaming; + cc_mode_t d_mode; + int d_output_size; + 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(int frame_size, int k, int rate, + std::vector<int> polys, int start_state = 0, + cc_mode_t mode=CC_STREAMING); ~cc_encoder_impl(); + + bool set_frame_size(unsigned int frame_size); + double rate(); }; } /* namespace code */ diff --git a/gr-fec/lib/ccsds_decoder_impl.cc b/gr-fec/lib/ccsds_decoder_impl.cc new file mode 100644 index 0000000000..a68d027e57 --- /dev/null +++ b/gr-fec/lib/ccsds_decoder_impl.cc @@ -0,0 +1,192 @@ +/* -*- 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 "ccsds_decoder_impl.h" +#include <math.h> +#include <boost/assign/list_of.hpp> +#include <volk/volk.h> +#include <sstream> +#include <vector> +#include <iostream> + +namespace gr { + namespace fec { + namespace code { + + generic_decoder::sptr + ccsds_decoder::make(int frame_size, + int start_state, int end_state, + cc_mode_t mode) + { + return generic_decoder::sptr + (new ccsds_decoder_impl(frame_size, start_state, end_state, mode)); + } + + ccsds_decoder_impl::ccsds_decoder_impl(int frame_size, + int start_state, int end_state, + cc_mode_t mode) + : generic_decoder("ccsds_decoder"), + d_count(0), d_frame_size(frame_size), + d_mode(mode), + d_start_state_chaining(start_state), + d_start_state_nonchaining(start_state), + d_end_state_nonchaining(end_state) + { + // Set max frame size here; all buffers and settings will be + // based on this value. + d_max_frame_size = frame_size; + set_frame_size(frame_size); + + float RATE = 0.5; + float ebn0 = 12.0; + float esn0 = RATE*pow(10.0, ebn0/10.0); + + gen_met(d_mettab, 100, esn0, 0.0, 4); + viterbi_chunks_init(d_state0); + viterbi_chunks_init(d_state1); + } + + ccsds_decoder_impl::~ccsds_decoder_impl() + { + } + + int + ccsds_decoder_impl::get_output_size() + { + // packed bits + return d_frame_size/8; + } + + int + ccsds_decoder_impl::get_input_size() + { + if(d_mode == CC_TERMINATED) { + return 2*(d_frame_size + 7 - 1); + } + else { + return 2*d_frame_size; + } + } + + int + ccsds_decoder_impl::get_input_item_size() + { + return sizeof(float); + } + + int + ccsds_decoder_impl::get_history() + { + if(d_mode == CC_STREAMING) { + return 2*(7 - 1); + } + else { + return 0; + } + } + + float + ccsds_decoder_impl::get_shift() + { + return 0.0; + } + + const char* + ccsds_decoder_impl::get_input_conversion() + { + return "none"; + } + + const char* + ccsds_decoder_impl::get_output_conversion() + { + return "unpack"; + } + + bool + ccsds_decoder_impl::set_frame_size(unsigned int frame_size) + { + bool ret = true; + if(frame_size > d_max_frame_size) { + GR_LOG_INFO(d_logger, boost::format("tried to set frame to %1%; max possible is %2%") \ + % frame_size % d_max_frame_size); + frame_size = d_max_frame_size; + ret = false; + } + + d_frame_size = frame_size; + + return ret; + } + + double + ccsds_decoder_impl::rate() + { + return 0.5; + } + + void + ccsds_decoder_impl::generic_work(void *inbuffer, void *outbuffer) + { + const float *in = (const float*)inbuffer; + unsigned char *out = (unsigned char*)outbuffer; + + switch(d_mode) { + + case(CC_STREAMING): + for(unsigned int i = 0; i < d_frame_size*2; i++) { + // Translate and clip [-1.0..1.0] to [28..228] + float sample = in[i]*100.0+128.0; + if(sample > 255.0) + sample = 255.0; + else if(sample < 0.0) + sample = 0.0; + + d_viterbi_in[d_count % 4] = (unsigned char)(floorf(sample)); + if((d_count % 4) == 3) { + // Every fourth symbol, perform butterfly operation + viterbi_butterfly2(d_viterbi_in, d_mettab, d_state0, d_state1); + + // Every sixteenth symbol, read out a byte + if(d_count % 16 == 11) { + unsigned char tmp; + viterbi_get_output(d_state0, out++); + viterbi_get_output(d_state0, &tmp); + } + } + + d_count++; + } + break; + + default: + throw std::runtime_error("ccsds_decoder: mode not recognized"); + } + } + + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ diff --git a/gr-fec/lib/ccsds_decoder_impl.h b/gr-fec/lib/ccsds_decoder_impl.h new file mode 100644 index 0000000000..26ccec48c7 --- /dev/null +++ b/gr-fec/lib/ccsds_decoder_impl.h @@ -0,0 +1,83 @@ +/* -*- 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_CCSDS_DECODER_IMPL_H +#define INCLUDED_FEC_CCSDS_DECODER_IMPL_H + +#include <map> +#include <string> +#include <gnuradio/fec/ccsds_decoder.h> + +extern "C" { +#include <gnuradio/fec/viterbi.h> +} + +namespace gr { + namespace fec { + namespace code { + + class FEC_API ccsds_decoder_impl : public ccsds_decoder + { + private: + //plug into the generic FECAPI + void generic_work(void *inbuffer, void *outbuffer); + int get_output_size(); + int get_input_size(); + int get_history(); + float get_shift(); + int get_input_item_size(); + const char* get_input_conversion(); + const char* get_output_conversion(); + + // Viterbi state + int d_mettab[2][256]; + struct viterbi_state d_state0[64]; + struct viterbi_state d_state1[64]; + unsigned char d_viterbi_in[16]; + int d_count; + + unsigned int d_max_frame_size; + unsigned int d_frame_size; + cc_mode_t d_mode; + + 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; + + public: + ccsds_decoder_impl(int frame_size, + int start_state=0, int end_state=-1, + cc_mode_t mode=CC_STREAMING); + ~ccsds_decoder_impl(); + + bool set_frame_size(unsigned int frame_size); + double rate(); + }; + + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ + +#endif /* INCLUDED_FEC_CCSDS_DECODER_IMPL_H */ diff --git a/gr-fec/lib/ccsds_encoder_impl.cc b/gr-fec/lib/ccsds_encoder_impl.cc new file mode 100644 index 0000000000..2a2228a8ed --- /dev/null +++ b/gr-fec/lib/ccsds_encoder_impl.cc @@ -0,0 +1,152 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ccsds_encoder_impl.h" +#include <gnuradio/fec/generic_encoder.h> +#include <cstdio> + +extern "C" { +#include <gnuradio/fec/viterbi.h> +} + +namespace gr { + namespace fec { + namespace code { + + generic_encoder::sptr + ccsds_encoder::make(int frame_size, int start_state, + cc_mode_t mode) + { + return generic_encoder::sptr + (new ccsds_encoder_impl(frame_size, start_state, mode)); + } + + ccsds_encoder_impl::ccsds_encoder_impl(int frame_size, int start_state, + cc_mode_t mode) + : generic_encoder("ccsds_encoder"), + d_start_state(static_cast<unsigned char>(start_state)), + d_mode(mode) + { + d_max_frame_size = frame_size; + set_frame_size(frame_size); + } + + ccsds_encoder_impl::~ccsds_encoder_impl() + { + } + + int + ccsds_encoder_impl::get_output_size() + { + return d_output_size; + } + + int + ccsds_encoder_impl::get_input_size() + { + return d_frame_size/8; // packed byte input + } + + const char* + ccsds_encoder_impl::get_input_conversion() + { + // Expects packed data input; tell wrapper to pack it. + return "pack"; + } + + bool + ccsds_encoder_impl::set_frame_size(unsigned int frame_size) + { + bool ret = true; + if(frame_size > d_max_frame_size) { + GR_LOG_INFO(d_logger, boost::format("tried to set frame to %1%; max possible is %2%") \ + % frame_size % d_max_frame_size); + frame_size = d_max_frame_size; + ret = false; + } + + d_frame_size = frame_size; + + if(d_mode == CC_TERMINATED) { + d_output_size = 2*(d_frame_size + 7 - 1); + } + else { + d_output_size = 2*d_frame_size; + } + + return ret; + } + + double + ccsds_encoder_impl::rate() + { + return 0.5; + } + + void + ccsds_encoder_impl::generic_work(void *in_buffer, void *out_buffer) + { + unsigned char *in = (unsigned char*) in_buffer; + unsigned char *out = (unsigned char*) out_buffer; + + unsigned char my_state = d_start_state; + + if(d_mode == CC_TAILBITING) { + // Grab K-1 (6) bits of data from the last input byte to add + // onto the from of the encoding stream for tailbiting mode. + unsigned char sym = in[d_frame_size/8 - 1]; + for(unsigned int i = 0; i < 7 - 1; ++i) { + my_state = (my_state << 1) | ((sym >> (5 - i)) & 1); + } + } + + my_state = encode(out, in, d_frame_size/8, my_state); + + if(d_mode == CC_TERMINATED) { + // encode works on bytes, but we are only adding some number + // of bits to the end of the frame, so we abuse the encode + // function by reshifting the start state within the + // for-loop and only taking the last two bits out of the + // encoded 2-bytes. + unsigned char end_bits[16]; + for(unsigned int i = 0; i < (7 - 1); ++i) { + my_state = (my_state << 1) | ((d_start_state >> (7 - 2 - i)) & 1); + encode(&end_bits[0], &my_state, 1, my_state); + out[(i + d_frame_size) * 2 + 0] = end_bits[14]; + out[(i + d_frame_size) * 2 + 1] = end_bits[15]; + } + } + + if(d_mode == CC_TRUNCATED) { + my_state = d_start_state; + } + + d_start_state = my_state; + } + + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ diff --git a/gr-fec/lib/ccsds_encoder_impl.h b/gr-fec/lib/ccsds_encoder_impl.h new file mode 100644 index 0000000000..e67890b0f8 --- /dev/null +++ b/gr-fec/lib/ccsds_encoder_impl.h @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#ifndef INCLUDED_FEC_CCSDS_ENCODER_IMPL_H +#define INCLUDED_FEC_CCSDS_ENCODER_IMPL_H + +#include <map> +#include <string> +#include <gnuradio/fec/ccsds_encoder.h> + +namespace gr { + namespace fec { + namespace code { + + class FEC_API ccsds_encoder_impl : public ccsds_encoder + { + private: + //plug into the generic fec api + void generic_work(void *inbuffer, void *outbuffer); + int get_output_size(); + int get_input_size(); + const char* get_input_conversion(); + + unsigned int d_max_frame_size; + unsigned int d_frame_size; + + unsigned char d_start_state; + cc_mode_t d_mode; + + int d_output_size; + + public: + ccsds_encoder_impl(int frame_size, int start_state = 0, + cc_mode_t mode=CC_STREAMING); + ~ccsds_encoder_impl(); + + bool set_frame_size(unsigned int frame_size); + double rate(); + }; + + } /* namespace code */ + } /* namespace fec */ +} /* namespace gr */ + +#endif /* INCLUDED_FEC_CCSDS_ENCODER_IMPL_H */ diff --git a/gr-fec/lib/decode_ccsds_27_fb_impl.cc b/gr-fec/lib/decode_ccsds_27_fb_impl.cc index 014297caef..9b782b7098 100644 --- a/gr-fec/lib/decode_ccsds_27_fb_impl.cc +++ b/gr-fec/lib/decode_ccsds_27_fb_impl.cc @@ -37,14 +37,14 @@ namespace gr { decode_ccsds_27_fb_impl::decode_ccsds_27_fb_impl() : sync_decimator("decode_ccsds_27_fb", - io_signature::make (1, 1, sizeof(float)), - io_signature::make (1, 1, sizeof(char)), - 2*8), d_count(0) // Rate 1/2 code, unpacked to packed conversion + io_signature::make (1, 1, sizeof(float)), + io_signature::make (1, 1, sizeof(char)), + 2*8), d_count(0) // Rate 1/2 code, unpacked to packed conversion { float RATE = 0.5; float ebn0 = 12.0; float esn0 = RATE*pow(10.0, ebn0/10.0); - + gen_met(d_mettab, 100, esn0, 0.0, 256); viterbi_chunks_init(d_state0); viterbi_chunks_init(d_state1); @@ -55,23 +55,23 @@ namespace gr { gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const float *in = (const float *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - + const float *in = (const float*)input_items[0]; + unsigned char *out = (unsigned char*)output_items[0]; + for (int i = 0; i < noutput_items*16; i++) { // Translate and clip [-1.0..1.0] to [28..228] float sample = in[i]*100.0+128.0; - if (sample > 255.0) + if(sample > 255.0) sample = 255.0; - else if (sample < 0.0) + else if(sample < 0.0) sample = 0.0; unsigned char sym = (unsigned char)(floor(sample)); - + d_viterbi_in[d_count % 4] = sym; - if ((d_count % 4) == 3) { + if((d_count % 4) == 3) { // Every fourth symbol, perform butterfly operation viterbi_butterfly2(d_viterbi_in, d_mettab, d_state0, d_state1); - + // Every sixteenth symbol, read out a byte if (d_count % 16 == 11) { // long metric = @@ -79,10 +79,10 @@ namespace gr { // printf("%li\n", *(out-1), metric); } } - + d_count++; } - + return noutput_items; } diff --git a/gr-fec/lib/decode_ccsds_27_fb_impl.h b/gr-fec/lib/decode_ccsds_27_fb_impl.h index cd16c6ab1c..83fed604d4 100644 --- a/gr-fec/lib/decode_ccsds_27_fb_impl.h +++ b/gr-fec/lib/decode_ccsds_27_fb_impl.h @@ -40,7 +40,7 @@ namespace gr { struct viterbi_state d_state0[64]; struct viterbi_state d_state1[64]; unsigned char d_viterbi_in[16]; - + int d_count; public: diff --git a/gr-fec/lib/decoder_impl.cc b/gr-fec/lib/decoder_impl.cc index 30132d0d11..dfc0842031 100644 --- a/gr-fec/lib/decoder_impl.cc +++ b/gr-fec/lib/decoder_impl.cc @@ -50,13 +50,14 @@ namespace gr { { set_fixed_rate(true); set_relative_rate((double)(my_decoder->get_output_size())/my_decoder->get_input_size()); + GR_LOG_DEBUG(d_debug_logger, boost::format("relative_rate: %1%") % relative_rate()); //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() ) ); + 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; } @@ -64,20 +65,20 @@ namespace gr { 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); + return (int)(0.5 + ninput*relative_rate()); } 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); + return (int)(0.5 + noutput/relative_rate()); } 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); + ninput_items_required[0] = 0.5 + fixed_rate_noutput_to_ninput(noutput_items); } int @@ -86,35 +87,39 @@ namespace gr { 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]; + const unsigned char *in = (unsigned char*)input_items[0]; + unsigned char *out = (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 outnum = (int)(((1.0/relative_rate()) * noutput_items) + 0.5); + int innum = (int)(relative_rate() * (ninput_items[0] - d_decoder->get_history()) + 0.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); + GR_LOG_DEBUG(d_debug_logger, boost::format("%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), + in+(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))); + (void*)(out+(i*d_decoder->get_output_size()*d_output_item_size))); + + add_item_tag(0, nitems_written(0) + ((i+1)*d_decoder->get_output_size()*d_output_item_size), + pmt::intern(d_decoder->alias()), pmt::PMT_T, pmt::intern(alias())); } - // 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()))); + int consumed = static_cast<int>(items/relative_rate()*(output_multiple() - d_decoder->get_history()) + 0.5); + int returned = items*(output_multiple() - d_decoder->get_history()); + + GR_LOG_DEBUG(d_debug_logger, boost::format("consumed %1%") % consumed); + GR_LOG_DEBUG(d_debug_logger, boost::format("returned %1%") % returned); - consume_each((int)(((1.0/relative_rate()) * items * (output_multiple() - d_decoder->get_history())) + .5)); - return items * (output_multiple() - d_decoder->get_history()); + consume_each(consumed); + return returned; } } /* namespace fec */ diff --git a/gr-fec/lib/depuncture_bb_impl.cc b/gr-fec/lib/depuncture_bb_impl.cc index b353f99fdd..e388120bbf 100644 --- a/gr-fec/lib/depuncture_bb_impl.cc +++ b/gr-fec/lib/depuncture_bb_impl.cc @@ -26,6 +26,7 @@ #include "depuncture_bb_impl.h" #include <gnuradio/io_signature.h> +#include <volk/volk.h> #include <boost/bind.hpp> #include <pmt/pmt.h> #include <string> @@ -35,23 +36,42 @@ namespace gr { namespace fec { depuncture_bb::sptr - depuncture_bb::make(int delay, int puncpat, int puncholes, int puncsize) + depuncture_bb::make(int puncsize, int puncpat, + int delay, char symbol) { return gnuradio::get_initial_sptr - (new depuncture_bb_impl(delay, puncpat, puncholes, puncsize)); + (new depuncture_bb_impl(puncsize, puncpat, + delay, symbol)); } - depuncture_bb_impl::depuncture_bb_impl(int delay, int puncpat, - int puncholes, int puncsize) + depuncture_bb_impl::depuncture_bb_impl(int puncsize, int puncpat, + int delay, char symbol) : 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) + d_puncsize(puncsize), d_delay(delay), d_sym(symbol) { + // Create a mask of all 1's of puncsize length + int mask = 0; + for(int i = 0; i < d_puncsize; i++) + mask |= 1 << i; + + // Rotate the pattern for the delay value; then mask it if there + // are any excess 1's in the pattern. for(int i = 0; i < d_delay; ++i) { puncpat = ((puncpat & 1) << (d_puncsize - 1)) + (puncpat >> 1); } - d_puncpat = puncpat; + d_puncpat = puncpat & mask; + + // Calculate the number of holes in the pattern. The mask is all + // 1's given puncsize and puncpat is a pattern with >= puncsize + // 0's (masked to ensure this). The difference between the + // number of 1's in the mask and the puncpat is the number of + // holes. + uint32_t count_mask=0, count_pat=0; + volk_32u_popcnt(&count_mask, static_cast<uint32_t>(mask)); + volk_32u_popcnt(&count_pat, static_cast<uint32_t>(d_puncpat)); + d_puncholes = count_mask - count_pat; set_fixed_rate(true); set_relative_rate((double)d_puncsize/(d_puncsize - d_puncholes)); @@ -103,24 +123,27 @@ namespace gr { 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; + out[i*output_multiple() + j] = ((d_puncpat >> (d_puncsize - 1 - j)) & 1) ? in[k++] : d_sym; } } /* - printf(">>>>>>start\n"); + 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) { - printf("%d...%d\n", out[i], in[k++]); + GR_LOG_DEBUG(d_debug_logger, boost::format("%1%...%2%") \ + % out[i] % in[k++]); } else { - printf("snit %d\n", out[i]); + GR_LOG_DEBUG(d_debug_logger, boost::format("snit %1%") % out[i]); } } - */ - /*printf("comp: %d, %d\n", noutput_items, ninput_items[0]); - printf("consuming %d\n", (int)(((1.0/relative_rate()) * noutput_items) + .5));*/ + 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; @@ -128,5 +151,3 @@ namespace gr { } /* namespace fec */ } /* namespace gr */ - - diff --git a/gr-fec/lib/depuncture_bb_impl.h b/gr-fec/lib/depuncture_bb_impl.h index 9e2101264d..013276d7ee 100644 --- a/gr-fec/lib/depuncture_bb_impl.h +++ b/gr-fec/lib/depuncture_bb_impl.h @@ -31,14 +31,15 @@ namespace gr { class FEC_API depuncture_bb_impl : public depuncture_bb { private: + int d_puncsize; int d_delay; int d_puncholes; - int d_puncsize; int d_puncpat; + char d_sym; public: - depuncture_bb_impl(int delay, int puncpat, - int puncholes, int puncsize); + depuncture_bb_impl(int puncsize, int puncpat, + int delay=0, char symbol=127); ~depuncture_bb_impl(); int general_work(int noutput_items, diff --git a/gr-fec/lib/encoder_impl.cc b/gr-fec/lib/encoder_impl.cc index b5956480db..399bcc41cf 100644 --- a/gr-fec/lib/encoder_impl.cc +++ b/gr-fec/lib/encoder_impl.cc @@ -51,9 +51,12 @@ namespace gr { 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_relative_rate((double)my_encoder->get_output_size()/(double)my_encoder->get_input_size()); set_output_multiple(my_encoder->get_output_size()); d_encoder = my_encoder; + + d_input_size = d_encoder->get_input_size()*d_input_item_size; + d_output_size = d_encoder->get_output_size()*d_output_item_size; } encoder_impl::~encoder_impl() @@ -63,20 +66,20 @@ namespace gr { 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); + return (int)(0.5 + ninput*relative_rate()); } 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); + return (int)(0.5 + noutput/relative_rate()); } 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); + ninput_items_required[0] = fixed_rate_noutput_to_ninput(noutput_items); } int @@ -85,15 +88,24 @@ namespace gr { 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]; + char *inbuffer = (char*)input_items[0]; + char *outbuffer = (char*)output_items[0]; + + GR_LOG_DEBUG(d_debug_logger, boost::format("%1%, %2%, %3%") \ + % noutput_items % ninput_items[0] % (noutput_items/output_multiple())); - for(int i = 0; i < noutput_items/output_multiple(); ++i) { - 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))); + + for(int i = 0; i < noutput_items/output_multiple(); i++) { + d_encoder->generic_work((void*)(inbuffer+(i*d_input_size)), + (void*)(outbuffer+(i*d_output_size))); } - consume_each((int)(((1.0/relative_rate()) * noutput_items) + .5)); + GR_LOG_DEBUG(d_debug_logger, boost::format("consuming: %1%") \ + % (fixed_rate_noutput_to_ninput(noutput_items))); + GR_LOG_DEBUG(d_debug_logger, boost::format("returning: %1%") \ + % (noutput_items)); + + consume_each(fixed_rate_noutput_to_ninput(noutput_items)); return noutput_items; } diff --git a/gr-fec/lib/encoder_impl.h b/gr-fec/lib/encoder_impl.h index 300f1c08be..3f325219b8 100644 --- a/gr-fec/lib/encoder_impl.h +++ b/gr-fec/lib/encoder_impl.h @@ -34,6 +34,8 @@ namespace gr { generic_encoder::sptr d_encoder; size_t d_input_item_size; size_t d_output_item_size; + size_t d_input_size; + size_t d_output_size; public: encoder_impl(generic_encoder::sptr my_encoder, diff --git a/gr-fec/lib/generic_decoder.cc b/gr-fec/lib/generic_decoder.cc index e9a5fc19d4..ed93ec1c3c 100644 --- a/gr-fec/lib/generic_decoder.cc +++ b/gr-fec/lib/generic_decoder.cc @@ -25,6 +25,7 @@ #endif #include <gnuradio/fec/generic_decoder.h> +#include <gnuradio/prefs.h> #include <stdio.h> namespace gr { @@ -34,6 +35,35 @@ namespace gr { { d_name = name; my_id = base_unique_id++; + +#ifdef ENABLE_GR_LOG +#ifdef HAVE_LOG4CPP + prefs *p = prefs::singleton(); + std::string config_file = p->get_string("LOG", "log_config", ""); + std::string log_level = p->get_string("LOG", "log_level", "off"); + std::string log_file = p->get_string("LOG", "log_file", ""); + + GR_CONFIG_LOGGER(config_file); + + GR_LOG_GETLOGGER(LOG, "gr_log." + alias()); + GR_LOG_SET_LEVEL(LOG, log_level); + if(log_file.size() > 0) { + if(log_file == "stdout") { + GR_LOG_ADD_CONSOLE_APPENDER(LOG, "cout","gr::log :%p: %c{1} - %m%n"); + } + else if(log_file == "stderr") { + GR_LOG_ADD_CONSOLE_APPENDER(LOG, "cerr","gr::log :%p: %c{1} - %m%n"); + } + else { + GR_LOG_ADD_FILE_APPENDER(LOG, log_file , true,"%r :%p: %c{1} - %m%n"); + } + } + d_logger = LOG; + +#endif /* HAVE_LOG4CPP */ +#else /* ENABLE_GR_LOG */ + d_logger = NULL; +#endif /* ENABLE_GR_LOG */ } generic_decoder::~generic_decoder() @@ -52,22 +82,22 @@ namespace gr { return 0.0; } - const char* - generic_decoder::get_conversion() - { - return "none"; - } - int generic_decoder::get_input_item_size() { - return 4; + return sizeof(float); } int generic_decoder::get_output_item_size() { - return 1; + return sizeof(char); + } + + const char* + generic_decoder::get_input_conversion() + { + return "none"; } const char* @@ -123,13 +153,13 @@ namespace gr { } const char* - get_conversion(generic_decoder::sptr my_decoder) + get_decoder_input_conversion(generic_decoder::sptr my_decoder) { - return my_decoder->get_conversion(); + return my_decoder->get_input_conversion(); } const char* - get_output_conversion(generic_decoder::sptr my_decoder) + get_decoder_output_conversion(generic_decoder::sptr my_decoder) { return my_decoder->get_output_conversion(); } diff --git a/gr-fec/lib/generic_encoder.cc b/gr-fec/lib/generic_encoder.cc index 9402b660bf..934d193e7f 100644 --- a/gr-fec/lib/generic_encoder.cc +++ b/gr-fec/lib/generic_encoder.cc @@ -25,15 +25,73 @@ #endif #include <gnuradio/fec/generic_encoder.h> +#include <gnuradio/prefs.h> #include <stdio.h> namespace gr { namespace fec { + generic_encoder::generic_encoder(std::string name) + { + d_name = name; + my_id = base_unique_id++; + +#ifdef ENABLE_GR_LOG +#ifdef HAVE_LOG4CPP + prefs *p = prefs::singleton(); + std::string config_file = p->get_string("LOG", "log_config", ""); + std::string log_level = p->get_string("LOG", "log_level", "off"); + std::string log_file = p->get_string("LOG", "log_file", ""); + + GR_CONFIG_LOGGER(config_file); + + GR_LOG_GETLOGGER(LOG, "gr_log." + alias()); + GR_LOG_SET_LEVEL(LOG, log_level); + if(log_file.size() > 0) { + if(log_file == "stdout") { + GR_LOG_ADD_CONSOLE_APPENDER(LOG, "cout","gr::log :%p: %c{1} - %m%n"); + } + else if(log_file == "stderr") { + GR_LOG_ADD_CONSOLE_APPENDER(LOG, "cerr","gr::log :%p: %c{1} - %m%n"); + } + else { + GR_LOG_ADD_FILE_APPENDER(LOG, log_file , true,"%r :%p: %c{1} - %m%n"); + } + } + d_logger = LOG; + +#endif /* HAVE_LOG4CPP */ +#else /* ENABLE_GR_LOG */ + d_logger = NULL; +#endif /* ENABLE_GR_LOG */ + } + generic_encoder::~generic_encoder() { } + const char* + generic_encoder::get_input_conversion() + { + return "none"; + } + + const char* + generic_encoder::get_output_conversion() + { + return "none"; + } + + int generic_encoder::base_unique_id = 1; + int + generic_encoder::unique_id() + { + return my_id; + } + + /******************************************************* + * Static functions + ******************************************************/ int get_encoder_output_size(generic_encoder::sptr my_encoder) { @@ -46,5 +104,17 @@ namespace gr { return my_encoder->get_input_size(); } + const char* + get_encoder_input_conversion(generic_encoder::sptr my_encoder) + { + return my_encoder->get_input_conversion(); + } + + const char* + get_encoder_output_conversion(generic_encoder::sptr my_encoder) + { + return my_encoder->get_output_conversion(); + } + } /* namespace fec */ } /* namespace gr */ diff --git a/gr-fec/lib/tagged_decoder_impl.cc b/gr-fec/lib/tagged_decoder_impl.cc new file mode 100644 index 0000000000..595537c925 --- /dev/null +++ b/gr-fec/lib/tagged_decoder_impl.cc @@ -0,0 +1,100 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "tagged_decoder_impl.h" +#include <gnuradio/io_signature.h> +#include <stdio.h> + +namespace gr { + namespace fec { + + tagged_decoder::sptr + tagged_decoder::make(generic_decoder::sptr my_decoder, + size_t input_item_size, + size_t output_item_size, + const std::string &lengthtagname) + { + return gnuradio::get_initial_sptr + ( new tagged_decoder_impl(my_decoder, input_item_size, + output_item_size, lengthtagname)); + } + + tagged_decoder_impl::tagged_decoder_impl(generic_decoder::sptr my_decoder, + size_t input_item_size, + size_t output_item_size, + const std::string &lengthtagname) + : tagged_stream_block("fec_tagged_decoder", + io_signature::make(1, 1, input_item_size), + io_signature::make(1, 1, output_item_size), + lengthtagname), + d_input_item_size(input_item_size), d_output_item_size(output_item_size) + { + d_inbuf = buf_sptr(new unsigned char[(my_decoder->get_input_size() + my_decoder->get_history())*input_item_size]); + d_decoder = my_decoder; + + set_relative_rate(d_decoder->rate()); + } + + int + tagged_decoder_impl::calculate_output_stream_length(const gr_vector_int &ninput_items) + { + return d_decoder->get_output_size(); + } + + tagged_decoder_impl::~tagged_decoder_impl() + { + } + + int + tagged_decoder_impl::work(int noutput_items, + gr_vector_int& ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const unsigned char *in = (unsigned char*)input_items[0]; + unsigned char *out = (unsigned char *)output_items[0]; + + d_decoder->set_frame_size(ninput_items[0]/2); + if(noutput_items < d_decoder->get_output_size()) + return 0; + + GR_LOG_DEBUG(d_debug_logger, boost::format("%1%, %2%, %3%") \ + % noutput_items % ninput_items[0] % d_decoder->get_output_size()); + + memcpy((void *)d_inbuf.get(), + in+(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*)(out)); + + add_item_tag(0, nitems_written(0) + d_decoder->get_output_size()*d_output_item_size, + pmt::intern(d_decoder->alias()), pmt::PMT_T, pmt::intern(alias())); + + return d_decoder->get_output_size(); + } + + } /* namespace fec */ +} /* namespace gr */ diff --git a/gr-fec/lib/tagged_decoder_impl.h b/gr-fec/lib/tagged_decoder_impl.h new file mode 100644 index 0000000000..4eeab25f75 --- /dev/null +++ b/gr-fec/lib/tagged_decoder_impl.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#ifndef INCLUDED_FEC_TAGGED_DECODER_IMPL_H +#define INCLUDED_FEC_TAGGED_DECODER_IMPL_H + +#include <gnuradio/fec/tagged_decoder.h> + +namespace gr { + namespace fec { + + class FEC_API tagged_decoder_impl : public tagged_decoder + { + private: + generic_decoder::sptr d_decoder; + size_t d_input_item_size; + size_t d_output_item_size; + buf_sptr d_inbuf; + + public: + tagged_decoder_impl(generic_decoder::sptr my_decoder, + size_t input_item_size, + size_t output_item_size, + const std::string &lengthtagname="packet_len"); + ~tagged_decoder_impl(); + + int work(int noutput_items, + gr_vector_int& ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + int calculate_output_stream_length(const gr_vector_int &ninput_items); + }; + + } /* namespace fec */ +} /* namespace gr */ + +#endif /* INCLUDED_FEC_TAGGED_DECODER_IMPL_H */ diff --git a/gr-fec/lib/tagged_encoder_impl.cc b/gr-fec/lib/tagged_encoder_impl.cc new file mode 100644 index 0000000000..f914866df1 --- /dev/null +++ b/gr-fec/lib/tagged_encoder_impl.cc @@ -0,0 +1,94 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "tagged_encoder_impl.h" +#include <gnuradio/io_signature.h> +#include <stdio.h> + +namespace gr { + namespace fec { + + tagged_encoder::sptr + tagged_encoder::make(generic_encoder::sptr my_encoder, + size_t input_item_size, + size_t output_item_size, + const std::string& lengthtagname) + { + return gnuradio::get_initial_sptr + (new tagged_encoder_impl(my_encoder, input_item_size, + output_item_size, + lengthtagname)); + } + + tagged_encoder_impl::tagged_encoder_impl(generic_encoder::sptr my_encoder, + size_t input_item_size, + size_t output_item_size, + const std::string& lengthtagname) + : tagged_stream_block("fec_tagged_encoder", + io_signature::make(1, 1, input_item_size), + io_signature::make(1, 1, output_item_size), + lengthtagname), + d_input_item_size(input_item_size), d_output_item_size(output_item_size) + { + d_encoder = my_encoder; + } + + tagged_encoder_impl::~tagged_encoder_impl() + { + } + + int + tagged_encoder_impl::calculate_output_stream_length(const gr_vector_int &ninput_items) + { + return d_encoder->get_output_size(); + } + + int + tagged_encoder_impl::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]; + + d_encoder->set_frame_size(ninput_items[0]); + if(noutput_items < d_encoder->get_output_size()) + return 0; + + GR_LOG_DEBUG(d_debug_logger, boost::format("nout: %1% nin: %2% ret: %3%") \ + % noutput_items % ninput_items[0] % d_encoder->get_output_size()); + + d_encoder->generic_work((void*)(inbuffer), (void*)(outbuffer)); + + add_item_tag(0, nitems_written(0) + (d_encoder->get_output_size()*d_output_item_size), + pmt::intern(d_encoder->alias()), pmt::PMT_T, pmt::intern(alias())); + + return d_encoder->get_output_size(); + } + + } /* namespace fec */ +} /* namespace gr */ diff --git a/gr-fec/lib/tagged_encoder_impl.h b/gr-fec/lib/tagged_encoder_impl.h new file mode 100644 index 0000000000..55b355342c --- /dev/null +++ b/gr-fec/lib/tagged_encoder_impl.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#ifndef INCLUDED_FEC_TAGGED_ENCODER_IMPL_H +#define INCLUDED_FEC_TAGGED_ENCODER_IMPL_H + +#include <gnuradio/fec/tagged_encoder.h> + +namespace gr { + namespace fec { + + class FEC_API tagged_encoder_impl : public tagged_encoder + { + private: + generic_encoder::sptr d_encoder; + size_t d_input_item_size; + size_t d_output_item_size; + + public: + tagged_encoder_impl(generic_encoder::sptr my_encoder, + size_t input_item_size, + size_t output_item_size, + const std::string &lengthtagname="packet_len"); + ~tagged_encoder_impl(); + + int work(int noutput_items, + gr_vector_int& ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + int calculate_output_stream_length(const gr_vector_int &ninput_items); + }; + + } /* namespace fec */ +} /* namespace gr */ + +#endif /* INCLUDED_FEC_TAGGED_ENCODER_IMPL_H */ diff --git a/gr-fec/python/fec/capillary_threaded_decoder.py b/gr-fec/python/fec/capillary_threaded_decoder.py index fcfa39e659..c4990ab21e 100644 --- a/gr-fec/python/fec/capillary_threaded_decoder.py +++ b/gr-fec/python/fec/capillary_threaded_decoder.py @@ -47,7 +47,7 @@ class capillary_threaded_decoder(gr.hier_block2): 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(blocks.interleave(output_size, - fec.get_decoder_output_size(decoder_list_0[0]))) + fec.get_decoder_output_size(decoder_list_0[0]))) rootcount = 0 branchcount = 1 diff --git a/gr-fec/python/fec/extended_decoder.py b/gr-fec/python/fec/extended_decoder.py index dafedd861a..d50746c1d4 100644 --- a/gr-fec/python/fec/extended_decoder.py +++ b/gr-fec/python/fec/extended_decoder.py @@ -76,28 +76,33 @@ class extended_decoder(gr.hier_block2): } 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)) + integration_period=10000, flush=None, rotator=None, lentagname=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 + if type(lentagname) == str: + if(lentagname.lower() == 'none'): + lentagname = None + 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": + if fec.get_decoder_input_conversion(decoder_obj_list[0]) == "uchar" or \ + fec.get_decoder_input_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": + elif fec.get_decoder_input_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": + if fec.get_decoder_input_conversion(decoder_obj_list[0]) == "uchar" or \ + fec.get_decoder_input_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 @@ -122,12 +127,10 @@ class extended_decoder(gr.hier_block2): 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.depuncture_bb(0, read_bitlist(puncpat), - puncpat.count('0'), len(puncpat))) + self.blocks.append(fec.depuncture_bb(len(puncpat), read_bitlist(puncpat), 0)) - if fec.get_conversion(decoder_obj_list[0]) == "packed_bits": + if fec.get_decoder_input_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()) @@ -135,6 +138,7 @@ class extended_decoder(gr.hier_block2): 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]), @@ -146,11 +150,17 @@ class extended_decoder(gr.hier_block2): 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": + if(not lentagname): + 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]))) + else: + self.blocks.append(fec.tagged_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]), + lentagname)) + + if fec.get_decoder_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)); diff --git a/gr-fec/python/fec/extended_encoder.py b/gr-fec/python/fec/extended_encoder.py index b2dcc26b13..01b9e09f2e 100644 --- a/gr-fec/python/fec/extended_encoder.py +++ b/gr-fec/python/fec/extended_encoder.py @@ -20,7 +20,7 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr +from gnuradio import gr, blocks import fec_swig as fec from threaded_encoder import threaded_encoder @@ -28,13 +28,22 @@ from capillary_threaded_encoder import capillary_threaded_encoder from bitflip import read_bitlist class extended_encoder(gr.hier_block2): - def __init__(self, encoder_obj_list, threading, puncpat=None): + def __init__(self, encoder_obj_list, threading, puncpat=None, + lentagname=None): gr.hier_block2.__init__(self, "extended_encoder", gr.io_signature(1, 1, gr.sizeof_char), gr.io_signature(1, 1, gr.sizeof_char)) self.blocks=[] self.puncpat=puncpat + + if type(lentagname) == str: + if(lentagname.lower() == 'none'): + lentagname = None + + if fec.get_encoder_input_conversion(encoder_obj_list[0]) == "pack": + self.blocks.append(blocks.pack_k_bits_bb(8)) + if threading == 'capillary': self.blocks.append(capillary_threaded_encoder(encoder_obj_list, gr.sizeof_char, @@ -44,9 +53,15 @@ class extended_encoder(gr.hier_block2): gr.sizeof_char, gr.sizeof_char)) else: - self.blocks.append(fec.encoder(encoder_obj_list[0], - gr.sizeof_char, - gr.sizeof_char)) + if(not lentagname): + self.blocks.append(fec.encoder(encoder_obj_list[0], + gr.sizeof_char, + gr.sizeof_char)) + else: + self.blocks.append(fec.tagged_encoder(encoder_obj_list[0], + gr.sizeof_char, + gr.sizeof_char, + lentagname)) if self.puncpat != '11': self.blocks.append(fec.puncture_bb(len(puncpat), read_bitlist(puncpat), 0)) diff --git a/gr-fec/python/fec/qa_depuncture.py b/gr-fec/python/fec/qa_depuncture.py new file mode 100644 index 0000000000..5566e83a25 --- /dev/null +++ b/gr-fec/python/fec/qa_depuncture.py @@ -0,0 +1,192 @@ +#!/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, gr_unittest +import fec_swig as fec +import blocks_swig as blocks +from collections import deque + +class test_depuncture (gr_unittest.TestCase): + + def depuncture_setup(self): + p = [] + for i in range(self.puncsize): + p.append(self.puncpat >> (self.puncsize - 1 - i) & 1) + d = deque(p) + d.rotate(self.delay) + _puncpat = list(d) + + k = 0 + self.expected = [] + for n in range(len(self.src_data)/(self.puncsize - self.puncholes)): + for i in range(self.puncsize): + if _puncpat[i] == 1: + self.expected.append(self.src_data[k]); + k+=1 + else: + self.expected.append(self.sym) + + def setUp(self): + self.src_data = 2000*range(64) + self.tb = gr.top_block () + + def tearDown(self): + self.tb = None + + def test_000(self): + # Test normal operation of the depuncture block + + self.puncsize = 8 + self.puncpat = 0xEF + self.delay = 0 + self.sym = 0 + self.puncholes = 1 + + self.depuncture_setup() + + src = blocks.vector_source_b(self.src_data) + op = fec.depuncture_bb(self.puncsize, self.puncpat, + self.delay, self.sym) + dst = blocks.vector_sink_b() + + self.tb.connect(src, op, dst) + self.tb.run() + + dst_data = list(dst.data()) + for i in xrange(len(dst_data)): + dst_data[i] = int(dst_data[i]) + + self.assertEqual(self.expected, dst_data) + + def test_001(self): + # Test normal operation of the depuncture block with a delay + + self.puncsize = 8 + self.puncpat = 0xEF + self.delay = 1 + self.sym = 0 + self.puncholes = 1 + + self.depuncture_setup() + + src = blocks.vector_source_b(self.src_data) + op = fec.depuncture_bb(self.puncsize, self.puncpat, + self.delay, self.sym) + dst = blocks.vector_sink_b() + + self.tb.connect(src, op, dst) + self.tb.run() + + dst_data = list(dst.data()) + for i in xrange(len(dst_data)): + dst_data[i] = int(dst_data[i]) + + self.assertEqual(self.expected, dst_data) + + def test_002(self): + # Test scenario where we have defined a puncture pattern with + # more bits than the puncsize. + + self.puncsize = 4 + self.puncpat = 0x5555 + self.delay = 0 + self.sym = 0 + self.puncholes = 2 + + self.depuncture_setup() + + src = blocks.vector_source_b(self.src_data) + op = fec.depuncture_bb(self.puncsize, self.puncpat, + self.delay, self.sym) + dst = blocks.vector_sink_b() + + self.tb.connect(src, op, dst) + self.tb.run() + + dst_data = list(dst.data()) + for i in xrange(len(dst_data)): + dst_data[i] = int(dst_data[i]) + + self.assertEqual(self.expected, dst_data) + + def test_003(self): + # Test scenario where we have defined a puncture pattern with + # more bits than the puncsize with a delay. The python code + # doesn't account for this when creating self.expected, but + # this should be equivalent to a puncpat of the correct size. + + self.puncsize = 4 + self.puncpat0 = 0x5555 # too many bits set + self.puncpat1 = 0x55 # num bits = puncsize + self.delay = 1 + self.sym = 0 + + src = blocks.vector_source_b(self.src_data) + op0 = fec.depuncture_bb(self.puncsize, self.puncpat0, + self.delay, self.sym) + op1 = fec.depuncture_bb(self.puncsize, self.puncpat1, + self.delay, self.sym) + dst0 = blocks.vector_sink_b() + dst1 = blocks.vector_sink_b() + + self.tb.connect(src, op0, dst0) + self.tb.connect(src, op1, dst1) + self.tb.run() + + dst_data0 = list(dst0.data()) + for i in xrange(len(dst_data0)): + dst_data0[i] = int(dst_data0[i]) + + dst_data1 = list(dst1.data()) + for i in xrange(len(dst_data1)): + dst_data1[i] = int(dst_data1[i]) + + self.assertEqual(dst_data1, dst_data0) + + def test_004(self): + # Test normal operation of the depuncture block without + # specifying the fill symbol (defaults to 127). + + self.puncsize = 8 + self.puncpat = 0xEF + self.delay = 0 + self.sym = 127 + self.puncholes = 1 + + self.depuncture_setup() + + src = blocks.vector_source_b(self.src_data) + op = fec.depuncture_bb(self.puncsize, self.puncpat, + self.delay) + dst = blocks.vector_sink_b() + + self.tb.connect(src, op, dst) + self.tb.run() + + dst_data = list(dst.data()) + for i in xrange(len(dst_data)): + dst_data[i] = int(dst_data[i]) + + self.assertEqual(self.expected, dst_data) + +if __name__ == '__main__': + gr_unittest.run(test_depuncture, "test_depuncture.xml") diff --git a/gr-fec/swig/fec_swig.i b/gr-fec/swig/fec_swig.i index e3cbd3387d..ae9b663ccf 100644 --- a/gr-fec/swig/fec_swig.i +++ b/gr-fec/swig/fec_swig.i @@ -27,6 +27,8 @@ //load generated python docstrings %include "fec_swig_doc.i" +%include "gnuradio/fec/cc_common.h" + %nodefaultctor gr::fec::generic_encoder; %template(generic_encoder_sptr) boost::shared_ptr<gr::fec::generic_encoder>; @@ -34,12 +36,16 @@ %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/generic_encoder.h" #include "gnuradio/fec/decoder.h" -#include "gnuradio/fec/cc_encoder.h" +#include "gnuradio/fec/encoder.h" +#include "gnuradio/fec/tagged_decoder.h" +#include "gnuradio/fec/tagged_encoder.h" #include "gnuradio/fec/cc_decoder.h" +#include "gnuradio/fec/cc_encoder.h" +#include "gnuradio/fec/ccsds_decoder.h" +#include "gnuradio/fec/ccsds_encoder.h" #include "gnuradio/fec/decode_ccsds_27_fb.h" #include "gnuradio/fec/encode_ccsds_27_bb.h" #include "gnuradio/fec/ber_bf.h" @@ -49,12 +55,16 @@ #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/generic_encoder.h" %include "gnuradio/fec/decoder.h" -%include "gnuradio/fec/cc_encoder.h" +%include "gnuradio/fec/encoder.h" +%include "gnuradio/fec/tagged_decoder.h" +%include "gnuradio/fec/tagged_encoder.h" %include "gnuradio/fec/cc_decoder.h" +%include "gnuradio/fec/cc_encoder.h" +%include "gnuradio/fec/ccsds_decoder.h" +%include "gnuradio/fec/ccsds_encoder.h" %include "gnuradio/fec/decode_ccsds_27_fb.h" %include "gnuradio/fec/encode_ccsds_27_bb.h" %include "gnuradio/fec/ber_bf.h" @@ -63,8 +73,10 @@ %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, encoder); +GR_SWIG_BLOCK_MAGIC2(fec, tagged_decoder); +GR_SWIG_BLOCK_MAGIC2(fec, tagged_encoder); 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); |