commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 25/57: fec: encoder now outputs bytes to ma


From: git
Subject: [Commit-gnuradio] [gnuradio] 25/57: fec: encoder now outputs bytes to make it more easily integratable with modulators.
Date: Wed, 21 May 2014 03:10:27 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch master
in repository gnuradio.

commit dd62061699a53e535f57a0ce0587bf1485db734f
Author: Tom Rondeau <address@hidden>
Date:   Fri Apr 18 17:28:14 2014 -0400

    fec: encoder now outputs bytes to make it more easily integratable with 
modulators.
---
 gr-fec/grc/fec_block_tree.xml                      |   4 +-
 gr-fec/grc/fec_depuncture_bb.xml                   |   2 +-
 gr-fec/grc/fec_extended_encoder.xml                |   2 +-
 .../{fec_puncture_ff.xml => fec_puncture_xx.xml}   |  24 +++-
 gr-fec/include/gnuradio/fec/CMakeLists.txt         |   1 +
 gr-fec/include/gnuradio/fec/generic_encoder.h      |   2 +-
 .../fec/{generic_encoder.h => puncture_bb.h}       |  25 ++--
 gr-fec/lib/CMakeLists.txt                          |   1 +
 gr-fec/lib/cc_encoder_impl.cc                      |  14 +--
 gr-fec/lib/encoder_impl.cc                         |   5 -
 gr-fec/lib/puncture_bb_impl.cc                     | 137 +++++++++++++++++++++
 gr-fec/lib/puncture_bb_impl.h                      |  59 +++++++++
 gr-fec/python/fec/capillary_threaded_encoder.py    |  18 +--
 gr-fec/python/fec/extended_encoder.py              |  25 ++--
 gr-fec/python/fec/threaded_encoder.py              |   2 +-
 15 files changed, 266 insertions(+), 55 deletions(-)

diff --git a/gr-fec/grc/fec_block_tree.xml b/gr-fec/grc/fec_block_tree.xml
index 6ce8a6e..de975ca 100644
--- a/gr-fec/grc/fec_block_tree.xml
+++ b/gr-fec/grc/fec_block_tree.xml
@@ -22,8 +22,8 @@
     <block>fec_generic_decoder</block>
     <block>fec_decode_ccsds_27_fb</block>
     <block>fec_encode_ccsds_27_bb</block>
-    <block>fec_puncture_ff</block>
-    <block>fec_depuncture_ff</block>
+    <block>fec_puncture_xx</block>
+    <block>fec_depuncture_bb</block>
     <block>fec_ber_bf</block>
     <block>fec_bercurve_generator</block>
   </cat>
diff --git a/gr-fec/grc/fec_depuncture_bb.xml b/gr-fec/grc/fec_depuncture_bb.xml
index 070dcb1..37173b3 100644
--- a/gr-fec/grc/fec_depuncture_bb.xml
+++ b/gr-fec/grc/fec_depuncture_bb.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <block>
   <name>Depuncture</name>
-  <key>fec_depuncture_ff</key>
+  <key>fec_depuncture_bb</key>
   <import>from gnuradio import fec</import>
   <make>fec.depucture_bb($delay, $puncpat, $puncholes, $puncsize)</make>
 
diff --git a/gr-fec/grc/fec_extended_encoder.xml 
b/gr-fec/grc/fec_extended_encoder.xml
index 0ed3d31..5055ca0 100644
--- a/gr-fec/grc/fec_extended_encoder.xml
+++ b/gr-fec/grc/fec_extended_encoder.xml
@@ -47,7 +47,7 @@
 
   <source>
     <name>out</name>
-    <type>float</type>
+    <type>byte</type>
   </source>
 
   <doc>
diff --git a/gr-fec/grc/fec_puncture_ff.xml b/gr-fec/grc/fec_puncture_xx.xml
similarity index 56%
rename from gr-fec/grc/fec_puncture_ff.xml
rename to gr-fec/grc/fec_puncture_xx.xml
index 1442dd5..0bc5558 100644
--- a/gr-fec/grc/fec_puncture_ff.xml
+++ b/gr-fec/grc/fec_puncture_xx.xml
@@ -1,9 +1,25 @@
 <?xml version="1.0"?>
 <block>
   <name>Puncture</name>
-  <key>fec_puncture_ff</key>
+  <key>fec_puncture_xx</key>
   <import>from gnuradio import fec</import>
-  <make>fec.puncture_ff($delay, $puncpat, $puncholes, $puncsize)</make>
+  <make>fec.puncture_$(type.fcn)($delay, $puncpat, $puncholes, 
$puncsize)</make>
+
+  <param>
+    <name>Type</name>
+    <key>type</key>
+    <type>enum</type>
+    <option>
+      <name>Float</name>
+      <key>float</key>
+      <opt>fcn:ff</opt>
+    </option>
+    <option>
+      <name>Byte</name>
+      <key>byte</key>
+      <opt>fcn:bb</opt>
+    </option>
+  </param>
 
   <param>
     <name>Delay</name>
@@ -31,12 +47,12 @@
 
   <sink>
     <name>in</name>
-    <type>float</type>
+    <type>$type</type>
   </sink>
 
   <source>
     <name>out</name>
-    <type>float</type>
+    <type>$type</type>
   </source>
 
 </block>
diff --git a/gr-fec/include/gnuradio/fec/CMakeLists.txt 
b/gr-fec/include/gnuradio/fec/CMakeLists.txt
index a2d1ac2..68aae6a 100644
--- a/gr-fec/include/gnuradio/fec/CMakeLists.txt
+++ b/gr-fec/include/gnuradio/fec/CMakeLists.txt
@@ -88,6 +88,7 @@ install(FILES
     viterbi.h
     ber_bf.h
     conv_bit_corr_bb.h
+    puncture_bb.h
     puncture_ff.h
     depuncture_bb.h
     DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fec
diff --git a/gr-fec/include/gnuradio/fec/generic_encoder.h 
b/gr-fec/include/gnuradio/fec/generic_encoder.h
index 25f35a6..4812873 100644
--- a/gr-fec/include/gnuradio/fec/generic_encoder.h
+++ b/gr-fec/include/gnuradio/fec/generic_encoder.h
@@ -34,7 +34,7 @@ namespace gr {
     {
     public:
       friend class encoder;
-      virtual void generic_work(void *inBuffer, void *outBuffer) = 0;
+      virtual void generic_work(void *in_buffer, void *out_buffer) = 0;
     public:
       typedef boost::shared_ptr<generic_encoder> sptr;
 
diff --git a/gr-fec/include/gnuradio/fec/generic_encoder.h 
b/gr-fec/include/gnuradio/fec/puncture_bb.h
similarity index 57%
copy from gr-fec/include/gnuradio/fec/generic_encoder.h
copy to gr-fec/include/gnuradio/fec/puncture_bb.h
index 25f35a6..b3d3db7 100644
--- a/gr-fec/include/gnuradio/fec/generic_encoder.h
+++ b/gr-fec/include/gnuradio/fec/puncture_bb.h
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2013-2014 Free Software Foundation, Inc.
+ * Copyright 2014 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -20,34 +20,25 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef INCLUDED_FEC_GENERIC_ENCODER_H
-#define INCLUDED_FEC_GENERIC_ENCODER_H
+#ifndef INCLUDED_FEC_PUNCTURE_BB_H
+#define INCLUDED_FEC_PUNCTURE_BB_H
 
 #include <gnuradio/fec/api.h>
 #include <gnuradio/block.h>
-#include <boost/shared_ptr.hpp>
 
 namespace gr {
   namespace fec {
 
-    class FEC_API generic_encoder
+    class FEC_API puncture_bb : virtual public block
     {
     public:
-      friend class encoder;
-      virtual void generic_work(void *inBuffer, void *outBuffer) = 0;
-    public:
-      typedef boost::shared_ptr<generic_encoder> sptr;
+      // gr::fec::puncture_bb::sptr
+      typedef boost::shared_ptr<puncture_bb> sptr;
 
-      virtual int get_input_size() = 0;
-      virtual int get_output_size() = 0;
-      generic_encoder(void) {};
-      virtual ~generic_encoder();
+      static sptr make(int delay, int puncpat, int puncholes, int puncsize);
     };
 
-    FEC_API int get_encoder_output_size(generic_encoder::sptr my_encoder);
-    FEC_API int get_encoder_input_size(generic_encoder::sptr my_encoder);
-
   } /* namespace fec */
 } /* namespace gr */
 
-#endif /* INCLUDED_FEC_GENERIC_ENCODER_H */
+#endif /* INCLUDED_FEC_PUNCTURE_BB_H */
diff --git a/gr-fec/lib/CMakeLists.txt b/gr-fec/lib/CMakeLists.txt
index 9d1e7d9..cc187d5 100644
--- a/gr-fec/lib/CMakeLists.txt
+++ b/gr-fec/lib/CMakeLists.txt
@@ -60,6 +60,7 @@ list(APPEND gnuradio_fec_sources
   ber_tools.cc
   ber_bf_impl.cc
   conv_bit_corr_bb_impl.cc
+  puncture_bb_impl.cc
   puncture_ff_impl.cc
   depuncture_bb_impl.cc
 )
diff --git a/gr-fec/lib/cc_encoder_impl.cc b/gr-fec/lib/cc_encoder_impl.cc
index 4e5e001..bf8617d 100644
--- a/gr-fec/lib/cc_encoder_impl.cc
+++ b/gr-fec/lib/cc_encoder_impl.cc
@@ -133,10 +133,10 @@ namespace gr {
       }
 
       void
-      cc_encoder_impl::generic_work(void *inBuffer, void *outBuffer)
+      cc_encoder_impl::generic_work(void *in_buffer, void *out_buffer)
       {
-        const unsigned char *in = (const unsigned char *) inBuffer;
-        float *out = (float *) outBuffer;
+        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);
@@ -151,7 +151,7 @@ namespace gr {
         for(unsigned int i = 0; i < d_framebits; ++i) {
           my_state = (my_state << 1) | (in[i] & 1);
           for(unsigned int j = 0; j < d_rate; ++j) {
-            out[i * d_rate + j] = parity(my_state & d_polys[j]) == 0 ? -1.0 : 
1.0;
+            out[i * d_rate + j] = parity(my_state & d_polys[j]) == 0 ? 0 : 1;
           }
         }
 
@@ -159,7 +159,7 @@ namespace gr {
           for(unsigned int i = 0; i < d_k - 1; ++i) {
             my_state = (my_state << 1) | ((d_start_state >> (d_k - 2 - i)) & 
1);
             for(unsigned int j = 0; j < d_rate; ++j) {
-              out[(i + d_framebits) * d_rate + j] = parity(my_state & 
d_polys[j]) == 0 ? -1.0 : 1.0;
+              out[(i + d_framebits) * d_rate + j] = parity(my_state & 
d_polys[j]) == 0 ? 0 : 1;
             }
           }
         }
@@ -171,7 +171,7 @@ namespace gr {
             int cnt = 0;
             for(int j = 0; j < d_rate; ++j) {
               if(d_polys[j] != 1) {
-                out[(i + d_framebits) * d_rate + cnt] = parity(my_state & 
d_polys[j]) == 0 ? -1.0 : 1.0;
+                out[(i + d_framebits) * d_rate + cnt] = parity(my_state & 
d_polys[j]) == 0 ? 0 : 1;
                 cnt++;
               }
             }
@@ -191,7 +191,7 @@ namespace gr {
         /*
         for(int i = d_framebits * d_rate - 25; i < d_framebits * d_rate; ++i) {
           //for(int i = 0; i < 25; ++i) {
-          printf("...%f : %u\n", out[i], i);
+          printf("...%d : %u\n", out[i], i);
         }
         */
       }
diff --git a/gr-fec/lib/encoder_impl.cc b/gr-fec/lib/encoder_impl.cc
index 6a075b4..b595648 100644
--- a/gr-fec/lib/encoder_impl.cc
+++ b/gr-fec/lib/encoder_impl.cc
@@ -89,15 +89,10 @@ namespace gr {
       char *outBuffer = (char*)output_items[0];
 
       for(int i = 0; i < noutput_items/output_multiple(); ++i) {
-        //printf("%u inp %u oup\n", d_input_item_size, d_output_item_size);
-        //printf("%u, %u\n", 
(i*d_encoder->get_input_size()*d_input_item_size), 
(i*d_encoder->get_output_size()*d_output_item_size));
-
         
d_encoder->generic_work((void*)(inBuffer+(i*d_encoder->get_input_size()*d_input_item_size)),
                                 
(void*)(outBuffer+(i*d_encoder->get_output_size()*d_output_item_size)));
       }
 
-      //printf("%d, %u, %u\n", (int)(((1.0/relative_rate()) * noutput_items) + 
.5), noutput_items, output_multiple());
-
       consume_each((int)(((1.0/relative_rate()) * noutput_items) + .5));
       return noutput_items;
     }
diff --git a/gr-fec/lib/puncture_bb_impl.cc b/gr-fec/lib/puncture_bb_impl.cc
new file mode 100644
index 0000000..2fedc77
--- /dev/null
+++ b/gr-fec/lib/puncture_bb_impl.cc
@@ -0,0 +1,137 @@
+/* -*- 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 "puncture_bb_impl.h"
+#include <gnuradio/io_signature.h>
+#include <boost/bind.hpp>
+#include <pmt/pmt.h>
+#include <string>
+#include <stdio.h>
+
+namespace gr {
+  namespace fec {
+
+    puncture_bb::sptr
+    puncture_bb::make(int delay, int puncpat,
+                      int puncholes, int puncsize)
+    {
+      return gnuradio::get_initial_sptr
+        (new puncture_bb_impl(delay, puncpat,
+                              puncholes, puncsize));
+    }
+
+    puncture_bb_impl::puncture_bb_impl(int delay, int puncpat,
+                                       int puncholes, int puncsize)
+      : block("puncture_bb",
+              io_signature::make(1, 1, sizeof(char)),
+              io_signature::make(1, 1, sizeof(char))),
+        d_delay(delay), d_puncholes(puncholes), d_puncsize(puncsize)
+    {
+      for(int i = 0; i < d_delay; ++i) {
+       puncpat = ((puncpat & 1) << (d_puncsize - 1)) + (puncpat >> 1);
+      }
+      d_puncpat = puncpat;
+
+      set_fixed_rate(true);
+      set_relative_rate((double)(d_puncsize - d_puncholes)/d_puncsize);
+      set_output_multiple(d_puncsize - d_puncholes);
+      //set_msg_handler(boost::bind(&puncture_bb_impl::catch_msg, this, _1));
+    }
+
+    puncture_bb_impl::~puncture_bb_impl()
+    {
+    }
+
+    int
+    puncture_bb_impl::fixed_rate_ninput_to_noutput(int ninput)
+    {
+      return (int)((((d_puncsize - d_puncholes)/(double)(d_puncsize)) * 
ninput) + .5);
+    }
+
+    int
+    puncture_bb_impl::fixed_rate_noutput_to_ninput(int noutput)
+    {
+      return (int)(((d_puncsize/(double)(d_puncsize-d_puncholes)) * noutput) + 
.5);
+    }
+
+    void
+    puncture_bb_impl::forecast(int noutput_items,
+                               gr_vector_int& ninput_items_required)
+    {
+      ninput_items_required[0] = 
(int)(((d_puncsize/(double)(d_puncsize-d_puncholes)) * noutput_items) + .5);
+    }
+
+    /*
+    void
+    puncture_bb_impl::catch_msg(pmt::pmt_t msg)
+    {
+      long mlong = pmt::pmt_to_long(msg);
+      for(int i = 0; i < mlong; ++i) {
+        d_puncholes = (d_puncholes >> 1) | ((d_puncholes & 1) << (d_puncsize - 
1));
+      }
+    }
+    */
+
+    int
+    puncture_bb_impl::general_work(int noutput_items,
+                                   gr_vector_int& ninput_items,
+                                   gr_vector_const_void_star &input_items,
+                                   gr_vector_void_star &output_items)
+    {
+      const char *in = (const char *)input_items[0];
+      char *out = (char *)output_items[0];
+
+      for(int i=0, k=0; i < noutput_items/output_multiple(); ++i) {
+        for(int j = 0; j < d_puncsize; ++j) {
+         if((d_puncpat >> (d_puncsize - 1 - j)) & 1) {
+            out[k++] = in[i*d_puncsize + j];
+         }
+        }
+      }
+
+      GR_LOG_DEBUG(d_debug_logger, ">>>>>> start");
+      for(int i = 0, k=0; i < noutput_items; ++i) {
+        if((d_puncpat >> (d_puncsize - 1 - (i % d_puncsize))) & 1) {
+         GR_LOG_DEBUG(d_debug_logger, boost::format("%1%...%2%") \
+                       % out[k++] % in[i]);
+        }
+        else {
+         GR_LOG_DEBUG(d_debug_logger, boost::format("snit %1%") % in[i]);
+        }
+      }
+
+      GR_LOG_DEBUG(d_debug_logger, boost::format("comp: %1%, %2%\n") \
+                   % noutput_items % ninput_items[0]);
+      GR_LOG_DEBUG(d_debug_logger, boost::format("consuming %1%") \
+                   % ((int)(((1.0/relative_rate()) * noutput_items) + .5)));
+
+      consume_each((int)(((1.0/relative_rate()) * noutput_items) + .5));
+      return noutput_items;
+    }
+
+  } /* namespace fec */
+}/* namespace gr */
+
diff --git a/gr-fec/lib/puncture_bb_impl.h b/gr-fec/lib/puncture_bb_impl.h
new file mode 100644
index 0000000..6480a74
--- /dev/null
+++ b/gr-fec/lib/puncture_bb_impl.h
@@ -0,0 +1,59 @@
+/* -*- 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_PUNCTURE_BB_IMPL_H
+#define INCLUDED_FEC_PUNCTURE_BB_IMPL_H
+
+#include <gnuradio/fec/puncture_bb.h>
+
+namespace gr {
+  namespace fec {
+
+    class FEC_API puncture_bb_impl : public puncture_bb
+    {
+    private:
+      int d_delay;
+      int d_puncholes;
+      int d_puncsize;
+      int d_puncpat;
+
+    public:
+      puncture_bb_impl(int delay, int puncpat,
+                       int puncholes, int puncsize);
+      ~puncture_bb_impl();
+
+      //void catch_msg(pmt::pmt_t msg);
+
+      int general_work(int noutput_items,
+                       gr_vector_int& ninput_items,
+                       gr_vector_const_void_star &input_items,
+                       gr_vector_void_star &output_items);
+      int fixed_rate_ninput_to_noutput(int ninput);
+      int fixed_rate_noutput_to_ninput(int noutput);
+      void forecast(int noutput_items,
+                    gr_vector_int& ninput_items_required);
+    };
+
+  } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_PUNCTURE_BB_IMPL_H */
diff --git a/gr-fec/python/fec/capillary_threaded_encoder.py 
b/gr-fec/python/fec/capillary_threaded_encoder.py
index dc2321a..377250f 100644
--- a/gr-fec/python/fec/capillary_threaded_encoder.py
+++ b/gr-fec/python/fec/capillary_threaded_encoder.py
@@ -25,27 +25,29 @@ import fec_swig as fec
 import math
 
 class capillary_threaded_encoder(gr.hier_block2):
-    def __init__(self, encoder_list_0, input_size=gr.sizeof_char, 
output_size=gr.sizeof_float):
-        gr.hier_block2.__init__(
-            self, "Capillary Threaded Encoder",
-            gr.io_signature(1, 1, input_size),
-            gr.io_signature(1, 1, output_size))
+    def __init__(self, encoder_list_0, input_size=gr.sizeof_char, 
output_size=gr.sizeof_char):
+        gr.hier_block2.__init__(self, "Capillary Threaded Encoder",
+                                gr.io_signature(1, 1, input_size),
+                                gr.io_signature(1, 1, output_size))
 
         self.encoder_list_0 = encoder_list_0
 
         self.deinterleaves_0 = [];
         for i in range(int(math.log(len(encoder_list_0), 2))):
             for j in range(int(math.pow(2, i))):
-                self.deinterleaves_0.append(blocks.deinterleave(input_size, 
fec.get_encoder_input_size(encoder_list_0[0])))
+                self.deinterleaves_0.append(blocks.deinterleave(input_size,
+                                                                
fec.get_encoder_input_size(encoder_list_0[0])))
 
                self.generic_encoders_0 = [];
         for i in range(len(encoder_list_0)):
-            self.generic_encoders_0.append(fec.encoder(encoder_list_0[i], 
input_size, output_size))
+            self.generic_encoders_0.append(fec.encoder(encoder_list_0[i],
+                                                       input_size, 
output_size))
 
         self.interleaves_0 = [];
         for i in range(int(math.log(len(encoder_list_0), 2))):
             for j in range(int(math.pow(2, i))):
-                self.interleaves_0.append(blocks.interleave(output_size, 
fec.get_encoder_output_size(encoder_list_0[0])))
+                self.interleaves_0.append(blocks.interleave(output_size,
+                                                            
fec.get_encoder_output_size(encoder_list_0[0])))
 
         rootcount = 0;
         branchcount = 1;
diff --git a/gr-fec/python/fec/extended_encoder.py 
b/gr-fec/python/fec/extended_encoder.py
index b7f414c..0e4bc09 100644
--- a/gr-fec/python/fec/extended_encoder.py
+++ b/gr-fec/python/fec/extended_encoder.py
@@ -29,27 +29,36 @@ from bitflip import read_bitlist
 
 class extended_encoder(gr.hier_block2):
     def __init__(self, encoder_obj_list, threading, puncpat=None):
-        gr.hier_block2.__init__(
-            self, "extended_encoder",
-            gr.io_signature(1, 1, gr.sizeof_char),
-            gr.io_signature(1, 1, gr.sizeof_float))
+        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 threading == 'capillary':
-            self.blocks.append(capillary_threaded_encoder(encoder_obj_list))
+            self.blocks.append(capillary_threaded_encoder(encoder_obj_list,
+                                                          gr.sizeof_char,
+                                                          gr.sizeof_char))
         elif threading == 'ordinary':
-            self.blocks.append(threaded_encoder(encoder_obj_list))
+            self.blocks.append(threaded_encoder(encoder_obj_list,
+                                                gr.sizeof_char,
+                                                gr.sizeof_char))
         else:
-            self.blocks.append(fec.encoder(encoder_obj_list[0]))
+            self.blocks.append(fec.encoder(encoder_obj_list[0],
+                                           gr.sizeof_char,
+                                           gr.sizeof_char))
 
         if self.puncpat != '11':
-            self.blocks.append(fec.puncture_ff(0, read_bitlist(puncpat),
+            self.blocks.append(fec.puncture_bb(0, read_bitlist(puncpat),
                                                puncpat.count('0'), 
len(puncpat)))
 
+        # Connect the input to the encoder and the output to the
+        # puncture if used or the encoder if not.
         self.connect((self, 0), (self.blocks[0], 0));
         self.connect((self.blocks[-1], 0), (self, 0));
 
+        # If using the puncture block, add it into the flowgraph after
+        # the encoder.
         for i in range(len(self.blocks) - 1):
             self.connect((self.blocks[i], 0), (self.blocks[i+1], 0));
 
diff --git a/gr-fec/python/fec/threaded_encoder.py 
b/gr-fec/python/fec/threaded_encoder.py
index 6779b04..568aaa4 100644
--- a/gr-fec/python/fec/threaded_encoder.py
+++ b/gr-fec/python/fec/threaded_encoder.py
@@ -33,7 +33,7 @@ class threaded_encoder(gr.hier_block2):
         self.encoder_list_0 = encoder_list_0
 
         self.fec_deinterleave_0 = blocks.deinterleave(input_size,
-                                                   
fec.get_encoder_input_size(encoder_list_0[0]))
+                                                      
fec.get_encoder_input_size(encoder_list_0[0]))
 
         self.generic_encoders_0 = [];
         for i in range(len(encoder_list_0)):



reply via email to

[Prev in Thread] Current Thread [Next in Thread]