diff options
author | Ben Reynwar | 2011-02-13 19:39:50 -0700 |
---|---|---|
committer | Ben Reynwar | 2011-02-13 19:39:50 -0700 |
commit | 0c7d7678defe24eb2a20ef6726c9aa57cf012d38 (patch) | |
tree | 474dece2c10d5e1a093030db07b51f8d4b5d8ce6 /gnuradio-core/src/lib/general | |
parent | e4df34e785651787930b2b2fcd4c9fbdeac5d8fc (diff) | |
download | gnuradio-0c7d7678defe24eb2a20ef6726c9aa57cf012d38.tar.gz gnuradio-0c7d7678defe24eb2a20ef6726c9aa57cf012d38.tar.bz2 gnuradio-0c7d7678defe24eb2a20ef6726c9aa57cf012d38.zip |
Added gr_constellation_decoder2_cb block.
Diffstat (limited to 'gnuradio-core/src/lib/general')
5 files changed, 167 insertions, 0 deletions
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 0830f5d2e..8f895f364 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -58,6 +58,7 @@ libgeneral_la_SOURCES = \ gr_copy.cc \ gr_constellation.cc \ gr_constellation_decoder_cb.cc \ + gr_constellation_decoder2_cb.cc \ gr_constellation_receiver_cb.cc \ gr_correlate_access_code_bb.cc \ gr_costas_loop_cc.cc \ @@ -217,6 +218,7 @@ grinclude_HEADERS = \ gr_conjugate_cc.h \ gr_constellation.h \ gr_constellation_decoder_cb.h \ + gr_constellation_decoder2_cb.h \ gr_constellation_receiver_cb.h \ gr_copy.h \ gr_correlate_access_code_bb.h \ @@ -394,6 +396,7 @@ swiginclude_HEADERS = \ gr_conjugate_cc.i \ gr_constellation.i \ gr_constellation_decoder_cb.i \ + gr_constellation_decoder2_cb.i \ gr_constellation_receiver_cb.i \ gr_copy.i \ gr_correlate_access_code_bb.i \ diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index aa7d95ff2..dddda60af 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -114,6 +114,7 @@ #include <gr_correlate_access_code_bb.h> #include <gr_diff_phasor_cc.h> #include <gr_constellation_decoder_cb.h> +#include <gr_constellation_decoder2_cb.h> #include <gr_binary_slicer_fb.h> #include <gr_diff_encoder_bb.h> #include <gr_diff_decoder_bb.h> @@ -242,6 +243,7 @@ %include "gr_correlate_access_code_bb.i" %include "gr_diff_phasor_cc.i" %include "gr_constellation_decoder_cb.i" +%include "gr_constellation_decoder2_cb.i" %include "gr_binary_slicer_fb.i" %include "gr_diff_encoder_bb.i" %include "gr_diff_decoder_bb.i" diff --git a/gnuradio-core/src/lib/general/gr_constellation_decoder2_cb.cc b/gnuradio-core/src/lib/general/gr_constellation_decoder2_cb.cc new file mode 100644 index 000000000..9116d4776 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_constellation_decoder2_cb.cc @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006, 2011 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 <gr_constellation_decoder2_cb.h> +#include <gr_constellation.h> +#include <gr_io_signature.h> + +gr_constellation_decoder2_cb_sptr +gr_make_constellation_decoder2_cb (gr_constellation_sptr constellation) +{ + return gr_constellation_decoder2_cb_sptr + (new gr_constellation_decoder2_cb(constellation)); +} + +gr_constellation_decoder2_cb:: +gr_constellation_decoder2_cb (gr_constellation_sptr constellation) + : gr_sync_block ("constellation_decoder2_cb", + gr_make_io_signature (1, 1, sizeof (gr_complex)), + gr_make_io_signature (1, 1, sizeof (unsigned char))), + d_constellation(constellation) +{ +} + + +gr_constellation_decoder2_cb::~gr_constellation_decoder2_cb(){} + +int +gr_constellation_decoder2_cb::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + gr_complex const *in = (const gr_complex *) input_items[0]; + unsigned char *out = (unsigned char *) output_items[0]; + + for(int i = 0; i < noutput_items; i++){ + out[i] = d_constellation->decision_maker(in[i]); + } + + return noutput_items; +} diff --git a/gnuradio-core/src/lib/general/gr_constellation_decoder2_cb.h b/gnuradio-core/src/lib/general/gr_constellation_decoder2_cb.h new file mode 100644 index 000000000..d72761927 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_constellation_decoder2_cb.h @@ -0,0 +1,61 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006, 2011 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_CONSTELLATION_DECODER2_CB_H +#define INCLUDED_GR_CONSTELLATION_DECODER2_CB_H + +#include <gr_sync_block.h> +#include <gr_constellation.h> +#include <vector> + +class gr_constellation_decoder2_cb; +typedef boost::shared_ptr<gr_constellation_decoder2_cb> gr_constellation_decoder2_cb_sptr; + +gr_constellation_decoder2_cb_sptr +gr_make_constellation_decoder2_cb (gr_constellation_sptr constellation); + +/*! + * \brief Constellation Decoder + * \ingroup coding_blk + * + */ +class gr_constellation_decoder2_cb : public gr_sync_block +{ + + private: + gr_constellation_sptr d_constellation; + + friend gr_constellation_decoder2_cb_sptr + gr_make_constellation_decoder2_cb (gr_constellation_sptr constellation); + + gr_constellation_decoder2_cb (gr_constellation_sptr constellation); + + public: + + ~gr_constellation_decoder2_cb(); //destructor + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif diff --git a/gnuradio-core/src/lib/general/gr_constellation_decoder2_cb.i b/gnuradio-core/src/lib/general/gr_constellation_decoder2_cb.i new file mode 100644 index 000000000..2865363d8 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_constellation_decoder2_cb.i @@ -0,0 +1,38 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006, 2011 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,constellation_decoder2_cb) + +gr_constellation_decoder2_cb_sptr +gr_make_constellation_decoder2_cb (gr_constellation_sptr constellation); + +class gr_constellation_decoder2_cb : public gr_sync_block +{ + private: + gr_constellation_decoder2_cb (gr_constellation_sptr constellation); + + friend gr_constellation_decoder2_cb_sptr + gr_make_constellation_decoder2_cb (gr_constellation_sptr constellation); + + public: + ~gr_constellation_decoder2_cb(); +}; |