diff src/Matcher.cpp @ 93:8b33cb568b10 refactors

Fix inconsistency (with Finder) in choice of preference where two costs come out equal
author Chris Cannam
date Thu, 27 Nov 2014 15:56:12 +0000
parents 35e50f28720f
children 13be4158251d
line wrap: on
line diff
--- a/src/Matcher.cpp	Thu Nov 27 15:29:43 2014 +0000
+++ b/src/Matcher.cpp	Thu Nov 27 15:56:12 2014 +0000
@@ -337,8 +337,13 @@
             double cost1 = min1 + distance;
             double cost2 = min2 + distance;
             double cost3 = min3 + diagDistance;
+
+            // Choosing is easy if there is a strict cheapest of the
+            // three. If two or more share the lowest cost, we choose
+            // in order of preference: cost3 (AdvanceBoth), cost2
+            // (AdvanceThis), cost1 (AdvanceOther).
             
-            if (cost1 <= cost2) {
+            if (cost1 < cost2) {
                 if (cost3 <= cost1) {
                     updateValue(m_frameCount, index, AdvanceBoth,
                                 min3, distance);