changeset 36:11b10bf3147a

Merge
author Chris Cannam
date Wed, 25 Jun 2014 13:59:32 +0100
parents 0d26e1096bac (current diff) d080b51953ba (diff)
children 32407651025d
files plugins/XTractPlugin.cpp svn-commit.tmp
diffstat 11 files changed, 108 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgsub	Wed Jun 25 13:59:32 2014 +0100
@@ -0,0 +1,1 @@
+LibXtract = [git]git://github.com/jamiebullock/LibXtract.git
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgsubstate	Wed Jun 25 13:59:32 2014 +0100
@@ -0,0 +1,1 @@
+03eb9cf0800c26c48e0369158f7058d3ae555fde LibXtract
--- a/.hgtags	Thu Jul 05 19:43:42 2012 +0100
+++ b/.hgtags	Wed Jun 25 13:59:32 2014 +0100
@@ -1,1 +1,4 @@
 066911b493d586eaeec2766fdfdd809b504bda43 vamp-libxtract-plugins-0.4.2.20071019
+066911b493d586eaeec2766fdfdd809b504bda43 0.4.2.20071019
+ff054467fe1d20e4957057a77f6925b7383e8871 0.4.5.20081202
+93aad8f9346ab4cae6e98cfa9068168d6c57f5f0 0.6.6.20121204
--- a/Makefile	Thu Jul 05 19:43:42 2012 +0100
+++ b/Makefile	Wed Jun 25 13:59:32 2014 +0100
@@ -3,13 +3,18 @@
 #
 PLUGINDIR	= plugins
 
+# Location of LibXtract
+#
+LIBXTRACTDIR	= LibXtract
+
 # Compile flags
 #
-CXXFLAGS	:= $(CXXFLAGS) -DNDEBUG -O3 -ffast-math -Wall -fPIC -I.
+CFLAGS		:= $(CFLAGS) -DXTRACT_FFT=1 -DUSE_OOURA=1 -DNDEBUG -O3 -ffast-math -Wall -fPIC -I. -I$(LIBXTRACTDIR)
+CXXFLAGS	:= $(CFLAGS) 
 
 # Libraries required for the plugins.
 #
-PLUGIN_LIBS	= -Wl,-Bstatic -lvamp-sdk -lxtract -lfftw3f -Wl,-Bdynamic
+PLUGIN_LIBS	= -Wl,-Bstatic -lvamp-sdk -lfftw3f -Wl,-Bdynamic
 
 # Flags required to tell the compiler to make a dynamically loadable object
 #
@@ -27,16 +32,17 @@
 ### End of user-serviceable parts
 
 PLUGIN_OBJECTS	= libmain.o $(patsubst %.cpp,%.o,$(wildcard $(PLUGINDIR)/*.cpp))
+XTRACT_OBJECTS	= $(patsubst %.c,%.o,$(wildcard $(LIBXTRACTDIR)/src/*.c $(LIBXTRACTDIR)/src/*/*.c))
 PLUGIN_HEADERS	= $(patsubst %.cpp,%.h,$(wildcard $(PLUGINDIR)/*.cpp))
 PLUGIN_TARGET	= vamp-libxtract$(PLUGIN_EXT)
 
 all:		$(PLUGIN_TARGET)
 
-$(PLUGIN_TARGET):	$(PLUGIN_OBJECTS) $(PLUGIN_HEADERS)
-		$(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS)
+$(PLUGIN_TARGET):	$(PLUGIN_OBJECTS) $(XTRACT_OBJECTS) $(PLUGIN_HEADERS)
+		$(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(XTRACT_OBJECTS) $(PLUGIN_LIBS)
 
 clean:		
-		rm -f $(PLUGIN_OBJECTS)
+		rm -f $(PLUGIN_OBJECTS) $(XTRACT_OBJECTS)
 
 distclean:	clean
 		rm -f $(PLUGIN_TARGET) *~ */*~
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.osx	Wed Jun 25 13:59:32 2014 +0100
@@ -0,0 +1,46 @@
+
+# Location of our plugins
+#
+PLUGINDIR	= plugins
+
+# Location of LibXtract
+#
+LIBXTRACTDIR	= LibXtract
+
+# Compile flags
+#
+CFLAGS		:= $(CFLAGS) -DXTRACT_FFT=1 -arch x86_64 -arch i386 -mmacosx-version-min=10.5 -DNDEBUG -O3 -ffast-math -Wall -fPIC -I. -I$(LIBXTRACTDIR) 
+CXXFLAGS	:= $(CFLAGS)
+
+# Libraries required for the plugins.
+#
+PLUGIN_LIBS	= -lvamp-sdk -lfftw3f
+
+# Flags required to tell the compiler to make a dynamically loadable object
+#
+PLUGIN_LDFLAGS	= -arch x86_64 -arch i386 -mmacosx-version-min=10.5 -dynamiclib -exported_symbols_list=vamp-plugin.list
+
+# File extension for a dynamically loadable object
+#
+PLUGIN_EXT	= .dylib
+
+
+### End of user-serviceable parts
+
+PLUGIN_OBJECTS	= libmain.o $(patsubst %.cpp,%.o,$(wildcard $(PLUGINDIR)/*.cpp))
+XTRACT_OBJECTS	= $(patsubst %.c,%.o,$(wildcard $(LIBXTRACTDIR)/src/*.c))
+PLUGIN_HEADERS	= $(patsubst %.cpp,%.h,$(wildcard $(PLUGINDIR)/*.cpp))
+PLUGIN_TARGET	= vamp-libxtract$(PLUGIN_EXT)
+
+all:		$(PLUGIN_TARGET)
+
+$(PLUGIN_TARGET):	$(PLUGIN_OBJECTS) $(XTRACT_OBJECTS) $(PLUGIN_HEADERS)
+		$(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(XTRACT_OBJECTS) $(PLUGIN_LIBS)
+
+clean:		
+		rm -f $(PLUGIN_OBJECTS) $(XTRACT_OBJECTS)
+
+distclean:	clean
+		rm -f $(PLUGIN_TARGET) *~ */*~
+
+
--- a/README	Thu Jul 05 19:43:42 2012 +0100
+++ b/README	Wed Jun 25 13:59:32 2014 +0100
@@ -9,7 +9,7 @@
 See STATUS for a description of the level of completeness and current
 test status of these plugins.
 
-Plugin code by Chris Cannam and Jamie Bullock, Copyright 2006-2008
+Plugin code by Chris Cannam and Jamie Bullock, Copyright 2006-2012
 Queen Mary, University of London and Jamie Bullock.  Distributed under
 the GNU General Public License.
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config.h	Wed Jun 25 13:59:32 2014 +0100
@@ -0,0 +1,6 @@
+
+/* Configure header for libxtract when building for use in Vamp plugin */
+
+#define BUILD_FFT 1
+#define XTRACT_FFT_OPTIMISATION_LEVEL 1
+
--- a/plugins/XTractPlugin.cpp	Thu Jul 05 19:43:42 2012 +0100
+++ b/plugins/XTractPlugin.cpp	Wed Jun 25 13:59:32 2014 +0100
@@ -5,7 +5,7 @@
     libxtract audio feature extraction library.
 
     Centre for Digital Music, Queen Mary, University of London.
-    This file copyright 2006-2008 Queen Mary, University of London.
+    This file copyright 2006-2012 Queen Mary, University of London.
     
     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License as
@@ -17,6 +17,7 @@
 #include "XTractPlugin.h"
 
 #include <cassert>
+#include <cstdio>
 #include <math.h>
 #include <stdio.h>
 
@@ -108,13 +109,13 @@
 int
 XTractPlugin::getPluginVersion() const
 {
-    return 3;
+    return 4;
 }
 
 string
 XTractPlugin::getCopyright() const
 {
-    string text = "Copyright 2006 Jamie Bullock, plugin Copyright 2006-2008 Queen Mary, University of London. ";
+    string text = "Copyright 2006-2012 Jamie Bullock, plugin Copyright 2006-2012 Queen Mary, University of London. ";
 
     string method = "";
 
@@ -179,9 +180,9 @@
 
     if (donor == XTRACT_INIT_MFCC) {
 
-        m_mfccFilters = new float *[m_coeffCount];
+        m_mfccFilters = new double *[m_coeffCount];
         for (size_t i = 0; i < m_coeffCount; ++i) {
-            m_mfccFilters[i] = new float[m_blockSize];
+            m_mfccFilters[i] = new double[m_blockSize];
         }
 
         int error = (int)xtract_init_mfcc(m_blockSize, m_inputSampleRate/2,
@@ -552,16 +553,22 @@
         // Add 2 here to accommodate extra data for spectrum with DC
         2 + (m_outputBinCount > m_blockSize ? m_outputBinCount : m_blockSize);
     if (!m_resultBuffer) {
-        m_resultBuffer = new float[rbs];
+        m_resultBuffer = new double[rbs];
     }
 
     int i;
 
     for (i = 0; i < rbs; ++i) m_resultBuffer[i] = 0.f;
 
-    const float *data = 0;
-    float *fft_temp = 0, *data_temp = 0;
     int N = m_blockSize, M = N >> 1;
+
+    const double *data = 0;
+    double *input_d = new double[N];
+    for (int i = 0; i < N; ++i) {
+        input_d[i] = inputBuffers[0][i];
+    }
+
+    double *fft_temp = 0, *data_temp = 0;
     void *argv = 0;
     bool isSpectral = false;
     xtract_function_descriptor_t *xtFd = xtDescriptor();
@@ -570,22 +577,22 @@
 
     switch (xtFd->data.format) {
 	case XTRACT_AUDIO_SAMPLES:
-	    data = &inputBuffers[0][0];
+	    data = input_d;
 	    break;
 	case XTRACT_SPECTRAL:
 	default:
 	    // All the rest are derived from the  spectrum
 	    // Need same format as would be output by xtract_spectrum
-	    float q = m_inputSampleRate / N;
-	    fft_temp = new float[N];
+	    double q = m_inputSampleRate / N;
+	    fft_temp = new double[N];
 	    for (int n = 1; n < N/2; ++n) {
-		fft_temp[n]   = sqrt(inputBuffers[0][n*2]   * 
-			inputBuffers[0][n*2] + inputBuffers[0][n*2+1] * 
-			inputBuffers[0][n*2+1]) / N;
+		fft_temp[n] = sqrt(input_d[n*2]   * 
+			input_d[n*2] + input_d[n*2+1] * 
+			input_d[n*2+1]) / N;
 		fft_temp[N-n] = (N/2 - n) * q;
 	    }
-	    fft_temp[0]   = fabs(inputBuffers[0][0]) / N;
-	    fft_temp[N/2] = fabs(inputBuffers[0][N]) / N;
+	    fft_temp[0]   = fabs(input_d[0]) / N;
+	    fft_temp[N/2] = fabs(input_d[N]) / N;
 	    data = &fft_temp[0];
 	    isSpectral = true;
 	    break;
@@ -593,13 +600,13 @@
 
     assert(m_outputBinCount > 0);
 
-    float *result = m_resultBuffer;
+    double *result = m_resultBuffer;
 
-    float argf[XTRACT_MAXARGS];
+    double argf[XTRACT_MAXARGS];
     argv = &argf[0];
     argf[0] = 0.f; // handy for some, e.g. lowest_value which has a threshold
 
-    float mean, variance, sd, npartials, nharmonics;
+    double mean, variance, sd, npartials, nharmonics;
 
     bool needSD, needVariance, needMean, needPeaks, 
 	 needBarkCoefficients, needHarmonics, needF0, needSFM, needMax, 
@@ -720,7 +727,7 @@
     // XTRACT_NOISINESS -- npartials, nharmonics.
     // XTRACT_SPECTRUM -- q, spectrum type, dc, normalise
 
-    data_temp = new float[N];
+    data_temp = new double[N];
 
     if (m_xtFeature == XTRACT_ROLLOFF || 
         m_xtFeature == XTRACT_PEAK_SPECTRUM || needPeaks) {
@@ -765,8 +772,7 @@
     }
 
     if (needF0) {
-	xtract_failsafe_f0(&inputBuffers[0][0], N, 
-		(void *)&m_inputSampleRate, result);
+	xtract_failsafe_f0(&input_d[0], N, (void *)&m_inputSampleRate, result);
 	argf[0] = *result;
 	argv = &argf[0];
     }
@@ -866,7 +872,7 @@
             bool good = true;
 
             for (size_t n = 0; n < m_outputDescriptors[output].binCount; ++n) {
-                float value = m_resultBuffer[index + m_lowestCoef];
+                double value = m_resultBuffer[index + m_lowestCoef];
                 if (isnan(value) || isinf(value)) {
                     good = false;
                     index += (m_outputDescriptors[output].binCount - n);
@@ -883,6 +889,7 @@
 //done:
     delete[] fft_temp;
     delete[] data_temp;
+    delete[] input_d;
 
 //    cerr << "XTractPlugin::process returning" << endl;
 
--- a/plugins/XTractPlugin.h	Thu Jul 05 19:43:42 2012 +0100
+++ b/plugins/XTractPlugin.h	Wed Jun 25 13:59:32 2014 +0100
@@ -63,26 +63,26 @@
     mutable OutputList m_outputDescriptors;
     void setupOutputDescriptors() const;
 
-    bool processSPF0(const float *data);
+    bool processSPF0(const double *data);
 
     const unsigned int m_xtFeature;
     size_t m_channels;
     size_t m_stepSize;
     size_t m_blockSize;
 
-    float *m_resultBuffer;
+    double *m_resultBuffer;
 
-    float m_peakThreshold;
-    float m_rolloffThreshold;
-    float m_harmonicThreshold;
+    double m_peakThreshold;
+    double m_rolloffThreshold;
+    double m_harmonicThreshold;
 
-    float m_minFreq;
-    float m_maxFreq;
+    double m_minFreq;
+    double m_maxFreq;
 
     int m_coeffCount;
     int m_highestCoef;
     int m_lowestCoef;
-    float **m_mfccFilters;
+    double **m_mfccFilters;
     int m_mfccStyle;
 
     int m_spectrumType;
--- a/svn-commit.tmp	Thu Jul 05 19:43:42 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-
-* Initial import
---This line, and those below, will be ignored--
-
-A    .
--- a/vamp-libxtract.cat	Thu Jul 05 19:43:42 2012 +0100
+++ b/vamp-libxtract.cat	Wed Jun 25 13:59:32 2014 +0100
@@ -35,6 +35,7 @@
 vamp:vamp-libxtract:nonzero_count::Low Level Features
 vamp:vamp-libxtract:f0::Low Level Features
 vamp:vamp-libxtract:failsafe_f0::Low Level Features
+vamp:vamp-libxtract:wavelet_f0::Low Level Features
 vamp:vamp-libxtract:autocorrelation::Low Level Features
 vamp:vamp-libxtract:amdf::Low Level Features
 vamp:vamp-libxtract:asdf::Low Level Features