patch_vecoverlap.diff
| gnuradio-core/src/python/gnuradio/gr/Makefile.am (working copy) | ||
|---|---|---|
| 95 | 95 |
qa_unpack_k_bits.py \ |
| 96 | 96 |
qa_repeat.py \ |
| 97 | 97 |
qa_scrambler.py \ |
| 98 |
qa_vector_sink_source.py |
|
| 98 |
qa_vector_sink_source.py \ |
|
| 99 |
qa_stream_to_vector_overlap.py |
|
| gnuradio-core/src/lib/general/Makefile.am (working copy) | ||
|---|---|---|
| 144 | 144 |
gr_stream_mux.cc \ |
| 145 | 145 |
gr_stream_to_streams.cc \ |
| 146 | 146 |
gr_stream_to_vector.cc \ |
| 147 |
gr_stream_to_vector_overlap.cc \ |
|
| 147 | 148 |
gr_streams_to_stream.cc \ |
| 148 | 149 |
gr_streams_to_vector.cc \ |
| 149 | 150 |
gr_stretch_ff.cc \ |
| ... | ... | |
| 300 | 301 |
gr_stream_mux.h \ |
| 301 | 302 |
gr_stream_to_streams.h \ |
| 302 | 303 |
gr_stream_to_vector.h \ |
| 304 |
gr_stream_to_vector_overlap.h \ |
|
| 303 | 305 |
gr_streams_to_stream.h \ |
| 304 | 306 |
gr_streams_to_vector.h \ |
| 305 | 307 |
gr_stretch_ff.h \ |
| ... | ... | |
| 454 | 456 |
gr_stream_mux.i \ |
| 455 | 457 |
gr_stream_to_streams.i \ |
| 456 | 458 |
gr_stream_to_vector.i \ |
| 459 |
gr_stream_to_vector_overlap.i \ |
|
| 457 | 460 |
gr_streams_to_stream.i \ |
| 458 | 461 |
gr_streams_to_vector.i \ |
| 459 | 462 |
gr_stretch_ff.i \ |
| gnuradio-core/src/lib/general/general.i (working copy) | ||
|---|---|---|
| 34 | 34 |
#include <gr_lfsr_32k_source_s.h> |
| 35 | 35 |
#include <gr_check_lfsr_32k_s.h> |
| 36 | 36 |
#include <gr_stream_to_vector.h> |
| 37 |
#include <gr_stream_to_vector_overlap.h> |
|
| 37 | 38 |
#include <gr_vector_to_stream.h> |
| 38 | 39 |
#include <gr_keep_one_in_n.h> |
| 39 | 40 |
#include <gr_fft_vcc.h> |
| ... | ... | |
| 153 | 154 |
%include "gr_lfsr_32k_source_s.i" |
| 154 | 155 |
%include "gr_check_lfsr_32k_s.i" |
| 155 | 156 |
%include "gr_stream_to_vector.i" |
| 157 |
%include "gr_stream_to_vector_overlap.i" |
|
| 156 | 158 |
%include "gr_vector_to_stream.i" |
| 157 | 159 |
%include "gr_keep_one_in_n.i" |
| 158 | 160 |
%include "gr_fft_vcc.i" |
| gnuradio-core/src/lib/general/gr_stream_to_vector_overlap.h (revision 0) | ||
|---|---|---|
| 1 |
/* -*- c++ -*- */ |
|
| 2 |
/* |
|
| 3 |
* Copyright 2004,2006 Free Software Foundation, Inc. |
|
| 4 |
* |
|
| 5 |
* This file is part of GNU Radio |
|
| 6 |
* |
|
| 7 |
* GNU Radio is free software; you can redistribute it and/or modify |
|
| 8 |
* it under the terms of the GNU General Public License as published by |
|
| 9 |
* the Free Software Foundation; either version 3, or (at your option) |
|
| 10 |
* any later version. |
|
| 11 |
* |
|
| 12 |
* GNU Radio is distributed in the hope that it will be useful, |
|
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 15 |
* GNU General Public License for more details. |
|
| 16 |
* |
|
| 17 |
* You should have received a copy of the GNU General Public License |
|
| 18 |
* along with GNU Radio; see the file COPYING. If not, write to |
|
| 19 |
* the Free Software Foundation, Inc., 51 Franklin Street, |
|
| 20 |
* Boston, MA 02110-1301, USA. |
|
| 21 |
*/ |
|
| 22 | ||
| 23 |
#ifndef INCLUDED_GR_STREAM_TO_VECTOR_OVERLAP_H |
|
| 24 |
#define INCLUDED_GR_STREAM_TO_VECTOR_OVERLAP_H |
|
| 25 | ||
| 26 |
#include <gr_sync_decimator.h> |
|
| 27 | ||
| 28 |
class gr_stream_to_vector_overlap; |
|
| 29 |
typedef boost::shared_ptr<gr_stream_to_vector_overlap> gr_stream_to_vector_overlap_sptr; |
|
| 30 | ||
| 31 |
gr_stream_to_vector_overlap_sptr |
|
| 32 |
gr_make_stream_to_vector_overlap (size_t item_size, size_t nitems_per_block, unsigned overlap); |
|
| 33 | ||
| 34 | ||
| 35 |
/*! |
|
| 36 |
* \brief Convert a stream of items into a stream of overlapping blocks containing nitems_per_block. |
|
| 37 |
* |
|
| 38 |
* The i-th block will start with the same \p overlap items as the i-1-th block ended. The first |
|
| 39 |
* block is prepended with \p overlap zeros to ensure synchronicity. |
|
| 40 |
* \ingroup converter |
|
| 41 |
*/ |
|
| 42 |
class gr_stream_to_vector_overlap : public gr_sync_decimator |
|
| 43 |
{
|
|
| 44 |
friend gr_stream_to_vector_overlap_sptr |
|
| 45 |
gr_make_stream_to_vector_overlap (size_t item_size, size_t nitems_per_block, unsigned overlap); |
|
| 46 | ||
| 47 |
protected: |
|
| 48 |
gr_stream_to_vector_overlap (size_t item_size, size_t nitems_per_block, unsigned overlap); |
|
| 49 | ||
| 50 |
int d_bytes_overlap; |
|
| 51 | ||
| 52 |
public: |
|
| 53 |
int work (int noutput_items, |
|
| 54 |
gr_vector_const_void_star &input_items, |
|
| 55 |
gr_vector_void_star &output_items); |
|
| 56 | ||
| 57 |
unsigned overlap() { return history() - 1; };
|
|
| 58 |
}; |
|
| 59 | ||
| 60 | ||
| 61 |
#endif /* INCLUDED_GR_STREAM_TO_VECTOR_OVERLAP_H */ |
|
| gnuradio-core/src/lib/general/gr_stream_to_vector_overlap.i (revision 0) | ||
|---|---|---|
| 1 |
/* -*- c++ -*- */ |
|
| 2 |
/* |
|
| 3 |
* Copyright 2004,2006 Free Software Foundation, Inc. |
|
| 4 |
* |
|
| 5 |
* This file is part of GNU Radio |
|
| 6 |
* |
|
| 7 |
* GNU Radio is free software; you can redistribute it and/or modify |
|
| 8 |
* it under the terms of the GNU General Public License as published by |
|
| 9 |
* the Free Software Foundation; either version 3, or (at your option) |
|
| 10 |
* any later version. |
|
| 11 |
* |
|
| 12 |
* GNU Radio is distributed in the hope that it will be useful, |
|
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 15 |
* GNU General Public License for more details. |
|
| 16 |
* |
|
| 17 |
* You should have received a copy of the GNU General Public License |
|
| 18 |
* along with GNU Radio; see the file COPYING. If not, write to |
|
| 19 |
* the Free Software Foundation, Inc., 51 Franklin Street, |
|
| 20 |
* Boston, MA 02110-1301, USA. |
|
| 21 |
*/ |
|
| 22 | ||
| 23 |
%include "exception.i" |
|
| 24 | ||
| 25 |
%{
|
|
| 26 |
#include <stdexcept> |
|
| 27 |
%} |
|
| 28 | ||
| 29 |
GR_SWIG_BLOCK_MAGIC(gr,stream_to_vector_overlap) |
|
| 30 | ||
| 31 |
gr_stream_to_vector_overlap_sptr |
|
| 32 |
gr_make_stream_to_vector_overlap (size_t itemsize, size_t nitems_per_block, unsigned overlap) |
|
| 33 |
throw (std::invalid_argument); |
|
| 34 | ||
| 35 |
class gr_stream_to_vector_overlap : public gr_sync_decimator |
|
| 36 |
{
|
|
| 37 |
protected: |
|
| 38 |
gr_stream_to_vector_overlap (size_t itemsize, size_t nitems_per_block, unsigned overlap); |
|
| 39 | ||
| 40 |
public: |
|
| 41 |
unsigned overlap(); |
|
| 42 |
}; |
|
| 43 | ||
| gnuradio-core/src/lib/general/gr_stream_to_vector_overlap.cc (revision 0) | ||
|---|---|---|
| 1 |
/* -*- c++ -*- */ |
|
| 2 |
/* |
|
| 3 |
* Copyright 2004,2005 Free Software Foundation, Inc. |
|
| 4 |
* |
|
| 5 |
* This file is part of GNU Radio |
|
| 6 |
* |
|
| 7 |
* GNU Radio is free software; you can redistribute it and/or modify |
|
| 8 |
* it under the terms of the GNU General Public License as published by |
|
| 9 |
* the Free Software Foundation; either version 3, or (at your option) |
|
| 10 |
* any later version. |
|
| 11 |
* |
|
| 12 |
* GNU Radio is distributed in the hope that it will be useful, |
|
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 15 |
* GNU General Public License for more details. |
|
| 16 |
* |
|
| 17 |
* You should have received a copy of the GNU General Public License |
|
| 18 |
* along with GNU Radio; see the file COPYING. If not, write to |
|
| 19 |
* the Free Software Foundation, Inc., 51 Franklin Street, |
|
| 20 |
* Boston, MA 02110-1301, USA. |
|
| 21 |
*/ |
|
| 22 | ||
| 23 |
#ifdef HAVE_CONFIG_H |
|
| 24 |
#include "config.h" |
|
| 25 |
#endif |
|
| 26 | ||
| 27 |
#include <gr_stream_to_vector_overlap.h> |
|
| 28 |
#include <gr_io_signature.h> |
|
| 29 |
#include <string.h> |
|
| 30 |
#include <stdexcept> |
|
| 31 | ||
| 32 |
gr_stream_to_vector_overlap_sptr |
|
| 33 |
gr_make_stream_to_vector_overlap (size_t item_size, size_t nitems_per_block, unsigned overlap) |
|
| 34 |
{
|
|
| 35 |
return gr_stream_to_vector_overlap_sptr (new gr_stream_to_vector_overlap (item_size, nitems_per_block, overlap)); |
|
| 36 |
} |
|
| 37 | ||
| 38 |
gr_stream_to_vector_overlap::gr_stream_to_vector_overlap (size_t item_size, size_t nitems_per_block, unsigned overlap) |
|
| 39 |
: gr_sync_decimator ("stream_to_vector_overlap",
|
|
| 40 |
gr_make_io_signature (1, 1, item_size), |
|
| 41 |
gr_make_io_signature (1, 1, item_size * nitems_per_block), |
|
| 42 |
nitems_per_block - overlap), |
|
| 43 |
d_bytes_overlap(overlap * item_size) |
|
| 44 |
{
|
|
| 45 |
if (overlap + 1 >= nitems_per_block) {
|
|
| 46 |
throw std::invalid_argument("gr_stream_to_vector_overlap: overlap must be smaller than the number of items per block.");
|
|
| 47 |
} |
|
| 48 |
set_history(overlap + 1); |
|
| 49 |
} |
|
| 50 | ||
| 51 |
int |
|
| 52 |
gr_stream_to_vector_overlap::work (int noutput_items, |
|
| 53 |
gr_vector_const_void_star &input_items, |
|
| 54 |
gr_vector_void_star &output_items) |
|
| 55 |
{
|
|
| 56 |
size_t block_size = output_signature()->sizeof_stream_item (0); |
|
| 57 | ||
| 58 |
char *in = (char *) input_items[0]; |
|
| 59 |
char *out = (char *) output_items[0]; |
|
| 60 | ||
| 61 |
for (int i = 0; i < noutput_items; i++) {
|
|
| 62 |
memcpy(out, in, block_size); |
|
| 63 |
out += block_size; |
|
| 64 |
in += block_size - d_bytes_overlap; |
|
| 65 |
} |
|
| 66 | ||
| 67 |
return noutput_items; |
|
| 68 |
} |
|