mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-24 18:18:17 -06:00
Problem: `read_exr_channels` kept the exr crate's whole decoded image alive while it built every f32 plane, and copied each channel through an extra `Vec` (`values_as_f32().collect()`) before placing it. One decode of a 2560x1440 Blender file with 32 channels briefly held ~320 MB of samples next to ~470 MB of planes, per concurrently decoded frame. Fix: consume the decoded image channel by channel, so each channel's samples are freed (or moved) as its plane is made. A channel that covers exactly the display window is converted in one pass, and an f32 one (Cryptomatte ranks) becomes its plane without a copy; other channels are placed into the display window with bounds-checked indexing, as before. Keeping half channels as f16 and sizing the channel cache by bytes stay open. Test: a full-window f32 channel's plane is the same allocation; f16 / u32 channels and offset or clipped data windows are placed as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>