diff options
author | eb | 2007-02-05 22:13:22 +0000 |
---|---|---|
committer | eb | 2007-02-05 22:13:22 +0000 |
commit | d5f0ec3d5bd5bf867ae5e387a6485a2d78138efb (patch) | |
tree | 325879e2d2f23be3fa2e5195792a667fb1539058 /gr-trellis/src/lib | |
parent | 8ae12742437172375c1721c439d850268982f687 (diff) | |
download | gnuradio-d5f0ec3d5bd5bf867ae5e387a6485a2d78138efb.tar.gz gnuradio-d5f0ec3d5bd5bf867ae5e387a6485a2d78138efb.tar.bz2 gnuradio-d5f0ec3d5bd5bf867ae5e387a6485a2d78138efb.zip |
removed generated files from svn
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@4387 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-trellis/src/lib')
48 files changed, 0 insertions, 3761 deletions
diff --git a/gr-trellis/src/lib/trellis_encoder_bb.cc b/gr-trellis/src/lib/trellis_encoder_bb.cc deleted file mode 100644 index bbb3c905f..000000000 --- a/gr-trellis/src/lib/trellis_encoder_bb.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_encoder_bb.h> -#include <gr_io_signature.h> -#include <iostream> - -trellis_encoder_bb_sptr -trellis_make_encoder_bb (const fsm &FSM, int ST) -{ - return trellis_encoder_bb_sptr (new trellis_encoder_bb (FSM,ST)); -} - -trellis_encoder_bb::trellis_encoder_bb (const fsm &FSM, int ST) - : gr_sync_block ("encoder_bb", - gr_make_io_signature (1, -1, sizeof (unsigned char)), - gr_make_io_signature (1, -1, sizeof (unsigned char))), - d_FSM (FSM), - d_ST (ST) -{ -} - - - -int -trellis_encoder_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ST_tmp=0; - - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - - for (int m=0;m<nstreams;m++) { - const unsigned char *in = (const unsigned char *) input_items[m]; - unsigned char *out = (unsigned char *) output_items[m]; - ST_tmp = d_ST; - - // per stream processing - for (int i = 0; i < noutput_items; i++){ - out[i] = (unsigned char) d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]]; // direction of time? - ST_tmp = (int) d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]]; - } - // end per stream processing - } - d_ST = ST_tmp; - - return noutput_items; -} - diff --git a/gr-trellis/src/lib/trellis_encoder_bb.h b/gr-trellis/src/lib/trellis_encoder_bb.h deleted file mode 100644 index a294bee2b..000000000 --- a/gr-trellis/src/lib/trellis_encoder_bb.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_ENCODER_BB_H -#define INCLUDED_TRELLIS_ENCODER_BB_H - -#include "fsm.h" -#include <gr_sync_block.h> - -class trellis_encoder_bb; -typedef boost::shared_ptr<trellis_encoder_bb> trellis_encoder_bb_sptr; - -trellis_encoder_bb_sptr trellis_make_encoder_bb (const fsm &FSM, int ST); - -/*! - * \brief Convolutional encoder. - * \ingroup block - * - * - */ -class trellis_encoder_bb : public gr_sync_block -{ -private: - friend trellis_encoder_bb_sptr trellis_make_encoder_bb (const fsm &FSM, int ST); - fsm d_FSM; - int d_ST; - trellis_encoder_bb (const fsm &FSM, int ST); - -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_encoder_bb.i b/gr-trellis/src/lib/trellis_encoder_bb.i deleted file mode 100644 index e79c6d8f7..000000000 --- a/gr-trellis/src/lib/trellis_encoder_bb.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,encoder_bb); - -trellis_encoder_bb_sptr trellis_make_encoder_bb (const fsm &FSM, int ST); - -class trellis_encoder_bb : public gr_sync_block -{ -private: - trellis_encoder_bb (const fsm &FSM, int ST); -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } -}; diff --git a/gr-trellis/src/lib/trellis_encoder_bi.cc b/gr-trellis/src/lib/trellis_encoder_bi.cc deleted file mode 100644 index 5e3d1899b..000000000 --- a/gr-trellis/src/lib/trellis_encoder_bi.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_encoder_bi.h> -#include <gr_io_signature.h> -#include <iostream> - -trellis_encoder_bi_sptr -trellis_make_encoder_bi (const fsm &FSM, int ST) -{ - return trellis_encoder_bi_sptr (new trellis_encoder_bi (FSM,ST)); -} - -trellis_encoder_bi::trellis_encoder_bi (const fsm &FSM, int ST) - : gr_sync_block ("encoder_bi", - gr_make_io_signature (1, -1, sizeof (unsigned char)), - gr_make_io_signature (1, -1, sizeof (int))), - d_FSM (FSM), - d_ST (ST) -{ -} - - - -int -trellis_encoder_bi::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ST_tmp=0; - - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - - for (int m=0;m<nstreams;m++) { - const unsigned char *in = (const unsigned char *) input_items[m]; - int *out = (int *) output_items[m]; - ST_tmp = d_ST; - - // per stream processing - for (int i = 0; i < noutput_items; i++){ - out[i] = (int) d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]]; // direction of time? - ST_tmp = (int) d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]]; - } - // end per stream processing - } - d_ST = ST_tmp; - - return noutput_items; -} - diff --git a/gr-trellis/src/lib/trellis_encoder_bi.h b/gr-trellis/src/lib/trellis_encoder_bi.h deleted file mode 100644 index 626bd6fd0..000000000 --- a/gr-trellis/src/lib/trellis_encoder_bi.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_ENCODER_BI_H -#define INCLUDED_TRELLIS_ENCODER_BI_H - -#include "fsm.h" -#include <gr_sync_block.h> - -class trellis_encoder_bi; -typedef boost::shared_ptr<trellis_encoder_bi> trellis_encoder_bi_sptr; - -trellis_encoder_bi_sptr trellis_make_encoder_bi (const fsm &FSM, int ST); - -/*! - * \brief Convolutional encoder. - * \ingroup block - * - * - */ -class trellis_encoder_bi : public gr_sync_block -{ -private: - friend trellis_encoder_bi_sptr trellis_make_encoder_bi (const fsm &FSM, int ST); - fsm d_FSM; - int d_ST; - trellis_encoder_bi (const fsm &FSM, int ST); - -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_encoder_bi.i b/gr-trellis/src/lib/trellis_encoder_bi.i deleted file mode 100644 index 9675b5f72..000000000 --- a/gr-trellis/src/lib/trellis_encoder_bi.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,encoder_bi); - -trellis_encoder_bi_sptr trellis_make_encoder_bi (const fsm &FSM, int ST); - -class trellis_encoder_bi : public gr_sync_block -{ -private: - trellis_encoder_bi (const fsm &FSM, int ST); -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } -}; diff --git a/gr-trellis/src/lib/trellis_encoder_bs.cc b/gr-trellis/src/lib/trellis_encoder_bs.cc deleted file mode 100644 index 0d84ca904..000000000 --- a/gr-trellis/src/lib/trellis_encoder_bs.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_encoder_bs.h> -#include <gr_io_signature.h> -#include <iostream> - -trellis_encoder_bs_sptr -trellis_make_encoder_bs (const fsm &FSM, int ST) -{ - return trellis_encoder_bs_sptr (new trellis_encoder_bs (FSM,ST)); -} - -trellis_encoder_bs::trellis_encoder_bs (const fsm &FSM, int ST) - : gr_sync_block ("encoder_bs", - gr_make_io_signature (1, -1, sizeof (unsigned char)), - gr_make_io_signature (1, -1, sizeof (short))), - d_FSM (FSM), - d_ST (ST) -{ -} - - - -int -trellis_encoder_bs::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ST_tmp=0; - - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - - for (int m=0;m<nstreams;m++) { - const unsigned char *in = (const unsigned char *) input_items[m]; - short *out = (short *) output_items[m]; - ST_tmp = d_ST; - - // per stream processing - for (int i = 0; i < noutput_items; i++){ - out[i] = (short) d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]]; // direction of time? - ST_tmp = (int) d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]]; - } - // end per stream processing - } - d_ST = ST_tmp; - - return noutput_items; -} - diff --git a/gr-trellis/src/lib/trellis_encoder_bs.h b/gr-trellis/src/lib/trellis_encoder_bs.h deleted file mode 100644 index cb7bc82e1..000000000 --- a/gr-trellis/src/lib/trellis_encoder_bs.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_ENCODER_BS_H -#define INCLUDED_TRELLIS_ENCODER_BS_H - -#include "fsm.h" -#include <gr_sync_block.h> - -class trellis_encoder_bs; -typedef boost::shared_ptr<trellis_encoder_bs> trellis_encoder_bs_sptr; - -trellis_encoder_bs_sptr trellis_make_encoder_bs (const fsm &FSM, int ST); - -/*! - * \brief Convolutional encoder. - * \ingroup block - * - * - */ -class trellis_encoder_bs : public gr_sync_block -{ -private: - friend trellis_encoder_bs_sptr trellis_make_encoder_bs (const fsm &FSM, int ST); - fsm d_FSM; - int d_ST; - trellis_encoder_bs (const fsm &FSM, int ST); - -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_encoder_bs.i b/gr-trellis/src/lib/trellis_encoder_bs.i deleted file mode 100644 index 95b5dfb9d..000000000 --- a/gr-trellis/src/lib/trellis_encoder_bs.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,encoder_bs); - -trellis_encoder_bs_sptr trellis_make_encoder_bs (const fsm &FSM, int ST); - -class trellis_encoder_bs : public gr_sync_block -{ -private: - trellis_encoder_bs (const fsm &FSM, int ST); -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } -}; diff --git a/gr-trellis/src/lib/trellis_encoder_ii.cc b/gr-trellis/src/lib/trellis_encoder_ii.cc deleted file mode 100644 index e281763a1..000000000 --- a/gr-trellis/src/lib/trellis_encoder_ii.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_encoder_ii.h> -#include <gr_io_signature.h> -#include <iostream> - -trellis_encoder_ii_sptr -trellis_make_encoder_ii (const fsm &FSM, int ST) -{ - return trellis_encoder_ii_sptr (new trellis_encoder_ii (FSM,ST)); -} - -trellis_encoder_ii::trellis_encoder_ii (const fsm &FSM, int ST) - : gr_sync_block ("encoder_ii", - gr_make_io_signature (1, -1, sizeof (int)), - gr_make_io_signature (1, -1, sizeof (int))), - d_FSM (FSM), - d_ST (ST) -{ -} - - - -int -trellis_encoder_ii::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ST_tmp=0; - - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - - for (int m=0;m<nstreams;m++) { - const int *in = (const int *) input_items[m]; - int *out = (int *) output_items[m]; - ST_tmp = d_ST; - - // per stream processing - for (int i = 0; i < noutput_items; i++){ - out[i] = (int) d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]]; // direction of time? - ST_tmp = (int) d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]]; - } - // end per stream processing - } - d_ST = ST_tmp; - - return noutput_items; -} - diff --git a/gr-trellis/src/lib/trellis_encoder_ii.h b/gr-trellis/src/lib/trellis_encoder_ii.h deleted file mode 100644 index 55477653e..000000000 --- a/gr-trellis/src/lib/trellis_encoder_ii.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_ENCODER_II_H -#define INCLUDED_TRELLIS_ENCODER_II_H - -#include "fsm.h" -#include <gr_sync_block.h> - -class trellis_encoder_ii; -typedef boost::shared_ptr<trellis_encoder_ii> trellis_encoder_ii_sptr; - -trellis_encoder_ii_sptr trellis_make_encoder_ii (const fsm &FSM, int ST); - -/*! - * \brief Convolutional encoder. - * \ingroup block - * - * - */ -class trellis_encoder_ii : public gr_sync_block -{ -private: - friend trellis_encoder_ii_sptr trellis_make_encoder_ii (const fsm &FSM, int ST); - fsm d_FSM; - int d_ST; - trellis_encoder_ii (const fsm &FSM, int ST); - -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_encoder_ii.i b/gr-trellis/src/lib/trellis_encoder_ii.i deleted file mode 100644 index 4d5615d82..000000000 --- a/gr-trellis/src/lib/trellis_encoder_ii.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,encoder_ii); - -trellis_encoder_ii_sptr trellis_make_encoder_ii (const fsm &FSM, int ST); - -class trellis_encoder_ii : public gr_sync_block -{ -private: - trellis_encoder_ii (const fsm &FSM, int ST); -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } -}; diff --git a/gr-trellis/src/lib/trellis_encoder_si.cc b/gr-trellis/src/lib/trellis_encoder_si.cc deleted file mode 100644 index 03da34fa1..000000000 --- a/gr-trellis/src/lib/trellis_encoder_si.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_encoder_si.h> -#include <gr_io_signature.h> -#include <iostream> - -trellis_encoder_si_sptr -trellis_make_encoder_si (const fsm &FSM, int ST) -{ - return trellis_encoder_si_sptr (new trellis_encoder_si (FSM,ST)); -} - -trellis_encoder_si::trellis_encoder_si (const fsm &FSM, int ST) - : gr_sync_block ("encoder_si", - gr_make_io_signature (1, -1, sizeof (short)), - gr_make_io_signature (1, -1, sizeof (int))), - d_FSM (FSM), - d_ST (ST) -{ -} - - - -int -trellis_encoder_si::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ST_tmp=0; - - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - - for (int m=0;m<nstreams;m++) { - const short *in = (const short *) input_items[m]; - int *out = (int *) output_items[m]; - ST_tmp = d_ST; - - // per stream processing - for (int i = 0; i < noutput_items; i++){ - out[i] = (int) d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]]; // direction of time? - ST_tmp = (int) d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]]; - } - // end per stream processing - } - d_ST = ST_tmp; - - return noutput_items; -} - diff --git a/gr-trellis/src/lib/trellis_encoder_si.h b/gr-trellis/src/lib/trellis_encoder_si.h deleted file mode 100644 index 633390e8d..000000000 --- a/gr-trellis/src/lib/trellis_encoder_si.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_ENCODER_SI_H -#define INCLUDED_TRELLIS_ENCODER_SI_H - -#include "fsm.h" -#include <gr_sync_block.h> - -class trellis_encoder_si; -typedef boost::shared_ptr<trellis_encoder_si> trellis_encoder_si_sptr; - -trellis_encoder_si_sptr trellis_make_encoder_si (const fsm &FSM, int ST); - -/*! - * \brief Convolutional encoder. - * \ingroup block - * - * - */ -class trellis_encoder_si : public gr_sync_block -{ -private: - friend trellis_encoder_si_sptr trellis_make_encoder_si (const fsm &FSM, int ST); - fsm d_FSM; - int d_ST; - trellis_encoder_si (const fsm &FSM, int ST); - -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_encoder_si.i b/gr-trellis/src/lib/trellis_encoder_si.i deleted file mode 100644 index 439a2aa5d..000000000 --- a/gr-trellis/src/lib/trellis_encoder_si.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,encoder_si); - -trellis_encoder_si_sptr trellis_make_encoder_si (const fsm &FSM, int ST); - -class trellis_encoder_si : public gr_sync_block -{ -private: - trellis_encoder_si (const fsm &FSM, int ST); -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } -}; diff --git a/gr-trellis/src/lib/trellis_encoder_ss.cc b/gr-trellis/src/lib/trellis_encoder_ss.cc deleted file mode 100644 index e4196eb99..000000000 --- a/gr-trellis/src/lib/trellis_encoder_ss.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_encoder_ss.h> -#include <gr_io_signature.h> -#include <iostream> - -trellis_encoder_ss_sptr -trellis_make_encoder_ss (const fsm &FSM, int ST) -{ - return trellis_encoder_ss_sptr (new trellis_encoder_ss (FSM,ST)); -} - -trellis_encoder_ss::trellis_encoder_ss (const fsm &FSM, int ST) - : gr_sync_block ("encoder_ss", - gr_make_io_signature (1, -1, sizeof (short)), - gr_make_io_signature (1, -1, sizeof (short))), - d_FSM (FSM), - d_ST (ST) -{ -} - - - -int -trellis_encoder_ss::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ST_tmp=0; - - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - - for (int m=0;m<nstreams;m++) { - const short *in = (const short *) input_items[m]; - short *out = (short *) output_items[m]; - ST_tmp = d_ST; - - // per stream processing - for (int i = 0; i < noutput_items; i++){ - out[i] = (short) d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]]; // direction of time? - ST_tmp = (int) d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]]; - } - // end per stream processing - } - d_ST = ST_tmp; - - return noutput_items; -} - diff --git a/gr-trellis/src/lib/trellis_encoder_ss.h b/gr-trellis/src/lib/trellis_encoder_ss.h deleted file mode 100644 index 286db6f65..000000000 --- a/gr-trellis/src/lib/trellis_encoder_ss.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_ENCODER_SS_H -#define INCLUDED_TRELLIS_ENCODER_SS_H - -#include "fsm.h" -#include <gr_sync_block.h> - -class trellis_encoder_ss; -typedef boost::shared_ptr<trellis_encoder_ss> trellis_encoder_ss_sptr; - -trellis_encoder_ss_sptr trellis_make_encoder_ss (const fsm &FSM, int ST); - -/*! - * \brief Convolutional encoder. - * \ingroup block - * - * - */ -class trellis_encoder_ss : public gr_sync_block -{ -private: - friend trellis_encoder_ss_sptr trellis_make_encoder_ss (const fsm &FSM, int ST); - fsm d_FSM; - int d_ST; - trellis_encoder_ss (const fsm &FSM, int ST); - -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_encoder_ss.i b/gr-trellis/src/lib/trellis_encoder_ss.i deleted file mode 100644 index 567374d98..000000000 --- a/gr-trellis/src/lib/trellis_encoder_ss.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,encoder_ss); - -trellis_encoder_ss_sptr trellis_make_encoder_ss (const fsm &FSM, int ST); - -class trellis_encoder_ss : public gr_sync_block -{ -private: - trellis_encoder_ss (const fsm &FSM, int ST); -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } -}; diff --git a/gr-trellis/src/lib/trellis_metrics_c.cc b/gr-trellis/src/lib/trellis_metrics_c.cc deleted file mode 100644 index 1dc3d137d..000000000 --- a/gr-trellis/src/lib/trellis_metrics_c.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_metrics_c.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <iostream> - - -trellis_metrics_c_sptr -trellis_make_metrics_c (int O, int D, const std::vector<gr_complex> &TABLE, trellis_metric_type_t TYPE) -{ - return trellis_metrics_c_sptr (new trellis_metrics_c (O,D,TABLE,TYPE)); -} - - - -trellis_metrics_c::trellis_metrics_c (int O, int D, const std::vector<gr_complex> &TABLE, trellis_metric_type_t TYPE) - : gr_block ("metrics_c", - gr_make_io_signature (1, -1, sizeof (gr_complex)), - gr_make_io_signature (1, -1, sizeof (float))), - d_O (O), - d_D (D), - d_TYPE (TYPE), - d_TABLE (TABLE) -{ - set_relative_rate (1.0 * d_O / ((double) d_D)); - set_output_multiple ((int)d_O); -} - - - - -void -trellis_metrics_c::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_O == 0); - int input_required = d_D * noutput_items / d_O; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = input_required; -} - - - -int -trellis_metrics_c::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - - assert (noutput_items % d_O == 0); - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - -for (int m=0;m<nstreams;m++) { - const gr_complex *in = (gr_complex *) input_items[m]; - float *out = (float *) output_items[m]; - - for (int i = 0; i < noutput_items / d_O ; i++){ -/* -#if 0 - calc_metric_s(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 0 - calc_metric_i(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 0 - calc_metric_f(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 1 - calc_metric_c(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#endif -*/ - calc_metric(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); - } -} - - consume_each (d_D * noutput_items / d_O); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_metrics_c.h b/gr-trellis/src/lib/trellis_metrics_c.h deleted file mode 100644 index 0eccf829b..000000000 --- a/gr-trellis/src/lib/trellis_metrics_c.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_METRICS_C_H -#define INCLUDED_TRELLIS_METRICS_C_H - -#include <gr_block.h> -#include "trellis_calc_metric.h" - -class trellis_metrics_c; -typedef boost::shared_ptr<trellis_metrics_c> trellis_metrics_c_sptr; - -trellis_metrics_c_sptr trellis_make_metrics_c (int O, int D, const std::vector<gr_complex> &TABLE, trellis_metric_type_t TYPE); - -/*! - * \brief Evaluate metrics for use by the Viterbi algorithm. - * \ingroup block - * - */ -class trellis_metrics_c : public gr_block -{ - int d_O; - int d_D; - trellis_metric_type_t d_TYPE; - std::vector<gr_complex> d_TABLE; - - friend trellis_metrics_c_sptr trellis_make_metrics_c (int O, int D, const std::vector<gr_complex> &TABLE, trellis_metric_type_t TYPE); - trellis_metrics_c (int O, int D, const std::vector<gr_complex> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - std::vector<gr_complex> TABLE () const { return d_TABLE; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gr-trellis/src/lib/trellis_metrics_c.i b/gr-trellis/src/lib/trellis_metrics_c.i deleted file mode 100644 index 8a4008a38..000000000 --- a/gr-trellis/src/lib/trellis_metrics_c.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,metrics_c); - -trellis_metrics_c_sptr trellis_make_metrics_c (int O, int D, const std::vector<gr_complex> &TABLE, trellis_metric_type_t TYPE); - -class trellis_metrics_c : public gr_block -{ -private: - trellis_metrics_c (int O, int D, const std::vector<gr_complex> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - std::vector<gr_complex> TABLE () const { return d_TABLE; } -}; diff --git a/gr-trellis/src/lib/trellis_metrics_f.cc b/gr-trellis/src/lib/trellis_metrics_f.cc deleted file mode 100644 index 6cfbe3520..000000000 --- a/gr-trellis/src/lib/trellis_metrics_f.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_metrics_f.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <iostream> - - -trellis_metrics_f_sptr -trellis_make_metrics_f (int O, int D, const std::vector<float> &TABLE, trellis_metric_type_t TYPE) -{ - return trellis_metrics_f_sptr (new trellis_metrics_f (O,D,TABLE,TYPE)); -} - - - -trellis_metrics_f::trellis_metrics_f (int O, int D, const std::vector<float> &TABLE, trellis_metric_type_t TYPE) - : gr_block ("metrics_f", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (float))), - d_O (O), - d_D (D), - d_TYPE (TYPE), - d_TABLE (TABLE) -{ - set_relative_rate (1.0 * d_O / ((double) d_D)); - set_output_multiple ((int)d_O); -} - - - - -void -trellis_metrics_f::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_O == 0); - int input_required = d_D * noutput_items / d_O; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = input_required; -} - - - -int -trellis_metrics_f::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - - assert (noutput_items % d_O == 0); - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - -for (int m=0;m<nstreams;m++) { - const float *in = (float *) input_items[m]; - float *out = (float *) output_items[m]; - - for (int i = 0; i < noutput_items / d_O ; i++){ -/* -#if 0 - calc_metric_s(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 0 - calc_metric_i(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 1 - calc_metric_f(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 0 - calc_metric_c(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#endif -*/ - calc_metric(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); - } -} - - consume_each (d_D * noutput_items / d_O); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_metrics_f.h b/gr-trellis/src/lib/trellis_metrics_f.h deleted file mode 100644 index 1b0f79dc8..000000000 --- a/gr-trellis/src/lib/trellis_metrics_f.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_METRICS_F_H -#define INCLUDED_TRELLIS_METRICS_F_H - -#include <gr_block.h> -#include "trellis_calc_metric.h" - -class trellis_metrics_f; -typedef boost::shared_ptr<trellis_metrics_f> trellis_metrics_f_sptr; - -trellis_metrics_f_sptr trellis_make_metrics_f (int O, int D, const std::vector<float> &TABLE, trellis_metric_type_t TYPE); - -/*! - * \brief Evaluate metrics for use by the Viterbi algorithm. - * \ingroup block - * - */ -class trellis_metrics_f : public gr_block -{ - int d_O; - int d_D; - trellis_metric_type_t d_TYPE; - std::vector<float> d_TABLE; - - friend trellis_metrics_f_sptr trellis_make_metrics_f (int O, int D, const std::vector<float> &TABLE, trellis_metric_type_t TYPE); - trellis_metrics_f (int O, int D, const std::vector<float> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - std::vector<float> TABLE () const { return d_TABLE; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gr-trellis/src/lib/trellis_metrics_f.i b/gr-trellis/src/lib/trellis_metrics_f.i deleted file mode 100644 index 631523a64..000000000 --- a/gr-trellis/src/lib/trellis_metrics_f.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,metrics_f); - -trellis_metrics_f_sptr trellis_make_metrics_f (int O, int D, const std::vector<float> &TABLE, trellis_metric_type_t TYPE); - -class trellis_metrics_f : public gr_block -{ -private: - trellis_metrics_f (int O, int D, const std::vector<float> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - std::vector<float> TABLE () const { return d_TABLE; } -}; diff --git a/gr-trellis/src/lib/trellis_metrics_i.cc b/gr-trellis/src/lib/trellis_metrics_i.cc deleted file mode 100644 index ab0938d22..000000000 --- a/gr-trellis/src/lib/trellis_metrics_i.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_metrics_i.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <iostream> - - -trellis_metrics_i_sptr -trellis_make_metrics_i (int O, int D, const std::vector<int> &TABLE, trellis_metric_type_t TYPE) -{ - return trellis_metrics_i_sptr (new trellis_metrics_i (O,D,TABLE,TYPE)); -} - - - -trellis_metrics_i::trellis_metrics_i (int O, int D, const std::vector<int> &TABLE, trellis_metric_type_t TYPE) - : gr_block ("metrics_i", - gr_make_io_signature (1, -1, sizeof (int)), - gr_make_io_signature (1, -1, sizeof (float))), - d_O (O), - d_D (D), - d_TYPE (TYPE), - d_TABLE (TABLE) -{ - set_relative_rate (1.0 * d_O / ((double) d_D)); - set_output_multiple ((int)d_O); -} - - - - -void -trellis_metrics_i::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_O == 0); - int input_required = d_D * noutput_items / d_O; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = input_required; -} - - - -int -trellis_metrics_i::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - - assert (noutput_items % d_O == 0); - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - -for (int m=0;m<nstreams;m++) { - const int *in = (int *) input_items[m]; - float *out = (float *) output_items[m]; - - for (int i = 0; i < noutput_items / d_O ; i++){ -/* -#if 0 - calc_metric_s(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 1 - calc_metric_i(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 0 - calc_metric_f(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 0 - calc_metric_c(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#endif -*/ - calc_metric(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); - } -} - - consume_each (d_D * noutput_items / d_O); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_metrics_i.h b/gr-trellis/src/lib/trellis_metrics_i.h deleted file mode 100644 index bbf38b4f1..000000000 --- a/gr-trellis/src/lib/trellis_metrics_i.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_METRICS_I_H -#define INCLUDED_TRELLIS_METRICS_I_H - -#include <gr_block.h> -#include "trellis_calc_metric.h" - -class trellis_metrics_i; -typedef boost::shared_ptr<trellis_metrics_i> trellis_metrics_i_sptr; - -trellis_metrics_i_sptr trellis_make_metrics_i (int O, int D, const std::vector<int> &TABLE, trellis_metric_type_t TYPE); - -/*! - * \brief Evaluate metrics for use by the Viterbi algorithm. - * \ingroup block - * - */ -class trellis_metrics_i : public gr_block -{ - int d_O; - int d_D; - trellis_metric_type_t d_TYPE; - std::vector<int> d_TABLE; - - friend trellis_metrics_i_sptr trellis_make_metrics_i (int O, int D, const std::vector<int> &TABLE, trellis_metric_type_t TYPE); - trellis_metrics_i (int O, int D, const std::vector<int> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - std::vector<int> TABLE () const { return d_TABLE; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gr-trellis/src/lib/trellis_metrics_i.i b/gr-trellis/src/lib/trellis_metrics_i.i deleted file mode 100644 index 42406d311..000000000 --- a/gr-trellis/src/lib/trellis_metrics_i.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,metrics_i); - -trellis_metrics_i_sptr trellis_make_metrics_i (int O, int D, const std::vector<int> &TABLE, trellis_metric_type_t TYPE); - -class trellis_metrics_i : public gr_block -{ -private: - trellis_metrics_i (int O, int D, const std::vector<int> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - std::vector<int> TABLE () const { return d_TABLE; } -}; diff --git a/gr-trellis/src/lib/trellis_metrics_s.cc b/gr-trellis/src/lib/trellis_metrics_s.cc deleted file mode 100644 index dd989b8e5..000000000 --- a/gr-trellis/src/lib/trellis_metrics_s.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_metrics_s.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <iostream> - - -trellis_metrics_s_sptr -trellis_make_metrics_s (int O, int D, const std::vector<short> &TABLE, trellis_metric_type_t TYPE) -{ - return trellis_metrics_s_sptr (new trellis_metrics_s (O,D,TABLE,TYPE)); -} - - - -trellis_metrics_s::trellis_metrics_s (int O, int D, const std::vector<short> &TABLE, trellis_metric_type_t TYPE) - : gr_block ("metrics_s", - gr_make_io_signature (1, -1, sizeof (short)), - gr_make_io_signature (1, -1, sizeof (float))), - d_O (O), - d_D (D), - d_TYPE (TYPE), - d_TABLE (TABLE) -{ - set_relative_rate (1.0 * d_O / ((double) d_D)); - set_output_multiple ((int)d_O); -} - - - - -void -trellis_metrics_s::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_O == 0); - int input_required = d_D * noutput_items / d_O; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = input_required; -} - - - -int -trellis_metrics_s::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - - assert (noutput_items % d_O == 0); - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - -for (int m=0;m<nstreams;m++) { - const short *in = (short *) input_items[m]; - float *out = (float *) output_items[m]; - - for (int i = 0; i < noutput_items / d_O ; i++){ -/* -#if 1 - calc_metric_s(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 0 - calc_metric_i(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 0 - calc_metric_f(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#elif 0 - calc_metric_c(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); -#endif -*/ - calc_metric(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); - } -} - - consume_each (d_D * noutput_items / d_O); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_metrics_s.h b/gr-trellis/src/lib/trellis_metrics_s.h deleted file mode 100644 index 9ec6576c3..000000000 --- a/gr-trellis/src/lib/trellis_metrics_s.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_METRICS_S_H -#define INCLUDED_TRELLIS_METRICS_S_H - -#include <gr_block.h> -#include "trellis_calc_metric.h" - -class trellis_metrics_s; -typedef boost::shared_ptr<trellis_metrics_s> trellis_metrics_s_sptr; - -trellis_metrics_s_sptr trellis_make_metrics_s (int O, int D, const std::vector<short> &TABLE, trellis_metric_type_t TYPE); - -/*! - * \brief Evaluate metrics for use by the Viterbi algorithm. - * \ingroup block - * - */ -class trellis_metrics_s : public gr_block -{ - int d_O; - int d_D; - trellis_metric_type_t d_TYPE; - std::vector<short> d_TABLE; - - friend trellis_metrics_s_sptr trellis_make_metrics_s (int O, int D, const std::vector<short> &TABLE, trellis_metric_type_t TYPE); - trellis_metrics_s (int O, int D, const std::vector<short> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - std::vector<short> TABLE () const { return d_TABLE; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gr-trellis/src/lib/trellis_metrics_s.i b/gr-trellis/src/lib/trellis_metrics_s.i deleted file mode 100644 index 38c5ce5a7..000000000 --- a/gr-trellis/src/lib/trellis_metrics_s.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,metrics_s); - -trellis_metrics_s_sptr trellis_make_metrics_s (int O, int D, const std::vector<short> &TABLE, trellis_metric_type_t TYPE); - -class trellis_metrics_s : public gr_block -{ -private: - trellis_metrics_s (int O, int D, const std::vector<short> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - std::vector<short> TABLE () const { return d_TABLE; } -}; diff --git a/gr-trellis/src/lib/trellis_viterbi_b.cc b/gr-trellis/src/lib/trellis_viterbi_b.cc deleted file mode 100644 index b4144434a..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_b.cc +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_viterbi_b.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -trellis_viterbi_b_sptr -trellis_make_viterbi_b ( - const fsm &FSM, - int K, - int S0, - int SK) -{ - return trellis_viterbi_b_sptr (new trellis_viterbi_b (FSM,K,S0,SK)); -} - -trellis_viterbi_b::trellis_viterbi_b ( - const fsm &FSM, - int K, - int S0, - int SK) - : gr_block ("viterbi_b", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (unsigned char))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK)//, - //d_trace(FSM.S()*K) -{ - set_relative_rate (1.0 / ((double) d_FSM.O())); - set_output_multiple (d_K); -} - - -void -trellis_viterbi_b::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_K == 0); - int input_required = d_FSM.O() * noutput_items ; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) { - ninput_items_required[i] = input_required; - } -} - - - - -void viterbi_algorithm(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - const float *in, unsigned char *out)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - int alphai; - float norm,mm,minm; - int minmi; - int st; - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (unsigned char) PI[st][i0]; - st=PS[st][i0]; - } - -} - - - - - - -int -trellis_viterbi_b::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - assert (noutput_items % d_K == 0); - int nblocks = noutput_items / d_K; - - for (int m=0;m<nstreams;m++) { - const float *in = (const float *) input_items[m]; - unsigned char *out = (unsigned char *) output_items[m]; - for (int n=0;n<nblocks;n++) { - viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]));//,d_trace); - } - } - - consume_each (d_FSM.O() * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_viterbi_b.h b/gr-trellis/src/lib/trellis_viterbi_b.h deleted file mode 100644 index 49cbe92b7..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_b.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_VITERBI_B_H -#define INCLUDED_TRELLIS_VITERBI_B_H - -#include "fsm.h" -#include <gr_block.h> - -class trellis_viterbi_b; -typedef boost::shared_ptr<trellis_viterbi_b> trellis_viterbi_b_sptr; - -trellis_viterbi_b_sptr trellis_make_viterbi_b ( - const fsm &FSM, - int K, - int S0, - int SK); - - - -class trellis_viterbi_b : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - //std::vector<int> d_trace; - - friend trellis_viterbi_b_sptr trellis_make_viterbi_b ( - const fsm &FSM, - int K, - int S0, - int SK); - - - trellis_viterbi_b ( - const fsm &FSM, - int K, - int S0, - int SK); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - //std::vector<int> trace () const { return d_trace; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_viterbi_b.i b/gr-trellis/src/lib/trellis_viterbi_b.i deleted file mode 100644 index 52680c9d4..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_b.i +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,viterbi_b); - -trellis_viterbi_b_sptr trellis_make_viterbi_b ( - const fsm &FSM, - int K, - int S0, - int SK); - - -class trellis_viterbi_b : public gr_block -{ -private: - trellis_viterbi_b ( - const fsm &FSM, - int K, - int S0, - int SK); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - //std::vector<short> trace () const { return d_trace; } -}; diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_b.cc b/gr-trellis/src/lib/trellis_viterbi_combined_b.cc deleted file mode 100644 index 9860c7f86..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_b.cc +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_viterbi_combined_b.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -trellis_viterbi_combined_b_sptr -trellis_make_viterbi_combined_b ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE) -{ - return trellis_viterbi_combined_b_sptr (new trellis_viterbi_combined_b (FSM,K,S0,SK,D,TABLE,TYPE)); -} - -trellis_viterbi_combined_b::trellis_viterbi_combined_b ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE) - : gr_block ("viterbi_combined_b", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (unsigned char))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK), - d_D (D), - d_TABLE (TABLE), - d_TYPE (TYPE)//, - //d_trace(FSM.S()*K) -{ - set_relative_rate (1.0 / ((double) d_D)); - set_output_multiple (d_K); -} - - -void -trellis_viterbi_combined_b::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_K == 0); - int input_required = d_D * noutput_items ; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) { - ninput_items_required[i] = input_required; - } -} - - - - -void viterbi_algorithm_combined(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE, - const float *in, unsigned char *out)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - float *metric = new float[O]; - int alphai; - float norm,mm,minm; - int minmi; - int st; - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - calc_metric(O, D, TABLE, &(in[k*D]), metric,TYPE); // calc metrics - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+metric[OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (unsigned char) PI[st][i0]; - st=PS[st][i0]; - } - - delete [] metric; - -} - - - - - - -int -trellis_viterbi_combined_b::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - assert (noutput_items % d_K == 0); - int nblocks = noutput_items / d_K; - - for (int m=0;m<nstreams;m++) { - const float *in = (const float *) input_items[m]; - unsigned char *out = (unsigned char *) output_items[m]; - for (int n=0;n<nblocks;n++) { - viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,d_D,d_TABLE,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]));//,d_trace); - } - } - - consume_each (d_D * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_b.h b/gr-trellis/src/lib/trellis_viterbi_combined_b.h deleted file mode 100644 index d48dec98e..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_b.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_VITERBI_COMBINED_B_H -#define INCLUDED_TRELLIS_VITERBI_COMBINED_B_H - -#include "fsm.h" -#include <gr_block.h> -#include "trellis_calc_metric.h" - -class trellis_viterbi_combined_b; -typedef boost::shared_ptr<trellis_viterbi_combined_b> trellis_viterbi_combined_b_sptr; - -trellis_viterbi_combined_b_sptr trellis_make_viterbi_combined_b ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -class trellis_viterbi_combined_b : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - int d_D; - std::vector<float> d_TABLE; - trellis_metric_type_t d_TYPE; - //std::vector<int> d_trace; - - friend trellis_viterbi_combined_b_sptr trellis_make_viterbi_combined_b ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - - trellis_viterbi_combined_b ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - //std::vector<int> trace () const { return d_trace; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_b.i b/gr-trellis/src/lib/trellis_viterbi_combined_b.i deleted file mode 100644 index 230024ff4..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_b.i +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,viterbi_combined_b); - -trellis_viterbi_combined_b_sptr trellis_make_viterbi_combined_b ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -class trellis_viterbi_combined_b : public gr_block -{ -private: - trellis_viterbi_combined_b ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - //std::vector<short> trace () const { return d_trace; } -}; diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_i.cc b/gr-trellis/src/lib/trellis_viterbi_combined_i.cc deleted file mode 100644 index 72b64e0d0..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_i.cc +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_viterbi_combined_i.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -trellis_viterbi_combined_i_sptr -trellis_make_viterbi_combined_i ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE) -{ - return trellis_viterbi_combined_i_sptr (new trellis_viterbi_combined_i (FSM,K,S0,SK,D,TABLE,TYPE)); -} - -trellis_viterbi_combined_i::trellis_viterbi_combined_i ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE) - : gr_block ("viterbi_combined_i", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (int))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK), - d_D (D), - d_TABLE (TABLE), - d_TYPE (TYPE)//, - //d_trace(FSM.S()*K) -{ - set_relative_rate (1.0 / ((double) d_D)); - set_output_multiple (d_K); -} - - -void -trellis_viterbi_combined_i::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_K == 0); - int input_required = d_D * noutput_items ; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) { - ninput_items_required[i] = input_required; - } -} - - - - -void viterbi_algorithm_combined(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE, - const float *in, int *out)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - float *metric = new float[O]; - int alphai; - float norm,mm,minm; - int minmi; - int st; - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - calc_metric(O, D, TABLE, &(in[k*D]), metric,TYPE); // calc metrics - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+metric[OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (int) PI[st][i0]; - st=PS[st][i0]; - } - - delete [] metric; - -} - - - - - - -int -trellis_viterbi_combined_i::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - assert (noutput_items % d_K == 0); - int nblocks = noutput_items / d_K; - - for (int m=0;m<nstreams;m++) { - const float *in = (const float *) input_items[m]; - int *out = (int *) output_items[m]; - for (int n=0;n<nblocks;n++) { - viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,d_D,d_TABLE,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]));//,d_trace); - } - } - - consume_each (d_D * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_i.h b/gr-trellis/src/lib/trellis_viterbi_combined_i.h deleted file mode 100644 index 4f60c2b5d..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_i.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_VITERBI_COMBINED_I_H -#define INCLUDED_TRELLIS_VITERBI_COMBINED_I_H - -#include "fsm.h" -#include <gr_block.h> -#include "trellis_calc_metric.h" - -class trellis_viterbi_combined_i; -typedef boost::shared_ptr<trellis_viterbi_combined_i> trellis_viterbi_combined_i_sptr; - -trellis_viterbi_combined_i_sptr trellis_make_viterbi_combined_i ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -class trellis_viterbi_combined_i : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - int d_D; - std::vector<float> d_TABLE; - trellis_metric_type_t d_TYPE; - //std::vector<int> d_trace; - - friend trellis_viterbi_combined_i_sptr trellis_make_viterbi_combined_i ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - - trellis_viterbi_combined_i ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - //std::vector<int> trace () const { return d_trace; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_i.i b/gr-trellis/src/lib/trellis_viterbi_combined_i.i deleted file mode 100644 index f2377382c..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_i.i +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,viterbi_combined_i); - -trellis_viterbi_combined_i_sptr trellis_make_viterbi_combined_i ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -class trellis_viterbi_combined_i : public gr_block -{ -private: - trellis_viterbi_combined_i ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - //std::vector<short> trace () const { return d_trace; } -}; diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_s.cc b/gr-trellis/src/lib/trellis_viterbi_combined_s.cc deleted file mode 100644 index 9ee6bc420..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_s.cc +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_viterbi_combined_s.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -trellis_viterbi_combined_s_sptr -trellis_make_viterbi_combined_s ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE) -{ - return trellis_viterbi_combined_s_sptr (new trellis_viterbi_combined_s (FSM,K,S0,SK,D,TABLE,TYPE)); -} - -trellis_viterbi_combined_s::trellis_viterbi_combined_s ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE) - : gr_block ("viterbi_combined_s", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (short))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK), - d_D (D), - d_TABLE (TABLE), - d_TYPE (TYPE)//, - //d_trace(FSM.S()*K) -{ - set_relative_rate (1.0 / ((double) d_D)); - set_output_multiple (d_K); -} - - -void -trellis_viterbi_combined_s::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_K == 0); - int input_required = d_D * noutput_items ; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) { - ninput_items_required[i] = input_required; - } -} - - - - -void viterbi_algorithm_combined(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE, - const float *in, short *out)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - float *metric = new float[O]; - int alphai; - float norm,mm,minm; - int minmi; - int st; - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - calc_metric(O, D, TABLE, &(in[k*D]), metric,TYPE); // calc metrics - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+metric[OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (short) PI[st][i0]; - st=PS[st][i0]; - } - - delete [] metric; - -} - - - - - - -int -trellis_viterbi_combined_s::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - assert (noutput_items % d_K == 0); - int nblocks = noutput_items / d_K; - - for (int m=0;m<nstreams;m++) { - const float *in = (const float *) input_items[m]; - short *out = (short *) output_items[m]; - for (int n=0;n<nblocks;n++) { - viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,d_D,d_TABLE,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]));//,d_trace); - } - } - - consume_each (d_D * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_s.h b/gr-trellis/src/lib/trellis_viterbi_combined_s.h deleted file mode 100644 index 8069bc22b..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_s.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_VITERBI_COMBINED_S_H -#define INCLUDED_TRELLIS_VITERBI_COMBINED_S_H - -#include "fsm.h" -#include <gr_block.h> -#include "trellis_calc_metric.h" - -class trellis_viterbi_combined_s; -typedef boost::shared_ptr<trellis_viterbi_combined_s> trellis_viterbi_combined_s_sptr; - -trellis_viterbi_combined_s_sptr trellis_make_viterbi_combined_s ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -class trellis_viterbi_combined_s : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - int d_D; - std::vector<float> d_TABLE; - trellis_metric_type_t d_TYPE; - //std::vector<int> d_trace; - - friend trellis_viterbi_combined_s_sptr trellis_make_viterbi_combined_s ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - - trellis_viterbi_combined_s ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - //std::vector<int> trace () const { return d_trace; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_s.i b/gr-trellis/src/lib/trellis_viterbi_combined_s.i deleted file mode 100644 index 7f2a6a93c..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_s.i +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,viterbi_combined_s); - -trellis_viterbi_combined_s_sptr trellis_make_viterbi_combined_s ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -class trellis_viterbi_combined_s : public gr_block -{ -private: - trellis_viterbi_combined_s ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - //std::vector<short> trace () const { return d_trace; } -}; diff --git a/gr-trellis/src/lib/trellis_viterbi_i.cc b/gr-trellis/src/lib/trellis_viterbi_i.cc deleted file mode 100644 index b39c68510..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_i.cc +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_viterbi_i.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -trellis_viterbi_i_sptr -trellis_make_viterbi_i ( - const fsm &FSM, - int K, - int S0, - int SK) -{ - return trellis_viterbi_i_sptr (new trellis_viterbi_i (FSM,K,S0,SK)); -} - -trellis_viterbi_i::trellis_viterbi_i ( - const fsm &FSM, - int K, - int S0, - int SK) - : gr_block ("viterbi_i", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (int))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK)//, - //d_trace(FSM.S()*K) -{ - set_relative_rate (1.0 / ((double) d_FSM.O())); - set_output_multiple (d_K); -} - - -void -trellis_viterbi_i::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_K == 0); - int input_required = d_FSM.O() * noutput_items ; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) { - ninput_items_required[i] = input_required; - } -} - - - - -void viterbi_algorithm(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - const float *in, int *out)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - int alphai; - float norm,mm,minm; - int minmi; - int st; - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (int) PI[st][i0]; - st=PS[st][i0]; - } - -} - - - - - - -int -trellis_viterbi_i::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - assert (noutput_items % d_K == 0); - int nblocks = noutput_items / d_K; - - for (int m=0;m<nstreams;m++) { - const float *in = (const float *) input_items[m]; - int *out = (int *) output_items[m]; - for (int n=0;n<nblocks;n++) { - viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]));//,d_trace); - } - } - - consume_each (d_FSM.O() * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_viterbi_i.h b/gr-trellis/src/lib/trellis_viterbi_i.h deleted file mode 100644 index 28cc01425..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_i.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_VITERBI_I_H -#define INCLUDED_TRELLIS_VITERBI_I_H - -#include "fsm.h" -#include <gr_block.h> - -class trellis_viterbi_i; -typedef boost::shared_ptr<trellis_viterbi_i> trellis_viterbi_i_sptr; - -trellis_viterbi_i_sptr trellis_make_viterbi_i ( - const fsm &FSM, - int K, - int S0, - int SK); - - - -class trellis_viterbi_i : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - //std::vector<int> d_trace; - - friend trellis_viterbi_i_sptr trellis_make_viterbi_i ( - const fsm &FSM, - int K, - int S0, - int SK); - - - trellis_viterbi_i ( - const fsm &FSM, - int K, - int S0, - int SK); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - //std::vector<int> trace () const { return d_trace; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_viterbi_i.i b/gr-trellis/src/lib/trellis_viterbi_i.i deleted file mode 100644 index dd0c3bcfd..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_i.i +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,viterbi_i); - -trellis_viterbi_i_sptr trellis_make_viterbi_i ( - const fsm &FSM, - int K, - int S0, - int SK); - - -class trellis_viterbi_i : public gr_block -{ -private: - trellis_viterbi_i ( - const fsm &FSM, - int K, - int S0, - int SK); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - //std::vector<short> trace () const { return d_trace; } -}; diff --git a/gr-trellis/src/lib/trellis_viterbi_s.cc b/gr-trellis/src/lib/trellis_viterbi_s.cc deleted file mode 100644 index 9ccbab28b..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_s.cc +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_viterbi_s.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -trellis_viterbi_s_sptr -trellis_make_viterbi_s ( - const fsm &FSM, - int K, - int S0, - int SK) -{ - return trellis_viterbi_s_sptr (new trellis_viterbi_s (FSM,K,S0,SK)); -} - -trellis_viterbi_s::trellis_viterbi_s ( - const fsm &FSM, - int K, - int S0, - int SK) - : gr_block ("viterbi_s", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (short))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK)//, - //d_trace(FSM.S()*K) -{ - set_relative_rate (1.0 / ((double) d_FSM.O())); - set_output_multiple (d_K); -} - - -void -trellis_viterbi_s::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_K == 0); - int input_required = d_FSM.O() * noutput_items ; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) { - ninput_items_required[i] = input_required; - } -} - - - - -void viterbi_algorithm(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - const float *in, short *out)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - int alphai; - float norm,mm,minm; - int minmi; - int st; - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (short) PI[st][i0]; - st=PS[st][i0]; - } - -} - - - - - - -int -trellis_viterbi_s::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - assert (noutput_items % d_K == 0); - int nblocks = noutput_items / d_K; - - for (int m=0;m<nstreams;m++) { - const float *in = (const float *) input_items[m]; - short *out = (short *) output_items[m]; - for (int n=0;n<nblocks;n++) { - viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]));//,d_trace); - } - } - - consume_each (d_FSM.O() * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_viterbi_s.h b/gr-trellis/src/lib/trellis_viterbi_s.h deleted file mode 100644 index ccfd2954b..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_s.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifndef INCLUDED_TRELLIS_VITERBI_S_H -#define INCLUDED_TRELLIS_VITERBI_S_H - -#include "fsm.h" -#include <gr_block.h> - -class trellis_viterbi_s; -typedef boost::shared_ptr<trellis_viterbi_s> trellis_viterbi_s_sptr; - -trellis_viterbi_s_sptr trellis_make_viterbi_s ( - const fsm &FSM, - int K, - int S0, - int SK); - - - -class trellis_viterbi_s : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - //std::vector<int> d_trace; - - friend trellis_viterbi_s_sptr trellis_make_viterbi_s ( - const fsm &FSM, - int K, - int S0, - int SK); - - - trellis_viterbi_s ( - const fsm &FSM, - int K, - int S0, - int SK); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - //std::vector<int> trace () const { return d_trace; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_viterbi_s.i b/gr-trellis/src/lib/trellis_viterbi_s.i deleted file mode 100644 index e294eab18..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_s.i +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 2, 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,viterbi_s); - -trellis_viterbi_s_sptr trellis_make_viterbi_s ( - const fsm &FSM, - int K, - int S0, - int SK); - - -class trellis_viterbi_s : public gr_block -{ -private: - trellis_viterbi_s ( - const fsm &FSM, - int K, - int S0, - int SK); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - //std::vector<short> trace () const { return d_trace; } -}; |