summaryrefslogtreecommitdiff
path: root/src/protocols
diff options
context:
space:
mode:
authorDominick DiMaggio <ddimaggio324@gmail.com>2025-12-07 12:58:49 -0500
committerGitHub <noreply@github.com>2025-12-07 17:58:49 +0000
commit532ca053d6d7ca4afd0b7980b91fcb5bb09da552 (patch)
treefe5c4681b19857131042c9b396071f9fe254f812 /src/protocols
parentca99e8228cd3b2fa062d74f16c0531f217d722b2 (diff)
renderer/cm: higher-quality tonemapping (#12204)
Diffstat (limited to 'src/protocols')
-rw-r--r--src/protocols/types/ColorManagement.hpp21
1 files changed, 21 insertions, 0 deletions
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();