summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Economos <w6rz@comcast.net>2015-12-28 14:39:34 -0800
committerRon Economos <w6rz@comcast.net>2015-12-28 14:39:34 -0800
commit443ae06e052cbd878b90e51c278d850feaf90cdd (patch)
tree435eb2e59ae8ae24fb15ce8a5068b7e4c7fc5fe8
parent9dccface365ce9dcf1407782008a58267360c6a6 (diff)
Add 2X interpolation capability to DVB-S2 modulator.
-rw-r--r--gr-dtv/grc/dtv_dvbs2_modulator_bc.xml17
-rw-r--r--gr-dtv/include/gnuradio/dtv/dvbs2_config.h6
-rw-r--r--gr-dtv/include/gnuradio/dtv/dvbs2_modulator_bc.h3
-rw-r--r--gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.cc202
-rw-r--r--gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.h3
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 1f7fef09a3..c57ad324ae 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 919c7de155..079857a8cf 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 68e5403e05..d59d3efda1 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 c8579d1c1e..e74414a113 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 8507878b0e..4fdbb149df 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);