mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-23 08:15:57 +02:00
The 32-bit branch cut the slider to floor(|s| * 255) / 255, which only matches Photoshop near 25 and 50 %: measured at every whole percent from -100 to +100 on a 32-bit document, Photoshop lowers by 1 - floor(|s| * 256) / 256 and raises by 255 / (255 - floor(s * 254)) taken to 1/256 and capped at 32767/256 (201 of 201 exact). +100 gave 512x where Photoshop gives 128x, +90 9.8x for 9.44x. It also kept the HSL saturation unclipped, which is inf at HSL lightness 1 and 0 and negative above 1: (2, 0, 0), red at +1 stop, turned NaN with any edit, Hue +40 alone included, where Photoshop gives (2, 1.333, 0). The 32-bit branch now scales the chroma around the lightness instead (same result in gamut), on the CPU and in the shader, in whole numbers on both. Colorize clamps its saturation before the 32-bit scaling, so a PSD's out-of-range value renders the same on the GPU. Tests (fail without this): thirty_two_bit_saturation_steps_match_photoshop, thirty_two_bit_hue_saturation_keeps_bright_colours, the GPU parity hdr_hue_saturation_bright_colours. Photoshop-oracle floor 188 -> 190 of 258, measured after merging main. Co-authored-by: Timothy Daly <100327160+timothydaly1@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>