diff --git a/crates/raw/tests/corpus.rs b/crates/raw/tests/corpus.rs index edfd12393..cb8928678 100644 --- a/crates/raw/tests/corpus.rs +++ b/crates/raw/tests/corpus.rs @@ -861,19 +861,13 @@ fn corpus_fujifilm_compressed_samples() { eprintln!("verified {seen} Fujifilm compressed sensor arrays"); } -/// Checks each available `(name, width, height, sum, weighted)` case against the pinned SHA-256 in `checksums` -/// and the decoder's sensor array; absent corpus files are skipped. Returns how many were verified. -fn verify_sensor_arrays(checksums: &str, cases: &[(&str, usize, usize, u64, u64)]) -> usize { - use sha2::{Digest, Sha256}; +/// Checks each available `(name, width, height, sum, weighted)` case against the decoder's sensor array (the file's +/// identity is checked by `cargo xtask corpus --download`); absent corpus files are skipped. Returns how many were verified. +fn verify_sensor_arrays(cases: &[(&str, usize, usize, u64, u64)]) -> usize { let dir = corpus_root().join("raw"); let mut seen = 0; for &(name, width, height, sum, weighted) in cases { - let path = format!("corpus/raw/{name}"); - let checksum = checksums.lines().filter_map(|s| s.split_once(" ")).find(|(_, p)| *p == path).unwrap().0; - assert_eq!(checksum.len(), 64, "{name}: missing published SHA-256"); let Ok(bytes) = std::fs::read(dir.join(name)) else { continue }; - let actual_sha: String = Sha256::digest(&bytes).iter().map(|b| format!("{b:02x}")).collect(); - assert_eq!(actual_sha, checksum, "{name}: corpus file differs from its pinned identity"); let img = decode(&bytes).unwrap_or_else(|e| panic!("{name}: {e}")); assert_eq!((img.width, img.height), (width, height), "{name}"); let lightcraft_raw::RawData::U16(data) = img.data else { panic!("{name}: float data") }; @@ -900,7 +894,7 @@ fn corpus_sony_arw6_samples() { ("arw6-sony-ilce7rm6-ff-port-hq.arw", 10016, 6672, 242772794178, 8043470668590476975), ("arw6-sony-ilce7rm6-ff-port-c.arw", 10016, 6672, 241868995482, 8014659803009871380), ]; - let seen = verify_sensor_arrays(include_str!("../../../docs/arw6-corpus.sha256"), cases); + let seen = verify_sensor_arrays(cases); eprintln!("verified {seen} Sony ARW6 sensor arrays"); } @@ -914,7 +908,7 @@ fn corpus_sony_ilce7rm6_lossless_samples() { ("arw-sony-ilce7rm6-ff-land-lossless.arw", 10240, 7168, 128728791716, 4922490451480041632), ("arw-sony-ilce7rm6-ff-port-lossless.arw", 10240, 7168, 120718314835, 4098302368966213583), ]; - let seen = verify_sensor_arrays(include_str!("../../../docs/arw6-corpus.sha256"), cases); + let seen = verify_sensor_arrays(cases); eprintln!("verified {seen} Sony ILCE-7RM6 lossless sensor arrays"); } diff --git a/docs/arw6-compression.md b/docs/arw6-compression.md index 95698799e..9f263051c 100644 --- a/docs/arw6-compression.md +++ b/docs/arw6-compression.md @@ -72,7 +72,7 @@ LibRaw assumes the full-frame grid (s = 0) for every tile. On the APS-C crop tha | `arw-sony-ilce7rm6-ff-land-lossless.arw` | `raw_modes/ILCE-7RM6_FF_land_RAW.ARW` | 100 851 712 | `5cb3c870bc961cf6b079d56c860d0cdf11acd1afd04e5fb8dbe041bcfd2d6201` | | `arw-sony-ilce7rm6-ff-port-lossless.arw` | `raw_modes/ILCE-7RM6_FF_port_RAW.ARW` | 100 884 480 | `b1a4026aa6adbaa27973b8b3426d8b4aa0c1cae1845cf5102359327d3b069691` | -These 12 files are CC0 1.0 per the RawDB record of the set (uploaded by abbradar; ); the server answers 303 to a signed object URL, so fetch with `curl -L` from `https://rawdb.dnglab.org/api/download/Sony/ILCE-7RM6/`. They live in the gitignored corpus; `cargo xtask corpus --download` fetches them and [arw6-corpus.sha256](arw6-corpus.sha256) pins their identities. `cargo test -p lightcraft-raw corpus_sony -- --nocapture` verifies each available file's checksum, then the decoder's sensor sum and position-weighted sum. The 8 ARW6 files are checked against the Phase 0 reference sums; the 4 lossless siblings go through the existing LJ92 path and their sums are regression values from LightCraft's own decoder. The test skips absent files. +These 12 files are CC0 1.0 per the RawDB record of the set (uploaded by abbradar; ); the server answers 303 to a signed object URL, so fetch with `curl -L` from `https://rawdb.dnglab.org/api/download/Sony/ILCE-7RM6/`. They live in the gitignored corpus; `cargo xtask corpus --download` fetches them and checks each against its SHA-256, pinned in `RAW_SAMPLES` (`xtask/src/main.rs`). `cargo test -p lightcraft-raw corpus_sony -- --nocapture` verifies the decoder's sensor sum and position-weighted sum of each available file. The 8 ARW6 files are checked against the Phase 0 reference sums; the 4 lossless siblings go through the existing LJ92 path and their sums are regression values from LightCraft's own decoder. The test skips absent files. Nine further full-frame HQ photos from the maintainer's A7R VI were compared with the oracle locally; they are private and never committed or published. All 9 private FF photos (ISO 100-12800, incl. two near-black night shots) decode bit-exact over the full frame (0 mismatching pixels of 66.8 MP each). diff --git a/docs/arw6-corpus.sha256 b/docs/arw6-corpus.sha256 deleted file mode 100644 index 30e80de00..000000000 --- a/docs/arw6-corpus.sha256 +++ /dev/null @@ -1,14 +0,0 @@ -# Sony ILCE-7RM6 ARW files (ARW6 Compressed / HQ and lossless siblings); CC0 1.0, RawDB (rawdb.dnglab.org), uploaded by abbradar. -# SHA-256 values verified 2026-10-09; see docs/arw6-compression.md. -b60a7e752d2a8102ccbe6eebcfdbf533c6b0f2545739090873e9e8eb32cc0637 corpus/raw/arw6-sony-ilce7rm6-apsc-land-hq.arw -1c803304e63ec508b2b5f9d59d4a7e30ed279315b35fa4c5d75f959bed62198b corpus/raw/arw6-sony-ilce7rm6-apsc-land-c.arw -0b6d782571e86868670f613de9fa1f1364623b24fbfd21b704b2c516d7a1c1cb corpus/raw/arw6-sony-ilce7rm6-apsc-port-hq.arw -c41674a485ffcf6d873e20e545ae62936192d94e95be3d53548e93bc543ecfd4 corpus/raw/arw6-sony-ilce7rm6-apsc-port-c.arw -559fa26501d7813e56afecde2aea3d9965a99228162b194752d986193abb172c corpus/raw/arw6-sony-ilce7rm6-ff-land-hq.arw -d900d6cbe838be864269ad54de4a33fcac7eb3a3d4f91009739f770b8f85a23b corpus/raw/arw6-sony-ilce7rm6-ff-land-c.arw -81c709633cb8f6340e612c3f53bb6ec6b0cccfe5b713c67efb1e977ece9e266d corpus/raw/arw6-sony-ilce7rm6-ff-port-hq.arw -f4448485629c3f82ff1955fd046404350e9a1f09b346038574b89c074d7c50fd corpus/raw/arw6-sony-ilce7rm6-ff-port-c.arw -7aaf0b3941509d7364a6f03844783155ebc912d246d1c456e5cdb4693ec09fbc corpus/raw/arw-sony-ilce7rm6-apsc-land-lossless.arw -0f011933ee96525a39710daa50b59d39702b4ec5934fa0206742e2128c55f366 corpus/raw/arw-sony-ilce7rm6-apsc-port-lossless.arw -5cb3c870bc961cf6b079d56c860d0cdf11acd1afd04e5fb8dbe041bcfd2d6201 corpus/raw/arw-sony-ilce7rm6-ff-land-lossless.arw -b1a4026aa6adbaa27973b8b3426d8b4aa0c1cae1845cf5102359327d3b069691 corpus/raw/arw-sony-ilce7rm6-ff-port-lossless.arw