LogCompress.h
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Tipic
5 
6  Centre for Digital Music, Queen Mary, University of London.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version. See the file
12  COPYING included with this distribution for more information.
13 */
14 
15 #ifndef LOGCOMPRESS_H
16 #define LOGCOMPRESS_H
17 
18 #include <vector>
19 #include <cmath>
20 
22 {
23 public:
24  static std::vector<double> process(std::vector<double> in,
25  double factor,
26  double addTerm) {
27  std::vector<double> out;
28  out.reserve(in.size());
29  for (auto x: in) {
30  out.push_back(log10(addTerm + factor * x));
31  }
32  return out;
33  }
34 };
35 
36 #endif
37 
Definition: LogCompress.h:21