commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r3219 - in gnuradio/trunk: . config gr-trellis gr-trel


From: eb
Subject: [Commit-gnuradio] r3219 - in gnuradio/trunk: . config gr-trellis gr-trellis/doc gr-trellis/src gr-trellis/src/lib gr-trellis/src/python
Date: Mon, 7 Aug 2006 10:28:57 -0600 (MDT)

Author: eb
Date: 2006-08-07 10:28:55 -0600 (Mon, 07 Aug 2006)
New Revision: 3219

Added:
   gnuradio/trunk/config/grc_trellis.m4
   gnuradio/trunk/gr-trellis/
   gnuradio/trunk/gr-trellis/AUTHORS
   gnuradio/trunk/gr-trellis/ChangeLog
   gnuradio/trunk/gr-trellis/Makefile.am
   gnuradio/trunk/gr-trellis/README
   gnuradio/trunk/gr-trellis/doc/
   gnuradio/trunk/gr-trellis/doc/Makefile.am
   gnuradio/trunk/gr-trellis/doc/gr-trellis.html
   gnuradio/trunk/gr-trellis/doc/gr-trellis.xml
   gnuradio/trunk/gr-trellis/doc/test_tcm.py
   gnuradio/trunk/gr-trellis/src/
   gnuradio/trunk/gr-trellis/src/Makefile.am
   gnuradio/trunk/gr-trellis/src/lib/
   gnuradio/trunk/gr-trellis/src/lib/Makefile.am
   gnuradio/trunk/gr-trellis/src/lib/Makefile.gen
   gnuradio/trunk/gr-trellis/src/lib/build_utils.py
   gnuradio/trunk/gr-trellis/src/lib/build_utils_codes.py
   gnuradio/trunk/gr-trellis/src/lib/fsm.cc
   gnuradio/trunk/gr-trellis/src/lib/fsm.h
   gnuradio/trunk/gr-trellis/src/lib/fsm.i
   gnuradio/trunk/gr-trellis/src/lib/generate_all.py
   gnuradio/trunk/gr-trellis/src/lib/generate_common.py
   gnuradio/trunk/gr-trellis/src/lib/trellis.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.cc.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.h.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.i.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_generated.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_metric_type.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.cc.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.h.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.i.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.cc.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.h.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.i.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.cc.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.h.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.i.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.i
   gnuradio/trunk/gr-trellis/src/python/
   gnuradio/trunk/gr-trellis/src/python/Makefile.am
   gnuradio/trunk/gr-trellis/src/python/qa_trellis.py
   gnuradio/trunk/gr-trellis/src/python/run_tests.in
Removed:
   gnuradio/trunk/gr-trellis/AUTHORS
   gnuradio/trunk/gr-trellis/ChangeLog
   gnuradio/trunk/gr-trellis/Makefile.am
   gnuradio/trunk/gr-trellis/README
   gnuradio/trunk/gr-trellis/doc/
   gnuradio/trunk/gr-trellis/doc/Makefile.am
   gnuradio/trunk/gr-trellis/doc/gr-trellis.html
   gnuradio/trunk/gr-trellis/doc/gr-trellis.xml
   gnuradio/trunk/gr-trellis/doc/test_tcm.py
   gnuradio/trunk/gr-trellis/src/
   gnuradio/trunk/gr-trellis/src/Makefile.am
   gnuradio/trunk/gr-trellis/src/lib/
   gnuradio/trunk/gr-trellis/src/lib/Makefile.am
   gnuradio/trunk/gr-trellis/src/lib/Makefile.gen
   gnuradio/trunk/gr-trellis/src/lib/build_utils.py
   gnuradio/trunk/gr-trellis/src/lib/build_utils_codes.py
   gnuradio/trunk/gr-trellis/src/lib/fsm.cc
   gnuradio/trunk/gr-trellis/src/lib/fsm.h
   gnuradio/trunk/gr-trellis/src/lib/fsm.i
   gnuradio/trunk/gr-trellis/src/lib/generate_all.py
   gnuradio/trunk/gr-trellis/src/lib/generate_common.py
   gnuradio/trunk/gr-trellis/src/lib/trellis.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.cc.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.h.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.i.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_generated.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_metric_type.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.cc.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.h.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.i.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.cc.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.h.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.i.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.cc.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.h.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.i.t
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.i
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.cc
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.h
   gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.i
   gnuradio/trunk/gr-trellis/src/python/
   gnuradio/trunk/gr-trellis/src/python/Makefile.am
   gnuradio/trunk/gr-trellis/src/python/qa_trellis.py
   gnuradio/trunk/gr-trellis/src/python/run_tests.in
Modified:
   gnuradio/trunk/configure.ac
Log:
Merged anastas/wip changes r3156:3218 into trunk.


Copied: gnuradio/trunk/config/grc_trellis.m4 (from rev 3218, 
gnuradio/branches/developers/anastas/wip/config/grc_trellis.m4)
===================================================================
--- gnuradio/trunk/config/grc_trellis.m4                                (rev 0)
+++ gnuradio/trunk/config/grc_trellis.m4        2006-08-07 16:28:55 UTC (rev 
3219)
@@ -0,0 +1,36 @@
+dnl Copyright 2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+dnl 
+dnl This file is part of GNU Radio
+dnl 
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2, or (at your option)
+dnl any later version.
+dnl 
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING.  If not, write to
+dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+dnl Boston, MA 02111-1307, USA.
+
+AC_DEFUN([GRC_GR_TRELLIS],[
+    AC_CONFIG_SRCDIR([gr-trellis/src/lib/trellis.i])
+
+    AC_CONFIG_FILES([\
+       gr-trellis/Makefile \
+       gr-trellis/doc/Makefile \
+       gr-trellis/src/Makefile \
+       gr-trellis/src/lib/Makefile \
+       gr-trellis/src/python/Makefile \
+       gr-trellis/src/python/run_tests \
+    ])
+
+    dnl run_tests is created from run_tests.in.  Make it executable.
+    AC_CONFIG_COMMANDS([run_tests_gr_trellis], [chmod +x 
gr-trellis/src/python/run_tests])
+
+    subdirs="$subdirs gr-trellis"
+])

Modified: gnuradio/trunk/configure.ac
===================================================================
--- gnuradio/trunk/configure.ac 2006-08-07 15:48:50 UTC (rev 3218)
+++ gnuradio/trunk/configure.ac 2006-08-07 16:28:55 UTC (rev 3219)
@@ -165,6 +165,7 @@
 GRC_GR_VIDEO_SDL
 GRC_GR_WXGUI
 GRC_PMT
+GRC_GR_TRELLIS
 
 dnl Has list of successfully configured components
 AC_SUBST([subdirs],$subdirs)

Copied: gnuradio/trunk/gr-trellis (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis)


Property changes on: gnuradio/trunk/gr-trellis
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in
aclocal.m4
configure
config.h.in
stamp-h.in
libtool
config.log
config.h
config.cache
config.status
missing
stamp-h
stamp-h1
.deps
.libs
*.la
*.lo
autom4te.cache
*.cache
missing
make.log


Deleted: gnuradio/trunk/gr-trellis/AUTHORS

Copied: gnuradio/trunk/gr-trellis/AUTHORS (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/AUTHORS)
===================================================================
--- gnuradio/trunk/gr-trellis/AUTHORS                           (rev 0)
+++ gnuradio/trunk/gr-trellis/AUTHORS   2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1 @@
+Eric Blossom <address@hidden>

Deleted: gnuradio/trunk/gr-trellis/ChangeLog

Copied: gnuradio/trunk/gr-trellis/ChangeLog (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/ChangeLog)
===================================================================
--- gnuradio/trunk/gr-trellis/ChangeLog                         (rev 0)
+++ gnuradio/trunk/gr-trellis/ChangeLog 2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,24 @@
+2006-08-03  Achilleas Anastasopoulos <address@hidden>
+
+       * first cut
+
+#
+# Copyright 2005 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 

Deleted: gnuradio/trunk/gr-trellis/Makefile.am

Copied: gnuradio/trunk/gr-trellis/Makefile.am (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/Makefile.am)
===================================================================
--- gnuradio/trunk/gr-trellis/Makefile.am                               (rev 0)
+++ gnuradio/trunk/gr-trellis/Makefile.am       2006-08-07 16:28:55 UTC (rev 
3219)
@@ -0,0 +1,26 @@
+#
+# Copyright 2004,2006 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+include $(top_srcdir)/Makefile.common
+
+SUBDIRS = src
+DIST_SUBDIRS = src doc
+

Deleted: gnuradio/trunk/gr-trellis/README

Copied: gnuradio/trunk/gr-trellis/README (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/README)
===================================================================
--- gnuradio/trunk/gr-trellis/README                            (rev 0)
+++ gnuradio/trunk/gr-trellis/README    2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,26 @@
+#
+# Copyright 2005,2006 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+
+The doc directory is not built by default.  This is to avoid spurious
+build problems on systems that don't have xmlto installed.  If you
+have xmlto and its dependencies installed, you can build the html
+version of the gr-trellis article by cd'ing to doc and invoking make.

Copied: gnuradio/trunk/gr-trellis/doc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/doc)


Property changes on: gnuradio/trunk/gr-trellis/doc
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in
.deps
.libs
*.la
*.lo
autom4te.cache
*.cache
howto-write-a-block.html
gr_block.h.xml
howto_1.i.xml
howto_square_ff.cc.xml
howto_square_ff.h.xml
qa_howto_1.py.xml
src_lib_Makefile_1.am.xml
src_lib_Makefile_2.am.xml
howto_square2_ff.cc.xml
howto_square2_ff.h.xml


Deleted: gnuradio/trunk/gr-trellis/doc/Makefile.am

Copied: gnuradio/trunk/gr-trellis/doc/Makefile.am (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/doc/Makefile.am)
===================================================================
--- gnuradio/trunk/gr-trellis/doc/Makefile.am                           (rev 0)
+++ gnuradio/trunk/gr-trellis/doc/Makefile.am   2006-08-07 16:28:55 UTC (rev 
3219)
@@ -0,0 +1,51 @@
+#
+# Copyright 2004,2005 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+TARGETS = gr-trellis.html
+
+
+# To avoid build problems for folks who don't have xmlto installed, we
+# don't build the docs by default.
+
+# html: $(TARGETS)
+all: $(TARGETS)
+
+
+EXTRA_DIST =                           
+
+
+BUILT_XML_FILES =                      
+
+
+gr-trellis.html : gr-trellis.xml $(BUILT_XML_FILES)
+
+
+
+# ----------------------------------------------------------------
+
+clean:
+       -rm -f $(TARGETS) $(BUILT_XML_FILES)
+
+%.html : %.xml
+       xmlto html-nochunks $<
+
+%.xml : % make_numbered_listing.py
+       ./make_numbered_listing.py $<

Deleted: gnuradio/trunk/gr-trellis/doc/gr-trellis.html

Copied: gnuradio/trunk/gr-trellis/doc/gr-trellis.html (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/doc/gr-trellis.html)
===================================================================
--- gnuradio/trunk/gr-trellis/doc/gr-trellis.html                               
(rev 0)
+++ gnuradio/trunk/gr-trellis/doc/gr-trellis.html       2006-08-07 16:28:55 UTC 
(rev 3219)
@@ -0,0 +1,446 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; 
charset=ISO-8859-1"><title>Trellis-based algorithms for GNU Radio</title><meta 
name="generator" content="DocBook XSL Stylesheets V1.65.1"><meta 
name="description" content="This document provides a description of the 
+Finite State Machine (FSM) implementation and the related 
+trellis-based encoding and decoding algorithms
+for GNU Radio.
+"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" 
alink="#0000FF"><div class="article" lang="en"><div 
class="titlepage"><div><div><h1 class="title"><a 
name="id2931733"></a>Trellis-based algorithms for GNU Radio</h1></div><div><div 
class="author"><h3 class="author"><span class="firstname">Achilleas</span> 
<span class="surname">Anastasopoulos</span></h3><div class="affiliation"><div 
class="address"><p><br>
+�����������<tt class="email">&lt;<a 
href="mailto:address@hidden";>address@hidden</a>&gt;</tt><br>
+��������</p></div></div></div></div><div><div class="revhistory"><table 
border="1" width="100%" summary="Revision history"><tr><th align="left" 
valign="top" colspan="2"><b>Revision History</b></th></tr><tr><td 
align="left">Revision v0.0</td><td align="left">2006-08-03</td></tr><tr><td 
align="left" colspan="2">
+    First cut.
+  </td></tr></table></div></div><div><div class="abstract"><p 
class="title"><b>Abstract</b></p><p>This document provides a description of the 
+Finite State Machine (FSM) implementation and the related 
+trellis-based encoding and decoding algorithms
+for GNU Radio.
+</p></div></div></div><div></div><hr></div><div class="toc"><p><b>Table of 
Contents</b></p><dl><dt><span class="sect1"><a 
href="#intro">Introduction</a></span></dt><dt><span class="sect1"><a 
href="#fsm">The FSM class</a></span></dt><dt><span class="sect1"><a 
href="#tcm">TCM: A Complete Example</a></span></dt><dt><span class="sect1"><a 
href="#future">Future Work</a></span></dt></dl></div><div class="sect1" 
lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: 
both"><a 
name="intro"></a>Introduction</h2></div></div><div></div></div><p>....</p><p>
+The basic goal of the implementation is to have a generic way of 
+describing an FSM that is decoupled from whether it describes a 
+convolutional 
+code (CC), a trellis code (TC), an inter-symbol interference (ISI) 
+channel, or any
+other communication system that can be modeled with an FSM.
+To achieve this goal, we need to separate the pure FSM descrition from the
+rest of the model details. For instance, in the case of a rate 2/3 TC, 
+the FSM should not involve details about the modulation used (it can
+be an 8-ary PAM, or 8-PSK, etc). Similarly, when attempting maximum likelihood
+sequence detection (MLSD)--using for instance the Viterbi algorithm (VA)--
+the VA implementation should not be concerned with the channel details
+(such as modulations, channel type, hard or soft inputs, etc).
+Clearly, having generality as the primary goal implies some penalty
+on the code efficiency, as compared to fully custom implementations. 
+</p><p>
+We will now describe the implementation of the basic ingedient, the FSM.
+</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a name="fsm"></a>The FSM 
class</h2></div></div><div></div></div><p>An FSM describes the evolution of a 
system with inputs
+x<sub>k</sub>, states s<sub>k</sub> and outputs y<sub>k</sub>. At time k the 
FSM state is s<sub>k</sub>. 
+Upon reception of a new input symbol x<sub>k</sub>, it outputs an output symbol
+y<sub>k</sub> which is a function of both x<sub>k</sub> and s<sub>k</sub>.  
+It will then move to a next state s<sub>k+1</sub>.
+An FSM has a finite number of states, input and output symbols. 
+All these are formally described as follows:
+</p><div class="itemizedlist"><ul type="disc"><li><p>The input alphabet 
A<sub>I</sub>={0,1,2,...,I-1}, with cardinality I, so that x<sub>k</sub> takes 
values in A<sub>I</sub>.</p></li><li><p>The state alphabet 
A<sub>S</sub>={0,1,2,...,S-1}, with cardinality S, so that s<sub>k</sub> takes 
values in A<sub>S</sub>.</p></li><li><p>The output alphabet 
A<sub>O</sub>={0,1,2,...,O-1}, with cardinality O, so that y<sub>k</sub> takes 
values in A<sub>O</sub></p></li><li><p>The "next-state" function NS: 
A<sub>S</sub> x A<sub>I</sub> --&gt; A<sub>S</sub>, 
+with the meaning 
+s<sub>k+1</sub> = NS(s<sub>k</sub>, x<sub>k</sub>)</p></li><li><p>The 
"output-symbol" function OS: A<sub>S</sub> x A<sub>I</sub> --&gt; 
A<sub>S</sub>, 
+with the meaning 
+y<sub>k</sub> = OS(s<sub>k</sub>, x<sub>k</sub>)</p></li></ul></div><p>
+Thus, a complete description of the FSM is given by the 
+the five-tuple (I,S,O,NS,OS).
+Observe that implementation details are hidden 
+in how the outside world interprets these input and output 
+integer symbols.
+Here is an example of an FSM describing the (2,1) CC
+with constraint length 3 and generator polynomial matrix
+(1+D+D<sup>2</sup>   1+D<sup>2</sup>)
+from Proakis-Salehi pg. 779.
+</p><div class="example"><a name="cc_ex"></a><p 
class="title"><b>Example�1.�(2,1) CC with generator polynomials 
(1+D+D<sup>2</sup>   1+D<sup>2</sup>)</b></p><p>
+This CC accepts 1 bit at a time, and outputs 2 bits at a time.
+It has a shift register storing the last two input bits.
+In particular, 
+b<sub>k</sub>(0)=x<sub>k</sub>+
+x<sub>k-1</sub>+x<sub>k-2</sub>, and
+b<sub>k</sub>(1)=x<sub>k</sub>+
+x<sub>k-2</sub>, where addition is mod-2. 
+We can represent the state of this system
+as s<sub>k</sub> = (x<sub>k-1</sub> x<sub>k-2</sub>)<sub>10</sub>. In addition 
we can represent its
+output symbol as y<sub>k</sub> = (b<sub>k</sub>(1) 
b<sub>k</sub>(0))<sub>10</sub>. 
+Based on the above assumptions, the input alphabet A<sub>I</sub>={0,1}, so 
I=2; 
+the state alphabet A<sub>S</sub>={0,1,2,3}, so S=4; and
+the output alphabet A<sub>O</sub>={0,1,2,3}, so O=4.
+The "next-state" function NS(,) is given by
+</p><pre class="programlisting">
+s<sub>k</sub>  x<sub>k</sub>   s<sub>k+1</sub>
+0      0       0
+0      1       2
+1      0       0
+1      1       2
+2      0       1
+2      1       3
+3      0       1
+3      1       3
+</pre><p>
+The "output-symbol" function OS(,) can be given by
+</p><pre class="programlisting">
+s<sub>k</sub>       x<sub>k</sub>       y<sub>k</sub>
+0      0       0
+0      1       3
+1      0       3
+1      1       0
+2      0       1
+2      1       2
+3      0       2
+3      1       1
+</pre><p>
+</p><p>
+Note that although the CC outputs 2 bits per time period, following 
+our approach, there is only one (quaternary) output symbol per 
+time period (for instance, here we use the decimal representation 
+of the 2-bits). Also note that the modulation used is not part of 
+the FSM description: it can be BPSK, OOK, BFSK, QPSK with or without Gray 
mapping, etc; 
+it is up to the rest of the program to interpret the meaning of 
+the symbol y<sub>k</sub>.
+</p></div><p>
+The C++ implementation of the FSM class keeps private information about
+I,S,O,NS,OS and public methods to read and write them. The NS
+and OS matrices are implemented as STL 1-dimensional vectors.
+</p><pre class="programlisting">
+class fsm {
+private:
+  int d_I;
+  int d_S;
+  int d_O;
+  std::vector&lt;int&gt; d_NS;
+  std::vector&lt;int&gt; d_OS;
+  std::vector&lt;int&gt; d_PS;
+  std::vector&lt;int&gt; d_PI;
+public:
+  fsm();
+  fsm(const fsm &amp;FSM);
+  fsm(const int I, const int S, const int O, const std::vector&lt;int&gt; 
&amp;NS, const std::vector&lt;int&gt; &amp;OS);
+  fsm(const char *name);
+  fsm(const int mod_size, const int ch_length);
+  int I () const { return d_I; }
+  int S () const { return d_S; }
+  int O () const { return d_O; }
+  const std::vector&lt;int&gt; &amp; NS () const { return d_NS; }
+  const std::vector&lt;int&gt; &amp; OS () const { return d_OS; }
+  const std::vector&lt;int&gt; &amp; PS () const { return d_PS; }
+  const std::vector&lt;int&gt; &amp; PI () const { return d_PI; }
+};
+</pre><p>
+As can be seen, other than the trivial and the copy constructor, 
+there are three additional
+ways to construct an FSM. 
+</p><div class="itemizedlist"><ul type="disc"><li><p>Supplying the parameters 
I,S,O,NS,OS:</p><pre class="programlisting">
+  fsm(const int I, const int S, const int O, const std::vector&lt;int&gt; 
&amp;NS, const std::vector&lt;int&gt; &amp;OS);
+</pre></li><li><p>Giving a filename containing all the FSM 
information:</p><pre class="programlisting">
+  fsm(const char *name);
+</pre><p>This information has to be in the following format</p><pre 
class="programlisting">
+I S O
+
+NS(0,0)   NS(0,1)   ...  NS(0,I-1)
+NS(1,0)   NS(1,1)   ...  NS(1,I-1)
+...
+NS(S-1,0) NS(S-1,1) ...  NS(S-1,I-1)
+
+OS(0,0)   OS(0,1)   ...  OS(0,I-1)
+OS(1,0)   OS(1,1)   ...  OS(1,I-1)
+...
+OS(S-1,0) OS(S-1,1) ... OS(S-1,I-1)
+</pre><p>For instance, the file containing the information for the example 
mentioned above is of the form</p><pre class="programlisting">
+2 4 4
+
+0 2
+0 2
+1 3
+1 3
+
+0 3
+3 0
+1 2
+2 1
+</pre></li><li><p>The third way is specific to FSMs resulting from shift 
registers, and the output symbol being the entire transition (ie, current_state 
and current_input). These FSMs are usefull when describibg ISI channels. In 
particular the state is comprised of the.....
+</p><pre class="programlisting">
+  fsm(const int mod_size, const int ch_length);
+</pre></li></ul></div><p>
+Finally, as can be seen from the above description, there are
+two more variables included in the FSM class implementation, 
+the PS and the PI matrices. These are computed internally 
+when an FSM is instantiated and their meaning is as follows.
+Sometimes (eg, in the traceback operation of the VA) we need
+to trace the history of the state or the input sequence. 
+To do this we would like to know for a given state s<sub>k</sub>, what are the 
possible previous states s<sub>k-1</sub>
+and what input symbols x<sub>k-1</sub> will get us from 
+s<sub>k-1</sub> to s<sub>k</sub>. This information can be derived from NS; 
however we want to have it ready in a 
+convenient format. 
+In the following we assume that for any state, 
+the number of incoming transitions is the same as the number of 
+outgoing transitions, ie, equal to I. All applications of interest 
+have FSMs satisfying this requirement.
+
+If we arbitrarily index the incoming transitions to the current state 
+by "i", then  as i goes from 0 to I-1, PS(s<sub>k</sub>,i)
+gives all previous states s<sub>k-1</sub>,
+and PI(s<sub>k</sub>,i) gives all previous inputs x<sub>k-1</sub>.
+In other words, for any given s<sub>k</sub> and any index i=0,1,...I-1, 
starting from 
+s<sub>k-1</sub>=PS(s<sub>k</sub>,i)
+with input 
+x<sub>k-1</sub>=PI(s<sub>k</sub>,i)
+will get us to the state s<sub>k</sub>. 
+More formally, for any i=0,1,...I-1 we have
+s<sub>k</sub> = NS(PS(s<sub>k</sub>,i),PI(s<sub>k</sub>,i)).
+
+</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a name="tcm"></a>TCM: A Complete 
Example</h2></div></div><div></div></div><p>
+We now discuss through a concrete example how
+the above FSM model can be used in GNU Radio.
+
+The communication system that we want to simulate
+consists of a source generating the
+input information in packets, a CC encoding each packet separately, 
+a memoryless modulator,
+an additive white Gaussian noise (AWGN) channel, and
+the VA performing MLSD.
+The program source is as follows.
+</p><pre class="programlisting">
+#!/usr/bin/env python
+
+from gnuradio import gr
+from gnuradio import audio
+from gnuradio import trellis
+from gnuradio import eng_notation
+import math
+import sys
+import random
+import fsm_utils
+
+def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
+    fg = gr.flow_graph ()
+
+
+    # TX
+    src = gr.lfsr_32k_source_s()
+    src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts
+    s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack 
shorts to symbols compatible with the FSM input cardinality
+    enc = trellis.encoder_ss(f,0) # initial state = 0
+    mod = gr.chunks_to_symbols_sf(constellation,dimensionality)
+
+    
+    # CHANNEL
+    add = gr.add_ff()
+    noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
+
+
+    # RX
+    metrics = 
trellis.metrics_f(f.O(),dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN) 
# data preprocessing to generate metrics for Viterbi
+    va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are 
not set.
+    fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack 
FSM input symbols to shorts
+    dst = gr.check_lfsr_32k_s(); 
+    
+
+    fg.connect (src,src_head,s2fsmi,enc,mod)
+    fg.connect (mod,(add,0))
+    fg.connect (noise,(add,1))
+    fg.connect (add,metrics)
+    fg.connect (metrics,va,fsmi2s,dst)
+    
+
+    fg.run()
+    
+    # A bit of cheating: run the program once and print the 
+    # final encoder state..
+    # Then put it as the last argument in the viterbi block
+    #print "final state = " , enc.ST()
+
+    ntotal = dst.ntotal ()
+    nright = dst.nright ()
+    runlength = dst.runlength ()
+    return (ntotal,ntotal-nright)
+
+
+
+
+def main(args):
+    nargs = len (args)
+    if nargs == 3:
+        fname=args[0]
+        esn0_db=float(args[1]) # Es/No in dB
+        rep=int(args[2]) # number of times the experiment is run to collect 
enough errors
+    else:
+        sys.stderr.write ('usage: test_tcm.py fsm_fname Es/No_db  
repetitions\n')
+        sys.exit (1)
+
+    # system parameters
+    f=trellis.fsm(fname) # get the FSM specification from a file (will 
hopefully be automated in the future...)
+    Kb=1024*16  # packet size in bits (make it multiple of 16 so it can be 
packed in a short)
+    bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM 
input symbol
+    K=Kb/bitspersymbol # packet size in trellis steps
+    modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined 
modulations
+    dimensionality = modulation[0]
+    constellation = modulation[1] 
+    if len(constellation)/dimensionality != f.O():
+        sys.stderr.write ('Incompatible FSM output cardinality and modulation 
size.\n')
+        sys.exit (1)
+    # calculate average symbol energy
+    Es = 0
+    for i in range(len(constellation)):
+        Es = Es + constellation[i]**2
+    Es = Es / (len(constellation)/dimensionality)
+    N0=Es/pow(10.0,esn0_db/10.0); # noise variance
+    
+
+
+    tot_s=0
+    terr_s=0
+    for i in range(rep):
+        
(s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i))
 # run experiment with different seed to get different noise realizations
+        tot_s=tot_s+s
+        terr_s=terr_s+e
+        if (i%100==0):
+            print i,s,e,tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s)
+    # estimate of the (short) error rate
+    print tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s)
+
+
+if __name__ == '__main__':
+    main (sys.argv[1:])
+</pre><p>
+The program is called by
+</p><pre class="programlisting">
+./test_tcm.py fsm_fname Es/No_db repetitions
+</pre><p>
+where "fsm_fname" is the file containing the FSM specification of the
+tested TCM code, "Es/No_db" is the SNR in dB, and "repetitions" 
+are the number of packets to be transmitted and received in order to
+collect sufficient number of errors for an accurate estimate of the
+error rate.
+</p><p>
+The FSM is first intantiated in "main" by 
+</p><pre class="programlisting">
+    f=trellis.fsm(fname)
+</pre><p>
+Each packet has size Kb bits
+(we choose Kb to be a multiple of 16 so that all bits fit nicely into shorts 
and can be generated by the lfsr GNU Radio).
+Assuming that the FSM input has cardinality I, each input symbol consists 
+of bitspersymbol=log<sub>2</sub>( I ). The Kb/16 shorts are now 
+unpacked to K=Kb/bitspersymbol input
+symbols that will drive the FSM encoder.
+</p><pre class="programlisting">
+    Kb=1024*16  # packet size in bits (make it multiple of 16 so it can be 
packed in a short)
+    bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM 
input symbol
+    K=Kb/bitspersymbol # packet size in trellis steps
+</pre><p>
+The FSM will produce K output symbols (remeber the FSM produces always one 
output symbol for each input symbol). Each of these symbols needs to be 
modulated. Since we are simulating the communication system, we need not 
simulate the actual waveforms. An M-ary, N-dimensional
+modulation is completely specified by a set of M, N-dimensional real vectors. 
In "fsm_utils.py" file we give a number of useful modulations with the 
following format: modulation = (N,constellation), where
+constellation=[c11,c12,...,c1N,c21,c22,...,c2N,...,cM1,cM2,...cMN].
+The meaning of the above is that every constellation point c_i
+is an N-dimnsional vector c_i=(ci1,ci2,...,ciN)
+For instance, 4-ary PAM is represented as
+(1,[-3, -1, 1, 3]), while QPSK is represented as
+(2,[1, 0, 0, 1, 0, -1, -1, 0]). In our example we choose QPSK modulation.
+Clearly, M should be equal to the cardinality of the FSM output, O.
+Finally the average symbol energy and noise variance are calculated.
+</p><pre class="programlisting">
+    modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined 
modulations
+    dimensionality = modulation[0]
+    constellation = modulation[1]
+    if len(constellation)/dimensionality != f.O():
+        sys.stderr.write ('Incompatible FSM output cardinality and modulation 
size.\n')
+        sys.exit (1)
+    # calculate average symbol energy
+    Es = 0
+    for i in range(len(constellation)):
+        Es = Es + constellation[i]**2
+    Es = Es / (len(constellation)/dimensionality)
+    N0=Es/pow(10.0,esn0_db/10.0); # noise variance
+</pre><p>
+Then, "run_test" is called with a different "seed" so that we get
+different noise realizations.
+</p><pre class="programlisting">
+        
(s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i))
 # run experiment with different seed to get different noise realizations
+</pre><p>
+Let us examine now the "run_test" function. 
+First we set up the transmitter blocks.
+The Kb/16 shorts are first unpacked to 
+symbols consistent with the FSM input alphabet.
+The FSm encoder requires the FSM specification,
+and an initial state (which is set to 0 in this example).
+</p><pre class="programlisting">
+    # TX
+    src = gr.lfsr_32k_source_s()
+    src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts
+    s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack 
shorts to symbols compatible with the FSM input cardinality
+    enc = trellis.encoder_ss(f,0) # initial state = 0
+</pre><p>
+The "chunks_to_symbols_sf" is essentially a memoryless mapper which 
+for each input symbol y_k 
+outputs a sequence of N numbers ci1,ci2,...,ciN  representing the 
+coordianates of the constellation symbol c_i with i=y_k.
+</p><pre class="programlisting">
+    mod = gr.chunks_to_symbols_sf(constellation,dimensionality)
+</pre><p>
+The channel is AWGN with appropriate noise variance.
+For each transmitted symbol c_k=(ck1,ck2,...,ckN) we receive a noisy version
+r_k=(rk1,rk2,...,rkN).
+</p><pre class="programlisting">
+    add = gr.add_ff()
+    noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
+</pre><p>
+Part of the design methodology was to decouple the FSM and VA from
+the details of the modulation, channel, receiver front-end etc.
+In order for the VA to run, we only need to provide it with
+a number representing a cost associated with each transition 
+in the trellis. Then the VA will find the sequence with 
+the smallest total cost through the trellis. 
+The cost associated with a transition (s_k,x_k) is only a function
+of the output y_k = OS(s_k,x_k), and the observation
+vector r_k. Thus, for each time period, k,
+we need to label each of the SxI transitions with such a cost.
+This means that for each time period we need to evaluate 
+O such numbers (one for each possible output symbol y_k). 
+This is done 
+in "metrics_f". In particular, metrics_f is a memoryless device
+taking N inputs at a time and producing O outputs. The N inputs are
+rk1,rk2,...,rkN.
+The O outputs
+are the costs associated with observations rk1,rk2,...,rkN and
+hypothesized output symbols c_1,c_2,...,c_M. For instance,
+if we choose to perform soft-input VA, we need to evaluate
+the Euclidean distance between r_k and each of c_1,c_2,...,c_M,
+for each of the K transmitted symbols.
+Other options are available as well; for instance, we can
+do hard decision demodulation and feed the VA with 
+symbol Hamming distances, or even bit Hamming distances, etc.
+These are all implemented in "metrics_f".
+</p><pre class="programlisting">
+    # RX
+    metrics = 
trellis.metrics_f(f.O(),dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN) 
# data preprocessing to generate metrics for Viterbi           
+</pre><p>
+Now the VA can run once it is supplied by the initial and final states.
+The initial state is known to be 0; the final state is usually 
+forced to some value by padding the information sequence appropriately.
+In this example, we always send the the same info sequence (we only randomize 
noise) so we can evaluate off line the final state and then provide it to the 
VA (a value of -1 signifies that there is no fixed initial
+or final state). The VA outputs the estimates of the symbols x_k which
+are then packed to shorts and compared with the transmitted sequence.
+</p><pre class="programlisting">
+    va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are 
not set.  
+    fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack 
FSM input symbols to shorts
+    dst = gr.check_lfsr_32k_s();
+</pre><p>
+The function returns the number of shorts and the number of shorts in error. 
Observe that this way the estimated error rate refers to 
+16-bit-symbol error rate.
+</p><pre class="programlisting">
+return (ntotal,ntotal-nright)
+</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a name="future"></a>Future 
Work</h2></div></div><div></div></div><div class="itemizedlist"><ul 
type="disc"><li><p>
+Improve the documentation :-)
+</p></li><li><p>
+automate fsm generation from generator polynomials 
+(feedforward or feedback form).
+</p></li><li><p>
+Optimize the VA code.
+</p></li><li><p>
+Provide implementation of soft-input soft-output (SISO) decoders for 
+potential use in concatenated systems. Also a host of suboptimal
+decoders, eg, sphere decoding, M- and T- algorithms, sequential decoding, etc.
+</p></li><li><p>
+Although turbo decoding is rediculously slow in software, 
+we can design it in pronciple. The question is, should 
+we use the FSM and SISO abstractions and cnnect them
+through GNU radio or should we implement turbo-decoding
+as a single block (issues with buffering between blocks).
+</p></li></ul></div></div></div></body></html>

Deleted: gnuradio/trunk/gr-trellis/doc/gr-trellis.xml

Copied: gnuradio/trunk/gr-trellis/doc/gr-trellis.xml (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/doc/gr-trellis.xml)
===================================================================
--- gnuradio/trunk/gr-trellis/doc/gr-trellis.xml                                
(rev 0)
+++ gnuradio/trunk/gr-trellis/doc/gr-trellis.xml        2006-08-07 16:28:55 UTC 
(rev 3219)
@@ -0,0 +1,653 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+          "docbookx.dtd" [
+  <!ENTITY test_tcm_listing SYSTEM "test_tcm.py">
+]>
+
+<article>
+
+<articleinfo>
+  <title>Trellis-based algorithms for GNU Radio</title>
+  <author>
+     <firstname>Achilleas</firstname>
+     <surname>Anastasopoulos</surname>
+     <affiliation>
+        <address>
+           <email>address@hidden</email>
+        </address>
+     </affiliation>
+  </author>
+
+<revhistory>
+  <revision>
+  <revnumber>v0.0</revnumber>
+  <date>2006-08-03</date>
+  <revremark>
+    First cut.
+  </revremark>
+  </revision>
+
+</revhistory>
+
+<abstract><para>This document provides a description of the 
+Finite State Machine (FSM) implementation and the related 
+trellis-based encoding and decoding algorithms
+for GNU Radio.
+</para></abstract>
+
+</articleinfo>
+
+
+
+
+<!--=====================================================-->
+<sect1 id="intro"><title>Introduction</title>
+
+<para>....</para>
+
+<para>
+The basic goal of the implementation is to have a generic way of 
+describing an FSM that is decoupled from whether it describes a 
+convolutional 
+code (CC), a trellis code (TC), an inter-symbol interference (ISI) 
+channel, or any
+other communication system that can be modeled with an FSM.
+To achieve this goal, we need to separate the pure FSM descrition from the
+rest of the model details. For instance, in the case of a rate 2/3 TC, 
+the FSM should not involve details about the modulation used (it can
+be an 8-ary PAM, or 8-PSK, etc). Similarly, when attempting maximum likelihood
+sequence detection (MLSD)--using for instance the Viterbi algorithm (VA)--
+the VA implementation should not be concerned with the channel details
+(such as modulations, channel type, hard or soft inputs, etc).
+Clearly, having generality as the primary goal implies some penalty
+on the code efficiency, as compared to fully custom implementations. 
+</para>
+
+<para>
+We will now describe the implementation of the basic ingedient, the FSM.
+</para>
+
+</sect1>
+
+
+<!--=====================================================-->
+<sect1 id="fsm"><title>The FSM class</title>
+
+<para>An FSM describes the evolution of a system with inputs
+x<subscript>k</subscript>, states s<subscript>k</subscript> and outputs 
y<subscript>k</subscript>. At time k the FSM state is 
s<subscript>k</subscript>. 
+Upon reception of a new input symbol x<subscript>k</subscript>, it outputs an 
output symbol
+y<subscript>k</subscript> which is a function of both 
x<subscript>k</subscript> and s<subscript>k</subscript>.  
+It will then move to a next state s<subscript>k+1</subscript>.
+An FSM has a finite number of states, input and output symbols. 
+All these are formally described as follows:
+</para>
+
+<itemizedlist>
+<listitem><para>The input alphabet A<subscript>I</subscript>={0,1,2,...,I-1}, 
with cardinality I, so that x<subscript>k</subscript> takes values in 
A<subscript>I</subscript>.</para></listitem>
+<listitem><para>The state alphabet A<subscript>S</subscript>={0,1,2,...,S-1}, 
with cardinality S, so that s<subscript>k</subscript> takes values in 
A<subscript>S</subscript>.</para></listitem>
+<listitem><para>The output alphabet A<subscript>O</subscript>={0,1,2,...,O-1}, 
with cardinality O, so that y<subscript>k</subscript> takes values in 
A<subscript>O</subscript></para></listitem>
+<listitem><para>The "next-state" function NS: A<subscript>S</subscript> x 
A<subscript>I</subscript> --> A<subscript>S</subscript>, 
+with the meaning 
+s<subscript>k+1</subscript> = NS(s<subscript>k</subscript>, 
x<subscript>k</subscript>)</para></listitem>
+<listitem><para>The "output-symbol" function OS: A<subscript>S</subscript> x 
A<subscript>I</subscript> --> A<subscript>S</subscript>, 
+with the meaning 
+y<subscript>k</subscript> = OS(s<subscript>k</subscript>, 
x<subscript>k</subscript>)</para></listitem>
+</itemizedlist>
+
+<para>
+Thus, a complete description of the FSM is given by the 
+the five-tuple (I,S,O,NS,OS).
+Observe that implementation details are hidden 
+in how the outside world interprets these input and output 
+integer symbols.
+Here is an example of an FSM describing the (2,1) CC
+with constraint length 3 and generator polynomial matrix
+(1+D+D<superscript>2</superscript>   1+D<superscript>2</superscript>)
+from Proakis-Salehi pg. 779.
+</para>
+
+
+<example id="cc_ex"><title>(2,1) CC with generator polynomials 
(1+D+D<superscript>2</superscript>   1+D<superscript>2</superscript>)</title>
+
+<para>
+This CC accepts 1 bit at a time, and outputs 2 bits at a time.
+It has a shift register storing the last two input bits.
+In particular, 
+b<subscript>k</subscript>(0)=x<subscript>k</subscript>+
+x<subscript>k-1</subscript>+x<subscript>k-2</subscript>, and
+b<subscript>k</subscript>(1)=x<subscript>k</subscript>+
+x<subscript>k-2</subscript>, where addition is mod-2. 
+We can represent the state of this system
+as s<subscript>k</subscript> = (x<subscript>k-1</subscript> 
x<subscript>k-2</subscript>)<subscript>10</subscript>. In addition we can 
represent its
+output symbol as y<subscript>k</subscript> = (b<subscript>k</subscript>(1) 
b<subscript>k</subscript>(0))<subscript>10</subscript>. 
+Based on the above assumptions, the input alphabet 
A<subscript>I</subscript>={0,1}, so I=2; 
+the state alphabet A<subscript>S</subscript>={0,1,2,3}, so S=4; and
+the output alphabet A<subscript>O</subscript>={0,1,2,3}, so O=4.
+The "next-state" function NS(,) is given by
+<programlisting>
+s<subscript>k</subscript>      x<subscript>k</subscript>       
s<subscript>k+1</subscript>
+0      0       0
+0      1       2
+1      0       0
+1      1       2
+2      0       1
+2      1       3
+3      0       1
+3      1       3
+</programlisting>
+The "output-symbol" function OS(,) can be given by
+<programlisting>
+s<subscript>k</subscript>       x<subscript>k</subscript>       
y<subscript>k</subscript>
+0      0       0
+0      1       3
+1      0       3
+1      1       0
+2      0       1
+2      1       2
+3      0       2
+3      1       1
+</programlisting>
+</para>
+
+<para>
+Note that although the CC outputs 2 bits per time period, following 
+our approach, there is only one (quaternary) output symbol per 
+time period (for instance, here we use the decimal representation 
+of the 2-bits). Also note that the modulation used is not part of 
+the FSM description: it can be BPSK, OOK, BFSK, QPSK with or without Gray 
mapping, etc; 
+it is up to the rest of the program to interpret the meaning of 
+the symbol y<subscript>k</subscript>.
+</para>
+
+</example>
+
+
+<para>
+The C++ implementation of the FSM class keeps private information about
+I,S,O,NS,OS and public methods to read and write them. The NS
+and OS matrices are implemented as STL 1-dimensional vectors.
+</para>
+
+<programlisting>
+class fsm {
+private:
+  int d_I;
+  int d_S;
+  int d_O;
+  std::vector&lt;int&gt; d_NS;
+  std::vector&lt;int&gt; d_OS;
+  std::vector&lt;int&gt; d_PS;
+  std::vector&lt;int&gt; d_PI;
+public:
+  fsm();
+  fsm(const fsm &amp;FSM);
+  fsm(const int I, const int S, const int O, const std::vector&lt;int&gt; 
&amp;NS, const std::vector&lt;int&gt; &amp;OS);
+  fsm(const char *name);
+  fsm(const int mod_size, const int ch_length);
+  int I () const { return d_I; }
+  int S () const { return d_S; }
+  int O () const { return d_O; }
+  const std::vector&lt;int&gt; &amp; NS () const { return d_NS; }
+  const std::vector&lt;int&gt; &amp; OS () const { return d_OS; }
+  const std::vector&lt;int&gt; &amp; PS () const { return d_PS; }
+  const std::vector&lt;int&gt; &amp; PI () const { return d_PI; }
+};
+</programlisting>
+
+<para>
+As can be seen, other than the trivial and the copy constructor, 
+there are three additional
+ways to construct an FSM. 
+</para>
+
+<itemizedlist>
+<listitem>
+<para>Supplying the parameters I,S,O,NS,OS:</para>
+<programlisting>
+  fsm(const int I, const int S, const int O, const std::vector&lt;int&gt; 
&amp;NS, const std::vector&lt;int&gt; &amp;OS);
+</programlisting>
+</listitem>
+
+<listitem>
+<para>Giving a filename containing all the FSM information:</para>
+<programlisting>
+  fsm(const char *name);
+</programlisting>
+<para>This information has to be in the following format</para>
+<programlisting>
+I S O
+
+NS(0,0)   NS(0,1)   ...  NS(0,I-1)
+NS(1,0)   NS(1,1)   ...  NS(1,I-1)
+...
+NS(S-1,0) NS(S-1,1) ...  NS(S-1,I-1)
+
+OS(0,0)   OS(0,1)   ...  OS(0,I-1)
+OS(1,0)   OS(1,1)   ...  OS(1,I-1)
+...
+OS(S-1,0) OS(S-1,1) ... OS(S-1,I-1)
+</programlisting>
+<para>For instance, the file containing the information for the example 
mentioned above is of the form</para>
+<programlisting>
+2 4 4
+
+0 2
+0 2
+1 3
+1 3
+
+0 3
+3 0
+1 2
+2 1
+</programlisting>
+</listitem>
+
+<listitem>
+<para>The third way is specific to FSMs resulting from shift registers, and 
the output symbol being the entire transition (ie, current_state and 
current_input). These FSMs are usefull when describibg ISI channels. In 
particular the state is comprised of the.....
+</para>
+<programlisting>
+  fsm(const int mod_size, const int ch_length);
+</programlisting>
+</listitem>
+
+</itemizedlist>
+
+
+<para>
+Finally, as can be seen from the above description, there are
+two more variables included in the FSM class implementation, 
+the PS and the PI matrices. These are computed internally 
+when an FSM is instantiated and their meaning is as follows.
+Sometimes (eg, in the traceback operation of the VA) we need
+to trace the history of the state or the input sequence. 
+To do this we would like to know for a given state s<subscript>k</subscript>, 
what are the possible previous states s<subscript>k-1</subscript>
+and what input symbols x<subscript>k-1</subscript> will get us from 
+s<subscript>k-1</subscript> to s<subscript>k</subscript>. This information can 
be derived from NS; however we want to have it ready in a 
+convenient format. 
+In the following we assume that for any state, 
+the number of incoming transitions is the same as the number of 
+outgoing transitions, ie, equal to I. All applications of interest 
+have FSMs satisfying this requirement.
+
+If we arbitrarily index the incoming transitions to the current state 
+by "i", then  as i goes from 0 to I-1, PS(s<subscript>k</subscript>,i)
+gives all previous states s<subscript>k-1</subscript>,
+and PI(s<subscript>k</subscript>,i) gives all previous inputs 
x<subscript>k-1</subscript>.
+In other words, for any given s<subscript>k</subscript> and any index 
i=0,1,...I-1, starting from 
+s<subscript>k-1</subscript>=PS(s<subscript>k</subscript>,i)
+with input 
+x<subscript>k-1</subscript>=PI(s<subscript>k</subscript>,i)
+will get us to the state s<subscript>k</subscript>. 
+More formally, for any i=0,1,...I-1 we have
+s<subscript>k</subscript> = 
NS(PS(s<subscript>k</subscript>,i),PI(s<subscript>k</subscript>,i)).
+
+</para>
+
+
+</sect1>
+
+
+
+
+
+<!--=====================================================-->
+<sect1 id="tcm"><title>TCM: A Complete Example</title>
+
+<para>
+We now discuss through a concrete example how
+the above FSM model can be used in GNU Radio.
+
+The communication system that we want to simulate
+consists of a source generating the
+input information in packets, a CC encoding each packet separately, 
+a memoryless modulator,
+an additive white Gaussian noise (AWGN) channel, and
+the VA performing MLSD.
+The program source is as follows.
+</para>
+
+
+
+<programlisting>
+#!/usr/bin/env python
+
+from gnuradio import gr
+from gnuradio import audio
+from gnuradio import trellis
+from gnuradio import eng_notation
+import math
+import sys
+import random
+import fsm_utils
+
+def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
+    fg = gr.flow_graph ()
+
+
+    # TX
+    src = gr.lfsr_32k_source_s()
+    src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts
+    s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack 
shorts to symbols compatible with the FSM input cardinality
+    enc = trellis.encoder_ss(f,0) # initial state = 0
+    mod = gr.chunks_to_symbols_sf(constellation,dimensionality)
+
+    
+    # CHANNEL
+    add = gr.add_ff()
+    noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
+
+
+    # RX
+    metrics = 
trellis.metrics_f(f.O(),dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN) 
# data preprocessing to generate metrics for Viterbi
+    va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are 
not set.
+    fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack 
FSM input symbols to shorts
+    dst = gr.check_lfsr_32k_s(); 
+    
+
+    fg.connect (src,src_head,s2fsmi,enc,mod)
+    fg.connect (mod,(add,0))
+    fg.connect (noise,(add,1))
+    fg.connect (add,metrics)
+    fg.connect (metrics,va,fsmi2s,dst)
+    
+
+    fg.run()
+    
+    # A bit of cheating: run the program once and print the 
+    # final encoder state..
+    # Then put it as the last argument in the viterbi block
+    #print "final state = " , enc.ST()
+
+    ntotal = dst.ntotal ()
+    nright = dst.nright ()
+    runlength = dst.runlength ()
+    return (ntotal,ntotal-nright)
+
+
+
+
+def main(args):
+    nargs = len (args)
+    if nargs == 3:
+        fname=args[0]
+        esn0_db=float(args[1]) # Es/No in dB
+        rep=int(args[2]) # number of times the experiment is run to collect 
enough errors
+    else:
+        sys.stderr.write ('usage: test_tcm.py fsm_fname Es/No_db  
repetitions\n')
+        sys.exit (1)
+
+    # system parameters
+    f=trellis.fsm(fname) # get the FSM specification from a file (will 
hopefully be automated in the future...)
+    Kb=1024*16  # packet size in bits (make it multiple of 16 so it can be 
packed in a short)
+    bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM 
input symbol
+    K=Kb/bitspersymbol # packet size in trellis steps
+    modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined 
modulations
+    dimensionality = modulation[0]
+    constellation = modulation[1] 
+    if len(constellation)/dimensionality != f.O():
+        sys.stderr.write ('Incompatible FSM output cardinality and modulation 
size.\n')
+        sys.exit (1)
+    # calculate average symbol energy
+    Es = 0
+    for i in range(len(constellation)):
+        Es = Es + constellation[i]**2
+    Es = Es / (len(constellation)/dimensionality)
+    N0=Es/pow(10.0,esn0_db/10.0); # noise variance
+    
+
+
+    tot_s=0
+    terr_s=0
+    for i in range(rep):
+        
(s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i))
 # run experiment with different seed to get different noise realizations
+        tot_s=tot_s+s
+        terr_s=terr_s+e
+        if (i%100==0):
+            print i,s,e,tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s)
+    # estimate of the (short) error rate
+    print tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s)
+
+
+if __name__ == '__main__':
+    main (sys.argv[1:])
+</programlisting>
+
+<para>
+The program is called by
+</para>
+<programlisting>
+./test_tcm.py fsm_fname Es/No_db repetitions
+</programlisting>
+<para>
+where "fsm_fname" is the file containing the FSM specification of the
+tested TCM code, "Es/No_db" is the SNR in dB, and "repetitions" 
+are the number of packets to be transmitted and received in order to
+collect sufficient number of errors for an accurate estimate of the
+error rate.
+</para>
+
+<para>
+The FSM is first intantiated in "main" by 
+</para>
+<programlisting>
+    f=trellis.fsm(fname)
+</programlisting>
+
+
+
+
+
+
+
+<para>
+Each packet has size Kb bits
+(we choose Kb to be a multiple of 16 so that all bits fit nicely into shorts 
and can be generated by the lfsr GNU Radio).
+Assuming that the FSM input has cardinality I, each input symbol consists 
+of bitspersymbol=log<subscript>2</subscript>( I ). The Kb/16 shorts are now 
+unpacked to K=Kb/bitspersymbol input
+symbols that will drive the FSM encoder.
+</para>
+<programlisting>
+    Kb=1024*16  # packet size in bits (make it multiple of 16 so it can be 
packed in a short)
+    bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM 
input symbol
+    K=Kb/bitspersymbol # packet size in trellis steps
+</programlisting>
+
+
+
+<para>
+The FSM will produce K output symbols (remeber the FSM produces always one 
output symbol for each input symbol). Each of these symbols needs to be 
modulated. Since we are simulating the communication system, we need not 
simulate the actual waveforms. An M-ary, N-dimensional
+modulation is completely specified by a set of M, N-dimensional real vectors. 
In "fsm_utils.py" file we give a number of useful modulations with the 
following format: modulation = (N,constellation), where
+constellation=[c11,c12,...,c1N,c21,c22,...,c2N,...,cM1,cM2,...cMN].
+The meaning of the above is that every constellation point c_i
+is an N-dimnsional vector c_i=(ci1,ci2,...,ciN)
+For instance, 4-ary PAM is represented as
+(1,[-3, -1, 1, 3]), while QPSK is represented as
+(2,[1, 0, 0, 1, 0, -1, -1, 0]). In our example we choose QPSK modulation.
+Clearly, M should be equal to the cardinality of the FSM output, O.
+Finally the average symbol energy and noise variance are calculated.
+</para>
+<programlisting>
+    modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined 
modulations
+    dimensionality = modulation[0]
+    constellation = modulation[1]
+    if len(constellation)/dimensionality != f.O():
+        sys.stderr.write ('Incompatible FSM output cardinality and modulation 
size.\n')
+        sys.exit (1)
+    # calculate average symbol energy
+    Es = 0
+    for i in range(len(constellation)):
+        Es = Es + constellation[i]**2
+    Es = Es / (len(constellation)/dimensionality)
+    N0=Es/pow(10.0,esn0_db/10.0); # noise variance
+</programlisting>
+
+
+
+<para>
+Then, "run_test" is called with a different "seed" so that we get
+different noise realizations.
+</para>
+<programlisting>
+        
(s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i))
 # run experiment with different seed to get different noise realizations
+</programlisting>
+
+
+
+<para>
+Let us examine now the "run_test" function. 
+First we set up the transmitter blocks.
+The Kb/16 shorts are first unpacked to 
+symbols consistent with the FSM input alphabet.
+The FSm encoder requires the FSM specification,
+and an initial state (which is set to 0 in this example).
+</para>
+<programlisting>
+    # TX
+    src = gr.lfsr_32k_source_s()
+    src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts
+    s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack 
shorts to symbols compatible with the FSM input cardinality
+    enc = trellis.encoder_ss(f,0) # initial state = 0
+</programlisting>
+
+
+
+
+
+<para>
+The "chunks_to_symbols_sf" is essentially a memoryless mapper which 
+for each input symbol y_k 
+outputs a sequence of N numbers ci1,ci2,...,ciN  representing the 
+coordianates of the constellation symbol c_i with i=y_k.
+</para>
+<programlisting>
+    mod = gr.chunks_to_symbols_sf(constellation,dimensionality)
+</programlisting>
+
+<para>
+The channel is AWGN with appropriate noise variance.
+For each transmitted symbol c_k=(ck1,ck2,...,ckN) we receive a noisy version
+r_k=(rk1,rk2,...,rkN).
+</para>
+<programlisting>
+    add = gr.add_ff()
+    noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
+</programlisting>
+
+
+
+<para>
+Part of the design methodology was to decouple the FSM and VA from
+the details of the modulation, channel, receiver front-end etc.
+In order for the VA to run, we only need to provide it with
+a number representing a cost associated with each transition 
+in the trellis. Then the VA will find the sequence with 
+the smallest total cost through the trellis. 
+The cost associated with a transition (s_k,x_k) is only a function
+of the output y_k = OS(s_k,x_k), and the observation
+vector r_k. Thus, for each time period, k,
+we need to label each of the SxI transitions with such a cost.
+This means that for each time period we need to evaluate 
+O such numbers (one for each possible output symbol y_k). 
+This is done 
+in "metrics_f". In particular, metrics_f is a memoryless device
+taking N inputs at a time and producing O outputs. The N inputs are
+rk1,rk2,...,rkN.
+The O outputs
+are the costs associated with observations rk1,rk2,...,rkN and
+hypothesized output symbols c_1,c_2,...,c_M. For instance,
+if we choose to perform soft-input VA, we need to evaluate
+the Euclidean distance between r_k and each of c_1,c_2,...,c_M,
+for each of the K transmitted symbols.
+Other options are available as well; for instance, we can
+do hard decision demodulation and feed the VA with 
+symbol Hamming distances, or even bit Hamming distances, etc.
+These are all implemented in "metrics_f".
+</para>
+<programlisting>
+    # RX
+    metrics = 
trellis.metrics_f(f.O(),dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN) 
# data preprocessing to generate metrics for Viterbi           
+</programlisting>
+
+<para>
+Now the VA can run once it is supplied by the initial and final states.
+The initial state is known to be 0; the final state is usually 
+forced to some value by padding the information sequence appropriately.
+In this example, we always send the the same info sequence (we only randomize 
noise) so we can evaluate off line the final state and then provide it to the 
VA (a value of -1 signifies that there is no fixed initial
+or final state). The VA outputs the estimates of the symbols x_k which
+are then packed to shorts and compared with the transmitted sequence.
+</para>
+<programlisting>
+    va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are 
not set.  
+    fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack 
FSM input symbols to shorts
+    dst = gr.check_lfsr_32k_s();
+</programlisting>
+
+
+
+
+<para>
+The function returns the number of shorts and the number of shorts in error. 
Observe that this way the estimated error rate refers to 
+16-bit-symbol error rate.
+</para>
+<programlisting>
+return (ntotal,ntotal-nright)
+</programlisting>
+
+
+
+</sect1>
+
+
+<!--=====================================================-->
+<sect1 id="future"><title>Future Work</title>
+
+
+
+<itemizedlist>
+
+<listitem>
+<para>
+Improve the documentation :-)
+</para>
+</listitem>
+
+<listitem>
+<para>
+automate fsm generation from generator polynomials 
+(feedforward or feedback form).
+</para>
+</listitem>
+
+<listitem>
+<para>
+Optimize the VA code.
+</para>
+</listitem>
+
+<listitem>
+<para>
+Provide implementation of soft-input soft-output (SISO) decoders for 
+potential use in concatenated systems. Also a host of suboptimal
+decoders, eg, sphere decoding, M- and T- algorithms, sequential decoding, etc.
+</para>
+</listitem>
+
+
+<listitem>
+<para>
+Although turbo decoding is rediculously slow in software, 
+we can design it in pronciple. The question is, should 
+we use the FSM and SISO abstractions and cnnect them
+through GNU radio or should we implement turbo-decoding
+as a single block (issues with buffering between blocks).
+</para>
+</listitem>
+
+</itemizedlist>
+
+</sect1>
+
+
+</article>

Deleted: gnuradio/trunk/gr-trellis/doc/test_tcm.py

Copied: gnuradio/trunk/gr-trellis/doc/test_tcm.py (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/doc/test_tcm.py)
===================================================================
--- gnuradio/trunk/gr-trellis/doc/test_tcm.py                           (rev 0)
+++ gnuradio/trunk/gr-trellis/doc/test_tcm.py   2006-08-07 16:28:55 UTC (rev 
3219)
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+
+from gnuradio import gr
+from gnuradio import audio
+from gnuradio import trellis
+from gnuradio import eng_notation
+import math
+import sys
+import random
+import fsm_utils
+
+def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
+    fg = gr.flow_graph ()
+
+
+    # TX
+    #packet = [0]*Kb
+    #for i in range(Kb-1*16): # last 16 bits = 0 to drive the final state to 0
+        #packet[i] = random.randint(0, 1) # random 0s and 1s
+    #src = gr.vector_source_s(packet,False)
+    src = gr.lfsr_32k_source_s()
+    src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts
+    #b2s = gr.unpacked_to_packed_ss(1,gr.GR_MSB_FIRST) # pack bits in shorts
+    s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack 
shorts to symbols compatible with the FSM input cardinality
+    enc = trellis.encoder_ss(f,0) # initial state = 0
+    mod = gr.chunks_to_symbols_sf(constellation,dimensionality)
+
+    
+    # CHANNEL
+    add = gr.add_ff()
+    noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
+
+
+    # RX
+    metrics = 
trellis.metrics_f(f.O(),dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN) 
# data preprocessing to generate metrics for Viterbi
+    va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are 
not set.
+    fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack 
FSM input symbols to shorts
+    #s2b = gr.packed_to_unpacked_ss(1,gr.GR_MSB_FIRST) # unpack shorts to bits
+    #dst = gr.vector_sink_s(); 
+    dst = gr.check_lfsr_32k_s(); 
+    
+
+    fg.connect (src,src_head,s2fsmi,enc,mod)
+    #fg.connect (src,b2s,s2fsmi,enc,mod)
+    fg.connect (mod,(add,0))
+    fg.connect (noise,(add,1))
+    fg.connect (add,metrics)
+    fg.connect (metrics,va,fsmi2s,dst)
+    #fg.connect (metrics,va,fsmi2s,s2b,dst)
+    
+
+    fg.run()
+    
+    # A bit of cheating: run the program once and print the 
+    # final encoder state..
+    # Then put it as the last argument in the viterbi block
+    #print "final state = " , enc.ST()
+
+    ntotal = dst.ntotal ()
+    nright = dst.nright ()
+    runlength = dst.runlength ()
+    #ntotal = len(packet)
+    #if len(dst.data()) != ntotal:
+        #print "Error: not enough data\n"
+    #nright = 0;
+    #for i in range(ntotal):
+        #if packet[i]==dst.data()[i]:
+            #nright=nright+1
+        #else:
+            #print "Error in ", i
+    return (ntotal,ntotal-nright)
+
+
+
+
+def main(args):
+    nargs = len (args)
+    if nargs == 3:
+        fname=args[0]
+        esn0_db=float(args[1]) # Es/No in dB
+        rep=int(args[2]) # number of times the experiment is run to collect 
enough errors
+    else:
+        sys.stderr.write ('usage: test_tcm.py fsm_fname Es/No_db  
repetitions\n')
+        sys.exit (1)
+
+    # system parameters
+    f=trellis.fsm(fname) # get the FSM specification from a file (will 
hopefully be automated in the future...)
+    Kb=1024*16  # packet size in bits (make it multiple of 16 so it can be 
packed in a short)
+    bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM 
input symbol
+    K=Kb/bitspersymbol # packet size in trellis steps
+    modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined 
modulations
+    dimensionality = modulation[0]
+    constellation = modulation[1] 
+    if len(constellation)/dimensionality != f.O():
+        sys.stderr.write ('Incompatible FSM output cardinality and modulation 
size.\n')
+        sys.exit (1)
+    # calculate average symbol energy
+    Es = 0
+    for i in range(len(constellation)):
+        Es = Es + constellation[i]**2
+    Es = Es / (len(constellation)/dimensionality)
+    N0=Es/pow(10.0,esn0_db/10.0); # noise variance
+    
+
+
+    tot_s=0
+    terr_s=0
+    for i in range(rep):
+        
(s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i))
 # run experiment with different seed to get different noise realizations
+        tot_s=tot_s+s
+        terr_s=terr_s+e
+        if (i%100==0):
+            print i,s,e,tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s)
+    # estimate of the (short or bit) error rate
+    print tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s)
+
+
+if __name__ == '__main__':
+    main (sys.argv[1:])
+

Copied: gnuradio/trunk/gr-trellis/src (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src)


Property changes on: gnuradio/trunk/gr-trellis/src
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
howto.cc
howto.py


Deleted: gnuradio/trunk/gr-trellis/src/Makefile.am

Copied: gnuradio/trunk/gr-trellis/src/Makefile.am (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/Makefile.am)
===================================================================
--- gnuradio/trunk/gr-trellis/src/Makefile.am                           (rev 0)
+++ gnuradio/trunk/gr-trellis/src/Makefile.am   2006-08-07 16:28:55 UTC (rev 
3219)
@@ -0,0 +1,22 @@
+#
+# 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+SUBDIRS = lib python

Copied: gnuradio/trunk/gr-trellis/src/lib (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib)


Property changes on: gnuradio/trunk/gr-trellis/src/lib
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
*.pyc
trellis.cc
trellis.py


Deleted: gnuradio/trunk/gr-trellis/src/lib/Makefile.am

Copied: gnuradio/trunk/gr-trellis/src/lib/Makefile.am (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/Makefile.am)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/Makefile.am                               
(rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/Makefile.am       2006-08-07 16:28:55 UTC 
(rev 3219)
@@ -0,0 +1,97 @@
+#
+# Copyright 2004,2005,2006 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+include $(top_srcdir)/Makefile.common
+
+include Makefile.gen
+
+# Install this stuff so that it ends up as the gnuradio.trellis module
+# This usually ends up at:
+#   ${prefix}/lib/python${python_version}/site-packages/gnuradio
+
+ourpythondir = $(grpythondir)
+ourlibdir    = $(grpyexecdir)
+
+INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS)
+
+SWIGPYTHONARGS = $(SWIGPYTHONFLAGS) $(STD_DEFINES_AND_INCLUDES)
+
+ALL_IFILES =                           \
+       $(LOCAL_IFILES)                 \
+       $(NON_LOCAL_IFILES)             
+
+NON_LOCAL_IFILES =                     \
+       $(top_srcdir)/gnuradio-core/src/lib/swig/gnuradio.i
+
+
+LOCAL_IFILES =                                 \
+       trellis.i                       
+
+
+# These files are built by SWIG.  The first is the C++ glue.
+# The second is the python wrapper that loads the _trellis shared library
+# and knows how to call our extensions.
+
+BUILT_SOURCES =                        \
+       trellis.cc                      \
+       trellis.py                              
+
+# This gets trellis.py installed in the right place
+ourpython_PYTHON =                     \
+       trellis.py
+
+ourlib_LTLIBRARIES = _trellis.la
+
+# These are the source files that go into the shared library
+_trellis_la_SOURCES =                  \
+       trellis.cc                      \
+        fsm.cc                         \
+        trellis_calc_metric.cc         \
+       $(GENERATED_CC)                 
+
+# magic flags
+_trellis_la_LDFLAGS = -module -avoid-version
+
+# link the library against some comon swig runtime code and the 
+# c++ standard library
+_trellis_la_LIBADD =                   \
+       $(PYTHON_LDFLAGS)               \
+       $(GNURADIO_CORE_LIBS)           \
+       -lstdc++                        
+
+trellis.cc trellis.py: trellis.i $(ALL_IFILES)
+       $(SWIG) $(SWIGPYTHONARGS) -module trellis -o trellis.cc $<
+
+# These headers get installed in ${prefix}/include/gnuradio
+grinclude_HEADERS =                    \
+        fsm.h                          \
+        trellis_metric_type.h          \
+        trellis_calc_metric.h          \
+       $(GENERATED_H)                  
+
+
+# These swig headers get installed in ${prefix}/include/gnuradio/swig
+swiginclude_HEADERS =                  \
+       $(LOCAL_IFILES)
+
+
+MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/Makefile.gen

Copied: gnuradio/trunk/gr-trellis/src/lib/Makefile.gen (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/Makefile.gen)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/Makefile.gen                              
(rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/Makefile.gen      2006-08-07 16:28:55 UTC 
(rev 3219)
@@ -0,0 +1,51 @@
+#
+# This file is machine generated.  All edits will be overwritten
+#
+GENERATED_H = \
+       trellis_encoder_bb.h \
+       trellis_encoder_bi.h \
+       trellis_encoder_bs.h \
+       trellis_encoder_ii.h \
+       trellis_encoder_si.h \
+       trellis_encoder_ss.h \
+       trellis_metrics_c.h \
+       trellis_metrics_f.h \
+       trellis_viterbi_b.h \
+       trellis_viterbi_combined_b.h \
+       trellis_viterbi_combined_i.h \
+       trellis_viterbi_combined_s.h \
+       trellis_viterbi_i.h \
+       trellis_viterbi_s.h
+
+GENERATED_I = \
+       trellis_encoder_bb.i \
+       trellis_encoder_bi.i \
+       trellis_encoder_bs.i \
+       trellis_encoder_ii.i \
+       trellis_encoder_si.i \
+       trellis_encoder_ss.i \
+       trellis_metrics_c.i \
+       trellis_metrics_f.i \
+       trellis_viterbi_b.i \
+       trellis_viterbi_combined_b.i \
+       trellis_viterbi_combined_i.i \
+       trellis_viterbi_combined_s.i \
+       trellis_viterbi_i.i \
+       trellis_viterbi_s.i
+
+GENERATED_CC = \
+       trellis_encoder_bb.cc \
+       trellis_encoder_bi.cc \
+       trellis_encoder_bs.cc \
+       trellis_encoder_ii.cc \
+       trellis_encoder_si.cc \
+       trellis_encoder_ss.cc \
+       trellis_metrics_c.cc \
+       trellis_metrics_f.cc \
+       trellis_viterbi_b.cc \
+       trellis_viterbi_combined_b.cc \
+       trellis_viterbi_combined_i.cc \
+       trellis_viterbi_combined_s.cc \
+       trellis_viterbi_i.cc \
+       trellis_viterbi_s.cc
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/build_utils.py

Copied: gnuradio/trunk/gr-trellis/src/lib/build_utils.py (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/build_utils.py)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/build_utils.py                            
(rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/build_utils.py    2006-08-07 16:28:55 UTC 
(rev 3219)
@@ -0,0 +1,193 @@
+#
+# 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+"""Misc utilities used at build time
+"""
+
+import re, os, os.path
+from build_utils_codes import *
+
+
+# set srcdir to the directory that contains Makefile.am
+try:
+    srcdir = os.environ['srcdir']
+except KeyError, e:
+    srcdir = "."
+srcdir = srcdir + '/'
+
+
+name_dict = {}
+
+def log_output_name (name):
+    (base, ext) = os.path.splitext (name)
+    ext = ext[1:]                       # drop the leading '.'
+    
+    entry = name_dict.setdefault (ext, [])
+    entry.append (name)
+    
+def open_and_log_name (name, dir):
+    f = open (name, dir)
+    log_output_name (name)
+    return f
+
+def expand_template (d, template_filename, extra = ""):
+    '''Given a dictionary D and a TEMPLATE_FILENAME, expand template into 
output file
+    '''
+    output_extension = extract_extension (template_filename)
+    template = open_src (template_filename, 'r')
+    output_name = d['NAME'] + extra + '.' + output_extension
+    log_output_name (output_name)
+    output = open (output_name, 'w')
+    do_substitution (d, template, output)
+    template.close ()
+    output.close ()
+
+def output_glue (dirname):
+    output_makefile_fragment ()
+    output_ifile_include (dirname)
+    
+def output_makefile_fragment ():
+    f = open ('Makefile.gen', 'w')
+    f.write ('#\n# This file is machine generated.  All edits will be 
overwritten\n#\n')
+    output_subfrag (f, 'h')
+    output_subfrag (f, 'i')
+    output_subfrag (f, 'cc')
+    f.close ()
+
+def output_ifile_include (dirname):
+    f = open ('%s_generated.i' % (dirname,), 'w')
+    f.write ('//\n// This file is machine generated.  All edits will be 
overwritten\n//\n')
+    files = name_dict.setdefault ('i', [])
+    files.sort ()
+    f.write ('%{\n')
+    for file in files:
+        f.write ('#include <%s>\n' % (file[0:-1] + 'h',))
+    f.write ('%}\n\n')
+    for file in files:
+        f.write ('%%include <%s>\n' % (file,))
+
+def output_subfrag (f, ext):
+    files = name_dict.setdefault (ext, [])
+    files.sort ()
+    f.write ("GENERATED_%s =" % (ext.upper ()))
+    for file in files:
+        f.write (" \\\n\t%s" % (file,))
+    f.write ("\n\n")
+    
+
+def extract_extension (template_name):
+    # template name is something like: GrFIRfilterXXX.h.t
+    # we return everything between the penultimate . and .t
+    mo = re.search (r'\.([a-z]+)\.t$', template_name)
+    if not mo:
+        raise ValueError, "Incorrectly formed template_name '%s'" % 
(template_name,)
+    return mo.group (1)
+
+def open_src (name, mode):
+    global srcdir
+    return open (os.path.join (srcdir, name), mode)
+
+def do_substitution (d, in_file, out_file):
+    def repl (match_obj):
+        key = match_obj.group (1)
+        # print key
+        return d[key]
+    
+    inp = in_file.read ()
+    out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, inp)
+    out_file.write (out)
+
+    
+
+copyright = '''/* -*- c++ -*- */
+/*
+ * Copyright 2003,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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+'''
+
+def is_byte (code3):
+    if i_code (code3) == 'b' or o_code (code3) == 'b':
+        return '1'
+    else:
+        return '0'
+
+def is_short (code3):
+    if i_code (code3) == 's' or o_code (code3) == 's':
+        return '1'
+    else:
+        return '0'
+
+def is_int (code3):
+    if i_code (code3) == 'i' or o_code (code3) == 'i':
+        return '1'
+    else:
+        return '0'
+
+def is_float (code3):
+    if i_code (code3) == 'f' or o_code (code3) == 'f':
+        return '1'
+    else:
+        return '0'
+
+def is_complex (code3):
+    if i_code (code3) == 'c' or o_code (code3) == 'c':
+        return '1'
+    else:
+        return '0'
+
+
+
+
+def standard_dict (name, code3):
+    d = {}
+    d['NAME'] = name
+    d['GUARD_NAME'] = 'INCLUDED_%s_H' % name.upper ()
+    d['BASE_NAME'] = re.sub ('^trellis_', '', name)
+    d['SPTR_NAME'] = '%s_sptr' % name
+    d['WARNING'] = 'WARNING: this file is machine generated.  Edits will be 
over written'
+    d['COPYRIGHT'] = copyright
+    d['TYPE'] = i_type (code3)
+    d['I_TYPE'] = i_type (code3)
+    d['O_TYPE'] = o_type (code3)
+    d['TAP_TYPE'] = tap_type (code3)
+    d['IS_BYTE'] = is_byte (code3)
+    d['IS_SHORT'] = is_short (code3)
+    d['IS_INT'] = is_int (code3)
+    d['IS_FLOAT'] = is_float (code3)
+    d['IS_COMPLEX'] = is_complex (code3)
+    return d

Deleted: gnuradio/trunk/gr-trellis/src/lib/build_utils_codes.py

Copied: gnuradio/trunk/gr-trellis/src/lib/build_utils_codes.py (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/build_utils_codes.py)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/build_utils_codes.py                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/build_utils_codes.py      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,52 @@
+#
+# 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+def i_code (code3):
+    return code3[0]
+
+def o_code (code3):
+    if len (code3) >= 2:
+        return code3[1]
+    else:
+        return code3[0]
+
+def tap_code (code3):
+    if len (code3) >= 3:
+        return code3[2]
+    else:
+        return code3[0]
+
+def i_type (code3):
+    return char_to_type[i_code (code3)]
+
+def o_type (code3):
+    return char_to_type[o_code (code3)]
+
+def tap_type (code3):
+    return char_to_type[tap_code (code3)]
+
+
+char_to_type = {}
+char_to_type['s'] = 'short'
+char_to_type['i'] = 'int'
+char_to_type['f'] = 'float'
+char_to_type['c'] = 'gr_complex'
+char_to_type['b'] = 'unsigned char'

Deleted: gnuradio/trunk/gr-trellis/src/lib/fsm.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/fsm.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/fsm.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/fsm.cc                            (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/fsm.cc    2006-08-07 16:28:55 UTC (rev 
3219)
@@ -0,0 +1,149 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cstdio>
+#include <stdexcept>
+#include <cmath>
+#include "fsm.h"
+
+fsm::fsm()
+{
+  d_I=0;
+  d_S=0;
+  d_O=0;
+  d_NS.resize(0);
+  d_OS.resize(0);
+  d_PS.resize(0);
+  d_PI.resize(0);
+}
+
+fsm::fsm(const fsm &FSM)
+{
+  d_I=FSM.I();
+  d_S=FSM.S();
+  d_O=FSM.O();
+  d_NS=FSM.NS();
+  d_OS=FSM.OS();
+  d_PS=FSM.PS();
+  d_PI=FSM.PI();
+}
+
+fsm::fsm(const int I, const int S, const int O, const std::vector<int> &NS, 
const std::vector<int> &OS)
+{
+  d_I=I;
+  d_S=S;
+  d_O=O;
+  d_NS=NS;
+  d_OS=OS;
+  d_PS.resize(d_I*d_S);
+  d_PI.resize(d_I*d_S);
+  
+  // generate the PS, PI tables for later use
+  for(int i=0;i<d_S;i++) {
+    int j=0;
+    for(int ii=0;ii<d_S;ii++) for(int jj=0;jj<d_I;jj++) {
+      if(d_NS[ii*d_I+jj]!=i) continue;
+      d_PS[i*d_I+j]=ii;
+      d_PI[i*d_I+j]=jj;
+      j++;
+    }
+  }
+}
+
+//######################################################################
+//# Read an FSM specification from a file.
+//# Format (hopefully will become more flexible in the future...):
+//# I S O (in the first line)
+//# blank line
+//# Next state matrix (S lines, each with I integers separated by spaces)
+//# blank line
+//# output symbol matrix (S lines, each with I integers separated by spaces)
+//# optional comments
+//######################################################################
+fsm::fsm(const char *name) 
+{
+  FILE *fsmfile;
+
+  if((fsmfile=fopen(name,"r"))==NULL) 
+    throw std::runtime_error ("file open error in fsm()");
+    //printf("file open error in fsm()\n");
+  
+  fscanf(fsmfile,"%d %d %d\n",&d_I,&d_S,&d_O);
+  d_NS.resize(d_I*d_S);
+  d_OS.resize(d_I*d_S);
+  d_PS.resize(d_I*d_S);
+  d_PI.resize(d_I*d_S);
+
+  for(int i=0;i<d_S;i++) {
+    for(int j=0;j<d_I;j++) fscanf(fsmfile,"%d",&(d_NS[i*d_I+j]));
+  }
+  for(int i=0;i<d_S;i++) {
+    for(int j=0;j<d_I;j++) fscanf(fsmfile,"%d",&(d_OS[i*d_I+j]));
+  }
+  
+  // generate the PS, PI tables for later use
+  for(int i=0;i<d_S;i++) {
+    int j=0;
+    for(int ii=0;ii<d_S;ii++) for(int jj=0;jj<d_I;jj++) {
+      if(d_NS[ii*d_I+jj]!=i) continue;
+      d_PS[i*d_I+j]=ii;
+      d_PI[i*d_I+j]=jj;
+      j++;
+    }
+  }
+}
+
+//######################################################################
+//# Automatically generate an FSM specification describing the 
+//# ISI for a channel
+//# of length ch_length and a modulation of size mod_size
+//######################################################################
+fsm::fsm(const int mod_size, const int ch_length)
+{
+  d_I=mod_size;
+  d_S=(int) (pow(1.0*d_I,1.0*ch_length-1)+0.5);
+  d_O=d_S*d_I;
+
+  d_NS.resize(d_I*d_S);
+  d_OS.resize(d_I*d_S);
+  d_PS.resize(d_I*d_S);
+  d_PI.resize(d_I*d_S);
+
+  for(int s=0;s<d_S;s++) {
+    for(int i=0;i<d_I;i++) { 
+      int t=i*d_S+s;
+      d_NS[s*d_I+i] = t/d_I;
+      d_OS[s*d_I+i] = t;
+    }
+  }
+  
+  // generate the PS, PI tables for later use
+  for(int i=0;i<d_S;i++) {
+    int j=0;
+    for(int ii=0;ii<d_S;ii++) for(int jj=0;jj<d_I;jj++) {
+      if(d_NS[ii*d_I+jj]!=i) continue;
+      d_PS[i*d_I+j]=ii;
+      d_PI[i*d_I+j]=jj;
+      j++;
+    }
+  }
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/fsm.h

Copied: gnuradio/trunk/gr-trellis/src/lib/fsm.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/fsm.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/fsm.h                             (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/fsm.h     2006-08-07 16:28:55 UTC (rev 
3219)
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_FSM_H
+#define INCLUDED_TRELLIS_FSM_H
+
+#include <vector>
+
+/*!
+ * \brief  FSM class
+ */
+class fsm {
+private:
+  int d_I;
+  int d_S;
+  int d_O;
+  std::vector<int> d_NS;
+  std::vector<int> d_OS;
+  std::vector<int> d_PS;
+  std::vector<int> d_PI;
+public:
+  fsm();
+  fsm(const fsm &FSM);
+  fsm(const int I, const int S, const int O, const std::vector<int> &NS, const 
std::vector<int> &OS);
+  fsm(const char *name);
+  fsm(const int mod_size, const int ch_length);
+  int I () const { return d_I; }
+  int S () const { return d_S; }
+  int O () const { return d_O; }
+  const std::vector<int> & NS () const { return d_NS; }
+  const std::vector<int> & OS () const { return d_OS; }
+  const std::vector<int> & PS () const { return d_PS; }
+  const std::vector<int> & PI () const { return d_PI; }
+};
+
+#endif

Deleted: gnuradio/trunk/gr-trellis/src/lib/fsm.i

Copied: gnuradio/trunk/gr-trellis/src/lib/fsm.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/fsm.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/fsm.i                             (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/fsm.i     2006-08-07 16:28:55 UTC (rev 
3219)
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+class fsm {
+private:
+  int d_I;
+  int d_S;
+  int d_O;
+  std::vector<int> d_NS;
+  std::vector<int> d_OS;
+  std::vector<int> d_PS;
+  std::vector<int> d_PI;
+public:
+  fsm();
+  fsm(const fsm &FSM);
+  fsm(const int I, const int S, const int O, const std::vector<int> &NS, const 
std::vector<int> &OS);
+  fsm(const char *name);
+  fsm(const int mod_size, const int ch_length);
+  int I () const { return d_I; }
+  int S () const { return d_S; }
+  int O () const { return d_O; }
+  const std::vector<int> & NS () const { return d_NS; }
+  const std::vector<int> & OS () const { return d_OS; }
+  const std::vector<int> & PS () const { return d_PS; }
+  const std::vector<int> & PI () const { return d_PI; }
+};
+
+
+
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/generate_all.py

Copied: gnuradio/trunk/gr-trellis/src/lib/generate_all.py (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/generate_all.py)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/generate_all.py                           
(rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/generate_all.py   2006-08-07 16:28:55 UTC 
(rev 3219)
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+#
+# 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+from build_utils import output_glue
+
+import generate_common
+
+def generate_all ():
+    generate_common.generate ()
+    output_glue ('trellis')
+
+
+if __name__ == '__main__':
+    generate_all ()

Deleted: gnuradio/trunk/gr-trellis/src/lib/generate_common.py

Copied: gnuradio/trunk/gr-trellis/src/lib/generate_common.py (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/generate_common.py)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/generate_common.py                        
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/generate_common.py        2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+from build_utils import expand_template, standard_dict
+from build_utils_codes import *
+
+import re
+
+
+# regular blocks
+other_roots = [
+    'trellis_encoder_XX',
+    'trellis_metrics_X',
+    'trellis_viterbi_X',
+    'trellis_viterbi_combined_X',
+    ]
+other_signatures = (
+    ['bb','bs','bi','ss','si','ii'],
+    ['f','c'],
+    ['b','s','i'],
+    ['b','s','i'],
+    )
+
+
+
+def expand_h_cc_i (root, sig):
+    # root looks like 'gr_vector_sink_X'
+    name = re.sub ('X+', sig, root)
+    d = standard_dict (name, sig)
+    expand_template (d, root + '.h.t')
+    expand_template (d, root + '.cc.t')
+    expand_template (d, root + '.i.t')
+
+
+def generate ():
+    i=0
+    for r in other_roots :
+        for s in other_signatures[i]:
+            expand_h_cc_i (r, s)
+        i=i+1
+            
+
+
+if __name__ == '__main__':
+    generate ()
+
+    

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis.i                         (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis.i 2006-08-07 16:28:55 UTC (rev 
3219)
@@ -0,0 +1,21 @@
+/* -*- c++ -*- */
+
+%feature("autodoc", "1");              // generate python docstrings
+
+%include "exception.i"
+%import "gnuradio.i"                   // the common stuff
+
+%{
+#include "gnuradio_swig_bug_workaround.h"      // mandatory bug fix
+#include "fsm.h"
+#include <stdexcept>
+%}
+
+// ----------------------------------------------------------------
+
+%include "fsm.i"
+%include "trellis_metric_type.h"
+
+
+%include "trellis_generated.i"
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.cc (from rev 
3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_calc_metric.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.cc                    
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.cc    2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,92 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <float.h>
+#include <stdexcept>
+#include "trellis_calc_metric.h"
+
+// soft decisions (Eucledean distance squared)
+void calc_metric_f(const int O, const int D, const std::vector<float> &TABLE, 
const float *in, float *metric, trellis_metric_type_t type)
+{
+  float minm = FLT_MAX;
+  int minmi = 0;
+
+  switch (type){
+  case TRELLIS_EUCLIDEAN:
+    for(int o=0;o<O;o++) {
+       metric[o]=0.0;
+       for (int m=0;m<D;m++) {
+           float s=in[m]-TABLE[o*D+m];
+           metric[o]+=s*s;
+       }
+    } 
+    break;
+  case TRELLIS_HARD_SYMBOL:
+    for(int o=0;o<O;o++) {
+       metric[o]=0.0;
+       for (int m=0;m<D;m++) {
+           float s=in[m]-TABLE[o*D+m];
+           metric[o]+=s*s;
+       }
+       if(metric[o]<minm) {
+         minm=metric[o];
+         minmi=o;
+       }
+    }
+    for(int o=0;o<O;o++) {
+      metric[o] = (o==minmi?0.0:1.0);
+    }
+    break;
+  case TRELLIS_HARD_BIT:
+    throw std::runtime_error ("Invalid metric type (not yet implemented).");
+    break;
+  default:
+    throw std::runtime_error ("Invalid metric type.");
+  }
+}
+
+
+// soft decisions (Eucledean distance squared)
+void calc_metric_c(const int O, const int D, const std::vector<gr_complex> 
&TABLE, const gr_complex *in, float *metric, trellis_metric_type_t type)
+{
+  float minm = FLT_MAX;
+  int minmi = 0;
+
+  switch (type){
+  case TRELLIS_EUCLIDEAN:
+    for(int o=0;o<O;o++) {
+      metric[o]=0.0;
+      for (int m=0;m<D;m++) {
+        gr_complex s=in[m]-TABLE[o*D+m];
+        metric[o]+=s.real()*s.real()+s.imag()*s.imag();
+      }
+    }
+  case TRELLIS_HARD_SYMBOL:
+    throw std::runtime_error ("Invalid metric type (not yet implemented).");
+    break;
+  case TRELLIS_HARD_BIT:
+    throw std::runtime_error ("Invalid metric type (not yet implemented).");
+    break;
+  default:
+    throw std::runtime_error ("Invalid metric type.");
+  }
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_calc_metric.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.h                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_calc_metric.h     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,34 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_CALC_METRIC_H
+#define INCLUDED_TRELLIS_CALC_METRIC_H
+
+#include <vector>
+#include <gr_complex.h>
+#include <trellis_metric_type.h>
+
+void calc_metric_f(const int O, const int D, const std::vector<float> &TABLE, 
const float *in, float *metric, trellis_metric_type_t type);
+
+void calc_metric_c(const int O, const int D, const std::vector<gr_complex> 
&TABLE, const gr_complex *in, float *metric, trellis_metric_type_t type);
+
+#endif

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.cc.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.cc.t (from rev 
3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_XX.cc.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.cc.t                   
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.cc.t   2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,76 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@address@hidden>
+#include <gr_io_signature.h>
+#include <iostream>
+
address@hidden@ 
address@hidden@ (const fsm &FSM, const int ST)
+{
+  return @SPTR_NAME@ (new @NAME@ (FSM,ST));
+}
+
address@hidden@::@NAME@ (const fsm &FSM, const int ST)
+  : gr_sync_block ("@BASE_NAME@",
+                  gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
+                  gr_make_io_signature (1, -1, sizeof (@O_TYPE@))),
+    d_FSM (FSM),
+    d_ST (ST)
+{
+}
+
+
+
+int 
address@hidden@::work (int noutput_items,
+                       gr_vector_const_void_star &input_items,
+                       gr_vector_void_star &output_items)
+{
+  int d_ST_tmp;
+
+  assert (input_items.size() == output_items.size());
+  int nstreams = input_items.size();
+
+for (int m=0;m<nstreams;m++) {
+  const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[m];
+  @O_TYPE@ *out = (@O_TYPE@ *) output_items[m];
+  d_ST_tmp = d_ST;
+
+// per stream processing
+
+  for (int i = 0; i < noutput_items; i++){
+    out[i] = (@O_TYPE@) d_FSM.OS()[d_ST_tmp*d_FSM.I()+in[i]]; // direction of 
time?
+    d_ST_tmp = (int) d_FSM.NS()[d_ST_tmp*d_FSM.I()+in[i]];
+  }
+
+// end per stream processing
+}
+  d_ST = d_ST_tmp;
+
+  return noutput_items;
+}
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.h.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.h.t (from rev 
3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_XX.h.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.h.t                    
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.h.t    2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,59 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include "fsm.h"
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
address@hidden@ address@hidden@ (const fsm &FSM, const int ST);
+
+/*!
+ * \brief Convolutional encoder.
+ * \ingroup block
+ *
+ * 
+ */
+class @NAME@ : public gr_sync_block
+{
+private:
+  friend @SPTR_NAME@ address@hidden@ (const fsm &FSM, const int ST);
+  fsm d_FSM;
+  int d_ST;
+  @NAME@ (const fsm &FSM, const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.i.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.i.t (from rev 
3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_XX.i.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.i.t                    
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_XX.i.t    2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,36 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
+
address@hidden@ address@hidden@ (const fsm &FSM, const int ST);
+
+class @NAME@ : public gr_sync_block
+{
+private:
+  @NAME@ (const fsm &FSM, const int ST);
+public:
+  fsm FSM () const { return d_FSM; }
+  int ST () const { return d_ST; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_bb.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.cc                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.cc     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,76 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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, const int ST)
+{
+  return trellis_encoder_bb_sptr (new trellis_encoder_bb (FSM,ST));
+}
+
+trellis_encoder_bb::trellis_encoder_bb (const fsm &FSM, const 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 d_ST_tmp;
+
+  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];
+  d_ST_tmp = d_ST;
+
+// per stream processing
+
+  for (int i = 0; i < noutput_items; i++){
+    out[i] = (unsigned char) d_FSM.OS()[d_ST_tmp*d_FSM.I()+in[i]]; // 
direction of time?
+    d_ST_tmp = (int) d_FSM.NS()[d_ST_tmp*d_FSM.I()+in[i]];
+  }
+
+// end per stream processing
+}
+  d_ST = d_ST_tmp;
+
+  return noutput_items;
+}
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_bb.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.h                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.h      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,59 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const 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, 
const int ST);
+  fsm d_FSM;
+  int d_ST;
+  trellis_encoder_bb (const fsm &FSM, const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_bb.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.i                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bb.i      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,36 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const int ST);
+
+class trellis_encoder_bb : public gr_sync_block
+{
+private:
+  trellis_encoder_bb (const fsm &FSM, const int ST);
+public:
+  fsm FSM () const { return d_FSM; }
+  int ST () const { return d_ST; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_bi.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.cc                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.cc     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,76 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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, const int ST)
+{
+  return trellis_encoder_bi_sptr (new trellis_encoder_bi (FSM,ST));
+}
+
+trellis_encoder_bi::trellis_encoder_bi (const fsm &FSM, const 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 d_ST_tmp;
+
+  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];
+  d_ST_tmp = d_ST;
+
+// per stream processing
+
+  for (int i = 0; i < noutput_items; i++){
+    out[i] = (int) d_FSM.OS()[d_ST_tmp*d_FSM.I()+in[i]]; // direction of time?
+    d_ST_tmp = (int) d_FSM.NS()[d_ST_tmp*d_FSM.I()+in[i]];
+  }
+
+// end per stream processing
+}
+  d_ST = d_ST_tmp;
+
+  return noutput_items;
+}
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_bi.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.h                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.h      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,59 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const 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, 
const int ST);
+  fsm d_FSM;
+  int d_ST;
+  trellis_encoder_bi (const fsm &FSM, const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_bi.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.i                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bi.i      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,36 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const int ST);
+
+class trellis_encoder_bi : public gr_sync_block
+{
+private:
+  trellis_encoder_bi (const fsm &FSM, const int ST);
+public:
+  fsm FSM () const { return d_FSM; }
+  int ST () const { return d_ST; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_bs.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.cc                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.cc     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,76 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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, const int ST)
+{
+  return trellis_encoder_bs_sptr (new trellis_encoder_bs (FSM,ST));
+}
+
+trellis_encoder_bs::trellis_encoder_bs (const fsm &FSM, const 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 d_ST_tmp;
+
+  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];
+  d_ST_tmp = d_ST;
+
+// per stream processing
+
+  for (int i = 0; i < noutput_items; i++){
+    out[i] = (short) d_FSM.OS()[d_ST_tmp*d_FSM.I()+in[i]]; // direction of 
time?
+    d_ST_tmp = (int) d_FSM.NS()[d_ST_tmp*d_FSM.I()+in[i]];
+  }
+
+// end per stream processing
+}
+  d_ST = d_ST_tmp;
+
+  return noutput_items;
+}
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_bs.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.h                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.h      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,59 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const 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, 
const int ST);
+  fsm d_FSM;
+  int d_ST;
+  trellis_encoder_bs (const fsm &FSM, const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_bs.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.i                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_bs.i      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,36 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const int ST);
+
+class trellis_encoder_bs : public gr_sync_block
+{
+private:
+  trellis_encoder_bs (const fsm &FSM, const int ST);
+public:
+  fsm FSM () const { return d_FSM; }
+  int ST () const { return d_ST; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_ii.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.cc                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.cc     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,76 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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, const int ST)
+{
+  return trellis_encoder_ii_sptr (new trellis_encoder_ii (FSM,ST));
+}
+
+trellis_encoder_ii::trellis_encoder_ii (const fsm &FSM, const 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 d_ST_tmp;
+
+  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];
+  d_ST_tmp = d_ST;
+
+// per stream processing
+
+  for (int i = 0; i < noutput_items; i++){
+    out[i] = (int) d_FSM.OS()[d_ST_tmp*d_FSM.I()+in[i]]; // direction of time?
+    d_ST_tmp = (int) d_FSM.NS()[d_ST_tmp*d_FSM.I()+in[i]];
+  }
+
+// end per stream processing
+}
+  d_ST = d_ST_tmp;
+
+  return noutput_items;
+}
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_ii.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.h                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.h      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,59 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const 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, 
const int ST);
+  fsm d_FSM;
+  int d_ST;
+  trellis_encoder_ii (const fsm &FSM, const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_ii.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.i                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ii.i      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,36 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const int ST);
+
+class trellis_encoder_ii : public gr_sync_block
+{
+private:
+  trellis_encoder_ii (const fsm &FSM, const int ST);
+public:
+  fsm FSM () const { return d_FSM; }
+  int ST () const { return d_ST; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_si.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.cc                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.cc     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,76 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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, const int ST)
+{
+  return trellis_encoder_si_sptr (new trellis_encoder_si (FSM,ST));
+}
+
+trellis_encoder_si::trellis_encoder_si (const fsm &FSM, const 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 d_ST_tmp;
+
+  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];
+  d_ST_tmp = d_ST;
+
+// per stream processing
+
+  for (int i = 0; i < noutput_items; i++){
+    out[i] = (int) d_FSM.OS()[d_ST_tmp*d_FSM.I()+in[i]]; // direction of time?
+    d_ST_tmp = (int) d_FSM.NS()[d_ST_tmp*d_FSM.I()+in[i]];
+  }
+
+// end per stream processing
+}
+  d_ST = d_ST_tmp;
+
+  return noutput_items;
+}
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_si.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.h                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.h      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,59 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const 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, 
const int ST);
+  fsm d_FSM;
+  int d_ST;
+  trellis_encoder_si (const fsm &FSM, const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_si.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.i                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_si.i      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,36 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const int ST);
+
+class trellis_encoder_si : public gr_sync_block
+{
+private:
+  trellis_encoder_si (const fsm &FSM, const int ST);
+public:
+  fsm FSM () const { return d_FSM; }
+  int ST () const { return d_ST; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_ss.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.cc                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.cc     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,76 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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, const int ST)
+{
+  return trellis_encoder_ss_sptr (new trellis_encoder_ss (FSM,ST));
+}
+
+trellis_encoder_ss::trellis_encoder_ss (const fsm &FSM, const 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 d_ST_tmp;
+
+  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];
+  d_ST_tmp = d_ST;
+
+// per stream processing
+
+  for (int i = 0; i < noutput_items; i++){
+    out[i] = (short) d_FSM.OS()[d_ST_tmp*d_FSM.I()+in[i]]; // direction of 
time?
+    d_ST_tmp = (int) d_FSM.NS()[d_ST_tmp*d_FSM.I()+in[i]];
+  }
+
+// end per stream processing
+}
+  d_ST = d_ST_tmp;
+
+  return noutput_items;
+}
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_ss.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.h                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.h      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,59 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const 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, 
const int ST);
+  fsm d_FSM;
+  int d_ST;
+  trellis_encoder_ss (const fsm &FSM, const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_encoder_ss.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.i                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_encoder_ss.i      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,36 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, const int ST);
+
+class trellis_encoder_ss : public gr_sync_block
+{
+private:
+  trellis_encoder_ss (const fsm &FSM, const int ST);
+public:
+  fsm FSM () const { return d_FSM; }
+  int ST () const { return d_ST; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_generated.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_generated.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_generated.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_generated.i                       
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_generated.i       2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,34 @@
+//
+// This file is machine generated.  All edits will be overwritten
+//
+%{
+#include <trellis_encoder_bb.h>
+#include <trellis_encoder_bi.h>
+#include <trellis_encoder_bs.h>
+#include <trellis_encoder_ii.h>
+#include <trellis_encoder_si.h>
+#include <trellis_encoder_ss.h>
+#include <trellis_metrics_c.h>
+#include <trellis_metrics_f.h>
+#include <trellis_viterbi_b.h>
+#include <trellis_viterbi_combined_b.h>
+#include <trellis_viterbi_combined_i.h>
+#include <trellis_viterbi_combined_s.h>
+#include <trellis_viterbi_i.h>
+#include <trellis_viterbi_s.h>
+%}
+
+%include <trellis_encoder_bb.i>
+%include <trellis_encoder_bi.i>
+%include <trellis_encoder_bs.i>
+%include <trellis_encoder_ii.i>
+%include <trellis_encoder_si.i>
+%include <trellis_encoder_ss.i>
+%include <trellis_metrics_c.i>
+%include <trellis_metrics_f.i>
+%include <trellis_viterbi_b.i>
+%include <trellis_viterbi_combined_b.i>
+%include <trellis_viterbi_combined_i.i>
+%include <trellis_viterbi_combined_s.i>
+%include <trellis_viterbi_i.i>
+%include <trellis_viterbi_s.i>

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_metric_type.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_metric_type.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_metric_type.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_metric_type.h                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_metric_type.h     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,31 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_METRIC_TYPE_H
+#define INCLUDED_TRELLIS_METRIC_TYPE_H
+
+typedef enum {
+  TRELLIS_EUCLIDEAN = 200, TRELLIS_HARD_SYMBOL, TRELLIS_HARD_BIT
+} trellis_metric_type_t;
+
+#endif
+

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.cc.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.cc.t (from rev 
3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_metrics_X.cc.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.cc.t                    
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.cc.t    2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,96 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@address@hidden>
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <stdexcept>
+#include <iostream>
+
+
address@hidden@
address@hidden@ (const int O, const int D,  const std::vector<@I_TYPE@> &TABLE, 
trellis_metric_type_t TYPE)
+{
+  return @SPTR_NAME@ (new @NAME@ (O,D,TABLE,TYPE));
+}
+
+
+
address@hidden@::@NAME@ (const int O, const int D,  const std::vector<@I_TYPE@> 
&TABLE, trellis_metric_type_t TYPE)
+  : gr_block ("@BASE_NAME@",
+             gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
+             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
address@hidden@::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
address@hidden@::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 @I_TYPE@ *in = (@I_TYPE@ *) input_items[m];
+  float *out = (float *) output_items[m];
+
+  for (int i = 0; i < noutput_items / d_O ; i++){
+#if @IS_FLOAT@
+    calc_metric_f(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE);
+#elif @IS_COMPLEX@
+    calc_metric_c(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE);
+#endif
+  } 
+}
+
+  consume_each (d_D * noutput_items / d_O);
+  return noutput_items;
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.h.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.h.t (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_metrics_X.h.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.h.t                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.h.t     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,65 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_block.h>
+#include "trellis_calc_metric.h"
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
address@hidden@ address@hidden@ (const int O, const int D,  const 
std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE);
+
+/*!
+ * \brief Evaluate metrics for use by the Viterbi algorithm.
+ * \ingroup block
+ *
+ */
+class @NAME@ : public gr_block
+{
+  int d_O;
+  int d_D;
+  trellis_metric_type_t d_TYPE;
+  std::vector<@I_TYPE@> d_TABLE;
+
+  friend @SPTR_NAME@ address@hidden@ (const int O, const int D,  const 
std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE);
+  @NAME@ (const int O, const int D,  const std::vector<@I_TYPE@> &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<@I_TYPE@> 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.i.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.i.t (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_metrics_X.i.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.i.t                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_X.i.t     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,39 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
+
address@hidden@ address@hidden@ (const int O, const int D, const 
std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE);
+
+class @NAME@ : public gr_block
+{
+private:
+  @NAME@ (const int O, const int D, const std::vector<@I_TYPE@> &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<@I_TYPE@> TABLE () const { return d_TABLE; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_metrics_c.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.cc                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.cc      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,96 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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 (const int O, const 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 (const int O, const 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_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
+  } 
+}
+
+  consume_each (d_D * noutput_items / d_O);
+  return noutput_items;
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_metrics_c.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.h                       
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.h       2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,65 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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 (const int O, const 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 (const int O, const int 
D,  const std::vector<gr_complex> &TABLE, trellis_metric_type_t TYPE);
+  trellis_metrics_c (const int O, const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_metrics_c.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.i                       
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_c.i       2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,39 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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 (const int O, const int D, const 
std::vector<gr_complex> &TABLE, trellis_metric_type_t TYPE);
+
+class trellis_metrics_c : public gr_block
+{
+private:
+  trellis_metrics_c (const int O, const 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; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_metrics_f.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.cc                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.cc      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,96 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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 (const int O, const 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 (const int O, const 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 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
+  } 
+}
+
+  consume_each (d_D * noutput_items / d_O);
+  return noutput_items;
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_metrics_f.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.h                       
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.h       2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,65 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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 (const int O, const 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 (const int O, const int 
D,  const std::vector<float> &TABLE, trellis_metric_type_t TYPE);
+  trellis_metrics_f (const int O, const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_metrics_f.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.i                       
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_metrics_f.i       2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,39 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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 (const int O, const int D, const 
std::vector<float> &TABLE, trellis_metric_type_t TYPE);
+
+class trellis_metrics_f : public gr_block
+{
+private:
+  trellis_metrics_f (const int O, const 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; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.cc.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.cc.t (from rev 
3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_X.cc.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.cc.t                    
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.cc.t    2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,167 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@address@hidden>
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <iostream>
+  
+static const float INF = 1.0e9;
+
address@hidden@ 
address@hidden@ (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const int SK)
+{
+  return @SPTR_NAME@ (new @NAME@ (FSM,K,S0,SK));
+}
+
address@hidden@::@NAME@ (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const int SK)
+  : gr_block ("@BASE_NAME@",
+                         gr_make_io_signature (1, -1, sizeof (float)),
+                         gr_make_io_signature (1, -1, sizeof (@TYPE@))),  
+  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
address@hidden@::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(const int I, const int S, const int O, 
+             const std::vector<int> &NS,
+             const std::vector<int> &OS,
+             const std::vector<int> &PS,
+             const std::vector<int> &PI,
+             const int K,
+             const int S0,const int SK,
+             const float *in, @TYPE@ *out,
+             std::vector<int> &trace) 
+{
+  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(int i=0;i<I;i++) {
+              int i0 = j*I+i;
+              if((mm=alpha[alphai*S+PS[i0]]+in[k*O+OS[PS[i0]*I+PI[i0]]])<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=trace[(K-1)*S+i])<minm) minm=mm,minmi=i;
+      st=minmi;
+  }
+  else {
+      st=SK;
+  }
+
+  for(int k=K-1;k>=0;k--) { // traceback
+      int i0=st*I+trace[k*S+st];
+      out[k]= (@TYPE@) PI[i0];
+      st=PS[i0];
+  }
+
+}
+
+
+
+
+
+
+int
address@hidden@::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];
+    @TYPE@ *out = (@TYPE@ *) 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;
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.h.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.h.t (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_X.h.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.h.t                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.h.t     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,78 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include "fsm.h"
+#include <gr_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
address@hidden@ address@hidden@ (
+    const fsm &FSM, 
+    const int K,
+    const int S0,
+    const int SK);
+
+
+
+class @NAME@ : public gr_block
+{
+  fsm d_FSM;
+  int d_K;
+  int d_S0;
+  int d_SK;
+  std::vector<int> d_trace;
+
+  friend @SPTR_NAME@ address@hidden@ (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const int SK);
+
+
+  @NAME@ (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.i.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.i.t (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_X.i.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.i.t                     
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_X.i.t     2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,49 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
+
address@hidden@ address@hidden@ (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const int SK);
+
+
+class @NAME@ : public gr_block
+{
+private:
+  @NAME@ (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const 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; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_b.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.cc                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.cc      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,167 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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,
+    const int K,
+    const int S0,
+    const int SK)
+{
+  return trellis_viterbi_b_sptr (new trellis_viterbi_b (FSM,K,S0,SK));
+}
+
+trellis_viterbi_b::trellis_viterbi_b (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const 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(const int I, const int S, const int O, 
+             const std::vector<int> &NS,
+             const std::vector<int> &OS,
+             const std::vector<int> &PS,
+             const std::vector<int> &PI,
+             const int K,
+             const int S0,const int SK,
+             const float *in, unsigned char *out,
+             std::vector<int> &trace) 
+{
+  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(int i=0;i<I;i++) {
+              int i0 = j*I+i;
+              if((mm=alpha[alphai*S+PS[i0]]+in[k*O+OS[PS[i0]*I+PI[i0]]])<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=trace[(K-1)*S+i])<minm) minm=mm,minmi=i;
+      st=minmi;
+  }
+  else {
+      st=SK;
+  }
+
+  for(int k=K-1;k>=0;k--) { // traceback
+      int i0=st*I+trace[k*S+st];
+      out[k]= (unsigned char) PI[i0];
+      st=PS[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;
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_b.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.h                       
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.h       2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,78 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, 
+    const int K,
+    const int S0,
+    const 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,
+    const int K,
+    const int S0,
+    const int SK);
+
+
+  trellis_viterbi_b (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_b.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.i                       
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_b.i       2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,49 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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,
+    const int K,
+    const int S0,
+    const int SK);
+
+
+class trellis_viterbi_b : public gr_block
+{
+private:
+  trellis_viterbi_b (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const 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; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.cc.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.cc.t (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_X.cc.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.cc.t           
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.cc.t   
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,182 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@address@hidden>
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <iostream>
+  
+static const float INF = 1.0e9;
+
address@hidden@ 
address@hidden@ (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE)
+{
+  return @SPTR_NAME@ (new @NAME@ (FSM,D,TABLE,K,S0,SK,TYPE));
+}
+
address@hidden@::@NAME@ (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE)
+  : gr_block ("@BASE_NAME@",
+                         gr_make_io_signature (1, -1, sizeof (float)),
+                         gr_make_io_signature (1, -1, sizeof (@TYPE@))),  
+  d_FSM (FSM),
+  d_D (D),
+  d_TABLE (TABLE),
+  d_K (K),
+  d_S0 (S0),
+  d_SK (SK),
+  d_TYPE (TYPE),
+  d_trace(FSM.S()*K)
+{
+    set_relative_rate (1.0 / ((double) d_D));
+    set_output_multiple (d_K);
+}
+
+
+void
address@hidden@::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(const int I, const int S, const int O, 
+             const std::vector<int> &NS,
+             const std::vector<int> &OS,
+             const std::vector<int> &PS,
+             const std::vector<int> &PI,
+             const int D,
+             const std::vector<float> &TABLE,
+             const int K,
+             const int S0,const int SK,
+             const trellis_metric_type_t TYPE,
+             const float *in, @TYPE@ *out,
+             std::vector<int> &trace) 
+{
+  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_f(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(int i=0;i<I;i++) {
+              int i0 = j*I+i;
+              if((mm=alpha[alphai*S+PS[i0]]+metric[OS[PS[i0]*I+PI[i0]]])<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=trace[(K-1)*S+i])<minm) minm=mm,minmi=i;
+      st=minmi;
+  }
+  else {
+      st=SK;
+  }
+
+  for(int k=K-1;k>=0;k--) { // traceback
+      int i0=st*I+trace[k*S+st];
+      out[k]= (@TYPE@) PI[i0];
+      st=PS[i0];
+  }
+  
+  delete [] metric;
+
+}
+
+
+
+
+
+
+int
address@hidden@::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];
+    @TYPE@ *out = (@TYPE@ *) 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_D,d_TABLE,d_K,d_S0,d_SK,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]),d_trace);
+    }
+  }
+
+  consume_each (d_D * noutput_items );
+  return noutput_items;
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.h.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.h.t (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_X.h.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.h.t            
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.h.t    
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,93 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include "fsm.h"
+#include <gr_block.h>
+#include "trellis_calc_metric.h"
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
address@hidden@ address@hidden@ (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+class @NAME@ : public gr_block
+{
+  fsm d_FSM;
+  int d_D;
+  std::vector<float> d_TABLE;
+  int d_K;
+  int d_S0;
+  int d_SK;
+  trellis_metric_type_t d_TYPE;
+  std::vector<int> d_trace;
+
+  friend @SPTR_NAME@ address@hidden@ (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+  @NAME@ (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+public:
+  fsm FSM () const { return d_FSM; }
+  int D () const { return d_D; }
+  std::vector<float> TABLE () const { return d_TABLE; }
+  int K () const { return d_K; }
+  int S0 () const { return d_S0; }
+  int SK () const { return d_SK; }
+  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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.i.t

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.i.t (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_X.i.t)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.i.t            
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_X.i.t    
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,58 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
+
address@hidden@ address@hidden@ (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+class @NAME@ : public gr_block
+{
+private:
+  @NAME@ (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+public:
+    fsm FSM () const { return d_FSM; }
+    int D () const { return d_D; }
+    std::vector<float> TABLE () const { return d_TABLE; }
+    int K () const { return d_K; }
+    int S0 () const { return d_S0; }
+    int SK () const { return d_SK; }
+    trellis_metric_type_t TYPE () const { return d_TYPE; }
+    //std::vector<short> trace () const { return d_trace; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.cc (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_b.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.cc             
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.cc     
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,182 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE)
+{
+  return trellis_viterbi_combined_b_sptr (new trellis_viterbi_combined_b 
(FSM,D,TABLE,K,S0,SK,TYPE));
+}
+
+trellis_viterbi_combined_b::trellis_viterbi_combined_b (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const 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_D (D),
+  d_TABLE (TABLE),
+  d_K (K),
+  d_S0 (S0),
+  d_SK (SK),
+  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(const int I, const int S, const int O, 
+             const std::vector<int> &NS,
+             const std::vector<int> &OS,
+             const std::vector<int> &PS,
+             const std::vector<int> &PI,
+             const int D,
+             const std::vector<float> &TABLE,
+             const int K,
+             const int S0,const int SK,
+             const trellis_metric_type_t TYPE,
+             const float *in, unsigned char *out,
+             std::vector<int> &trace) 
+{
+  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_f(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(int i=0;i<I;i++) {
+              int i0 = j*I+i;
+              if((mm=alpha[alphai*S+PS[i0]]+metric[OS[PS[i0]*I+PI[i0]]])<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=trace[(K-1)*S+i])<minm) minm=mm,minmi=i;
+      st=minmi;
+  }
+  else {
+      st=SK;
+  }
+
+  for(int k=K-1;k>=0;k--) { // traceback
+      int i0=st*I+trace[k*S+st];
+      out[k]= (unsigned char) PI[i0];
+      st=PS[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_D,d_TABLE,d_K,d_S0,d_SK,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]),d_trace);
+    }
+  }
+
+  consume_each (d_D * noutput_items );
+  return noutput_items;
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.h (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_b.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.h              
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.h      
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,93 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+class trellis_viterbi_combined_b : public gr_block
+{
+  fsm d_FSM;
+  int d_D;
+  std::vector<float> d_TABLE;
+  int d_K;
+  int d_S0;
+  int d_SK;
+  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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+  trellis_viterbi_combined_b (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+public:
+  fsm FSM () const { return d_FSM; }
+  int D () const { return d_D; }
+  std::vector<float> TABLE () const { return d_TABLE; }
+  int K () const { return d_K; }
+  int S0 () const { return d_S0; }
+  int SK () const { return d_SK; }
+  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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.i (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_b.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.i              
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_b.i      
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,58 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+class trellis_viterbi_combined_b : public gr_block
+{
+private:
+  trellis_viterbi_combined_b (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+public:
+    fsm FSM () const { return d_FSM; }
+    int D () const { return d_D; }
+    std::vector<float> TABLE () const { return d_TABLE; }
+    int K () const { return d_K; }
+    int S0 () const { return d_S0; }
+    int SK () const { return d_SK; }
+    trellis_metric_type_t TYPE () const { return d_TYPE; }
+    //std::vector<short> trace () const { return d_trace; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.cc (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_i.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.cc             
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.cc     
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,182 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE)
+{
+  return trellis_viterbi_combined_i_sptr (new trellis_viterbi_combined_i 
(FSM,D,TABLE,K,S0,SK,TYPE));
+}
+
+trellis_viterbi_combined_i::trellis_viterbi_combined_i (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const 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_D (D),
+  d_TABLE (TABLE),
+  d_K (K),
+  d_S0 (S0),
+  d_SK (SK),
+  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(const int I, const int S, const int O, 
+             const std::vector<int> &NS,
+             const std::vector<int> &OS,
+             const std::vector<int> &PS,
+             const std::vector<int> &PI,
+             const int D,
+             const std::vector<float> &TABLE,
+             const int K,
+             const int S0,const int SK,
+             const trellis_metric_type_t TYPE,
+             const float *in, int *out,
+             std::vector<int> &trace) 
+{
+  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_f(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(int i=0;i<I;i++) {
+              int i0 = j*I+i;
+              if((mm=alpha[alphai*S+PS[i0]]+metric[OS[PS[i0]*I+PI[i0]]])<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=trace[(K-1)*S+i])<minm) minm=mm,minmi=i;
+      st=minmi;
+  }
+  else {
+      st=SK;
+  }
+
+  for(int k=K-1;k>=0;k--) { // traceback
+      int i0=st*I+trace[k*S+st];
+      out[k]= (int) PI[i0];
+      st=PS[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_D,d_TABLE,d_K,d_S0,d_SK,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]),d_trace);
+    }
+  }
+
+  consume_each (d_D * noutput_items );
+  return noutput_items;
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.h (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_i.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.h              
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.h      
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,93 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+class trellis_viterbi_combined_i : public gr_block
+{
+  fsm d_FSM;
+  int d_D;
+  std::vector<float> d_TABLE;
+  int d_K;
+  int d_S0;
+  int d_SK;
+  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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+  trellis_viterbi_combined_i (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+public:
+  fsm FSM () const { return d_FSM; }
+  int D () const { return d_D; }
+  std::vector<float> TABLE () const { return d_TABLE; }
+  int K () const { return d_K; }
+  int S0 () const { return d_S0; }
+  int SK () const { return d_SK; }
+  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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.i (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_i.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.i              
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_i.i      
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,58 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+class trellis_viterbi_combined_i : public gr_block
+{
+private:
+  trellis_viterbi_combined_i (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+public:
+    fsm FSM () const { return d_FSM; }
+    int D () const { return d_D; }
+    std::vector<float> TABLE () const { return d_TABLE; }
+    int K () const { return d_K; }
+    int S0 () const { return d_S0; }
+    int SK () const { return d_SK; }
+    trellis_metric_type_t TYPE () const { return d_TYPE; }
+    //std::vector<short> trace () const { return d_trace; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.cc (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_s.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.cc             
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.cc     
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,182 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE)
+{
+  return trellis_viterbi_combined_s_sptr (new trellis_viterbi_combined_s 
(FSM,D,TABLE,K,S0,SK,TYPE));
+}
+
+trellis_viterbi_combined_s::trellis_viterbi_combined_s (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const 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_D (D),
+  d_TABLE (TABLE),
+  d_K (K),
+  d_S0 (S0),
+  d_SK (SK),
+  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(const int I, const int S, const int O, 
+             const std::vector<int> &NS,
+             const std::vector<int> &OS,
+             const std::vector<int> &PS,
+             const std::vector<int> &PI,
+             const int D,
+             const std::vector<float> &TABLE,
+             const int K,
+             const int S0,const int SK,
+             const trellis_metric_type_t TYPE,
+             const float *in, short *out,
+             std::vector<int> &trace) 
+{
+  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_f(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(int i=0;i<I;i++) {
+              int i0 = j*I+i;
+              if((mm=alpha[alphai*S+PS[i0]]+metric[OS[PS[i0]*I+PI[i0]]])<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=trace[(K-1)*S+i])<minm) minm=mm,minmi=i;
+      st=minmi;
+  }
+  else {
+      st=SK;
+  }
+
+  for(int k=K-1;k>=0;k--) { // traceback
+      int i0=st*I+trace[k*S+st];
+      out[k]= (short) PI[i0];
+      st=PS[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_D,d_TABLE,d_K,d_S0,d_SK,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]),d_trace);
+    }
+  }
+
+  consume_each (d_D * noutput_items );
+  return noutput_items;
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.h (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_s.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.h              
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.h      
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,93 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+class trellis_viterbi_combined_s : public gr_block
+{
+  fsm d_FSM;
+  int d_D;
+  std::vector<float> d_TABLE;
+  int d_K;
+  int d_S0;
+  int d_SK;
+  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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+  trellis_viterbi_combined_s (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+public:
+  fsm FSM () const { return d_FSM; }
+  int D () const { return d_D; }
+  std::vector<float> TABLE () const { return d_TABLE; }
+  int K () const { return d_K; }
+  int S0 () const { return d_S0; }
+  int SK () const { return d_SK; }
+  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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.i (from 
rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_combined_s.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.i              
                (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_combined_s.i      
2006-08-07 16:28:55 UTC (rev 3219)
@@ -0,0 +1,58 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+
+class trellis_viterbi_combined_s : public gr_block
+{
+private:
+  trellis_viterbi_combined_s (
+    const fsm &FSM,
+    const int D,
+    const std::vector<float> &TABLE,
+    const int K,
+    const int S0,
+    const int SK,
+    const trellis_metric_type_t TYPE);
+
+public:
+    fsm FSM () const { return d_FSM; }
+    int D () const { return d_D; }
+    std::vector<float> TABLE () const { return d_TABLE; }
+    int K () const { return d_K; }
+    int S0 () const { return d_S0; }
+    int SK () const { return d_SK; }
+    trellis_metric_type_t TYPE () const { return d_TYPE; }
+    //std::vector<short> trace () const { return d_trace; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_i.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.cc                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.cc      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,167 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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,
+    const int K,
+    const int S0,
+    const int SK)
+{
+  return trellis_viterbi_i_sptr (new trellis_viterbi_i (FSM,K,S0,SK));
+}
+
+trellis_viterbi_i::trellis_viterbi_i (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const 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(const int I, const int S, const int O, 
+             const std::vector<int> &NS,
+             const std::vector<int> &OS,
+             const std::vector<int> &PS,
+             const std::vector<int> &PI,
+             const int K,
+             const int S0,const int SK,
+             const float *in, int *out,
+             std::vector<int> &trace) 
+{
+  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(int i=0;i<I;i++) {
+              int i0 = j*I+i;
+              if((mm=alpha[alphai*S+PS[i0]]+in[k*O+OS[PS[i0]*I+PI[i0]]])<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=trace[(K-1)*S+i])<minm) minm=mm,minmi=i;
+      st=minmi;
+  }
+  else {
+      st=SK;
+  }
+
+  for(int k=K-1;k>=0;k--) { // traceback
+      int i0=st*I+trace[k*S+st];
+      out[k]= (int) PI[i0];
+      st=PS[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;
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_i.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.h                       
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.h       2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,78 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, 
+    const int K,
+    const int S0,
+    const 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,
+    const int K,
+    const int S0,
+    const int SK);
+
+
+  trellis_viterbi_i (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_i.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.i                       
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_i.i       2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,49 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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,
+    const int K,
+    const int S0,
+    const int SK);
+
+
+class trellis_viterbi_i : public gr_block
+{
+private:
+  trellis_viterbi_i (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const 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; }
+};

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.cc

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.cc (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_s.cc)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.cc                      
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.cc      2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,167 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#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,
+    const int K,
+    const int S0,
+    const int SK)
+{
+  return trellis_viterbi_s_sptr (new trellis_viterbi_s (FSM,K,S0,SK));
+}
+
+trellis_viterbi_s::trellis_viterbi_s (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const 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(const int I, const int S, const int O, 
+             const std::vector<int> &NS,
+             const std::vector<int> &OS,
+             const std::vector<int> &PS,
+             const std::vector<int> &PI,
+             const int K,
+             const int S0,const int SK,
+             const float *in, short *out,
+             std::vector<int> &trace) 
+{
+  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(int i=0;i<I;i++) {
+              int i0 = j*I+i;
+              if((mm=alpha[alphai*S+PS[i0]]+in[k*O+OS[PS[i0]*I+PI[i0]]])<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=trace[(K-1)*S+i])<minm) minm=mm,minmi=i;
+      st=minmi;
+  }
+  else {
+      st=SK;
+  }
+
+  for(int k=K-1;k>=0;k--) { // traceback
+      int i0=st*I+trace[k*S+st];
+      out[k]= (short) PI[i0];
+      st=PS[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;
+}

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.h

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.h (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_s.h)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.h                       
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.h       2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,78 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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, 
+    const int K,
+    const int S0,
+    const 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,
+    const int K,
+    const int S0,
+    const int SK);
+
+
+  trellis_viterbi_s (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const 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

Deleted: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.i

Copied: gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.i (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/lib/trellis_viterbi_s.i)
===================================================================
--- gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.i                       
        (rev 0)
+++ gnuradio/trunk/gr-trellis/src/lib/trellis_viterbi_s.i       2006-08-07 
16:28:55 UTC (rev 3219)
@@ -0,0 +1,49 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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,
+    const int K,
+    const int S0,
+    const int SK);
+
+
+class trellis_viterbi_s : public gr_block
+{
+private:
+  trellis_viterbi_s (
+    const fsm &FSM,
+    const int K,
+    const int S0,
+    const 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; }
+};

Copied: gnuradio/trunk/gr-trellis/src/python (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/python)


Property changes on: gnuradio/trunk/gr-trellis/src/python
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in
.deps
.libs
*.la
*.lo
*.pyc
*.pyo
run_tests


Deleted: gnuradio/trunk/gr-trellis/src/python/Makefile.am

Copied: gnuradio/trunk/gr-trellis/src/python/Makefile.am (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/python/Makefile.am)
===================================================================
--- gnuradio/trunk/gr-trellis/src/python/Makefile.am                            
(rev 0)
+++ gnuradio/trunk/gr-trellis/src/python/Makefile.am    2006-08-07 16:28:55 UTC 
(rev 3219)
@@ -0,0 +1,32 @@
+#
+# 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+include $(top_srcdir)/Makefile.common
+
+EXTRA_DIST = run_tests.in
+
+
+TESTS =                                \
+       run_tests
+
+
+noinst_PYTHON =                        \
+       qa_trellis.py                   

Deleted: gnuradio/trunk/gr-trellis/src/python/qa_trellis.py

Copied: gnuradio/trunk/gr-trellis/src/python/qa_trellis.py (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/python/qa_trellis.py)
===================================================================
--- gnuradio/trunk/gr-trellis/src/python/qa_trellis.py                          
(rev 0)
+++ gnuradio/trunk/gr-trellis/src/python/qa_trellis.py  2006-08-07 16:28:55 UTC 
(rev 3219)
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+#
+# 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+from gnuradio import gr, gr_unittest
+import trellis
+
+class qa_trellis (gr_unittest.TestCase):
+
+    def setUp (self):
+        self.fg = gr.flow_graph ()
+
+    def tearDown (self):
+        self.fg = None
+
+if __name__ == '__main__':
+    gr_unittest.main ()


Property changes on: gnuradio/trunk/gr-trellis/src/python/qa_trellis.py
___________________________________________________________________
Name: svn:executable
   + *

Deleted: gnuradio/trunk/gr-trellis/src/python/run_tests.in

Copied: gnuradio/trunk/gr-trellis/src/python/run_tests.in (from rev 3218, 
gnuradio/branches/developers/anastas/wip/gr-trellis/src/python/run_tests.in)
===================================================================
--- gnuradio/trunk/gr-trellis/src/python/run_tests.in                           
(rev 0)
+++ gnuradio/trunk/gr-trellis/src/python/run_tests.in   2006-08-07 16:28:55 UTC 
(rev 3219)
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# All this strange PYTHONPATH manipulation is required to run our
+# tests using our just built shared library and swig-generated python
+# code prior to installation.
+
+# build tree == src tree unless you're doing a VPATH build.  
+# If you don't know what a VPATH build is, you're not doing one.  Relax...
+
address@hidden@
address@hidden@
+
+# Where to look in the build tree for our shared library
address@hidden@/gr-trellis/src/lib
+# Where to look in the src tree for swig generated python code
address@hidden@/gr-trellis/src/lib
+# Where to look in the src tree for hand written python code
address@hidden@/gr-trellis/src/python
+
+# Where to look for GNU Radio python modules in current build tree
address@hidden@/gnuradio-core/src/python/:@abs_top_builddir@/gnuradio-core/src/lib/swig/:@abs_top_builddir@/gnuradio-core/src/lib/swig/.libs
+
+PYTHONPATH="$grpythonbld:$libbld:$libbld/.libs:$libsrc:$py:$PYTHONPATH"
+export PYTHONPATH
+
+#
+# This is the simple part...
+# Run everything that matches qa_*.py and return the final result.
+#
+
+ok=yes
+for file in @srcdir@/qa_*.py
+do
+  if ! $file
+  then
+    ok=no
+  fi  
+done
+
+if [ $ok = yes ]
+then
+  exit 0
+else
+  exit 1
+fi





reply via email to

[Prev in Thread] Current Thread [Next in Thread]