commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 03/09: dtv: misc. stylistic cleanup, add mi


From: git
Subject: [Commit-gnuradio] [gnuradio] 03/09: dtv: misc. stylistic cleanup, add missing blocks to GRC block tree
Date: Tue, 22 Jul 2014 19:33:56 +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 621830cc9cdb4e74ada44c91db4f33830034e92b
Author: Johnathan Corgan <address@hidden>
Date:   Wed Jun 11 09:28:32 2014 -0700

    dtv: misc. stylistic cleanup, add missing blocks to GRC block tree
---
 gr-dtv/grc/dtv_block_tree.xml                 |  4 +++
 gr-dtv/include/gnuradio/dtv/atsc_rs_decoder.h |  2 +-
 gr-dtv/lib/atsc_deinterleaver_impl.cc         | 41 ++++++++++++++-------------
 gr-dtv/lib/atsc_deinterleaver_impl.h          | 14 ++++-----
 gr-dtv/lib/atsc_depad_impl.cc                 | 12 ++++----
 gr-dtv/lib/atsc_depad_impl.h                  |  7 ++---
 gr-dtv/lib/atsc_derandomizer_impl.cc          | 10 ++-----
 gr-dtv/lib/atsc_derandomizer_impl.h           |  7 ++---
 gr-dtv/lib/atsc_rs_decoder_impl.cc            | 40 ++++++++++++++------------
 gr-dtv/lib/atsc_rs_decoder_impl.h             | 10 +++----
 gr-dtv/python/dtv/atsc_rx.py                  |  2 +-
 11 files changed, 73 insertions(+), 76 deletions(-)

diff --git a/gr-dtv/grc/dtv_block_tree.xml b/gr-dtv/grc/dtv_block_tree.xml
index ab7a19a..8b84c36 100644
--- a/gr-dtv/grc/dtv_block_tree.xml
+++ b/gr-dtv/grc/dtv_block_tree.xml
@@ -32,9 +32,13 @@
     <name>Digital Television</name>
     <cat>
       <name>ATSC</name>
+      <block>dtv_atsc_deinterleaver</block>
+      <block>dtv_atsc_depad</block>
+      <block>dtv_atsc_derandomizer</block>
       <block>dtv_atsc_equalizer</block>
       <block>dtv_atsc_fpll</block>
       <block>dtv_atsc_fs_checker</block>
+      <block>dtv_atsc_rs_decoder</block>
       <block>dtv_atsc_rx</block>
       <block>dtv_atsc_rx_filter</block>
       <block>dtv_atsc_sync</block>
diff --git a/gr-dtv/include/gnuradio/dtv/atsc_rs_decoder.h 
b/gr-dtv/include/gnuradio/dtv/atsc_rs_decoder.h
index 3f5c198..92eb263 100644
--- a/gr-dtv/include/gnuradio/dtv/atsc_rs_decoder.h
+++ b/gr-dtv/include/gnuradio/dtv/atsc_rs_decoder.h
@@ -30,7 +30,7 @@ namespace gr {
   namespace dtv {
 
     /*!
-     * \brief ATSC Receiver RS_DECODER
+     * \brief ATSC Receiver Reed-Solomon Decoder
      *
      * \ingroup dtv_atsc
      */
diff --git a/gr-dtv/lib/atsc_deinterleaver_impl.cc 
b/gr-dtv/lib/atsc_deinterleaver_impl.cc
index 0d6d131..7b2001a 100644
--- a/gr-dtv/lib/atsc_deinterleaver_impl.cc
+++ b/gr-dtv/lib/atsc_deinterleaver_impl.cc
@@ -39,16 +39,17 @@ namespace gr {
     }
 
     atsc_deinterleaver_impl::atsc_deinterleaver_impl()
-        : gr::sync_block("atsc_deinterleaver",
-                    io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)),
-                    io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded))), alignment_fifo (156)
+      : gr::sync_block("atsc_deinterleaver",
+                       io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)),
+                       io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded))),
+        alignment_fifo (156)
     {
-      m_fifo.resize (52);
+      m_fifo.resize(52);
 
       for (int i = 0; i < 52; i++)
         m_fifo[52 - 1 - i] = new interleaver_fifo<unsigned char>(i * 4);
 
-      sync ();
+      sync();
     }
 
     atsc_deinterleaver_impl::~atsc_deinterleaver_impl()
@@ -57,35 +58,35 @@ namespace gr {
         delete m_fifo[i];
     }
 
-    void atsc_deinterleaver_impl::reset ()
+    void atsc_deinterleaver_impl::reset()
     {
-      sync ();
+      sync();
       for (int i = 0; i < 52; i++)
-        m_fifo[i]->reset ();
+        m_fifo[i]->reset();
     }
 
     int
-    atsc_deinterleaver_impl::work (int noutput_items,
-                        gr_vector_const_void_star &input_items,
-                        gr_vector_void_star &output_items)
+    atsc_deinterleaver_impl::work(int noutput_items,
+                                  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];
+      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];
 
-      for (int i = 0; i < noutput_items; i++){
-        assert (in[i].pli.regular_seg_p ());
-        plinfo::sanity_check (in[i].pli);
+      for (int i = 0; i < noutput_items; i++) {
+        assert (in[i].pli.regular_seg_p());
+        plinfo::sanity_check(in[i].pli);
 
         // reset commutator if required using INPUT pipeline info
-        if (in[i].pli.first_regular_seg_p ())
-          sync ();
+        if (in[i].pli.first_regular_seg_p())
+          sync();
 
         // remap OUTPUT pipeline info to reflect 52 data segment end-to-end 
delay
         plinfo::delay (out[i].pli, in[i].pli, 52);
 
         // now do the actual deinterleaving
-        for (unsigned int j = 0; j < sizeof (in[i].data); j++){
-          out[i].data[j] = alignment_fifo.stuff (transform (in[i].data[j]));
+        for (unsigned int j = 0; j < sizeof(in[i].data); j++) {
+          out[i].data[j] = alignment_fifo.stuff(transform (in[i].data[j]));
         }
       }
 
diff --git a/gr-dtv/lib/atsc_deinterleaver_impl.h 
b/gr-dtv/lib/atsc_deinterleaver_impl.h
index 2baf413..75eb7e8 100644
--- a/gr-dtv/lib/atsc_deinterleaver_impl.h
+++ b/gr-dtv/lib/atsc_deinterleaver_impl.h
@@ -34,8 +34,8 @@ namespace gr {
     {
     private:
       //! transform a single symbol
-      unsigned char transform (unsigned char input){
-        unsigned char retval = m_fifo[m_commutator]->stuff (input);
+      unsigned char transform(unsigned char input) {
+        unsigned char retval = m_fifo[m_commutator]->stuff(input);
         m_commutator++;
         if (m_commutator >= 52)
           m_commutator = 0;
@@ -58,15 +58,15 @@ namespace gr {
       atsc_deinterleaver_impl();
       ~atsc_deinterleaver_impl();
 
-      int work (int noutput_items,
-            gr_vector_const_void_star &input_items,
-            gr_vector_void_star &output_items);
+      int work(int noutput_items,
+               gr_vector_const_void_star &input_items,
+               gr_vector_void_star &output_items);
 
       //! reset interleaver (flushes contents and resets commutator)
-      void reset ();
+      void reset();
 
       //! sync interleaver (resets commutator, but doesn't flush fifos)
-      void sync () { m_commutator = 0; }
+      void sync() { m_commutator = 0; }
     };
 
   } /* namespace dtv */
diff --git a/gr-dtv/lib/atsc_depad_impl.cc b/gr-dtv/lib/atsc_depad_impl.cc
index 9264b19..e1172e6 100644
--- a/gr-dtv/lib/atsc_depad_impl.cc
+++ b/gr-dtv/lib/atsc_depad_impl.cc
@@ -44,22 +44,20 @@ namespace gr {
                               io_signature::make(1, 1, sizeof(unsigned char)),
                               ATSC_MPEG_PKT_LENGTH)
     {
-      reset();
     }
 
     int
     atsc_depad_impl::work (int noutput_items,
-                    gr_vector_const_void_star &input_items,
-                    gr_vector_void_star &output_items)
+                           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];
-      unsigned char *out = (unsigned char *) output_items[0];
+      const atsc_mpeg_packet *in = (const atsc_mpeg_packet *)input_items[0];
+      unsigned char *out = (unsigned char *)output_items[0];
 
       int i;
 
-      for (i = 0; i < noutput_items/ATSC_MPEG_PKT_LENGTH; i++){
+      for (i = 0; i < noutput_items/ATSC_MPEG_PKT_LENGTH; i++)
         memcpy(&out[i * ATSC_MPEG_PKT_LENGTH], in[i].data, 
ATSC_MPEG_PKT_LENGTH);
-      }
 
       return i * ATSC_MPEG_PKT_LENGTH;
     }
diff --git a/gr-dtv/lib/atsc_depad_impl.h b/gr-dtv/lib/atsc_depad_impl.h
index 81b3ab7..d29b1cf 100644
--- a/gr-dtv/lib/atsc_depad_impl.h
+++ b/gr-dtv/lib/atsc_depad_impl.h
@@ -33,11 +33,10 @@ namespace gr {
     {
     public:
       atsc_depad_impl();
-      int work (int noutput_items,
-            gr_vector_const_void_star &input_items,
-            gr_vector_void_star &output_items);
 
-      void reset() { /* nop */ }
+      int work(int noutput_items,
+               gr_vector_const_void_star &input_items,
+               gr_vector_void_star &output_items);
     };
 
   } /* namespace dtv */
diff --git a/gr-dtv/lib/atsc_derandomizer_impl.cc 
b/gr-dtv/lib/atsc_derandomizer_impl.cc
index f62580b..364713f 100644
--- a/gr-dtv/lib/atsc_derandomizer_impl.cc
+++ b/gr-dtv/lib/atsc_derandomizer_impl.cc
@@ -40,14 +40,8 @@ namespace gr {
 
     atsc_derandomizer_impl::atsc_derandomizer_impl()
       : gr::sync_block("dtv_atsc_derandomizer",
-                  io_signature::make(1, 1, sizeof(atsc_mpeg_packet_no_sync)),
-                  io_signature::make(1, 1, sizeof(atsc_mpeg_packet)))
-    {
-      reset();
-    }
-
-    void
-    atsc_derandomizer_impl::reset()
+                       io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_no_sync)),
+                       io_signature::make(1, 1, sizeof(atsc_mpeg_packet)))
     {
       d_rand.reset();
     }
diff --git a/gr-dtv/lib/atsc_derandomizer_impl.h 
b/gr-dtv/lib/atsc_derandomizer_impl.h
index 39a58e0..a307a51 100644
--- a/gr-dtv/lib/atsc_derandomizer_impl.h
+++ b/gr-dtv/lib/atsc_derandomizer_impl.h
@@ -36,11 +36,10 @@ namespace gr {
 
     public:
       atsc_derandomizer_impl();
-      int work (int noutput_items,
-            gr_vector_const_void_star &input_items,
-            gr_vector_void_star &output_items);
 
-      void reset();
+      int work(int noutput_items,
+               gr_vector_const_void_star &input_items,
+               gr_vector_void_star &output_items);
     };
 
   } /* namespace dtv */
diff --git a/gr-dtv/lib/atsc_rs_decoder_impl.cc 
b/gr-dtv/lib/atsc_rs_decoder_impl.cc
index 890afde..cd9588d 100644
--- a/gr-dtv/lib/atsc_rs_decoder_impl.cc
+++ b/gr-dtv/lib/atsc_rs_decoder_impl.cc
@@ -51,16 +51,15 @@ namespace gr {
 
     atsc_rs_decoder_impl::atsc_rs_decoder_impl()
       : gr::sync_block("dtv_atsc_rs_decoder",
-                  io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)),
-                  io_signature::make(1, 1, sizeof(atsc_mpeg_packet_no_sync)))
+                       io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_rs_encoded)),
+                       io_signature::make(1, 1, 
sizeof(atsc_mpeg_packet_no_sync)))
     {
-      d_rs = init_rs_char (rs_init_symsize, rs_init_gfpoly, rs_init_fcr, 
rs_init_prim, rs_init_nroots);
+      d_rs = init_rs_char(rs_init_symsize, rs_init_gfpoly, rs_init_fcr, 
rs_init_prim, rs_init_nroots);
       assert (d_rs != 0);
       nerrors_corrrected_count = 0;
       bad_packet_count = 0;
       total_packets = 0;
       reset_counter = 0;
-      reset();
     }
 
     int atsc_rs_decoder_impl::decode (atsc_mpeg_packet_no_sync &out, const 
atsc_mpeg_packet_rs_encoded &in)
@@ -68,14 +67,14 @@ namespace gr {
       unsigned char tmp[N];
       int ncorrections;
 
-      assert ((int)(amount_of_pad + sizeof (in.data)) == N);
+      assert((int)(amount_of_pad + sizeof(in.data)) == N);
 
       // add missing prefix zero padding to message
-      memset (tmp, 0, amount_of_pad);
-      memcpy (&tmp[amount_of_pad], in.data, sizeof (in.data));
+      memset(tmp, 0, amount_of_pad);
+      memcpy(&tmp[amount_of_pad], in.data, sizeof(in.data));
 
       // correct message...
-      ncorrections = decode_rs_char (d_rs, tmp, 0, 0);
+      ncorrections = decode_rs_char(d_rs, tmp, 0, 0);
 
       // copy corrected message to output, skipping prefix zero padding
       memcpy (out.data, &tmp[amount_of_pad], sizeof (out.data));
@@ -91,20 +90,20 @@ namespace gr {
     }
 
     int
-    atsc_rs_decoder_impl::work (int noutput_items,
-                        gr_vector_const_void_star &input_items,
-                        gr_vector_void_star &output_items)
+    atsc_rs_decoder_impl::work(int noutput_items,
+                               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_no_sync *out = (atsc_mpeg_packet_no_sync *) 
output_items[0];
+      const atsc_mpeg_packet_rs_encoded *in = (const 
atsc_mpeg_packet_rs_encoded *)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++){
+      for (int i = 0; i < noutput_items; i++) {
         assert(in[i].pli.regular_seg_p());
         out[i].pli = in[i].pli;                        // copy pipeline info...
 
         int nerrors_corrrected = decode(out[i], in[i]);
         out[i].pli.set_transport_error(nerrors_corrrected == -1);
-        if( nerrors_corrrected == -1 )
+        if (nerrors_corrrected == -1)
           bad_packet_count++;
         else
           nerrors_corrrected_count += nerrors_corrrected;
@@ -113,9 +112,14 @@ namespace gr {
       total_packets += noutput_items;
       reset_counter++;
 
-      if( reset_counter > 100 )
-      {
-        std::cout << "Error rate: " << 
(float)nerrors_corrrected_count/total_packets << "\tPacket error rate: " << 
(float)bad_packet_count/total_packets << std::endl;
+      if (reset_counter > 100) {
+        // FIXME: convert to logger
+        std::cout << "Error rate: "
+                  << (float)nerrors_corrrected_count/total_packets
+                  << "\tPacket error rate: "
+                  << (float)bad_packet_count/total_packets
+                  << std::endl;
+
         nerrors_corrrected_count = 0;
         bad_packet_count = 0;
         total_packets = 0;
diff --git a/gr-dtv/lib/atsc_rs_decoder_impl.h 
b/gr-dtv/lib/atsc_rs_decoder_impl.h
index b2f3a8c..691d619 100644
--- a/gr-dtv/lib/atsc_rs_decoder_impl.h
+++ b/gr-dtv/lib/atsc_rs_decoder_impl.h
@@ -50,13 +50,11 @@ namespace gr {
        * Decode RS encoded packet.
        * \returns a count of corrected symbols, or -1 if the block was 
uncorrectible.
        */
-      int decode (atsc_mpeg_packet_no_sync &out, const 
atsc_mpeg_packet_rs_encoded &in);
+      int decode(atsc_mpeg_packet_no_sync &out, const 
atsc_mpeg_packet_rs_encoded &in);
 
-      int work (int noutput_items,
-            gr_vector_const_void_star &input_items,
-            gr_vector_void_star &output_items);
-
-      void reset() { /* nop */ }
+      int work(int noutput_items,
+               gr_vector_const_void_star &input_items,
+               gr_vector_void_star &output_items);
     };
 
   } /* namespace dtv */
diff --git a/gr-dtv/python/dtv/atsc_rx.py b/gr-dtv/python/dtv/atsc_rx.py
index 71e9f46..9ca93fb 100644
--- a/gr-dtv/python/dtv/atsc_rx.py
+++ b/gr-dtv/python/dtv/atsc_rx.py
@@ -53,7 +53,7 @@ class atsc_rx(gr.hier_block2):
         # Remove convolutional trellis coding
         vit = dtv.atsc_viterbi_decoder()
 
-       # Remove convolutianal interleave
+       # Remove convolutional interleaving
        dei = dtv.atsc_deinterleaver()
 
        # Reed-Solomon decode



reply via email to

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