changeset 94:13be4158251d refactors

Ah, it's subtler than that -- we have to handle the case where this is not the first matcher as well, if we're to get precisely the same results
author Chris Cannam
date Thu, 27 Nov 2014 16:05:19 +0000
parents 8b33cb568b10
children bc3b60d65a5f
files src/Matcher.cpp
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/Matcher.cpp	Thu Nov 27 15:56:12 2014 +0000
+++ b/src/Matcher.cpp	Thu Nov 27 16:05:19 2014 +0000
@@ -341,9 +341,14 @@
             // 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) {
+            // (AdvanceThis), cost1 (AdvanceOther) if we are the first
+            // matcher; and cost3 (AdvanceBoth), cost1 (AdvanceOther),
+            // cost2 (AdvanceThis) if we are the second matcher.  That
+            // is, we always prioritise the diagonal followed by the
+            // first matcher.
+
+            if (( m_firstPM && (cost1 <  cost2)) ||
+                (!m_firstPM && (cost1 <= cost2))) {
                 if (cost3 <= cost1) {
                     updateValue(m_frameCount, index, AdvanceBoth,
                                 min3, distance);