Slicer was being called with fewer samples than necessary for output. This may fix the "O" bug and should reduce CPU consumption.

This commit is contained in:
Nick Foster 2012-08-23 09:03:56 -07:00
parent ee542ded35
commit 89d818a792
2 changed files with 10 additions and 4 deletions

View File

@ -90,7 +90,7 @@ static double tag_to_timestamp(gr_tag_t tstamp, uint64_t abs_sample_cnt, double
ts_sample = tstamp.offset; ts_sample = tstamp.offset;
double tstime = double(abs_sample_cnt * secs_per_sample) + last_whole_stamp + last_frac_stamp; 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; 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 const int ninputs = std::min(ninput_items[0], ninput_items[1]); //just in case
float *out = (float *) output_items[0]; float *out = (float *) output_items[0];
if(0) std::cout << "Preamble called with " << ninputs << " samples" << std::endl;
//fixme move into .h //fixme move into .h
const int pulse_offsets[4] = { 0, const int pulse_offsets[4] = { 0,
int(2 * d_samples_per_chip), int(2 * d_samples_per_chip),
@ -187,13 +189,15 @@ int air_modes_preamble::general_work(int noutput_items,
//std::cout << "PREAMBLE" << std::endl; //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); consume_each(i+240*d_samples_per_chip);
return 240; return 240;
} }
} }
//didn't get anything this time //didn't get anything this time
if(0) std::cout << "Preamble consumed " << ninputs << ", returned 0" << std::endl;
consume_each(ninputs); consume_each(ninputs);
return 0; return 0;
} }

View File

@ -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_check_width = 120 * d_samples_per_symbol; //how far you will have to look ahead
d_queue = queue; 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. //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]; 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 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<gr_tag_t> tags; std::vector<gr_tag_t> tags;
uint64_t abs_sample_cnt = nitems_read(0); 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())); gr_message_sptr msg = gr_make_message_from_string(std::string(d_payload.str()));
d_queue->handle(msg); d_queue->handle(msg);
} }
if(0) std::cout << "Slicer consumed " << size << ", returned " << size << std::endl;
return size; return size;
} }