mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-28 12:08:10 -06:00
Three changes, each leaving the output bit for bit as it was: - Each step runs only where the tile's output depends on it (choice ±0, homogeneity ±1, Lab ±2, greens ±3, mosaic ±5 inside the 6 px margin), with direct neighbour indices instead of an index clamped on every read; the clamped values at the buffer edge never reached the output. - A candidate pixel is built in registers before its Lab conversion: writing its channels through an index and reading the pixel back stalled on store forwarding (the hottest instructions of the profile). - Tiles are written into the output one band at a time, instead of all 64 MP of tiles being collected and then copied (797 MB held twice). Tiles inside the image copy their mosaic rows instead of reflecting and taking a modulo per sample. Sony ILCE-7RM6 9984 × 6656 Compressed HQ raw, demosaic only, best of 5 on 4 cores: 1.85 s → 1.05 s wall, 6.3 s → 4.0 s CPU. Verified identical (f32 bits) on 7 real raws (ILCE-7RM6 FF/APS-C, ARW6 HQ/C and lossless, ILCE-7RM4A) and, against the previous code, on random mosaics of all four Bayer layouts at 1 × 1 … 300 × 7, 257 × 130 (tile edges, reflection). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>