misc_utils/resampler: Cosmetic changes
Change variables names to more readable. Remove old comment. Change-Id: Ibe22677cfc4b3e1a9fb900e5055cdce0a7656a92
This commit is contained in:
parent
6a0fb1a415
commit
acd7d71db4
|
@ -84,31 +84,29 @@ namespace gr {
|
||||||
uint64_t processed_in_sum = 0; //input samples processed during a whole call to general_work function
|
uint64_t processed_in_sum = 0; //input samples processed during a whole call to general_work function
|
||||||
uint64_t produced_out_sum = 0; //output samples produced during a whole call to general_work function
|
uint64_t produced_out_sum = 0; //output samples produced during a whole call to general_work function
|
||||||
|
|
||||||
std::vector<tag_t> set_resamp_ratio_tags;
|
std::vector<tag_t> tags;
|
||||||
|
|
||||||
pmt::pmt_t key = pmt::string_to_symbol("set_resamp_ratio");
|
pmt::pmt_t key = pmt::string_to_symbol("set_resamp_ratio");
|
||||||
get_tags_in_window(set_resamp_ratio_tags, 0, 0, ninput_items[0]);
|
get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+ninput_items[0]);
|
||||||
|
bool out_buffer_full = false;
|
||||||
bool all_output_samples_produced = false;
|
for(std::vector<tag_t>::iterator i_tag = tags.begin(); i_tag < tags.end(); i_tag++)
|
||||||
for(std::vector<tag_t>::iterator i_tag = set_resamp_ratio_tags.begin(); i_tag < set_resamp_ratio_tags.end(); i_tag++)
|
|
||||||
{
|
{
|
||||||
uint64_t tag_offset_rel = i_tag->offset - nitems_read(0);
|
uint64_t tag_offset_rel = i_tag->offset - nitems_read(0);
|
||||||
|
|
||||||
if(pmt::symbol_to_string(i_tag->key) == "set_resamp_ratio")
|
if(pmt::symbol_to_string(i_tag->key) == "set_resamp_ratio")
|
||||||
{
|
{
|
||||||
uint64_t samples_to_produce = static_cast<uint64_t>(round(static_cast<double>(tag_offset_rel-processed_in_sum)/d_mu_inc)); //tu może być problem - bo to jest głupota przy d_mu_inc różnym od 1.0
|
uint64_t samples_to_produce = static_cast<uint64_t>(round(static_cast<double>(tag_offset_rel-processed_in_sum)/d_mu_inc));
|
||||||
|
|
||||||
if((samples_to_produce + produced_out_sum) > noutput_items)
|
if((samples_to_produce + produced_out_sum) > noutput_items)
|
||||||
{
|
{
|
||||||
samples_to_produce = noutput_items - produced_out_sum;
|
samples_to_produce = noutput_items - produced_out_sum;
|
||||||
all_output_samples_produced = true;
|
out_buffer_full = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
processed_in = resample(in, processed_in_sum, out, produced_out_sum, samples_to_produce);
|
processed_in = resample(in, processed_in_sum, out, produced_out_sum, samples_to_produce);
|
||||||
processed_in_sum = processed_in_sum + processed_in;
|
processed_in_sum = processed_in_sum + processed_in;
|
||||||
produced_out_sum = produced_out_sum + samples_to_produce;
|
produced_out_sum = produced_out_sum + samples_to_produce;
|
||||||
|
|
||||||
if(all_output_samples_produced)
|
if(out_buffer_full)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -124,12 +122,11 @@ namespace gr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!all_output_samples_produced)
|
if(!out_buffer_full)
|
||||||
{
|
{
|
||||||
processed_in = resample(in, processed_in_sum, out, produced_out_sum, (noutput_items-produced_out_sum));
|
processed_in = resample(in, processed_in_sum, out, produced_out_sum, (noutput_items-produced_out_sum));
|
||||||
processed_in_sum = processed_in_sum + processed_in;
|
processed_in_sum = processed_in_sum + processed_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
consume_each(processed_in_sum);
|
consume_each(processed_in_sum);
|
||||||
return noutput_items;
|
return noutput_items;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue