diff options
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r-- | gnuradio-core/src/lib/gengen/Makefile.am | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/Makefile.gen | 18 | ||||
-rwxr-xr-x | gnuradio-core/src/lib/gengen/generate_common.py | 4 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gengen_generated.i | 12 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_argmax_XX.cc.t | 79 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t | 51 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_argmax_XX.i.t | 34 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_max_XX.cc.t | 71 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_max_XX.h.t | 51 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_max_XX.i.t | 34 |
10 files changed, 359 insertions, 1 deletions
diff --git a/gnuradio-core/src/lib/gengen/Makefile.am b/gnuradio-core/src/lib/gengen/Makefile.am index c566570e2..7c585dda9 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.am +++ b/gnuradio-core/src/lib/gengen/Makefile.am @@ -44,12 +44,18 @@ CODE_GENERATOR = \ gr_add_const_vXX.cc.t \ gr_add_const_vXX.h.t \ gr_add_const_vXX.i.t \ + gr_argmax_XX.cc.t \ + gr_argmax_XX.h.t \ + gr_argmax_XX.i.t \ gr_chunks_to_symbols_XX.cc.t \ gr_chunks_to_symbols_XX.h.t \ gr_chunks_to_symbols_XX.i.t \ gr_divide_XX.cc.t \ gr_divide_XX.h.t \ gr_divide_XX.i.t \ + gr_max_XX.cc.t \ + gr_max_XX.h.t \ + gr_max_XX.i.t \ gr_multiply_XX.cc.t \ gr_multiply_XX.h.t \ gr_multiply_XX.i.t \ diff --git a/gnuradio-core/src/lib/gengen/Makefile.gen b/gnuradio-core/src/lib/gengen/Makefile.gen index adbceba10..ceb8692b4 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.gen +++ b/gnuradio-core/src/lib/gengen/Makefile.gen @@ -19,6 +19,9 @@ GENERATED_H = \ gr_add_vff.h \ gr_add_vii.h \ gr_add_vss.h \ + gr_argmax_fs.h \ + gr_argmax_is.h \ + gr_argmax_ss.h \ gr_chunks_to_symbols_bc.h \ gr_chunks_to_symbols_bf.h \ gr_chunks_to_symbols_ic.h \ @@ -29,6 +32,9 @@ GENERATED_H = \ gr_divide_ff.h \ gr_divide_ii.h \ gr_divide_ss.h \ + gr_max_ff.h \ + gr_max_ii.h \ + gr_max_ss.h \ gr_multiply_cc.h \ gr_multiply_const_cc.h \ gr_multiply_const_ff.h \ @@ -103,6 +109,9 @@ GENERATED_I = \ gr_add_vff.i \ gr_add_vii.i \ gr_add_vss.i \ + gr_argmax_fs.i \ + gr_argmax_is.i \ + gr_argmax_ss.i \ gr_chunks_to_symbols_bc.i \ gr_chunks_to_symbols_bf.i \ gr_chunks_to_symbols_ic.i \ @@ -113,6 +122,9 @@ GENERATED_I = \ gr_divide_ff.i \ gr_divide_ii.i \ gr_divide_ss.i \ + gr_max_ff.i \ + gr_max_ii.i \ + gr_max_ss.i \ gr_multiply_cc.i \ gr_multiply_const_cc.i \ gr_multiply_const_ff.i \ @@ -187,6 +199,9 @@ GENERATED_CC = \ gr_add_vff.cc \ gr_add_vii.cc \ gr_add_vss.cc \ + gr_argmax_fs.cc \ + gr_argmax_is.cc \ + gr_argmax_ss.cc \ gr_chunks_to_symbols_bc.cc \ gr_chunks_to_symbols_bf.cc \ gr_chunks_to_symbols_ic.cc \ @@ -197,6 +212,9 @@ GENERATED_CC = \ gr_divide_ff.cc \ gr_divide_ii.cc \ gr_divide_ss.cc \ + gr_max_ff.cc \ + gr_max_ii.cc \ + gr_max_ss.cc \ gr_multiply_cc.cc \ gr_multiply_const_cc.cc \ gr_multiply_const_ff.cc \ diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py index 2ab0586df..aaf15f04a 100755 --- a/gnuradio-core/src/lib/gengen/generate_common.py +++ b/gnuradio-core/src/lib/gengen/generate_common.py @@ -59,7 +59,9 @@ others = ( ('gr_unpacked_to_packed_XX', ('bb','ss','ii')), ('gr_packed_to_unpacked_XX', ('bb','ss','ii')), ('gr_sample_and_hold_XX', ('bb','ss','ii','ff')), - ('gr_peak_detector_XX', ('ff','ii','ss')) + ('gr_peak_detector_XX', ('ff','ii','ss')), + ('gr_argmax_XX', ('fs','is','ss')), + ('gr_max_XX', ('ff','ii','ss')), ) diff --git a/gnuradio-core/src/lib/gengen/gengen_generated.i b/gnuradio-core/src/lib/gengen/gengen_generated.i index d5f874e61..bab1f03e6 100644 --- a/gnuradio-core/src/lib/gengen/gengen_generated.i +++ b/gnuradio-core/src/lib/gengen/gengen_generated.i @@ -19,6 +19,9 @@ #include <gr_add_vff.h> #include <gr_add_vii.h> #include <gr_add_vss.h> +#include <gr_argmax_fs.h> +#include <gr_argmax_is.h> +#include <gr_argmax_ss.h> #include <gr_chunks_to_symbols_bc.h> #include <gr_chunks_to_symbols_bf.h> #include <gr_chunks_to_symbols_ic.h> @@ -29,6 +32,9 @@ #include <gr_divide_ff.h> #include <gr_divide_ii.h> #include <gr_divide_ss.h> +#include <gr_max_ff.h> +#include <gr_max_ii.h> +#include <gr_max_ss.h> #include <gr_multiply_cc.h> #include <gr_multiply_const_cc.h> #include <gr_multiply_const_ff.h> @@ -103,6 +109,9 @@ %include <gr_add_vff.i> %include <gr_add_vii.i> %include <gr_add_vss.i> +%include <gr_argmax_fs.i> +%include <gr_argmax_is.i> +%include <gr_argmax_ss.i> %include <gr_chunks_to_symbols_bc.i> %include <gr_chunks_to_symbols_bf.i> %include <gr_chunks_to_symbols_ic.i> @@ -113,6 +122,9 @@ %include <gr_divide_ff.i> %include <gr_divide_ii.i> %include <gr_divide_ss.i> +%include <gr_max_ff.i> +%include <gr_max_ii.i> +%include <gr_max_ss.i> %include <gr_multiply_cc.i> %include <gr_multiply_const_cc.i> %include <gr_multiply_const_ff.i> diff --git a/gnuradio-core/src/lib/gengen/gr_argmax_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_argmax_XX.cc.t new file mode 100644 index 000000000..85c272b4c --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_argmax_XX.cc.t @@ -0,0 +1,79 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <@NAME@.h> +#include <gr_io_signature.h> + +@SPTR_NAME@ +gr_make_@BASE_NAME@ ( size_t vlen ) +{ + return @SPTR_NAME@ ( new @NAME@(vlen)); +} + +@NAME@::@NAME@( size_t vlen) + : gr_sync_block ( "@BASE_NAME@", + gr_make_io_signature (1, -1, vlen*sizeof (@I_TYPE@)), + gr_make_io_signature (2, 2, sizeof (@O_TYPE@))), + d_vlen(vlen) +{ +} + + +int +@NAME@::work( int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + + int ninputs = input_items.size (); + + @O_TYPE@ *x_optr = (@O_TYPE@ *) output_items[0]; + @O_TYPE@ *y_optr = (@O_TYPE@ *) output_items[1]; + + for (int i=0; i<noutput_items; i++) { + + @I_TYPE@ max = 0; + int x = 0; + int y = 0; + + for (int j=0; j < (int) d_vlen; j++ ) { + for (int k=0; k<ninputs; k++) { + if ( ((@I_TYPE@ *) input_items[k])[i*d_vlen + j] > max) { + max = ((@I_TYPE@ *) input_items[k])[i*d_vlen + j]; + x = j; + y = k; + } + } + } + + *x_optr++ = (@O_TYPE@) x; + *y_optr++ = (@O_TYPE@) y; + } + return noutput_items; +} + diff --git a/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t b/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t new file mode 100644 index 000000000..ad8b04756 --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gr_sync_block.h> + +class @NAME@; +typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; + +@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + + +class @NAME@ : public gr_sync_block +{ + friend @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + + @NAME@ (size_t vlen); + size_t d_vlen; + + public: + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + + +#endif diff --git a/gnuradio-core/src/lib/gengen/gr_argmax_XX.i.t b/gnuradio-core/src/lib/gengen/gr_argmax_XX.i.t new file mode 100644 index 000000000..c6c4f4366 --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_argmax_XX.i.t @@ -0,0 +1,34 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) + +@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + +class @NAME@ : public gr_sync_block +{ + private: + @NAME@ (size_t vlen); + size_t d_vlen; +}; diff --git a/gnuradio-core/src/lib/gengen/gr_max_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_max_XX.cc.t new file mode 100644 index 000000000..d91703634 --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_max_XX.cc.t @@ -0,0 +1,71 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <@NAME@.h> +#include <gr_io_signature.h> + +@SPTR_NAME@ +gr_make_@BASE_NAME@ ( size_t vlen ) +{ + return @SPTR_NAME@ ( new @NAME@(vlen)); +} + +@NAME@::@NAME@( size_t vlen) + : gr_sync_block ( "@BASE_NAME@", + gr_make_io_signature (1, -1, vlen*sizeof (@I_TYPE@)), + gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), + d_vlen(vlen) +{ +} + +int +@NAME@::work( int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; + + int ninputs = input_items.size (); + + for (int i=0; i<noutput_items; i++) { + + @I_TYPE@ max = 0; + + for (int j=0; j < (int) d_vlen; j++ ) { + for (int k=0; k<ninputs; k++) { + if ( ((@I_TYPE@ *) input_items[k])[i*d_vlen + j] > max) { + max = ((@I_TYPE@*) input_items[k])[i*d_vlen + j]; + } + } + } + + *optr++ = (@O_TYPE@) max; + } + return noutput_items; +} + diff --git a/gnuradio-core/src/lib/gengen/gr_max_XX.h.t b/gnuradio-core/src/lib/gengen/gr_max_XX.h.t new file mode 100644 index 000000000..ad8b04756 --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_max_XX.h.t @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gr_sync_block.h> + +class @NAME@; +typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; + +@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + + +class @NAME@ : public gr_sync_block +{ + friend @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + + @NAME@ (size_t vlen); + size_t d_vlen; + + public: + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + + +#endif diff --git a/gnuradio-core/src/lib/gengen/gr_max_XX.i.t b/gnuradio-core/src/lib/gengen/gr_max_XX.i.t new file mode 100644 index 000000000..c6c4f4366 --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_max_XX.i.t @@ -0,0 +1,34 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) + +@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + +class @NAME@ : public gr_sync_block +{ + private: + @NAME@ (size_t vlen); + size_t d_vlen; +}; |