nx_vcodec_nf.nx
buildroot/runtime/nx_vcodec_nf.nx
about
nx_vcodec_nf.nx -- LEARNED decoder-side RESTORATION FILTER (NEURAL track rung 1, task #46; operator
2026-07-07: "achieve true neural sota as we climb ... and these things are all going live").
A data-TRAINED piecewise-linear restorer (RAISR/Wiener-class -- the same family as AV1's loop
restoration): every interior pixel of the DEBLOCKED recon is classified by its local gradient
(flat + 4 directions x 2 strengths = 9 classes) inside a qp band (3 bands), and restored by that
class's TRAINED 3x3+bias filter (Q12 integer weights, trained by nx_vcodec_nf_train on
(our-codec-recon -> source) pairs from REAL frames -- no floats anywhere, sovereign end to end).
DISPLAY-PATH ONLY by design: the P-reference chain keeps the unfiltered recon (bit-exactness of the
codec is untouched; a receiver applies this after decode, before YUV->RGBA). The trained table is
caller-provided (vc_nf_load from the GENERATED nx_vcodec_nf_table.nx fills it) -- this module stays
allocation-free and wasm-clean. license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_vcodec_nf_train.nxnx_video_codec_wasm.nx
structs
| none |
consts
| 14 | const VC_NF_CLASSES: i64 = 9 // 0=flat, 1..4 = H/V/D1/D2 moderate, 5..8 = H/V/D1/D2 strong |
| 15 | const VC_NF_BANDS: i64 = 3 // qp bands: <16, 16..27, >=28 (quant noise scales with qp) |
| 16 | const VC_NF_TAPS: i64 = 10 // 3x3 raster taps + bias, Q12 |
| 17 | const VC_NF_TBL: i64 = 270 // table length in i64 (bands * classes * taps) |
functions
| 19 | func vc_nf_band(qp: i64) -> i64 |
| 27 | func vc_nf_class(gx: i64, gy: i64) -> i64 |
| 47 | func vc_nf_apply(src: *u8, W: i64, H: i64, out: *u8, qp: i64, tbl: *i64) -> i64 |
| 86 | func vc_nf_identity(tbl: *i64) -> i64 called by 1: main |