From 532ca053d6d7ca4afd0b7980b91fcb5bb09da552 Mon Sep 17 00:00:00 2001 From: Dominick DiMaggio Date: Sun, 7 Dec 2025 12:58:49 -0500 Subject: renderer/cm: higher-quality tonemapping (#12204) --- src/protocols/types/ColorManagement.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/protocols') diff --git a/src/protocols/types/ColorManagement.hpp b/src/protocols/types/ColorManagement.hpp index 435e50df..8bb30e8e 100644 --- a/src/protocols/types/ColorManagement.hpp +++ b/src/protocols/types/ColorManagement.hpp @@ -6,8 +6,10 @@ #define SDR_MIN_LUMINANCE 0.2 #define SDR_MAX_LUMINANCE 80.0 +#define SDR_REF_LUMINANCE 80.0 #define HDR_MIN_LUMINANCE 0.005 #define HDR_MAX_LUMINANCE 10000.0 +#define HDR_REF_LUMINANCE 203.0 #define HLG_MAX_LUMINANCE 1000.0 namespace NColorManagement { @@ -229,6 +231,25 @@ namespace NColorManagement { } }; + float getTFRefLuminance(int sdrRefLuminance = -1) const { + switch (transferFunction) { + case CM_TRANSFER_FUNCTION_EXT_LINEAR: + case CM_TRANSFER_FUNCTION_ST2084_PQ: + case CM_TRANSFER_FUNCTION_HLG: return HDR_REF_LUMINANCE; + case CM_TRANSFER_FUNCTION_GAMMA22: + case CM_TRANSFER_FUNCTION_GAMMA28: + case CM_TRANSFER_FUNCTION_BT1886: + case CM_TRANSFER_FUNCTION_ST240: + case CM_TRANSFER_FUNCTION_LOG_100: + case CM_TRANSFER_FUNCTION_LOG_316: + case CM_TRANSFER_FUNCTION_XVYCC: + case CM_TRANSFER_FUNCTION_EXT_SRGB: + case CM_TRANSFER_FUNCTION_ST428: + case CM_TRANSFER_FUNCTION_SRGB: + default: return sdrRefLuminance >= 0 ? sdrRefLuminance : SDR_REF_LUMINANCE; + } + }; + uint32_t findId() const; uint32_t getId() const; uint32_t updateId(); -- cgit v1.2.3