Files
lightcraft/docs/tone-curve-input.md
T
6f3819ab4c LR-EDIT-CURVE: show the selected Tone Curve's sampled input histogram (#987) (#2531)
* LR-EDIT-CURVE: show sampled Tone Curve input (#987)

Keep the output Histogram separate. Sample each selected curve's input
with the production prefix LUT builder and strict request identity.
Preserve current main's source facts, mask behavior and render output.

Credit @zelefogs for the request and @aiongg for the input/output
clarification. Human contributor credit remains @AlexChambers.

Co-Authored-By: GPT-6-Astra <[email protected]>

* LR-EDIT-CURVE: refresh curve input source after relink (#987)

Rebuild the prepared diagnostic job when its origin changes, even if
the content hash and render key stay the same. Retain completed
histograms for identical content.

Add a real-file regression through import, relink, the prepared-job
caller flow and the native worker. Check the actual retry path,
source facts and successful recovery.

Co-Authored-By: GPT-6-Astra <[email protected]>

* LR-EDIT-CURVE: bound histogram UI test work (#987)

Use two small generated PNGs for the input-histogram tests. Keep the
production decoder, render queue and pipeline, and retain the 20-second
settle budget. The full demo library adds unrelated thumbnail and
neighbor work when the failure gate opens.

Assert that stale cached histograms stay hidden during pending and
failed replacements, and verify that clearing the selection leaves
no active photo. Keep the existing histogram stage checks.

Human contributor credit remains @AlexChambers.

Co-Authored-By: GPT-6-Astra <[email protected]>

* LR-EDIT-CURVE: adapt the histogram to main's render parameters (#987)

Carry the curve input source, edit panel and tests into the module layout and
render-parameter API on current main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* LR-EDIT-CURVE: register the histogram label with the panel's Ui (#987)

Main's register now takes the Ui, not its Context.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* LR-EDIT-CURVE: match unknown channels to the Point input (#987)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* LR-EDIT-CURVE: refresh the parity summary after the merge

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* LR-EDIT-CURVE: fit the merge to main's three-argument file loader; histogram-only slots in one helper (#987)

Main's loaders take the camera profile as a third argument, so the curve tests' loaders take it too. Keeping the Tone Curve and HDR histograms moves into keep_histogram, which brings Renderer::collect back under the cognitive complexity limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* LR-EDIT-CURVE: the input diagnostic's pixels are dithered like the render's (#987)

Main's finish dithers its 8-bit output with an 8x8 Bayer pattern (#3509). The diagnostic's image used plain rounding, so it no longer matched a render with the later curves removed; it now encodes with finish's dither at the same output position. Its histogram still bins the undithered samples.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* LR-EDIT-CURVE: refresh the parity summary after the merge

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* LR-EDIT-CURVE: refresh the parity summary after the merge

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* LR-EDIT-CURVE: refresh the parity summary after the merge

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Trim duplicate Tone Curve histogram tests (#987)

* LR-EDIT-CURVE: check the brush budget before sampling a curve's input (#987)

The Tone Curve input diagnostic went straight into mask preparation in
both the native render job and the web worker, skipping
check_brush_budget. An over-budget brush then lost its later strokes and
the backdrop showed that partial sample as the curve's input.

curve_input::render now runs check_brush_budget on its own clamped,
full-crop request (at most 256 px, no window) and returns a Result, so
both callers fail the request and the UI shows "Input histogram
unavailable". Regression tests cover the pipeline, the native job, the
worker and the headless UI.

* LR-EDIT-CURVE: tell screen readers the selected channel and the input status (#987)

The Tone Curve's channel buttons now report which channel is selected
(toggled), through the same helper the segmented controls use. The input
histogram's caption is a polite live region, so screen readers read it
when it changes between loading, sampled and unavailable, and the focus
stays where it is. A new announce_live helper sets the live region; the
AccessKit adapters read a live node only when its text changes.

The headless test view keeps the last frame's AccessKit tree in test
builds, and a new test checks both behaviours through it.

---------

Co-authored-by: GPT-6-Astra <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: FredApps <[email protected]>
2026-12-01 11:03:57 +01:00

4.5 KiB

Tone Curve input histogram

The backdrop shows sampled tones entering the selected curve. The Histogram panel still shows rendered output. Issue #987, reported by @zelefogs, requested this distinction; #1091 supplied the earlier output backdrop.

Where the sample comes from

The CPU pipeline shares its existing geometry, white balance, noise reduction and spatial stages. Its finish stage applies exposure, local adjustments, detail, tone, colour, vignette and the output gamut or proof transform. It then applies the sRGB transfer function in the preview's output primaries. These encoded component values are the curve axes.

Selected curve Sampled values
Parametric Before every curve
Point (master) After Parametric, before Point
Red, Green or Blue That component after Parametric and Point, before the independent RGB curves

Point and Parametric display a luminance summary of the encoded components, using the output primaries' luminance weights. Both curves actually act on each RGB component. The normal renderer composes the curves into 1,024-entry lookup tables. The diagnostic constructs the same tables with only the preceding curves, after built-in profile expansion. It does not change the normal tables or how existing edits render.

The renderer does not store an intermediate image between its fused curves. This reconstructed prefix does not imply that applying the selected curve separately reproduces every output bit; table interpolation and nonlinear composition can differ.

Refine Saturation, grain, LUT profiles, proof warning colours, diagnostic overlays and final output re-encoding are excluded. Built-in profiles can change upstream settings and preceding curves; those contributions remain. This is why simply disabling curves and measuring final output would not measure the requested stage.

Sampling and identity

The UI uses the existing thumbnail source and a separate render request, with at most 256 pixels per edge (65,536 samples). It samples the whole crop. Zoom windows and panning do not change the distribution. Float values are binned before quantization. Nonfinite values and values outside 0..1 are excluded rather than placed at the graph's endpoints.

This is an approximation from a downsampled development, not a full-resolution pixel count. Initial thumbnail loading follows the normal source loader and can require decoding an original. Subsequent diagnostics reuse the thumbnail source and spatial cache. Moving the selected curve or its successors does not invalidate the diagnostic key. Upstream settings, source identity, photo, channel, crop, display profile and proof settings do. An idle frame reuses the prepared job.

The diagnostic has its own preview slot and accepts only its current request. The UI also checks the current photo and key before drawing. Loading or failure leaves an empty backdrop with a status label; a previous photo's distribution is never used as a fallback. Library and display resets clear the diagnostic. It never reads or writes rendered thumbnail or view caches.

Before it prepares local masks, the diagnostic checks every visible brush mask against its dab budget at the diagnostic's own size and crop, as the normal preview does. Past the budget, mask preparation would drop the later strokes, so the request fails instead, in the native renderer and in the browser worker. The backdrop then shows "Input histogram unavailable".

Native previews use the selected monitor primaries and proof transform. Browser worker previews currently use their existing sRGB request semantics. HDR edits use the SDR preview rendition, including its brightness and contrast offsets; this graph does not represent the HDR export's headroom. The help text states this limit. No output toggle or new edit setting is added.

Verification and limits

Procedural regressions cover exposure, nonidentity curves and their order, built-in and LUT profiles, crop and window handling, size bounds, HDR and nonfinite boundaries, display primaries, proof transforms, over-budget brush masks, cache separation and late completions across edits, photos, channels and library resets. A GPU comparison checks each curve prefix against the existing GPU renderer. Headless UI tests check channel selection, output separation, loading, failure (including an over-budget brush) and no-photo states.

These tests establish LightCraft's stage contract. They do not establish Lightroom colour parity, real-camera accuracy or performance on every platform.