nx_fec_xor.nx
buildroot/runtime/nx_fec_xor.nx
about
nx_fec_xor.nx -- sovereign XOR forward-error-correction (FlexFEC family,
RFC 8627 re-implemented from spec). Closes the #1 shared gap vs the
very best: loss-resilience, behind top esports netcode AND missing for
NASA/aerospace-critical streaming. Pure XOR -> integer-only, no field
math, branch-light, sovereign (imports only nx_syscalls).
Same machinery, three uses:
- row (1-D non-interleaved): recovers 1 RANDOM loss per row.
- column (1-D interleaved): recovers a BURST of up to D consecutive
(they land in distinct columns).
- 2-D (row+column): iterative peeling recovers most MIXED loss.
- K=1 row == the game REDUNDANT-INPUT window (send last N inputs).
THE EXCEED: redundancy is sized adaptively from the REAL per-flow loss
estimator (nx_linkqual lq_loss_pct), not a fixed cvar -- caller passes
loss_pct to fec_scheme_for_loss. Generalizes the shipped nx_voice_fec
redundant-copy concept (CLAUDE.md 15 / review-existing-functionality).
Layout: source packets in a flat buffer, packet i at src + i*S (each
padded to S bytes). Grid is L columns x D rows, K = L*D source packets,
row j cell i = index j*L + i. Row repairs: D x S. Col repairs: L x S.
license_tier: ORIGINAL
dependencies 1 imports · 4 importers
imports: nx_syscalls.nx
imported by: nx_adverse_net_gate.nxnx_fec_state_gate.nxnx_fec_stripe.nxnx_fec_xor_test.nx
structs
| none |
consts
| 28 | const FEC_NONE: i64 = 0 |
| 29 | const FEC_ROW: i64 = 1 |
| 30 | const FEC_2D: i64 = 2 |
functions
| 32 | func fec_pkt(buf: *u8, i: i64, S: i64) -> *u8 { return ((buf as i64) + i * S) as *u8 } |
| 34 | func fec_zero(p: *u8, S: i64) -> i64 |
| 40 | func fec_xor_into(dst: *u8, src: *u8, S: i64) -> i64 |
| 50 | func fec_encode_rows(src: *u8, L: i64, D: i64, S: i64, out_rows: *u8) -> i64 |
| 61 | func fec_encode_cols(src: *u8, L: i64, D: i64, S: i64, out_cols: *u8) -> i64 |
| 77 | func fec_decode_2d(src: *u8, L: i64, D: i64, S: i64, present: *i64, |
| 151 | func fec_scheme_for_loss(loss_pct: i64) -> i64 |
| 157 | func fec_overhead_pct(scheme: i64, L: i64, D: i64) -> i64 |