mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-07 02:51:24 +00:00
EXR golden test: compare samples near, not bit for bit (#3181)
* EXR golden test: hash samples near, not bit for bit (temporary: print the new goldens) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * EXR golden test: the new near hashes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5047d8b5e7
commit
4465c0ea10
1 file changed
+55
-49
@@ -202,6 +202,12 @@ fn bits_hash(v: &[f32]) -> u64 {
|
||||
fnv(&v.iter().flat_map(|x| x.to_bits().to_le_bytes()).collect::<Vec<u8>>())
|
||||
}
|
||||
|
||||
/// [`bits_hash`] of the samples rounded to 15 mantissa bits. 32 bpc samples go through `powf`, and
|
||||
/// the last bits of its result differ between platforms' math libraries (macOS on Apple silicon).
|
||||
fn near_hash(v: &[f32]) -> u64 {
|
||||
bits_hash(&v.iter().map(|x| f32::from_bits(x.to_bits().wrapping_add(0x80) & !0xff)).collect::<Vec<f32>>())
|
||||
}
|
||||
|
||||
/// Clip-mode EXR samples with an sRGB output, for each colour setup × bit depth × channels.
|
||||
fn exr_clip_hashes(build: Build, channels: &[Channels]) -> Vec<u64> {
|
||||
let mut out = vec![];
|
||||
@@ -210,7 +216,7 @@ fn exr_clip_hashes(build: Build, channels: &[Channels]) -> Vec<u64> {
|
||||
let (p, cid) = build(depth, HdrMode::Clip, ws, linearize, None);
|
||||
for &ch in channels {
|
||||
let d = out_dir(&format!("clip-{ws:?}-{linearize}-{depth:?}-{ch:?}"));
|
||||
out.push(bits_hash(&exr_samples(&render(&p, cid, OutputFormat::ExrSequence, ch, &d, "exr"))));
|
||||
out.push(near_hash(&exr_samples(&render(&p, cid, OutputFormat::ExrSequence, ch, &d, "exr"))));
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
}
|
||||
}
|
||||
@@ -220,41 +226,41 @@ fn exr_clip_hashes(build: Build, channels: &[Channels]) -> Vec<u64> {
|
||||
|
||||
/// [`exr_clip_hashes`] before: Clip-mode EXRs with an sRGB output keep every sample.
|
||||
const EXR_CLIP_GOLDEN: [u64; 36] = [
|
||||
0x9f54fea3d3abcb25,
|
||||
0x9f54fea3d3abcb25,
|
||||
0x008b8f887b9f6d25,
|
||||
0x008b8f887b9f6d25,
|
||||
0x7d40ad9df8600325,
|
||||
0x379f5ef9e35ce325,
|
||||
0x379f5ef9e35ce325,
|
||||
0x5d55eb1dddaa5f25,
|
||||
0x5d55eb1dddaa5f25,
|
||||
0x7d40ad9df8600325,
|
||||
0xb60de6a90263b525,
|
||||
0xb60de6a90263b525,
|
||||
0x41734aa4aa58c525,
|
||||
0x41734aa4aa58c525,
|
||||
0x7d40ad9df8600325,
|
||||
0x9f54fea3d3abcb25,
|
||||
0x9f54fea3d3abcb25,
|
||||
0x008b8f887b9f6d25,
|
||||
0x008b8f887b9f6d25,
|
||||
0x7d40ad9df8600325,
|
||||
0x379f5ef9e35ce325,
|
||||
0x379f5ef9e35ce325,
|
||||
0x5d55eb1dddaa5f25,
|
||||
0x5d55eb1dddaa5f25,
|
||||
0x7d40ad9df8600325,
|
||||
0xb60de6a90263b525,
|
||||
0xb60de6a90263b525,
|
||||
0x41734aa4aa58c525,
|
||||
0x41734aa4aa58c525,
|
||||
0x7d40ad9df8600325,
|
||||
0x27858400549ac325,
|
||||
0x27858400549ac325,
|
||||
0x6f6623e2a3f91d25,
|
||||
0x6f6623e2a3f91d25,
|
||||
0x7d40ad9df8600325,
|
||||
0x379f5ef9e35ce325,
|
||||
0x379f5ef9e35ce325,
|
||||
0x5d55eb1dddaa5f25,
|
||||
0x5d55eb1dddaa5f25,
|
||||
0x7d40ad9df8600325,
|
||||
0xb60de6a90263b525,
|
||||
0xb60de6a90263b525,
|
||||
0x41734aa4aa58c525,
|
||||
0x41734aa4aa58c525,
|
||||
0x7d40ad9df8600325,
|
||||
0x31d03697119d9325,
|
||||
0x31d03697119d9325,
|
||||
0x283ae54f8c799325,
|
||||
0x283ae54f8c799325,
|
||||
0x7d40ad9df8600325,
|
||||
0xff61dc513c834b25,
|
||||
0xff61dc513c834b25,
|
||||
0xa33e57ad0ed75f25,
|
||||
0xa33e57ad0ed75f25,
|
||||
0x7d40ad9df8600325,
|
||||
0x0c57d24a44f45925,
|
||||
0x0c57d24a44f45925,
|
||||
0xb394d882f55d9d25,
|
||||
0xb394d882f55d9d25,
|
||||
0x7d40ad9df8600325,
|
||||
];
|
||||
|
||||
@@ -267,30 +273,30 @@ fn exr_clip_with_srgb_output_is_unchanged() {
|
||||
|
||||
/// [`exr_clip_hashes`] of [`half_project`] before (RGBA premultiplied, RGB over the background).
|
||||
const HALF_EXR_CLIP_GOLDEN: [u64; 24] = [
|
||||
0xe7f7d517df7baf25,
|
||||
0xc9d6dcb2671f9925,
|
||||
0x2fe5733c26d16325,
|
||||
0x8b267197d2645925,
|
||||
0x6fe736332cb80f25,
|
||||
0x30d5f66395d92d25,
|
||||
0xe7f7d517df7baf25,
|
||||
0xc9d6dcb2671f9925,
|
||||
0x2fe5733c26d16325,
|
||||
0x8b267197d2645925,
|
||||
0x6fe736332cb80f25,
|
||||
0x30d5f66395d92d25,
|
||||
0x8c261c1cd9674b25,
|
||||
0xace550c3a8e72925,
|
||||
0xb9bd0b7863b78325,
|
||||
0xdf8e948c5e8af125,
|
||||
0x6fe736332cb80f25,
|
||||
0x30d5f66395d92d25,
|
||||
0xe4aedfefacc80725,
|
||||
0x95ddfccddc885525,
|
||||
0x81fa3c39c1d09725,
|
||||
0x49cc0014f05a1d25,
|
||||
0x4ed1b417cc847725,
|
||||
0x2df6df5ce394d925,
|
||||
0xff7aaead9ab01325,
|
||||
0x3acad0d73898c925,
|
||||
0x43f9a05a72195325,
|
||||
0x3ecc7469546f8125,
|
||||
0x53f3d9bb0c539325,
|
||||
0xc39f1146174d9525,
|
||||
0xff7aaead9ab01325,
|
||||
0x3acad0d73898c925,
|
||||
0x43f9a05a72195325,
|
||||
0x3ecc7469546f8125,
|
||||
0x53f3d9bb0c539325,
|
||||
0xc39f1146174d9525,
|
||||
0x2f1672447511f325,
|
||||
0x24cd9261bb6a2125,
|
||||
0x7860797209347f25,
|
||||
0xfb0c8f2dcb2e5125,
|
||||
0x53f3d9bb0c539325,
|
||||
0xc39f1146174d9525,
|
||||
0xad649b2be4ec3f25,
|
||||
0x604f764e18b99925,
|
||||
0x65d354406ce81b25,
|
||||
0x4d30fabdbcdbe125,
|
||||
0xf125e2282bdd9725,
|
||||
0x00276de880e5e125,
|
||||
];
|
||||
|
||||
/// An Alpha-only EXR holds the alpha (coverage) as it is in every output space: no transfer
|
||||
|
||||
Reference in new issue
Block a user