[client] fix the HDR colorspace mapping to SDR
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled

This commit is contained in:
Geoffrey McRae
2026-07-16 20:25:20 +10:00
parent ef8a4e2923
commit adb4fcb57a

View File

@@ -102,7 +102,12 @@ vec3 bt2020to709(vec3 bt2020)
vec3 mapToSDR(vec3 color, float gain, bool pq)
{
if (pq)
{
// HDR10: PQ-encoded BT.2020. Linearise then convert the gamut to BT.709.
color = pq2lin(color.rgb, gain);
color = bt2020to709(color);
}
// else: scRGB is already linear BT.709 (1.0 == SDR white), so no EOTF or
// gamut conversion is required - only highlight compression below.
return lin2srgb(compress(color));
}