From b41916aebf945cac1542bdfab58b1c91868955db Mon Sep 17 00:00:00 2001 From: Karlis Goba Date: Tue, 12 Nov 2019 15:36:32 +0200 Subject: [PATCH] Added sync score threshold to speed up decoding with few or no signals --- decode_ft8.cpp | 3 ++- ft8/decode.cpp | 6 ++++-- ft8/decode.h | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/decode_ft8.cpp b/decode_ft8.cpp index 259a098..e147df0 100644 --- a/decode_ft8.cpp +++ b/decode_ft8.cpp @@ -15,6 +15,7 @@ #define LOG_LEVEL LOG_INFO +const int kMin_score = 40; // Minimum sync score threshold for candidates const int kMax_candidates = 120; const int kLDPC_iterations = 25; @@ -277,4 +278,4 @@ int main(int argc, char **argv) { LOG(LOG_INFO, "Decoded %d messages\n", num_decoded); return 0; -} \ No newline at end of file +} diff --git a/ft8/decode.cpp b/ft8/decode.cpp index 42ef2a4..ae6d490 100644 --- a/ft8/decode.cpp +++ b/ft8/decode.cpp @@ -19,7 +19,7 @@ static int get_index(const MagArray *power, int block, int time_sub, int freq_su // Localize top N candidates in frequency and time according to their sync strength (looking at Costas symbols) // We treat and organize the candidate list as a min-heap (empty initially). -int find_sync(const MagArray *power, const uint8_t *sync_map, int num_candidates, Candidate *heap) { +int find_sync(const MagArray *power, const uint8_t *sync_map, int num_candidates, Candidate *heap, int min_score) { int heap_size = 0; int num_alt = power->time_osr * power->freq_osr; @@ -74,6 +74,8 @@ int find_sync(const MagArray *power, const uint8_t *sync_map, int num_candidates } score /= num_symbols; + if (score < min_score) continue; + // If the heap is full AND the current candidate is better than // the worst in the heap, we remove the worst and make space if (heap_size == num_candidates && score > heap[0].score) { @@ -268,4 +270,4 @@ static void decode_multi_symbols(const uint8_t *power, int num_bins, int n_syms, } } -} // namespace \ No newline at end of file +} // namespace diff --git a/ft8/decode.h b/ft8/decode.h index 05f05e6..0894ac6 100644 --- a/ft8/decode.h +++ b/ft8/decode.h @@ -23,11 +23,11 @@ struct Candidate { // Localize top N candidates in frequency and time according to their sync strength (looking at Costas symbols) // We treat and organize the candidate list as a min-heap (empty initially). -int find_sync(const MagArray * power, const uint8_t *sync_map, int num_candidates, Candidate *heap); +int find_sync(const MagArray * power, const uint8_t *sync_map, int num_candidates, Candidate *heap, int min_score = 0); // Compute log likelihood log(p(1) / p(0)) of 174 message bits // for later use in soft-decision LDPC decoding void extract_likelihood(const MagArray *power, const Candidate & cand, const uint8_t *code_map, float *log174); -} \ No newline at end of file +}