-
Notifications
You must be signed in to change notification settings - Fork 644
feat(openexr): ACES Container hint for exr outputs #4907
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
base: main
Are you sure you want to change the base?
feat(openexr): ACES Container hint for exr outputs #4907
Conversation
Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
… in relaxed mode Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
70b11ea to
2deb446
Compare
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.
Other than my fairly minor comments about attribute name and unnecessary work related to channel order, etc, this all looks right to me. I'll ask Anton for a review as well.
|
Would appreciate a review from @antond-weta as the person who filed the issue this is based on (as well as being more knowledgeable than me about ACES containers.) |
|
@Glowies would you mind changing the description to say specifically or those are the magic words, and I think anything else doesn't trigger GitHub to link the issue to be automatically closed by the merge of the PR. |
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.
Looks good!
I've raised a point about setting the chromaticities in the "relaxed" mode automatically.
…ainer Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
|
The documentation reference should be changed to https://pub.smpte.org/pub/st2065-4/st2065-4-2023.pdf, as minor changes were made to the spec and the publication was updated. On p. 5 there's a list of changes, and since they are short enough I'll just list them here:
Nothing in this changes the definition of an ACES container. In the future (there is a five-year review of this document, only a couple years away), if the recent addition to OpenEXR of HTJ2K, a compression type that is normatively specified seems to be beneficial to the community, I could see that one particular compression type being allowed in ACES containers; I would lobby for it (if people are using it). But for now, compression remains disallowed, not because it's undesirable, but because ST 2065-4 is a normative international standard, and can only normatively reference other normatively specified international standards. At one point I did suggest a Google Summer of Code project to produce normative-quality documentation on piz, the DWA formats, etc. etc. and the output of which could be taken to SMPTE, but it was pointed out the phrase is "Summer of Code", not "Summer of Code and Doc". Anyway, please update the reference to the more recent version of the normative definition of the ACES container. |
|
@Glowies There are a variety of (fairly minor) suggestions for changes. I think that once you fix those few things, we'll be ready to merge this. |
Yep, thank you for the suggestions everyone! Didn't get a chance over the weekend but I'll be addressing them tomorrow. |
|
I have another suggestion, sorry! If the ImageBuf already contained the Here is an example of a use case when this might be important: This does change the existing behaviour, so I'm not sure if we want to make this change. |
Same as strict, or same as relaxed? And now I'm wondering about inevitable confusion between the Maybe the presence of |
A similar check could be added regarding the colour space: if the ImageBuf contains colour space metadata, and it is different from AP0, the writer should fail in either mode. I have zero experience working with colour spaces in OIIO, so I actually don't have a strong opinion on this. |
|
Let's be totally concrete about what behavior we want. What specific combinations of
do we want to trigger each of the following behaviors:
And ensure that all combinations of a-c must deterministically result in one of behaviors 1-3. |
|
Here is my take: |
|
Oh, one other thing I remember us clarifying in the recent 2065-4 revision: most but for some reason not all string attributes were prohibited from being blank. E.g. you can't have a lensMake that is "". That's something to add to the list of things to be checked |
Signed-off-by: glowies <[email protected]>
8f5ae6d to
f98e2ce
Compare
…ontainer Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
… exact order Signed-off-by: glowies <[email protected]>
|
The CI failures that say something about ffmpeg not found are not related to this PR, just ignore them. |
|
I see, that makes sense. Ultimately, I'm happy to go with you recommendation on all matters ACES container. If I understand you correctly, you want to rely 100% on the hint for whether or not to write it as an aces container? Which means it needs to be proactively set when a file is being written? So consider this: Should out.exr end up with the flag that makes it an ACES container? |
Yes it should, assuming that In my pseudocode, if we don't want to do the global setting for now, we can just replace the top line with In other words, these (and only these?) cases should set the acesImageContainerFlag in the output file: This case should set the ACES primaries and colorInteropID, but not acesImageContainerFlag: |
Co-authored-by: Larry Gritz <[email protected]> Signed-off-by: Oktay Comu <[email protected]>
Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
6da83eb to
c30d8f8
Compare
Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
|
Heya @antond-weta! I've done another pass on my implementation, and I tried to follow the logic in your pseudo-code - just without the global attribute. I also tried to converge some of the branching in your pseudo-code since it looked like there was some common behaviours on some of the branches. I made two assumptions there that I wanted to check with you:
Let me know if either of those assumptions are incorrect and I can fix them! |
…ed mode Signed-off-by: glowies <[email protected]>
…ntainer compliance Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
Signed-off-by: glowies <[email protected]>
0304a1f to
d725544
Compare
Signed-off-by: glowies <[email protected]>
| If not `none`, the spec will be checked to see if it is compliant | ||
| with the ACES Container format defined in `ST 2065-4`_. If it is, | ||
| `chromaticities` will be set to the ACES AP0 ones, `colorInteropId` | ||
| will be set to 'lin_ap0_scene' and the `acesImageContainerFlag` | ||
| attribute will be set to 1. | ||
| In `strict` mode, if the spec is non-compliant, the output will | ||
| throw an error and avoid writing the image. | ||
| While in `relaxed` mode, if the spec is non-compliant, `chromaticities` | ||
| and `colorInteropId` will be set, but `acesImageContainerFlag` | ||
| will NOT. |
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 feel like this is not clear about what happens if the spec is passed with a colorInteropID that is set, but is not lin_ap0_scene. Are you saying that it will be changed to lin_ap0_scene (but pixels stay as they are)? Or is this something that will be rejected as non-compliant? Or does the behavior differ depending on the policy setting?
| if (spec.get_string_attribute("oiio:ColorSpace", ACES_AP0_colorInteropId) | ||
| != ACES_AP0_colorInteropId | ||
| || spec.get_string_attribute("colorInteropId", ACES_AP0_colorInteropId) | ||
| != ACES_AP0_colorInteropId) { | ||
| reason | ||
| = "Color space is not lin_ap0_scene as required for an ACES Container."; | ||
| return false; | ||
| } |
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.
Do we want "no color space known" to pass? Or fail? The way to make "none specified" to fail is to not supply default values to the get_string_attribute calls.
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 I'd like to get @antond-weta's opinions on that. I had assumed that we want the "no color space known" case to pass the compliance check. (ie. If there is no attribute indicating a color space, it passes the ACES Container compliance check, and we just continue processing the image assuming it is in linear AP0 space)
| // Check data type | ||
| if (spec.format != OIIO::TypeDesc::HALF) { | ||
| reason | ||
| = "EXR data type is not 'HALF' as required for an ACES Container."; | ||
| return false; | ||
| } | ||
|
|
||
| // Check compression | ||
| std::string compression = spec.get_string_attribute("compression", "zip"); | ||
| if (compression != "none") { | ||
| reason = "Compression is not 'none' as required for an ACES Container."; | ||
| return false; |
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.
What's the best policy here?
For something like "doesn't have the right channels", the only thing to do is fail.
But for "wrong data type" or "wrong compression", we could force compliance by just fixing it.
|
Philosophically, the concerns I have boil down to these:
|
Signed-off-by: glowies <[email protected]>
…ation Signed-off-by: glowies <[email protected]>
…stions Signed-off-by: glowies <[email protected]>
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 going to approve and merge this because I don't want it to languish any longer, and I think it's a definite step forward, although I believe we may wish to continue to iterate on this functionality in a couple of minor ways.
In my mind, the biggest unanswered questions (which I hope we can discuss, definitively answer, and amend with subsequent PRs if necessary) are:
-
Should we require a colorInteropID set to the correct color space in strict mode (or any mode), or else consider it an error? I think that now, having NO color space info is just accepted and assumed to be in the right space. But an ACES file not in the main ACES color space is totally out-of-spec and is a problem waiting to happen, so maybe "no color space news" is actually "bad news?"
-
For any or all of the modes, should we fix things that are easily fixed, rather than make an ACES file that doesn't conform to spec? As an example, if an unsupported compression method is requested, should we just force an ACES-supported compression to ensure compliance?
|
|
Oh, I misread item 1. We should not prevent people from writing non-ACES stuff into the ACES container. Maybe we can log a warning with OCIO's logger, but we shouldn't do anything too contrived here. |
Closes #4791
Description
This PR introduces the
oiio:ACESContainerhint for OpenEXR outputs.The hint can take one of the following values:
none(default),strict, orrelaxed. If notnone, the spec will be checked to see if it is compliant with the ACES Container format defined in ST 2065-4. If it is, chromaticities will be set to the ACES AP0 ones, and the acesImageContainerFlag attribute will be set to 1. Instrictmode, if the spec is non-compliant, the output will throw an error and avoid writing the image. While inrelaxedmode, if the spec in non-compliant, only a warning will be printed and the attributes mentioned above will not be written to the spec.Tests
I've added several tests under
openexr-suite. These use oiiotool to attempt writing several EXRs with theoiio:ACESContainerhint.Checklist:
need to update the documentation, for example if this is a bug fix that
doesn't change the API.)
(adding new test cases if necessary).
corresponding Python bindings (and if altering ImageBufAlgo functions, also
exposed the new functionality as oiiotool options).
already run clang-format before submitting, I definitely will look at the CI
test that runs clang-format and fix anything that it highlights as being
nonconforming.