Skip to content

feat(denoise): forward-lookahead (cadence-aware) bidirectional temporal denoise (ADR-0137)#36

Merged
lusoris merged 1 commit into
masterfrom
feat/denoise-cadence-build
Jun 27, 2026
Merged

feat(denoise): forward-lookahead (cadence-aware) bidirectional temporal denoise (ADR-0137)#36
lusoris merged 1 commit into
masterfrom
feat/denoise-cadence-build

Conversation

@lusoris

@lusoris lusoris commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

What

Implements ADR-0137 (now Accepted): forward-lookahead (bidirectional) temporal denoise — an opt-in lookahead option (default 0) for vf_pelorus_denoise_vulkan.

Why

The causal walk only denoises the trailing frame of each held animation drawing (2s/3s cadence): A1 finds A0 (prev, same drawing → averaged), but the leading frame A0 sees a different drawing (tcut-breaks) and is under-denoised. A forward tap closes it.

How

lookahead=1 delays output one frame (activate() delay-line + EOF flush — the filter was causal with no latency/flush) and the temporal loop adds one same-coordinate sample of the next frame, tcut-gated like the prev taps. A 6th next0_images binding (index 9) + push-const actual_next; .comp kept in lockstep.

Validation

PSNR vs clean frames
lookahead=0 (causal) 35.60 dB 24
lookahead=1 (forward) 35.98 dB (+0.37 dB) 24

lookahead=0 bit-identical to causal; frame count preserved across the delay/flush. An independent review confirmed the activate() frame-ownership, descriptor wiring, push-constant std430 layout, and shader/filter lockstep are all correct. Fast gate 11/11.

Disposition

Real but modest (~+0.37 dB, concentrated on the leading frames; the spatial NLM already partly covers them) and the benefit is niche (animation cadence) → ships opt-in, default 0. The common live-action path is untouched (the forward tap tcut-breaks on motion); matches the tile opt-in pattern; tune=anime enables it.

The first positive direction after the v0.11–v0.13 encoder-RC negatives — preprocessing (Pelorus's lane), premise-validated before the build.

Deliverables

ADR-0137→Accepted (+ Built result), denoise.md lookahead row, changelog, bench-results v0.14, regenerated patch 0003.

🤖 Generated with Claude Code

…al denoise (ADR-0137)

The causal temporal walk only denoises the TRAILING frame of each held animation
drawing (2s/3s cadence): A1 finds A0 (prev, same drawing, averaged), but the
LEADING frame A0 sees only the previous, different drawing (tcut breaks) and is
under-denoised. Add an opt-in forward lookahead so the walk is bidirectional.

lookahead AVOption (default 0 = causal, bit-identical, no latency; 1 = one
forward tap). When 1, the filter delays output by a frame (activate() delay-line
+ EOF flush — the filter was causal with no latency/flush) and the temporal loop
adds one same-coordinate sample of the NEXT frame, tcut-gated like the prev taps.
A 6th next0_images storage-image binding (index 9) + a push-const actual_next;
pelorus_denoise.comp kept in lockstep (a nextImg tap).

Validated against the cadence oracle (2s-cadence noisy clip, 24f): lookahead=1
35.98 dB vs lookahead=0 35.60 dB (+0.37 dB), frame count preserved across the
delay/flush, lookahead=0 bit-identical to the causal filter. An independent
review confirmed the activate() frame-ownership, descriptor wiring, push-constant
std430 layout and shader/filter lockstep are correct.

The gain is real but modest (~+0.37 dB, concentrated on the leading frames; well
short of the +1.5 dB upper-bound premise because the spatial NLM partly covers
them) and the benefit is niche (animation cadence), so it ships OPT-IN (default
0) — the common live-action path is untouched (the forward tap tcut-breaks on
motion anyway), matching the tile opt-in pattern; tune=anime enables it.

This is the first positive direction after the v0.11-v0.13 encoder-RC negatives —
PREPROCESSING (Pelorus's lane), premise-validated before the build. Regenerates
patch 0003.

ADR: docs/adr/0137-denoise-forward-lookahead-cadence.md (Accepted)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lusoris
lusoris merged commit 9bdddf9 into master Jun 27, 2026
3 checks passed
@lusoris
lusoris deleted the feat/denoise-cadence-build branch June 27, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant