-
Notifications
You must be signed in to change notification settings - Fork 48
Description
p3Luminance uses following coefficients:
// See SMPTE EG 432-1, Equation 7-8.
static const float kP3R = 0.20949f, kP3G = 0.72160f, kP3B = 0.06891f;However, the NPM in Equation 7-8 is inferred based on white point (0.314, 0.351), which is P3-DCI, not Display-P3 (0.3127, 0.3290). From the context and comments in gainmapmath.cpp, the P3 used by this library should refer to Display-P3. If so, the following coefficients should be used according to SMPTE EG 432-1, Equation G-7:
static const float kP3R = 0.22897f, kP3G = 0.69174f, kP3B = 0.07929f;In addition, there is a question here. The coefficients used in p3RgbToYuv function is BT601. The comment says:
// Unfortunately, calculation of luma signal differs from calculation of
// luminance for Display-P3, so we can't reuse p3Luminance here.
static const float kP3YR = 0.299f, kP3YG = 0.587f, kP3YB = 0.114f;
static const float kP3Cb = 1.772f, kP3Cr = 1.402f;As I understand it, the reason of P3`s calculation of luma signal differs from luminance is that Display-P3 standard does not define the RgbToYuv coefficients explicitly. The same calculation can be used for BT601, BT709, BT2100 as they all have RgbToYuv coefficients explicitly defined. In my view, cofficients calculation in BT* series is according to RP177 protocol by given color primaries, the Display-P3 RgbToYuv coefficients according to RP177 is:
// same with SMPTE EG 432-1, Equation G-7
static const float kP3YR = 0.229f, kP3YG = 0.6917f, kP3YB = 0.0793f;
static const float kP3Cb = 1.8414f, kP3Cr = 1.542f;May be this coefficients shoud be used in p3RgbToYuv. In my experiments, the two version coefficients result in different jpeg visuals.
If I undersand wrongly, could you give me an explanation why BT601 is used here instead of BT709 or something else? Thx