cannam@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ cannam@0: cannam@0: /* cannam@0: Vamp feature extraction plugin using the MATCH audio alignment cannam@0: algorithm. cannam@0: cannam@0: Centre for Digital Music, Queen Mary, University of London. Chris@236: Copyright (c) 2007-2020 Simon Dixon, Chris Cannam, and Queen Mary Chris@230: University of London, Copyright (c) 2014-2015 Tido GmbH. cannam@0: cannam@0: This program is free software; you can redistribute it and/or cannam@0: modify it under the terms of the GNU General Public License as cannam@0: published by the Free Software Foundation; either version 2 of the cannam@0: License, or (at your option) any later version. See the file cannam@0: COPYING included with this distribution for more information. cannam@0: */ cannam@0: cannam@0: #ifndef _PATH_H_ cannam@0: #define _PATH_H_ cannam@0: cannam@0: #include cannam@0: cannam@0: class Path cannam@0: { cannam@0: public: cannam@0: Path() { } cannam@0: cannam@0: /** Smooths an alignment path.
cannam@0: * Consider the path as a sequence of horizontal (H), vertical (V) and cannam@0: * diagonal (D) steps. The smoothing consists of 2 rewrite rules:
cannam@0: * HnDmVn / Dm+n (where m is less than MAX_RUN_LENGTH)
cannam@0: * VnDmHn / Dm+n (where m is less than MAX_RUN_LENGTH)
cannam@0: * The new path is written over the old path. Note that the end points of cannam@0: * each application of a rewrite rule do not change. cannam@0: * @return the length of the new path cannam@0: */ cannam@0: int smooth(std::vector &x, std::vector &y, int length); cannam@0: cannam@0: protected: cannam@0: static const int MAX_RUN_LENGTH = 50; cannam@0: Chris@188: std::vector m_val; Chris@188: std::vector m_len; cannam@0: }; cannam@0: cannam@0: #endif cannam@0: