From e64c4076289669717efca4430bce0e6fd578ee6a Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 8 Mar 2026 23:33:25 +0100 Subject: [PATCH] FT4 demod: added a subtract_edge_symbols parameter to take the ramp up/down symbol (for completeness but no significant improvement) --- ft8/ft4.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++ ft8/ft4.h | 4 ++++ sdrbench/test_ft4.cpp | 5 +++-- 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/ft8/ft4.cpp b/ft8/ft4.cpp index bc31ed504..d3485be2a 100644 --- a/ft8/ft4.cpp +++ b/ft8/ft4.cpp @@ -3443,6 +3443,29 @@ void FT4::subtract( ramp = 1; } + if (params.subtract_edge_symbols) + { + int sym = bin0 + re103[0]; + float phase = phases[0]; + float amp = amps[0]; + float hz = sym * bin_hz; + float dtheta = 2 * M_PI / (rate_ / hz); // advance per sample + + for (int jj = 0; jj < ramp; jj++) + { + int iii = off0 - ramp + jj; + + if (iii < 0 || iii >= (int)moved.size()) { + continue; + } + + float theta = phase + (jj - ramp) * dtheta; + float x = amp * cos(theta); + x *= jj / (float)ramp; + moved[iii] -= x; + } + } + // initial ramp part of first symbol. { int sym = bin0 + re103[0]; @@ -3550,6 +3573,29 @@ void FT4::subtract( } } + if (params.subtract_edge_symbols) + { + int sym = bin0 + re103[102]; + float phase = phases[102]; + float amp = amps[102]; + float hz = sym * bin_hz; + float dtheta = 2 * M_PI / (rate_ / hz); // advance per sample + + for (int jj = 0; jj < ramp; jj++) + { + int iii = off0 + block * 103 + jj; + + if (iii < 0 || iii >= (int)moved.size()) { + continue; + } + + float theta = phase + (block + jj) * dtheta; + float x = amp * cos(theta); + x *= 1.0 - (jj / (float)ramp); + moved[iii] -= x; + } + } + nsamples_ = fftEngine_->hilbert_shift(moved, -diff0, -diff1, rate_); } diff --git a/ft8/ft4.h b/ft8/ft4.h index 5691bcea2..0397b0931 100644 --- a/ft8/ft4.h +++ b/ft8/ft4.h @@ -86,6 +86,7 @@ public: int second_count; int soft_phase_win; float subtract_ramp; + int subtract_edge_symbols; // model one extra tapered symbol at frame start/end during subtraction (does not yield significant improvement) int soft_ones; int soft_pairs; int soft_triples; @@ -155,6 +156,7 @@ public: second_count = 3; soft_phase_win = 2; subtract_ramp = 0.11; + subtract_edge_symbols = 0; soft_ones = 2; soft_pairs = 1; soft_triples = 1; @@ -180,6 +182,7 @@ public: int use_osd; int osd_depth; int osd_ldpc_thresh; + int subtract_edge_symbols; int max_candidates; FT4ParamsLight() : @@ -188,6 +191,7 @@ public: use_osd(1), osd_depth(0), osd_ldpc_thresh(70), + subtract_edge_symbols(0), max_candidates(96) {} }; diff --git a/sdrbench/test_ft4.cpp b/sdrbench/test_ft4.cpp index 8f5202523..4d6cd4603 100644 --- a/sdrbench/test_ft4.cpp +++ b/sdrbench/test_ft4.cpp @@ -219,8 +219,9 @@ void MainBench::testFT4(const QString& wavFile, const QString& argsStr) FT8::FT4Decoder decoder; decoder.getParams().nthreads = nthreads; decoder.getParams().use_osd = 1; - decoder.getParams().osd_depth = 6; - decoder.getParams().osd_ldpc_thresh = 77; // Require at least 77/83 correct LDPC bits before OSD + decoder.getParams().osd_depth = 3; // OSD candidates must be in top 3 to be considered + decoder.getParams().osd_ldpc_thresh = 75; // Require at least 75/83 correct LDPC bits before OSD + decoder.getParams().subtract_edge_symbols = 0; // Experimental: model pre/post ramp symbols in subtraction decoder.entry( samples.data(),