Commit 23b48dc6 authored by Stefan Westerfeld's avatar Stefan Westerfeld

Improve performance for speed detection bits compare.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent c6845081
......@@ -282,11 +282,18 @@ SpeedSync::compare_bits (vector<CmpState>& cmp_states, double relative_speed)
for (size_t mi = 0; mi < sync_bits.size(); mi++)
{
for (auto& cs : cmp_states)
auto start = std::lower_bound (cmp_states.begin(), cmp_states.end(), 0,
[&] (auto& cs, auto idx)
{
int index = (cs.offset + OFFSET + sync_bits[mi].frame * steps_per_frame) * relative_speed_inv + 0.5;
if (index >= 0)
return index < idx;
});
for (auto it = start; it != cmp_states.end(); it++)
{
CmpState& cs = *it;
int index = (cs.offset + OFFSET + sync_bits[mi].frame * steps_per_frame) * relative_speed_inv + 0.5;
if (index >= sync_matrix.rows())
break;
......@@ -305,7 +312,6 @@ SpeedSync::compare_bits (vector<CmpState>& cmp_states, double relative_speed)
bv.count++;
}
}
}
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment