Commit fd2870f7 authored by Stefan Westerfeld's avatar Stefan Westerfeld

Refactor n-best sync search step.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 8545a069
......@@ -415,6 +415,13 @@ private:
sync_scores = selected_scores;
}
void
sync_select_n_best (vector<Score>& sync_scores, size_t n)
{
std::sort (sync_scores.begin(), sync_scores.end(), [](Score& s1, Score& s2) { return s1.quality > s2.quality; });
if (sync_scores.size() > n)
sync_scores.resize (n);
}
void
search_refine (const WavData& wav_data, Mode mode, vector<Score>& sync_scores)
{
vector<float> fft_db;
......@@ -514,15 +521,10 @@ public:
vector<Score> sync_scores;
sync_scores = search_approx (wav_data, mode);
sync_select_by_threshold (sync_scores);
sync_select_by_threshold (sync_scores);
if (mode == Mode::CLIP)
{
/* n-best-search */
std::sort (sync_scores.begin(), sync_scores.end(), [](Score& s1, Score& s2) { return s1.quality > s2.quality; });
if (sync_scores.size() > 5)
sync_scores.resize (5);
}
sync_select_n_best (sync_scores, 5);
search_refine (wav_data, mode, sync_scores);
......
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