- fixed peaks heights and merge()

git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@476 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-05-26 08:51:26 +00:00
parent b5f2ef3bb2
commit 635bf1ae4f
2 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -226,7 +226,7 @@ namespace gr {
else
{
Peak peak(m_peak_id++, pos);
peak.heightUpdate_rel(m_pXds, nitems_per_block);
peak.height_rel = m_pXds[pos];
addToListByPos(peaks, peak);
numPeaksClimbed++;
break;
+7 -5
View File
@@ -149,12 +149,14 @@ namespace jay {
const Peak& merge(const Peak &other)
{
float beta = 0.1f;
float beta = 0.5f;
float alpha = (1.f-beta);
pos = alpha*pos + beta*other.pos;
pbh = alpha*pbh + beta*other.pbh;
height_rel = std::max(height_rel, other.height_rel);
height_abs = std::max(height_abs, other.height_abs);
float pos_f = alpha*(float)pos + beta*(float)other.pos;
float pbh_f = alpha*(float)pbh + beta*(float)other.pbh;
pos = (int)(pos_f + 0.5f);
pbh = (int)(pbh_f + 0.5f);
height_rel = other.height_rel;
height_abs = other.height_abs;
return *this;
}