JS8Call-Improved master
Loading...
Searching...
No Matches
js8 Namespace Reference

JS8 namespace for Kalman filter-based trackers. More...

Namespaces

namespace  bp
 Numerical limits for JS8 belief propagation.

Classes

struct  CoherentPilot
struct  CoherentDataSymbol
struct  CarrierPhaseFit
 Result of the low-order carrier-phase fit over pilot symbols. More...
struct  CoherentLikelihoodTelemetry
 Debug/benchmark telemetry for one candidate frame. More...
struct  CoherentToneResult
struct  CoherentBlend
class  FrequencyTracker
 Lightweight PLL/Kalman-style tracker for residual frequency offset. More...
class  TimingTracker
class  OptionalWorkSignal
class  OptionalWorkBudget
struct  SicRefinementResult
class  SoftCombiner
 Cache and combine repeated LLR frames for the same decode candidate. More...
class  WhiteningProcessor
 Compute per-tone/symbol noise medians and whiten LLRs for a JS8 frame. More...

Enumerations

enum class  OptionalStage : std::size_t { Deep , Rescue , Aided , Count }

Functions

double effectiveSymbolTimeSeconds (double baseTimeSeconds, double shiftSamples, double sampleRateHz)
std::complex< double > normalizeFrequencyTrackerPhase (std::complex< double > bin, double trackerHz, double sampleRateHz, int windowSamples)
std::complex< double > normalizeTimingPhase (std::complex< double > bin, int tone, double shiftSamples, int windowSamples)
CarrierPhaseFit fitCarrierPhase (std::vector< CoherentPilot > const &pilots, int minPilots, double minSpanSeconds, int windowSamples, double sampleRateHz)
double coherentBlendWeight (CarrierPhaseFit const &fit)
double predictCarrierPhase (CarrierPhaseFit const &fit, double timeSeconds)
 Predicted carrier phase at an absolute symbol-start time.
template<std::size_t Tones>
bool blendToneScores (std::array< float, Tones > const &noncoherent, std::array< float, Tones > const &coherent, float alpha, std::array< float, Tones > &out)
template<std::size_t Tones>
std::optional< double > topTwoMargin (std::array< float, Tones > const &scores)
 Margin between the largest and second-largest tone scores, if well-defined.
CoherentToneResult computeCoherentToneScores (std::vector< CoherentPilot > const &pilots, std::vector< CoherentDataSymbol > const &data, int minPilots, double minSpanSeconds, int windowSamples, double sampleRateHz)
float llrGlobalScale ()
float llrErasureThreshold ()
 Read configured LLR erasure threshold.
bool ldpcFeedbackEnabled ()
 Whether LDPC feedback is enabled.
int ldpcFeedbackMaxPasses ()
 Maximum LDPC feedback passes to attempt.
template<std::size_t N>
void refineLlrsWithLdpcFeedback (std::array< float, N > const &llrIn, std::array< int8_t, N > const &cw, float erasureThreshold, std::array< float, N > &llrOut, int &confidentCount, int &uncertainCount)
 Refine LLRs using a decoded LDPC codeword as feedback.
std::vector< std::complex< float > > applySicTimingWarp (std::vector< std::complex< float > > const &reference, double interceptSamples, double slopeSamplesPerSecond, double sampleRate)
double wrapSicPhase (double angle)
bool solveSicLinearSystem3 (double const normal[3][3], double const right[3], double solution[3])
int sicStartSample (float seconds)
 Converts SIC timing to the nearest 12-kHz sample for fit and subtraction.
template<int SymbolSamples, std::size_t Symbols, typename Samples, typename Tones>
SicRefinementResult refineSicReference (std::vector< std::complex< float > > nominal, Samples const &samples, Tones const &tones, float const dt, bool const allowTimingDrift)
 Refines a decoded reference while guarding its matched correlation.

Variables

constexpr float LLR_ERASURE_THRESHOLD_DEFAULT = 0.0f
 LDPC erasure threshold config and feedback refinement helpers.
constexpr float LLR_FEEDBACK_CONFIDENT_MIN = 3.0f
constexpr float LLR_FEEDBACK_UNCERTAIN_MAX = 1.0f
constexpr float LLR_FEEDBACK_CONFIDENT_BOOST = 1.2f
constexpr float LLR_FEEDBACK_UNCERTAIN_SHRINK = 0.5f
constexpr float LLR_FEEDBACK_MAX_MAG = 6.0f
constexpr int LDPC_FEEDBACK_MAX_PASSES_DEFAULT = 8

Detailed Description

JS8 namespace for Kalman filter-based trackers.

Function Documentation

◆ blendToneScores()

template<std::size_t Tones>
bool js8::blendToneScores ( std::array< float, Tones > const & noncoherent,
std::array< float, Tones > const & coherent,
float alpha,
std::array< float, Tones > & out )

Blend physical noncoherent and coherent tone scores for one symbol.

noncoherent[i] must hold the decoder's 0.5*power*invSigma2 values and coherent[i] the (A*projection - 0.5*A*A)*invSigma2 values sharing the same invSigma2. With alpha <= 0 (or any invalid input) this copies noncoherent exactly, so the fallback path is bit-identical to the legacy likelihood path. Symbols are never renormalized: reliability information in the score magnitudes is preserved.

Here is the caller graph for this function:

◆ coherentBlendWeight()

double js8::coherentBlendWeight ( CarrierPhaseFit const & fit)
inline

Blend weight in [0,1] from pilot phase-fit quality.

Full weight below the good RMS threshold, zero above the poor threshold, and a simple linear ramp between them. Returns exactly 0 whenever the fit is untrusted or non-finite.

◆ effectiveSymbolTimeSeconds()

double js8::effectiveSymbolTimeSeconds ( double baseTimeSeconds,
double shiftSamples,
double sampleRateHz )
inline

Effective carrier-model timestamp for an extracted symbol.

The carrier trajectory must be evaluated where the FFT window actually starts, not at the nominal symbol boundary. Timing-dependent FSK phase is handled separately by normalizeTimingPhase(), so adding the displacement here does not double-count it.

Here is the caller graph for this function:

◆ fitCarrierPhase()

CarrierPhaseFit js8::fitCarrierPhase ( std::vector< CoherentPilot > const & pilots,
int minPilots,
double minSpanSeconds,
int windowSamples,
double sampleRateHz )
inline

Fit the carrier-phase model to pilot observations.

Pilot bins are first normalized into the nominal phase frame (tracker and timing corrections above). Adjacent same-block phase differences then give a closed-form frequency/drift seed, followed by one absolute-phase refinement pass. Cost is O(pilots): a few dozen trig evaluations, no grid.

Parameters
pilotsKnown-tone pilot observations (complex bin + metadata).
minPilotsMinimum valid pilots required before trusting the fit.
minSpanSecondsMinimum time span across valid pilots.
windowSamplesDecoder symbol FFT length (Mode::NDOWNSPS).
sampleRateHzDecoder downsampled rate (post-downsample Hz).
Returns
Fit result; fitted is false on any degenerate/ambiguous input.
Here is the call graph for this function:

◆ ldpcFeedbackEnabled()

bool js8::ldpcFeedbackEnabled ( )
inline

Whether LDPC feedback is enabled.

The JS8_LDPC_FEEDBACK environment variable may be set to 0 to explicitly disable feedback. If the variable is not present or cannot be parsed as an integer, feedback is enabled by default.

Returns
true when LDPC feedback is enabled, otherwise false.

◆ ldpcFeedbackMaxPasses()

int js8::ldpcFeedbackMaxPasses ( )
inline

Maximum LDPC feedback passes to attempt.

Reads JS8_LDPC_MAX_PASSES and clamps the value to the range [1, LDPC_FEEDBACK_MAX_PASSES_DEFAULT]. Returns a sensible default when the variable is not provided or invalid.

Returns
Number of feedback passes to attempt.

◆ llrErasureThreshold()

float js8::llrErasureThreshold ( )
inline

Read configured LLR erasure threshold.

Reads the JS8_LLR_ERASURE_THRESH environment variable (if present) and returns a positive finite threshold. If the environment variable is missing, invalid, or the JS8_DISABLE_ERASURE_THRESHOLDING variable is set, this function returns 0.0f to indicate erasure thresholding is disabled.

Returns
Positive erasure threshold, or 0.0f if disabled/invalid.

◆ llrGlobalScale()

float js8::llrGlobalScale ( )
inline

Fixed LLR calibration shared across all frames (one means no adjustment).

◆ normalizeFrequencyTrackerPhase()

std::complex< double > js8::normalizeFrequencyTrackerPhase ( std::complex< double > bin,
double trackerHz,
double sampleRateHz,
int windowSamples )
inline

Remove the deterministic bulk phase of one FrequencyTracker::apply() call.

apply() multiplies window sample n by wstep^(n+1) with wstep = exp(j*2*pi*trackerHz/sampleRateHz) and resets every symbol. For a bin-centered tone that contributes exactly exp(j*dphi*(windowSamples+1)/2) to the matched FFT bin, so dividing it out leaves the physical carrier trajectory plus only the residual error.

Here is the caller graph for this function:

◆ normalizeTimingPhase()

std::complex< double > js8::normalizeTimingPhase ( std::complex< double > bin,
int tone,
double shiftSamples,
int windowSamples )
inline

Remove the known tone-dependent phase of a TimingTracker displacement.

A window starting shiftSamples late sees the tone component advanced by 2*pi*tone*shiftSamples/windowSamples; dividing it out normalizes every symbol to the nominal-boundary phase frame used by the carrier model.

Here is the caller graph for this function:

◆ refineLlrsWithLdpcFeedback()

template<std::size_t N>
void js8::refineLlrsWithLdpcFeedback ( std::array< float, N > const & llrIn,
std::array< int8_t, N > const & cw,
float erasureThreshold,
std::array< float, N > & llrOut,
int & confidentCount,
int & uncertainCount )

Refine LLRs using a decoded LDPC codeword as feedback.

The algorithm adjusts each input LLR based on whether its sign matches the corresponding bit in the provided codeword cw and on the magnitude of the LLR:

This function writes results to llrOut and returns counts of confident and uncertain bits via confidentCount and uncertainCount respectively.

Template Parameters
NNumber of LLR elements (array length).
Parameters
llrInInput LLR array (unchanged).
cwDecoded codeword as an array of int8_t (non-zero means bit 1).
erasureThresholdThreshold below which shrunk magnitudes are erased (set to zero). Use 0.0f to disable erasure thresholding.
[out]llrOutOutput array receiving adjusted LLRs.
[out]confidentCountNumber of bits considered confident after adjust.
[out]uncertainCountNumber of bits considered uncertain after adjust.

◆ refineSicReference()

template<int SymbolSamples, std::size_t Symbols, typename Samples, typename Tones>
SicRefinementResult js8::refineSicReference ( std::vector< std::complex< float > > nominal,
Samples const & samples,
Tones const & tones,
float const dt,
bool const allowTimingDrift )

Refines a decoded reference while guarding its matched correlation.

Returns
The accepted reference and timing/frequency fit diagnostics.
Here is the call graph for this function:

◆ sicStartSample()

int js8::sicStartSample ( float seconds)
inline

Converts SIC timing to the nearest 12-kHz sample for fit and subtraction.

Returns
The signed sample offset of the reference waveform.
Here is the caller graph for this function:

Variable Documentation

◆ LDPC_FEEDBACK_MAX_PASSES_DEFAULT

int js8::LDPC_FEEDBACK_MAX_PASSES_DEFAULT = 8
constexpr

Default maximum number of LDPC feedback passes when unset in env.

◆ LLR_ERASURE_THRESHOLD_DEFAULT

float js8::LLR_ERASURE_THRESHOLD_DEFAULT = 0.0f
constexpr

LDPC erasure threshold config and feedback refinement helpers.

Inline env readers expose thresholds/pass limits; the templated refineLlrsWithLdpcFeedback shrinks/boosts LLRs using the decoded codeword to retry LDPC. Used inside the JS8 decode loop between LDPC passes. Default erasure threshold (zero retains all likelihood evidence).

◆ LLR_FEEDBACK_CONFIDENT_BOOST

float js8::LLR_FEEDBACK_CONFIDENT_BOOST = 1.2f
constexpr

Multiply confident magnitudes by this factor when boosting.

◆ LLR_FEEDBACK_CONFIDENT_MIN

float js8::LLR_FEEDBACK_CONFIDENT_MIN = 3.0f
constexpr

Minimum magnitude to consider a bit "confident" when sign matches.

◆ LLR_FEEDBACK_MAX_MAG

float js8::LLR_FEEDBACK_MAX_MAG = 6.0f
constexpr

Maximum allowed absolute magnitude for adjusted LLRs.

◆ LLR_FEEDBACK_UNCERTAIN_MAX

float js8::LLR_FEEDBACK_UNCERTAIN_MAX = 1.0f
constexpr

Maximum magnitude considered "uncertain" (will be shrunk).

◆ LLR_FEEDBACK_UNCERTAIN_SHRINK

float js8::LLR_FEEDBACK_UNCERTAIN_SHRINK = 0.5f
constexpr

Multiply uncertain magnitudes by this factor when shrinking.