annotate src/Chroma.cpp @ 60:1ea2aed23d4a tip

Fix version
author Chris Cannam
date Thu, 13 Feb 2020 13:37:36 +0000
parents 00b6ae41efbe
children
rev   line source
Chris@26 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@26 2
Chris@42 3 /*
Chris@42 4 Tipic
Chris@42 5
Chris@42 6 Centre for Digital Music, Queen Mary, University of London.
Chris@42 7
Chris@42 8 This program is free software; you can redistribute it and/or
Chris@42 9 modify it under the terms of the GNU General Public License as
Chris@42 10 published by the Free Software Foundation; either version 2 of the
Chris@42 11 License, or (at your option) any later version. See the file
Chris@42 12 COPYING included with this distribution for more information.
Chris@42 13 */
Chris@42 14
Chris@26 15 #include "Chroma.h"
Chris@26 16
Chris@42 17 #include "maths/MathUtilities.h"
Chris@26 18 #include "LogCompress.h"
Chris@26 19 #include "OctaveFold.h"
Chris@26 20 #include "Resize.h"
Chris@26 21
Chris@26 22 #include <cmath>
Chris@26 23 #include <iostream>
Chris@26 24
Chris@26 25 using namespace std;
Chris@26 26
Chris@35 27 Chroma::Chroma(Parameters params) :
Chris@35 28 m_params(params)
Chris@35 29 {
Chris@35 30 }
Chris@35 31
Chris@26 32 Chroma::~Chroma()
Chris@26 33 {
Chris@26 34 }
Chris@26 35
Chris@26 36 RealBlock
Chris@26 37 Chroma::process(const RealBlock &in)
Chris@26 38 {
Chris@26 39 if (in.empty()) {
Chris@26 40 return in;
Chris@26 41 }
Chris@26 42
Chris@26 43 RealBlock out;
Chris@26 44
Chris@26 45 for (RealColumn col: in) {
Chris@26 46
Chris@26 47 if (m_params.applyLogCompression) {
Chris@26 48 col = LogCompress::process(col, m_params.logFactor, m_params.logAddTerm);
Chris@26 49 }
Chris@26 50
Chris@42 51 out.push_back(MathUtilities::normaliseLp
Chris@26 52 (OctaveFold::process
Chris@26 53 (Resize::process(col)),
Chris@26 54 m_params.normP, m_params.normThresh));
Chris@26 55 }
Chris@26 56
Chris@26 57 return out;
Chris@26 58 }
Chris@26 59