cannam@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
cannam@0
|
2
|
cannam@0
|
3 /*
|
cannam@0
|
4 Vamp feature extraction plugin using the MATCH audio alignment
|
cannam@0
|
5 algorithm.
|
cannam@0
|
6
|
cannam@0
|
7 Centre for Digital Music, Queen Mary, University of London.
|
cannam@0
|
8 This file copyright 2007 Simon Dixon, Chris Cannam and QMUL.
|
cannam@0
|
9
|
cannam@0
|
10 This program is free software; you can redistribute it and/or
|
cannam@0
|
11 modify it under the terms of the GNU General Public License as
|
cannam@0
|
12 published by the Free Software Foundation; either version 2 of the
|
cannam@0
|
13 License, or (at your option) any later version. See the file
|
cannam@0
|
14 COPYING included with this distribution for more information.
|
cannam@0
|
15 */
|
cannam@0
|
16
|
cannam@0
|
17 #ifndef _PATH_H_
|
cannam@0
|
18 #define _PATH_H_
|
cannam@0
|
19
|
cannam@0
|
20 #include <vector>
|
cannam@0
|
21
|
cannam@0
|
22 class Path
|
cannam@0
|
23 {
|
cannam@0
|
24 public:
|
cannam@0
|
25 Path() { }
|
cannam@0
|
26
|
cannam@0
|
27 /** Smooths an alignment path.<BR>
|
cannam@0
|
28 * Consider the path as a sequence of horizontal (H), vertical (V) and
|
cannam@0
|
29 * diagonal (D) steps. The smoothing consists of 2 rewrite rules:<BR>
|
cannam@0
|
30 * HnDmVn / Dm+n (where m is less than MAX_RUN_LENGTH)<BR>
|
cannam@0
|
31 * VnDmHn / Dm+n (where m is less than MAX_RUN_LENGTH)<BR>
|
cannam@0
|
32 * The new path is written over the old path. Note that the end points of
|
cannam@0
|
33 * each application of a rewrite rule do not change.
|
cannam@0
|
34 * @return the length of the new path
|
cannam@0
|
35 */
|
cannam@0
|
36 int smooth(std::vector<int> &x, std::vector<int> &y, int length);
|
cannam@0
|
37
|
cannam@0
|
38 protected:
|
cannam@0
|
39 static const int MAX_RUN_LENGTH = 50;
|
cannam@0
|
40
|
cannam@0
|
41 std::vector<int> val;
|
cannam@0
|
42 std::vector<int> len;
|
cannam@0
|
43 };
|
cannam@0
|
44
|
cannam@0
|
45 #endif
|
cannam@0
|
46
|