[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] New blocks for agc, uchar-to_float and char-to_float
From: |
Martin Dvh |
Subject: |
[Discuss-gnuradio] New blocks for agc, uchar-to_float and char-to_float |
Date: |
Mon, 19 Dec 2005 00:24:36 +0100 |
User-agent: |
Debian Thunderbird 1.0.2 (X11/20051002) |
Hi all,
I still have a few new blocks laying around which I wrote a while ago but
haven't commited yet.
They are generic conversion blocks and an agc block.
I need them for tv reception but they can be used for other things.
Especially the char_to_float block can be used in conjunction with the now
supported 8 bit captures with the usrp.
(We also need an interleaved char to complex block)
With all the conversions between uchar, char, short,float (and complex) we
might want to use a template for these instead in the future.
Eric, you could apply the patch or just give a call and I do a commit.
Greetings,
Martin
2005-12-19 Martin Dudok van Heel <nldudok1 at olifantasia.com>
Addded a new blocks to convert from unsigned char to float and for char
to float.
Added new agc block gr_agc_ff based on existing gr_agc block (which
can't be directly used in a flowgraph).
All needed for tv-reception.
* src/lib/general/gr_uchar_to_float.{cc,h,i}: new
* src/lib/general/gri_uchar_to_float.{cc,h}: new
* src/lib/general/gr_char_to_float.{cc,h,i}: new
* src/lib/general/gri_char_to_float.{cc,h}: new
* src/lib/general/gr_agc_ff.cc: new
* src/lib/general/gr_agc_ff.h: new
* src/lib/general/gr_agc_ff.i: new
* src/lib/general/Makefile.am: changed. Added gr_agc_ff,
gr_(u)char_to_float and gri_(u)char_to_float.
* src/lib/general/general.i: changed. Added
gr_agc_ff,gr_(u)char_to_float and gri_(u)char_to_float.
Index: src/lib/general/Makefile.am
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/lib/general/Makefile.am,v
retrieving revision 1.69
diff -u -r1.69 Makefile.am
--- src/lib/general/Makefile.am 18 Dec 2005 00:20:23 -0000 1.69
+++ src/lib/general/Makefile.am 18 Dec 2005 22:57:53 -0000
@@ -145,9 +145,12 @@
gr_remez.cc \
gr_serial_to_parallel.cc \
gr_short_to_float.cc \
+ gr_char_to_float.cc \
+ gr_uchar_to_float.cc \
gr_simple_framer.cc \
gr_simple_correlator.cc \
gr_simple_squelch_cc.cc \
+ gr_agc_ff.cc \
gr_stream_to_streams.cc \
gr_streams_to_stream.cc \
gr_streams_to_vector.cc \
@@ -169,6 +172,8 @@
gri_float_to_uchar.cc \
gri_float_to_short.cc \
gri_short_to_float.cc \
+ gri_char_to_float.cc \
+ gri_uchar_to_float.cc \
gri_interleaved_short_to_complex.cc \
malloc16.c
@@ -236,11 +241,14 @@
gr_reverse.h \
gr_serial_to_parallel.h \
gr_short_to_float.h \
+ gr_char_to_float.h \
+ gr_uchar_to_float.h \
gr_sig_source_waveform.h \
gr_simple_correlator.h \
gr_simple_framer.h \
gr_simple_framer_sync.h \
gr_simple_squelch_cc.h \
+ gr_agc_ff.h \
gr_stream_to_streams.h \
gr_streams_to_stream.h \
gr_streams_to_vector.h \
@@ -265,6 +273,8 @@
gri_lfsr_15_1_0.h \
gri_lfsr_32k.h \
gri_short_to_float.h \
+ gri_char_to_float.h \
+ gri_uchar_to_float.h \
random.h
@@ -320,8 +330,11 @@
gr_serial_to_parallel.i \
gr_short_to_float.i \
gr_simple_correlator.i \
+ gr_char_to_float.i \
+ gr_uchar_to_float.i \
gr_simple_framer.i \
gr_simple_squelch_cc.i \
+ gr_agc_ff.i \
gr_stream_to_streams.i \
gr_streams_to_stream.i \
gr_streams_to_vector.i \
Index: src/lib/general/general.i
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/lib/general/general.i,v
retrieving revision 1.42
diff -u -r1.42 general.i
--- src/lib/general/general.i 17 Dec 2005 22:35:22 -0000 1.42
+++ src/lib/general/general.i 18 Dec 2005 22:57:53 -0000
@@ -45,6 +45,8 @@
#include <gr_float_to_char.h>
#include <gr_float_to_uchar.h>
#include <gr_short_to_float.h>
+#include <gr_char_to_float.h>
+#include <gr_uchar_to_float.h>
#include <gr_frequency_modulator_fc.h>
#include <gr_bytes_to_syms.h>
#include <gr_simple_correlator.h>
@@ -55,6 +57,7 @@
#include <gr_interleave.h>
#include <gr_deinterleave.h>
#include <gr_simple_squelch_cc.h>
+#include <gr_agc_ff.h>
#include <gr_rms_cf.h>
#include <gr_rms_ff.h>
#include <gr_nlog10_ff.h>
@@ -105,6 +108,8 @@
%include "gr_float_to_char.i"
%include "gr_float_to_uchar.i"
%include "gr_short_to_float.i"
+%include "gr_char_to_float.i"
+%include "gr_uchar_to_float.i"
%include "gr_frequency_modulator_fc.i"
%include "gr_bytes_to_syms.i"
%include "gr_simple_correlator.i"
@@ -115,6 +120,7 @@
%include "gr_interleave.i"
%include "gr_deinterleave.i"
%include "gr_simple_squelch_cc.i"
+%include "gr_agc_ff.i"
%include "gr_rms_cf.i"
%include "gr_rms_ff.i"
%include "gr_nlog10_ff.i"
Index: src/lib/general/gr_agc_ff.cc
===================================================================
RCS file: src/lib/general/gr_agc_ff.cc
diff -N src/lib/general/gr_agc_ff.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gr_agc_ff.cc 18 Dec 2005 22:57:53 -0000
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_agc_ff.h>
+#include <gr_io_signature.h>
+#include <gr_agc.h>
+
+gr_agc_ff_sptr
+gr_make_agc_ff (float rate, float reference, float gain)
+{
+ return gr_agc_ff_sptr (new gr_agc_ff (rate, reference, gain));
+}
+
+gr_agc_ff::gr_agc_ff (float rate, float reference, float gain)
+ : gr_sync_block ("gr_agc_ff",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (float)))
+ , gr_agc (rate, reference, gain)
+{
+}
+
+int
+gr_agc_ff::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+ scaleN (out, in, noutput_items);
+ return noutput_items;
+}
Index: src/lib/general/gr_agc_ff.h
===================================================================
RCS file: src/lib/general/gr_agc_ff.h
diff -N src/lib/general/gr_agc_ff.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gr_agc_ff.h 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#ifndef INCLUDED_GR_AGC_FF_H
+#define INCLUDED_GR_AGC_FF_H
+
+#include <gr_sync_block.h>
+#include <gr_agc.h>
+class gr_agc_ff;
+//class gr_agc;
+typedef boost::shared_ptr<gr_agc_ff> gr_agc_ff_sptr;
+
+gr_agc_ff_sptr
+gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, float gain = 1.0);
+/*!
+ * \brief high performance Automatic Gain Control class
+ *
+ * Power is approximated by absolute value
+ */
+
+class gr_agc_ff : public gr_sync_block, gr_agc
+{
+ friend gr_agc_ff_sptr gr_make_agc_ff (float rate, float reference, float
gain);
+ gr_agc_ff (float rate, float reference, float gain);
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_FLOAT_AGC_FF_H */
Index: src/lib/general/gr_agc_ff.i
===================================================================
RCS file: src/lib/general/gr_agc_ff.i
diff -N src/lib/general/gr_agc_ff.i
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gr_agc_ff.i 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,agc_ff)
+//class gr_agc;
+#include <gr_agc.h>
+//class gr_agc {
+//
+// public:
+// gr_agc (float rate = 1e-4, float reference = 1.0, float gain = 1.0)
+// };
+gr_agc_ff_sptr
+gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, float gain = 1.0);
+
+class gr_agc_ff : public gr_sync_block, gr_agc
+{
+ gr_agc_ff (float rate, float reference, float gain);
+};
Index: src/lib/general/gr_char_to_float.cc
===================================================================
RCS file: src/lib/general/gr_char_to_float.cc
diff -N src/lib/general/gr_char_to_float.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gr_char_to_float.cc 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_char_to_float.h>
+#include <gr_io_signature.h>
+#include <gri_char_to_float.h>
+
+gr_char_to_float_sptr
+gr_make_char_to_float ()
+{
+ return gr_char_to_float_sptr (new gr_char_to_float ());
+}
+
+gr_char_to_float::gr_char_to_float ()
+ : gr_sync_block ("gr_char_to_float",
+ gr_make_io_signature (1, 1, sizeof (char)),
+ gr_make_io_signature (1, 1, sizeof (float)))
+{
+}
+
+int
+gr_char_to_float::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *in = (const char *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ gri_char_to_float (in, out, noutput_items);
+
+ return noutput_items;
+}
Index: src/lib/general/gr_char_to_float.h
===================================================================
RCS file: src/lib/general/gr_char_to_float.h
diff -N src/lib/general/gr_char_to_float.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gr_char_to_float.h 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#ifndef INCLUDED_GR_CHAR_TO_FLOAT_H
+#define INCLUDED_GR_CHAR_TO_FLOAT_H
+
+#include <gr_sync_block.h>
+
+class gr_char_to_float;
+typedef boost::shared_ptr<gr_char_to_float> gr_char_to_float_sptr;
+
+gr_char_to_float_sptr
+gr_make_char_to_float ();
+
+/*!
+ * \brief Convert stream of chars to a stream of float
+ * \ingroup converter
+ */
+
+class gr_char_to_float : public gr_sync_block
+{
+ friend gr_char_to_float_sptr gr_make_char_to_float ();
+ gr_char_to_float ();
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_CHAR_TO_FLOAT_H */
Index: src/lib/general/gr_char_to_float.i
===================================================================
RCS file: src/lib/general/gr_char_to_float.i
diff -N src/lib/general/gr_char_to_float.i
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gr_char_to_float.i 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,char_to_float)
+
+gr_char_to_float_sptr gr_make_char_to_float ();
+
+class gr_char_to_float : public gr_sync_block
+{
+ gr_char_to_float ();
+};
Index: src/lib/general/gr_uchar_to_float.cc
===================================================================
RCS file: src/lib/general/gr_uchar_to_float.cc
diff -N src/lib/general/gr_uchar_to_float.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gr_uchar_to_float.cc 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_uchar_to_float.h>
+#include <gr_io_signature.h>
+#include <gri_uchar_to_float.h>
+
+gr_uchar_to_float_sptr
+gr_make_uchar_to_float ()
+{
+ return gr_uchar_to_float_sptr (new gr_uchar_to_float ());
+}
+
+gr_uchar_to_float::gr_uchar_to_float ()
+ : gr_sync_block ("gr_uchar_to_float",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (float)))
+{
+}
+
+int
+gr_uchar_to_float::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ gri_uchar_to_float (in, out, noutput_items);
+
+ return noutput_items;
+}
Index: src/lib/general/gr_uchar_to_float.h
===================================================================
RCS file: src/lib/general/gr_uchar_to_float.h
diff -N src/lib/general/gr_uchar_to_float.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gr_uchar_to_float.h 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#ifndef INCLUDED_GR_UCHAR_TO_FLOAT_H
+#define INCLUDED_GR_UCHAR_TO_FLOAT_H
+
+#include <gr_sync_block.h>
+
+class gr_uchar_to_float;
+typedef boost::shared_ptr<gr_uchar_to_float> gr_uchar_to_float_sptr;
+
+gr_uchar_to_float_sptr
+gr_make_uchar_to_float ();
+
+/*!
+ * \brief Convert stream of unsigned chars to a stream of float
+ * \ingroup converter
+ */
+
+class gr_uchar_to_float : public gr_sync_block
+{
+ friend gr_uchar_to_float_sptr gr_make_uchar_to_float ();
+ gr_uchar_to_float ();
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_UCHAR_TO_FLOAT_H */
Index: src/lib/general/gr_uchar_to_float.i
===================================================================
RCS file: src/lib/general/gr_uchar_to_float.i
diff -N src/lib/general/gr_uchar_to_float.i
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gr_uchar_to_float.i 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,uchar_to_float)
+
+gr_uchar_to_float_sptr gr_make_uchar_to_float ();
+
+class gr_uchar_to_float : public gr_sync_block
+{
+ gr_uchar_to_float ();
+};
Index: src/lib/general/gri_char_to_float.cc
===================================================================
RCS file: src/lib/general/gri_char_to_float.cc
diff -N src/lib/general/gri_char_to_float.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gri_char_to_float.cc 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#include <gri_char_to_float.h>
+
+void
+gri_char_to_float (const char *in, float *out, int nsamples)
+{
+ while (nsamples >= 4){
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
+ out[3] = in[3];
+ out += 4;
+ in += 4;
+ nsamples -= 4;
+ }
+
+ while (nsamples-- > 0)
+ *out++ = *in++;
+}
Index: src/lib/general/gri_char_to_float.h
===================================================================
RCS file: src/lib/general/gri_char_to_float.h
diff -N src/lib/general/gri_char_to_float.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gri_char_to_float.h 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#ifndef INCLUDED_GRI_CHAR_TO_FLOAT_H
+#define INCLUDED_GRI_CHAR_TO_FLOAT_H
+
+/*
+ * convert array of chars to floats
+ */
+void gri_char_to_float (const char *in, float *out, int nsamples);
+
+
+#endif /* INCLUDED_GRI_CHAR_TO_FLOAT_H */
Index: src/lib/general/gri_uchar_to_float.cc
===================================================================
RCS file: src/lib/general/gri_uchar_to_float.cc
diff -N src/lib/general/gri_uchar_to_float.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gri_uchar_to_float.cc 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#include <gri_uchar_to_float.h>
+
+void
+gri_uchar_to_float (const unsigned char *in, float *out, int nsamples)
+{
+ while (nsamples >= 4){
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
+ out[3] = in[3];
+ out += 4;
+ in += 4;
+ nsamples -= 4;
+ }
+
+ while (nsamples-- > 0)
+ *out++ = *in++;
+}
Index: src/lib/general/gri_uchar_to_float.h
===================================================================
RCS file: src/lib/general/gri_uchar_to_float.h
diff -N src/lib/general/gri_uchar_to_float.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/lib/general/gri_uchar_to_float.h 18 Dec 2005 22:57:54 -0000
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#ifndef INCLUDED_GRI_UCHAR_TO_FLOAT_H
+#define INCLUDED_GRI_UCHAR_TO_FLOAT_H
+
+/*
+ * convert array of unsigned chars to floats
+ */
+void gri_uchar_to_float (const unsigned char *in, float *out, int nsamples);
+
+
+#endif /* INCLUDED_GRI_UCHAR_TO_FLOAT_H */
- [Discuss-gnuradio] New blocks for agc, uchar-to_float and char-to_float,
Martin Dvh <=