Commit 035b27f1 authored by Stefan Westerfeld's avatar Stefan Westerfeld

Simplify crash

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 75556db4
......@@ -215,13 +215,6 @@ SpeedSync::prepare_mags (const SpeedScanParams& scan_params)
const int sub_frame_size = Params::frame_size / 2;
const int sub_sync_search_step = Params::sync_search_step / 2;
vector<float> window = FFTAnalyzer::gen_normalized_window (sub_frame_size);
FFTProcessor fft_processor (sub_frame_size);
float *in = fft_processor.in();
float *out = fft_processor.out();
/* set mag matrix size */
int n_sync_rows = 0;
int n_sync_cols = sync_bits.size();
......@@ -229,42 +222,17 @@ SpeedSync::prepare_mags (const SpeedScanParams& scan_params)
n_sync_rows++;
sync_matrix.resize (n_sync_rows, n_sync_cols);
size_t pos = 0;
int row = 0;
while (pos + sub_frame_size < in_data_sub.n_frames())
for (int row = 0; row < n_sync_rows; row++)
{
int col = 0;
const std::vector<float>& samples = in_data_sub.samples();
vector<float> fft_out_db;
for (int ch = 0; ch < in_data_sub.n_channels(); ch++)
{
for (int i = 0; i < sub_frame_size; i++)
{
in[i] = samples[ch + (pos + i) * in_data_sub.n_channels()] * window[i];
}
fft_processor.fft();
for (int i = Params::min_band; i <= Params::max_band; i++)
{
const float min_db = -96;
fft_out_db.push_back (db_from_complex (out[i * 2], out[i * 2 + 1], min_db));
}
}
for (const auto& sync_bit : sync_bits)
for (int col = 0; col < n_sync_cols; col++)
{
float umag = 1, dmag = 1;
sync_matrix (row, col++) = MagMatrix::Mags {umag, dmag};
sync_matrix (row, col) = MagMatrix::Mags {umag, dmag};
assert (umag != 0);
assert (dmag != 0);
}
assert (col == n_sync_cols);
row++;
pos += sub_sync_search_step;
}
assert (row == n_sync_rows);
}
template<bool B2> 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