summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_m_in_n.cc33
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_m_in_n.h2
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_m_in_n.i2
-rw-r--r--gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc34
-rw-r--r--gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h2
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t42
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t16
-rw-r--r--gr-digital/lib/digital_ofdm_insert_preamble.cc19
8 files changed, 76 insertions, 74 deletions
diff --git a/gnuradio-core/src/lib/general/gr_keep_m_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_m_in_n.cc
index f17c3e00d..56f5931fd 100644
--- a/gnuradio-core/src/lib/general/gr_keep_m_in_n.cc
+++ b/gnuradio-core/src/lib/general/gr_keep_m_in_n.cc
@@ -30,9 +30,9 @@
#include <stdio.h>
gr_keep_m_in_n_sptr
-gr_make_keep_m_in_n (size_t item_size, int m, int n, int offset)
+gr_make_keep_m_in_n(size_t item_size, int m, int n, int offset)
{
- return gnuradio::get_initial_sptr(new gr_keep_m_in_n (item_size, m, n, offset));
+ return gnuradio::get_initial_sptr(new gr_keep_m_in_n(item_size, m, n, offset));
}
@@ -40,16 +40,16 @@ gr_make_keep_m_in_n (size_t item_size, int m, int n, int offset)
*
* offset = 0, starts with 0th item
* offset = 1, starts with 1st item, etc...
-*
+*
* we take m items out of each n
*/
-gr_keep_m_in_n::gr_keep_m_in_n (size_t item_size, int m, int n, int offset)
+gr_keep_m_in_n::gr_keep_m_in_n(size_t item_size, int m, int n, int offset)
: gr_sync_block ("keep_m_in_n",
- gr_make_io_signature (1, 1, n*item_size),
- gr_make_io_signature (1, 1, m*item_size)),
+ gr_make_io_signature(1, 1, n*item_size),
+ gr_make_io_signature(1, 1, m*item_size)),
d_n(n),
d_m(m),
- d_offset( offset )
+ d_offset(offset)
{
// sanity checking
assert(d_m > 0);
@@ -59,27 +59,28 @@ gr_keep_m_in_n::gr_keep_m_in_n (size_t item_size, int m, int n, int offset)
}
-void gr_keep_m_in_n::set_offset(int offset){
+void gr_keep_m_in_n::set_offset(int offset)
+{
d_offset = offset;
}
int
-gr_keep_m_in_n::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
+gr_keep_m_in_n::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
{
- uint8_t* out = (uint8_t*) output_items[0];
- const uint8_t* in = (const uint8_t*) input_items[0];
+ uint8_t* out = (uint8_t*)output_items[0];
+ const uint8_t* in = (const uint8_t*)input_items[0];
int in_item( input_signature()->sizeof_stream_item(0) );
int out_item( output_signature()->sizeof_stream_item(0) );
int single_size = in_item/d_n;
// iterate over data blocks of size {n, input : m, output}
- for(int i=0; i<noutput_items; i++){
- memcpy( &out[out_item*i], &in[in_item*i + single_size*d_offset], out_item);
- }
+ for(int i = 0; i < noutput_items; i++) {
+ memcpy(&out[out_item*i], &in[in_item*i + single_size*d_offset], out_item);
+ }
return noutput_items;
}
diff --git a/gnuradio-core/src/lib/general/gr_keep_m_in_n.h b/gnuradio-core/src/lib/general/gr_keep_m_in_n.h
index f9d5a268b..e627ca0ea 100644
--- a/gnuradio-core/src/lib/general/gr_keep_m_in_n.h
+++ b/gnuradio-core/src/lib/general/gr_keep_m_in_n.h
@@ -29,7 +29,7 @@
class gr_keep_m_in_n;
typedef boost::shared_ptr<gr_keep_m_in_n> gr_keep_m_in_n_sptr;
-GR_CORE_API gr_keep_m_in_n_sptr
+GR_CORE_API gr_keep_m_in_n_sptr
gr_make_keep_m_in_n (size_t item_size, int m, int n, int offset);
diff --git a/gnuradio-core/src/lib/general/gr_keep_m_in_n.i b/gnuradio-core/src/lib/general/gr_keep_m_in_n.i
index cb5c63683..de89cec2c 100644
--- a/gnuradio-core/src/lib/general/gr_keep_m_in_n.i
+++ b/gnuradio-core/src/lib/general/gr_keep_m_in_n.i
@@ -22,7 +22,7 @@
GR_SWIG_BLOCK_MAGIC(gr,keep_m_in_n)
-gr_keep_m_in_n_sptr
+gr_keep_m_in_n_sptr
gr_make_keep_m_in_n (size_t itemsize, int m, int n, int offset);
class gr_keep_m_in_n : public gr_sync_block
diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc
index 0237a4d69..bd51c2ec5 100644
--- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc
+++ b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc
@@ -29,41 +29,41 @@
#include <stdexcept>
#include <iostream>
-gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k)
+gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb(unsigned k)
{
- return gnuradio::get_initial_sptr(new gr_pack_k_bits_bb (k));
+ return gnuradio::get_initial_sptr(new gr_pack_k_bits_bb(k));
}
gr_pack_k_bits_bb::gr_pack_k_bits_bb (unsigned k)
- : gr_sync_decimator ("pack_k_bits_bb",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- k),
+ : gr_sync_decimator("pack_k_bits_bb",
+ gr_make_io_signature (1, 1, sizeof(unsigned char)),
+ gr_make_io_signature (1, 1, sizeof(unsigned char)),
+ k),
d_k (k)
{
if (d_k == 0)
- throw std::out_of_range ("interpolation must be > 0");
+ throw std::out_of_range("interpolation must be > 0");
}
-gr_pack_k_bits_bb::~gr_pack_k_bits_bb ()
+gr_pack_k_bits_bb::~gr_pack_k_bits_bb()
{
}
int
-gr_pack_k_bits_bb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
+gr_pack_k_bits_bb::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
+ const unsigned char *in = (const unsigned char *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
- for (int i = 0; i < noutput_items; i++){
+ for(int i = 0; i < noutput_items; i++) {
out[i] = 0x00;
- for (unsigned int j = 0; j < d_k; j++){
- out[i] |= (0x01 & in[i*d_k+j])<<j;
+ for(unsigned int j = 0; j < d_k; j++) {
+ out[i] |= (0x01 & in[i*d_k+j])<<j;
}
}
-
+
return noutput_items;
}
diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h
index 00b8f8f13..caf6d7992 100644
--- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h
+++ b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h
@@ -33,7 +33,7 @@ GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k);
class gr_pack_k_bits_bb;
/*!
- * \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB.
+ * \brief Converts a stream of bytes with 1 bit in the LSB to a byte with k relevent bits.
* \ingroup converter_blk
*/
class GR_CORE_API gr_pack_k_bits_bb : public gr_sync_decimator
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t
index 15e19edb0..75ed526ad 100644
--- a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t
@@ -32,13 +32,13 @@
#include <stdio.h>
-@NAME@::@NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset)
- : gr_block ("@BASE_NAME@",
- gr_make_io_signature (1, 1, sizeof (@TYPE@)),
- gr_make_io_signature (1, 1, sizeof (@TYPE@))),
- d_data (data),
- d_offset (offset),
- d_periodicity (periodicity)
+@NAME@::@NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset)
+ : gr_block("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof(@TYPE@)),
+ gr_make_io_signature (1, 1, sizeof(@TYPE@))),
+ d_data(data),
+ d_offset(offset),
+ d_periodicity(periodicity)
{
//printf("INITIAL: periodicity = %d, offset = %d\n", periodicity, offset);
// some sanity checks
@@ -48,22 +48,22 @@
}
int
-@NAME@::general_work (int noutput_items,
+@NAME@::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @TYPE@ *out = (@TYPE@ *) output_items[0];
- const @TYPE@ *in = (const @TYPE@ *) input_items[0];
+ @TYPE@ *out = (@TYPE@ *)output_items[0];
+ const @TYPE@ *in = (const @TYPE@ *)input_items[0];
int ii(0), oo(0);
- while( (oo < noutput_items) && (ii < ninput_items[0]) ){
+ while((oo < noutput_items) && (ii < ninput_items[0])) {
//printf("oo = %d, ii = %d, d_offset = %d, noutput_items = %d, ninput_items[0] = %d", oo, ii, d_offset, noutput_items, ninput_items[0]);
//printf(", d_periodicity = %d\n", d_periodicity);
- if( d_offset >= ((int)d_data.size()) ){ // if we are in the copy region
+ if(d_offset >= ((int)d_data.size())) { // if we are in the copy region
int max_copy = std::min( std::min( noutput_items - oo, ninput_items[0] - ii ), d_periodicity - d_offset );
//printf("copy %d from input\n", max_copy);
memcpy( &out[oo], &in[ii], sizeof(@TYPE@)*max_copy );
@@ -72,24 +72,24 @@ int
oo += max_copy;
d_offset = (d_offset + max_copy)%d_periodicity;
- } else { // if we are in the insertion region
+ }
+ else { // if we are in the insertion region
int max_copy = std::min( noutput_items - oo, ((int)d_data.size()) - d_offset );
//printf("copy %d from d_data[%d] to out[%d]\n", max_copy, d_offset, oo);
memcpy( &out[oo], &d_data[d_offset], sizeof(@TYPE@)*max_copy );
//printf(" * memcpy returned.\n");
- oo += max_copy;
+ oo += max_copy;
d_offset = (d_offset + max_copy)%d_periodicity;
//printf(" ## (inelse) oo = %d, d_offset = %d\n", oo, d_offset);
- }
+ }
//printf(" # exit else, on to next loop.\n");
- }
- //printf(" # got out of loop\n");
-
- //printf("consume = %d, produce = %d\n", ii, oo);
- consume_each(ii);
- return oo;
+ }
+ //printf(" # got out of loop\n");
+ //printf("consume = %d, produce = %d\n", ii, oo);
+ consume_each(ii);
+ return oo;
}
@NAME@_sptr
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t
index 76c6b7a5d..a7de7831b 100644
--- a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t
+++ b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t
@@ -37,25 +37,25 @@ typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
*/
class @NAME@ : public gr_block {
- friend GR_CORE_API @NAME@_sptr
- gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset);
+ friend GR_CORE_API @NAME@_sptr
+ gr_make_@BASE_NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset);
std::vector<@TYPE@> d_data;
int d_offset;
int d_periodicity;
- @NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset);
+ @NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset);
public:
void rewind() {d_offset=0;}
- virtual int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
+ virtual int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
void set_data(const std::vector<@TYPE@> &data){ d_data = data; rewind(); }
};
GR_CORE_API @NAME@_sptr
-gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset=0);
+gr_make_@BASE_NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset=0);
#endif
diff --git a/gr-digital/lib/digital_ofdm_insert_preamble.cc b/gr-digital/lib/digital_ofdm_insert_preamble.cc
index d94425f31..e0449b50b 100644
--- a/gr-digital/lib/digital_ofdm_insert_preamble.cc
+++ b/gr-digital/lib/digital_ofdm_insert_preamble.cc
@@ -54,8 +54,8 @@ digital_ofdm_insert_preamble::digital_ofdm_insert_preamble
d_pending_flag(0)
{
// sanity check preamble symbols
- for (size_t i = 0; i < d_preamble.size(); i++){
- if (d_preamble[i].size() != (size_t) d_fft_length)
+ for(size_t i = 0; i < d_preamble.size(); i++) {
+ if(d_preamble[i].size() != (size_t) d_fft_length)
throw std::invalid_argument("digital_ofdm_insert_preamble: invalid length for preamble symbol");
}
@@ -67,20 +67,21 @@ digital_ofdm_insert_preamble::~digital_ofdm_insert_preamble()
{
}
-void digital_ofdm_insert_preamble::forecast (int noutput_items, gr_vector_int &ninput_items_required){
- ninput_items_required[0] = noutput_items;
+void digital_ofdm_insert_preamble::forecast (int noutput_items, gr_vector_int &ninput_items_required)
+{
+ ninput_items_required[0] = noutput_items;
}
int
-digital_ofdm_insert_preamble::general_work (int noutput_items,
- gr_vector_int &ninput_items_v,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
+digital_ofdm_insert_preamble::general_work(int noutput_items,
+ gr_vector_int &ninput_items_v,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
{
int ninput_items = ninput_items_v.size()==2?std::min(ninput_items_v[0], ninput_items_v[1]):ninput_items_v[0];
const gr_complex *in_sym = (const gr_complex *) input_items[0];
const unsigned char *in_flag = 0;
- if (input_items.size() == 2)
+ if (input_items.size() == 2)
in_flag = (const unsigned char *) input_items[1];
gr_complex *out_sym = (gr_complex *) output_items[0];