changeset 352:a3fc6e1f2d4e

Restore threads stuff -- the host needs to be compiled with threading
author Chris Cannam
date Thu, 03 Sep 2015 12:06:31 +0100
parents 34357aeab3ad
children 169775c036b3
files CHANGELOG Makefile.inc README src/Silvet.cpp src/Silvet.h
diffstat 5 files changed, 37 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CHANGELOG	Thu Sep 03 12:06:31 2015 +0100
@@ -0,0 +1,21 @@
+
+Changes in Silvet v1.1 since the previous release v1.0:
+
+ * The "draft" mode has been replaced by "live" mode. This usually
+   produces worse results than "draft" did, but it is much faster and
+   has much lower processing latency. (The "draft" mode occupied an
+   uncomfortable role -- not fast enough to be usable in real-time or
+   low-power situations, not good enough to be a useful alternative to
+   the default processing mode.)
+
+ * The plugin has new outputs for note onsets only; onsets and
+   offsets; pitch activation matrix; and pitch chroma distribution
+   (chromagram).
+
+ * Some thresholds have been adjusted to improve performance in test
+   datasets.
+
+ * The expectation-maximisation process is now initialised
+   deterministically rather than from random data, so the plugin
+   now produces the same results on every run.
+
--- a/Makefile.inc	Fri Aug 14 12:24:12 2015 +0100
+++ b/Makefile.inc	Thu Sep 03 12:06:31 2015 +0100
@@ -13,7 +13,7 @@
 CC	?= gcc
 
 CFLAGS := $(CFLAGS)
-CXXFLAGS := $(CFLAGS) -I. -I$(VAMPSDK_DIR) -I$(CQ_DIR) -I$(BQVEC_DIR) -I$(BQVEC_DIR) -I$(FD_DIR) $(CXXFLAGS) -DMAX_EM_THREADS=1
+CXXFLAGS := $(CFLAGS) -I. -I$(VAMPSDK_DIR) -I$(CQ_DIR) -I$(BQVEC_DIR) -I$(BQVEC_DIR) -I$(FD_DIR) $(CXXFLAGS) 
 
 LDFLAGS := $(LDFLAGS) 
 PLUGIN_LDFLAGS := $(LDFLAGS) $(PLUGIN_LDFLAGS)
--- a/README	Fri Aug 14 12:24:12 2015 +0100
+++ b/README	Thu Sep 03 12:06:31 2015 +0100
@@ -60,6 +60,9 @@
 
 http://www.music-ir.org/mirex/wiki/2012:Multiple_Fundamental_Frequency_Estimation_%26_Tracking_Results
 
+Also refer to later editions of MIREX (2014 and 2015) for results
+obtained using the Silvet plugin itself.
+
 
 Authors
 -------
@@ -85,6 +88,6 @@
 
 (See the CITATION file for a BibTeX reference.)
 
-This plugin is Copyright 2014 Queen Mary, University of London. It is
-distributed under the GNU General Public License: see the file COPYING
-for details.
+This plugin is Copyright 2014-2015 Queen Mary, University of
+London. It is distributed under the GNU General Public License: see
+the file COPYING for details.
--- a/src/Silvet.cpp	Fri Aug 14 12:24:12 2015 +0100
+++ b/src/Silvet.cpp	Thu Sep 03 12:06:31 2015 +0100
@@ -727,11 +727,10 @@
         localBestShifts = vector<vector<int> >(width);
     }
 
-#ifndef MAX_EM_THREADS
-#define MAX_EM_THREADS 8
-#endif
-
     int emThreadCount = MAX_EM_THREADS;
+    if (emThreadCount > int(std::thread::hardware_concurrency())) {
+        emThreadCount = std::thread::hardware_concurrency();
+    }
     if (m_mode == LiveMode && pack.templates.size() == 1) {
         // The EM step is probably not slow enough to merit it
         emThreadCount = 1;
@@ -743,15 +742,12 @@
             typedef future<pair<vector<double>, vector<int>>> EMFuture;
             vector<EMFuture> results;
             for (int j = 0; j < emThreadCount && i + j < width; ++j) {
-                cerr << "creating future " << j << " (i = " << i << ", width = " << width << ")" << endl;
+                const vector<double> &column = filtered.at(i + j);
                 results.push_back
                     (async(std::launch::async,
-                           [&](int index) {
-                               return applyEM(pack, filtered.at(index));
-                           }, i + j));
+                           [&]() { return applyEM(pack, column); }));
             }
             for (int j = 0; j < emThreadCount && i + j < width; ++j) {
-                cerr << "reaping future " << j << " (i = " << i << ", width = " << width << ")" << endl;
                 auto out = results[j].get();
                 localPitches[i+j] = out.first;
                 if (wantShifts) localBestShifts[i+j] = out.second;
--- a/src/Silvet.h	Fri Aug 14 12:24:12 2015 +0100
+++ b/src/Silvet.h	Thu Sep 03 12:06:31 2015 +0100
@@ -25,6 +25,10 @@
 #include "MedianFilter.h"
 #include "Instruments.h"
 
+#ifndef MAX_EM_THREADS
+#define MAX_EM_THREADS 8
+#endif
+
 using std::string;
 using std::vector;
 using std::set;