[Peak Detect]

- added more parameter

git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@460 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-05-25 05:41:50 +00:00
parent 045de0c155
commit f0b29e0e6e
4 changed files with 55 additions and 23 deletions
+10 -6
View File
@@ -29,19 +29,23 @@ namespace gr {
namespace jay {
peak_detect::sptr
peak_detect::make(float alpha_s, float alpha_m, int vlen)
peak_detect::make(int vlen, float framerate, float peak_height_min, int peak_width_min, int peak_width_max, float alpha_s, float alpha_m)
{
return gnuradio::get_initial_sptr
(new peak_detect_impl(alpha_s, alpha_m, vlen));
(new peak_detect_impl(vlen, framerate, peak_height_min, peak_width_min, peak_width_max, alpha_s, alpha_m));
}
/*
* The private constructor
*/
peak_detect_impl::peak_detect_impl(float alpha_s, float alpha_m, int vlen)
peak_detect_impl::peak_detect_impl(int vlen, float framerate, float peak_height_min, int peak_width_min, int peak_width_max, float alpha_s, float alpha_m)
: gr::sync_block("peak_detect"
, gr::io_signature::make(1, 1, vlen*sizeof(float))
, gr::io_signature::make(1, 1, vlen*sizeof(float)))
, m_framerate (framerate)
, m_peak_height_min (peak_height_min)
, m_peak_width_min (peak_width_min)
, m_peak_width_max (peak_width_max)
, m_alpha_s (alpha_s)
, m_alpha_m(alpha_m)
, m_frameCount(0)
@@ -200,7 +204,7 @@ namespace gr {
// Create peak list
// -----------------------------------------------------------------
// Find peak candidates by thresholding
threshold(m_pPeakData, m_pXd, nitems_per_block, 20.f);
threshold(m_pPeakData, m_pXd, nitems_per_block, m_peak_height_min);
int numPeaks = findPeakPos(m_pPeakPos, m_pPeakData, nitems_per_block);
// -----------------------------------------------------------------
@@ -318,9 +322,9 @@ namespace gr {
pbh = std::max(pbh_left, pbh_right);
// Ensure peak box is at least pb_min
pbh = std::max(pbh, PB_MIN);
pbh = std::max(pbh, m_peak_width_min);
if (pbh > PB_MAX)
if (pbh > m_peak_width_max)
{
pbh = 0;
break;