develop.auto (crates/pipeline/src/auto.rs) is deterministic & closed-loop. Repeated runs with the same pixels, source kind & white balance produce the same eight values under the same implementation & runtime (f32 statistics, fixed sample stride, fixed iteration order & count, no clock, no randomness).
- Proxy. Box-fit to 512 px, white balance & scene-linear preparation as the pipeline does it, then every finite pixel's scene EV (
log2(Y / 0.18)) & Oklab chroma. The key's median is centre-weighted: half the frame's median, half the median of the central ellipse (CENTRE_R2, about 28 % of the frame), so a dark subject against a bright sky or a lit face in a dark room sets the key more than the frame's edges (regressionauto_is_centre_weighted_and_so_spatially_sensitive: shuffling the same pixels changes Auto). Percentiles for highlights, shadows & clipping stay frame-wide. Faces (#204): given detected face boxes (AutoHints::faces, fractions of the frame,scene_population_with), the faces' median takes the central ellipse's half of the key (half the frame's, half the faces'), the face median bounded to ±2.5 EV around the frame's so a false detection moves the key by at most 1.25 EV. Faces under 0.5 % of the valid pixels (or 16 proxy pixels), non-finite or inverted boxes, & no boxes leave the key exactly as v5 (regressionwithout_usable_faces_auto_is_identical;a_face_darker_than_the_frame_raises_exposure). Auto takes plain boxes: the pipeline does not depend onlightcraft-faces, & the engine converts the photo's cached face regions (a Detect Faces run, or the file's own XMP regions) to those boxes indevelop.auto(auto_face_boxes,region_auto_with/auto_tone_with); no regions, no change. YuNet 2023mar is pinned inlightcraft-faces(known.rs): opencv_zoo commit25f423d0e04c31a17254620e58febd7386da523b, 232,589 bytes, SHA-2568f2383e4dd3cfbb4553ea8718107fc0423210dc964f9f4280604804ed2552fa4, MIT (verified against upstream 2026-10-16). Auto never runs the detector itself: the user downloads it & runs Detect Faces. - Scene key (
SceneKey). Low-key, high-key & backlit are continuous weights in 0..=1 from smooth steps on the EV percentiles, never branches. Two frames of one burst that straddle a threshold get nearly the same values (regressionburst_frames_across_a_key_threshold_get_nearly_the_same_auto: the old branch moved exposure by 0.9 EV between frames 6 % apart). - Exposure. An exact rule: exposure is a gain before the tone curve, so
target_key − medianlands the median where the key wants it (−0.5 EV ordinary, −0.9 low-key, +0.65 high-key, blended; the ordinary offset fades out as a scene turns low- or high-key). The −0.5 EV ordinary key comes from a 7,524-photo measurement against the photographer's finals (#28): Auto's median luminance was 0.499 against their 0.371, 2.4 times as far from the camera render as they move it; 0.371 / 0.499 is −0.43 EV in linear luminance and about −0.9 EV on a 2.2 gamma scale, and 0.5 EV is the conservative end. Regressionkey_target_is_pinned_and_fades_the_ordinary_offset_for_keyed_scenes. Backlit scenes cap exposure near +2 EV so recovery handles the tail instead of lifting a dark foreground several stops. - Shaping fit (
auto::fit). Contrast, highlights, shadows, whites & blacks are fitted against a per-pixel model of the finish stage: finish's own highlight/shadow log-luminance offsets (the pixel's luminance stands in for the edge-aware base plane) followed by the source's real tone map (ToneMap::camera/new/display, chosen asfinishchooses). Targets on the rendered histogram: bright tail reaches white without clipping (also measured in EV against the tone map's white point, which stays informative where the output saturates), blacks reach near black, ordinary mid-tone spread, median kept where exposure put it. Coordinate descent in fixed slider order with a fixed step schedule (16, 8, 4, 2) over four passes, bounded to Auto's ranges (highlights only recover; shadows 0..+70; blacks −35..0 so they never lift), with a guard that keeps the rendered 10th percentile from rising above where neutral shaping leaves it (weight 8, relaxed for backlit scenes, whose dark foreground wants lifting; measured look targets keep the old ranges and no guard), with regularisation that keeps sliders modest where they buy nothing. Clipped raws (#205): clipped channels hold no detail to recover, & Highlights on them only greys the reconstructed neutral, so the lowest Highlights value rises with the clipped share of channel samples (fit::highlight_floor): −90 up to 0.5 % clipped, linearly to −18 from 10 %. The share comes from the decoder when it supplies one (AutoHints::clipped_share, elseSourceInfo::clipped_share: the raw loader counts the mosaic's active area after early-saturating plateaus are lifted to white,RawImage::clipped_share, the mean over the colour planes of each plane's share at or above white; teststhe_decoders_clipped_count_on_the_source_replaces_the_proxy_estimate,a_decoded_raw_carries_its_exact_clipped_share); otherwise raw sources get a proxy estimate (per channel, samples within 0.5 % of the channel's maximum when that maximum is ≥ 0.9, i.e. a plateau at sensor white), & rendered sources 0. Unclipped raws & all rendered sources are unchanged (regressiona_heavily_clipped_raw_caps_highlight_recovery). The proxy estimate remains for raws without a count (demo scenes, tests). The count moves Highlights on raws whose count differs from the estimate, so it isREVISIONv6 & receipts bound to v5 are rejected (BASELINE_AUTO_REVISIONfollowsREVISION). Cost per evaluation: ≤ 4096 samples × two LUT lookups. - Colour. Vibrance & saturation from the 90th-percentile chroma headroom. Without headroom, saturation also takes back 0.2 per point of fitted positive contrast, since contrast raises rendered chroma (v5, #28).
Why closed-loop: the previous rules mapped percentiles straight to slider values & assumed each slider's effect was linear & independent. Tone-curve tuning silently detuned Auto, & a display-referred JPEG (clips at 1.0) got the same recovery as a raw with a Reinhard shoulder. The fit reads the tone map, so Auto follows the pipeline (regression fitted_sliders_track_the_tone_map_of_the_source_kind).
A global fit cannot serve a subject against a washed-out background: the subject wants lifting, the background wants its contrast, blacks & haze back. auto::regions::region_auto (develop.auto's default; regions: false gives the global fit alone) splits the photo by the Subject & Sky mask shapes, today the classical heuristics in crates/pipeline/src/masks.rs (a segmentation model drops in behind the same shapes), & treats three regions:
- Regions on the 512 px proxy: subject = Subject alpha ≥ 0.6, sky = Sky alpha ≥ 0.6, background = the rest. A region counts with ≥ 4 % of the valid pixels & a 5th–95th percentile spread ≥ 0.1 EV; a subject over 90 % of the frame leaves no background. No usable subject → the global Auto, exactly.
- Global fit as above, but the key median is half the frame's, half the subject's (instead of the central ellipse).
- Region fits: the same closed-loop fit on each region's own pixels (the background's are those in neither subject nor sky, which is what its mask covers: Background minus Sky), each region moving only in its restoring direction (a fit against whole-scene targets would otherwise flatten a subject or brighten a background, & a heuristic mask is not precise enough to be trusted with more). Subject: its median to the scene's key target (local exposure) & shadows 0..40. Background: key kept, contrast 0..30 & blacks −35..0 from its fit, dehaze 0..25 from how far its 5th percentile sits above black under the global render (0 at 0.12, full at 0.37 encoded) scaled by how flat it is (full below 0.5 EV of 5th–95th spread, none above 1.5: a bright wall has lifted blacks too, but spread). Sky: highlights −60..0 & whites −30..0. Local values are the region's fit minus the global one.
- Settle: the subject's local exposure is bisected (8 steps over −0.5..+2 EV: a dark subject is lifted, a bright one left bright, only pulled back a little when far above the key) against the real render of the proxy as the photo will render (its own white balance on the un-white-balanced proxy, the person's masks & other edits, an earlier Auto's masks replaced, Auto's masks after theirs), until the subject region's encoded median meets the key target. Local slider units differ from the global ones & a soft mask applies only part of a value; the render is the truth. Region-aware latency needs qualification on representative photos & named hardware.
- Output: the eight global values plus masks named
Auto: subject/Auto: background/Auto: sky(Subject/Sky components & Background minus Sky) with the local adjustments, only where any is non-zero. Each carriesMask::auto, Auto's provenance flag ("auto": truein XMP / JSON). The next Auto replaces masks that carry it & still have the name & components Auto gave them (is_auto_mask); manual changes transfer ownership by clearing the flag, so adjusted, refined, inverted, renamed or extended masks stay. Masks created by a person stay regardless of name; Auto allocates free IDs with checked arithmetic. One undo step.
Regression a_dark_subject_on_a_washed_out_background_gets_two_treatments: subject region median within 0.06 of the key target in the real render, brighter than under the global Auto, background blacks deeper; repeat-identical. The masks are evaluated on the uncropped, unrotated proxy. Personal Auto's baseline receipts bind to the global auto_tone (unchanged, revision v3); region masks are not part of them.
auto::neutral_wb is a grey-world mean weighted towards mid-tone pixels with a strong low-chroma preference ((1 − chroma)⁴: a coloured wall or field that fills most of the frame still loses to the neutrals that are there; regression auto_wb_resists_a_large_coloured_surface…). It is exact on a uniform patch, which is what the white-balance picker samples. auto::auto_wb (Develop ▸ WB ▸ Auto) is the same estimate with the tint held within ±60 (MAX_TINT): real illuminants sit near the Planckian / daylight locus, so a larger green–magenta estimate is a coloured scene, not a coloured light. Non-finite or negative pixels are skipped; an all-invalid frame returns as-shot. Qualifying a better illuminant estimator (shades-of-grey, grey-edge, learned) needs a ground-truth illuminant set under a usable licence; a p = 6 shades-of-grey variant was tried & dropped: it made the coloured-wall case worse.
auto::scene_population (the proxy's sorted scene EVs, percentiles & chroma), SceneKey, auto::fit::Targets / auto_targets / fit_with, encode & tone_map are public: look targets (look-targets.md) feed measured statistics into the same fit; Personal Auto adds a learned residual on top of the result.
develop.auto(Shift+A, Edit ▸ Auto): the whole Auto, regions on by default;dryRunmeasures only.develop.autoControl {control}: one of the eight sliders (light.exposure,light.contrast,light.highlights,light.shadows,light.whites,light.blacks,color.vibrance,color.saturation) set to Auto's value for the active photo; the other settings and masks stay. Shift+double-click a slider's name in the Edit panel runs it.develop.autoBatch {ids?, regions?}: Auto on each target photo (ids, else the selection) as one undo step. Each photo is measured with its own source, settings and process version, so an older-process photo keeps its process and gets the Auto it would get alone.- Presets with the
autoflag (preset.create {auto: true}, stored asPreset.auto) run Auto on the photo first and lay the preset's own settings on top (preset.apply, one undo step). Presets without it are unchanged.
auto::REVISION names the rules (lightcraft.deterministic-auto.v6: v2 added the closed-loop fit & continuous keys, v3 the centre-weighted key, v4 process-version-aware baseline preparation & camera-space Auto WB, v5 the −0.5 EV ordinary key & the no-lift blacks range with the 10th-percentile guard, #28: on the corpus Auto moved the 10th percentile the user's way on only 46 % of photos and the median 2.4 times too far, v6 the raw decoder's exact clipped count in place of the proxy estimate, #205: Highlights differ on raws whose count differs); Personal Auto receipts bind to it & reject stale baselines. Changing any constant above is a new revision.
A segmentation model behind the Subject / Sky shapes (the region-aware Auto improves with it, no code change) #177, scene priors from DINOv2 embeddings blended by probability #199, a learned decision model that predicts target residuals from these measurements (auto-decision-model.md) #198, & spatial / face-weighted look targets #203. Evaluation: docs/personal-auto-evaluation.md (shoot-disjoint preference against this baseline).