summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-runtime/include/gnuradio/attributes.h8
-rw-r--r--gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.cc10
-rw-r--r--gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.cc8
-rw-r--r--gr-filter/grc/filter_fractional_resampler_xx.xml7
-rw-r--r--gr-filter/include/gnuradio/filter/fractional_resampler_cc.h5
-rw-r--r--gr-filter/include/gnuradio/filter/fractional_resampler_ff.h6
-rw-r--r--gr-filter/lib/fractional_resampler_cc_impl.cc26
-rw-r--r--gr-filter/lib/fractional_resampler_cc_impl.h2
-rw-r--r--gr-filter/lib/fractional_resampler_ff_impl.cc27
-rw-r--r--gr-filter/lib/fractional_resampler_ff_impl.h2
10 files changed, 88 insertions, 13 deletions
diff --git a/gnuradio-runtime/include/gnuradio/attributes.h b/gnuradio-runtime/include/gnuradio/attributes.h
index 0102c110c2..250683f248 100644
--- a/gnuradio-runtime/include/gnuradio/attributes.h
+++ b/gnuradio-runtime/include/gnuradio/attributes.h
@@ -81,12 +81,10 @@
////////////////////////////////////////////////////////////////////////
// implement cross-compiler VLA macros
////////////////////////////////////////////////////////////////////////
-#ifdef C99
-# define __GR_VLA(TYPE, buf, size) TYPE buf[size]
-# define __GR_VLA2D(TYPE, buf, size, size2) TYPE buf[size][size2]
-#else
+#ifdef _MSC_VER
# define __GR_VLA(TYPE, buf, size) TYPE * buf = (TYPE *) alloca(sizeof(TYPE) * (size))
-# define __GR_VLA2D(TYPE, buf, size, size2) TYPE ** buf = (TYPE **) alloca(sizeof(TYPE) * (size) * (size2))
+#else
+# define __GR_VLA(TYPE, buf, size) TYPE buf[size]
#endif
#endif /* INCLUDED_GNURADIO_ATTRIBUTES_H */
diff --git a/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.cc b/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.cc
index 9e45c81018..c10a77c98a 100644
--- a/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.cc
+++ b/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.cc
@@ -26,10 +26,13 @@
#include "dvbt_bit_inner_deinterleaver_impl.h"
#include <stdio.h>
+#define MAX_MODULATION_ORDER 6
+#define INTERLEAVER_BLOCK_SIZE 126
+
namespace gr {
namespace dtv {
- const int dvbt_bit_inner_deinterleaver_impl::d_bsize = 126;
+ const int dvbt_bit_inner_deinterleaver_impl::d_bsize = INTERLEAVER_BLOCK_SIZE;
int
dvbt_bit_inner_deinterleaver_impl::H(int e, int w)
@@ -135,9 +138,8 @@ namespace gr {
// First index of d_b is Bit interleaver number
// Second index of d_b is the position inside Bit interleaver
- // Linux: unsigned char d_b[d_v][d_bsize];
- __GR_VLA2D(unsigned char, d_b, d_v, d_bsize);
-
+ unsigned char d_b[MAX_MODULATION_ORDER][INTERLEAVER_BLOCK_SIZE];
+
for (int bcount = 0; bcount < bmax; bcount++) {
for (int w = 0; w < d_bsize; w++) {
int c = in[(bcount * d_bsize) + w];
diff --git a/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.cc b/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.cc
index a5a9847812..43146f02c5 100644
--- a/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.cc
+++ b/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.cc
@@ -26,10 +26,13 @@
#include "dvbt_bit_inner_interleaver_impl.h"
#include <stdio.h>
+#define MAX_MODULATION_ORDER 6
+#define INTERLEAVER_BLOCK_SIZE 126
+
namespace gr {
namespace dtv {
- const int dvbt_bit_inner_interleaver_impl::d_bsize = 126;
+ const int dvbt_bit_inner_interleaver_impl::d_bsize = INTERLEAVER_BLOCK_SIZE;
int
dvbt_bit_inner_interleaver_impl::H(int e, int w)
@@ -137,8 +140,7 @@ namespace gr {
// First index of d_b is Bit interleaver number
// Second index of d_b is the position inside the Bit interleaver
- // Linux: unsigned char d_b[d_v][d_bsize];
- __GR_VLA2D(unsigned char, d_b, d_v, d_bsize);
+ unsigned char d_b[MAX_MODULATION_ORDER][INTERLEAVER_BLOCK_SIZE];
for (int bcount = 0; bcount < bmax; bcount++) {
for (int i = 0; i < d_bsize; i++) {
diff --git a/gr-filter/grc/filter_fractional_resampler_xx.xml b/gr-filter/grc/filter_fractional_resampler_xx.xml
index 40957b889d..b2b4b1066c 100644
--- a/gr-filter/grc/filter_fractional_resampler_xx.xml
+++ b/gr-filter/grc/filter_fractional_resampler_xx.xml
@@ -42,7 +42,12 @@
<sink>
<name>rate</name>
<type>float</type>
- <optional>1</optional>
+ <optional>1</optional>
+ </sink>
+ <sink>
+ <name>msg_in</name>
+ <type>message</type>
+ <optional>1</optional>
</sink>
<source>
<name>out</name>
diff --git a/gr-filter/include/gnuradio/filter/fractional_resampler_cc.h b/gr-filter/include/gnuradio/filter/fractional_resampler_cc.h
index 6fde6dde8a..65e53e23f2 100644
--- a/gr-filter/include/gnuradio/filter/fractional_resampler_cc.h
+++ b/gr-filter/include/gnuradio/filter/fractional_resampler_cc.h
@@ -32,6 +32,11 @@ namespace gr {
/*!
* \brief resampling MMSE filter with complex input, complex output
* \ingroup resamplers_blk
+ *
+ * \details
+ * The resampling ratio and mu parameters can be set with a pmt dict
+ * message. Keys are pmt symbols with the strings "resamp_ratio" and "mu"
+ * and values are pmt floats.
*/
class FILTER_API fractional_resampler_cc : virtual public block
{
diff --git a/gr-filter/include/gnuradio/filter/fractional_resampler_ff.h b/gr-filter/include/gnuradio/filter/fractional_resampler_ff.h
index 9836010af5..f8d207d337 100644
--- a/gr-filter/include/gnuradio/filter/fractional_resampler_ff.h
+++ b/gr-filter/include/gnuradio/filter/fractional_resampler_ff.h
@@ -32,7 +32,13 @@ namespace gr {
/*!
* \brief Resampling MMSE filter with float input, float output
* \ingroup resamplers_blk
+ *
+ * \details
+ * The resampling ratio and mu parameters can be set with a pmt dict
+ * message. Keys are pmt symbols with the strings "resamp_ratio" and "mu"
+ * and values are pmt floats.
*/
+
class FILTER_API fractional_resampler_ff : virtual public block
{
public:
diff --git a/gr-filter/lib/fractional_resampler_cc_impl.cc b/gr-filter/lib/fractional_resampler_cc_impl.cc
index 72a2262605..4d8def70cd 100644
--- a/gr-filter/lib/fractional_resampler_cc_impl.cc
+++ b/gr-filter/lib/fractional_resampler_cc_impl.cc
@@ -52,6 +52,9 @@ namespace gr {
throw std::out_of_range("phase shift ratio must be > 0 and < 1");
set_relative_rate(1.0 / resamp_ratio);
+ message_port_register_in(pmt::intern("msg_in"));
+ set_msg_handler(pmt::intern("msg_in"), boost::bind(
+ &fractional_resampler_cc_impl::handle_msg, this, _1));
}
fractional_resampler_cc_impl::~fractional_resampler_cc_impl()
@@ -60,6 +63,29 @@ namespace gr {
}
void
+ fractional_resampler_cc_impl::handle_msg(pmt::pmt_t msg) {
+ if(!pmt::is_dict(msg))
+ return;
+ // set resamp_ratio or mu by message dict
+ if(pmt::dict_has_key(msg, pmt::intern("resamp_ratio"))) {
+ set_resamp_ratio(
+ pmt::to_float(
+ pmt::dict_ref(msg, pmt::intern("resamp_ratio"),
+ pmt::from_float(resamp_ratio()))
+ )
+ );
+ }
+ if(pmt::dict_has_key(msg, pmt::intern("mu"))) {
+ set_mu(
+ pmt::to_float(
+ pmt::dict_ref(msg, pmt::intern("mu"),
+ pmt::from_float(mu()))
+ )
+ );
+ }
+ }
+
+ void
fractional_resampler_cc_impl::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
diff --git a/gr-filter/lib/fractional_resampler_cc_impl.h b/gr-filter/lib/fractional_resampler_cc_impl.h
index d88d595370..8b7d9de317 100644
--- a/gr-filter/lib/fractional_resampler_cc_impl.h
+++ b/gr-filter/lib/fractional_resampler_cc_impl.h
@@ -42,6 +42,8 @@ namespace gr {
float resamp_ratio);
~fractional_resampler_cc_impl();
+ void handle_msg(pmt::pmt_t msg);
+
void forecast(int noutput_items,
gr_vector_int &ninput_items_required);
int general_work(int noutput_items,
diff --git a/gr-filter/lib/fractional_resampler_ff_impl.cc b/gr-filter/lib/fractional_resampler_ff_impl.cc
index 2ffccf5204..6fcd7e53d3 100644
--- a/gr-filter/lib/fractional_resampler_ff_impl.cc
+++ b/gr-filter/lib/fractional_resampler_ff_impl.cc
@@ -52,6 +52,10 @@ namespace gr {
throw std::out_of_range("phase shift ratio must be > 0 and < 1");
set_relative_rate(1.0 / resamp_ratio);
+
+ message_port_register_in(pmt::intern("msg_in"));
+ set_msg_handler(pmt::intern("msg_in"), boost::bind(
+ &fractional_resampler_ff_impl::handle_msg, this, _1));
}
fractional_resampler_ff_impl::~fractional_resampler_ff_impl()
@@ -60,6 +64,29 @@ namespace gr {
}
void
+ fractional_resampler_ff_impl::handle_msg(pmt::pmt_t msg) {
+ if(!pmt::is_dict(msg))
+ return;
+ // set resamp_ratio or mu by message dict
+ if(pmt::dict_has_key(msg, pmt::intern("resamp_ratio"))) {
+ set_resamp_ratio(
+ pmt::to_float(
+ pmt::dict_ref(msg, pmt::intern("resamp_ratio"),
+ pmt::from_float(resamp_ratio()))
+ )
+ );
+ }
+ if(pmt::dict_has_key(msg, pmt::intern("mu"))) {
+ set_mu(
+ pmt::to_float(
+ pmt::dict_ref(msg, pmt::intern("mu"),
+ pmt::from_float(mu()))
+ )
+ );
+ }
+ }
+
+ void
fractional_resampler_ff_impl::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
diff --git a/gr-filter/lib/fractional_resampler_ff_impl.h b/gr-filter/lib/fractional_resampler_ff_impl.h
index 11c9886176..cccc1be4b3 100644
--- a/gr-filter/lib/fractional_resampler_ff_impl.h
+++ b/gr-filter/lib/fractional_resampler_ff_impl.h
@@ -42,6 +42,8 @@ namespace gr {
float resamp_ratio);
~fractional_resampler_ff_impl();
+ void handle_msg(pmt::pmt_t msg);
+
void forecast(int noutput_items,
gr_vector_int &ninput_items_required);
int general_work(int noutput_items,