diff options
Diffstat (limited to 'gr-atsc/src/lib/atsci_equalizer_lms2.cc')
-rw-r--r-- | gr-atsc/src/lib/atsci_equalizer_lms2.cc | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/gr-atsc/src/lib/atsci_equalizer_lms2.cc b/gr-atsc/src/lib/atsci_equalizer_lms2.cc index f9fb57c7b..2825aad50 100644 --- a/gr-atsc/src/lib/atsci_equalizer_lms2.cc +++ b/gr-atsc/src/lib/atsci_equalizer_lms2.cc @@ -1,19 +1,19 @@ /* -*- 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 3, 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, @@ -43,22 +43,22 @@ static const int KNOWN_FIELD_SYNC_LENGTH = 4 + 511 + 3 * 63; static int get_field_sync_training_sequence_length (int offset); static const float *get_field_sync_training_sequence (int which_field, int offset); -static inline int -wrap (int d) +static inline int +wrap (int d) { assert (d >= 0 && d <= (2 * NFBTAPS)); - + if(d >= NFBTAPS) return d - NFBTAPS; return d; } -static inline float +static inline float slice (float d) { if (boost::math::isnan (d)) return 0.0; - + if (d >= 0.0){ if (d >= 4.0){ if (d >= 6.0) @@ -129,7 +129,7 @@ atsci_equalizer_lms2::npretaps () const * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be * referenced to compute the output values. */ -void +void atsci_equalizer_lms2::filter_normal (const float *input_samples, float *output_samples, int nsamples) @@ -149,7 +149,7 @@ atsci_equalizer_lms2::filter_normal (const float *input_samples, * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be * referenced to compute the output values. */ -void +void atsci_equalizer_lms2::filter_data_seg_sync (const float *input_samples, float *output_samples, int nsamples, @@ -162,24 +162,24 @@ atsci_equalizer_lms2::filter_data_seg_sync (const float *input_samples, // cerr << "Seg Sync: offset " << offset << "\tnsamples\t" << nsamples << "\t pre, 5 -5 -5 5\t" << // output_samples[0] << "\t" << output_samples[1] << "\t" << output_samples[2] << "\t" << output_samples[3] << endl; - + } - + /*! * Input range is known to consist of only a field sync segment or a * portion of a field sync segment. \p nsamples will be in [1,832]. * \p offset will be in [0,831]. \p offset is the offset of the input * from the beginning of the data segment sync pattern. We consider the * 4 symbols of the immediately preceding data segment sync to be the - * first symbols of the field sync segment. \p which_field is in [0,1] + * first symbols of the field sync segment. \p which_field is in [0,1] * and specifies which field (duh). * * \p input_samples has (nsamples + ntaps() - 1) valid entries. * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be * referenced to compute the output values. */ -void +void atsci_equalizer_lms2::filter_field_sync (const float *input_samples, float *output_samples, int nsamples, @@ -187,11 +187,11 @@ atsci_equalizer_lms2::filter_field_sync (const float *input_samples, int which_field) { // Only the first 4 + 511 + 3 * 63 symbols are completely defined. - // Those after that the symbols are bilevel, so we could use decision feedback and use + // Those after that the symbols are bilevel, so we could use decision feedback and use // that to train, but for now, don't train on them. int n = min (nsamples, get_field_sync_training_sequence_length (offset)); - + // handle known training sequence adaptN (input_samples, get_field_sync_training_sequence (which_field, offset), output_samples, n); @@ -268,7 +268,7 @@ float atsci_equalizer_lms2::adapt1 (const float input[], float ideal_output) { static const double BETA = 0.00005; // FIXME figure out what this ought to be - // FIXME add gear-shifting + // FIXME add gear-shifting double y = filter1 (input); double e = y - ideal_output; @@ -296,7 +296,7 @@ atsci_equalizer_lms2::filterN (const float *input_samples, } -void +void atsci_equalizer_lms2::adaptN (const float *input_samples, const float *training_pattern, float *output_samples, @@ -316,7 +316,7 @@ bin_map (int bit) static void init_field_sync_common (float *p, int mask) - + { int i = 0; @@ -333,7 +333,7 @@ init_field_sync_common (float *p, int mask) for (int j = 0; j < 63; j++) // PN63, toggled on field 2 p[i++] = bin_map (atsc_pn63[j] ^ mask); - + for (int j = 0; j < 63; j++) // PN63 p[i++] = bin_map (atsc_pn63[j]); @@ -349,7 +349,7 @@ get_data_seg_sync_training_sequence (int offset) } #endif -static int +static int get_field_sync_training_sequence_length (int offset) { return max (0, KNOWN_FIELD_SYNC_LENGTH - offset); |