Bug 463651 - PNG support for HDR clamps the dynamic range to SDR
Summary: PNG support for HDR clamps the dynamic range to SDR
Status: RESOLVED WORKSFORME
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: git master (please specify the git hash!)
Platform: Compiled Sources Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression
Depends on: 355727
Blocks:
  Show dependency treegraph
 
Reported: 2022-12-31 02:31 UTC by amyspark
Modified: 2023-02-19 03:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description amyspark 2022-12-31 02:31:58 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

While trying to test the HDR support of Krita, I noticed that the HDR test failed, because the color conversion transformation clamps the channel values to 0.0-1.0.

There is a possibly related issue, which I've linked here. It worked previously to sometime before the following commits, because those sidestepped the issue by manually managing the color (same as is currently done with JXL and HEIF by me and Wolthera):

https://invent.kde.org/graphics/krita/-/commit/16203f979dc8b064814e4d99f0ea7c39148d22b0
https://invent.kde.org/graphics/krita/-/commit/3bdf84eaedd4d539ce1ee6b7abb47681d56af2bf

Marked as regression since at least 4.2.0 based on the above commits.

STEPS TO REPRODUCE
1. Build Krita.
2. Export a HDR image to PNG and open it back. Alternatively, run kis_png_test.

OBSERVED RESULT

The HDR information is preserved.

EXPECTED RESULT

All HDR information is clamped to 1.0.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
commit c7bec2eae0f767960ace049677f6742e6b387a5f
Comment 1 Halla Rempt 2023-01-04 10:25:51 UTC
Did you discuss assigning this bug to Dmitry with Dmitry?
Comment 2 Dmitry Kazakov 2023-01-20 11:33:01 UTC
Hi, amyspark!

I cannot reproduce the issue here. Saving HDR images to PNG is supported only in rec2020pq color space (as per PNG-HDR standard). To do that you need to check a checkbox while saving. When doing so, everything works perfectly here in master.
Comment 3 Dmitry Kazakov 2023-01-20 15:30:35 UTC
Git commit 1ee7682ab7fac5312d11c7a5c940873019e2ef36 by Dmitry Kazakov.
Committed on 20/01/2023 at 15:30.
Pushed by dkazakov into branch 'master'.

Fix HDR-clipping in the Advanced Color Selector

We should disable LCMS optimizations when the color profile is linear
and, therefore, can have values above 1.0

M  +3    -7    plugins/color/lcms2engine/IccColorSpaceEngine.cpp
M  +28   -0    plugins/color/lcms2engine/tests/TestLcmsRGBP2020PQColorSpace.cpp
M  +1    -0    plugins/color/lcms2engine/tests/TestLcmsRGBP2020PQColorSpace.h

https://invent.kde.org/graphics/krita/commit/1ee7682ab7fac5312d11c7a5c940873019e2ef36
Comment 4 Bug Janitor Service 2023-02-04 04:58:53 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Bug Janitor Service 2023-02-19 03:45:44 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!