Files
DarkRoom/core/dr-film/src/tables.rs
T
dtourolleandClaude Opus 5 56978fdf35
🐳 Android image / Build and push (push) Successful in 1s
Build and test / android-image (push) Successful in 1s
Build and test / Desktop (Linux) (push) Failing after 9m6s
Build and test / Layer separation (push) Successful in 26s
Traceability / Requirement traces (push) Failing after 23s
Build and test / Android (aarch64) (push) Failing after 22m38s
Clear the clippy warnings that were failing CI before this branch
Nothing here is film simulation. These are lints that fail master today,
under the -D warnings CI runs with, mostly from a toolchain that learned
new ones rather than from anybody's code -- `is_multiple_of` and the
derivable `Default` did not exist as lints when this was written.

They are fixed rather than allowed, and by hand rather than by trusting
`cargo clippy --fix` wholesale: its automatic pass split a derive in two
and left a stray blank line, which is the sort of thing that is correct
and still wrong to commit.

The four that needed a decision rather than a rewrite:

  - The distance transform's inner loop writes through its iterator now.
    `q` stays, because it is the position the parabola is evaluated at as
    well as the index it is written to -- the lint is about the write.
  - `to_source` and `to_proto` take `self` by value. Their receiver is
    `Copy`, so this is the same machine code and the honest signature.
  - The export path's return type is five levels deep and now has a name,
    plus a line saying why the `Option` wraps the `Result`: `None` is
    cancellation, which is not a failure and has no error to report.
  - A test fills a range instead of looping over one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 22:35:02 +02:00

234 lines
12 KiB
Rust

//! Generated by tools/film-profiles/convert.py. Do not edit.
//!
//! The fixed colour science: the observer, the illuminants and the spectral
//! basis. None of it is per-stock, all of it is published data, and together it
//! is under 6 kB of source -- which is the point. A film simulation's data cost
//! is dominated by whatever it uses to turn a pixel back into a spectrum, and a
//! basis is three curves where a coefficient table is megabytes.
/// The lowest wavelength sampled, in nanometres.
pub const LAMBDA_MIN: f32 = 380.0;
/// The spacing between samples, in nanometres.
pub const LAMBDA_STEP: f32 = 5.0;
/// How many wavelengths every spectral table carries.
///
/// The profiles, the observer and the basis all arrive on this grid already, so
/// nothing in this crate resamples anything.
pub const SPECTRUM: usize = 81;
/// CIE 1931 2-degree standard observer, x-bar/y-bar/z-bar per wavelength.
pub static OBSERVER: [[f32; 3]; SPECTRUM] = [
[0.001368, 3.9e-05, 0.006450001], // 380nm
[0.002236, 6.4e-05, 0.01054999], // 385nm
[0.004243, 0.00012, 0.02005001], // 390nm
[0.00765, 0.000217, 0.03621], // 395nm
[0.01431, 0.000396, 0.06785001], // 400nm
[0.02319, 0.00064, 0.1102], // 405nm
[0.04351, 0.00121, 0.2074], // 410nm
[0.07763, 0.00218, 0.3713], // 415nm
[0.13438, 0.004, 0.6456], // 420nm
[0.21477, 0.0073, 1.03905], // 425nm
[0.2839, 0.0116, 1.3856], // 430nm
[0.3285, 0.01684, 1.62296], // 435nm
[0.34828, 0.023, 1.74706], // 440nm
[0.34806, 0.0298, 1.7826], // 445nm
[0.3362, 0.038, 1.77211], // 450nm
[0.3187, 0.048, 1.7441], // 455nm
[0.2908, 0.06, 1.6692], // 460nm
[0.2511, 0.0739, 1.5281], // 465nm
[0.19536, 0.09098, 1.28764], // 470nm
[0.1421, 0.1126, 1.0419], // 475nm
[0.09564, 0.13902, 0.8129501], // 480nm
[0.05795001, 0.1693, 0.6162], // 485nm
[0.03201, 0.20802, 0.46518], // 490nm
[0.0147, 0.2586, 0.3533], // 495nm
[0.0049, 0.323, 0.272], // 500nm
[0.0024, 0.4073, 0.2123], // 505nm
[0.0093, 0.503, 0.1582], // 510nm
[0.0291, 0.6082, 0.1117], // 515nm
[0.06327, 0.71, 0.07824999], // 520nm
[0.1096, 0.7932, 0.05725001], // 525nm
[0.1655, 0.862, 0.04216], // 530nm
[0.2257499, 0.9148501, 0.02984], // 535nm
[0.2904, 0.954, 0.0203], // 540nm
[0.3597, 0.9803, 0.0134], // 545nm
[0.4334499, 0.9949501, 0.008749999], // 550nm
[0.5120501, 1.0, 0.005749999], // 555nm
[0.5945, 0.995, 0.0039], // 560nm
[0.6784, 0.9786, 0.002749999], // 565nm
[0.7621, 0.952, 0.0021], // 570nm
[0.8425, 0.9154, 0.0018], // 575nm
[0.9163, 0.87, 0.001650001], // 580nm
[0.9786, 0.8163, 0.0014], // 585nm
[1.0263, 0.757, 0.0011], // 590nm
[1.0567, 0.6949, 0.001], // 595nm
[1.0622, 0.631, 0.0008], // 600nm
[1.0456, 0.5668, 0.0006], // 605nm
[1.0026, 0.503, 0.00034], // 610nm
[0.9384, 0.4412, 0.00024], // 615nm
[0.8544499, 0.381, 0.00019], // 620nm
[0.7514, 0.321, 0.0001], // 625nm
[0.6424, 0.265, 4.999999e-05], // 630nm
[0.5419, 0.217, 3e-05], // 635nm
[0.4479, 0.175, 2e-05], // 640nm
[0.3608, 0.1382, 1e-05], // 645nm
[0.2835, 0.107, 2.117582e-22], // 650nm
[0.2187, 0.0816, 0.0], // 655nm
[0.1649, 0.061, 0.0], // 660nm
[0.1212, 0.04458, 0.0], // 665nm
[0.0874, 0.032, 0.0], // 670nm
[0.0636, 0.0232, 0.0], // 675nm
[0.04677, 0.017, 0.0], // 680nm
[0.0329, 0.01192, 0.0], // 685nm
[0.0227, 0.00821, 0.0], // 690nm
[0.01584, 0.005723, 0.0], // 695nm
[0.01135916, 0.004102, 0.0], // 700nm
[0.008110916, 0.002929, 0.0], // 705nm
[0.005790346, 0.002091, 0.0], // 710nm
[0.004109457, 0.001484, 0.0], // 715nm
[0.002899327, 0.001047, 0.0], // 720nm
[0.00204919, 0.00074, 0.0], // 725nm
[0.001439971, 0.00052, 0.0], // 730nm
[0.0009999493, 0.0003611, 0.0], // 735nm
[0.0006900786, 0.0002492, 0.0], // 740nm
[0.0004760213, 0.0001719, 0.0], // 745nm
[0.0003323011, 0.00012, 0.0], // 750nm
[0.0002348261, 8.48e-05, 0.0], // 755nm
[0.0001661505, 6e-05, 0.0], // 760nm
[0.000117413, 4.24e-05, 0.0], // 765nm
[8.307527e-05, 3e-05, 0.0], // 770nm
[5.870652e-05, 2.12e-05, 0.0], // 775nm
[4.150994e-05, 1.499e-05, 0.0], // 780nm
];
/// Mallett & Yuksel (2019) sRGB reflectance basis: the three smooth,
/// non-negative spectra that reconstruct any sRGB colour exactly.
///
/// This is what makes the exposure step a 3x3 matrix rather than a
/// per-pixel spectral integration -- see [`crate::bake`].
pub static SRGB_BASIS: [[f32; 3]; SPECTRUM] = [
[0.3274574, 0.3318617, 0.3406808], // 380nm
[0.3237506, 0.3296882, 0.3465612], // 385nm
[0.3134395, 0.32786, 0.3587005], // 390nm
[0.2888794, 0.3191736, 0.391947], // 395nm
[0.2392057, 0.2943226, 0.4664717], // 400nm
[0.189702, 0.2586971, 0.5516009], // 405nm
[0.1217461, 0.1888943, 0.6893596], // 410nm
[0.07457827, 0.1253884, 0.8000333], // 415nm
[0.04443316, 0.07868706, 0.8768798], // 420nm
[0.02892863, 0.05314327, 0.9179281], // 425nm
[0.02231665, 0.04228815, 0.9353952], // 430nm
[0.01691131, 0.03331835, 0.9497703], // 435nm
[0.01418111, 0.02975595, 0.9560629], // 440nm
[0.01305314, 0.03033125, 0.9566156], // 445nm
[0.01198616, 0.03098857, 0.9570253], // 450nm
[0.01128871, 0.03168635, 0.9570249], // 455nm
[0.01090607, 0.03466996, 0.954424], // 460nm
[0.01040071, 0.03455196, 0.9550473], // 465nm
[0.01063736, 0.04068481, 0.9486778], // 470nm
[0.01090766, 0.05446004, 0.9346323], // 475nm
[0.01103271, 0.08090529, 0.908062], // 480nm
[0.01131066, 0.1463483, 0.842341], // 485nm
[0.01115464, 0.3796796, 0.6091657], // 490nm
[0.01014877, 0.7667443, 0.223107], // 495nm
[0.008918582, 0.8762148, 0.1148667], // 500nm
[0.007685576, 0.9184917, 0.07382277], // 505nm
[0.006705708, 0.9406556, 0.05263873], // 510nm
[0.005995806, 0.9537319, 0.04027231], // 515nm
[0.005537257, 0.9616433, 0.03281946], // 520nm
[0.005193784, 0.9672, 0.0276062], // 525nm
[0.005025362, 0.9709897, 0.02398489], // 530nm
[0.005136363, 0.9728523, 0.02201133], // 535nm
[0.0054332, 0.9731166, 0.0214502], // 540nm
[0.005819986, 0.9733511, 0.02082895], // 545nm
[0.006400573, 0.9733511, 0.02024831], // 550nm
[0.007449529, 0.9722611, 0.02028939], // 555nm
[0.008583636, 0.973351, 0.01806534], // 560nm
[0.01039576, 0.9731485, 0.01645574], // 565nm
[0.01356543, 0.9710613, 0.01537326], // 570nm
[0.01938452, 0.9663713, 0.01424418], // 575nm
[0.03208407, 0.954942, 0.01297396], // 580nm
[0.07435604, 0.913579, 0.01206497], // 585nm
[0.6243937, 0.3643488, 0.01125748], // 590nm
[0.91831, 0.07150724, 0.01018273], // 595nm
[0.949253, 0.04123043, 0.009516535], // 600nm
[0.9581878, 0.03242387, 0.009388293], // 605nm
[0.9581878, 0.03192463, 0.009887619], // 610nm
[0.9581876, 0.03127603, 0.01053634], // 615nm
[0.9556791, 0.03263037, 0.01169057], // 620nm
[0.9580062, 0.02953087, 0.01246297], // 625nm
[0.9541016, 0.03156176, 0.01433667], // 630nm
[0.9476076, 0.03567422, 0.01671817], // 635nm
[0.9386813, 0.041403, 0.01991567], // 640nm
[0.9244667, 0.05060426, 0.02492906], // 645nm
[0.904606, 0.0634343, 0.03195967], // 650nm
[0.8804122, 0.07891824, 0.04066955], // 655nm
[0.8477879, 0.09954274, 0.05266938], // 660nm
[0.8057791, 0.1255958, 0.06862511], // 665nm
[0.7525319, 0.1575909, 0.08987723], // 670nm
[0.6864394, 0.1953982, 0.1181624], // 675nm
[0.6186946, 0.2314745, 0.1498309], // 680nm
[0.5402644, 0.2688521, 0.1908834], // 685nm
[0.4729644, 0.2960292, 0.2310064], // 690nm
[0.4327016, 0.309755, 0.2575434], // 695nm
[0.4053581, 0.3178159, 0.276826], // 700nm
[0.3854918, 0.3229903, 0.2915178], // 705nm
[0.3709836, 0.3263539, 0.3026625], // 710nm
[0.3576087, 0.3291439, 0.3132473], // 715nm
[0.3487128, 0.3308087, 0.3204783], // 720nm
[0.3448801, 0.3314827, 0.323637], // 725nm
[0.3419179, 0.3319845, 0.3260973], // 730nm
[0.3395311, 0.3323412, 0.3281274], // 735nm
[0.3371695, 0.332912, 0.329918], // 740nm
[0.336172, 0.3329193, 0.3309079], // 745nm
[0.3351674, 0.3330277, 0.3318036], // 750nm
[0.3344216, 0.3331797, 0.3323966], // 755nm
[0.3340088, 0.333247, 0.3327408], // 760nm
[0.3339158, 0.3332594, 0.3328209], // 765nm
[0.3338184, 0.3332751, 0.3329017], // 770nm
[0.3336728, 0.3332943, 0.333026], // 775nm
[0.3335695, 0.3333094, 0.3331111], // 780nm
];
/// CIE standard illuminant D50, normalised to unit mean.
pub static ILLUMINANT_D50: [f32; SPECTRUM] = [
0.2850091, 0.3163289, 0.3476603, 0.4607654, 0.5738822, 0.6158049, 0.6577392, 0.6782233,
0.6987191, 0.6858234, 0.6729277, 0.7718918, 0.8708675, 0.9431556, 1.015444, 1.035032, 1.054608,
1.059008, 1.063407, 1.085171, 1.106947, 1.08864, 1.070332, 1.092213, 1.114105, 1.119284,
1.124452, 1.127455, 1.130458, 1.15938, 1.188302, 1.180481, 1.17266, 1.181749, 1.190839,
1.177362, 1.163872, 1.150697, 1.137511, 1.144401, 1.151279, 1.119738, 1.088209, 1.11258,
1.136964, 1.146158, 1.155364, 1.154038, 1.152723, 1.133402, 1.114082, 1.132331, 1.150569,
1.132005, 1.113442, 1.12813, 1.142806, 1.170821, 1.198824, 1.176303, 1.153782, 1.085392,
1.017003, 1.041573, 1.066154, 1.073626, 1.081109, 0.9878018, 0.8944825, 0.9506859, 1.006878,
1.042201, 1.077513, 0.9940052, 0.9104973, 0.7909793, 0.6714613, 0.8182837, 0.9651179,
0.9380695, 0.9110095,
];
/// CIE standard illuminant D55, normalised to unit mean.
pub static ILLUMINANT_D55: [f32; SPECTRUM] = [
0.3792827, 0.4113047, 0.4433384, 0.576397, 0.7094555, 0.7537114, 0.7979789, 0.8155671,
0.833167, 0.8118539, 0.7905292, 0.8934979, 0.9964551, 1.068554, 1.140653, 1.155029, 1.169404,
1.166203, 1.163002, 1.17945, 1.195897, 1.168776, 1.141643, 1.156786, 1.17193, 1.172024,
1.172105, 1.167984, 1.163864, 1.188436, 1.21302, 1.200751, 1.188483, 1.193523, 1.198563,
1.181289, 1.164015, 1.147812, 1.131609, 1.134705, 1.137813, 1.101042, 1.064282, 1.081673,
1.099051, 1.103254, 1.107444, 1.102089, 1.096735, 1.074782, 1.052828, 1.063782, 1.074735,
1.054504, 1.034274, 1.042795, 1.051303, 1.072442, 1.093592, 1.070347, 1.047101, 0.9872826,
0.9274523, 0.9458553, 0.9642701, 0.9759335, 0.9875969, 0.9025656, 0.817546, 0.8703108,
0.9230756, 0.9562034, 0.9893313, 0.9130185, 0.836694, 0.725612, 0.6145185, 0.7491601,
0.8838017, 0.8598812, 0.8359723,
];
/// CIE standard illuminant D65, normalised to unit mean.
pub static ILLUMINANT_D65: [f32; SPECTRUM] = [
0.5707279, 0.5974089, 0.6240909, 0.7845818, 0.9450738, 0.9949285, 1.044784, 1.055895, 1.067006,
1.028465, 0.9899253, 1.093749, 1.197574, 1.266906, 1.33625, 1.34084, 1.345431, 1.328575,
1.31173, 1.317794, 1.323859, 1.283249, 1.242638, 1.245733, 1.24884, 1.239978, 1.231116,
1.213917, 1.196718, 1.213266, 1.229825, 1.211073, 1.192321, 1.190266, 1.188221, 1.165118,
1.142016, 1.121083, 1.100151, 1.097033, 1.093914, 1.053359, 1.012803, 1.020344, 1.027885,
1.02556, 1.023236, 1.012384, 1.001533, 0.9763502, 0.9511687, 0.9535133, 0.9558578, 0.9348881,
0.9139185, 0.9149908, 0.9160632, 0.9278442, 0.9396252, 0.9168215, 0.8940177, 0.8451223,
0.796228, 0.8070075, 0.817787, 0.8334315, 0.8490771, 0.7763022, 0.7035272, 0.7508158,
0.7981044, 0.8278048, 0.8575052, 0.7918713, 0.7262385, 0.6281702, 0.530103, 0.6465155,
0.762928, 0.7433847, 0.7238414,
];