mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Color Management: Improve display color interop IDs
* Add more color spaces from the latest display interop ID recommendation. * Add and improve CICP mappings. * g24_rec709_display become an official interop ID, remove blender prefix. * Fallback to alias or color space name for finding a color space from an interop ID, for falling back to corresponding scene interop ID and compatibility with older configs. Pull Request: https://projects.blender.org/blender/blender/pulls/163006
This commit is contained in:
parent
736a2df10a
commit
17920f1da3
5 changed files with 84 additions and 25 deletions
|
|
@ -182,14 +182,14 @@ display_colorspaces:
|
|||
|
||||
- !<ColorSpace>
|
||||
name: Rec.2020
|
||||
aliases: [g24_rec2020_display, blender:g24_rec2020_display, BT.2020, BT.2020 2.4, BT.2020 I-D65, Rec.1886 / Rec.2020 Video - Display, rec1886_rec2020_display, rec1886_rec2020_video_display, Rec.1886 Rec.2020 - Display, "Rec1886: 2.4 Gamma - Rec.2020"]
|
||||
aliases: [g24_rec2020_display, BT.2020, BT.2020 2.4, BT.2020 I-D65, Rec.1886 / Rec.2020 Video - Display, rec1886_rec2020_display, rec1886_rec2020_video_display, Rec.1886 Rec.2020 - Display, "Rec1886: 2.4 Gamma - Rec.2020"]
|
||||
family: Display
|
||||
equalitygroup:
|
||||
bitdepth: 32f
|
||||
description: |
|
||||
BT.2020 2.4 Exponent EOTF Display
|
||||
isdata: false
|
||||
interop_id: blender:g24_rec2020_display
|
||||
interop_id: g24_rec2020_display
|
||||
interchange:
|
||||
icc_profile_name: g24_rec2020_display.icc
|
||||
from_display_reference: !<GroupTransform>
|
||||
|
|
@ -517,7 +517,7 @@ colorspaces:
|
|||
|
||||
- !<ColorSpace>
|
||||
name: Linear Rec.709
|
||||
aliases: [lin_rec709_scene, Linear, Linear BT.709, Linear BT.709 I-D65, Linear Tristimulus, linrec709, Utility - Linear - sRGB, Utility - Linear - Rec.709, lin_srgb, Linear Rec.709 (sRGB), lin_rec709_srgb, lin_rec709, lin_srgb, "CGI: Linear - Rec.709"]
|
||||
aliases: [lin_rec709_scene, lin_rec709_display, Linear, Linear BT.709, Linear BT.709 I-D65, Linear Tristimulus, linrec709, Utility - Linear - sRGB, Utility - Linear - Rec.709, lin_srgb, Linear Rec.709 (sRGB), lin_rec709_srgb, lin_rec709, lin_srgb, "CGI: Linear - Rec.709"]
|
||||
family: Linear
|
||||
equalitygroup:
|
||||
bitdepth: 32f
|
||||
|
|
@ -532,7 +532,7 @@ colorspaces:
|
|||
|
||||
- !<ColorSpace>
|
||||
name: Linear DCI-P3 D65
|
||||
aliases: [lin_p3d65_scene, Linear DCI-P3 I-D65, Linear P3-D65, lin_p3d65, Utility - Linear - P3-D65, Apple DCI-P3 D65]
|
||||
aliases: [lin_p3d65_scene, lin_p3d65_display, Linear DCI-P3 I-D65, Linear P3-D65, lin_p3d65, Utility - Linear - P3-D65, Apple DCI-P3 D65]
|
||||
family: Linear
|
||||
equalitygroup:
|
||||
bitdepth: 32f
|
||||
|
|
@ -547,7 +547,7 @@ colorspaces:
|
|||
|
||||
- !<ColorSpace>
|
||||
name: Linear Rec.2020
|
||||
aliases: [lin_rec2020_scene, Linear BT.2020 I-D65, Linear BT.2020, lin_rec2020, Utility - Linear - Rec.2020]
|
||||
aliases: [lin_rec2020_scene, lin_rec2020_display, Linear BT.2020 I-D65, Linear BT.2020, lin_rec2020, Utility - Linear - Rec.2020]
|
||||
family: Linear
|
||||
equalitygroup:
|
||||
bitdepth: 32f
|
||||
|
|
@ -1121,7 +1121,7 @@ colorspaces:
|
|||
|
||||
- !<ColorSpace>
|
||||
name: Gamma 2.2 Encoded Rec.709
|
||||
aliases: [g22_rec709_scene, g22_rec709, Gamma 2.2 Rec.709 - Texture, Utility - Gamma 2.2 - Rec.709 - Texture, sRGB 2.2]
|
||||
aliases: [g22_rec709_scene, g22_rec709_display, g22_rec709, Gamma 2.2 Rec.709 - Texture, Utility - Gamma 2.2 - Rec.709 - Texture, sRGB 2.2]
|
||||
family: Utility
|
||||
equalitygroup:
|
||||
bitdepth: 32f
|
||||
|
|
|
|||
|
|
@ -1107,13 +1107,15 @@ Vector<char> IMB_colormanagement_space_to_icc_profile(const ColorSpace *colorspa
|
|||
/* Primaries */
|
||||
static const int CICP_PRI_REC709 = 1;
|
||||
static const int CICP_PRI_REC2020 = 9;
|
||||
static const int CICP_PRI_XYZD65 = 10;
|
||||
static const int CICP_PRI_P3D65 = 12;
|
||||
/* Transfer functions */
|
||||
static const int CICP_TRC_BT709 = 1;
|
||||
static const int CICP_TRC_G22 = 4;
|
||||
static const int CICP_TRC_LINEAR = 8;
|
||||
static const int CICP_TRC_SRGB = 13;
|
||||
static const int CICP_TRC_PQ = 16;
|
||||
static const int CICP_TRC_G26 = 17;
|
||||
static const int CICP_TRC_SMPTE428 = 17;
|
||||
static const int CICP_TRC_HLG = 18;
|
||||
/* Matrix */
|
||||
static const int CICP_MATRIX_RGB = 0;
|
||||
|
|
@ -1159,22 +1161,34 @@ bool IMB_colormanagement_space_to_cicp(const ColorSpace *colorspace,
|
|||
cicp[3] = CICP_RANGE_FULL;
|
||||
return true;
|
||||
}
|
||||
if (interop_id == "g26_p3d65_display") {
|
||||
/* BT.709 matrix may seem odd, but follows Color Interop Forum recommendation. */
|
||||
cicp[0] = CICP_PRI_P3D65;
|
||||
cicp[1] = CICP_TRC_G26;
|
||||
cicp[2] = (rgb_matrix) ? CICP_MATRIX_RGB : CICP_MATRIX_BT709;
|
||||
if (interop_id == "pq_xyzd65_display") {
|
||||
cicp[0] = CICP_PRI_XYZD65;
|
||||
cicp[1] = CICP_TRC_PQ;
|
||||
cicp[2] = CICP_MATRIX_RGB;
|
||||
cicp[3] = CICP_RANGE_FULL;
|
||||
return true;
|
||||
}
|
||||
if (interop_id == "g22_rec709_display") {
|
||||
if (interop_id == "g26_xyzd65_display") {
|
||||
cicp[0] = CICP_PRI_XYZD65;
|
||||
cicp[1] = CICP_TRC_SMPTE428;
|
||||
cicp[2] = CICP_MATRIX_RGB;
|
||||
cicp[3] = CICP_RANGE_FULL;
|
||||
return true;
|
||||
}
|
||||
if (interop_id == "g26_p3d65_display") {
|
||||
/* One might think the same transfer function as g26_xyzd65_display can be
|
||||
* used here. But actually it's that one has headroom scaling, and this one
|
||||
* does not. And there is no CICP for regular gamma 2.6. */
|
||||
return false;
|
||||
}
|
||||
if (ELEM(interop_id, "g22_rec709_display", "g22_rec709_scene")) {
|
||||
cicp[0] = CICP_PRI_REC709;
|
||||
cicp[1] = CICP_TRC_G22;
|
||||
cicp[2] = (rgb_matrix) ? CICP_MATRIX_RGB : CICP_MATRIX_BT709;
|
||||
cicp[3] = CICP_RANGE_FULL;
|
||||
return true;
|
||||
}
|
||||
if (interop_id == "blender:g24_rec2020_display") {
|
||||
if (ELEM(interop_id, "g24_rec2020_display", "g24_rec2020_scene")) {
|
||||
/* There is no gamma 2.4 TRC, but BT.709 is close. */
|
||||
cicp[0] = CICP_PRI_REC2020;
|
||||
cicp[1] = CICP_TRC_BT709;
|
||||
|
|
@ -1182,7 +1196,7 @@ bool IMB_colormanagement_space_to_cicp(const ColorSpace *colorspace,
|
|||
cicp[3] = CICP_RANGE_FULL;
|
||||
return true;
|
||||
}
|
||||
if (interop_id == "g24_rec709_display") {
|
||||
if (ELEM(interop_id, "g24_rec709_display", "g24_rec709_scene")) {
|
||||
/* There is no gamma 2.4 TRC, but BT.709 is close. */
|
||||
cicp[0] = CICP_PRI_REC709;
|
||||
cicp[1] = CICP_TRC_BT709;
|
||||
|
|
@ -1190,7 +1204,7 @@ bool IMB_colormanagement_space_to_cicp(const ColorSpace *colorspace,
|
|||
cicp[3] = CICP_RANGE_FULL;
|
||||
return true;
|
||||
}
|
||||
if (ELEM(interop_id, "srgb_p3d65_display", "srgbe_p3d65_display")) {
|
||||
if (ELEM(interop_id, "srgb_p3d65_display", "srgbe_p3d65_display", "srgb_p3d65_scene")) {
|
||||
/* For video we use BT.709 to match default sRGB writing, even though it is wrong.
|
||||
* But we have been writing sRGB like this forever, and there is the so called
|
||||
* "Quicktime gamma shift bug" that complicates things. */
|
||||
|
|
@ -1200,11 +1214,39 @@ bool IMB_colormanagement_space_to_cicp(const ColorSpace *colorspace,
|
|||
cicp[3] = CICP_RANGE_FULL;
|
||||
return true;
|
||||
}
|
||||
if (interop_id == "srgb_rec709_display") {
|
||||
if (ELEM(interop_id, "srgb_rec709_display", "srgb_rec709_scene")) {
|
||||
/* Don't write anything for backwards compatibility. Is fine for PNG
|
||||
* and video but may reconsider when JXL or AVIF get added. */
|
||||
return false;
|
||||
}
|
||||
if (ELEM(interop_id, "lin_rec709_display", "lin_rec709_scene")) {
|
||||
cicp[0] = CICP_PRI_REC709;
|
||||
cicp[1] = CICP_TRC_LINEAR;
|
||||
cicp[2] = (rgb_matrix) ? CICP_MATRIX_RGB : CICP_MATRIX_BT709;
|
||||
cicp[3] = CICP_RANGE_FULL;
|
||||
return true;
|
||||
}
|
||||
if (ELEM(interop_id, "lin_p3d65_display", "lin_p3d65_scene")) {
|
||||
cicp[0] = CICP_PRI_P3D65;
|
||||
cicp[1] = CICP_TRC_LINEAR;
|
||||
cicp[2] = (rgb_matrix) ? CICP_MATRIX_RGB : CICP_MATRIX_BT709;
|
||||
cicp[3] = CICP_RANGE_FULL;
|
||||
return true;
|
||||
}
|
||||
if (ELEM(interop_id, "lin_rec2020_display", "lin_rec2020_scene")) {
|
||||
cicp[0] = CICP_PRI_REC2020;
|
||||
cicp[1] = CICP_TRC_LINEAR;
|
||||
cicp[2] = (rgb_matrix) ? CICP_MATRIX_RGB : CICP_MATRIX_REC2020_NCL;
|
||||
cicp[3] = CICP_RANGE_FULL;
|
||||
return true;
|
||||
}
|
||||
if (interop_id == "lin_ciexyzd65_scene") {
|
||||
cicp[0] = CICP_PRI_XYZD65;
|
||||
cicp[1] = CICP_TRC_LINEAR;
|
||||
cicp[2] = CICP_MATRIX_RGB;
|
||||
cicp[3] = CICP_RANGE_FULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1225,14 +1267,17 @@ const ColorSpace *IMB_colormanagement_space_from_cicp(const int cicp[4],
|
|||
else if (cicp[0] == CICP_PRI_P3D65 && cicp[1] == CICP_TRC_PQ) {
|
||||
interop_id = "pq_p3d65_display";
|
||||
}
|
||||
else if (cicp[0] == CICP_PRI_P3D65 && cicp[1] == CICP_TRC_G26) {
|
||||
interop_id = "g26_p3d65_display";
|
||||
else if (cicp[0] == CICP_PRI_XYZD65 && cicp[1] == CICP_TRC_PQ) {
|
||||
interop_id = "pq_xyzd65_display";
|
||||
}
|
||||
else if (cicp[0] == CICP_PRI_XYZD65 && cicp[1] == CICP_TRC_SMPTE428) {
|
||||
interop_id = "g26_xyzd65_display";
|
||||
}
|
||||
else if (cicp[0] == CICP_PRI_REC709 && cicp[1] == CICP_TRC_G22) {
|
||||
interop_id = "g22_rec709_display";
|
||||
}
|
||||
else if (cicp[0] == CICP_PRI_REC2020 && cicp[1] == CICP_TRC_BT709) {
|
||||
interop_id = "blender:g24_rec2020_display";
|
||||
interop_id = "g24_rec2020_display";
|
||||
}
|
||||
else if (cicp[0] == CICP_PRI_REC709 && cicp[1] == CICP_TRC_BT709) {
|
||||
if (output == ColorManagedFileOutput::Video) {
|
||||
|
|
@ -1250,6 +1295,18 @@ const ColorSpace *IMB_colormanagement_space_from_cicp(const int cicp[4],
|
|||
else if (cicp[0] == CICP_PRI_REC709 && cicp[1] == CICP_TRC_SRGB) {
|
||||
interop_id = "srgb_rec709_display";
|
||||
}
|
||||
else if (cicp[0] == CICP_PRI_REC709 && cicp[1] == CICP_TRC_LINEAR) {
|
||||
interop_id = "lin_rec709_display";
|
||||
}
|
||||
else if (cicp[0] == CICP_PRI_P3D65 && cicp[1] == CICP_TRC_LINEAR) {
|
||||
interop_id = "lin_p3d65_display";
|
||||
}
|
||||
else if (cicp[0] == CICP_PRI_REC2020 && cicp[1] == CICP_TRC_LINEAR) {
|
||||
interop_id = "lin_rec2020_display";
|
||||
}
|
||||
else if (cicp[0] == CICP_PRI_XYZD65 && cicp[1] == CICP_TRC_LINEAR) {
|
||||
interop_id = "lin_ciexyzd65_scene";
|
||||
}
|
||||
|
||||
return interop_id.is_empty() ? nullptr : g_config()->get_color_space_by_interop_id(interop_id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,10 +100,10 @@ const ColorSpace *FallbackConfig::get_sorted_color_space_by_index(const int inde
|
|||
|
||||
const ColorSpace *FallbackConfig::get_color_space_by_interop_id(StringRefNull interop_id) const
|
||||
{
|
||||
if (interop_id == "lin_rec709_scene") {
|
||||
if (ELEM(interop_id, "lin_rec709_scene", "lin_rec709_display")) {
|
||||
return &colorspace_linear_;
|
||||
}
|
||||
if (interop_id == "srgb_rec709_display") {
|
||||
if (ELEM(interop_id, "srgb_rec709_display", "srgb_rec709_scene")) {
|
||||
return &colorspace_srgb_;
|
||||
}
|
||||
if (interop_id == "data") {
|
||||
|
|
|
|||
|
|
@ -55,8 +55,9 @@ LibOCIOColorSpace::LibOCIOColorSpace(const int index,
|
|||
else if (alias == "rec1886_rec709_display") {
|
||||
interop_id_ = "g24_rec709_display";
|
||||
}
|
||||
else if (alias == "g24_rec2020_display") {
|
||||
interop_id_ = "blender:g24_rec2020_display";
|
||||
/* Legacy interop ID from before this was a standard. */
|
||||
else if (alias == "blender:g24_rec2020_display") {
|
||||
interop_id_ = "g24_rec2020_display";
|
||||
}
|
||||
else if (alias == "rec2100_pq_display") {
|
||||
interop_id_ = "pq_rec2020_display";
|
||||
|
|
|
|||
|
|
@ -345,7 +345,8 @@ const ColorSpace *LibOCIOConfig::get_color_space_by_interop_id(StringRefNull int
|
|||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
/* Fall back to name and alias lookup. */
|
||||
return get_color_space(interop_id);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue