Blur: update run test

This commit is contained in:
Simon Gardling 2025-03-27 16:14:42 -04:00
parent 50640efb17
commit 8dd01ab105
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -444,115 +444,116 @@ mod tests {
.collect::<Vec<_>>();
let mut blur = Blur::new(width);
blur.box_blur(
blur.run(
&mut src,
&mut vec![0.0; width * height],
width,
height,
1,
2 as f32,
0.1,
);
let sol = vec![
0.020623347,
0.031088883,
0.03575954,
0.04622508,
0.050895732,
0.06136127,
0.066031925,
0.06618575,
0.055720214,
0.051049553,
0.038047146,
0.05850169,
0.067484796,
0.087939344,
0.09692245,
0.11737699,
0.1263601,
0.12663625,
0.1061817,
0.097198606,
0.040142592,
0.06103797,
0.07035155,
0.091246925,
0.1005605,
0.12145588,
0.13076945,
0.13107346,
0.11017809,
0.100864515,
0.057566393,
0.088450775,
0.102076806,
0.1329612,
0.14658722,
0.1774716,
0.19109762,
0.19152397,
0.16063958,
0.14701356,
0.05966184,
0.09098706,
0.10494356,
0.13626878,
0.15022527,
0.18155049,
0.19550698,
0.19596118,
0.16463596,
0.15067947,
0.077085644,
0.118399866,
0.13666882,
0.17798306,
0.19625197,
0.2375662,
0.25583515,
0.2564117,
0.21509746,
0.19682851,
0.0791811,
0.12093615,
0.13953556,
0.18129064,
0.19989002,
0.24164508,
0.26024452,
0.2608489,
0.21909383,
0.20049442,
0.07922324,
0.12098102,
0.13958256,
0.18134035,
0.19994187,
0.24169965,
0.2603012,
0.26090586,
0.21914804,
0.20054653,
0.06179944,
0.09356822,
0.1078573,
0.13962609,
0.15391515,
0.18568392,
0.19997302,
0.20045534,
0.16868654,
0.15439747,
0.059703995,
0.09103194,
0.10499055,
0.1363185,
0.15027711,
0.18160504,
0.19556366,
0.19601813,
0.16469017,
0.15073158,
0.050528992,
0.044103604,
0.038919702,
0.032494307,
0.027310405,
0.020885015,
0.023104476,
0.020885015,
0.023104476,
0.028288381,
0.043704934,
0.038152207,
0.033674292,
0.028121557,
0.023643643,
0.018090911,
0.020009955,
0.018090911,
0.020009955,
0.024487872,
0.03968891,
0.03461781,
0.03053501,
0.025463907,
0.021381106,
0.016310005,
0.018066125,
0.016310005,
0.018066125,
0.022148928,
0.032864854,
0.028666414,
0.025289603,
0.021091158,
0.017714344,
0.013515903,
0.014971604,
0.013515901,
0.014971604,
0.01834842,
0.02884883,
0.025132021,
0.022150321,
0.018433508,
0.015451807,
0.011734996,
0.013027772,
0.011734993,
0.013027772,
0.016009476,
0.022024775,
0.019180624,
0.016904911,
0.014060758,
0.011785044,
0.008940893,
0.009933252,
0.00894089,
0.009933252,
0.012208968,
0.02513346,
0.021875666,
0.019268055,
0.016010256,
0.013402643,
0.010144847,
0.011281048,
0.010144845,
0.011281048,
0.013888664,
0.022024775,
0.019180622,
0.016904911,
0.014060758,
0.011785044,
0.008940893,
0.009933252,
0.00894089,
0.009933252,
0.012208967,
0.02513346,
0.021875666,
0.019268055,
0.016010256,
0.013402643,
0.010144847,
0.011281048,
0.010144845,
0.011281048,
0.013888664,
0.029149484,
0.02541006,
0.022407336,
0.018667907,
0.015665181,
0.011925754,
0.013224879,
0.011925753,
0.013224879,
0.016227607,
];
for (v1, v2) in src.iter().zip(sol) {
assert!((v1 - v2).abs() < 1e-6, "run failure {} vs {}", v1, v2);