Commit e5a9efef authored by Stefan Westerfeld's avatar Stefan Westerfeld

Avoid lrint() in speed detection (rounding doesn't improve results).

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent d42a8b0b
speed detection possible improvements: speed detection possible improvements:
- refine with 128 sync step instead of 256? - refine with 128 sync step instead of 256?
- grid size adjustment - grid size adjustment
- remove lrint?
- detect silence instead of total volume? - detect silence instead of total volume?
- split big region into two smaller ones? - split big region into two smaller ones?
- connected search on even smaller regions? - connected search on even smaller regions?
......
...@@ -302,14 +302,12 @@ SpeedSync::compare_bits (BitValue *bit_values, double relative_speed, int *start ...@@ -302,14 +302,12 @@ SpeedSync::compare_bits (BitValue *bit_values, double relative_speed, int *start
for (auto si = sync_bits.begin() + mi; si != sync_bits.end(); si++) for (auto si = sync_bits.begin() + mi; si != sync_bits.end(); si++)
{ {
int index = offset + si->frame * steps_per_frame; int index = (offset + si->frame * steps_per_frame) * relative_speed_inv;
if (index >= sync_matrix.rows())
const int index1 = lrint (index * relative_speed_inv);
if (index1 >= sync_matrix.rows())
return; return;
auto& bv = bit_values[si->bit]; auto& bv = bit_values[si->bit];
auto mags = sync_matrix (index1, mi); auto mags = sync_matrix (index, mi);
if (B2) if (B2)
{ {
bv.umag += mags.dmag; bv.umag += mags.dmag;
......
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