summaryrefslogtreecommitdiff
path: root/gr-blocks/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gr-blocks/lib')
-rw-r--r--gr-blocks/lib/CMakeLists.txt7
-rw-r--r--gr-blocks/lib/message_burst_source_impl.cc149
-rw-r--r--gr-blocks/lib/message_burst_source_impl.h58
-rw-r--r--gr-blocks/lib/message_sink_impl.cc132
-rw-r--r--gr-blocks/lib/message_sink_impl.h56
-rw-r--r--gr-blocks/lib/message_source_impl.cc151
-rw-r--r--gr-blocks/lib/message_source_impl.h62
-rw-r--r--gr-blocks/lib/nlog10_ff_impl.cc30
-rw-r--r--gr-blocks/lib/nlog10_ff_impl.h4
-rw-r--r--gr-blocks/lib/pdu_to_tagged_stream_impl.cc5
10 files changed, 30 insertions, 624 deletions
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
index 1d69f27a1d..1f3b0ee041 100644
--- a/gr-blocks/lib/CMakeLists.txt
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -140,11 +140,8 @@ list(APPEND gr_blocks_sources
keep_one_in_n_impl.cc
lfsr_32k_source_s_impl.cc
message_debug_impl.cc
- message_sink_impl.cc
- message_source_impl.cc
message_strobe_impl.cc
message_strobe_random_impl.cc
- message_burst_source_impl.cc
multiply_cc_impl.cc
multiply_ff_impl.cc
multiply_conjugate_cc_impl.cc
@@ -259,7 +256,7 @@ add_library(gnuradio-blocks SHARED ${gr_blocks_sources})
add_dependencies(gnuradio-blocks blocks_generated_includes)
target_link_libraries(gnuradio-blocks ${blocks_libs})
-GR_LIBRARY_FOO(gnuradio-blocks RUNTIME_COMPONENT "blocks_runtime" DEVEL_COMPONENT "blocks_devel")
+GR_LIBRARY_FOO(gnuradio-blocks)
if(ENABLE_STATIC_LIBS)
# Remove controlport-specific source files from staticlibs build
@@ -290,7 +287,7 @@ if(ENABLE_STATIC_LIBS)
endif(NOT WIN32)
install(TARGETS gnuradio-blocks_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "blocks_devel" # .lib file
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
)
endif(ENABLE_STATIC_LIBS)
diff --git a/gr-blocks/lib/message_burst_source_impl.cc b/gr-blocks/lib/message_burst_source_impl.cc
deleted file mode 100644
index 0ce0a9284f..0000000000
--- a/gr-blocks/lib/message_burst_source_impl.cc
+++ /dev/null
@@ -1,149 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012-2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "message_burst_source_impl.h"
-#include <gnuradio/io_signature.h>
-#include <cstdio>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdexcept>
-#include <string.h>
-#include <gnuradio/tags.h>
-
-namespace gr {
- namespace blocks {
-
- message_burst_source::sptr
- message_burst_source::make(size_t itemsize, int msgq_limit)
- {
- return gnuradio::get_initial_sptr
- (new message_burst_source_impl(itemsize, msgq_limit));
- }
-
- message_burst_source::sptr
- message_burst_source::make(size_t itemsize, msg_queue::sptr msgq)
- {
- return gnuradio::get_initial_sptr
- (new message_burst_source_impl(itemsize, msgq));
- }
-
- message_burst_source_impl::message_burst_source_impl(size_t itemsize, int msgq_limit)
- : sync_block("message_burst_source",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, itemsize)),
- d_itemsize(itemsize), d_msgq(msg_queue::make(msgq_limit)),
- d_msg_offset(0), d_eof(false)
- {
- std::stringstream id;
- id << name() << unique_id();
- d_me = pmt::string_to_symbol(id.str());
- }
-
- message_burst_source_impl::message_burst_source_impl(size_t itemsize, msg_queue::sptr msgq)
- : sync_block("message_burst_source",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, itemsize)),
- d_itemsize(itemsize), d_msgq(msgq),
- d_msg_offset(0), d_eof(false)
- {
- std::stringstream id;
- id << name() << unique_id();
- d_me = pmt::string_to_symbol(id.str());
- }
-
- message_burst_source_impl::~message_burst_source_impl()
- {
- }
-
- int
- message_burst_source_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- char *out = (char*)output_items[0];
- int nn = 0;
-
- uint64_t abs_sample_count = nitems_written(0);
-
- while(nn < noutput_items) {
- if(d_msg) {
- //
- // Consume whatever we can from the current message
- //
-
- int mm = std::min(noutput_items - nn,
- (int)((d_msg->length() - d_msg_offset) / d_itemsize));
- memcpy(out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize);
-
- nn += mm;
- out += mm * d_itemsize;
- d_msg_offset += mm * d_itemsize;
- assert(d_msg_offset <= d_msg->length());
-
- if(d_msg_offset == d_msg->length()) {
- if(d_msg->type() == 1) // type == 1 sets EOF
- d_eof = true;
- d_msg.reset();
- //tag end of burst
- add_item_tag(0, //stream ID
- abs_sample_count+nn-1, //sample number
- pmt::string_to_symbol("tx_eob"),
- pmt::from_bool(1),
- d_me); //block src id
- }
- }
- else {
- //
- // No current message
- //
- if(d_msgq->empty_p() && nn > 0) { // no more messages in the queue, return what we've got
- break;
- }
-
- if(d_eof)
- return -1;
-
- d_msg = d_msgq->delete_head(); // block, waiting for a message
- d_msg_offset = 0;
- //tag start of burst
- add_item_tag(0, //stream ID
- abs_sample_count+nn, //sample number
- pmt::string_to_symbol("tx_sob"),
- pmt::from_bool(1),
- d_me); //block src id
-
- if((d_msg->length() % d_itemsize) != 0)
- throw std::runtime_error("msg length is not a multiple of d_itemsize");
- }
- }
-
- return nn;
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/message_burst_source_impl.h b/gr-blocks/lib/message_burst_source_impl.h
deleted file mode 100644
index a389a23942..0000000000
--- a/gr-blocks/lib/message_burst_source_impl.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2012-2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_MESSAGE_BURST_SOURCE_IMPL_H
-#define INCLUDED_GR_MESSAGE_BURST_SOURCE_IMPL_H
-
-#include <gnuradio/blocks/message_burst_source.h>
-#include <gnuradio/message.h>
-
-namespace gr {
- namespace blocks {
-
- class message_burst_source_impl : public message_burst_source
- {
- private:
- size_t d_itemsize;
- msg_queue::sptr d_msgq;
- message::sptr d_msg;
- unsigned d_msg_offset;
- bool d_eof;
-
- pmt::pmt_t d_me;
-
- public:
- message_burst_source_impl(size_t itemsize, int msgq_limit);
- message_burst_source_impl(size_t itemsize, msg_queue::sptr msgq);
- ~message_burst_source_impl();
-
- msg_queue::sptr msgq() const { return d_msgq; }
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_GR_MESSAGE_BURST_SOURCE_IMPL_H */
diff --git a/gr-blocks/lib/message_sink_impl.cc b/gr-blocks/lib/message_sink_impl.cc
deleted file mode 100644
index 3dc4102c48..0000000000
--- a/gr-blocks/lib/message_sink_impl.cc
+++ /dev/null
@@ -1,132 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2010,2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "message_sink_impl.h"
-#include <gnuradio/io_signature.h>
-#include <cstdio>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdexcept>
-#include <string.h>
-
-namespace gr {
- namespace blocks {
-
- message_sink::sptr
- message_sink::make(size_t itemsize, msg_queue::sptr msgq, bool dont_block)
- {
- return gnuradio::get_initial_sptr
- (new message_sink_impl(itemsize, msgq, dont_block));
- }
-
- message_sink::sptr
- message_sink::make(size_t itemsize, msg_queue::sptr msgq, bool dont_block,
- const std::string& lengthtagname)
- {
- return gnuradio::get_initial_sptr
- (new message_sink_impl(itemsize, msgq, dont_block, lengthtagname));
- }
-
- message_sink_impl::message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block)
- : sync_block("message_sink",
- io_signature::make(1, 1, itemsize),
- io_signature::make(0, 0, 0)),
- d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block),
- d_tags(false), d_items_read(0)
- {
- }
-
- message_sink_impl::message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block,
- const std::string& lengthtagname)
- : sync_block("message_sink",
- io_signature::make(1, 1, itemsize),
- io_signature::make(0, 0, 0)),
- d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block),
- d_tags(true), d_lengthtagname(lengthtagname), d_items_read(0)
- {
- }
-
- message_sink_impl::~message_sink_impl()
- {
- }
-
- int
- message_sink_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- const char *in = (const char *) input_items[0];
-
- if (d_tags) {
- long packet_length = 0;
- std::vector<tag_t> tags;
- this->get_tags_in_range(tags, 0, d_items_read, d_items_read+1);
- //const size_t ninput_items = noutput_items; //assumption for sync block, this can change
- for (unsigned int i = 0; i < tags.size(); i++) {
- if (pmt::symbol_to_string(tags[i].key) == d_lengthtagname) {
- packet_length = pmt::to_long(tags[i].value);
- }
- }
- assert(packet_length != 0);
-
- // FIXME run this multiple times if input_items >= N * packet_length
- if (noutput_items >= packet_length ) {
- // If the message queue is full we drop the packet.
- if (!d_msgq->full_p()) {
- message::sptr msg = message::make(0, // msg type
- d_itemsize, // arg1 for other end
- packet_length, // arg2 for other end (redundant)
- packet_length * d_itemsize); // len of msg
- memcpy(msg->msg(), in, packet_length * d_itemsize);
- d_msgq->handle(msg); // send it
- }
- d_items_read += packet_length;
- return packet_length;
- } else {
- return 0;
- }
- } else {
- // If the queue if full we drop all the data we got.
- if (!d_msgq->full_p()) {
- // build a message to hold whatever we've got
- message::sptr msg = message::make(0, // msg type
- d_itemsize, // arg1 for other end
- noutput_items, // arg2 for other end (redundant)
- noutput_items * d_itemsize); // len of msg
- memcpy(msg->msg(), in, noutput_items * d_itemsize);
-
- d_msgq->handle(msg); // send it
- }
-
- return noutput_items;
- }
- }
-
- } /* namespace blocks */
-} /* namespace gr */
-
diff --git a/gr-blocks/lib/message_sink_impl.h b/gr-blocks/lib/message_sink_impl.h
deleted file mode 100644
index e0ae3d00c0..0000000000
--- a/gr-blocks/lib/message_sink_impl.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_MESSAGE_SINK_IMPL_H
-#define INCLUDED_GR_MESSAGE_SINK_IMPL_H
-
-#include <gnuradio/blocks/message_sink.h>
-
-namespace gr {
- namespace blocks {
-
- class message_sink_impl : public message_sink
- {
- private:
- size_t d_itemsize;
- msg_queue::sptr d_msgq;
- bool d_dont_block;
- bool d_tags;
- std::string d_lengthtagname;
- uint64_t d_items_read;
-
- public:
- message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block);
- message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block,
- const std::string& lengthtagname);
-
- ~message_sink_impl();
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_GR_MESSAGE_SINK_IMPL_H */
diff --git a/gr-blocks/lib/message_source_impl.cc b/gr-blocks/lib/message_source_impl.cc
deleted file mode 100644
index b4e9ba6ed7..0000000000
--- a/gr-blocks/lib/message_source_impl.cc
+++ /dev/null
@@ -1,151 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2010,2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "message_source_impl.h"
-#include <gnuradio/io_signature.h>
-#include <cstdio>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdexcept>
-#include <string.h>
-
-namespace gr {
- namespace blocks {
-
- message_source::sptr
- message_source::make(size_t itemsize, int msgq_limit)
- {
- return gnuradio::get_initial_sptr
- (new message_source_impl(itemsize, msgq_limit));
- }
-
- message_source::sptr
- message_source::make(size_t itemsize, msg_queue::sptr msgq)
- {
- return gnuradio::get_initial_sptr
- (new message_source_impl(itemsize, msgq));
- }
-
- message_source::sptr
- message_source::make(size_t itemsize, msg_queue::sptr msgq,
- const std::string& lengthtagname)
- {
- return gnuradio::get_initial_sptr
- (new message_source_impl(itemsize, msgq, lengthtagname));
- }
-
- message_source_impl::message_source_impl(size_t itemsize, int msgq_limit)
- : sync_block("message_source",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, itemsize)),
- d_itemsize(itemsize), d_msgq(msg_queue::make(msgq_limit)),
- d_msg_offset(0), d_eof(false), d_tags(false)
- {
- }
-
- message_source_impl::message_source_impl(size_t itemsize, msg_queue::sptr msgq)
- : sync_block("message_source",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, itemsize)),
- d_itemsize(itemsize), d_msgq(msgq),
- d_msg_offset(0), d_eof(false), d_tags(false)
- {
- }
-
- message_source_impl::message_source_impl(size_t itemsize, msg_queue::sptr msgq,
- const std::string& lengthtagname)
- : sync_block("message_source",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, itemsize)),
- d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false),
- d_tags(true), d_lengthtagname(lengthtagname)
- {
- }
-
- message_source_impl::~message_source_impl()
- {
- }
-
- int
- message_source_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- char *out = (char*)output_items[0];
- int nn = 0;
-
- while(nn < noutput_items) {
- if (d_msg){
- //
- // Consume whatever we can from the current message
- //
- int mm = std::min(noutput_items - nn, (int)((d_msg->length() - d_msg_offset) / d_itemsize));
- memcpy (out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize);
-
- if (d_tags && (d_msg_offset == 0)) {
- const uint64_t offset = this->nitems_written(0) + nn;
- pmt::pmt_t key = pmt::string_to_symbol(d_lengthtagname);
- pmt::pmt_t value = pmt::from_long(d_msg->length());
- this->add_item_tag(0, offset, key, value);
- }
- nn += mm;
- out += mm * d_itemsize;
- d_msg_offset += mm * d_itemsize;
- assert(d_msg_offset <= d_msg->length());
-
- if (d_msg_offset == d_msg->length()){
- if (d_msg->type() == 1) // type == 1 sets EOF
- d_eof = true;
- d_msg.reset();
- }
- }
- else {
- //
- // No current message
- //
- if (d_msgq->empty_p() && nn > 0){ // no more messages in the queue, return what we've got
- break;
- }
-
- if (d_eof)
- return -1;
-
- d_msg = d_msgq->delete_head(); // block, waiting for a message
- d_msg_offset = 0;
-
- if ((d_msg->length() % d_itemsize) != 0)
- throw std::runtime_error("msg length is not a multiple of d_itemsize");
- }
-
- }
-
- return nn;
- }
-
- } /* namespace blocks */
-} /* namespace gr */
diff --git a/gr-blocks/lib/message_source_impl.h b/gr-blocks/lib/message_source_impl.h
deleted file mode 100644
index bbc8f728d5..0000000000
--- a/gr-blocks/lib/message_source_impl.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_MESSAGE_SOURCE_IMPL_H
-#define INCLUDED_GR_MESSAGE_SOURCE_IMPL_H
-
-#include <gnuradio/blocks/message_source.h>
-#include <gnuradio/message.h>
-
-namespace gr {
- namespace blocks {
-
- class message_source_impl : public message_source
- {
- private:
- size_t d_itemsize;
- msg_queue::sptr d_msgq;
- message::sptr d_msg;
- unsigned d_msg_offset;
- bool d_eof;
- bool d_tags;
- // FIXME: Is this adequate tagname length.
- std::string d_lengthtagname;
-
- public:
- message_source_impl(size_t itemsize, int msgq_limit);
- message_source_impl(size_t itemsize, msg_queue::sptr msgq);
- message_source_impl(size_t itemsize, msg_queue::sptr msgq,
- const std::string& lengthtagname);
-
- ~message_source_impl();
-
- msg_queue::sptr msgq() const { return d_msgq; }
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } /* namespace blocks */
-} /* namespace gr */
-
-#endif /* INCLUDED_GR_MESSAGE_SOURCE_IMPL_H */
diff --git a/gr-blocks/lib/nlog10_ff_impl.cc b/gr-blocks/lib/nlog10_ff_impl.cc
index bed2da4d0d..5bc234f2cb 100644
--- a/gr-blocks/lib/nlog10_ff_impl.cc
+++ b/gr-blocks/lib/nlog10_ff_impl.cc
@@ -26,6 +26,7 @@
#include "nlog10_ff_impl.h"
#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
namespace gr {
namespace blocks {
@@ -39,8 +40,23 @@ namespace gr {
: sync_block("nlog10_ff",
io_signature::make (1, 1, sizeof(float)*vlen),
io_signature::make (1, 1, sizeof(float)*vlen)),
- d_n(n), d_vlen(vlen), d_k(k)
+ d_vlen(vlen)
{
+ setk(k);
+ setn(n);
+ //TODO message handlers
+ }
+
+ void
+ nlog10_ff_impl::setk(float k)
+ {
+ d_k = k;
+ }
+
+ void
+ nlog10_ff_impl::setn(float n)
+ {
+ d_prefactor = n / log2f(10.0f);
}
int
@@ -51,12 +67,14 @@ namespace gr {
const float *in = (const float *) input_items[0];
float *out = (float *) output_items[0];
int noi = noutput_items * d_vlen;
- float n = d_n;
- float k = d_k;
-
- for (int i = 0; i < noi; i++)
- out[i] = n * log10(std::max(in[i], (float) 1e-18)) + k;
+ volk_32f_log2_32f(out, in, noi);
+ volk_32f_s32f_multiply_32f(out, out, d_prefactor, noi);
+ if(d_k != 0.0f) {
+ for(int i = 0; i < noi; ++i) {
+ out[i] += d_k;
+ }
+ }
return noutput_items;
}
diff --git a/gr-blocks/lib/nlog10_ff_impl.h b/gr-blocks/lib/nlog10_ff_impl.h
index dd260bea1f..21c64d42f5 100644
--- a/gr-blocks/lib/nlog10_ff_impl.h
+++ b/gr-blocks/lib/nlog10_ff_impl.h
@@ -30,12 +30,14 @@ namespace gr {
class BLOCKS_API nlog10_ff_impl : public nlog10_ff
{
- float d_n;
+ float d_prefactor;
size_t d_vlen;
float d_k;
public:
nlog10_ff_impl(float n, size_t vlen, float k);
+ void setn(float n);
+ void setk(float k);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
diff --git a/gr-blocks/lib/pdu_to_tagged_stream_impl.cc b/gr-blocks/lib/pdu_to_tagged_stream_impl.cc
index aec5d335c4..0c48442fa7 100644
--- a/gr-blocks/lib/pdu_to_tagged_stream_impl.cc
+++ b/gr-blocks/lib/pdu_to_tagged_stream_impl.cc
@@ -52,10 +52,7 @@ namespace gr {
int pdu_to_tagged_stream_impl::calculate_output_stream_length(const gr_vector_int &)
{
if (d_curr_len == 0) {
- /* FIXME: This blocking call is far from ideal but is the best we
- * can do at the moment
- */
- pmt::pmt_t msg(delete_head_blocking(PDU_PORT_ID, 100));
+ pmt::pmt_t msg(delete_head_nowait(PDU_PORT_ID));
if (msg.get() == NULL) {
return 0;
}