Copiste  0.1
 All Classes Functions Variables Enumerations Friends Pages
extractor.h
1 /*
2  * This file is part of Copiste.
3  *
4  * Copiste is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Copiste is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Copiste. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 
19 #ifndef INCLUDED_EXTRACTORH
20 #define INCLUDED_EXTRACTORH
21 
22 #include <vlc/vlc.h>
23 #include <iostream>
24 #include <deque>
25 
26 using namespace std;
27 
33 {
34  public:
36  FeatureExtractor(int chunkSize = 0) { ; }
37 
39  virtual ~FeatureExtractor() { ; }
40 
42  virtual bool extract(std::deque<uint16_t> data, int size) = 0;
44  bool extract(std::deque<uint16_t> data, int size, size_t start);
45 
47  virtual float value(int index = 0) = 0;
49  virtual float safeValue(int index = 0)
50  { return std::min(max(), std::max(min(), value(index))); }
52  virtual float value(int index, float low, float high)
53  { return low + (high-low)*(value(index) - min())/(max() - min()); }
54 
56  virtual int size() = 0;
58  virtual float min() { return -1; }
60  virtual float max() { return 1; }
61 
63  virtual void setFloat(string key, float value) { ; }
65  virtual void setInt(string key, int value) { ; }
67  virtual float getFloat(string key) { return 0; }
69  virtual int getInt(string key) { return 0; }
71  virtual void setString(string key, string value) { ; }
73  virtual string getString(string key) { return ""; }
74 
76  virtual void clear() { ; }
77 };
78 
79 
80 #endif