Skip to content
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

Implement mDCv chunk described in PNG 3rd Edition (Priority 2) #509

Open
digitaltvguy opened this issue Dec 23, 2023 · 13 comments
Open

Implement mDCv chunk described in PNG 3rd Edition (Priority 2) #509

digitaltvguy opened this issue Dec 23, 2023 · 13 comments

Comments

@digitaltvguy
Copy link

mDCv or Mastering Display Color Volume (SMPTE ST 2086) stores static metadata which idenfies display characteristics of the mastering display and allows optimized tone and color mapping to a target (consumer display).

mDCv is helpful because the content creation display may have superior capabilities compared to the target display, therefore tone and color mapping may be necessary

@svgeesus
Copy link

svgeesus commented Jan 8, 2024

@jbowler
Copy link
Contributor

jbowler commented Sep 14, 2024

Yet another broken link :-) The current draft spec is here:

https://www.w3.org/TR/png-3/#mDCv-chunk

The spec is, well, very wordy and not very useful; it's not a normative spec, it's pretty much a discussion. I'm sure this will change during review; proffering opinions in ISO specs is not normally acceptable! At present the spec is unimplementable simply because it does not define the encoding of the fields. It says how many bytes each contains but not how the bytes are encoded!

It's possible to deduce that the CIExyY values are encoded in two bytes for x and y but it is not possible to deduce whether that is a signed or unsigned value given the error in cHRM (it erroneously uses unsigned values). The ACES AP0 color space has a negative "y" (and, as discussed, AP1 has a negative "z" but that's ok, as discussed.)

The same problem may exist with cLLi because display relative images can, in fact, have negative luminance. This is a consequence of the need to offset colours to make them visible, so in display space a colour may end up with a negative luminance because it is below the level of perception in the viewing environment (the "black level").

@digitaltvguy
Copy link
Author

digitaltvguy commented Sep 14, 2024 via email

@jbowler
Copy link
Contributor

jbowler commented Sep 14, 2024

Negative luminance values in narrow range can also contain pluge (which allows monitor setup for black levels)

Indeed, and I would expect a display application or editor which handles the cICP chunk to handle values outside the 16..235 range. Indeed any app that reads Kodak's PhotoCD already has to handle the negative values. PhotoCD is a 16..235 encoding, though (IRC) without the signaling values.

Similarly image resampling produces RGB values outside the bounds of the original values even given perfectly sampled image data and perfect resampling (sinc, done correctly.)

@jbowler
Copy link
Contributor

jbowler commented Sep 14, 2024

Another note; the current spec defines the fields thus:

https://www.w3.org/TR/png-3/#mDCv-chunk-syntax

To quote the table (table 19 at present):

Name Size Divisor value
Mastering display color primary chromaticities (CIE 1931 x,y of R,G,B ) 12 bytes 0.00002
Mastering display white point chromaticity (CIE 1931 x,y) 4 bytes 0.00002
Mastering display maximum luminance 4 bytes 0.0001 cd/m2
Mastering display minimum luminance 4 bytes 0.0001 cd/m2

The title line of the third column is wrong (the values are scale factors; multipliers not divisors). That's clear to me; for one thing the last two rows are dimensionally incorrect (luminance is measured in cd/m2, not 1/(cd/m2) but it will probably lead to some confusion.

@digitaltvguy
Copy link
Author

digitaltvguy commented Sep 15, 2024

The standard SMPTE ST 2067-21 indicates them as "units of" in Annex B. I think all that needs to occur is moving cd/m2 to the name column. The store value is multiplied by the divisor to get the resulting luminance in cd/m2

@digitaltvguy
Copy link
Author

Change has been posted to branch 464 in PNG 3rd Edition

@jbowler
Copy link
Contributor

jbowler commented Sep 28, 2024

Ok. It would be useful to know the maximum values of all four fields; it's no problem with floating point but libpng also has fixed point APIs.

@ProgramMax
Copy link
Contributor

Following up here, the mDCv chunk does specify the byte definition. So it can be implemented.

Although negative luminance values in narrow range can act as a control signal, those signal values are separate from the display's color volume. I think some of the conversation here is mixing logical color spaces with the physical mastering display's color volume, right?

@jbowler
Copy link
Contributor

jbowler commented Sep 29, 2024

ACES is intended for use in video workflows; it was originated (in 2014) by the film industry. It is a mastering color space. Clarification is required in the spec with regard to specifications like ACES. Are we meant to put the workflow space in cHRM (etc) or in mDCv?

@ProgramMax
Copy link
Contributor

"Mastering Display" here is the monitor/display used while mastering.
That is separate from the image's color space. And the workflow color space could also be different.

It would be possible to use ACES in the workflow and then render out to a final, non-ACES color space for the end user.

The reason we care about the mastering display at all is for the end user's processing to try to match it. It is a way to provide a target for the end device.

@digitaltvguy
Copy link
Author

digitaltvguy commented Sep 29, 2024 via email

@digitaltvguy
Copy link
Author

digitaltvguy commented Sep 29, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants