1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +00:00

LibGfx/ICC: Implement forward transform for mft1 and mft2 tags

mft1 and mft2 tags are very similar. The only difference is that
mft1 uses an u8 lookup table, while mft2 uses a u16 lookup table.
This means their PCS lookup encodings are different, and mft2 uses a
PCSLAB encoding that's different from other places in the v4 spec.
This commit is contained in:
Nico Weber 2023-12-04 08:32:21 -05:00 committed by Andreas Kling
parent b138bc0004
commit 72f5461af4
2 changed files with 179 additions and 6 deletions

View file

@ -1213,12 +1213,14 @@ ErrorOr<FloatVector3> Profile::to_pcs_a_to_b(TagData const& tag_data, ReadonlyBy
VERIFY(number_of_components_in_color_space(connection_space()) == 3);
switch (tag_data.type()) {
case Lut16TagData::Type:
// FIXME
return Error::from_string_literal("ICC::Profile::to_pcs: AToB*Tag handling for mft2 tags not yet implemented");
case Lut8TagData::Type:
// FIXME
return Error::from_string_literal("ICC::Profile::to_pcs: AToB*Tag handling for mft1 tags not yet implemented");
case Lut16TagData::Type: {
auto const& a_to_b = static_cast<Lut16TagData const&>(tag_data);
return a_to_b.evaluate(data_color_space(), connection_space(), color);
}
case Lut8TagData::Type: {
auto const& a_to_b = static_cast<Lut8TagData const&>(tag_data);
return a_to_b.evaluate(data_color_space(), connection_space(), color);
}
case LutAToBTagData::Type: {
auto const& a_to_b = static_cast<LutAToBTagData const&>(tag_data);
if (a_to_b.number_of_input_channels() != number_of_components_in_color_space(data_color_space()))