Repository navigation
colorspaces: encode PQ and HLG thumbnails the way the pipe does - #22751
Merged
Merged
Conversation
Since 4b0878d the pipe encodes PQ with 1.0 at reference white (203 nits) and applies the HLG OOTF itself, through dt_hdr_encode(). The thumbnail display transforms still went straight through LittleCMS to the built-in PQ and HLG ICC profiles, whose shapers put PQ 1.0 at 10000 nits and have no OOTF. With a PQ or HLG display profile, lighttable and filmstrip thumbnails were therefore much lighter than the darkroom view: AdobeRGB white landed at code 1.0 instead of 0.58 for PQ and 0.75 for HLG, mid gray at 0.82 instead of 0.41 for PQ. The image open in the darkroom looked right only because its filmstrip thumbnail is drawn from the preview pipe's output, which colorout has already encoded. For PQ and HLG display profiles the sRGB and AdobeRGB display transforms now end in linear light, as colorout does, and the new dt_colorspaces_transform_to_display() applies dt_hdr_encode() before writing 8-bit BGRA. Lighttable, filmstrip and the tethering live view use it. Other display profiles keep the plain 8-bit transform.
TurboGit
approved these changes
Oct 23, 2026
TurboGit
left a comment
Member
There was a problem hiding this comment.
Works for me in all views, lighttable, darkroom, slideshow and print. Good to go, thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With a PQ or HLG display profile, lighttable and filmstrip thumbnails are much lighter than the darkroom view, as seen while testing #22669. The open image's own filmstrip thumbnail looks right.
Cause. Since 4b0878d the pipe encodes PQ with 1.0 at reference white (203 nits) and applies the HLG OOTF itself, through
dt_hdr_encode(). The thumbnail display transforms (transform_srgb_to_display,transform_adobe_rgb_to_display) still go straight through LittleCMS to the built-in PQ/HLG ICC profiles, whose shapers (_PQ_fct(),_HLG_fct()) put PQ 1.0 at 10000 nits and have no OOTF. The image open in the darkroom escapes this because its filmstrip thumbnail is drawn from the preview pipe's backbuf (dtgtk/thumbnail.c), which colorout has already encoded.Fix. For PQ and HLG display profiles, the sRGB/AdobeRGB display transforms now end in linear light (via
dt_colorspaces_linearize_profile(), as colorout does), and a newdt_colorspaces_transform_to_display()appliesdt_hdr_encode()before writing 8-bit BGRA. Lighttable/filmstrip (dt_view_image_get_surface()) and the tethering live view use it. Other display profiles keep the plain 8-bit transform, so SDR output is byte-identical. The display2 transforms get the same treatment for consistency, though nothing uses them at the moment. The ICC profiles themselves are unchanged, so exports and imports are not affected.Checked. Builds without warnings (Ubuntu 24.04, GCC, OpenCL off); the
hdrunit tests pass. A scratch program linked against libdarktable, run headless with--conf ui_last/color/display_type=..., pushed an AdobeRGB gray ramp through the old and new thumbnail transforms and compared withdt_hdr_encode()of the same linear values (display code, green channel):HLG P3 gives the same grays; saturated colors differ only by primaries. With the sRGB display profile, old and new output are identical.
Not checked. I haven't looked at the thumbnails in the GUI on a PQ or HLG screen, nor the tethering live view.
Release notes. None added: the mismatch came in with 4b0878d in this cycle, so no release had it. Happy to add one if you'd rather.
This change was written with AI assistance (Claude Code) and reviewed by me.