From 5d69a524f81f234b3fbc41d49ba18d6f6886baba Mon Sep 17 00:00:00 2001 From: jcorgan Date: Thu, 3 Aug 2006 04:51:51 +0000 Subject: Houston, we have a trunk. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3122 221aa14e-8319-0410-a670-987f0aec2ac5 --- gr-atsc/src/lib/atsc_equalizer.cc | 97 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 gr-atsc/src/lib/atsc_equalizer.cc (limited to 'gr-atsc/src/lib/atsc_equalizer.cc') diff --git a/gr-atsc/src/lib/atsc_equalizer.cc b/gr-atsc/src/lib/atsc_equalizer.cc new file mode 100644 index 000000000..168d62209 --- /dev/null +++ b/gr-atsc/src/lib/atsc_equalizer.cc @@ -0,0 +1,97 @@ +/* -*- c++ -*- */ +/* + * Copyright 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. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include + + +atsc_equalizer_sptr +atsc_make_equalizer() +{ + return atsc_equalizer_sptr(new atsc_equalizer()); +} + +// had atsc_equalizer(atsci_equalizer *equalizer) +atsc_equalizer::atsc_equalizer() + : gr_sync_block("atsc_equalizer", + gr_make_io_signature(2, 2, sizeof(float)), + gr_make_io_signature(2, 2, sizeof(float))) +{ + d_equalizer = create_atsci_equalizer_lms(); +} + +atsc_equalizer::~atsc_equalizer () +{ + // Anything that isn't automatically cleaned up... + + delete d_equalizer; +} + + +void +atsc_equalizer::forecast (int noutput_items, gr_vector_int &ninput_items_required) +{ + + int ntaps = d_equalizer->ntaps (); + int npretaps = d_equalizer->npretaps (); + + assert (ntaps >= 1); + assert (npretaps >= 0 && npretaps < ntaps); + + unsigned ninputs = ninput_items_required.size(); + for (unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = fixed_rate_noutput_to_ninput (noutput_items); +} + + +int +atsc_equalizer::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]; + const atsc::syminfo *in_tags = (const atsc::syminfo *) input_items[1]; + float *out = (float *) output_items[0]; + atsc::syminfo *out_tags = (atsc::syminfo *) output_items[1]; + + assert(sizeof(float) == sizeof(atsc::syminfo)); + + + // peform the actual equalization + + d_equalizer->filter (in, in_tags, + out, noutput_items); + + // write the output tags + + for (int i = 0; i < noutput_items; i++) + out_tags[i] = in_tags[i]; + + return noutput_items; +} -- cgit