From 89d818a792a5c98fba0d576bc9dda20bcf8794d0 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Thu, 23 Aug 2012 09:03:56 -0700 Subject: [PATCH] Slicer was being called with fewer samples than necessary for output. This may fix the "O" bug and should reduce CPU consumption. --- lib/air_modes_preamble.cc | 8 ++++++-- lib/air_modes_slicer.cc | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/air_modes_preamble.cc b/lib/air_modes_preamble.cc index 6bcf2e6..33dd033 100644 --- a/lib/air_modes_preamble.cc +++ b/lib/air_modes_preamble.cc @@ -90,7 +90,7 @@ static double tag_to_timestamp(gr_tag_t tstamp, uint64_t abs_sample_cnt, double ts_sample = tstamp.offset; double tstime = double(abs_sample_cnt * secs_per_sample) + last_whole_stamp + last_frac_stamp; - //std::cout << "HEY WE GOT A STAMP AT " << tstime << " TICKS AT SAMPLE " << ts_sample << " ABS SAMPLE CNT IS " << abs_sample_cnt << std::endl; + if(0) std::cout << "HEY WE GOT A STAMP AT " << tstime << " TICKS AT SAMPLE " << ts_sample << " ABS SAMPLE CNT IS " << abs_sample_cnt << std::endl; return tstime; } @@ -104,6 +104,8 @@ int air_modes_preamble::general_work(int noutput_items, const int ninputs = std::min(ninput_items[0], ninput_items[1]); //just in case float *out = (float *) output_items[0]; + if(0) std::cout << "Preamble called with " << ninputs << " samples" << std::endl; + //fixme move into .h const int pulse_offsets[4] = { 0, int(2 * d_samples_per_chip), @@ -187,13 +189,15 @@ int air_modes_preamble::general_work(int noutput_items, //std::cout << "PREAMBLE" << std::endl; - //produce only one output per work call + //produce only one output per work call -- TODO this should probably change + if(0) std::cout << "Preamble consumed " << i+240*d_samples_per_chip << ", returned 240" << std::endl; consume_each(i+240*d_samples_per_chip); return 240; } } //didn't get anything this time + if(0) std::cout << "Preamble consumed " << ninputs << ", returned 0" << std::endl; consume_each(ninputs); return 0; } diff --git a/lib/air_modes_slicer.cc b/lib/air_modes_slicer.cc index 1426d56..c6519aa 100644 --- a/lib/air_modes_slicer.cc +++ b/lib/air_modes_slicer.cc @@ -56,7 +56,7 @@ air_modes_slicer::air_modes_slicer(int channel_rate, gr_msg_queue_sptr queue) : d_check_width = 120 * d_samples_per_symbol; //how far you will have to look ahead d_queue = queue; - set_output_multiple(1+d_check_width); //how do you specify buffer size for sinks? + set_output_multiple(d_check_width*2); //how do you specify buffer size for sinks? } //this slicer is courtesy of Lincoln Labs. supposedly it is more resistant to mode A/C FRUIT. @@ -102,6 +102,8 @@ int air_modes_slicer::work(int noutput_items, { const float *in = (const float *) input_items[0]; int size = noutput_items - d_check_width; //since it's a sync block, i assume that it runs with ninput_items = noutput_items + + if(0) std::cout << "Slicer called with " << size << " samples" << std::endl; std::vector tags; uint64_t abs_sample_cnt = nitems_read(0); @@ -188,6 +190,6 @@ int air_modes_slicer::work(int noutput_items, gr_message_sptr msg = gr_make_message_from_string(std::string(d_payload.str())); d_queue->handle(msg); } - + if(0) std::cout << "Slicer consumed " << size << ", returned " << size << std::endl; return size; }