Clear the clippy warnings that were failing CI before this branch
🐳 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
🐳 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
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>
This commit is contained in:
@@ -1201,7 +1201,8 @@ mod tests {
|
|||||||
let heap = GPS_IFD + 2 + 12 + 4;
|
let heap = GPS_IFD + 2 + 12 + 4;
|
||||||
let mut extra = Vec::new();
|
let mut extra = Vec::new();
|
||||||
extra.extend_from_slice(&1u16.to_le_bytes());
|
extra.extend_from_slice(&1u16.to_le_bytes());
|
||||||
for (tag, kind, count, value) in [(gps_tag::LATITUDE, 5u16, 3u32, heap)] {
|
{
|
||||||
|
let (tag, kind, count, value) = (gps_tag::LATITUDE, 5u16, 3u32, heap);
|
||||||
extra.extend_from_slice(&tag.to_le_bytes());
|
extra.extend_from_slice(&tag.to_le_bytes());
|
||||||
extra.extend_from_slice(&kind.to_le_bytes());
|
extra.extend_from_slice(&kind.to_le_bytes());
|
||||||
extra.extend_from_slice(&count.to_le_bytes());
|
extra.extend_from_slice(&count.to_le_bytes());
|
||||||
|
|||||||
+66
-68
@@ -27,7 +27,7 @@ pub static OBSERVER: [[f32; 3]; SPECTRUM] = [
|
|||||||
[0.04351, 0.00121, 0.2074], // 410nm
|
[0.04351, 0.00121, 0.2074], // 410nm
|
||||||
[0.07763, 0.00218, 0.3713], // 415nm
|
[0.07763, 0.00218, 0.3713], // 415nm
|
||||||
[0.13438, 0.004, 0.6456], // 420nm
|
[0.13438, 0.004, 0.6456], // 420nm
|
||||||
[0.21477, 0.0073, 1.03905], // 425nm
|
[0.21477, 0.0073, 1.03905], // 425nm
|
||||||
[0.2839, 0.0116, 1.3856], // 430nm
|
[0.2839, 0.0116, 1.3856], // 430nm
|
||||||
[0.3285, 0.01684, 1.62296], // 435nm
|
[0.3285, 0.01684, 1.62296], // 435nm
|
||||||
[0.34828, 0.023, 1.74706], // 440nm
|
[0.34828, 0.023, 1.74706], // 440nm
|
||||||
@@ -72,7 +72,7 @@ pub static OBSERVER: [[f32; 3]; SPECTRUM] = [
|
|||||||
[0.5419, 0.217, 3e-05], // 635nm
|
[0.5419, 0.217, 3e-05], // 635nm
|
||||||
[0.4479, 0.175, 2e-05], // 640nm
|
[0.4479, 0.175, 2e-05], // 640nm
|
||||||
[0.3608, 0.1382, 1e-05], // 645nm
|
[0.3608, 0.1382, 1e-05], // 645nm
|
||||||
[0.2835, 0.107, 2.117582e-22], // 650nm
|
[0.2835, 0.107, 2.117582e-22], // 650nm
|
||||||
[0.2187, 0.0816, 0.0], // 655nm
|
[0.2187, 0.0816, 0.0], // 655nm
|
||||||
[0.1649, 0.061, 0.0], // 660nm
|
[0.1649, 0.061, 0.0], // 660nm
|
||||||
[0.1212, 0.04458, 0.0], // 665nm
|
[0.1212, 0.04458, 0.0], // 665nm
|
||||||
@@ -109,127 +109,125 @@ pub static OBSERVER: [[f32; 3]; SPECTRUM] = [
|
|||||||
pub static SRGB_BASIS: [[f32; 3]; SPECTRUM] = [
|
pub static SRGB_BASIS: [[f32; 3]; SPECTRUM] = [
|
||||||
[0.3274574, 0.3318617, 0.3406808], // 380nm
|
[0.3274574, 0.3318617, 0.3406808], // 380nm
|
||||||
[0.3237506, 0.3296882, 0.3465612], // 385nm
|
[0.3237506, 0.3296882, 0.3465612], // 385nm
|
||||||
[0.3134395, 0.32786, 0.3587005], // 390nm
|
[0.3134395, 0.32786, 0.3587005], // 390nm
|
||||||
[0.2888794, 0.3191736, 0.391947], // 395nm
|
[0.2888794, 0.3191736, 0.391947], // 395nm
|
||||||
[0.2392057, 0.2943226, 0.4664717], // 400nm
|
[0.2392057, 0.2943226, 0.4664717], // 400nm
|
||||||
[0.189702, 0.2586971, 0.5516009], // 405nm
|
[0.189702, 0.2586971, 0.5516009], // 405nm
|
||||||
[0.1217461, 0.1888943, 0.6893596], // 410nm
|
[0.1217461, 0.1888943, 0.6893596], // 410nm
|
||||||
[0.07457827, 0.1253884, 0.8000333], // 415nm
|
[0.07457827, 0.1253884, 0.8000333], // 415nm
|
||||||
[0.04443316, 0.07868706, 0.8768798], // 420nm
|
[0.04443316, 0.07868706, 0.8768798], // 420nm
|
||||||
[0.02892863, 0.05314327, 0.9179281], // 425nm
|
[0.02892863, 0.05314327, 0.9179281], // 425nm
|
||||||
[0.02231665, 0.04228815, 0.9353952], // 430nm
|
[0.02231665, 0.04228815, 0.9353952], // 430nm
|
||||||
[0.01691131, 0.03331835, 0.9497703], // 435nm
|
[0.01691131, 0.03331835, 0.9497703], // 435nm
|
||||||
[0.01418111, 0.02975595, 0.9560629], // 440nm
|
[0.01418111, 0.02975595, 0.9560629], // 440nm
|
||||||
[0.01305314, 0.03033125, 0.9566156], // 445nm
|
[0.01305314, 0.03033125, 0.9566156], // 445nm
|
||||||
[0.01198616, 0.03098857, 0.9570253], // 450nm
|
[0.01198616, 0.03098857, 0.9570253], // 450nm
|
||||||
[0.01128871, 0.03168635, 0.9570249], // 455nm
|
[0.01128871, 0.03168635, 0.9570249], // 455nm
|
||||||
[0.01090607, 0.03466996, 0.954424], // 460nm
|
[0.01090607, 0.03466996, 0.954424], // 460nm
|
||||||
[0.01040071, 0.03455196, 0.9550473], // 465nm
|
[0.01040071, 0.03455196, 0.9550473], // 465nm
|
||||||
[0.01063736, 0.04068481, 0.9486778], // 470nm
|
[0.01063736, 0.04068481, 0.9486778], // 470nm
|
||||||
[0.01090766, 0.05446004, 0.9346323], // 475nm
|
[0.01090766, 0.05446004, 0.9346323], // 475nm
|
||||||
[0.01103271, 0.08090529, 0.908062], // 480nm
|
[0.01103271, 0.08090529, 0.908062], // 480nm
|
||||||
[0.01131066, 0.1463483, 0.842341], // 485nm
|
[0.01131066, 0.1463483, 0.842341], // 485nm
|
||||||
[0.01115464, 0.3796796, 0.6091657], // 490nm
|
[0.01115464, 0.3796796, 0.6091657], // 490nm
|
||||||
[0.01014877, 0.7667443, 0.223107], // 495nm
|
[0.01014877, 0.7667443, 0.223107], // 495nm
|
||||||
[0.008918582, 0.8762148, 0.1148667], // 500nm
|
[0.008918582, 0.8762148, 0.1148667], // 500nm
|
||||||
[0.007685576, 0.9184917, 0.07382277], // 505nm
|
[0.007685576, 0.9184917, 0.07382277], // 505nm
|
||||||
[0.006705708, 0.9406556, 0.05263873], // 510nm
|
[0.006705708, 0.9406556, 0.05263873], // 510nm
|
||||||
[0.005995806, 0.9537319, 0.04027231], // 515nm
|
[0.005995806, 0.9537319, 0.04027231], // 515nm
|
||||||
[0.005537257, 0.9616433, 0.03281946], // 520nm
|
[0.005537257, 0.9616433, 0.03281946], // 520nm
|
||||||
[0.005193784, 0.9672, 0.0276062], // 525nm
|
[0.005193784, 0.9672, 0.0276062], // 525nm
|
||||||
[0.005025362, 0.9709897, 0.02398489], // 530nm
|
[0.005025362, 0.9709897, 0.02398489], // 530nm
|
||||||
[0.005136363, 0.9728523, 0.02201133], // 535nm
|
[0.005136363, 0.9728523, 0.02201133], // 535nm
|
||||||
[0.0054332, 0.9731166, 0.0214502], // 540nm
|
[0.0054332, 0.9731166, 0.0214502], // 540nm
|
||||||
[0.005819986, 0.9733511, 0.02082895], // 545nm
|
[0.005819986, 0.9733511, 0.02082895], // 545nm
|
||||||
[0.006400573, 0.9733511, 0.02024831], // 550nm
|
[0.006400573, 0.9733511, 0.02024831], // 550nm
|
||||||
[0.007449529, 0.9722611, 0.02028939], // 555nm
|
[0.007449529, 0.9722611, 0.02028939], // 555nm
|
||||||
[0.008583636, 0.973351, 0.01806534], // 560nm
|
[0.008583636, 0.973351, 0.01806534], // 560nm
|
||||||
[0.01039576, 0.9731485, 0.01645574], // 565nm
|
[0.01039576, 0.9731485, 0.01645574], // 565nm
|
||||||
[0.01356543, 0.9710613, 0.01537326], // 570nm
|
[0.01356543, 0.9710613, 0.01537326], // 570nm
|
||||||
[0.01938452, 0.9663713, 0.01424418], // 575nm
|
[0.01938452, 0.9663713, 0.01424418], // 575nm
|
||||||
[0.03208407, 0.954942, 0.01297396], // 580nm
|
[0.03208407, 0.954942, 0.01297396], // 580nm
|
||||||
[0.07435604, 0.913579, 0.01206497], // 585nm
|
[0.07435604, 0.913579, 0.01206497], // 585nm
|
||||||
[0.6243937, 0.3643488, 0.01125748], // 590nm
|
[0.6243937, 0.3643488, 0.01125748], // 590nm
|
||||||
[0.91831, 0.07150724, 0.01018273], // 595nm
|
[0.91831, 0.07150724, 0.01018273], // 595nm
|
||||||
[0.949253, 0.04123043, 0.009516535], // 600nm
|
[0.949253, 0.04123043, 0.009516535], // 600nm
|
||||||
[0.9581878, 0.03242387, 0.009388293], // 605nm
|
[0.9581878, 0.03242387, 0.009388293], // 605nm
|
||||||
[0.9581878, 0.03192463, 0.009887619], // 610nm
|
[0.9581878, 0.03192463, 0.009887619], // 610nm
|
||||||
[0.9581876, 0.03127603, 0.01053634], // 615nm
|
[0.9581876, 0.03127603, 0.01053634], // 615nm
|
||||||
[0.9556791, 0.03263037, 0.01169057], // 620nm
|
[0.9556791, 0.03263037, 0.01169057], // 620nm
|
||||||
[0.9580062, 0.02953087, 0.01246297], // 625nm
|
[0.9580062, 0.02953087, 0.01246297], // 625nm
|
||||||
[0.9541016, 0.03156176, 0.01433667], // 630nm
|
[0.9541016, 0.03156176, 0.01433667], // 630nm
|
||||||
[0.9476076, 0.03567422, 0.01671817], // 635nm
|
[0.9476076, 0.03567422, 0.01671817], // 635nm
|
||||||
[0.9386813, 0.041403, 0.01991567], // 640nm
|
[0.9386813, 0.041403, 0.01991567], // 640nm
|
||||||
[0.9244667, 0.05060426, 0.02492906], // 645nm
|
[0.9244667, 0.05060426, 0.02492906], // 645nm
|
||||||
[0.904606, 0.0634343, 0.03195967], // 650nm
|
[0.904606, 0.0634343, 0.03195967], // 650nm
|
||||||
[0.8804122, 0.07891824, 0.04066955], // 655nm
|
[0.8804122, 0.07891824, 0.04066955], // 655nm
|
||||||
[0.8477879, 0.09954274, 0.05266938], // 660nm
|
[0.8477879, 0.09954274, 0.05266938], // 660nm
|
||||||
[0.8057791, 0.1255958, 0.06862511], // 665nm
|
[0.8057791, 0.1255958, 0.06862511], // 665nm
|
||||||
[0.7525319, 0.1575909, 0.08987723], // 670nm
|
[0.7525319, 0.1575909, 0.08987723], // 670nm
|
||||||
[0.6864394, 0.1953982, 0.1181624], // 675nm
|
[0.6864394, 0.1953982, 0.1181624], // 675nm
|
||||||
[0.6186946, 0.2314745, 0.1498309], // 680nm
|
[0.6186946, 0.2314745, 0.1498309], // 680nm
|
||||||
[0.5402644, 0.2688521, 0.1908834], // 685nm
|
[0.5402644, 0.2688521, 0.1908834], // 685nm
|
||||||
[0.4729644, 0.2960292, 0.2310064], // 690nm
|
[0.4729644, 0.2960292, 0.2310064], // 690nm
|
||||||
[0.4327016, 0.309755, 0.2575434], // 695nm
|
[0.4327016, 0.309755, 0.2575434], // 695nm
|
||||||
[0.4053581, 0.3178159, 0.276826], // 700nm
|
[0.4053581, 0.3178159, 0.276826], // 700nm
|
||||||
[0.3854918, 0.3229903, 0.2915178], // 705nm
|
[0.3854918, 0.3229903, 0.2915178], // 705nm
|
||||||
[0.3709836, 0.3263539, 0.3026625], // 710nm
|
[0.3709836, 0.3263539, 0.3026625], // 710nm
|
||||||
[0.3576087, 0.3291439, 0.3132473], // 715nm
|
[0.3576087, 0.3291439, 0.3132473], // 715nm
|
||||||
[0.3487128, 0.3308087, 0.3204783], // 720nm
|
[0.3487128, 0.3308087, 0.3204783], // 720nm
|
||||||
[0.3448801, 0.3314827, 0.323637], // 725nm
|
[0.3448801, 0.3314827, 0.323637], // 725nm
|
||||||
[0.3419179, 0.3319845, 0.3260973], // 730nm
|
[0.3419179, 0.3319845, 0.3260973], // 730nm
|
||||||
[0.3395311, 0.3323412, 0.3281274], // 735nm
|
[0.3395311, 0.3323412, 0.3281274], // 735nm
|
||||||
[0.3371695, 0.332912, 0.329918], // 740nm
|
[0.3371695, 0.332912, 0.329918], // 740nm
|
||||||
[0.336172, 0.3329193, 0.3309079], // 745nm
|
[0.336172, 0.3329193, 0.3309079], // 745nm
|
||||||
[0.3351674, 0.3330277, 0.3318036], // 750nm
|
[0.3351674, 0.3330277, 0.3318036], // 750nm
|
||||||
[0.3344216, 0.3331797, 0.3323966], // 755nm
|
[0.3344216, 0.3331797, 0.3323966], // 755nm
|
||||||
[0.3340088, 0.333247, 0.3327408], // 760nm
|
[0.3340088, 0.333247, 0.3327408], // 760nm
|
||||||
[0.3339158, 0.3332594, 0.3328209], // 765nm
|
[0.3339158, 0.3332594, 0.3328209], // 765nm
|
||||||
[0.3338184, 0.3332751, 0.3329017], // 770nm
|
[0.3338184, 0.3332751, 0.3329017], // 770nm
|
||||||
[0.3336728, 0.3332943, 0.333026], // 775nm
|
[0.3336728, 0.3332943, 0.333026], // 775nm
|
||||||
[0.3335695, 0.3333094, 0.3331111], // 780nm
|
[0.3335695, 0.3333094, 0.3331111], // 780nm
|
||||||
];
|
];
|
||||||
|
|
||||||
/// CIE standard illuminant D50, normalised to unit mean.
|
/// CIE standard illuminant D50, normalised to unit mean.
|
||||||
pub static ILLUMINANT_D50: [f32; SPECTRUM] = [
|
pub static ILLUMINANT_D50: [f32; SPECTRUM] = [
|
||||||
0.2850091, 0.3163289, 0.3476603, 0.4607654, 0.5738822, 0.6158049, 0.6577392, 0.6782233,
|
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,
|
0.6987191, 0.6858234, 0.6729277, 0.7718918, 0.8708675, 0.9431556, 1.015444, 1.035032, 1.054608,
|
||||||
1.054608, 1.059008, 1.063407, 1.085171, 1.106947, 1.08864, 1.070332, 1.092213,
|
1.059008, 1.063407, 1.085171, 1.106947, 1.08864, 1.070332, 1.092213, 1.114105, 1.119284,
|
||||||
1.114105, 1.119284, 1.124452, 1.127455, 1.130458, 1.15938, 1.188302, 1.180481,
|
1.124452, 1.127455, 1.130458, 1.15938, 1.188302, 1.180481, 1.17266, 1.181749, 1.190839,
|
||||||
1.17266, 1.181749, 1.190839, 1.177362, 1.163872, 1.150697, 1.137511, 1.144401,
|
1.177362, 1.163872, 1.150697, 1.137511, 1.144401, 1.151279, 1.119738, 1.088209, 1.11258,
|
||||||
1.151279, 1.119738, 1.088209, 1.11258, 1.136964, 1.146158, 1.155364, 1.154038,
|
1.136964, 1.146158, 1.155364, 1.154038, 1.152723, 1.133402, 1.114082, 1.132331, 1.150569,
|
||||||
1.152723, 1.133402, 1.114082, 1.132331, 1.150569, 1.132005, 1.113442, 1.12813,
|
1.132005, 1.113442, 1.12813, 1.142806, 1.170821, 1.198824, 1.176303, 1.153782, 1.085392,
|
||||||
1.142806, 1.170821, 1.198824, 1.176303, 1.153782, 1.085392, 1.017003, 1.041573,
|
1.017003, 1.041573, 1.066154, 1.073626, 1.081109, 0.9878018, 0.8944825, 0.9506859, 1.006878,
|
||||||
1.066154, 1.073626, 1.081109, 0.9878018, 0.8944825, 0.9506859, 1.006878, 1.042201,
|
1.042201, 1.077513, 0.9940052, 0.9104973, 0.7909793, 0.6714613, 0.8182837, 0.9651179,
|
||||||
1.077513, 0.9940052, 0.9104973, 0.7909793, 0.6714613, 0.8182837, 0.9651179, 0.9380695,
|
0.9380695, 0.9110095,
|
||||||
0.9110095,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/// CIE standard illuminant D55, normalised to unit mean.
|
/// CIE standard illuminant D55, normalised to unit mean.
|
||||||
pub static ILLUMINANT_D55: [f32; SPECTRUM] = [
|
pub static ILLUMINANT_D55: [f32; SPECTRUM] = [
|
||||||
0.3792827, 0.4113047, 0.4433384, 0.576397, 0.7094555, 0.7537114, 0.7979789, 0.8155671,
|
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,
|
0.833167, 0.8118539, 0.7905292, 0.8934979, 0.9964551, 1.068554, 1.140653, 1.155029, 1.169404,
|
||||||
1.169404, 1.166203, 1.163002, 1.17945, 1.195897, 1.168776, 1.141643, 1.156786,
|
1.166203, 1.163002, 1.17945, 1.195897, 1.168776, 1.141643, 1.156786, 1.17193, 1.172024,
|
||||||
1.17193, 1.172024, 1.172105, 1.167984, 1.163864, 1.188436, 1.21302, 1.200751,
|
1.172105, 1.167984, 1.163864, 1.188436, 1.21302, 1.200751, 1.188483, 1.193523, 1.198563,
|
||||||
1.188483, 1.193523, 1.198563, 1.181289, 1.164015, 1.147812, 1.131609, 1.134705, 1.137813,
|
1.181289, 1.164015, 1.147812, 1.131609, 1.134705, 1.137813, 1.101042, 1.064282, 1.081673,
|
||||||
1.101042, 1.064282, 1.081673, 1.099051, 1.103254, 1.107444, 1.102089, 1.096735,
|
1.099051, 1.103254, 1.107444, 1.102089, 1.096735, 1.074782, 1.052828, 1.063782, 1.074735,
|
||||||
1.074782, 1.052828, 1.063782, 1.074735, 1.054504, 1.034274, 1.042795, 1.051303,
|
1.054504, 1.034274, 1.042795, 1.051303, 1.072442, 1.093592, 1.070347, 1.047101, 0.9872826,
|
||||||
1.072442, 1.093592, 1.070347, 1.047101, 0.9872826, 0.9274523, 0.9458553, 0.9642701,
|
0.9274523, 0.9458553, 0.9642701, 0.9759335, 0.9875969, 0.9025656, 0.817546, 0.8703108,
|
||||||
0.9759335, 0.9875969, 0.9025656, 0.817546, 0.8703108, 0.9230756, 0.9562034, 0.9893313,
|
0.9230756, 0.9562034, 0.9893313, 0.9130185, 0.836694, 0.725612, 0.6145185, 0.7491601,
|
||||||
0.9130185, 0.836694, 0.725612, 0.6145185, 0.7491601, 0.8838017, 0.8598812, 0.8359723,
|
0.8838017, 0.8598812, 0.8359723,
|
||||||
];
|
];
|
||||||
|
|
||||||
/// CIE standard illuminant D65, normalised to unit mean.
|
/// CIE standard illuminant D65, normalised to unit mean.
|
||||||
pub static ILLUMINANT_D65: [f32; SPECTRUM] = [
|
pub static ILLUMINANT_D65: [f32; SPECTRUM] = [
|
||||||
0.5707279, 0.5974089, 0.6240909, 0.7845818, 0.9450738, 0.9949285, 1.044784, 1.055895,
|
0.5707279, 0.5974089, 0.6240909, 0.7845818, 0.9450738, 0.9949285, 1.044784, 1.055895, 1.067006,
|
||||||
1.067006, 1.028465, 0.9899253, 1.093749, 1.197574, 1.266906, 1.33625, 1.34084,
|
1.028465, 0.9899253, 1.093749, 1.197574, 1.266906, 1.33625, 1.34084, 1.345431, 1.328575,
|
||||||
1.345431, 1.328575, 1.31173, 1.317794, 1.323859, 1.283249, 1.242638, 1.245733,
|
1.31173, 1.317794, 1.323859, 1.283249, 1.242638, 1.245733, 1.24884, 1.239978, 1.231116,
|
||||||
1.24884, 1.239978, 1.231116, 1.213917, 1.196718, 1.213266, 1.229825, 1.211073,
|
1.213917, 1.196718, 1.213266, 1.229825, 1.211073, 1.192321, 1.190266, 1.188221, 1.165118,
|
||||||
1.192321, 1.190266, 1.188221, 1.165118, 1.142016, 1.121083, 1.100151, 1.097033,
|
1.142016, 1.121083, 1.100151, 1.097033, 1.093914, 1.053359, 1.012803, 1.020344, 1.027885,
|
||||||
1.093914, 1.053359, 1.012803, 1.020344, 1.027885, 1.02556, 1.023236, 1.012384,
|
1.02556, 1.023236, 1.012384, 1.001533, 0.9763502, 0.9511687, 0.9535133, 0.9558578, 0.9348881,
|
||||||
1.001533, 0.9763502, 0.9511687, 0.9535133, 0.9558578, 0.9348881, 0.9139185, 0.9149908,
|
0.9139185, 0.9149908, 0.9160632, 0.9278442, 0.9396252, 0.9168215, 0.8940177, 0.8451223,
|
||||||
0.9160632, 0.9278442, 0.9396252, 0.9168215, 0.8940177, 0.8451223, 0.796228, 0.8070075,
|
0.796228, 0.8070075, 0.817787, 0.8334315, 0.8490771, 0.7763022, 0.7035272, 0.7508158,
|
||||||
0.817787, 0.8334315, 0.8490771, 0.7763022, 0.7035272, 0.7508158, 0.7981044, 0.8278048,
|
0.7981044, 0.8278048, 0.8575052, 0.7918713, 0.7262385, 0.6281702, 0.530103, 0.6465155,
|
||||||
0.8575052, 0.7918713, 0.7262385, 0.6281702, 0.530103, 0.6465155, 0.762928, 0.7433847,
|
0.762928, 0.7433847, 0.7238414,
|
||||||
0.7238414,
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -165,7 +165,12 @@ fn film_key(t: &dr_pipeline::ops::FilmTables) -> u64 {
|
|||||||
mix(v.to_bits());
|
mix(v.to_bits());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for v in [t.curve_log_min, t.curve_log_max, t.density_max, t.lut_size as f32] {
|
for v in [
|
||||||
|
t.curve_log_min,
|
||||||
|
t.curve_log_max,
|
||||||
|
t.density_max,
|
||||||
|
t.lut_size as f32,
|
||||||
|
] {
|
||||||
mix(v.to_bits());
|
mix(v.to_bits());
|
||||||
}
|
}
|
||||||
for e in t.lut.iter().step_by(8).chain(t.curves.iter().step_by(8)) {
|
for e in t.lut.iter().step_by(8).chain(t.curves.iter().step_by(8)) {
|
||||||
@@ -228,7 +233,11 @@ impl AdjustPass {
|
|||||||
let lut = self.upload_film(
|
let lut = self.upload_film(
|
||||||
"adjust-film-lut",
|
"adjust-film-lut",
|
||||||
wgpu::TextureDimension::D3,
|
wgpu::TextureDimension::D3,
|
||||||
wgpu::Extent3d { width: n, height: n, depth_or_array_layers: n },
|
wgpu::Extent3d {
|
||||||
|
width: n,
|
||||||
|
height: n,
|
||||||
|
depth_or_array_layers: n,
|
||||||
|
},
|
||||||
&to_rgba(&t.lut),
|
&to_rgba(&t.lut),
|
||||||
);
|
);
|
||||||
self.film = Some(FilmTextures { curves, lut, key });
|
self.film = Some(FilmTextures { curves, lut, key });
|
||||||
@@ -282,7 +291,9 @@ impl AdjustPass {
|
|||||||
|
|
||||||
/// The curve texture to bind: the loaded stock's, or the placeholder.
|
/// The curve texture to bind: the loaded stock's, or the placeholder.
|
||||||
fn film_curves_view(&self) -> &wgpu::TextureView {
|
fn film_curves_view(&self) -> &wgpu::TextureView {
|
||||||
self.film.as_ref().map_or(&self.empty_film_curves, |f| &f.curves)
|
self.film
|
||||||
|
.as_ref()
|
||||||
|
.map_or(&self.empty_film_curves, |f| &f.curves)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The density lookup to bind: the loaded stock's, or the placeholder.
|
/// The density lookup to bind: the loaded stock's, or the placeholder.
|
||||||
@@ -352,7 +363,11 @@ impl AdjustPass {
|
|||||||
.device
|
.device
|
||||||
.create_texture(&wgpu::TextureDescriptor {
|
.create_texture(&wgpu::TextureDescriptor {
|
||||||
label: Some("adjust-empty-film-curves"),
|
label: Some("adjust-empty-film-curves"),
|
||||||
size: wgpu::Extent3d { width: 1, height: 1, depth_or_array_layers: 1 },
|
size: wgpu::Extent3d {
|
||||||
|
width: 1,
|
||||||
|
height: 1,
|
||||||
|
depth_or_array_layers: 1,
|
||||||
|
},
|
||||||
mip_level_count: 1,
|
mip_level_count: 1,
|
||||||
sample_count: 1,
|
sample_count: 1,
|
||||||
dimension: wgpu::TextureDimension::D2,
|
dimension: wgpu::TextureDimension::D2,
|
||||||
@@ -365,7 +380,11 @@ impl AdjustPass {
|
|||||||
.device
|
.device
|
||||||
.create_texture(&wgpu::TextureDescriptor {
|
.create_texture(&wgpu::TextureDescriptor {
|
||||||
label: Some("adjust-empty-film-lut"),
|
label: Some("adjust-empty-film-lut"),
|
||||||
size: wgpu::Extent3d { width: 1, height: 1, depth_or_array_layers: 1 },
|
size: wgpu::Extent3d {
|
||||||
|
width: 1,
|
||||||
|
height: 1,
|
||||||
|
depth_or_array_layers: 1,
|
||||||
|
},
|
||||||
mip_level_count: 1,
|
mip_level_count: 1,
|
||||||
sample_count: 1,
|
sample_count: 1,
|
||||||
dimension: wgpu::TextureDimension::D3,
|
dimension: wgpu::TextureDimension::D3,
|
||||||
|
|||||||
@@ -296,7 +296,11 @@ fn the_threshold_leaves_shallow_modulation_where_it_found_it() {
|
|||||||
// under the 12.5% at which the gate below starts letting detail through.
|
// under the 12.5% at which the gate below starts letting detail through.
|
||||||
let ripple: Vec<u8> = (0..SIZE * SIZE)
|
let ripple: Vec<u8> = (0..SIZE * SIZE)
|
||||||
.flat_map(|i| {
|
.flat_map(|i| {
|
||||||
let v = if (i % SIZE) % 2 == 0 { 128u8 } else { 132 };
|
let v = if (i % SIZE).is_multiple_of(2) {
|
||||||
|
128u8
|
||||||
|
} else {
|
||||||
|
132
|
||||||
|
};
|
||||||
[v, v, v, 255]
|
[v, v, v, 255]
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ fn a_difference_below_the_threshold_is_averaged_and_one_above_it_is_not() {
|
|||||||
/// [`chroma_r`] is what keeps it out of the measurements.
|
/// [`chroma_r`] is what keeps it out of the measurements.
|
||||||
fn chroma_pattern(ctx: &GpuContext, size: u32, half_period: u32, swing: i32) -> DemosaicedImage {
|
fn chroma_pattern(ctx: &GpuContext, size: u32, half_period: u32, swing: i32) -> DemosaicedImage {
|
||||||
upload(ctx, size, move |x, _| {
|
upload(ctx, size, move |x, _| {
|
||||||
let on = (x / half_period) % 2 == 0;
|
let on = (x / half_period).is_multiple_of(2);
|
||||||
let d = if on { swing } else { -swing };
|
let d = if on { swing } else { -swing };
|
||||||
[(128 + d) as u8, 128, (128 - d) as u8]
|
[(128 + d) as u8, 128, (128 - d) as u8]
|
||||||
})
|
})
|
||||||
@@ -244,7 +244,7 @@ fn modulation(
|
|||||||
let mut count = 0.0;
|
let mut count = 0.0;
|
||||||
for x in margin..(width - margin) {
|
for x in margin..(width - margin) {
|
||||||
let value = sample(linear(pixels, width, x, row));
|
let value = sample(linear(pixels, width, x, row));
|
||||||
let sign = if (x / half_period) % 2 == 0 {
|
let sign = if (x / half_period).is_multiple_of(2) {
|
||||||
1.0
|
1.0
|
||||||
} else {
|
} else {
|
||||||
-1.0
|
-1.0
|
||||||
|
|||||||
@@ -707,7 +707,7 @@ pub fn compose_full(
|
|||||||
" // The camera profile's base curve and the conversion out of camera\n // space are both absent: an operation declaring `Operation::renders`\n // has done both, and doing them again would render the picture twice.\n"
|
" // The camera profile's base curve and the conversion out of camera\n // space are both absent: an operation declaring `Operation::renders`\n // has done both, and doing them again would render the picture twice.\n"
|
||||||
.to_string()
|
.to_string()
|
||||||
} else {
|
} else {
|
||||||
" // ==== camera profile: the base curve (FR-DEV-3e) ====
|
" // ==== camera profile: the base curve (FR-DEV-3e) ====
|
||||||
//
|
//
|
||||||
// Marked with `====` and not the `----` an operation block carries: this
|
// Marked with `====` and not the `----` an operation block carries: this
|
||||||
// is not one, and the difference is what several tests count on to tell
|
// is not one, and the difference is what several tests count on to tell
|
||||||
|
|||||||
@@ -183,12 +183,15 @@ fn transform(f: &[f32], out: &mut [f32], v: &mut [usize], z: &mut [f32]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
k = 0;
|
k = 0;
|
||||||
for q in 0..n {
|
// `q` is both the position and the value the parabola is evaluated at, so
|
||||||
|
// it stays; what changes is that the write goes through the iterator
|
||||||
|
// rather than re-indexing `out` on every step.
|
||||||
|
for (q, slot) in out.iter_mut().enumerate().take(n) {
|
||||||
while z[k + 1] < q as f32 {
|
while z[k + 1] < q as f32 {
|
||||||
k += 1;
|
k += 1;
|
||||||
}
|
}
|
||||||
let p = v[k];
|
let p = v[k];
|
||||||
out[q] = (q as f32 - p as f32).powi(2) + f[p];
|
*slot = (q as f32 - p as f32).powi(2) + f[p];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,13 +417,13 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn an_empty_mask_is_everywhere_outside() {
|
fn an_empty_mask_is_everywhere_outside() {
|
||||||
let d = signed_distance(&vec![0u8; 16], 4, 4, 128);
|
let d = signed_distance(&[0u8; 16], 4, 4, 128);
|
||||||
assert!(d.iter().all(|&v| v < 0.0), "no pixel can be inside");
|
assert!(d.iter().all(|&v| v < 0.0), "no pixel can be inside");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_full_mask_is_everywhere_inside() {
|
fn a_full_mask_is_everywhere_inside() {
|
||||||
let d = signed_distance(&vec![255u8; 16], 4, 4, 128);
|
let d = signed_distance(&[255u8; 16], 4, 4, 128);
|
||||||
assert!(d.iter().all(|&v| v > 0.0), "no pixel can be outside");
|
assert!(d.iter().all(|&v| v > 0.0), "no pixel can be outside");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,9 +551,7 @@ mod tests {
|
|||||||
// M5: masks reach the sidecar as indices, so the field they are shaped
|
// M5: masks reach the sidecar as indices, so the field they are shaped
|
||||||
// by has to be reproducible.
|
// by has to be reproducible.
|
||||||
let mut m = vec![0u8; 64];
|
let mut m = vec![0u8; 64];
|
||||||
for i in 20..30 {
|
m[20..30].fill(255);
|
||||||
m[i] = 255;
|
|
||||||
}
|
|
||||||
let a = signed_distance(&m, 8, 8, 128);
|
let a = signed_distance(&m, 8, 8, 128);
|
||||||
let b = signed_distance(&m, 8, 8, 128);
|
let b = signed_distance(&m, 8, 8, 128);
|
||||||
assert_eq!(a, b);
|
assert_eq!(a, b);
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn a_wrong_sized_mask_is_an_error_not_a_panic() {
|
fn a_wrong_sized_mask_is_an_error_not_a_panic() {
|
||||||
let f = field();
|
let f = field();
|
||||||
let err = Membership::compute(&f, &[&vec![0.0; 3]], &PriorOptions::default()).unwrap_err();
|
let err = Membership::compute(&f, &[&[0.0; 3]], &PriorOptions::default()).unwrap_err();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
err,
|
err,
|
||||||
MembershipError::MaskSize {
|
MembershipError::MaskSize {
|
||||||
|
|||||||
@@ -56,13 +56,14 @@ const DETECTION_STRIDE: usize = 6 + PROTOTYPES;
|
|||||||
const PROTO_STRIDE: usize = 4;
|
const PROTO_STRIDE: usize = 4;
|
||||||
|
|
||||||
/// How the image is presented to a fixed-shape graph.
|
/// How the image is presented to a fixed-shape graph.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
||||||
pub enum Tiling {
|
pub enum Tiling {
|
||||||
/// One inference over the whole frame, letterboxed into the square input.
|
/// One inference over the whole frame, letterboxed into the square input.
|
||||||
///
|
///
|
||||||
/// The default, and the right default: a photographic subject is usually
|
/// The default, and the right default: a photographic subject is usually
|
||||||
/// *large* in frame, which is the case whole-image inference handles best
|
/// *large* in frame, which is the case whole-image inference handles best
|
||||||
/// and the case tiling helps least.
|
/// and the case tiling helps least.
|
||||||
|
#[default]
|
||||||
Whole,
|
Whole,
|
||||||
/// Cover the frame with overlapping fixed-size windows.
|
/// Cover the frame with overlapping fixed-size windows.
|
||||||
///
|
///
|
||||||
@@ -77,12 +78,6 @@ pub enum Tiling {
|
|||||||
Grid { overlap: f32 },
|
Grid { overlap: f32 },
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Tiling {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Whole
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// How the semantic pass is tuned.
|
/// How the semantic pass is tuned.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct SemanticOptions {
|
pub struct SemanticOptions {
|
||||||
@@ -515,7 +510,7 @@ impl Letterbox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Input-space box back to source pixels.
|
/// Input-space box back to source pixels.
|
||||||
fn to_source(&self, x0: f32, y0: f32, x1: f32, y1: f32, w: &Window) -> (f32, f32, f32, f32) {
|
fn to_source(self, x0: f32, y0: f32, x1: f32, y1: f32, w: &Window) -> (f32, f32, f32, f32) {
|
||||||
(
|
(
|
||||||
(x0 - self.pad_x) / self.scale + w.x,
|
(x0 - self.pad_x) / self.scale + w.x,
|
||||||
(y0 - self.pad_y) / self.scale + w.y,
|
(y0 - self.pad_y) / self.scale + w.y,
|
||||||
@@ -525,7 +520,7 @@ impl Letterbox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Source pixel to prototype-grid coordinates.
|
/// Source pixel to prototype-grid coordinates.
|
||||||
fn to_proto(&self, sx: f32, sy: f32, w: &Window) -> (f32, f32) {
|
fn to_proto(self, sx: f32, sy: f32, w: &Window) -> (f32, f32) {
|
||||||
(
|
(
|
||||||
((sx - w.x) * self.scale + self.pad_x) / PROTO_STRIDE as f32,
|
((sx - w.x) * self.scale + self.pad_x) / PROTO_STRIDE as f32,
|
||||||
((sy - w.y) * self.scale + self.pad_y) / PROTO_STRIDE as f32,
|
((sy - w.y) * self.scale + self.pad_y) / PROTO_STRIDE as f32,
|
||||||
|
|||||||
+18
-18
@@ -2936,6 +2936,24 @@ fn unit_suffix(unit: Unit) -> &'static str {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `dr_pipeline`'s morphology, as `dr_segment` names it.
|
||||||
|
///
|
||||||
|
/// Two enums for one idea, and deliberately: `dr-pipeline` describes the
|
||||||
|
/// *edit* and `dr-segment` implements the *transform*, and neither depends on
|
||||||
|
/// the other. The crossing is this function, which the compiler makes
|
||||||
|
/// exhaustive on both sides.
|
||||||
|
fn morphology_for(m: dr_pipeline::mask::Morphology) -> dr_segment::Morphology {
|
||||||
|
use dr_pipeline::mask::Morphology as Edit;
|
||||||
|
use dr_segment::Morphology as Transform;
|
||||||
|
match m {
|
||||||
|
Edit::None => Transform::None,
|
||||||
|
Edit::Dilate => Transform::Dilate,
|
||||||
|
Edit::Erode => Transform::Erode,
|
||||||
|
Edit::Close => Transform::Close,
|
||||||
|
Edit::Open => Transform::Open,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
@@ -4712,21 +4730,3 @@ mod tests {
|
|||||||
assert_eq!(session.rows().len(), all);
|
assert_eq!(session.rows().len(), all);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `dr_pipeline`'s morphology, as `dr_segment` names it.
|
|
||||||
///
|
|
||||||
/// Two enums for one idea, and deliberately: `dr-pipeline` describes the
|
|
||||||
/// *edit* and `dr-segment` implements the *transform*, and neither depends on
|
|
||||||
/// the other. The crossing is this function, which the compiler makes
|
|
||||||
/// exhaustive on both sides.
|
|
||||||
fn morphology_for(m: dr_pipeline::mask::Morphology) -> dr_segment::Morphology {
|
|
||||||
use dr_pipeline::mask::Morphology as Edit;
|
|
||||||
use dr_segment::Morphology as Transform;
|
|
||||||
match m {
|
|
||||||
Edit::None => Transform::None,
|
|
||||||
Edit::Dilate => Transform::Dilate,
|
|
||||||
Edit::Erode => Transform::Erode,
|
|
||||||
Edit::Close => Transform::Close,
|
|
||||||
Edit::Open => Transform::Open,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+14
-11
@@ -672,23 +672,26 @@ fn carried_metadata(meta: &dr_decode::Metadata) -> dr_export::SourceMetadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// One rendered photograph on its way to a file: the name it will be written
|
||||||
|
/// under, the name it came from, the pixels, and whatever metadata travelled
|
||||||
|
/// with them.
|
||||||
|
type RenderedItem = (
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
dr_export::Frame,
|
||||||
|
Option<dr_export::SourceMetadata>,
|
||||||
|
);
|
||||||
|
|
||||||
/// Fetch a photograph, apply its stored edit, and render it at full size.
|
/// Fetch a photograph, apply its stored edit, and render it at full size.
|
||||||
|
///
|
||||||
|
/// `None` means the work was cancelled, which is not a failure and has no
|
||||||
|
/// error to report — hence the `Option` outside the `Result`.
|
||||||
fn render_from_library(
|
fn render_from_library(
|
||||||
request: &BatchRequest,
|
request: &BatchRequest,
|
||||||
path: &str,
|
path: &str,
|
||||||
cache: Option<crate::library::CacheContext>,
|
cache: Option<crate::library::CacheContext>,
|
||||||
cancel: &Cancel,
|
cancel: &Cancel,
|
||||||
) -> Option<
|
) -> Option<Result<RenderedItem, ItemError>> {
|
||||||
Result<
|
|
||||||
(
|
|
||||||
String,
|
|
||||||
String,
|
|
||||||
dr_export::Frame,
|
|
||||||
Option<dr_export::SourceMetadata>,
|
|
||||||
),
|
|
||||||
ItemError,
|
|
||||||
>,
|
|
||||||
> {
|
|
||||||
let Some((creds, user_id)) = request.creds.clone() else {
|
let Some((creds, user_id)) = request.creds.clone() else {
|
||||||
return Some(Err(ItemError::Fetch("no library is open".into())));
|
return Some(Err(ItemError::Fetch("no library is open".into())));
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user