From 6b7d976ab8835854ed38fd1d832dcf26e98c8a9f Mon Sep 17 00:00:00 2001 From: Raymond Wright Date: Thu, 26 Nov 2020 05:34:18 +0000 Subject: [PATCH] Skip some impossible act ends in optimiser --- src/optimiser.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/optimiser.cpp b/src/optimiser.cpp index d68a64af..526d74f6 100644 --- a/src/optimiser.cpp +++ b/src/optimiser.cpp @@ -164,8 +164,8 @@ Optimiser::try_previous_best_subpaths(CacheKey key, const Cache& cache, // point. class PointPtrRangeSet { private: - const PointPtr m_start; - const PointPtr m_end; + PointPtr m_start; + PointPtr m_end; PointPtr m_min_absent_ptr; std::vector m_abnormal_elements; @@ -230,6 +230,7 @@ Optimiser::CacheValue Optimiser::find_best_subpaths(CacheKey key, Cache& cache, std::vector> acts; PointPtrRangeSet attained_act_ends {key.point, m_song->points().cend()}; + auto lower_bound_set = false; auto best_score_boost = 0; for (auto p = key.point; p < m_song->points().cend(); ++p) { @@ -261,6 +262,20 @@ Optimiser::CacheValue Optimiser::find_best_subpaths(CacheKey key, Cache& cache, } break; } + // This skips some points that are too early to be an act end for the + // earliest possible activation. + if (!lower_bound_set) { + const Measure act_length {8.0 * std::max(sp_bar.min(), 0.5)}; + const auto earliest_act_end = starting_pos.measure + act_length; + auto earliest_pt_end = std::find_if_not( + std::next(p), m_song->points().cend(), [&](const auto& pt) { + return pt.hit_window_end.measure <= earliest_act_end; + }); + --earliest_pt_end; + attained_act_ends + = PointPtrRangeSet {earliest_pt_end, m_song->points().cend()}; + lower_bound_set = true; + } for (auto q = attained_act_ends.lowest_absent_element(); q < m_song->points().cend();) { if (attained_act_ends.contains(q)) {