renderer/cm: higher-quality tonemapping (#12204)

This commit is contained in:
Dominick DiMaggio 2025-12-07 12:58:49 -05:00 committed by GitHub
parent ca99e8228c
commit 532ca053d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 53 additions and 25 deletions

View file

@ -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();