diff --git a/libheif/color-conversion/colorconversion.cc b/libheif/color-conversion/colorconversion.cc index 8afb75733d..da39dd11e2 100644 --- a/libheif/color-conversion/colorconversion.cc +++ b/libheif/color-conversion/colorconversion.cc @@ -446,8 +446,7 @@ std::shared_ptr ColorConversionPipeline::convert_image(const std // --- pass the color profiles to the new image - auto output_nclx = std::make_shared(); - *output_nclx = step.output_state.nclx_profile; + auto output_nclx = std::make_shared(step.output_state.nclx_profile); out->set_color_profile_nclx(output_nclx); out->set_color_profile_icc(in->get_color_profile_icc()); @@ -521,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); + if (input_state.nclx_profile.get_transfer_characteristics() == heif_transfer_characteristic_unspecified) { + input_state.nclx_profile.set_transfer_characteristics(heif_transfer_characteristic_IEC_61966_2_1); } std::set channels = input->get_channel_set(); @@ -546,7 +545,7 @@ std::shared_ptr convert_colorspace(const std::shared_ptr convert_colorspace(const std::shared_ptrversion = 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; }