diff options
author | cswiger | 2007-04-23 10:45:42 +0000 |
---|---|---|
committer | cswiger | 2007-04-23 10:45:42 +0000 |
commit | d049678e49aefaa823ce45bd9310e2e43c93e1cf (patch) | |
tree | ed7b5a030611df1e4ca916bf19717a165e1bab9f /gr-atsc/src/lib | |
parent | aaf51ed7d99ba7cb9badd38c15e8643425b8bf78 (diff) | |
download | gnuradio-d049678e49aefaa823ce45bd9310e2e43c93e1cf.tar.gz gnuradio-d049678e49aefaa823ce45bd9310e2e43c93e1cf.tar.bz2 gnuradio-d049678e49aefaa823ce45bd9310e2e43c93e1cf.zip |
Fixed atsc_field_sync_demux to consume input even when not creating
output. Added python files to make a complete 2.x atsc receiver, but
it is not fully working. It will happily produce the exact same amount of
transport stream output as a working system but has errors in the data.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@5081 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-atsc/src/lib')
-rw-r--r-- | gr-atsc/src/lib/atsc.i | 2 | ||||
-rw-r--r-- | gr-atsc/src/lib/atsc_bit_timing_loop.cc | 3 | ||||
-rw-r--r-- | gr-atsc/src/lib/atsc_field_sync_demux.cc | 45 | ||||
-rw-r--r-- | gr-atsc/src/lib/atsc_field_sync_demux.h | 17 | ||||
-rw-r--r-- | gr-atsc/src/lib/atsci_sssr.cc | 3 |
5 files changed, 49 insertions, 21 deletions
diff --git a/gr-atsc/src/lib/atsc.i b/gr-atsc/src/lib/atsc.i index 9c2fdecb2..77f5b75f2 100644 --- a/gr-atsc/src/lib/atsc.i +++ b/gr-atsc/src/lib/atsc.i @@ -187,7 +187,7 @@ GR_SWIG_BLOCK_MAGIC(atsc,field_sync_demux); atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); -class atsc_field_sync_demux : public gr_sync_decimator +class atsc_field_sync_demux : public gr_block { atsc_field_sync_demux(); diff --git a/gr-atsc/src/lib/atsc_bit_timing_loop.cc b/gr-atsc/src/lib/atsc_bit_timing_loop.cc index 49623a4fe..7c12fc111 100644 --- a/gr-atsc/src/lib/atsc_bit_timing_loop.cc +++ b/gr-atsc/src/lib/atsc_bit_timing_loop.cc @@ -28,7 +28,8 @@ #include <gr_io_signature.h> #include <atsc_consts.h> -float input_rate = 20e6; +// Input rate changed from 20MHz to 19.2 to support usrp at 3 * 6.4MHz +float input_rate = 19.2e6; double ratio_of_rx_clock_to_symbol_freq = input_rate / ATSC_SYMBOL_RATE; diff --git a/gr-atsc/src/lib/atsc_field_sync_demux.cc b/gr-atsc/src/lib/atsc_field_sync_demux.cc index 1534da8ad..070c901ad 100644 --- a/gr-atsc/src/lib/atsc_field_sync_demux.cc +++ b/gr-atsc/src/lib/atsc_field_sync_demux.cc @@ -46,11 +46,12 @@ atsc_make_field_sync_demux() } atsc_field_sync_demux::atsc_field_sync_demux() - : gr_sync_decimator("atsc_field_sync_demux", + : gr_block("atsc_field_sync_demux", gr_make_io_signature(2, 2, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(atsc_soft_data_segment)),DEC), + gr_make_io_signature(1, 1, sizeof(atsc_soft_data_segment))), d_locked(false), d_in_field2(true), d_segment_number(0), - d_next_input(0), d_lost_index(0) + d_next_input(0), d_lost_index(0), d_inputs0_size(0), + d_inputs0_index(0), d_consume(0) { reset(); } @@ -66,13 +67,27 @@ atsc_field_sync_demux::forecast (int noutput_items, gr_vector_int &ninput_items_ { unsigned ninputs = ninput_items_required.size(); for (unsigned i = 0; i < ninputs; i++) { - ninput_items_required[i] = noutput_items * DEC + 2 * DEC - 1; + ninput_items_required[i] = noutput_items * DEC + 2 * DEC ; - inputs0_index = d_next_input; - inputs0_size = noutput_items * DEC + 2 * DEC - 1; + d_inputs0_index = d_next_input; + d_inputs0_size = noutput_items * DEC + 2 * DEC ; } } +int +atsc_field_sync_demux::general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + int r = work (noutput_items, input_items, output_items); + consume_each (d_consume); + // printf("Consumed: %d, produced: %d\n",d_consume,r); + // we consume input even if no output is produced + // while looking for sync + return r; +} + int atsc_field_sync_demux::work (int noutput_items, @@ -92,7 +107,7 @@ atsc_field_sync_demux::work (int noutput_items, if (d_locked){ d_locked = false; - d_lost_index = inputs0_index + ii; + d_lost_index = d_inputs0_index + ii; cerr << "atsc_field_sync_demux: lost sync at " << d_lost_index << endl; } @@ -100,9 +115,9 @@ atsc_field_sync_demux::work (int noutput_items, // ... search for beginning of a field sync // cerr << "atsc_field_sync_demux: searching for sync at " - // << inputs0_index + ii << endl; + // << d_inputs0_index + ii << endl; - for (ii = 1; ii < inputs0_size; ii++){ + for (ii = 1; ii < d_inputs0_size; ii++){ if (atsc::tag_is_start_field_sync (input_tags[ii])){ // found one d_locked = true; @@ -116,16 +131,19 @@ atsc_field_sync_demux::work (int noutput_items, str = "SEGMENT"; cerr << "atsc_field_sync_demux: synced (" << str << ") at " - << inputs0_index + ii - << " [delta = " << inputs0_index + ii - d_lost_index + << d_inputs0_index + ii + << " [delta = " << d_inputs0_index + ii - d_lost_index << "]\n"; d_next_input += ii; // update for forecast + d_consume = ii; return 0; // no work completed so far } } // no non-NORMAL tag found d_next_input += ii; // update for forecast + d_consume = ii; + // printf("ii: %d, d_next_input: %d\n",ii,d_next_input); return 0; // no work completed so far } @@ -135,7 +153,7 @@ atsc_field_sync_demux::work (int noutput_items, while (k < noutput_items){ - if (inputs0_size - ii < ATSC_DATA_SEGMENT_LENGTH){ + if (d_inputs0_size - ii < ATSC_DATA_SEGMENT_LENGTH){ // We're out of input data. cerr << "atsc_field_sync_demux: ran out of input data\n"; d_next_input += ii; // update for forecast @@ -145,7 +163,7 @@ atsc_field_sync_demux::work (int noutput_items, if (!tag_is_seg_sync_or_field_sync (input_tags[ii])){ // lost sync... cerr << "atsc_field_sync_demux: lost sync at " - << inputs0_index + ii << endl; + << d_inputs0_index + ii << endl; d_next_input += ii; // update for forecast return k; // return amount of work completed so far @@ -179,6 +197,7 @@ atsc_field_sync_demux::work (int noutput_items, } d_next_input += ii; // update for forecast + d_consume = ii; return k; // return amount of work completed } diff --git a/gr-atsc/src/lib/atsc_field_sync_demux.h b/gr-atsc/src/lib/atsc_field_sync_demux.h index 05ef068c9..48bc1b864 100644 --- a/gr-atsc/src/lib/atsc_field_sync_demux.h +++ b/gr-atsc/src/lib/atsc_field_sync_demux.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_ATSC_FIELD_SYNC_DEMUX_H #define INCLUDED_ATSC_FIELD_SYNC_DEMUX_H -#include <gr_sync_decimator.h> +#include <gr_block.h> #include <atsc_types.h> class atsc_field_sync_demux; @@ -36,9 +36,8 @@ atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); * This class accepts 1 stream of floats (data), and 1 stream of tags (syminfo). * It outputs one stream of atsc_soft_data_segment packets * \ingroup atsc * - * input: atsc_data_segment; output: atsc_data_segment */ -class atsc_field_sync_demux : public gr_sync_decimator +class atsc_field_sync_demux : public gr_block { friend atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); @@ -46,6 +45,13 @@ class atsc_field_sync_demux : public gr_sync_decimator public: void forecast (int noutput_items, gr_vector_int &ninput_items_required); + + int general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); @@ -59,8 +65,9 @@ protected: gr_uint64 d_next_input; gr_uint64 d_lost_index; // diagnostic fluff - unsigned long long inputs0_index; // for inputs[0].index - unsigned long inputs0_size; // for inputs[0].size + unsigned long long d_inputs0_index; // for inputs[0].index + unsigned long d_inputs0_size; // for inputs[0].size + int d_consume; }; diff --git a/gr-atsc/src/lib/atsci_sssr.cc b/gr-atsc/src/lib/atsci_sssr.cc index b52f7a66b..f44b9243e 100644 --- a/gr-atsc/src/lib/atsci_sssr.cc +++ b/gr-atsc/src/lib/atsci_sssr.cc @@ -189,7 +189,8 @@ static const double ADJUSTMENT_GAIN = 1.0e-5 / (10 * ATSC_DATA_SEGMENT_LENGTH); atsci_interpolator::atsci_interpolator (double nominal_ratio_of_rx_clock_to_symbol_freq) { - assert (nominal_ratio_of_rx_clock_to_symbol_freq >= 1.8); +// Tweaked ratio from 1.8 to 1.78 to support input rate of 19.2MHz + assert (nominal_ratio_of_rx_clock_to_symbol_freq >= 1.78); d_nominal_ratio_of_rx_clock_to_symbol_freq = nominal_ratio_of_rx_clock_to_symbol_freq; |