[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:
@@ -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;
|
||||
|
||||
@@ -44,6 +44,10 @@ namespace jay {
|
||||
|
||||
};
|
||||
|
||||
float m_framerate;
|
||||
float m_peak_height_min;
|
||||
int m_peak_width_min;
|
||||
int m_peak_width_max;
|
||||
float m_alpha_s;
|
||||
float m_alpha_m;
|
||||
float *m_pPeakData;
|
||||
@@ -57,11 +61,8 @@ namespace jay {
|
||||
uint64_t m_frameCount;
|
||||
pmt::pmt_t m_tag_id;
|
||||
|
||||
const int PB_MIN = 5;
|
||||
const int PB_MAX = 37;
|
||||
|
||||
public:
|
||||
peak_detect_impl(float alpha_s, float alpha_m, int vlen);
|
||||
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);
|
||||
~peak_detect_impl();
|
||||
|
||||
// Where all the action really happens
|
||||
|
||||
Reference in New Issue
Block a user