Commit Graph
10 Commits
Author SHA1 Message Date
06c1b9ae07 Use crw craftlib (#3503)
* CRW-LIB: decode Canon CRW through the shared craft-crw crate

LightCraft decodes Canon CRW (the CIFF raws of the EOS D30, D60, 10D, 300D and the
PowerShot G1/G6) through craft-libs' `craft-crw`, the clean-room decoder derived and
verified on the `clean-room-crw-format-decode` branch and moved there with its frozen
tables and derivation record. `crates/raw/src/vendor/crw.rs` is now the adapter: it maps
the crate's header and samples onto `RawImage` (CFA, levels, active area, orientation,
as-shot white balance, the make/model/time records a CRW keeps instead of Exif) and
converts the capture time through chrono. The dependency is a local path
(`../craft-libs/crates/crw`) until the craft-libs branch merges; then it becomes a git
revision.

Everything LightCraft-side from that branch comes along unchanged: `probe_bytes` fills
metadata gaps from the decoder's records so CRW imports name their camera; the EOS D60
bundled camera profile and its chart-measured dual-illuminant matrices (`chart_table.rs`,
`spectral::Camera` carries its illuminant pair) give the D60 a Kelvin white-balance scale;
CRW joins the JPEG-fitted starting look, the catalog's raw formats and `lightcraft-cli
calibrate`; `RENDER_CACHE_VERSION` 71; the CC0 CRW corpus entries for `cargo xtask corpus`;
coverage, parity, gaps, raw-parity, target-app-parity and ROADMAP updates. The G5 stays
preview-only (the crate refuses it with the reason) and the robustness test keeps its CRW
sample.

What does not come along: the decoder, its tables and `crw_oracle.rs` (now craft-crw's
digest-pinned sample test) and the derivation record, which lives in craft-libs
`crates/crw/clean-room/`. `clean-room/crw/` here keeps only the EOS D60 chart-calibration
document and its capture list, with a README pointing at the record.

Gates: fmt, clippy -D warnings (raw all targets; engine, catalog, cli), lightcraft-raw tests
(475 + 134, the corpus files decoding through the adapter), catalog tests, engine lib tests
(1,300 pass; the two failures, `tests_import::recursive_discovery_…` and
`originals::tests::write_targets_pin_absent_paths_…`, are in files unchanged from main),
`cargo xtask parity`, `assets`, `layers`, `coverage.py --check`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* no message

* no message

* Update documentation after moving code to craft-libs

* Review coment fixes

* CRW: pin craft-crw f3b62ec, a truncated entropy stream is Corrupt

craft-libs #472 makes craft_crw::decode refuse a stream that ends more than
Limits::max_stream_end_fill (64 samples, one block) before the frame does,
instead of filling the rest with predictor values and returning success.
The adapter already maps craft_crw::Error::Corrupt to RawError::Corrupt;
a regression test proves a truncated CRW now fails at this boundary (it
decoded as a flat frame on the old pin) while its header still reads.

Only craft-crw moves; craft-ui/docpath/update/window stay on c5a1cbf.

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

* Code review comment fix

* Add some tests

---------

Co-authored-by: Robert Woldberg <314159+rwoldberg@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-02 20:41:34 -05:00
aiongg 35d2fc957b Merge PR #3402: RAW.colour: fit the per-file look on the vignetting-corrected sensor
Conflicts: crates/engine/src/camera_preview.rs: LOOK_VERSION stays 13, all three version notes kept; docs/raw-parity.md header merged (newer date, both changes)
2026-10-31 02:10:02 +00:00
Christian BramandClaude Opus 5.5 cabc9a3d21 RAW.colour: vignetting at the warp's source position; alignment skips missing pixels
Review follow-up to the vignetting fit fix:
- `proxies` applies the embedded vignetting gain before it moves the sensor
  into the camera JPEG's lens geometry, so a warped proxy pixel gets the gain
  of the position it samples, as the render applies it.
- `alignment` reads NaN pixels (outside a lens-warped proxy) as missing. The
  `max(1e-4)` turned them into black, a false edge along the border, and the
  warped candidate lost on wide-angle RAFs with barrel distortion.
- Tests: the colour fit gets the embedded lens, the vignetting is applied
  before the warp, and alignment ignores missing pixels.

27 + 60 X-S10 RAFs: mean ΔE00 unchanged (3.06, 2.55 -> 2.54), none worse by
more than 0.02.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 18:39:31 +01:00
Christian BramandClaude Opus 5.5 001a58e992 RAW.colour: fit the per-file look on the vignetting-corrected sensor
The RAF look fit compared the uncorrected sensor proxy with the camera
JPEG, which is already corrected for vignetting, so the tone curve learned
the brightening and the render then applied the embedded vignetting
correction a second time. Shadows and midtones came out up to 0.6 / 0.3 EV
too light on X-S10 files.

`look_proxies` applies the embedded correction to the sensor proxy of
every per-file fit (colour, monochrome, near-black fallback), as
`fit_dng_tone` already did. LOOK_VERSION 13, RENDER_CACHE_VERSION 71.

60 held-out X-S10 RAFs: mean ΔE00 2.71 -> 2.55, 32 better, none worse by
more than 0.05.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 18:00:02 +01:00
radialmonsterandClaude Opus 5.5 0149200bd5 Test the end-of-curve choice in the tone step repair (#1904)
A step at the top of a fitted curve reaches its end; the pixel pairs pick
the free end (top knots drop to the repair slope) or the window pinned to
the top knot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014ti8KemZbjE2ZgHgV1q1BM
2026-10-28 13:47:26 -04:00
radialmonsterandClaude Opus 5.5 3335fffb87 Limit tone-curve steps between pixel populations in the camera look fit (#1904)
The per-file look fitted from the embedded JPEG can join two pixel
populations the camera renders at different brightness for the same scene
luminance (by hue) with a near-vertical tone step. On a dark ISO 1100
D3400 frame of saturated blue and red the step had a log-log slope of
12-28 and the render's fine luminance noise in the blue area was 1.46x
that of Adobe's DNG of the same frame.

Fitted tone curves are now limited to a log-log slope of 4 between knots
(fitted looks: median steepest segment 2.1, 95th percentile 3.6). A
steeper segment is spread over the smallest window of knots whose
end-to-end slope is under the bound; a window that reaches an end of the
curve is weighed against leaving that end free at slope 2, keeping the
one closer to the fit's pairs. D3400 blue-area luminance noise drops to
0.99x Adobe's.

LOOK_VERSION 13, RENDER_CACHE_VERSION 71.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014ti8KemZbjE2ZgHgV1q1BM
2026-10-28 13:47:14 -04:00
Dylan M. Taylor c9d44f7804 style(engine): expand module imports explicitly 2026-10-28 03:24:18 +00:00
aiongg 50509093b6 refactor(lightcraft-engine): split camera_preview.rs into camera_preview/ 2026-10-26 21:08:55 +00:00
aiongg d151df0149 style: cargo fmt the moved test modules 2026-10-26 18:30:36 +00:00
aiongg 89083b6c77 refactor(lightcraft-engine): move camera_preview.rs tests to crates/engine/src/camera_preview/tests.rs 2026-10-26 18:15:56 +00:00