_bc_interp_lut_snorm clamped a -128 endpoint to -127 before the red_0 > red_1
test. D3D's BC4_SNORM rule compares the stored int8 endpoints and reads -128
as -127 only as a value (DirectXTex and Pillow decode it that way), so the
pair 0x81, 0x80 (-127 > -128) is an eight-value block with every entry -1.0.
The clamp made the endpoints equal, took the six-value ramp, and index 7
decoded to +1.0 (255) instead of 0. It is the only one of the 65,536 pairs
whose ramp changes.
Tested: new test_snorm_ramp_is_chosen_by_the_raw_endpoints (BC4S and BC5S,
fails before the fix); all 65,536 BC5_SNORM endpoint pairs x 8 indices match
Pillow 12.3 within 1 (one 255-off mismatch before).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When previewing/saving PNG in CLI main(), if os.replace fails after
shutil.copymode set the destination's permissions, resetting os.chmod to
0o600 ensures TemporaryDirectory cleanup does not fail with PermissionError
on Windows if the output was read-only.
agent: yes
AI-assisted: yes
Carry the DXGI transfer function through alpha-weighted preview resizing. Keep RGBA8 quantization stable on dark ties and cover the PNG bytes for tagged and untagged textures (BUILD-1087).
dds_png.py had no tests, so header parsing, the BC block decoders and the
PNG writer were only ever checked by eye. These cases pin the exact pixel
output of BC1, BC2, BC3, BC4 and BC5 against hand-computed values, plus
the uncompressed swizzles, the box-filter downscaler and the PNG chunks.