|
| bool | js8::aided::redemodEnabled () |
| | Kill switch for decoder-aided re-demodulation.
|
| constexpr bool | js8::aided::isCostasSymbol (int k) |
| | Whether global symbol k is a known Costas pilot.
|
| constexpr int | js8::aided::dataSymbolIndex (int j) |
| void | js8::aided::codewordToTones (std::array< int8_t, kCodeBits > const &cw, CostasTones const &costas, std::array< int, kTotalSymbols > &tones) |
| | Convert a tentative 174-bit codeword into 79 expected tones.
|
| ConfidenceSummary | js8::aided::tentativeConfidences (std::array< float, kCodeBits > const &llr) |
| | Confidence weight per tentative data symbol from its 3 bit LLRs.
|
| void | js8::aided::buildSymbolWeights (ConfidenceSummary const &conf, std::array< float, kTotalSymbols > &weights) |
| | Expand 58 data confidences to 79 per-symbol weights.
|
| void | js8::aided::buildCostasWeights (std::array< float, kTotalSymbols > &weights) |
| | Expand confidences to Costas-only weights (1.0 on pilots, else 0).
|
| float | js8::aided::aidedFrameXdt (float xdt2, int aidedDt, float dtSecondsPerSample) |
| | Scalar frame timing seed from an aided timing delta.
|
| MidpointResidual | js8::aided::aidedPhysicalResidualAtMidpoint (double aidedDf, double aidedDd, std::array< SymbolBaseline, kTotalSymbols > const &baselines, int window, double sampleRateHz, std::array< float, kTotalSymbols > const &weights) |
| | Physical carrier residual at the frame midpoint.
|
| bool | js8::aided::symbolBoundsValid (std::array< SymbolBaseline, kTotalSymbols > const &baselines, int window, int numSamples, int maxAbsDelta) |
| | Validate candidate sample bounds for the aided search/extraction.
|
| bool | js8::aided::replayTrackerCorrection (std::complex< float > *window, int count, double trackerHz, double sampleRateHz) |
| | Replay one symbol's recorded FrequencyTracker correction.
|
| double | js8::aided::contrastEight (double expectedPower, double const *otherPowers) |
| | Tone-CONTRAST metric from the actual 8 JS8 FSK bins.
|
| Refinement | js8::aided::refineSync (std::complex< float > const *samples, int numSamples, std::array< SymbolBaseline, kTotalSymbols > const &baselines, int window, double sampleRateHz, std::array< int, kTotalSymbols > const &tones, std::array< float, kTotalSymbols > const &weights, std::function< bool()> const &shouldCancel={}) |
| | Bounded local sync refinement around the first-pass solution.
|
|
bool | js8::aided::refinementAccepted (Refinement const &r) |
| | Safety gate: accept the refined sync only when it is finite, off the search boundary, and measurably better than baseline (>= 0.5% gain, or any positive metric over a degenerate zero baseline).
|
| double | js8::aided::metricGainDb (double refined, double baseline) |
| template<std::size_t NBlades> |
| double | js8::aided::llrNorm (std::array< float, NBlades > const &llr) |
Decoder-aided re-demodulation helpers for JS8 near-miss rescue.
When normal decoding fails but LDPC gets CLOSE (small syndrome), the best tentative 174-bit codeword is used as a waveform hypothesis: its 58 data tones plus the 21 known Costas tones refine timing/residual-frequency/drift against the candidate's actual received samples. The refined sync then drives ONE fresh 8-tone re-demodulation producing new LLRs for a final LDPC attempt. CRC remains the only acceptance gate.
This header holds the pure, deterministic algorithmic core (no Qt, no FFTW, no decoder state) so it can be unit-tested standalone:
- tentative codeword -> 79 expected tones (exact decoder bit/tone mapping)
- per-data-symbol confidence weights from LLR magnitudes
- bounded local sync refinement with a tone-CONTRAST metric
- baseline comparison / safety gate
Bit/tone mapping authority (derived from the decoder, not memory):
- Decoder LLR formation (whitening_processor.h): data symbol j emits llr[3j] (tone bit 2, value 4), llr[3j+1] (tone bit 1, value 2), llr[3j+2] (tone bit 0, value 1); llr > 0 means bit 1.
- bpdecode174 (JS8.cpp): hard slice cw[i] = zn[i] > 0 ? 1 : 0, positions preserved, so tone(j) = 4*cw[3j] + 2*cw[3j+1] + cw[3j+2].
- Encoder (JS8::encode, JS8.cpp): parity words -> tones+7 (data symbols j=0..28, globals 7..35), message words -> tones+43 (j=29..57, globals 43..71); MSB-first accumulation matches the tone formula above.
- Symbol layout (JS8.cpp demod loop): Costas globals 0-6, 36-42, 72-78; data globals 7-35 (j=0..28) and 43-71 (j=29..57).
| MidpointResidual js8::aided::aidedPhysicalResidualAtMidpoint |
( |
double | aidedDf, |
|
|
double | aidedDd, |
|
|
std::array< SymbolBaseline, kTotalSymbols > const & | baselines, |
|
|
int | window, |
|
|
double | sampleRateHz, |
|
|
std::array< float, kTotalSymbols > const & | weights ) |
|
inline |
Physical carrier residual at the frame midpoint.
Sign derivation from the decoder (do not change without re-deriving):
- coarse correction multiplies cd0 by exp(-j*2*pi*delfbest*t), then f1 += delfbest, so f1 is the physical center for zero cd0 residual;
- FrequencyTracker::apply() (and replayTrackerCorrection()) multiplies by exp(+j*2*pi*trackerHz*t_local), i.e. it ADDS trackerHz to the apparent residual, so a perfectly correcting tracker records trackerHz ~= -physicalResidualHz;
- the aided refinement derotates by exp(-j*(2*pi*aidedDf*t+pi*aidedDd*t^2)) AFTER replaying the tracker correction, and the search centers the expected-tone peak, so at the optimum physicalResidual(t) ~= aidedDf + aidedDd*t - trackerHz(t).
The scalar seed is f1 + residual(midpoint). Per-symbol residuals r_k = aidedDf + aidedDd*t_k - trackerHz[k] (t_k = window-center absolute time) are combined with a weighted linear fit evaluated at the frame midpoint (weighted mean fallback); drift therefore enters through aidedDd*t_mid and is never discarded. Weights are caller-provided (Costas preferred for SIC seeding). Finite-input guarded, deterministic, no Qt.
| Refinement js8::aided::refineSync |
( |
std::complex< float > const * | samples, |
|
|
int | numSamples, |
|
|
std::array< SymbolBaseline, kTotalSymbols > const & | baselines, |
|
|
int | window, |
|
|
double | sampleRateHz, |
|
|
std::array< int, kTotalSymbols > const & | tones, |
|
|
std::array< float, kTotalSymbols > const & | weights, |
|
|
std::function< bool()> const & | shouldCancel = {} ) |
|
inline |
Bounded local sync refinement around the first-pass solution.
The baseline (delta 0,0,0) replays the ACTUAL first-pass per-symbol extraction: recorded window starts plus the recorded FrequencyTracker correction for each symbol. That correction depends on timing, not on the residual frequency/drift hypothesis, so each used (timing, symbol) window is replayed once and reused throughout the grid. Search hypotheses are refinements RELATIVE to that baseline (trial start = recorded start + deltaSamples, recorded tracker rotation followed by the candidate freq/drift derotation), so the gate can never claim a fake gain by rediscovering a correction the first pass already applied.
Each hypothesis scores every useful symbol with the tone contrast of the actual 8 JS8 FSK bins: the window is derotated once, all 8 bins are computed together with a tiny direct DFT (no FFTW plan per hypothesis), and contrast = P[expected] - mean(P[other 7]). Unused FFT bins never enter the estimate. Ties keep the earliest (baseline wins all ties: grid entries must STRICTLY beat it). Any invalid input yields searched=false rather than partial garbage.
| ConfidenceSummary js8::aided::tentativeConfidences |
( |
std::array< float, kCodeBits > const & | llr | ) |
|
|
inline |
Confidence weight per tentative data symbol from its 3 bit LLRs.
weight = clamp((minAbs - floor) / (scale - floor), 0, 1), i.e. zero below kConfidenceFloor, ramping to 1.0 at min|LLR| = kConfidenceScale. Non-finite LLRs force zero weight so NaN/Inf can never steer the fit. One huge LLR cannot dominate: each symbol contributes at most 1.0.