feat: RQF: filter() style interface RunningQuality
This commit is contained in:
@@ -124,7 +124,7 @@ RunningQuality::RunningQuality(bool disableSsf): beatCorrThr2(BEAT_CORR_THR_2),
|
||||
RunningQuality::~RunningQuality() {}
|
||||
|
||||
// note: arg should be an iterator really, but can do later
|
||||
void RunningQuality::append(std::vector<double> &rawBeat, std::vector<double> &rawSsf) {
|
||||
bool RunningQuality::append(std::vector<double> &rawBeat, std::vector<double> &rawSsf) {
|
||||
// TODO: should ignore crazy-long and very short beats here. (filter up on beat detector)
|
||||
|
||||
std::vector<double> beat;
|
||||
@@ -181,4 +181,20 @@ void RunningQuality::append(std::vector<double> &rawBeat, std::vector<double> &r
|
||||
dispatchBeat(idx, goodBeat, posCorr);
|
||||
}
|
||||
idx++;
|
||||
if (!goodBeat) return 0.0;
|
||||
return posCorr;
|
||||
}
|
||||
|
||||
|
||||
RunningQualityFilter::RunningQualityFilter(size_t upslope_width) : sqi(0.0) {}
|
||||
|
||||
double RunningQualityFilter::filter(double y, double ssf, double step) {
|
||||
if (step == 1.0) {
|
||||
sqi = f_sqi.append(beat_buf, ssf_buf);
|
||||
beat_buf.clear();
|
||||
ssf_buf.clear();
|
||||
}
|
||||
beat_buf.push_back(y);
|
||||
ssf_buf.push_back(ssf);
|
||||
return sqi;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user