diff --git a/crates/denoise-core/src/run.rs b/crates/denoise-core/src/run.rs index 987a859b9..4314ed8c3 100644 --- a/crates/denoise-core/src/run.rs +++ b/crates/denoise-core/src/run.rs @@ -14,7 +14,7 @@ use crate::manifest::Gain; use crate::tiles::{starts, weight}; /// Most pixels one picture may have (guards the allocations that follow from its size). -pub const MAX_PIXELS: usize = 100_000_000; +pub const MAX_PIXELS: usize = 110_000_000; /// A tile whose mean signal is below this (white = 1) is too dark to measure its scale from. const MIN_SIGNAL: f32 = 0.003; @@ -642,4 +642,19 @@ mod tests { assert!(matches!(denoise_bayer(&[0.5; 16], 4, 4, layout, &Bad(vec![0.0; 5]), &p, &Control::default()), Err(Error::Model(_)))); assert!(matches!(denoise_bayer(&[0.5; 16], 4, 4, layout, &Bad(vec![f32::NAN; 3 * 64 * 64]), &p, &Control::default()), Err(Error::Model(_)))); } + + #[test] + fn accepts_102_mp_inputs_and_rejects_inputs_above_the_limit() { + let layout = Layout { dx: 0, dy: 0 }; + let model = Mock { tile: 32, scale: 1.0 }; + let p = params(32, 8, Gain::None); + assert!(matches!( + denoise_bayer(&[], 11_648, 8_736, layout, &model, &p, &Control::default()), + Err(Error::Input(message)) if message == "the mosaic does not have width × height samples" + )); + assert!(matches!( + denoise_bayer(&[], MAX_PIXELS + 1, 1, layout, &model, &p, &Control::default()), + Err(Error::Input(message)) if message == "the picture has no size, or is too large" + )); + } } diff --git a/docs/denoise.md b/docs/denoise.md index 926b1bee7..7c3f5138f 100644 --- a/docs/denoise.md +++ b/docs/denoise.md @@ -77,7 +77,7 @@ pool. A scalar implementation checks the optimized operators on synthetic networ Tract is not a workspace dependency or a product feature. CPU inference and the GPU model module are feature-gated; ordinary engine/web builds do not compile the faer/GEMM backend. The engine depends on the inference crate only through `denoise = ["dep:lightcraft-denoise", …]`; -lightweight `lightcraft-denoise-core` metadata and cache formats remain available without inference. Pictures are capped at 100 megapixels; at most +lightweight `lightcraft-denoise-core` metadata and cache formats remain available without inference. Pictures are capped at 110 megapixels; at most four tile calls run together, chosen within the process-wide working-memory budget. One idle CPU workspace is retained, and cache costs reserve room for the blended picture.