diff --git a/docs/dev/frame-budget.md b/docs/dev/frame-budget.md index 454197d..64340bc 100644 --- a/docs/dev/frame-budget.md +++ b/docs/dev/frame-budget.md @@ -474,3 +474,41 @@ sharpening at a scale too coarse to draw its radius emits an empty pass, which cost a full read and write when another neighbourhood operation followed it: sharpen with clarity at 2560 × 1600 fit went from 18.66 ms to 14.16 ms, and at 3840 × 2160 from 37.93 ms to 27.88 ms. + +## Dehaze in two passes — 2026-09-26 + +**Status:** Measured in the commit named, not re-run for this file. + +**Dehaze erodes each axis in one pass and recovers in the second** +(`bee5c58`, #74). It was five passes — a run and a span erosion along x, +the same along y, and the recovery — and cost 22.9 ms of a 2560 × 1600 +frame on the laptop RTX 3050, 54.1 ms at 3840 × 2160, with the memory +clock held at 810 MHz by the power cap. At those clocks a detail pass costs +what it reads and writes rather than what it taps: a pass with an empty +body, one render-sized `rgba16float` read and write, measured 4.0 ms, and +each dehaze pass 4.4–4.6 ms, so the taps were about 2 ms of the 22 and the +four hand-offs between passes were the rest. Each axis now takes the +minimum over its whole window directly, and the recovery rides in the y +pass, which already holds the veil and the pixel's own colour: 36 texture +reads a pixel in place of 12, nearly all cache hits, and two passes in +place of five. + +The same synthetic 60 MP source, only a detail parameter moving so the +fused pass is reused, 30 frames a scene after six of warm-up, five runs of +each binary alternated, median of the per-run p50: + +| scene | before | after | +|---|---:|---:| +| dehaze, 2560 × 1600 fit | 22.88 ms | 9.06 ms | +| dehaze, 2560 × 1600 1:1 | 23.41 ms | 9.52 ms | +| dehaze, 3840 × 2160 fit | 54.09 ms | 28.12 ms | +| all five detail operations, 2560 × 1600 fit | 53.11 ms | 39.97 ms | +| all five detail operations, 2560 × 1600 1:1 | 67.48 ms | 56.42 ms | +| every operation with film, 2560 × 1600 fit | 57.59 ms | 44.19 ms | +| every operation with film, 2560 × 1600 1:1 | 71.83 ms | 57.93 ms | + +The five detail operations are noise reduction, sharpening, clarity, +texture and dehaze; the scenes without dehaze moved within ±2%. The +picture is the same bits: a minimum is exact in any order, the window is +the one the split passes covered, and the rgba8 output hashed identically +before and after in all 64 scene, view and size combinations measured.