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
Owner

First pixel-domain post-filter. Refines a chroma plane using co-located luma:

c_out = relu( w[0]·(y-min) + c_in ) + Σ_{j=1..7} w[j]·relu( y - min - j·gap )

The reference builds a per-tile 2-layer conv/ReLU net with a fixed weight structure; it collapses to this closed form (one luma-gated channel carrying c_in + seven luma-only histogram-breakpoint channels). Constants: wP=16 → deinteger=(q-32767)/2^11, hist_split=8, 4:4:4.

Validated vs the reference fixture: max|Δ| = 4.6e-5 (f32-vs-f64), SNR 149.9 dB. Plus a unit test for the deinteger scale, min/gap breakpoints, and the two ReLU gates.

First pixel-domain post-filter. Refines a chroma plane using co-located luma: ``` c_out = relu( w[0]·(y-min) + c_in ) + Σ_{j=1..7} w[j]·relu( y - min - j·gap ) ``` The reference builds a per-tile 2-layer conv/ReLU net with a fixed weight structure; it collapses to this closed form (one luma-gated channel carrying c_in + seven luma-only histogram-breakpoint channels). Constants: wP=16 → deinteger=(q-32767)/2^11, hist_split=8, 4:4:4. **Validated vs the reference fixture: max|Δ| = 4.6e-5 (f32-vs-f64), SNR 149.9 dB.** Plus a unit test for the deinteger scale, min/gap breakpoints, and the two ReLU gates.
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]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!9
No description provided.