summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.h3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc23
2 files changed, 26 insertions, 0 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h
index e8e393756..9478e1ce0 100644
--- a/gnuradio-core/src/lib/runtime/gr_buffer.h
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.h
@@ -93,6 +93,7 @@ class GR_CORE_API gr_buffer {
uint64_t nitems_written() { return d_abs_write_offset; }
+ size_t get_sizeof_item() { return d_sizeof_item; }
/*!
* \brief Adds a new tag to the buffer.
@@ -249,6 +250,8 @@ class GR_CORE_API gr_buffer_reader {
uint64_t nitems_read() { return d_abs_read_offset; }
+ size_t get_sizeof_item() { return d_buffer->get_sizeof_item(); }
+
/*!
* \brief Return the block that reads via this reader.
*
diff --git a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
index 5d1057e0f..e97fa13a4 100644
--- a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
+++ b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
@@ -28,6 +28,7 @@
#include <gr_block_detail.h>
#include <gr_io_signature.h>
#include <gr_buffer.h>
+#include <volk/volk.h>
#include <iostream>
#include <map>
@@ -243,6 +244,28 @@ gr_flat_flowgraph::merge_connections(gr_flat_flowgraph_sptr old_ffg)
if (GR_FLAT_FLOWGRAPH_DEBUG)
std::cout << "new block" << std::endl;
connect_block_inputs(block);
+
+ const int alignment = volk_get_alignment();
+ for(int i = 0; i < block->detail()->ninputs(); i++) {
+ void *r = (void*)block->detail()->input(i)->read_pointer();
+ unsigned long int ri = (unsigned long int)r % alignment;
+ if(ri != 0) {
+ size_t itemsize = block->detail()->input(i)->get_sizeof_item();
+ block->detail()->input(i)->update_read_pointer(ri/itemsize);
+ block->set_unaligned(0);
+ block->set_is_unaligned(false);
+ }
+ }
+ for(int i = 0; i < block->detail()->noutputs(); i++) {
+ void *w = (void*)block->detail()->output(i)->write_pointer();
+ unsigned long int wi = (unsigned long int)w % alignment;
+ if(wi != 0) {
+ size_t itemsize = block->detail()->output(i)->get_sizeof_item();
+ block->detail()->output(i)->update_write_pointer(wi/itemsize);
+ block->set_unaligned(0);
+ block->set_is_unaligned(false);
+ }
+ }
}
// Now deal with the fact that the block details might have changed numbers of