commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 03/06: Add 2X interpolation capability to D


From: git
Subject: [Commit-gnuradio] [gnuradio] 03/06: Add 2X interpolation capability to DVB-S2 modulator.
Date: Tue, 29 Dec 2015 15:49:34 +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 443ae06e052cbd878b90e51c278d850feaf90cdd
Author: Ron Economos <address@hidden>
Date:   Mon Dec 28 14:39:34 2015 -0800

    Add 2X interpolation capability to DVB-S2 modulator.
---
 gr-dtv/grc/dtv_dvbs2_modulator_bc.xml            |  17 +-
 gr-dtv/include/gnuradio/dtv/dvbs2_config.h       |   6 +
 gr-dtv/include/gnuradio/dtv/dvbs2_modulator_bc.h |   3 +-
 gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.cc      | 202 ++++++++++++++++-------
 gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.h       |   3 +-
 5 files changed, 168 insertions(+), 63 deletions(-)

diff --git a/gr-dtv/grc/dtv_dvbs2_modulator_bc.xml 
b/gr-dtv/grc/dtv_dvbs2_modulator_bc.xml
index 1f7fef0..c57ad32 100644
--- a/gr-dtv/grc/dtv_dvbs2_modulator_bc.xml
+++ b/gr-dtv/grc/dtv_dvbs2_modulator_bc.xml
@@ -8,7 +8,7 @@
   <name>DVB-S2X Modulator</name>
   <key>dtv_dvbs2_modulator_bc</key>
   <import>from gnuradio import dtv</import>
-  <make>dtv.dvbs2_modulator_bc($framesize.val, $rate.val, 
$constellation.val)</make>
+  <make>dtv.dvbs2_modulator_bc($framesize.val, $rate.val, $constellation.val, 
$interpolation.val)</make>
   <param>
     <name>FECFRAME size</name>
     <key>framesize</key>
@@ -254,6 +254,21 @@
       <opt>val:dtv.MOD_256APSK</opt>
     </option>
   </param>
+  <param>
+    <name>2X Interpolation</name>
+    <key>interpolation</key>
+    <type>enum</type>
+    <option>
+      <name>Off</name>
+      <key>INTERPOLATION_OFF</key>
+      <opt>val:dtv.INTERPOLATION_OFF</opt>
+    </option>
+    <option>
+      <name>On</name>
+      <key>INTERPOLATION_ON</key>
+      <opt>val:dtv.INTERPOLATION_ON</opt>
+    </option>
+  </param>
   <sink>
     <name>in</name>
     <type>byte</type>
diff --git a/gr-dtv/include/gnuradio/dtv/dvbs2_config.h 
b/gr-dtv/include/gnuradio/dtv/dvbs2_config.h
index 919c7de..079857a 100644
--- a/gr-dtv/include/gnuradio/dtv/dvbs2_config.h
+++ b/gr-dtv/include/gnuradio/dtv/dvbs2_config.h
@@ -38,11 +38,17 @@ namespace gr {
       PILOTS_ON,
     };
 
+    enum dvbs2_interpolation_t {
+      INTERPOLATION_OFF = 0,
+      INTERPOLATION_ON,
+    };
+
   } // namespace dtv
 } // namespace gr
 
 typedef gr::dtv::dvbs2_rolloff_factor_t dvbs2_rolloff_factor_t;
 typedef gr::dtv::dvbs2_pilots_t dvbs2_pilots_t;
+typedef gr::dtv::dvbs2_interpolation_t dvbs2_interpolation_t;
 
 #endif /* INCLUDED_DTV_DVBS2_CONFIG_H */
 
diff --git a/gr-dtv/include/gnuradio/dtv/dvbs2_modulator_bc.h 
b/gr-dtv/include/gnuradio/dtv/dvbs2_modulator_bc.h
index 68e5403..d59d3ef 100644
--- a/gr-dtv/include/gnuradio/dtv/dvbs2_modulator_bc.h
+++ b/gr-dtv/include/gnuradio/dtv/dvbs2_modulator_bc.h
@@ -23,6 +23,7 @@
 
 #include <gnuradio/dtv/api.h>
 #include <gnuradio/dtv/dvb_config.h>
+#include <gnuradio/dtv/dvbs2_config.h>
 #include <gnuradio/block.h>
 
 namespace gr {
@@ -47,7 +48,7 @@ namespace gr {
        * \param rate FEC code rate.
        * \param constellation DVB-S2 constellation.
        */
-      static sptr make(dvb_framesize_t framesize, dvb_code_rate_t rate, 
dvb_constellation_t constellation);
+      static sptr make(dvb_framesize_t framesize, dvb_code_rate_t rate, 
dvb_constellation_t constellation, dvbs2_interpolation_t interpolation);
     };
 
   } // namespace dtv
diff --git a/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.cc 
b/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.cc
index c8579d1..e74414a 100644
--- a/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.cc
+++ b/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.cc
@@ -29,16 +29,16 @@ namespace gr {
   namespace dtv {
 
     dvbs2_modulator_bc::sptr
-    dvbs2_modulator_bc::make(dvb_framesize_t framesize, dvb_code_rate_t rate, 
dvb_constellation_t constellation)
+    dvbs2_modulator_bc::make(dvb_framesize_t framesize, dvb_code_rate_t rate, 
dvb_constellation_t constellation, dvbs2_interpolation_t interpolation)
     {
       return gnuradio::get_initial_sptr
-        (new dvbs2_modulator_bc_impl(framesize, rate, constellation));
+        (new dvbs2_modulator_bc_impl(framesize, rate, constellation, 
interpolation));
     }
 
     /*
      * The private constructor
      */
-    dvbs2_modulator_bc_impl::dvbs2_modulator_bc_impl(dvb_framesize_t 
framesize, dvb_code_rate_t rate, dvb_constellation_t constellation)
+    dvbs2_modulator_bc_impl::dvbs2_modulator_bc_impl(dvb_framesize_t 
framesize, dvb_code_rate_t rate, dvb_constellation_t constellation, 
dvbs2_interpolation_t interpolation)
       : gr::block("dvbs2_modulator_bc",
               gr::io_signature::make(1, 1, sizeof(unsigned char)),
               gr::io_signature::make(1, 1, sizeof(gr_complex)))
@@ -1668,6 +1668,7 @@ namespace gr {
           break;
       }
       signal_constellation = constellation;
+      signal_interpolation = interpolation;
       set_output_multiple(2);
     }
 
@@ -1681,7 +1682,12 @@ namespace gr {
     void
     dvbs2_modulator_bc_impl::forecast (int noutput_items, gr_vector_int 
&ninput_items_required)
     {
-      ninput_items_required[0] = noutput_items;
+      if (signal_interpolation == INTERPOLATION_OFF) {
+        ninput_items_required[0] = noutput_items;
+      }
+      else {
+        ninput_items_required[0] = noutput_items / 2;
+      }
     }
 
     int
@@ -1693,67 +1699,143 @@ namespace gr {
       const unsigned char *in = (const unsigned char *) input_items[0];
       gr_complex *out = (gr_complex *) output_items[0];
       int index;
+      gr_complex zero;
 
-      switch (signal_constellation) {
-        case MOD_QPSK:
-          for (int i = 0; i < noutput_items; i++) {
-            index = *in++;
-            *out++ = m_qpsk[index & 0x3];
-          }
-          break;
-        case MOD_8PSK:
-        case MOD_8APSK:
-          for (int i = 0; i < noutput_items; i++) {
-            index = *in++;
-            *out++ = m_8psk[index & 0x7];
-          }
-          break;
-        case MOD_16APSK:
-        case MOD_8_8APSK:
-          for (int i = 0; i < noutput_items; i++) {
-            index = *in++;
-            *out++ = m_16apsk[index & 0xf];
-          }
-          break;
-        case MOD_32APSK:
-        case MOD_4_12_16APSK:
-        case MOD_4_8_4_16APSK:
-          for (int i = 0; i < noutput_items; i++) {
-            index = *in++;
-            *out++ = m_32apsk[index & 0x1f];
-          }
-          break;
-        case MOD_64APSK:
-        case MOD_8_16_20_20APSK:
-        case MOD_4_12_20_28APSK:
-          for (int i = 0; i < noutput_items; i++) {
-            index = *in++;
-            *out++ = m_64apsk[index & 0x3f];
-          }
-          break;
-        case MOD_128APSK:
-          for (int i = 0; i < noutput_items; i++) {
-            index = *in++;
-            *out++ = m_128apsk[index & 0x7f];
-          }
-          break;
-        case MOD_256APSK:
-          for (int i = 0; i < noutput_items; i++) {
-            index = *in++;
-            *out++ = m_256apsk[index & 0xff];
-          }
-          break;
-        default:
-          for (int i = 0; i < noutput_items; i++) {
-            index = *in++;
-            *out++ = m_qpsk[index & 0x3];
-          }
-          break;
+      zero = gr_complex(0.0, 0.0);
+
+      if (signal_interpolation == INTERPOLATION_OFF) {
+        switch (signal_constellation) {
+          case MOD_QPSK:
+            for (int i = 0; i < noutput_items; i++) {
+              index = *in++;
+              *out++ = m_qpsk[index & 0x3];
+            }
+            break;
+          case MOD_8PSK:
+          case MOD_8APSK:
+            for (int i = 0; i < noutput_items; i++) {
+              index = *in++;
+              *out++ = m_8psk[index & 0x7];
+            }
+            break;
+          case MOD_16APSK:
+          case MOD_8_8APSK:
+            for (int i = 0; i < noutput_items; i++) {
+              index = *in++;
+              *out++ = m_16apsk[index & 0xf];
+            }
+            break;
+          case MOD_32APSK:
+          case MOD_4_12_16APSK:
+          case MOD_4_8_4_16APSK:
+            for (int i = 0; i < noutput_items; i++) {
+              index = *in++;
+              *out++ = m_32apsk[index & 0x1f];
+            }
+            break;
+          case MOD_64APSK:
+          case MOD_8_16_20_20APSK:
+          case MOD_4_12_20_28APSK:
+            for (int i = 0; i < noutput_items; i++) {
+              index = *in++;
+              *out++ = m_64apsk[index & 0x3f];
+            }
+            break;
+          case MOD_128APSK:
+            for (int i = 0; i < noutput_items; i++) {
+              index = *in++;
+              *out++ = m_128apsk[index & 0x7f];
+            }
+            break;
+          case MOD_256APSK:
+            for (int i = 0; i < noutput_items; i++) {
+              index = *in++;
+              *out++ = m_256apsk[index & 0xff];
+            }
+            break;
+          default:
+            for (int i = 0; i < noutput_items; i++) {
+              index = *in++;
+              *out++ = m_qpsk[index & 0x3];
+            }
+            break;
+        }
+      }
+      else {
+        switch (signal_constellation) {
+          case MOD_QPSK:
+            for (int i = 0; i < noutput_items / 2; i++) {
+              index = *in++;
+              *out++ = m_qpsk[index & 0x3];
+              *out++ = zero;
+            }
+            break;
+          case MOD_8PSK:
+          case MOD_8APSK:
+            for (int i = 0; i < noutput_items / 2; i++) {
+              index = *in++;
+              *out++ = m_8psk[index & 0x7];
+              *out++ = zero;
+            }
+            break;
+          case MOD_16APSK:
+          case MOD_8_8APSK:
+            for (int i = 0; i < noutput_items / 2; i++) {
+              index = *in++;
+              *out++ = m_16apsk[index & 0xf];
+              *out++ = zero;
+            }
+            break;
+          case MOD_32APSK:
+          case MOD_4_12_16APSK:
+          case MOD_4_8_4_16APSK:
+            for (int i = 0; i < noutput_items / 2; i++) {
+              index = *in++;
+              *out++ = m_32apsk[index & 0x1f];
+              *out++ = zero;
+            }
+            break;
+          case MOD_64APSK:
+          case MOD_8_16_20_20APSK:
+          case MOD_4_12_20_28APSK:
+            for (int i = 0; i < noutput_items / 2; i++) {
+              index = *in++;
+              *out++ = m_64apsk[index & 0x3f];
+              *out++ = zero;
+            }
+            break;
+          case MOD_128APSK:
+            for (int i = 0; i < noutput_items / 2; i++) {
+              index = *in++;
+              *out++ = m_128apsk[index & 0x7f];
+              *out++ = zero;
+            }
+            break;
+          case MOD_256APSK:
+            for (int i = 0; i < noutput_items / 2; i++) {
+              index = *in++;
+              *out++ = m_256apsk[index & 0xff];
+              *out++ = zero;
+            }
+            break;
+          default:
+            for (int i = 0; i < noutput_items / 2; i++) {
+              index = *in++;
+              *out++ = m_qpsk[index & 0x3];
+              *out++ = zero;
+            }
+            break;
+        }
       }
 
       // Tell runtime system how many input items we consumed on
       // each input stream.
-      consume_each (noutput_items);
+      if (signal_interpolation == INTERPOLATION_OFF) {
+        consume_each (noutput_items);
+      }
+      else {
+        consume_each (noutput_items / 2);
+      }
 
       // Tell runtime system how many output items we produced.
       return noutput_items;
diff --git a/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.h 
b/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.h
index 8507878..4fdbb14 100644
--- a/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.h
+++ b/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.h
@@ -31,6 +31,7 @@ namespace gr {
     {
      private:
       int signal_constellation;
+      int signal_interpolation;
       gr_complex m_qpsk[4];
       gr_complex m_8psk[8];
       gr_complex m_16apsk[16];
@@ -40,7 +41,7 @@ namespace gr {
       gr_complex m_256apsk[256];
 
      public:
-      dvbs2_modulator_bc_impl(dvb_framesize_t framesize, dvb_code_rate_t rate, 
dvb_constellation_t constellation);
+      dvbs2_modulator_bc_impl(dvb_framesize_t framesize, dvb_code_rate_t rate, 
dvb_constellation_t constellation, dvbs2_interpolation_t interpolation);
       ~dvbs2_modulator_bc_impl();
 
       void forecast (int noutput_items, gr_vector_int &ninput_items_required);



reply via email to

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