Files
photocraft/crates
Claude b8b8483bf9 fix(algo): seam carving never panics on degenerate input; NaN never steers seams
From an adversarial review of the Content-Aware Scale speed-up:

- resize_bilinear with zero channels panicked (chunk size 0) since the
  previous commit; it, carve_with and carve_width_with now return early
  when there are no pixels or channels, or fewer values than the size
  says (sizes checked with checked_mul). carve with an empty width and
  a height change, and a protection map shorter than the image (now
  ignored), panicked before this series too.
- With NaN in the energy map, which seam was chosen depended on the NaN
  payload, and that differed between builds. NaN samples now give the
  highest energy and NaN protection protects nothing, so costs are never
  NaN; outputs without NaN are unchanged (all pins match).

Tests: degenerate_inputs_do_not_panic and nan_payloads_do_not_steer_seams
(both failed before), proxy_rebuild_observes_cancellation (a cancel during
the tall-image rebuild), and NaN/inf cases in incremental_dp_matches_full_dp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LELc5BQzgV5dA7dxdMejkK
2026-10-13 18:08:45 +00:00
..
…