mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Verified our levels() against Adobe Photoshop 2026 (adjustLevels on a 0..255 ramp): exact for gamma<=1 and all input/output ranges, but a pure u^(1/gamma) has infinite slope at black while Photoshop bounds the shadow toe to initial slope 2^gamma. Added a soft-min (p-norm) of the power curve with that line, applied only for gamma>1; reduces to the exact power curve in the body, so highlights/midtones and gamma<=1 are unchanged. GPU Levels LUT is built from this fn, so GPU stays in sync (gpu parity 18/18). Corpus oracle: levels_grayscale.psd max error 0.043 -> 0.0078 (bad px 4.1% -> 0.1%); 113 pass / 30 differ unchanged (no regressions). Golden test pins the curve to captured Photoshop samples (gamma 2 toe within 4/255). Co-Authored-By: Claude Opus 4.8 <[email protected]>