annotate PeakInterpolator.h @ 75:84d1a0647ce5 tip

Split out COPYING from README
author Chris Cannam
date Fri, 06 Mar 2020 11:01:53 +0000
parents 45b4401136f6
children
rev   line source
Chris@39 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@39 2 /*
Chris@39 3 This file is Copyright (c) 2012 Chris Cannam
Chris@39 4
Chris@39 5 Permission is hereby granted, free of charge, to any person
Chris@39 6 obtaining a copy of this software and associated documentation
Chris@39 7 files (the "Software"), to deal in the Software without
Chris@39 8 restriction, including without limitation the rights to use, copy,
Chris@39 9 modify, merge, publish, distribute, sublicense, and/or sell copies
Chris@39 10 of the Software, and to permit persons to whom the Software is
Chris@39 11 furnished to do so, subject to the following conditions:
Chris@39 12
Chris@39 13 The above copyright notice and this permission notice shall be
Chris@39 14 included in all copies or substantial portions of the Software.
Chris@39 15
Chris@39 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Chris@39 17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Chris@39 18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Chris@39 19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
Chris@39 20 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Chris@39 21 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
Chris@39 22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Chris@39 23 */
Chris@39 24
Chris@39 25 #ifndef _PEAK_INTERPOLATOR_H_
Chris@39 26 #define _PEAK_INTERPOLATOR_H_
Chris@39 27
Chris@39 28 class PeakInterpolator
Chris@39 29 {
Chris@39 30 public:
Chris@39 31 PeakInterpolator() { }
Chris@39 32 ~PeakInterpolator() { }
Chris@39 33
Chris@39 34 /**
Chris@42 35 * Return the interpolated location (i.e. possibly between sample
Chris@42 36 * point indices) of the peak in the given sampled range.
Chris@42 37 *
Chris@42 38 * "The peak" is defined as the (approximate) location of the
Chris@42 39 * maximum of a function interpolating between the points
Chris@42 40 * neighbouring the sample index with the maximum value in the
Chris@42 41 * range.
Chris@42 42 *
Chris@42 43 * If multiple local peak samples in the input range are equal,
Chris@42 44 * i.e. there is more than one apparent peak in the range, the one
Chris@42 45 * with the lowest index will be used. This is the case even if a
Chris@42 46 * later peak would be of superior height after interpolation.
Chris@42 47 */
Chris@42 48 double findPeakLocation(const double *data, int size);
Chris@42 49
Chris@42 50 /**
Chris@39 51 * Return the interpolated location (i.e. between sample point
Chris@42 52 * indices) of the peak whose nearest sample is found at peakIndex
Chris@42 53 * in the given sampled range. This method allows you to specify
Chris@42 54 * which peak to find, if local rather than global peaks are of
Chris@42 55 * interest.
Chris@39 56 */
Chris@39 57 double findPeakLocation(const double *data, int size, int peakIndex);
Chris@39 58 };
Chris@39 59
Chris@39 60 #endif