diff viterbi.cpp @ 44:109d3b2c7105 matthiasm-plugin

regarding the chord estimation:\n * tweaked chord templates\n * that means that the original method also changed
author matthiasm
date Mon, 25 Oct 2010 01:58:37 +0900
parents 131801714118
children b6cddb109482
line wrap: on
line diff
--- a/viterbi.cpp	Mon Oct 25 00:52:39 2010 +0900
+++ b/viterbi.cpp	Mon Oct 25 01:58:37 2010 +0900
@@ -39,11 +39,13 @@
         for (int jState = 0; jState < nState; ++jState) {            
             int bestState = nState - 1;
             double bestValue = 0;
-            for (int iState = 0; iState < nState; ++iState) {
-                double currentValue = delta[iFrame-1][iState] * trans[iState][jState];
-                if (currentValue > bestValue) {
-                    bestValue = currentValue;
-                    bestState = iState;
+            if (obs[iFrame][jState] > 0) {
+                for (int iState = 0; iState < nState; ++iState) {
+                    double currentValue = delta[iFrame-1][iState] * trans[iState][jState];
+                    if (currentValue > bestValue) {
+                        bestValue = currentValue;
+                        bestState = iState;
+                    }
                 }
             }
             // cerr << bestState <<" ::: " << bestValue << endl ;