diff options
author | Nico Weber <thakis@chromium.org> | 2023-02-07 21:35:14 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-08 16:41:58 +0000 |
commit | e8bbb3d91536679bc468bf485ac11e44f8438041 (patch) | |
tree | 65cf0c317cb38d31f3d036ffa8a0136d6ff29f0d /Userland/Utilities | |
parent | a434b89521b6b3f891b50cc55ac147c7bf90eece (diff) | |
download | serenity-e8bbb3d91536679bc468bf485ac11e44f8438041.zip |
LibGfx+icc: Read cicpType
This is a very new tag used for HDR content. The only files I know that
use it are the jpegs on https://ccameron-chromium.github.io/hdr-jpeg/
But they have an invalid ICC creation date, so `icc` can't process them.
(Commenting out the check for that does allow to print them.)
If the CIPC tag is present, it takes precedence about the actual data
in the profile and from what I understand, the ICC profile is
basically ignored. See https://www.color.org/events/HDR_experts.xalter
for background, in particular
https://www.color.org/hdr/02-Luke_Wallis.pdf (but the other talks
are very interesting too).
(PNG also has a cICP chunk that's supposed to take precedence over
iCCP.)
Diffstat (limited to 'Userland/Utilities')
-rw-r--r-- | Userland/Utilities/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/Utilities/icc.cpp | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index d05c679111..6316ffb0aa 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -94,7 +94,7 @@ target_link_libraries(grep PRIVATE LibRegex) target_link_libraries(gunzip PRIVATE LibCompress) target_link_libraries(gzip PRIVATE LibCompress) target_link_libraries(headless-browser PRIVATE LibCrypto LibGemini LibGfx LibHTTP LibTLS LibWeb LibWebSocket LibIPC LibJS) -target_link_libraries(icc PRIVATE LibGfx) +target_link_libraries(icc PRIVATE LibGfx LibVideo) target_link_libraries(image2bin PRIVATE LibGfx) target_link_libraries(jail-attach PRIVATE LibCore LibMain) target_link_libraries(jail-create PRIVATE LibCore LibMain) diff --git a/Userland/Utilities/icc.cpp b/Userland/Utilities/icc.cpp index e0c43c68b5..f8e6ff6284 100644 --- a/Userland/Utilities/icc.cpp +++ b/Userland/Utilities/icc.cpp @@ -12,6 +12,7 @@ #include <LibGfx/ICC/Profile.h> #include <LibGfx/ICC/Tags.h> #include <LibGfx/ImageDecoder.h> +#include <LibVideo/Color/CodingIndependentCodePoints.h> template<class T> static ErrorOr<String> hyperlink(URL const& target, T const& label) @@ -125,7 +126,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } tag_data_to_first_signature.set(tag_data, tag_signature); - if (tag_data->type() == Gfx::ICC::CurveTagData::Type) { + if (tag_data->type() == Gfx::ICC::CicpTagData::Type) { + auto& cicp = static_cast<Gfx::ICC::CicpTagData&>(*tag_data); + outln(" color primaries: {} - {}", cicp.color_primaries(), + Video::color_primaries_to_string((Video::ColorPrimaries)cicp.color_primaries())); + outln(" transfer characteristics: {} - {}", cicp.transfer_characteristics(), + Video::transfer_characteristics_to_string((Video::TransferCharacteristics)cicp.transfer_characteristics())); + outln(" matrix coefficients: {} - {}", cicp.matrix_coefficients(), + Video::matrix_coefficients_to_string((Video::MatrixCoefficients)cicp.matrix_coefficients())); + outln(" video full range flag: {}", cicp.video_full_range_flag()); + } else if (tag_data->type() == Gfx::ICC::CurveTagData::Type) { auto& curve = static_cast<Gfx::ICC::CurveTagData&>(*tag_data); if (curve.values().is_empty()) { outln(" identity curve"); |