commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 02/03: dtv: cleanup for merge


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/03: dtv: cleanup for merge
Date: Wed, 21 Jan 2015 21:18:27 +0000 (UTC)

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

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 83d3dca959d79f6acb5371f9a4efc8dbb8be7147
Author: Johnathan Corgan <address@hidden>
Date:   Wed Jan 21 13:00:58 2015 -0800

    dtv: cleanup for merge
---
 gr-dtv/include/gnuradio/dtv/CMakeLists.txt         |   2 +-
 gr-dtv/include/gnuradio/dtv/atsc_field_sync_mux.h  |  15 +-
 gr-dtv/include/gnuradio/dtv/atsc_interleaver.h     |  15 +-
 gr-dtv/include/gnuradio/dtv/atsc_pad.h             |  15 +-
 gr-dtv/include/gnuradio/dtv/atsc_randomizer.h      |  14 +-
 gr-dtv/include/gnuradio/dtv/atsc_rs_encoder.h      |  14 +-
 gr-dtv/include/gnuradio/dtv/atsc_trellis_encoder.h |  15 +-
 gr-dtv/lib/atsc/atsc_basic_trellis_encoder.cc      |  17 +-
 gr-dtv/lib/atsc/atsc_basic_trellis_encoder.h       |  12 +-
 gr-dtv/lib/atsc/atsc_field_sync_mux_impl.cc        | 263 ++++++++----------
 gr-dtv/lib/atsc/atsc_field_sync_mux_impl.h         |  13 +-
 gr-dtv/lib/atsc/atsc_interleaver_impl.cc           | 126 ++++-----
 gr-dtv/lib/atsc/atsc_interleaver_impl.h            |  13 +-
 gr-dtv/lib/atsc/atsc_pad_impl.cc                   |  38 +--
 gr-dtv/lib/atsc/atsc_pad_impl.h                    |  11 +-
 gr-dtv/lib/atsc/atsc_randomizer_impl.cc            |  77 +++---
 gr-dtv/lib/atsc/atsc_randomizer_impl.h             |  13 +-
 gr-dtv/lib/atsc/atsc_rs_encoder_impl.cc            |  74 +++--
 gr-dtv/lib/atsc/atsc_rs_encoder_impl.h             |  13 +-
 gr-dtv/lib/atsc/atsc_trellis_encoder_impl.cc       | 307 ++++++++++-----------
 gr-dtv/lib/atsc/atsc_trellis_encoder_impl.h        |  13 +-
 gr-dtv/swig/dtv_swig.i                             |  30 +-
 22 files changed, 491 insertions(+), 619 deletions(-)

diff --git a/gr-dtv/include/gnuradio/dtv/CMakeLists.txt 
b/gr-dtv/include/gnuradio/dtv/CMakeLists.txt
index 8aff3eb..b7626e9 100644
--- a/gr-dtv/include/gnuradio/dtv/CMakeLists.txt
+++ b/gr-dtv/include/gnuradio/dtv/CMakeLists.txt
@@ -32,7 +32,7 @@ install(FILES
     atsc_rs_decoder.h
     atsc_sync.h
     atsc_viterbi_decoder.h
-    atsc_depad.h
+    atsc_pad.h
     atsc_randomizer.h
     atsc_rs_encoder.h
     atsc_interleaver.h
diff --git a/gr-dtv/include/gnuradio/dtv/atsc_field_sync_mux.h 
b/gr-dtv/include/gnuradio/dtv/atsc_field_sync_mux.h
index 9eeef02..3b34e5a 100644
--- a/gr-dtv/include/gnuradio/dtv/atsc_field_sync_mux.h
+++ b/gr-dtv/include/gnuradio/dtv/atsc_field_sync_mux.h
@@ -1,24 +1,23 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
  * Boston, MA 02110-1301, USA.
  */
 
-
 #ifndef INCLUDED_DTV_ATSC_FIELD_SYNC_MUX_H
 #define INCLUDED_DTV_ATSC_FIELD_SYNC_MUX_H
 
@@ -40,11 +39,6 @@ namespace gr {
 
       /*!
        * \brief Return a shared_ptr to a new instance of 
dtv::atsc_field_sync_mux.
-       *
-       * To avoid accidental use of raw pointers, dtv::atsc_field_sync_mux's
-       * constructor is in a private implementation
-       * class. dtv::atsc_field_sync_mux::make is the public interface for
-       * creating new instances.
        */
       static sptr make();
     };
@@ -53,4 +47,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_FIELD_SYNC_MUX_H */
-
diff --git a/gr-dtv/include/gnuradio/dtv/atsc_interleaver.h 
b/gr-dtv/include/gnuradio/dtv/atsc_interleaver.h
index 86d5493..5882fd2 100644
--- a/gr-dtv/include/gnuradio/dtv/atsc_interleaver.h
+++ b/gr-dtv/include/gnuradio/dtv/atsc_interleaver.h
@@ -1,24 +1,23 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
  * Boston, MA 02110-1301, USA.
  */
 
-
 #ifndef INCLUDED_DTV_ATSC_INTERLEAVER_H
 #define INCLUDED_DTV_ATSC_INTERLEAVER_H
 
@@ -40,11 +39,6 @@ namespace gr {
 
       /*!
        * \brief Return a shared_ptr to a new instance of dtv::atsc_interleaver.
-       *
-       * To avoid accidental use of raw pointers, dtv::atsc_interleaver's
-       * constructor is in a private implementation
-       * class. dtv::atsc_interleaver::make is the public interface for
-       * creating new instances.
        */
       static sptr make();
     };
@@ -53,4 +47,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_INTERLEAVER_H */
-
diff --git a/gr-dtv/include/gnuradio/dtv/atsc_pad.h 
b/gr-dtv/include/gnuradio/dtv/atsc_pad.h
index efd1680..b14f2e7 100644
--- a/gr-dtv/include/gnuradio/dtv/atsc_pad.h
+++ b/gr-dtv/include/gnuradio/dtv/atsc_pad.h
@@ -1,24 +1,23 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
  * Boston, MA 02110-1301, USA.
  */
 
-
 #ifndef INCLUDED_DTV_ATSC_PAD_H
 #define INCLUDED_DTV_ATSC_PAD_H
 
@@ -40,11 +39,6 @@ namespace gr {
 
       /*!
        * \brief Return a shared_ptr to a new instance of dtv::atsc_pad.
-       *
-       * To avoid accidental use of raw pointers, dtv::atsc_pad's
-       * constructor is in a private implementation
-       * class. dtv::atsc_pad::make is the public interface for
-       * creating new instances.
        */
       static sptr make();
     };
@@ -53,4 +47,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_PAD_H */
-
diff --git a/gr-dtv/include/gnuradio/dtv/atsc_randomizer.h 
b/gr-dtv/include/gnuradio/dtv/atsc_randomizer.h
index f9823a7..e938f61 100644
--- a/gr-dtv/include/gnuradio/dtv/atsc_randomizer.h
+++ b/gr-dtv/include/gnuradio/dtv/atsc_randomizer.h
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -40,11 +40,6 @@ namespace gr {
 
       /*!
        * \brief Return a shared_ptr to a new instance of dtv::atsc_randomizer.
-       *
-       * To avoid accidental use of raw pointers, dtv::atsc_randomizer's
-       * constructor is in a private implementation
-       * class. dtv::atsc_randomizer::make is the public interface for
-       * creating new instances.
        */
       static sptr make();
     };
@@ -53,4 +48,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_RANDOMIZER_H */
-
diff --git a/gr-dtv/include/gnuradio/dtv/atsc_rs_encoder.h 
b/gr-dtv/include/gnuradio/dtv/atsc_rs_encoder.h
index bca73fd..53889c7 100644
--- a/gr-dtv/include/gnuradio/dtv/atsc_rs_encoder.h
+++ b/gr-dtv/include/gnuradio/dtv/atsc_rs_encoder.h
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -40,11 +40,6 @@ namespace gr {
 
       /*!
        * \brief Return a shared_ptr to a new instance of dtv::atsc_rs_encoder.
-       *
-       * To avoid accidental use of raw pointers, dtv::atsc_rs_encoder's
-       * constructor is in a private implementation
-       * class. dtv::atsc_rs_encoder::make is the public interface for
-       * creating new instances.
        */
       static sptr make();
     };
@@ -53,4 +48,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_RS_ENCODER_H */
-
diff --git a/gr-dtv/include/gnuradio/dtv/atsc_trellis_encoder.h 
b/gr-dtv/include/gnuradio/dtv/atsc_trellis_encoder.h
index 1c1e0a4..925e9c2 100644
--- a/gr-dtv/include/gnuradio/dtv/atsc_trellis_encoder.h
+++ b/gr-dtv/include/gnuradio/dtv/atsc_trellis_encoder.h
@@ -1,24 +1,23 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
  * Boston, MA 02110-1301, USA.
  */
 
-
 #ifndef INCLUDED_DTV_ATSC_TRELLIS_ENCODER_H
 #define INCLUDED_DTV_ATSC_TRELLIS_ENCODER_H
 
@@ -40,11 +39,6 @@ namespace gr {
 
       /*!
        * \brief Return a shared_ptr to a new instance of 
dtv::atsc_trellis_encoder.
-       *
-       * To avoid accidental use of raw pointers, dtv::atsc_trellis_encoder's
-       * constructor is in a private implementation
-       * class. dtv::atsc_trellis_encoder::make is the public interface for
-       * creating new instances.
        */
       static sptr make();
     };
@@ -53,4 +47,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_TRELLIS_ENCODER_H */
-
diff --git a/gr-dtv/lib/atsc/atsc_basic_trellis_encoder.cc 
b/gr-dtv/lib/atsc/atsc_basic_trellis_encoder.cc
index f7327c7..b0aeee5 100644
--- a/gr-dtv/lib/atsc/atsc_basic_trellis_encoder.cc
+++ b/gr-dtv/lib/atsc/atsc_basic_trellis_encoder.cc
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -54,12 +54,11 @@ namespace gr {
     int
     atsc_basic_trellis_encoder::encode(unsigned int input)
     {
-        assert (input < 4);
-        int index = (state << 2) + input;
-        state = next_state[index];
-        return out_symbol[index];
+      assert (input < 4);
+      int index = (state << 2) + input;
+      state = next_state[index];
+      return out_symbol[index];
     }
 
   } /* namespace dtv */
 } /* namespace gr */
-
diff --git a/gr-dtv/lib/atsc/atsc_basic_trellis_encoder.h 
b/gr-dtv/lib/atsc/atsc_basic_trellis_encoder.h
index a4e64fb..3bac601 100644
--- a/gr-dtv/lib/atsc/atsc_basic_trellis_encoder.h
+++ b/gr-dtv/lib/atsc/atsc_basic_trellis_encoder.h
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -38,10 +38,10 @@ namespace gr {
 
     class atsc_basic_trellis_encoder
     {
-     private:
+    private:
       int state;    // two bit state;
 
-     public:
+    public:
       atsc_basic_trellis_encoder() : state(0) {}
 
       /*!
diff --git a/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.cc 
b/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.cc
index 01400e6..e9b875c 100644
--- a/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.cc
+++ b/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.cc
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -38,206 +38,183 @@ namespace gr {
         (new atsc_field_sync_mux_impl());
     }
 
-    /*
-     * The private constructor
-     */
     atsc_field_sync_mux_impl::atsc_field_sync_mux_impl()
       : gr::block("atsc_field_sync_mux",
-              gr::io_signature::make(1, 1, sizeof(atsc_data_segment)),
-              gr::io_signature::make(1, 1, sizeof(atsc_data_segment)))
+                  gr::io_signature::make(1, 1, sizeof(atsc_data_segment)),
+                  gr::io_signature::make(1, 1, sizeof(atsc_data_segment)))
     {
-        d_already_output_field_sync = false;
-        for (int i = 0; i < N_SAVED_SYMBOLS; i++)
-        {
-            d_saved_symbols[i] = 0;
+      d_already_output_field_sync = false;
+      for (int i = 0; i < N_SAVED_SYMBOLS; i++) {
+          d_saved_symbols[i] = 0;
         }
     }
 
-    /*
-     * Our virtual destructor.
-     */
     atsc_field_sync_mux_impl::~atsc_field_sync_mux_impl()
     {
     }
 
     void
     atsc_field_sync_mux_impl::init_field_sync_common(unsigned char *p, int 
mask,
-                             const unsigned char 
saved_symbols[N_SAVED_SYMBOLS])
+                                                     const unsigned char 
saved_symbols[N_SAVED_SYMBOLS])
     {
-        static const unsigned char bin_map[2] = {1, 6};    // map binary 
values to 1 of 8 levels
+      static const unsigned char bin_map[2] = {1, 6};    // map binary values 
to 1 of 8 levels
 
-        int i = 0;
+      int i = 0;
 
-        p[i++] = bin_map[1];    // data segment sync pulse
-        p[i++] = bin_map[0];
-        p[i++] = bin_map[0];
-        p[i++] = bin_map[1];
+      p[i++] = bin_map[1];    // data segment sync pulse
+      p[i++] = bin_map[0];
+      p[i++] = bin_map[0];
+      p[i++] = bin_map[1];
 
-        for (int j = 0; j < 511; j++)    // PN511
-        {
-            p[i++] = bin_map[atsc_pn511[j]];
-        }
+      for (int j = 0; j < 511; j++) {    // PN511
+        p[i++] = bin_map[atsc_pn511[j]];
+      }
 
-        for (int j = 0; j < 63; j++)     // PN63
-        {
-            p[i++] = bin_map[atsc_pn63[j]];
-        }
+      for (int j = 0; j < 63; j++) {     // PN63
+        p[i++] = bin_map[atsc_pn63[j]];
+      }
 
-        for (int j = 0; j < 63; j++)     // PN63, toggled on field 2
-        {
-            p[i++] = bin_map[atsc_pn63[j] ^ mask];
-        }
+      for (int j = 0; j < 63; j++) {     // PN63, toggled on field 2
+        p[i++] = bin_map[atsc_pn63[j] ^ mask];
+      }
 
-        for (int j = 0; j < 63; j++)     // PN63
-        {
-            p[i++] = bin_map[atsc_pn63[j]];
-        }
+      for (int j = 0; j < 63; j++) {     // PN63
+        p[i++] = bin_map[atsc_pn63[j]];
+      }
 
-        p[i++] = bin_map[0];    // 24 bits of 8VSB mode identifier
-        p[i++] = bin_map[0];
-        p[i++] = bin_map[0];
-        p[i++] = bin_map[0];
-
-        p[i++] = bin_map[1];
-        p[i++] = bin_map[0];
-        p[i++] = bin_map[1];
-        p[i++] = bin_map[0];
-
-        p[i++] = bin_map[0];
-        p[i++] = bin_map[1];
-        p[i++] = bin_map[0];
-        p[i++] = bin_map[1];
-
-        p[i++] = bin_map[1];
-        p[i++] = bin_map[1];
-        p[i++] = bin_map[1];
-        p[i++] = bin_map[1];
-
-        p[i++] = bin_map[0];
-        p[i++] = bin_map[1];
-        p[i++] = bin_map[0];
-        p[i++] = bin_map[1];
-
-        p[i++] = bin_map[1];
-        p[i++] = bin_map[0];
-        p[i++] = bin_map[1];
-        p[i++] = bin_map[0];
-
-        for (int j = 0; j < 92; j++)    // 92 more bits
-        {
-            p[i++] = bin_map[atsc_pn63[j % 63]];
-        }
+      p[i++] = bin_map[0];    // 24 bits of 8VSB mode identifier
+      p[i++] = bin_map[0];
+      p[i++] = bin_map[0];
+      p[i++] = bin_map[0];
 
-        // now copy the last 12 symbols of the previous segment
+      p[i++] = bin_map[1];
+      p[i++] = bin_map[0];
+      p[i++] = bin_map[1];
+      p[i++] = bin_map[0];
 
-        for (int j = 0; j < N_SAVED_SYMBOLS; j++)
-        {
-            p[i++] = saved_symbols[j];
-        }
+      p[i++] = bin_map[0];
+      p[i++] = bin_map[1];
+      p[i++] = bin_map[0];
+      p[i++] = bin_map[1];
+
+      p[i++] = bin_map[1];
+      p[i++] = bin_map[1];
+      p[i++] = bin_map[1];
+      p[i++] = bin_map[1];
+
+      p[i++] = bin_map[0];
+      p[i++] = bin_map[1];
+      p[i++] = bin_map[0];
+      p[i++] = bin_map[1];
 
-        assert (i == ATSC_DATA_SEGMENT_LENGTH);
+      p[i++] = bin_map[1];
+      p[i++] = bin_map[0];
+      p[i++] = bin_map[1];
+      p[i++] = bin_map[0];
+
+      for (int j = 0; j < 92; j++) {    // 92 more bits
+        p[i++] = bin_map[atsc_pn63[j % 63]];
+      }
+
+      // now copy the last 12 symbols of the previous segment
+
+      for (int j = 0; j < N_SAVED_SYMBOLS; j++) {
+        p[i++] = saved_symbols[j];
+      }
+
+      assert(i == ATSC_DATA_SEGMENT_LENGTH);
     }
 
     inline void
     atsc_field_sync_mux_impl::init_field_sync_1(atsc_data_segment *s,
-                  const unsigned char saved_symbols[N_SAVED_SYMBOLS])
+                                                const unsigned char 
saved_symbols[N_SAVED_SYMBOLS])
     {
-        init_field_sync_common(&s->data[0], 0, saved_symbols);
+      init_field_sync_common(&s->data[0], 0, saved_symbols);
     }
 
     inline void
     atsc_field_sync_mux_impl::init_field_sync_2(atsc_data_segment *s,
-                  const unsigned char saved_symbols[N_SAVED_SYMBOLS])
+                                                const unsigned char 
saved_symbols[N_SAVED_SYMBOLS])
     {
-        init_field_sync_common(&s->data[0], 1, saved_symbols);
+      init_field_sync_common(&s->data[0], 1, saved_symbols);
     }
 
     void
     atsc_field_sync_mux_impl::save_last_symbols(unsigned char 
saved_symbols[N_SAVED_SYMBOLS],
                                                 const atsc_data_segment &seg)
     {
-        for (int i = 0; i < N_SAVED_SYMBOLS; i++)
-        {
-            saved_symbols[i] = seg.data[i + ATSC_DATA_SEGMENT_LENGTH - 
N_SAVED_SYMBOLS];
+        for (int i = 0; i < N_SAVED_SYMBOLS; i++) {
+          saved_symbols[i] = seg.data[i + ATSC_DATA_SEGMENT_LENGTH - 
N_SAVED_SYMBOLS];
         }
     }
 
     inline bool
     atsc_field_sync_mux_impl::last_regular_seg_p(const plinfo &pli)
     {
-        return pli.regular_seg_p() && (pli.segno() == ATSC_DSEGS_PER_FIELD - 
1);
+      return pli.regular_seg_p() && (pli.segno() == ATSC_DSEGS_PER_FIELD - 1);
     }
 
     void
     atsc_field_sync_mux_impl::forecast (int noutput_items, gr_vector_int 
&ninput_items_required)
     {
-        ninput_items_required[0] = noutput_items;
+      ninput_items_required[0] = noutput_items;
     }
 
     int
     atsc_field_sync_mux_impl::general_work (int noutput_items,
-                       gr_vector_int &ninput_items,
-                       gr_vector_const_void_star &input_items,
-                       gr_vector_void_star &output_items)
+                                            gr_vector_int &ninput_items,
+                                            gr_vector_const_void_star 
&input_items,
+                                            gr_vector_void_star &output_items)
     {
-        const atsc_data_segment *in = (const atsc_data_segment *) 
input_items[0];
-        atsc_data_segment *out = (atsc_data_segment *) output_items[0];
-        int in_length = ninput_items[0];
-        int index = 0;
-        int outdex = 0;
-
-        for (outdex = 0; outdex < noutput_items && index < in_length; outdex++)
-        {
-            assert(in[index].pli.regular_seg_p());
-
-            if (!in[index].pli.first_regular_seg_p())
-            {
-                out[outdex] = in[index];    // just copy in to out
-
-                if (last_regular_seg_p(in[index].pli))
-                {
-                    save_last_symbols(d_saved_symbols, in[index]);
-                }
-                index++;
+      const atsc_data_segment *in = (const atsc_data_segment *) input_items[0];
+      atsc_data_segment *out = (atsc_data_segment *) output_items[0];
+      int in_length = ninput_items[0];
+      int index = 0;
+      int outdex = 0;
+
+      for (outdex = 0; outdex < noutput_items && index < in_length; outdex++) {
+        assert(in[index].pli.regular_seg_p());
+
+        if (!in[index].pli.first_regular_seg_p()) {
+          out[outdex] = in[index];    // just copy in to out
+
+          if (last_regular_seg_p(in[index].pli)) {
+            save_last_symbols(d_saved_symbols, in[index]);
+          }
+          index++;
+        }
+        else {   // first_regular_seg_p
+          if (!d_already_output_field_sync) {
+            // write out field sync...
+            atsc_data_segment field_sync;
+
+            if (in[index].pli.in_field1_p()) {
+              init_field_sync_1(&field_sync, d_saved_symbols);
             }
-            else
-            {   // first_regular_seg_p
-                if (!d_already_output_field_sync)
-                {
-                    // write out field sync...
-                    atsc_data_segment field_sync;
-
-                    if (in[index].pli.in_field1_p())
-                    {
-                        init_field_sync_1(&field_sync, d_saved_symbols);
-                    }
-                    else
-                    {
-                        init_field_sync_2(&field_sync, d_saved_symbols);
-                    }
-
-                    // note that index doesn't advance in this branch
-                    out[outdex] = field_sync;
-                    d_already_output_field_sync = true;
-                }
-                else
-                {
-                    // already output field sync, now output first regular 
segment
-                    out[outdex] = in[index];
-                    index++;
-                    d_already_output_field_sync = false;
-                }
+            else {
+              init_field_sync_2(&field_sync, d_saved_symbols);
             }
+
+            // note that index doesn't advance in this branch
+            out[outdex] = field_sync;
+            d_already_output_field_sync = true;
+          }
+          else {
+            // already output field sync, now output first regular segment
+            out[outdex] = in[index];
+            index++;
+            d_already_output_field_sync = false;
+          }
         }
+      }
 
-        // Tell runtime system how many input items we consumed on
-        // each input stream.
-        consume_each (index);
+      // Tell runtime system how many input items we consumed on
+      // each input stream.
+      consume_each (index);
 
-        // Tell runtime system how many output items we produced.
-        return outdex;
+      // Tell runtime system how many output items we produced.
+      return outdex;
     }
 
   } /* namespace dtv */
 } /* namespace gr */
-
diff --git a/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.h 
b/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.h
index ba73faa..ce4ab30 100644
--- a/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.h
+++ b/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.h
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -30,7 +30,7 @@ namespace gr {
 
     class atsc_field_sync_mux_impl : public atsc_field_sync_mux
     {
-     private:
+    private:
       static const int N_SAVED_SYMBOLS = 12;
       bool d_already_output_field_sync;
       unsigned char d_saved_symbols[N_SAVED_SYMBOLS];
@@ -41,7 +41,7 @@ namespace gr {
       void save_last_symbols(unsigned char saved_symbols[N_SAVED_SYMBOLS], 
const atsc_data_segment &seg);
       inline bool last_regular_seg_p(const plinfo &pli);
 
-     public:
+    public:
       atsc_field_sync_mux_impl();
       ~atsc_field_sync_mux_impl();
 
@@ -57,4 +57,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_FIELD_SYNC_MUX_IMPL_H */
-
diff --git a/gr-dtv/lib/atsc/atsc_interleaver_impl.cc 
b/gr-dtv/lib/atsc/atsc_interleaver_impl.cc
index 6d147f5..2826a5b 100644
--- a/gr-dtv/lib/atsc/atsc_interleaver_impl.cc
+++ b/gr-dtv/lib/atsc/atsc_interleaver_impl.cc
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -22,7 +22,6 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/io_signature.h>
 #include "atsc_interleaver_impl.h"
 #include "gnuradio/dtv/atsc_consts.h"
 
@@ -36,43 +35,37 @@ namespace gr {
         (new atsc_interleaver_impl());
     }
 
-    /*
-     * The private constructor
-     */
     atsc_interleaver_impl::atsc_interleaver_impl()
       : gr::sync_block("atsc_interleaver",
-              gr::io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)),
-              gr::io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)))
+                       gr::io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)),
+                       gr::io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)))
     {
-        I = 52;    /* ATSC interleaver */
-        J = 4;
-        registers = (unsigned char *) malloc(sizeof(unsigned char) * I * ((I - 
1) * J));
-        if (registers == NULL) {
-            fprintf(stderr, "Out of memory.\n");
-            exit(1);
-        }
-
-        pointers = (int *) malloc(sizeof(int) * I);
-        if (pointers == NULL) {
-            fprintf(stderr, "Out of memory.\n");
-            exit(1);
-        }
-
-        memset(registers, 0, sizeof(unsigned char) * I * ((I - 1) * J));
-        memset(pointers, 0, sizeof(int) * I);
-
-        this->I = I;
-        this->J = J;
-        commutator = 0;
+      I = 52;    /* ATSC interleaver */
+      J = 4;
+      registers = (unsigned char *) malloc(sizeof(unsigned char) * I * ((I - 
1) * J));
+      if (registers == NULL) {
+        fprintf(stderr, "Out of memory.\n");
+        exit(1);
+      }
+
+      pointers = (int *) malloc(sizeof(int) * I);
+      if (pointers == NULL) {
+        fprintf(stderr, "Out of memory.\n");
+        exit(1);
+      }
+
+      memset(registers, 0, sizeof(unsigned char) * I * ((I - 1) * J));
+      memset(pointers, 0, sizeof(int) * I);
+
+      this->I = I;
+      this->J = J;
+      commutator = 0;
     }
 
-    /*
-     * Our virtual destructor.
-     */
     atsc_interleaver_impl::~atsc_interleaver_impl()
     {
-        free(pointers);
-        free(registers);
+      free(pointers);
+      free(registers);
     }
 
     int
@@ -80,43 +73,38 @@ namespace gr {
                                 gr_vector_const_void_star &input_items,
                                 gr_vector_void_star &output_items)
     {
-        const atsc_mpeg_packet_rs_encoded *in = (const 
atsc_mpeg_packet_rs_encoded *) input_items[0];
-        atsc_mpeg_packet_rs_encoded *out = (atsc_mpeg_packet_rs_encoded *) 
output_items[0];
-        int p, n = ATSC_MPEG_RS_ENCODED_LENGTH;
-
-        for (int i = 0; i < noutput_items; i++)
-        {
-            assert(in[i].pli.regular_seg_p());
-            plinfo::sanity_check(in[i].pli);
-
-            out[i].pli = in[i].pli;                 // copy pipeline info
-            if (in[i].pli.first_regular_seg_p())    // reset commutator if 
required
-            {
-                commutator = 0;
-            }
-            for (int j = 0; j < n; j++)
-            {
-                if (commutator == 0)
-                {
-                    out[i].data[j] = in[i].data[j];
-                }
-                else
-                {
-                    p = pointers[commutator];
-
-                    out[i].data[j] = registers[commutator * (I - 1) * J + p];
-                    registers[commutator * (I - 1) * J + p] = in[i].data[j];
-
-                    pointers[commutator] = (p + 1) % (commutator * J);
-                }
-                commutator = (commutator + 1) % I;
-            }
+      const atsc_mpeg_packet_rs_encoded *in = (const 
atsc_mpeg_packet_rs_encoded *) input_items[0];
+      atsc_mpeg_packet_rs_encoded *out = (atsc_mpeg_packet_rs_encoded *) 
output_items[0];
+      int p, n = ATSC_MPEG_RS_ENCODED_LENGTH;
+
+      for (int i = 0; i < noutput_items; i++) {
+        assert(in[i].pli.regular_seg_p());
+        plinfo::sanity_check(in[i].pli);
+
+        out[i].pli = in[i].pli;                 // copy pipeline info
+        if (in[i].pli.first_regular_seg_p()) {  // reset commutator if required
+          commutator = 0;
+        }
+        for (int j = 0; j < n; j++) {
+          if (commutator == 0) {
+            out[i].data[j] = in[i].data[j];
+          }
+          else {
+            p = pointers[commutator];
+
+            out[i].data[j] = registers[commutator * (I - 1) * J + p];
+            registers[commutator * (I - 1) * J + p] = in[i].data[j];
+
+            pointers[commutator] = (p + 1) % (commutator * J);
+          }
+
+          commutator = (commutator + 1) % I;
         }
+      }
 
-        // Tell runtime system how many output items we produced.
-        return noutput_items;
+      // Tell runtime system how many output items we produced.
+      return noutput_items;
     }
 
   } /* namespace dtv */
 } /* namespace gr */
-
diff --git a/gr-dtv/lib/atsc/atsc_interleaver_impl.h 
b/gr-dtv/lib/atsc/atsc_interleaver_impl.h
index 337edcf..ffcd02b 100644
--- a/gr-dtv/lib/atsc/atsc_interleaver_impl.h
+++ b/gr-dtv/lib/atsc/atsc_interleaver_impl.h
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -29,13 +29,13 @@ namespace gr {
 
     class atsc_interleaver_impl : public atsc_interleaver
     {
-     private:
+    private:
       int I, J;
       int commutator;
       unsigned char *registers;
       int *pointers;
 
-     public:
+    public:
       atsc_interleaver_impl();
       ~atsc_interleaver_impl();
 
@@ -48,4 +48,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_INTERLEAVER_IMPL_H */
-
diff --git a/gr-dtv/lib/atsc/atsc_pad_impl.cc b/gr-dtv/lib/atsc/atsc_pad_impl.cc
index 1b5e733..2dee03f 100644
--- a/gr-dtv/lib/atsc/atsc_pad_impl.cc
+++ b/gr-dtv/lib/atsc/atsc_pad_impl.cc
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -22,7 +22,6 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/io_signature.h>
 #include "atsc_pad_impl.h"
 #include "gnuradio/dtv/atsc_consts.h"
 
@@ -36,18 +35,13 @@ namespace gr {
         (new atsc_pad_impl());
     }
 
-    /*
-     * The private constructor
-     */
     atsc_pad_impl::atsc_pad_impl()
       : gr::sync_decimator("atsc_pad",
-              gr::io_signature::make(1, 1, sizeof(unsigned char)),
-              gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet)), 
ATSC_MPEG_PKT_LENGTH)
-    {}
+                           gr::io_signature::make(1, 1, sizeof(unsigned char)),
+                           gr::io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet)), ATSC_MPEG_PKT_LENGTH)
+    {
+    }
 
-    /*
-     * Our virtual destructor.
-     */
     atsc_pad_impl::~atsc_pad_impl()
     {
     }
@@ -57,18 +51,16 @@ namespace gr {
                         gr_vector_const_void_star &input_items,
                         gr_vector_void_star &output_items)
     {
-        const unsigned char *in = (const unsigned char *) input_items[0];
-        atsc_mpeg_packet *out = (atsc_mpeg_packet *) output_items[0];
+      const unsigned char *in = (const unsigned char *) input_items[0];
+      atsc_mpeg_packet *out = (atsc_mpeg_packet *) output_items[0];
 
-        for (int i = 0; i < noutput_items; i++)
-        {
-            memcpy(out[i].data, &in[i * ATSC_MPEG_PKT_LENGTH], 
ATSC_MPEG_PKT_LENGTH);
-        }
+      for (int i = 0; i < noutput_items; i++) {
+        memcpy(out[i].data, &in[i * ATSC_MPEG_PKT_LENGTH], 
ATSC_MPEG_PKT_LENGTH);
+      }
 
-        // Tell runtime system how many output items we produced.
-        return noutput_items;
+      // Tell runtime system how many output items we produced.
+      return noutput_items;
     }
 
   } /* namespace dtv */
 } /* namespace gr */
-
diff --git a/gr-dtv/lib/atsc/atsc_pad_impl.h b/gr-dtv/lib/atsc/atsc_pad_impl.h
index 4a661bd..292931d 100644
--- a/gr-dtv/lib/atsc/atsc_pad_impl.h
+++ b/gr-dtv/lib/atsc/atsc_pad_impl.h
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -29,7 +29,7 @@ namespace gr {
 
     class atsc_pad_impl : public atsc_pad
     {
-     public:
+    public:
       atsc_pad_impl();
       ~atsc_pad_impl();
 
@@ -42,4 +42,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_PAD_IMPL_H */
-
diff --git a/gr-dtv/lib/atsc/atsc_randomizer_impl.cc 
b/gr-dtv/lib/atsc/atsc_randomizer_impl.cc
index 55d4785..f6b6a6a 100644
--- a/gr-dtv/lib/atsc/atsc_randomizer_impl.cc
+++ b/gr-dtv/lib/atsc/atsc_randomizer_impl.cc
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -36,20 +36,14 @@ namespace gr {
         (new atsc_randomizer_impl());
     }
 
-    /*
-     * The private constructor
-     */
     atsc_randomizer_impl::atsc_randomizer_impl()
       : gr::sync_block("atsc_randomizer",
-              gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet)),
-              gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_no_sync)))
+                       gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet)),
+                       gr::io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_no_sync)))
     {
-        reset();
+      reset();
     }
 
-    /*
-     * Our virtual destructor.
-     */
     atsc_randomizer_impl::~atsc_randomizer_impl()
     {
     }
@@ -57,9 +51,9 @@ namespace gr {
     void
     atsc_randomizer_impl::reset()
     {
-        d_rand.reset();
-        d_field2 = false;
-        d_segno = 0;
+      d_rand.reset();
+      d_field2 = false;
+      d_segno = 0;
     }
 
     int
@@ -67,40 +61,37 @@ namespace gr {
                                gr_vector_const_void_star &input_items,
                                gr_vector_void_star &output_items)
     {
-        const atsc_mpeg_packet *in = (const atsc_mpeg_packet *) input_items[0];
-        atsc_mpeg_packet_no_sync *out = (atsc_mpeg_packet_no_sync *) 
output_items[0];
+      const atsc_mpeg_packet *in = (const atsc_mpeg_packet *) input_items[0];
+      atsc_mpeg_packet_no_sync *out = (atsc_mpeg_packet_no_sync *) 
output_items[0];
 
-        for (int i = 0; i < noutput_items; i++)
-        {
-            // sanity check incoming data.
-            assert((in[i].data[0] == MPEG_SYNC_BYTE));
-            assert((in[i].data[1] & MPEG_TRANSPORT_ERROR_BIT) == 0);
+      for (int i = 0; i < noutput_items; i++) {
+        // sanity check incoming data.
+        assert((in[i].data[0] == MPEG_SYNC_BYTE));
+        assert((in[i].data[1] & MPEG_TRANSPORT_ERROR_BIT) == 0);
 
-            // initialize plinfo for downstream
-            //
-            // We do this here because the randomizer is effectively
-            // the head of the tx processing chain
-            //
-            out[i].pli.set_regular_seg(d_field2, d_segno);
-            d_segno++;
-            if (d_segno == 312)
-            {
-                d_segno = 0;
-                d_field2 = !d_field2;
-            }
+        // initialize plinfo for downstream
+        //
+        // We do this here because the randomizer is effectively
+        // the head of the tx processing chain
+        //
+        out[i].pli.set_regular_seg(d_field2, d_segno);
+        d_segno++;
 
-            if (out[i].pli.first_regular_seg_p())
-            {
-                d_rand.reset();
-            }
+        if (d_segno == 312) {
+          d_segno = 0;
+          d_field2 = !d_field2;
+        }
 
-            d_rand.randomize(out[i], in[i]);
+        if (out[i].pli.first_regular_seg_p()) {
+          d_rand.reset();
         }
 
-        // Tell runtime system how many output items we produced.
-        return noutput_items;
+        d_rand.randomize(out[i], in[i]);
+      }
+
+      // Tell runtime system how many output items we produced.
+      return noutput_items;
     }
 
   } /* namespace dtv */
 } /* namespace gr */
-
diff --git a/gr-dtv/lib/atsc/atsc_randomizer_impl.h 
b/gr-dtv/lib/atsc/atsc_randomizer_impl.h
index 48ee213..d13b09f 100644
--- a/gr-dtv/lib/atsc/atsc_randomizer_impl.h
+++ b/gr-dtv/lib/atsc/atsc_randomizer_impl.h
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -30,14 +30,14 @@ namespace gr {
 
     class atsc_randomizer_impl : public atsc_randomizer
     {
-     private:
+    private:
       atsc_randomize d_rand;
       int d_segno;
       bool d_field2;
 
       void reset(void);
 
-     public:
+    public:
       atsc_randomizer_impl();
       ~atsc_randomizer_impl();
 
@@ -50,4 +50,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_RANDOMIZER_IMPL_H */
-
diff --git a/gr-dtv/lib/atsc/atsc_rs_encoder_impl.cc 
b/gr-dtv/lib/atsc/atsc_rs_encoder_impl.cc
index 002dc17..9249301 100644
--- a/gr-dtv/lib/atsc/atsc_rs_encoder_impl.cc
+++ b/gr-dtv/lib/atsc/atsc_rs_encoder_impl.cc
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -46,46 +46,40 @@ namespace gr {
         (new atsc_rs_encoder_impl());
     }
 
-    /*
-     * The private constructor
-     */
     atsc_rs_encoder_impl::atsc_rs_encoder_impl()
       : gr::sync_block("atsc_rs_encoder",
-              gr::io_signature::make(1, 1, sizeof(atsc_mpeg_packet_no_sync)),
-              gr::io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)))
+                       gr::io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_no_sync)),
+                       gr::io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)))
     {
-        d_rs = init_rs_char(rs_init_symsize, rs_init_gfpoly, rs_init_fcr, 
rs_init_prim, rs_init_nroots);
-        assert (d_rs != 0);
+      d_rs = init_rs_char(rs_init_symsize, rs_init_gfpoly, rs_init_fcr, 
rs_init_prim, rs_init_nroots);
+      assert (d_rs != 0);
     }
 
-    /*
-     * Our virtual destructor.
-     */
     atsc_rs_encoder_impl::~atsc_rs_encoder_impl()
     {
-        if (d_rs)
-        {
-            free_rs_char(d_rs);
-        }
-        d_rs = 0;
+      if (d_rs) {
+        free_rs_char(d_rs);
+      }
+
+      d_rs = 0;
     }
 
     void
     atsc_rs_encoder_impl::encode(atsc_mpeg_packet_rs_encoded &out, const 
atsc_mpeg_packet_no_sync &in)
     {
-        unsigned char tmp[K];
+      unsigned char tmp[K];
 
-        assert((int)(amount_of_pad + sizeof (in.data)) == K);
+      assert((int)(amount_of_pad + sizeof (in.data)) == K);
 
-        // add missing prefix zero padding to message
-        memset(tmp, 0, amount_of_pad);
-        memcpy(&tmp[amount_of_pad], in.data, sizeof (in.data));
+      // add missing prefix zero padding to message
+      memset(tmp, 0, amount_of_pad);
+      memcpy(&tmp[amount_of_pad], in.data, sizeof (in.data));
 
-        // copy message portion to output packet
-        memcpy(out.data, in.data, sizeof (in.data));
+      // copy message portion to output packet
+      memcpy(out.data, in.data, sizeof (in.data));
 
-        // now compute parity bytes and add them to tail end of output packet
-        encode_rs_char(d_rs, tmp, &out.data[sizeof (in.data)]);
+      // now compute parity bytes and add them to tail end of output packet
+      encode_rs_char(d_rs, tmp, &out.data[sizeof (in.data)]);
     }
 
     int
@@ -93,20 +87,18 @@ namespace gr {
                                gr_vector_const_void_star &input_items,
                                gr_vector_void_star &output_items)
     {
-        const atsc_mpeg_packet_no_sync *in = (const atsc_mpeg_packet_no_sync 
*) input_items[0];
-        atsc_mpeg_packet_rs_encoded *out = (atsc_mpeg_packet_rs_encoded *) 
output_items[0];
-
-        for (int i = 0; i < noutput_items; i++)
-        {
-            assert(in[i].pli.regular_seg_p());
-            out[i].pli = in[i].pli;                // copy pipeline info...
-            encode(out[i], in[i]);
-        }
-
-        // Tell runtime system how many output items we produced.
-        return noutput_items;
+      const atsc_mpeg_packet_no_sync *in = (const atsc_mpeg_packet_no_sync *) 
input_items[0];
+      atsc_mpeg_packet_rs_encoded *out = (atsc_mpeg_packet_rs_encoded *) 
output_items[0];
+
+      for (int i = 0; i < noutput_items; i++) {
+        assert(in[i].pli.regular_seg_p());
+        out[i].pli = in[i].pli;                // copy pipeline info...
+        encode(out[i], in[i]);
+      }
+
+      // Tell runtime system how many output items we produced.
+      return noutput_items;
     }
 
   } /* namespace dtv */
 } /* namespace gr */
-
diff --git a/gr-dtv/lib/atsc/atsc_rs_encoder_impl.h 
b/gr-dtv/lib/atsc/atsc_rs_encoder_impl.h
index 3f82a29..9086c82 100644
--- a/gr-dtv/lib/atsc/atsc_rs_encoder_impl.h
+++ b/gr-dtv/lib/atsc/atsc_rs_encoder_impl.h
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -34,11 +34,11 @@ namespace gr {
 
     class atsc_rs_encoder_impl : public atsc_rs_encoder
     {
-     private:
+    private:
       void *d_rs;
       void encode(atsc_mpeg_packet_rs_encoded &out, const 
atsc_mpeg_packet_no_sync &in);
 
-     public:
+    public:
       atsc_rs_encoder_impl();
       ~atsc_rs_encoder_impl();
 
@@ -51,4 +51,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_RS_ENCODER_IMPL_H */
-
diff --git a/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.cc 
b/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.cc
index 3baf045..3252f94 100644
--- a/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.cc
+++ b/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.cc
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -22,34 +22,33 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/io_signature.h>
+#include <stdio.h>
 #include "atsc_trellis_encoder_impl.h"
 #include "gnuradio/dtv/atsc_consts.h"
-#include <stdio.h>
 
 namespace gr {
   namespace dtv {
 
-static const int DIBITS_PER_BYTE = 4;
+    static const int DIBITS_PER_BYTE = 4;
 
 #define SEGOF(x) ( (x) / ((SEGMENT_SIZE + 1) * DIBITS_PER_BYTE))
 #define SYMOF(x) (((x) % ((SEGMENT_SIZE + 1) * DIBITS_PER_BYTE)) - 4)
 
-/* How many separate Trellis encoders / Viterbi decoders run in parallel */
-static const int NCODERS = 12;
+    /* How many separate Trellis encoders / Viterbi decoders run in parallel */
+    static const int NCODERS = 12;
 
 #define ENCODER_SEG_BUMP 4
 
-/* A Segment sync symbol is an 8VSB +5,-5,-5,+5 sequence that occurs at
-   the start of each 207-byte segment (including field sync segments).  */
+    /* A Segment sync symbol is an 8VSB +5,-5,-5,+5 sequence that occurs at
+       the start of each 207-byte segment (including field sync segments).  */
 #define DSEG_SYNC_SYM1 0x06    /* +5 */
 #define DSEG_SYNC_SYM2 0x01    /* -5 */
 #define DSEG_SYNC_SYM3 0x01    /* -5 */
 #define DSEG_SYNC_SYM4 0x06    /* +5 */
 
-/* Shift counts to bit numbers (high order, low order); 9x entries unused */
-static const int bit1[8] = {1, 99, 3, 98, 5, 97, 7, 96};
-static const int bit2[8] = {0, 99, 2, 98, 4, 97, 6, 96};
+    /* Shift counts to bit numbers (high order, low order); 9x entries unused 
*/
+    static const int bit1[8] = {1, 99, 3, 98, 5, 97, 7, 96};
+    static const int bit2[8] = {0, 99, 2, 98, 4, 97, 6, 96};
 
     atsc_trellis_encoder::sptr
     atsc_trellis_encoder::make()
@@ -58,22 +57,16 @@ static const int bit2[8] = {0, 99, 2, 98, 4, 97, 6, 96};
         (new atsc_trellis_encoder_impl());
     }
 
-    /*
-     * The private constructor
-     */
     atsc_trellis_encoder_impl::atsc_trellis_encoder_impl()
       : gr::sync_block("atsc_trellis_encoder",
-              gr::io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)),
-              gr::io_signature::make(1, 1, sizeof(atsc_data_segment)))
+                       gr::io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)),
+                       gr::io_signature::make(1, 1, sizeof(atsc_data_segment)))
     {
-        reset();
-        debug = false;
-        set_output_multiple(NCODERS);
+      reset();
+      debug = false;
+      set_output_multiple(NCODERS);
     }
 
-    /*
-     * Our virtual destructor.
-     */
     atsc_trellis_encoder_impl::~atsc_trellis_encoder_impl()
     {
     }
@@ -81,46 +74,43 @@ static const int bit2[8] = {0, 99, 2, 98, 4, 97, 6, 96};
     void
     atsc_trellis_encoder_impl::reset()
     {
-        for (int i = 0; i < NCODERS; i++)
-        {
-            enc[i].reset();
-        }
+      for (int i = 0; i < NCODERS; i++) {
+        enc[i].reset();
+      }
     }
 
     void
     atsc_trellis_encoder_impl::encode(atsc_data_segment out[NCODERS],
                                       const atsc_mpeg_packet_rs_encoded 
in[NCODERS])
     {
-        unsigned char out_copy[OUTPUT_SIZE];
-        unsigned char in_copy[INPUT_SIZE];
-
-        assert (sizeof (in_copy) == sizeof (in[0].data) * NCODERS);
-        assert (sizeof (out_copy) == sizeof (out[0].data) * NCODERS);
-
-        // copy input into continguous temporary buffer
-        for (int i = 0; i < NCODERS; i++)
-        {
-            assert(in[i].pli.regular_seg_p());
-            plinfo::sanity_check (in[i].pli);
-            memcpy(&in_copy[i * INPUT_SIZE / NCODERS], &in[i].data[0], 
ATSC_MPEG_RS_ENCODED_LENGTH * sizeof (in_copy[0]));
-        }
+      unsigned char out_copy[OUTPUT_SIZE];
+      unsigned char in_copy[INPUT_SIZE];
 
-        memset(out_copy, 0, sizeof (out_copy));    // FIXME, sanity check
+      assert (sizeof (in_copy) == sizeof (in[0].data) * NCODERS);
+      assert (sizeof (out_copy) == sizeof (out[0].data) * NCODERS);
 
-        // do the deed...
-        encode_helper(out_copy, in_copy);
+      // copy input into continguous temporary buffer
+      for (int i = 0; i < NCODERS; i++) {
+        assert(in[i].pli.regular_seg_p());
+        plinfo::sanity_check (in[i].pli);
+        memcpy(&in_copy[i * INPUT_SIZE / NCODERS], &in[i].data[0], 
ATSC_MPEG_RS_ENCODED_LENGTH * sizeof (in_copy[0]));
+      }
 
-        // copy output from contiguous temp buffer into final output
-        for (int i = 0; i < NCODERS; i++)
-        {
-            memcpy(&out[i].data[0], &out_copy[i * OUTPUT_SIZE / NCODERS], 
ATSC_DATA_SEGMENT_LENGTH * sizeof (out_copy[0]));
+      memset(out_copy, 0, sizeof (out_copy));    // FIXME, sanity check
 
-            // copy pipeline info
-            out[i].pli = in[i].pli;
+      // do the deed...
+      encode_helper(out_copy, in_copy);
 
-            plinfo::sanity_check(out[i].pli);
-            assert(out[i].pli.regular_seg_p());
-        }
+      // copy output from contiguous temp buffer into final output
+      for (int i = 0; i < NCODERS; i++) {
+        memcpy(&out[i].data[0], &out_copy[i * OUTPUT_SIZE / NCODERS], 
ATSC_DATA_SEGMENT_LENGTH * sizeof (out_copy[0]));
+
+        // copy pipeline info
+        out[i].pli = in[i].pli;
+
+        plinfo::sanity_check(out[i].pli);
+        assert(out[i].pli.regular_seg_p());
+      }
     }
 
     /*
@@ -132,114 +122,105 @@ static const int bit2[8] = {0, 99, 2, 98, 4, 97, 6, 96};
     atsc_trellis_encoder_impl::encode_helper(unsigned char output[OUTPUT_SIZE],
                                              const unsigned char 
input[INPUT_SIZE])
     {
-        int i;
-        int encoder;
-        unsigned char trellis_buffer[NCODERS];
-        int trellis_wherefrom[NCODERS];
-        unsigned char *out, *next_out_seg;
-        int chunk;
-        int shift;
-        unsigned char dibit;
-        unsigned char symbol;
-        int skip_encoder_bump;
-
-        /* FIXME, we may want special processing here for a flag
-         * byte to keep track of which part of the field we're in?
+      int i;
+      int encoder;
+      unsigned char trellis_buffer[NCODERS];
+      int trellis_wherefrom[NCODERS];
+      unsigned char *out, *next_out_seg;
+      int chunk;
+      int shift;
+      unsigned char dibit;
+      unsigned char symbol;
+      int skip_encoder_bump;
+
+      /* FIXME, we may want special processing here for a flag
+       * byte to keep track of which part of the field we're in?
+       */
+
+      encoder = NCODERS - ENCODER_SEG_BUMP;
+      skip_encoder_bump = 0;
+      out = output;
+      next_out_seg = out;
+
+      for (chunk = 0; chunk < INPUT_SIZE; chunk += NCODERS) {
+        /* Load a new chunk of bytes into the Trellis encoder buffers.
+         * They get loaded in an order that depends on where we are in
+         * the segment sync progress (sigh).
+         * GRR! When the chunk reload happens at the same time as the
+         * segment boundary, we should bump the encoder NOW for the reload,
+         * rather than LATER during the bitshift transition!!!
          */
+        if (out >= next_out_seg) {
+          encoder = (encoder + ENCODER_SEG_BUMP) % NCODERS;
+          skip_encoder_bump = 1;
+        }
+
+        for (i = 0; i < NCODERS; i++) {
+          /* for debug */
+          trellis_wherefrom[encoder] = chunk + i;
+          trellis_buffer[encoder] = input [chunk + i];
+          encoder++;
+          if (encoder >= NCODERS) {
+            encoder = 0;
+          }
+        }
 
-        encoder = NCODERS - ENCODER_SEG_BUMP;
-        skip_encoder_bump = 0;
-        out = output;
-        next_out_seg = out;
-
-        for (chunk = 0; chunk < INPUT_SIZE; chunk += NCODERS)
-        {
-            /* Load a new chunk of bytes into the Trellis encoder buffers.
-             * They get loaded in an order that depends on where we are in
-             * the segment sync progress (sigh).
-             * GRR! When the chunk reload happens at the same time as the
-             * segment boundary, we should bump the encoder NOW for the reload,
-             * rather than LATER during the bitshift transition!!!
+        for (shift = 6; shift >= 0; shift -= 2) {
+          /* Segment boundaries happen to occur on some bitshift transitions. 
*/
+          if (out >= next_out_seg) {
+            /* Segment transition. Output a data segment sync symbol,
+             * and mess with the trellis encoder mux.
              */
-            if (out >= next_out_seg)
-            {
-                encoder = (encoder + ENCODER_SEG_BUMP) % NCODERS;
-                skip_encoder_bump = 1;
+            *out++ = DSEG_SYNC_SYM1;
+            *out++ = DSEG_SYNC_SYM2;
+            *out++ = DSEG_SYNC_SYM3;
+            *out++ = DSEG_SYNC_SYM4;
+            if (debug) {
+              printf("SYNC SYNC SYNC SYNC\n");
             }
 
-            for (i = 0; i < NCODERS; i++)
-            {
-                /* for debug */
-                trellis_wherefrom[encoder] = chunk + i;
-                trellis_buffer[encoder] = input [chunk + i];
-                encoder++;
-                if (encoder >= NCODERS)
-                {
-                    encoder = 0;
-                }
+            next_out_seg = out + (SEGMENT_SIZE * DIBITS_PER_BYTE);
+
+            if (!skip_encoder_bump) {
+              encoder = (encoder + ENCODER_SEG_BUMP) % NCODERS;
+            }
+            skip_encoder_bump = 0;
+          }
+
+          /* Now run each of the 12 Trellis encoders to spit out 12 symbols.
+           * Each encoder takes input from the same byte of the chunk, but
+           * the outputs of the encoders come out in various orders.
+           * NOPE -- this is false. The encoders take input from various
+           * bytes of the chunk (which changes at segment sync time), AND
+           * they also come out in various orders. You really do have to
+           * keep separate track of: the input bytes, the encoders, and
+           * the output bytes -- because they're all moving with respect
+           * to each other!!!
+           */
+          for (i = 0; i < NCODERS; i++) {
+            dibit = 0x03 & (trellis_buffer[encoder] >> shift);
+            if (debug) {
+              printf("Seg %ld Symb %3ld Trell %2d Byte %6d Bits %d-%d = dibit 
%d ", (long) SEGOF(out-output), (long) SYMOF(out-output), encoder, 
trellis_wherefrom[encoder], bit1[shift], bit2[shift], dibit);
             }
 
-            for (shift = 6; shift >= 0; shift -= 2)
-            {
-                /* Segment boundaries happen to occur on some bitshift 
transitions. */
-                if (out >= next_out_seg)
-                {
-                    /* Segment transition. Output a data segment sync symbol,
-                     * and mess with the trellis encoder mux.
-                     */
-                    *out++ = DSEG_SYNC_SYM1;
-                    *out++ = DSEG_SYNC_SYM2;
-                    *out++ = DSEG_SYNC_SYM3;
-                    *out++ = DSEG_SYNC_SYM4;
-                    if (debug)
-                    {
-                        printf("SYNC SYNC SYNC SYNC\n");
-                    }
-                    next_out_seg = out + (SEGMENT_SIZE * DIBITS_PER_BYTE);
-
-                    if (!skip_encoder_bump)
-                    {
-                        encoder = (encoder + ENCODER_SEG_BUMP) % NCODERS;
-                    }
-                    skip_encoder_bump = 0;
-                }
-
-                /* Now run each of the 12 Trellis encoders to spit out 12 
symbols.
-                 * Each encoder takes input from the same byte of the chunk, 
but
-                 * the outputs of the encoders come out in various orders.
-                 * NOPE -- this is false. The encoders take input from various
-                 * bytes of the chunk (which changes at segment sync time), AND
-                 * they also come out in various orders. You really do have to
-                 * keep separate track of: the input bytes, the encoders, and
-                 * the output bytes -- because they're all moving with respect
-                 * to each other!!!
-                 */
-                for (i = 0; i < NCODERS; i++)
-                {
-                    dibit = 0x03 & (trellis_buffer[encoder] >> shift);
-                    if (debug)
-                    {
-                        printf("Seg %ld Symb %3ld Trell %2d Byte %6d Bits 
%d-%d = dibit %d ", (long) SEGOF(out-output), (long) SYMOF(out-output), 
encoder, trellis_wherefrom[encoder], bit1[shift], bit2[shift], dibit);
-                    }
-                    symbol = enc[encoder].encode(dibit);
-                    *out++ = symbol;
-                    encoder++;
-                    if (encoder >= NCODERS)
-                    {
-                        encoder = 0;
-                    }
-                    if (debug)
-                    {
-                        printf("sym %d\n", symbol);
-                    }
-                } /* Encoders */
-            } /* Bit shifts */
-        } /* Chunks */
-
-        /* Check up on ourselves */
-        assert (0 ==  (INPUT_SIZE * DIBITS_PER_BYTE) % NCODERS);
-        assert (OUTPUT_SIZE == out - output);
-        assert (NCODERS - ENCODER_SEG_BUMP == encoder);
+            symbol = enc[encoder].encode(dibit);
+            *out++ = symbol;
+            encoder++;
+            if (encoder >= NCODERS) {
+              encoder = 0;
+            }
+            if (debug) {
+              printf("sym %d\n", symbol);
+            }
+
+          } /* Encoders */
+        } /* Bit shifts */
+      } /* Chunks */
+
+      /* Check up on ourselves */
+      assert (0 ==  (INPUT_SIZE * DIBITS_PER_BYTE) % NCODERS);
+      assert (OUTPUT_SIZE == out - output);
+      assert (NCODERS - ENCODER_SEG_BUMP == encoder);
     }
 
     int
@@ -247,18 +228,16 @@ static const int bit2[8] = {0, 99, 2, 98, 4, 97, 6, 96};
                                     gr_vector_const_void_star &input_items,
                                     gr_vector_void_star &output_items)
     {
-        const atsc_mpeg_packet_rs_encoded *in = (const 
atsc_mpeg_packet_rs_encoded *) input_items[0];
-        atsc_data_segment *out = (atsc_data_segment *) output_items[0];
+      const atsc_mpeg_packet_rs_encoded *in = (const 
atsc_mpeg_packet_rs_encoded *) input_items[0];
+      atsc_data_segment *out = (atsc_data_segment *) output_items[0];
 
-        for (int i = 0; i < noutput_items; i += NCODERS)
-        {
-            encode(&out[i], &in[i]);
-        }
+      for (int i = 0; i < noutput_items; i += NCODERS) {
+        encode(&out[i], &in[i]);
+      }
 
-        // Tell runtime system how many output items we produced.
-        return noutput_items;
+      // Tell runtime system how many output items we produced.
+      return noutput_items;
     }
 
   } /* namespace dtv */
 } /* namespace gr */
-
diff --git a/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.h 
b/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.h
index f81b4d0..054a3ac 100644
--- a/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.h
+++ b/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.h
@@ -1,17 +1,17 @@
 /* -*- c++ -*- */
-/* 
+/*
  * Copyright 2015 Free Software Foundation, Inc.
- * 
+ *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -30,7 +30,7 @@ namespace gr {
 
     class atsc_trellis_encoder_impl : public atsc_trellis_encoder
     {
-     private:
+    private:
       bool debug;
 
       static const int NCODERS = 12;
@@ -44,7 +44,7 @@ namespace gr {
 
       atsc_basic_trellis_encoder enc[NCODERS];
 
-     public:
+    public:
       atsc_trellis_encoder_impl();
       ~atsc_trellis_encoder_impl();
 
@@ -57,4 +57,3 @@ namespace gr {
 } // namespace gr
 
 #endif /* INCLUDED_DTV_ATSC_TRELLIS_ENCODER_IMPL_H */
-
diff --git a/gr-dtv/swig/dtv_swig.i b/gr-dtv/swig/dtv_swig.i
index 0baaafd..0226ac6 100644
--- a/gr-dtv/swig/dtv_swig.i
+++ b/gr-dtv/swig/dtv_swig.i
@@ -32,47 +32,47 @@
 #include "gnuradio/dtv/atsc_depad.h"
 #include "gnuradio/dtv/atsc_derandomizer.h"
 #include "gnuradio/dtv/atsc_equalizer.h"
+#include "gnuradio/dtv/atsc_field_sync_mux.h"
 #include "gnuradio/dtv/atsc_fpll.h"
 #include "gnuradio/dtv/atsc_fs_checker.h"
-#include "gnuradio/dtv/atsc_rs_decoder.h"
-#include "gnuradio/dtv/atsc_sync.h"
-#include "gnuradio/dtv/atsc_viterbi_decoder.h"
+#include "gnuradio/dtv/atsc_interleaver.h"
 #include "gnuradio/dtv/atsc_pad.h"
 #include "gnuradio/dtv/atsc_randomizer.h"
+#include "gnuradio/dtv/atsc_rs_decoder.h"
 #include "gnuradio/dtv/atsc_rs_encoder.h"
-#include "gnuradio/dtv/atsc_interleaver.h"
+#include "gnuradio/dtv/atsc_sync.h"
 #include "gnuradio/dtv/atsc_trellis_encoder.h"
-#include "gnuradio/dtv/atsc_field_sync_mux.h"
+#include "gnuradio/dtv/atsc_viterbi_decoder.h"
 %}
 
 %include "gnuradio/dtv/atsc_deinterleaver.h"
 %include "gnuradio/dtv/atsc_depad.h"
 %include "gnuradio/dtv/atsc_derandomizer.h"
 %include "gnuradio/dtv/atsc_equalizer.h"
+%include "gnuradio/dtv/atsc_field_sync_mux.h"
 %include "gnuradio/dtv/atsc_fpll.h"
 %include "gnuradio/dtv/atsc_fs_checker.h"
-%include "gnuradio/dtv/atsc_rs_decoder.h"
-%include "gnuradio/dtv/atsc_sync.h"
-%include "gnuradio/dtv/atsc_viterbi_decoder.h"
+%include "gnuradio/dtv/atsc_interleaver.h"
 %include "gnuradio/dtv/atsc_pad.h"
 %include "gnuradio/dtv/atsc_randomizer.h"
+%include "gnuradio/dtv/atsc_rs_decoder.h"
 %include "gnuradio/dtv/atsc_rs_encoder.h"
-%include "gnuradio/dtv/atsc_interleaver.h"
+%include "gnuradio/dtv/atsc_sync.h"
 %include "gnuradio/dtv/atsc_trellis_encoder.h"
-%include "gnuradio/dtv/atsc_field_sync_mux.h"
+%include "gnuradio/dtv/atsc_viterbi_decoder.h"
 
 GR_SWIG_BLOCK_MAGIC2(dtv, atsc_deinterleaver);
 GR_SWIG_BLOCK_MAGIC2(dtv, atsc_depad);
 GR_SWIG_BLOCK_MAGIC2(dtv, atsc_derandomizer);
 GR_SWIG_BLOCK_MAGIC2(dtv, atsc_equalizer)
+GR_SWIG_BLOCK_MAGIC2(dtv, atsc_field_sync_mux);
 GR_SWIG_BLOCK_MAGIC2(dtv, atsc_fpll);
 GR_SWIG_BLOCK_MAGIC2(dtv, atsc_fs_checker);
-GR_SWIG_BLOCK_MAGIC2(dtv, atsc_rs_decoder);
-GR_SWIG_BLOCK_MAGIC2(dtv, atsc_sync);
-GR_SWIG_BLOCK_MAGIC2(dtv, atsc_viterbi_decoder);
+GR_SWIG_BLOCK_MAGIC2(dtv, atsc_interleaver);
 GR_SWIG_BLOCK_MAGIC2(dtv, atsc_pad);
 GR_SWIG_BLOCK_MAGIC2(dtv, atsc_randomizer);
+GR_SWIG_BLOCK_MAGIC2(dtv, atsc_rs_decoder);
 GR_SWIG_BLOCK_MAGIC2(dtv, atsc_rs_encoder);
-GR_SWIG_BLOCK_MAGIC2(dtv, atsc_interleaver);
+GR_SWIG_BLOCK_MAGIC2(dtv, atsc_sync);
 GR_SWIG_BLOCK_MAGIC2(dtv, atsc_trellis_encoder);
-GR_SWIG_BLOCK_MAGIC2(dtv, atsc_field_sync_mux);
+GR_SWIG_BLOCK_MAGIC2(dtv, atsc_viterbi_decoder);



reply via email to

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