changeset 88:97b77e7cb94c timing

Store templates as doubles instead of floats
author Chris Cannam
date Tue, 06 May 2014 12:49:49 +0100
parents a44c52983ec2
children a6e136aaa202
files data/include/templates.h src/EM.cpp src/EM.h testdata/timing/results.txt yeti/scratch/generateTemplatesC.yeti
diffstat 5 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/data/include/templates.h	Tue May 06 12:45:09 2014 +0100
+++ b/data/include/templates.h	Tue May 06 12:49:49 2014 +0100
@@ -15,7 +15,7 @@
     const char *name;
     int lowest;
     int highest;
-    float data[SILVET_TEMPLATE_NOTE_COUNT][SILVET_TEMPLATE_SIZE];
+    double data[SILVET_TEMPLATE_NOTE_COUNT][SILVET_TEMPLATE_SIZE];
 } silvet_template_t;
 
 static int silvet_templates_lowest_note = 15;
--- a/src/EM.cpp	Tue May 06 12:45:09 2014 +0100
+++ b/src/EM.cpp	Tue May 06 12:49:49 2014 +0100
@@ -122,7 +122,7 @@
     maximisation(column);
 }
 
-const float *
+const double *
 EM::templateFor(int instrument, int note, int shift)
 {
     return silvet_templates[instrument].data[note] + shift;
@@ -142,7 +142,7 @@
             const double pitch = m_pitches[n];
             const double source = m_sources[i][n];
             for (int f = 0; f < m_shiftCount; ++f) {
-                const float *w = templateFor(i, n, f);
+                const double *w = templateFor(i, n, f);
                 const double shift = m_shifts[f][n];
                 const double factor = pitch * source * shift;
                 for (int j = 0; j < m_binCount; ++j) {
@@ -179,7 +179,7 @@
                 const double source = m_sources[i][n];
                 newSources[i][n] = epsilon;
 
-                const float *w = templateFor(i, n, f);
+                const double *w = templateFor(i, n, f);
                 const double factor = pitch * source * shift;
 
                 if (n >= m_lowestPitch && n <= m_highestPitch) {
--- a/src/EM.h	Tue May 06 12:45:09 2014 +0100
+++ b/src/EM.h	Tue May 06 12:49:49 2014 +0100
@@ -63,7 +63,7 @@
     void expectation(const V &column);
     void maximisation(const V &column);
 
-    const float *templateFor(int instrument, int note, int shift);
+    const double *templateFor(int instrument, int note, int shift);
     void rangeFor(int instrument, int &minPitch, int &maxPitch);
     bool inRange(int instrument, int pitch);
 };
--- a/testdata/timing/results.txt	Tue May 06 12:45:09 2014 +0100
+++ b/testdata/timing/results.txt	Tue May 06 12:49:49 2014 +0100
@@ -116,3 +116,4 @@
 real	1m44.767s
 user	1m44.490s
 sys	0m0.190s
+
--- a/yeti/scratch/generateTemplatesC.yeti	Tue May 06 12:45:09 2014 +0100
+++ b/yeti/scratch/generateTemplatesC.yeti	Tue May 06 12:49:49 2014 +0100
@@ -106,7 +106,7 @@
         "    const char *name;",
         "    int lowest;",
         "    int highest;",
-        "    float data[SILVET_TEMPLATE_NOTE_COUNT][SILVET_TEMPLATE_SIZE];",
+        "    double data[SILVET_TEMPLATE_NOTE_COUNT][SILVET_TEMPLATE_SIZE];",
         "} silvet_template_t;",
         "",
         "static int silvet_templates_lowest_note = \(overallLowest);",