annotate dsp/onsets/PeakPicking.h @ 515:08bcc06c38ec tip master

Remove fast-math
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 28 Jan 2020 15:27:37 +0000
parents af5b7ef02aa7
children
rev   line source
c@225 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@225 2
c@225 3 /*
c@225 4 QM DSP Library
c@225 5
c@225 6 Centre for Digital Music, Queen Mary, University of London.
c@309 7 This file 2005-2006 Christian Landone.
c@309 8
mathieu@321 9 Modifications:
mathieu@321 10
mathieu@321 11 - delta threshold
mathieu@321 12 Description: add delta threshold used as offset in the smoothed
mathieu@321 13 detection function
mathieu@321 14 Author: Mathieu Barthet
mathieu@321 15 Date: June 2010
mathieu@321 16
c@309 17 This program is free software; you can redistribute it and/or
c@309 18 modify it under the terms of the GNU General Public License as
c@309 19 published by the Free Software Foundation; either version 2 of the
c@309 20 License, or (at your option) any later version. See the file
c@309 21 COPYING included with this distribution for more information.
c@225 22 */
c@225 23
cannam@489 24 #ifndef QM_DSP_PEAKPICKING_H
cannam@489 25 #define QM_DSP_PEAKPICKING_H
c@225 26
c@241 27 #include "maths/MathUtilities.h"
c@241 28 #include "maths/MathAliases.h"
c@225 29 #include "dsp/signalconditioning/DFProcess.h"
c@225 30
c@225 31
c@237 32 struct PPWinThresh
c@225 33 {
cannam@499 34 int pre;
cannam@499 35 int post;
mathieu@321 36
cannam@499 37 PPWinThresh(int x, int y) :
mathieu@321 38 pre(x),
mathieu@321 39 post(y)
mathieu@321 40 {
mathieu@321 41 }
c@225 42 };
c@225 43
c@225 44 struct QFitThresh
c@225 45 {
c@225 46 double a;
c@225 47 double b;
c@225 48 double c;
mathieu@321 49
mathieu@321 50 QFitThresh(double x, double y, double z) :
mathieu@321 51 a(x),
mathieu@321 52 b(y),
mathieu@321 53 c(z)
mathieu@321 54 {
mathieu@321 55 }
c@225 56 };
c@225 57
c@225 58 struct PPickParams
c@225 59 {
cannam@499 60 int length; // detection function length
mathieu@321 61 double tau; // time resolution of the detection function
cannam@499 62 int alpha; // alpha-norm parameter
cannam@499 63 double cutoff;// low-pass filter cutoff freq
cannam@499 64 int LPOrd; // low-pass filter order
cannam@499 65 double* LPACoeffs; // low-pass filter denominator coefficients
cannam@499 66 double* LPBCoeffs; // low-pass filter numerator coefficients
cannam@499 67 PPWinThresh WinT;// window size in frames for adaptive thresholding [pre post]:
c@225 68 QFitThresh QuadThresh;
cannam@499 69 float delta; // delta threshold used as an offset when computing the smoothed detection function
mathieu@321 70
mathieu@321 71 PPickParams() :
mathieu@321 72 length(0),
mathieu@321 73 tau(0),
mathieu@321 74 alpha(0),
mathieu@321 75 cutoff(0),
mathieu@321 76 LPOrd(0),
mathieu@321 77 LPACoeffs(NULL),
mathieu@321 78 LPBCoeffs(NULL),
mathieu@321 79 WinT(0,0),
mathieu@321 80 QuadThresh(0,0,0),
mathieu@321 81 delta(0)
mathieu@321 82 {
mathieu@321 83 }
c@225 84 };
c@225 85
c@225 86 class PeakPicking
c@225 87 {
c@225 88 public:
c@225 89 PeakPicking( PPickParams Config );
c@225 90 virtual ~PeakPicking();
cannam@483 91
cannam@499 92 void process( double* src, int len, std::vector<int> &onsets );
c@225 93
c@225 94 private:
c@225 95 void initialise( PPickParams Config );
c@225 96 void deInitialise();
cannam@487 97 int quadEval( std::vector<double> &src, std::vector<int> &idx );
cannam@483 98
c@225 99 DFProcConfig m_DFProcessingParams;
c@225 100
cannam@499 101 int m_DFLength ;
c@225 102 double Qfilta ;
c@225 103 double Qfiltb;
c@225 104 double Qfiltc;
c@225 105
c@225 106 double* m_workBuffer;
cannam@483 107
cannam@483 108 DFProcess* m_DFSmoothing;
c@225 109 };
c@225 110
c@225 111 #endif