diff -u -r -N gnuradio-core.orig/src/lib/general/Makefile.am gnuradio-core/src/lib/general/Makefile.am --- gnuradio-core.orig/src/lib/general/Makefile.am 2004-12-22 00:01:05.000000000 +0100 +++ gnuradio-core/src/lib/general/Makefile.am 2005-01-12 01:30:49.000000000 +0100 @@ -99,6 +99,7 @@ libgeneral_la_SOURCES = \ $(GENERATED_CC) \ + gr_abs_cf.cc \ gr_bytes_to_syms.cc \ gr_check_counting_s.cc \ gr_check_lfsr_32k_s.cc \ @@ -150,6 +152,7 @@ grinclude_HEADERS = \ $(GENERATED_H) \ malloc16.h \ + gr_abs_cf.h \ gr_agc.h \ gr_bytes_to_syms.h \ gr_check_counting_s.h \ @@ -211,6 +215,7 @@ swiginclude_HEADERS = \ general.i \ general_generated.i \ + gr_abs_cf.i \ gr_bytes_to_syms.i \ gr_check_counting_s.i \ gr_check_lfsr_32k_s.i \ diff -u -r -N gnuradio-core.orig/src/lib/general/general.i gnuradio-core/src/lib/general/general.i --- gnuradio-core.orig/src/lib/general/general.i 2004-12-17 21:56:28.000000000 +0100 +++ gnuradio-core/src/lib/general/general.i 2005-01-12 02:33:16.000000000 +0100 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -64,6 +65,7 @@ %include "gr_sig_source_waveform.h" %include "gr_noise_type.h" %include "gr_quadrature_demod_cf.i" +%include "gr_abs_cf.i" %include "gr_remez.i" %include "gr_float_to_complex.i" %include "gr_check_counting_s.i" diff -u -r -N gnuradio-core.orig/src/lib/general/gr_abs_cf.cc gnuradio-core/src/lib/general/gr_abs_cf.cc --- gnuradio-core.orig/src/lib/general/gr_abs_cf.cc 1970-01-01 01:00:00.000000000 +0100 +++ gnuradio-core/src/lib/general/gr_abs_cf.cc 2005-01-12 01:30:49.000000000 +0100 @@ -0,0 +1,63 @@ +/* -*- 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 +#include + +gr_abs_cf::gr_abs_cf (): +gr_sync_block ("abs_cf", + gr_make_io_signature (1, 1, sizeof (gr_complex)), + gr_make_io_signature (1, 1, sizeof (float))) +{ +} + +gr_abs_cf_sptr +gr_make_abs_cf () +{ + return gr_abs_cf_sptr (new gr_abs_cf ()); +} + +int +gr_abs_cf::work (int noutput_items, + gr_vector_const_void_star & input_items, + gr_vector_void_star & output_items) +{ + gr_complex *in = (gr_complex *) input_items[0]; + float *out = (float *) output_items[0]; + int i; + for ( i = 0; i < noutput_items-3; i+=4)//stride=4 + { + out[i] = abs (in[i]); + out[i+1]=abs (in[i+1]); + out[i+2]=abs (in[i+2]); + out[i+3]=abs (in[i+3]); + } + for (; i < noutput_items; i++) //tail section + { + out[i] = abs (in[i]); + } + return noutput_items; +} diff -u -r -N gnuradio-core.orig/src/lib/general/gr_abs_cf.h gnuradio-core/src/lib/general/gr_abs_cf.h --- gnuradio-core.orig/src/lib/general/gr_abs_cf.h 1970-01-01 01:00:00.000000000 +0100 +++ gnuradio-core/src/lib/general/gr_abs_cf.h 2005-01-12 01:30:49.000000000 +0100 @@ -0,0 +1,56 @@ +/* -*- 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_GR_ABS_CF_H +#define INCLUDED_GR_ABS_CF_H + +#include + +class gr_abs_cf; +typedef + boost::shared_ptr < + gr_abs_cf > + gr_abs_cf_sptr; +gr_abs_cf_sptr +gr_make_abs_cf (); + +/*! + * \brief abs: compute absolute value, can be used for envelope AM demodulator: complex in, complex out + * \ingroup block + */ +class + gr_abs_cf: + public + gr_sync_block +{ + friend gr_abs_cf_sptr + gr_make_abs_cf (); + gr_abs_cf (); + + public: + int + work (int noutput_items, + gr_vector_const_void_star & input_items, + gr_vector_void_star & output_items); +}; + +#endif /* INCLUDED_GR_ABS_CF_H */ diff -u -r -N gnuradio-core.orig/src/lib/general/gr_abs_cf.i gnuradio-core/src/lib/general/gr_abs_cf.i --- gnuradio-core.orig/src/lib/general/gr_abs_cf.i 1970-01-01 01:00:00.000000000 +0100 +++ gnuradio-core/src/lib/general/gr_abs_cf.i 2005-01-12 01:30:49.000000000 +0100 @@ -0,0 +1,30 @@ +/* -*- 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. + */ + +GR_SWIG_BLOCK_MAGIC (gr, abs_cf) + +gr_abs_cf_sptr gr_make_abs_cf ( ); + +class gr_abs_cf : public gr_sync_block +{ + gr_abs_cf ( ); +}; diff -u -r -N gnuradio-core.orig/src/lib/swig/Makefile.swigdeps gnuradio-core/src/lib/swig/Makefile.swigdeps --- gnuradio-core.orig/src/lib/swig/Makefile.swigdeps 2004-12-17 21:56:28.000000000 +0100 +++ gnuradio-core/src/lib/swig/Makefile.swigdeps 2005-01-12 01:30:49.000000000 +0100 @@ -19,6 +19,7 @@ ../../../src/lib/general/gr_sig_source_waveform.h \ ../../../src/lib/general/gr_noise_type.h \ ../../../src/lib/general/gr_quadrature_demod_cf.i \ + ../../../src/lib/general/gr_abs_cf.i \ ../../../src/lib/general/gr_remez.i \ ../../../src/lib/general/gr_float_to_complex.i \ ../../../src/lib/general/gr_check_counting_s.i \ diff -u -r -N gnuradio-core.orig/src/lib/swig/gnuradio_swig_bug_workaround.h gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h --- gnuradio-core.orig/src/lib/swig/gnuradio_swig_bug_workaround.h 2004-12-17 21:56:28.000000000 +0100 +++ gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h 2005-01-12 01:30:49.000000000 +0100 @@ -29,6 +29,7 @@ * %import "gnuradio.i" */ +class gr_abs_cf; class gr_add_cc; class gr_add_const_cc; class gr_add_const_ff;