Merge PR #1453 (rebased onto main)

This commit is contained in:
Brandon Thomas
2026-10-14 01:27:32 -04:00
6 changed files with 72 additions and 3 deletions
+4
View File
@@ -1115,6 +1115,10 @@ mod tests {
("cr3-canon-m50-craw.cr3", 0x9aacbfe66f505e1bu64),
("cr3-canon-r8-raw.cr3", 0x63c1c6d8d1eb2312u64),
("cr3-canon-r8-craw.cr3", 0xf836a663a795a375u64),
("cr3-canon-rp-raw.cr3", 0x5cb0f46404b8b663u64),
("cr3-canon-rp-craw.cr3", 0xf48df06ca1d67382u64),
("cr3-canon-rp-raw-crop.cr3", 0x46808a9de3b3dcc7u64),
("cr3-canon-rp-craw-crop.cr3", 0x39a60c4efed4e1f4u64),
] {
let path = std::path::Path::new(&directory).join(name);
let bytes = std::fs::read(path).unwrap();
+28
View File
@@ -124,3 +124,31 @@ fn canon_m50_craw_crop_is_the_shot_aspect() {
let raw = decode(&bytes).unwrap();
assert_eq!((raw.crop.x, raw.crop.y, raw.crop.width, raw.crop.height), (1012, 12, 4000, 4000));
}
#[test]
fn canon_rp_lossless_sensor_is_exact() {
// raw.pixls.us/getfile.php/4674; SHA256
// dcbd0f6f9929de2e2331b0fd10a9d01e7cfd04c5a5e4038456de1647d714cdf2
check("cr3-canon-rp-raw.cr3", 0x5cb0_f464_04b8_b663, (6384, 4224), (6240, 4160));
}
#[test]
fn canon_rp_craw_sensor_is_exact() {
// raw.pixls.us/getfile.php/4672; SHA256
// bd3270610593d37ff8a399908bb9406a4e32f9151d55bf19ac1cf8f10d787b46
check("cr3-canon-rp-craw.cr3", 0xf48d_f06c_a1d6_7382, (6384, 4224), (6240, 4160));
}
#[test]
fn canon_rp_crop_mode_lossless_sensor_is_exact() {
// 1.6x crop mode: a single tile. raw.pixls.us/getfile.php/4673; SHA256
// 7d4ba45dc9264d598336133593c677b09774bcdf13b602ee770e72415a652a16
check("cr3-canon-rp-raw-crop.cr3", 0x4680_8a9d_e3b3_dcc7, (4032, 2656), (3888, 2592));
}
#[test]
fn canon_rp_crop_mode_craw_sensor_is_exact() {
// raw.pixls.us/getfile.php/4671; SHA256
// 4a859ab137f792aedaf3416b0aad1497ebaab02052a49453902e226699154aa7
check("cr3-canon-rp-craw-crop.cr3", 0x39a6_0c4e_fed4_e1f4, (4032, 2656), (3888, 2592));
}
+18 -1
View File
@@ -62,6 +62,10 @@ control. The exact inputs and reference hashes are:
| Canon R100 C-RAW, raw.pixls.us 7897 | `0b66842b2fe00329ebc05fe8ab9357ddbbe1a0a2d2e69a2893102de7fdf5c942` | `341c706b37c38bbf` |
| Canon R8 RAW, raw.pixls.us 6585 | `7d5c6dbb11ff7e6ee58715d90a20f5d801e8b103f4711ff6ea329ceafcef254c` | `63c1c6d8d1eb2312` |
| Canon R8 C-RAW, raw.pixls.us 6587 | `df33cf394573645ce03dea1b2e9f0b5cc2b7734e9e3391ee7114151414cf2812` | `f836a663a795a375` |
| Canon RP RAW, raw.pixls.us 4674 | `dcbd0f6f9929de2e2331b0fd10a9d01e7cfd04c5a5e4038456de1647d714cdf2` | `5cb0f46404b8b663` |
| Canon RP C-RAW, raw.pixls.us 4672 | `bd3270610593d37ff8a399908bb9406a4e32f9151d55bf19ac1cf8f10d787b46` | `f48df06ca1d67382` |
| Canon RP RAW, 1.6× crop, raw.pixls.us 4673 | `7d4ba45dc9264d598336133593c677b09774bcdf13b602ee770e72415a652a16` | `46808a9de3b3dcc7` |
| Canon RP C-RAW, 1.6× crop, raw.pixls.us 4671 | `4a859ab137f792aedaf3416b0aad1497ebaab02052a49453902e226699154aa7` | `39a60c4efed4e1f4` |
The EOS R5 Mark II files (raw.pixls.us 7881–7884, CC0) are pinned to LightCraft's own decode; no external
decoder was run on them:
@@ -77,7 +81,11 @@ Reference pixels were observed from the DNGLab 0.8.0 macOS arm64 release
binary; no decoder source was read or copied, and it is not shipped or linked.
The release ZIP SHA-256 was
`ee70805cb60f18d5ed62548c4e595f6cee0a33407e15358eb1766a46afc1c16e`.
All six sensor comparisons pass. R8 HEVC preview tracks are distinguished from
The RP references came from the same release's Windows x64 binary (ZIP SHA-256
`d3add6b71568bf5f7938468b0b40a0ee1eaec01e0057fe78dcc453188010be9a`), after it
reproduced the M50 RAW hash above. The RP's 1.6× crop mode writes a single
4032×2656 tile, where full frame (6384×4224) uses two 3192-wide horizontal
tiles. All ten sensor comparisons pass. R8 HEVC preview tracks are distinguished from
the primary Bayer RAW; the HEVC preview itself is not decoded. Missing corpus
files are reported as skipped by the tests.
@@ -129,6 +137,15 @@ tile count, marker headers and temporary allocations. The full sensor buffer is
allocated only after the first plane decodes, and plane buffers grow row by row,
so a small crafted file fails before reserving memory for the image it claims.
## White level
The white level is Canon's specular white from `ColorData` (the word after the
normal white level), not the sensor's saturation point. On the RP at ISO 100
it is 14558 while samples clip at 16383. At the −⅓-stop ISOs, which pull a
higher analog ISO down digitally, it drops further: 11062 at ISO 5000, where
red saturates near 13668. Samples above the white level render as clipped.
Whether Lightroom recovers them has not been measured.
## Colour limits
CR3 carries as-shot white balance but no measured camera matrix is imported
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -591,7 +591,7 @@
12–32 mm kit zoom was off by about 5 % of the image width at the corners before. Files shot with the correction off
are unchanged; photos imported before this change get it when imported again.
- Canon CR3 raws now develop from their sensor data: lossless RAW and C-RAW, checked sample for sample on the EOS
M50, R100 and R8. CR3 files the decoder can't read yet still open from their embedded JPEG, as before.
M50, R100, R8 and RP (on the RP also in 1.6× crop mode). CR3 files the decoder can't read yet still open from their embedded JPEG, as before.
- Canon EOS R7 C-RAW files develop from their sensor data too, instead of opening from their embedded JPEG. For R7
C-RAWs imported earlier, Photo ▸ Reload from Disk picks up the raw data.
- Canon CRW, Minolta MRW, Sigma X3F, Kodak KDC, Leaf MOS and Epson ERF files that LightCraft can't decode yet
+20
View File
@@ -524,6 +524,26 @@ const RAW_SAMPLES: &[(&str, &str, &str)] = &[
"https://raw.pixls.us/getfile.php/6587/nice/Canon%20-%20EOS%20R8%20-%203:2.CR3",
"df33cf394573645ce03dea1b2e9f0b5cc2b7734e9e3391ee7114151414cf2812",
),
(
"cr3-canon-rp-raw.cr3",
"https://raw.pixls.us/getfile.php/4674/nice/Canon%20-%20EOS%20RP%20-%203:2.CR3",
"dcbd0f6f9929de2e2331b0fd10a9d01e7cfd04c5a5e4038456de1647d714cdf2",
),
(
"cr3-canon-rp-craw.cr3",
"https://raw.pixls.us/getfile.php/4672/nice/Canon%20-%20EOS%20RP%20-%203:2.CR3",
"bd3270610593d37ff8a399908bb9406a4e32f9151d55bf19ac1cf8f10d787b46",
),
(
"cr3-canon-rp-raw-crop.cr3",
"https://raw.pixls.us/getfile.php/4673/nice/Canon%20-%20EOS%20RP%20-%203:2.CR3",
"7d4ba45dc9264d598336133593c677b09774bcdf13b602ee770e72415a652a16",
),
(
"cr3-canon-rp-craw-crop.cr3",
"https://raw.pixls.us/getfile.php/4671/nice/Canon%20-%20EOS%20RP%20-%203:2.CR3",
"4a859ab137f792aedaf3416b0aad1497ebaab02052a49453902e226699154aa7",
),
// EOS R5 Mark II, full frame and 1.6x crop mode: odd-height (2825- / 1787-row) Bayer planes.
(
"cr3-canon-r5m2-raw.cr3",