From 3bc75720f9eb686e2a674a710961422b9920d2e3 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sun, 29 Oct 2023 16:52:35 +0100 Subject: [PATCH] nclx: use default values that match sRGB See: https://github.com/libvips/libvips/pull/3731 --- libheif/color-conversion/colorconversion.cc | 8 ++++---- libheif/nclx.cc | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libheif/color-conversion/colorconversion.cc b/libheif/color-conversion/colorconversion.cc index f5a4740bcd5..3e8f6d36ae7 100644 --- a/libheif/color-conversion/colorconversion.cc +++ b/libheif/color-conversion/colorconversion.cc @@ -520,18 +520,18 @@ std::shared_ptr convert_colorspace(const std::shared_ptrget_color_profile_nclx(); } - // If some input nclx values are unspecified, use CCIR-601 values as default. + // If some input nclx values are unspecified, use values that match sRGB as default. if (input_state.nclx_profile.get_matrix_coefficients() == heif_matrix_coefficients_unspecified) { - input_state.nclx_profile.set_matrix_coefficients(heif_matrix_coefficients_ITU_R_BT_601_6); + input_state.nclx_profile.set_matrix_coefficients(heif_matrix_coefficients_ITU_R_BT_709_5); } if (input_state.nclx_profile.get_colour_primaries() == heif_color_primaries_unspecified) { - input_state.nclx_profile.set_colour_primaries(heif_color_primaries_ITU_R_BT_601_6); + input_state.nclx_profile.set_colour_primaries(heif_color_primaries_ITU_R_BT_709_5); } if (input_state.nclx_profile.get_transfer_characteristics() == heif_color_primaries_unspecified) { - input_state.nclx_profile.set_transfer_characteristics(heif_transfer_characteristic_ITU_R_BT_601_6); + input_state.nclx_profile.set_transfer_characteristics(heif_transfer_characteristic_IEC_61966_2_1); } std::set channels = input->get_channel_set(); diff --git a/libheif/nclx.cc b/libheif/nclx.cc index 46d0bdf4546..9be6848ac11 100644 --- a/libheif/nclx.cc +++ b/libheif/nclx.cc @@ -294,9 +294,9 @@ struct heif_color_profile_nclx* color_profile_nclx::alloc_nclx_color_profile() if (profile) { profile->version = 1; - profile->color_primaries = heif_color_primaries_unspecified; - profile->transfer_characteristics = heif_transfer_characteristic_unspecified; - profile->matrix_coefficients = heif_matrix_coefficients_ITU_R_BT_601_6; + profile->color_primaries = heif_color_primaries_ITU_R_BT_709_5; + profile->transfer_characteristics = heif_transfer_characteristic_IEC_61966_2_1; + profile->matrix_coefficients = heif_matrix_coefficients_ITU_R_BT_709_5; profile->full_range_flag = true; } @@ -312,9 +312,9 @@ void color_profile_nclx::free_nclx_color_profile(struct heif_color_profile_nclx* void color_profile_nclx::set_default() { - m_colour_primaries = 2; - m_transfer_characteristics = 2; - m_matrix_coefficients = 6; + m_colour_primaries = 1; + m_transfer_characteristics = 13; + m_matrix_coefficients = 1; m_full_range_flag = true; }