[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/43: gnuradio-runtime:: removed the indiv
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/43: gnuradio-runtime:: removed the individual port setting on hier_block2, current operation assuming the buffers are being set for latency and therefore all blocks are being set to a small amount |
Date: |
Thu, 2 Apr 2015 19:15:49 +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 266557129cefa2d9144ae0db554ca4ac76ae974f
Author: Bill Clark <address@hidden>
Date: Tue Mar 31 20:12:00 2015 -0400
gnuradio-runtime:: removed the individual port setting on hier_block2,
current operation assuming the buffers are being set for latency and therefore
all blocks are being set to a small amount
---
gnuradio-runtime/include/gnuradio/hier_block2.h | 30 +++++----
gnuradio-runtime/lib/hier_block2.cc | 84 ++++++++++++++-----------
gnuradio-runtime/lib/hier_block2_detail.cc | 57 +++++++++++------
gnuradio-runtime/swig/hier_block2.i | 2 -
4 files changed, 103 insertions(+), 70 deletions(-)
diff --git a/gnuradio-runtime/include/gnuradio/hier_block2.h
b/gnuradio-runtime/include/gnuradio/hier_block2.h
index 01c18e0..e547d2f 100644
--- a/gnuradio-runtime/include/gnuradio/hier_block2.h
+++ b/gnuradio-runtime/include/gnuradio/hier_block2.h
@@ -57,6 +57,7 @@ namespace gr {
*/
hier_block2_detail *d_detail;
+ // Track output buffer min/max settings
std::vector<long> d_max_output_buffer;
std::vector<long> d_min_output_buffer;
@@ -176,7 +177,7 @@ namespace gr {
/*!
* \brief Returns max buffer size on output port \p i.
*/
- long max_output_buffer(size_t i);
+ long max_output_buffer(size_t i=0);
/*!
* \brief Sets max buffer size on all output ports.
@@ -184,24 +185,15 @@ namespace gr {
void set_max_output_buffer(long max_output_buffer);
/*!
- * \brief Sets max buffer size on output port \p port.
- */
- void set_max_output_buffer(int port, long max_output_buffer);
-
- /*!
* \brief Returns min buffer size on output port \p i.
*/
- long min_output_buffer(size_t i);
+ long min_output_buffer(size_t i=0);
/*!
* \brief Sets min buffer size on all output ports.
*/
void set_min_output_buffer(long min_output_buffer);
- /*!
- * \brief Sets min buffer size on output port \p port.
- */
- void set_min_output_buffer(int port, long min_output_buffer);
// This is a public method for ease of code organization, but should be
// ignored by the user.
@@ -266,6 +258,22 @@ namespace gr {
* call could be misleading.
*/
std::vector<int> processor_affinity();
+
+ /*!
+ * \brief Get if all block buffers should be set.
+ *
+ * \details this returns whether all the block min output buffers
+ * should be set or just the block ports connected to the hier ports.
+ */
+ bool set_all_min_output_buffer(void);
+
+ /*!
+ * \brief Get if all block buffers should be set.
+ *
+ * \details this returns whether all the block max output buffers
+ * should be set or just the block ports connected to the hier ports.
+ */
+ bool set_all_max_output_buffer(void);
};
/*!
diff --git a/gnuradio-runtime/lib/hier_block2.cc
b/gnuradio-runtime/lib/hier_block2.cc
index 4345e2d..5793e1c 100644
--- a/gnuradio-runtime/lib/hier_block2.cc
+++ b/gnuradio-runtime/lib/hier_block2.cc
@@ -185,64 +185,74 @@ namespace gr {
}
long
- hier_block2::max_output_buffer(size_t i)
+ hier_block2::max_output_buffer(size_t i=0)
{
- /*if(i >= d_max_output_buffer.size())
- throw std::invalid_argument("basic_block::max_output_buffer: port out of
range.");
- return d_max_output_buffer[i];*/
- if(d_max_output_buffer.size() == 0)
+ if(d_max_output_buffer.size() <= i)
throw std::invalid_argument("hier_block2::max_output_buffer: port out of
range.");
- return d_max_output_buffer[0];
+ return d_max_output_buffer[i];
}
void
hier_block2::set_max_output_buffer(long max_output_buffer)
{
- /*for(int i = 0; i < output_signature()->max_streams(); i++) {
- set_max_output_buffer(i, max_output_buffer);
- }*/
if(output_signature()->max_streams()>0)
- set_max_output_buffer(0,max_output_buffer);
- }
-
- void
- hier_block2::set_max_output_buffer(int port, long max_output_buffer)
- {
- if((size_t)port >= d_max_output_buffer.size())
- d_max_output_buffer.push_back(max_output_buffer);
- else
- d_max_output_buffer[port] = max_output_buffer;
+ {
+ if(d_max_output_buffer.size() == 0)
+ throw std::length_error("hier_block2::max_output_buffer: out_sig
greater than zero, buff_vect isn't");
+ for(int idx = 0; idx < output_signature()->max_streams(); idx++)
+ d_max_output_buffer[idx] = max_output_buffer;
+ }
}
long
- hier_block2::min_output_buffer(size_t i)
+ hier_block2::min_output_buffer(size_t i=0)
{
- /*if(i >= d_min_output_buffer.size())
- throw std::invalid_argument("basic_block::min_output_buffer: port out of
range.");
- return d_min_output_buffer[i];*/
- if(d_min_output_buffer.size() == 0)
+ if(d_min_output_buffer.size() <= i)
throw std::invalid_argument("hier_block2::min_output_buffer: port out of
range.");
- return d_min_output_buffer[0];
+ return d_min_output_buffer[i];
}
void
hier_block2::set_min_output_buffer(long min_output_buffer)
{
- /*std::cout << "set_min_output_buffer on block " << unique_id() << " to "
<< min_output_buffer << std::endl;
- for(int i=0; i<output_signature()->max_streams(); i++) {
- set_min_output_buffer(i, min_output_buffer);
- }*/
if(output_signature()->max_streams()>0)
- set_min_output_buffer(0,min_output_buffer);
+ {
+ if(d_min_output_buffer.size() == 0)
+ throw std::length_error("hier_block2::min_output_buffer: out_sig
greater than zero, buff_vect isn't");
+ for(int idx = 0; idx < output_signature()->max_streams(); idx++)
+ d_min_output_buffer[idx] = min_output_buffer;
+ }
}
-
- void
- hier_block2::set_min_output_buffer(int port, long min_output_buffer)
+
+ bool
+ hier_block2::set_all_min_output_buffer(void)
{
- if((size_t)port >= d_min_output_buffer.size())
- d_min_output_buffer.push_back(min_output_buffer);
- else
- d_min_output_buffer[port] = min_output_buffer;
+ if(d_min_output_buffer.size() > 0){
+ bool all_equal = true;
+ for(int idx = 1; (idx < d_min_output_buffer.size()) && all_equal; idx++){
+ if(d_min_output_buffer[0] != d_min_output_buffer[idx])
+ all_equal = false;
+ }
+ return all_equal;
+ }
+ else{
+ return false;
+ }
+ }
+ bool
+ hier_block2::set_all_max_output_buffer(void)
+ {
+ if(d_max_output_buffer.size() > 0){
+ bool all_equal = true;
+ for(int idx = 1; (idx < d_max_output_buffer.size()) && all_equal; idx++){
+ if(d_max_output_buffer[0] != d_max_output_buffer[idx])
+ all_equal = false;
+ }
+ return all_equal;
+ }
+ else{
+ return false;
+ }
}
} /* namespace gr */
diff --git a/gnuradio-runtime/lib/hier_block2_detail.cc
b/gnuradio-runtime/lib/hier_block2_detail.cc
index 8f7f6db..7210dca 100644
--- a/gnuradio-runtime/lib/hier_block2_detail.cc
+++ b/gnuradio-runtime/lib/hier_block2_detail.cc
@@ -514,8 +514,19 @@ namespace gr {
// Only run setup_rpc if ControlPort config param is enabled.
bool ctrlport_on = prefs::singleton()->get_bool("ControlPort", "on",
false);
- long min_buff = d_owner->min_output_buffer(0);
- long max_buff = d_owner->max_output_buffer(0);
+ // Get the min and max buffer length
+ // TODO: Currently assuming all blocks within hier
+ // are set to the first port value. (latency case)
+ // Address the condition where only the block connected
+ // to a specific hier port is modified by the hier port assignment
+ // TODO: handle the connect port only case
+ long min_buff(-1), max_buff(-1);
+ bool set_all_min_buff = d_owner->set_all_min_output_buffer();
+ bool set_all_max_buff = d_owner->set_all_max_output_buffer();
+ if(set_all_min_buff)
+ min_buff = d_owner->min_output_buffer();
+ if(set_all_max_buff)
+ max_buff = d_owner->max_output_buffer();
// For every block (gr::block and gr::hier_block2), set up the RPC
// interface.
@@ -529,27 +540,33 @@ namespace gr {
b->rpc_set();
}
}
- if(min_buff != -1){
- block_sptr bb = boost::dynamic_pointer_cast<block>(b);
- if(bb != 0){
- bb->set_min_output_buffer(min_buff);
- }
- else{
- hier_block2_sptr hh = boost::dynamic_pointer_cast<hier_block2>(b);
- if(hh != 0){
- hh->set_min_output_buffer(min_buff);
+ if(set_all_min_buff){
+ //sets the min buff for every block within hier_block2
+ if(min_buff != -1){
+ block_sptr bb = boost::dynamic_pointer_cast<block>(b);
+ if(bb != 0){
+ bb->set_min_output_buffer(min_buff);
+ }
+ else{
+ hier_block2_sptr hh = boost::dynamic_pointer_cast<hier_block2>(b);
+ if(hh != 0){
+ hh->set_min_output_buffer(min_buff);
+ }
}
}
}
- if(max_buff != -1){
- block_sptr bb = boost::dynamic_pointer_cast<block>(b);
- if(bb != 0){
- bb->set_max_output_buffer(max_buff);
- }
- else{
- hier_block2_sptr hh = boost::dynamic_pointer_cast<hier_block2>(b);
- if(hh != 0){
- hh->set_max_output_buffer(max_buff);
+ if(set_all_max_buff){
+ //sets the max buff for every block within hier_block2
+ if(max_buff != -1){
+ block_sptr bb = boost::dynamic_pointer_cast<block>(b);
+ if(bb != 0){
+ bb->set_max_output_buffer(max_buff);
+ }
+ else{
+ hier_block2_sptr hh = boost::dynamic_pointer_cast<hier_block2>(b);
+ if(hh != 0){
+ hh->set_max_output_buffer(max_buff);
+ }
}
}
}
diff --git a/gnuradio-runtime/swig/hier_block2.i
b/gnuradio-runtime/swig/hier_block2.i
index d2a33b4..fbe44dc 100644
--- a/gnuradio-runtime/swig/hier_block2.i
+++ b/gnuradio-runtime/swig/hier_block2.i
@@ -94,10 +94,8 @@ namespace gr {
// Methods to manage block's min/max buffer sizes.
long max_output_buffer(int i);
void set_max_output_buffer(long max_output_buffer);
- void set_max_output_buffer(int port, long max_output_buffer);
long min_output_buffer(int i);
void set_min_output_buffer(long min_output_buffer);
- void set_min_output_buffer(int port, long min_output_buffer);
gr::hier_block2_sptr to_hier_block2(); // Needed for Python type coercion
};
- [Commit-gnuradio] [gnuradio] 15/43: fec: ldpc encoder now working in async encoder interface, (continued)
- [Commit-gnuradio] [gnuradio] 15/43: fec: ldpc encoder now working in async encoder interface, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 06/43: gnuradio-runtime: (option 1) The hier block can now take a generic min/max output buffer length and assign it to every block within the hier (assumes all output buffers have the same min/max values set); (option 2) sets only the blocks connected to hier output ports and does not set the other internal blocks (requires that each port has different values); for single port output hier blocks only option 1 is possible., git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 07/43: gnuradio-runtime: non-helpful debug outputs removed from hier_block2 and hier_block2_detail, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 27/43: grc: optional thread-safe setters in generated code (#748), git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 19/43: gnuradio-runtime: added logger to flat_flowgraph and print out a warning for when the max_output_buffer isn't set to the requested value, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 28/43: grc: don't try to open missing files, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 01/43: gnuradio-runtime: trying to see if this will handle the output buffer size of hier blocks; trying to find the proper casting methods, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 10/43: fec: cleaning up LDPC warnings, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 18/43: fec: ldpc works, add iterations meta tag, etc, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 34/43: Merge remote-tracking branch 'saikwolf/logging_flat_flowgraph', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 03/43: gnuradio-runtime:: removed the individual port setting on hier_block2, current operation assuming the buffers are being set for latency and therefore all blocks are being set to a small amount,
git <=
- [Commit-gnuradio] [gnuradio] 11/43: fec: LDPC cleaning up comments, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 30/43: grc: clean-up 'gnuradio-companion', add mode 'run from source', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 12/43: fec: re-shuffling LDPC make helper, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 31/43: grc: PropsDialog: apply button and hotkey (Ctrl+Enter), git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 40/43: fec: Move the definition of yp_kernel from the class into a temp variable in the main code. This variable is used just to find the actual Volk kernel, and its current use is not c++11 complaint. Moving it makes the code c++11 complaint on both GCC / libstdc++ and Clang / libc++., git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 35/43: Merge remote-tracking branch 'osh/ldpc_add', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 20/43: grc: Reworked save confirmation dialog to allow cancel option, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 42/43: Merge remote-tracking branch 'michaelld/misc_fixes', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 29/43: grc: move context def into Bars.py and add submenu, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 14/43: gnuradio-runtime: modified buffer length types to size_t, moved buffer length vectors into detail, git, 2015/04/02