# HG changeset patch # User Chris Cannam # Date 1399376989 -3600 # Node ID 97b77e7cb94c2c7f0f4d4174aee444fef2f5da24 # Parent a44c52983ec2940c7b79fab57e3e8905ee30a5d0 Store templates as doubles instead of floats diff -r a44c52983ec2 -r 97b77e7cb94c data/include/templates.h --- 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; diff -r a44c52983ec2 -r 97b77e7cb94c src/EM.cpp --- 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) { diff -r a44c52983ec2 -r 97b77e7cb94c src/EM.h --- 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); }; diff -r a44c52983ec2 -r 97b77e7cb94c testdata/timing/results.txt --- 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 + diff -r a44c52983ec2 -r 97b77e7cb94c yeti/scratch/generateTemplatesC.yeti --- 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);",