[feat](trx-rs): add FT2 decoder protocol support

Implement a distinct FT2 protocol path in the decoder stack and align\nits timing with the confirmed FT2 framing used by Decodium.\n\nCo-authored-by: OpenAI Codex <codex@openai.com>

Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
2026-03-14 19:49:05 +01:00
parent d547c45a9c
commit ad6aa6aab4
9 changed files with 116 additions and 46 deletions
+6 -5
View File
@@ -189,8 +189,9 @@ static int ft4_sync_score(const ftx_waterfall_t* wf, const ftx_candidate_t* cand
int ftx_find_candidates(const ftx_waterfall_t* wf, int num_candidates, ftx_candidate_t heap[], int min_score)
{
int (*sync_fun)(const ftx_waterfall_t*, const ftx_candidate_t*) = (wf->protocol == FTX_PROTOCOL_FT4) ? ft4_sync_score : ft8_sync_score;
int num_tones = (wf->protocol == FTX_PROTOCOL_FT4) ? 4 : 8;
int (*sync_fun)(const ftx_waterfall_t*, const ftx_candidate_t*) =
ftx_protocol_uses_ft4_layout(wf->protocol) ? ft4_sync_score : ft8_sync_score;
int num_tones = ftx_protocol_uses_ft4_layout(wf->protocol) ? 4 : 8;
int heap_size = 0;
ftx_candidate_t candidate;
@@ -327,7 +328,7 @@ static void ftx_normalize_logl(float* log174)
bool ftx_decode_candidate(const ftx_waterfall_t* wf, const ftx_candidate_t* cand, int max_iterations, ftx_message_t* message, ftx_decode_status_t* status)
{
float log174[FTX_LDPC_N]; // message bits encoded as likelihood
if (wf->protocol == FTX_PROTOCOL_FT4)
if (ftx_protocol_uses_ft4_layout(wf->protocol))
{
ft4_extract_likelihood(wf, cand, log174);
}
@@ -366,7 +367,7 @@ bool ftx_decode_candidate(const ftx_waterfall_t* wf, const ftx_candidate_t* cand
// Reuse CRC value as a hash for the message (TODO: 14 bits only, should perhaps use full 16 or 32 bits?)
message->hash = status->crc_calculated;
if (wf->protocol == FTX_PROTOCOL_FT4)
if (ftx_protocol_uses_ft4_layout(wf->protocol))
{
// '[..] for FT4 only, in order to avoid transmitting a long string of zeros when sending CQ messages,
// the assembled 77-bit message is bitwise exclusive-ORed with [a] pseudorandom sequence before computing the CRC and FEC parity bits'
@@ -589,4 +590,4 @@ static void pack_bits(const uint8_t bit_array[], int num_bits, uint8_t packed[])
++byte_idx;
}
}
}
}