- 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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user