Skip to content

Commit

Permalink
Align with KDFS 1.3.2 rounding update
Browse files Browse the repository at this point in the history
  • Loading branch information
solidpixel committed Feb 7, 2025
1 parent d66e8a1 commit 6e04e17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
11 changes: 2 additions & 9 deletions Source/astcenc_color_unquantize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,15 +925,8 @@ void unpack_color_endpoints(
alpha_hdr = false;
}

vmask4 mask(true, true, true, false);

vint4 output0rgb = lsl<8>(output0) | vint4(0x80);
vint4 output0a = output0 * 257;
output0 = select(output0a, output0rgb, mask);

vint4 output1rgb = lsl<8>(output1) | vint4(0x80);
vint4 output1a = output1 * 257;
output1 = select(output1a, output1rgb, mask);
output0 = lsl<8>(output0) | vint4(0x80);
output1 = lsl<8>(output1) | vint4(0x80);
}
// An HDR profile decode, but may be using linear LDR endpoints
// Linear LDR 8-bit endpoints are expanded to 16-bit by replication
Expand Down
14 changes: 4 additions & 10 deletions Source/astcenc_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1583,19 +1583,13 @@ static inline vmask4 get_u8_component_mask(
astcenc_profile decode_mode,
const image_block& blk
) {
vmask4 u8_mask(false);
// Decode mode writing to a unorm8 output value
if (blk.decode_unorm8)
// Decode mode or sRGB forces writing to unorm8 output value
if (blk.decode_unorm8 || decode_mode == ASTCENC_PRF_LDR_SRGB)
{
u8_mask = vmask4(true);
}
// SRGB writing to a unorm8 RGB value
else if (decode_mode == ASTCENC_PRF_LDR_SRGB)
{
u8_mask = vmask4(true, true, true, false);
return vmask4(true);
}

return u8_mask;
return vmask4(false);
}

/**
Expand Down

0 comments on commit 6e04e17

Please sign in to comment.