cannam@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ cannam@0: cannam@0: /* cannam@0: QM DSP Library cannam@0: cannam@0: Centre for Digital Music, Queen Mary, University of London. Chris@84: This file 2005-2006 Christian Landone. Chris@84: mathieu@96: Modifications: mathieu@96: mathieu@96: - delta threshold mathieu@96: Description: add delta threshold used as offset in the smoothed mathieu@96: detection function mathieu@96: Author: Mathieu Barthet mathieu@96: Date: June 2010 mathieu@96: Chris@84: This program is free software; you can redistribute it and/or Chris@84: modify it under the terms of the GNU General Public License as Chris@84: published by the Free Software Foundation; either version 2 of the Chris@84: License, or (at your option) any later version. See the file Chris@84: COPYING included with this distribution for more information. cannam@0: */ cannam@0: cannam@0: #ifndef CDFPROCESS_H cannam@0: #define CDFPROCESS_H cannam@0: cannam@0: #include cannam@0: #include "FiltFilt.h" cannam@0: cannam@0: struct DFProcConfig{ cannam@0: unsigned int length; cannam@0: unsigned int LPOrd; cannam@0: double *LPACoeffs; cannam@0: double *LPBCoeffs; cannam@0: unsigned int winPre; cannam@0: unsigned int winPost; cannam@0: double AlphaNormParam; cannam@12: bool isMedianPositive; Chris@185: float delta; //delta threshold used as an offset when computing the smoothed detection function Chris@185: Chris@185: DFProcConfig() : Chris@185: length(0), Chris@185: LPOrd(0), Chris@185: LPACoeffs(NULL), Chris@185: LPBCoeffs(NULL), Chris@185: winPre(0), Chris@185: winPost(0), Chris@185: AlphaNormParam(0), Chris@185: isMedianPositive(false), Chris@185: delta(0) Chris@185: { Chris@185: } cannam@12: }; cannam@0: cannam@0: class DFProcess cannam@0: { cannam@0: public: cannam@0: DFProcess( DFProcConfig Config ); cannam@0: virtual ~DFProcess(); cannam@0: cannam@0: void process( double* src, double* dst ); cannam@0: cannam@0: cannam@0: private: cannam@0: void initialise( DFProcConfig Config ); cannam@0: void deInitialise(); cannam@0: void removeDCNormalize( double *src, double*dst ); cannam@0: void medianFilter( double* src, double* dst ); cannam@0: cannam@74: int m_length; cannam@74: int m_FFOrd; cannam@0: cannam@74: int m_winPre; cannam@74: int m_winPost; cannam@0: cannam@0: double m_alphaNormParam; cannam@0: cannam@0: double* filtSrc; cannam@0: double* filtDst; cannam@0: cannam@0: double* m_filtScratchIn; cannam@0: double* m_filtScratchOut; cannam@0: Chris@153: FilterConfig m_FilterConfigParams; cannam@0: cannam@0: FiltFilt* m_FiltFilt; cannam@0: cannam@0: bool m_isMedianPositive; Chris@185: float m_delta; //add delta threshold cannam@0: }; cannam@0: cannam@0: #endif