-
Notifications
You must be signed in to change notification settings - Fork 3.2k
wayland: convert luminance values to libplacebo space #17149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| float a = wd->min_luma; | ||
| float b = (PL_COLOR_SDR_WHITE - PL_COLOR_HDR_BLACK) / (wd->ref_luma - a); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just mapping primary color volume min_luma to PL_COLOR_HDR_BLACK now. I don't know if there is anything more sensible to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to test this with some dark videos to see if the blacks come out as the proper shade of black.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PL_COLOR_HDR_BLACK is effectively 0, it's just sentinel value to discriminate from "undefined" which is 0.
It shouldn't make a difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is so, but the goal of this mapping is to ensure that 0 in nominal space A maps to 0 in nominal space B. But 0 in nominal space is usually not 0 luminance. For most SDR transfer functions 0 in nominal space is 0.2 cd/m^2 and for PQ 0 in nominal space is 0.005 cd/m^2. I'd have to know what 0 is in the nominal space assumed by libplacebo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that it depends on the values in csp. If things are set, they will be used, if not. Default is used instead, which is 0.203 (203/1000) for SDR and 0 for PQ. Generally internal absolute black is always 0 in libplacebo and SDR is shifted according to min_luma value.
float min, max;
pl_color_space_nominal_luma_ex(pl_nominal_luma_params(
.color = &csp,
.metadata = PL_HDR_METADATA_HDR10,
.scaling = PL_HDR_NITS,
.out_min = &min,
.out_max = &max,
));There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So something like this: afaedac?
video/out/wayland_common.c
Outdated
| wd->csp.hdr.max_fall = MPMIN(wd->csp.hdr.max_fall, wd->csp.hdr.max_luma); | ||
| } | ||
| wl->preferred_csp = wd->csp; | ||
| if (wd->csp.hdr.max_luma != PL_COLOR_SDR_WHITE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to != since that is the only case where it is ok for the rest of mpv to ignore the max_luma.
5a1bbd2 to
10b960c
Compare
Signed-off-by: Julian Orth <[email protected]>
10b960c to
ceb3fbd
Compare
kasper93
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it make sense. We can always improve on case by case basis, should there be any issues.
|
Download the artifacts for this pull request: Windows |
This PR contains the first commit from #17070 with some small changes.