Files
eliets2 547fd29f3c Extend CR3 white level to actual sensor saturation (#3805)
* Extend CR3 white level to actual sensor saturation

The white level comes from Canon's stated value, not from the sensor data, so highlights between the stated level and true saturation are misclassified as clipped. Extending the white level to the real pile-up and folding the delta into baseline_exposure leaves everything below the old white unchanged while recovering the lost highlight range.

Add RawImage::extend_white_to_saturation() to saturation.rs that scans for a saturation pile-up above the stated white (coarse 1/128 bins, requires >= 1 sample in 100,000 and >= 64 samples above), sets white to the lowest colour's pile-up edge or the bit-depth top, and returns the EV delta. Call it from cr3.rs decode() on Mode::Full and add the delta to ColorData::baseline_exposure. Bump RENDER_CACHE_VERSION in media.rs.

Test: extend_white_to_saturation_above_stated_white failed before the change and passes after.

* Preserve CR3 highlight headroom and exposure

Assisted-by: OpenAI Codex

* Tests: a probe does not know the white headroom a CR3 decode finds

The header probe stays a header probe, so the comparison leaves out
baseline_exposure, which a full decode adjusts from the samples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: eliets2 <287273517+eliets2@users.noreply.github.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 23:01:16 +01:00
..