wai-rs: jpegai_pipeline::efn_filter — EFE luma-aided nonlinear chroma post-filter #9

Merged
dcharlot merged 1 commit from feat/jpegai-efn into main 2026-07-13 13:18:38 -04:00

2026-07-13

Transaction Science
wai-rs: jpegai_pipeline::efn_filter — EFE luma-aided nonlinear chroma post-filter (float-exact)
First pixel-domain post-filter. Refines a chroma plane using the co-located luma:

  w[i]  = (weights_q15[i] - 32767) / 2^11            // deinteger, wP=16
  min   = luma_min_q/100 ; gap = (luma_max_q/100 - min)/8
  c_out = relu( w[0]·(y - min) + c_in )
        + Σ_{j=1..7} w[j]·relu( y - min - j·gap )

The reference builds a tiny 2-layer conv/ReLU net per tile (conv1 2→8 1×1 + bias,
conv2 8→1 1×1) with a fixed weight structure; that collapses to the closed form above
— one luma-gated channel carrying c_in plus seven luma-only histogram-breakpoint
channels summed with weights [1, w[1..7]].

Validated against the reference fixture (luma + input chroma + 8 Q15 tile weights +
luma min/max → filtered chroma): max|Δ| = 4.6e-5 (f32-vs-f64 rounding), SNR 149.9 dB.
Plus a unit test pinning the deinteger scale, the min/gap breakpoints, and the two
ReLU gates. Single-tile / 4:4:4; caller downsamples luma for subsampled formats.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-13 13:17:53 -04:00