Add length assertion
All checks were successful
/ tests (push) Successful in 2m32s
/ check (x86_64-unknown-linux-musl) (push) Successful in 6s
/ clippy (push) Successful in 8s
/ check (aarch64-unknown-linux-musl) (push) Successful in 7s
/ check (armv7-unknown-linux-musleabihf) (push) Successful in 6s

This commit is contained in:
asonix 2024-02-18 13:25:39 -06:00
parent 8f79825c2e
commit b1cefd7863

View file

@ -122,6 +122,7 @@ impl Encoder {
for (ComponentState { x, y, .. }, rgb) in self.factors.iter_mut() {
let basis = f32::cos(*x as f32 * scale_x) * f32::cos(*y as f32 * scale_y);
assert_eq!(chunk.len(), rgb.len());
for (val, slot) in chunk
.iter()
.map(|byte| basis * srgb_to_linear(*byte))