1 /* -*- c++ -*- */ 2 /* 3 * Copyright 2014 Free Software Foundation, Inc. 4 * 5 * This file is part of GNU Radio 6 * 7 * GNU Radio is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3, or (at your option) 10 * any later version. 11 * 12 * GNU Radio is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with GNU Radio; see the file COPYING. If not, write to 19 * the Free Software Foundation, Inc., 51 Franklin Street, 20 * Boston, MA 02110-1301, USA. 21 */ 22 23 #ifndef INCLUDED_DTV_ATSC_EQUALIZER_IMPL_H 24 #define INCLUDED_DTV_ATSC_EQUALIZER_IMPL_H 25 26 #include "atsc_syminfo_impl.h" 27 #include <gnuradio/dtv/atsc_consts.h> 28 #include <gnuradio/dtv/atsc_equalizer.h> 29 30 namespace gr { 31 namespace dtv { 32 33 class atsc_equalizer_impl : public atsc_equalizer 34 { 35 private: 36 static const int NTAPS = 64; 37 static const int NPRETAPS = (int)(NTAPS * 0.8); // probably should be either .2 or .8 38 39 // the length of the field sync pattern that we know unequivocally 40 static const int KNOWN_FIELD_SYNC_LENGTH = 4 + 511 + 3 * 63; 41 42 float training_sequence1[KNOWN_FIELD_SYNC_LENGTH]; 43 float training_sequence2[KNOWN_FIELD_SYNC_LENGTH]; 44 45 void filterN(const float* input_samples, float* output_samples, int nsamples); 46 void adaptN(const float* input_samples, 47 const float* training_pattern, 48 float* output_samples, 49 int nsamples); 50 51 std::vector<float> d_taps; 52 53 float data_mem[ATSC_DATA_SEGMENT_LENGTH + NTAPS]; // Buffer for previous data packet 54 float data_mem2[ATSC_DATA_SEGMENT_LENGTH]; 55 unsigned short d_flags; 56 short d_segno; 57 58 int d_buff_not_filled; 59 60 public: 61 atsc_equalizer_impl(); 62 ~atsc_equalizer_impl(); 63 64 void setup_rpc(); 65 66 std::vector<float> taps() const; 67 std::vector<float> data() const; 68 69 virtual int general_work(int noutput_items, 70 gr_vector_int& ninput_items, 71 gr_vector_const_void_star& input_items, 72 gr_vector_void_star& output_items); 73 }; 74 75 } /* namespace dtv */ 76 } /* namespace gr */ 77 78 #endif /* INCLUDED_DTV_ATSC_EQUALIZER_IMPL_H */ 79