[Peak Detect]
- no intersection check during finding of peak boxes git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@464 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -74,9 +74,7 @@ namespace gr {
|
||||
std::stringstream str;
|
||||
str << name() << unique_id();
|
||||
m_tag_id = pmt::string_to_symbol(str.str());
|
||||
|
||||
fprintf(stderr, "m_peakList.size = %u\n", m_peakHistory.size());
|
||||
fprintf(stderr, "m_peakList.max_size = %u\n", m_peakHistory.max_size());
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -331,7 +329,6 @@ namespace gr {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Find intersection
|
||||
Peak peak =
|
||||
{
|
||||
.id = m_peak_id,
|
||||
@@ -340,29 +337,15 @@ namespace gr {
|
||||
.height_rel = m_pXd[pos],
|
||||
.height_abs = m_pX[pos],
|
||||
};
|
||||
int does_intersect = 0;
|
||||
for (int j=0; j < m_peakList.size(); j++)
|
||||
{
|
||||
if (m_peakList[j].isInRange(peak))
|
||||
{
|
||||
if (m_peakList[j].height_rel > peak.height_rel)
|
||||
{
|
||||
does_intersect = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!does_intersect)
|
||||
{
|
||||
m_peakList.push_back(peak);
|
||||
m_peak_id++;
|
||||
}
|
||||
|
||||
m_peakList.push_back(peak);
|
||||
m_peak_id++;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Peak management
|
||||
// -----------------------------------------------------------------
|
||||
temp.clear();
|
||||
for (int i = 0; i < m_peakList.size(); i++)
|
||||
{
|
||||
Peak &peak = m_peakList[i];
|
||||
@@ -372,7 +355,8 @@ namespace gr {
|
||||
{
|
||||
if (m_peakHistory[j].isInRange(peak))
|
||||
{
|
||||
m_peakHistory[j].update(peak);
|
||||
Peak p = m_peakHistory[j].update(peak);
|
||||
temp.push_back(p);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -380,10 +364,11 @@ namespace gr {
|
||||
|
||||
if (!found)
|
||||
{
|
||||
m_peakHistory.push_back(peak);
|
||||
temp.push_back(peak);
|
||||
}
|
||||
}
|
||||
|
||||
m_peakHistory = temp;
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Create peak box data
|
||||
// -----------------------------------------------------------------
|
||||
@@ -419,11 +404,8 @@ namespace gr {
|
||||
{
|
||||
// Create peak tags
|
||||
Peak &peak = m_peakHistory[i];
|
||||
pmt::pmt_t tag_key = pmt::string_to_symbol("id");
|
||||
pmt::pmt_t tag_value = pmt::from_long(peak.id);
|
||||
add_item_tag(DATA, nitems_written(DATA) + peak.pos, tag_key, tag_value, m_tag_id);
|
||||
tag_key = pmt::string_to_symbol("pos");
|
||||
tag_value = pmt::from_long(peak.pos);
|
||||
pmt::pmt_t tag_key = pmt::string_to_symbol(std::string("pos_id_") + std::to_string(peak.id));
|
||||
pmt::pmt_t tag_value = pmt::from_long(peak.pos);
|
||||
add_item_tag(DATA, nitems_written(DATA) + peak.pos, tag_key, tag_value, m_tag_id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user