-
Notifications
You must be signed in to change notification settings - Fork 0
Adding new attributes to color spaces. #2
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?
Conversation
Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
- adding python docs for AMF transform IDs and interop ID. - With the newly added unit tests discovered crasher issues some of the "char *" taking functions and fixed the crashers - Also hardened Platform::Strcasecmp() and Platoform::Strncasecmp() against nullptr. Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
doug-walker
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.
We need to decide what version checks should be added to Config.cpp. It looks like the current code will read and write these attributes for any config version. For writing, we don't want to allow them in configs with version less than 2.5 since old readers would not handle them. I guess we could always read them from any version?
|
|
||
| Specify the transform for the appropriate direction. Setting the transform to null will clear it. | ||
|
|
||
|
|
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.
Did you generate this manually rather than via the process specified here?
https://opencolorio.readthedocs.io/en/latest/guides/contributing/contributing.html
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 reverted the changes but failed to build the rst locally both on Windows and Mac.
tests/cpu/ColorSpace_tests.cpp
Outdated
| // Test setting to nullptr | ||
| cs->setDescription(nullptr); | ||
| cs->setAmfTransformIDs(nullptr); | ||
| OCIO_CHECK_EQUAL(std::string(cs->getAmfTransformIDs()), ""); |
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.
Would be a more interesting test if the value was not already "".
|
Please add some Python tests, though they do not have to be as thorough as the CPU tests. |
- Reverting the manual changes to python frozen docs - capitalizing the acronyms in the functions names, adding underscores to the yaml keywords - changing the new keyword's ordering in the yaml file - bumping the config minor version number for v2 to 5 - new fields are now restricted to v2.5 and higher (checkVersionConsistency() is updated to detect violations) - Fixing the version check logic error in Config::validate() - Added basic pyhton tests - fixed / extended the color space cpu tests Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
…y added fields. Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
…macros. Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
| str = cs.getAMFTransformIDs(); | ||
| if (!str.empty()) | ||
| { | ||
| os << ", amf_transform_ids=" << str; |
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 we're not parsing the string value that AMFTransformIDs field holds. Since the formatting stayed the same, that is multiple entities are separated with the newline character, this may create EOLs in the ostream.
Is this OK? Or should we try to create a list from each entity here (that requires tokenizing the string with /n/r separators).
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.
Description has the same problem. Maybe for both we should just add something like "=(non-empty)" rather than trying to include the whole string? Or a hash value?
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'll leave those as-is for now, we can decide/change if a real need arises.
Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
src/bindings/python/PyColorSpace.cpp
Outdated
| .def("getAmfTransformIDs", &ColorSpace::getAmfTransformIDs, | ||
| DOC(ColorSpace, getAmfTransformIDs)) | ||
| .def("setAmfTransformIDs", &ColorSpace::setAmfTransformIDs, "amfTransformIDs"_a, | ||
| DOC(ColorSpace, setAmfTransformIDs)) |
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 to add any of these newly added fields as an Init() function parameter which is defined in line 80 above?
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.
Sure, as long as they go at the end and have default values so as not to break existing code.
|
|
||
|
|
||
| // Check for interchange roles requirements - scene-referred and display-referred. | ||
| if (getMajorVersion() >= 2 && getMinorVersion() >= 2) |
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.
This would work only until v3.0
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.
Good catch. But you could use GetVersionHex() rather than making your own.
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 saw that but that's a global function returning the library's version, not the config's current version.
I can add a function to Config class but that may break ABI.
Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
| str = cs.getAMFTransformIDs(); | ||
| if (!str.empty()) | ||
| { | ||
| os << ", amf_transform_ids=" << str; |
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.
Description has the same problem. Maybe for both we should just add something like "=(non-empty)" rather than trying to include the whole string? Or a hash value?
|
|
||
|
|
||
| // Check for interchange roles requirements - scene-referred and display-referred. | ||
| if (getMajorVersion() >= 2 && getMinorVersion() >= 2) |
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.
Good catch. But you could use GetVersionHex() rather than making your own.
| aliases.push_back(cs->getAlias(aidx)); | ||
| } | ||
| out << YAML::Flow << YAML::Value << aliases; | ||
| } |
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.
When reading, there is no need for version checks here since checkVersionConsistency will be called after the load. However, when saving, it seems like we need to avoid writing if the version is less than 2.5. Otherwise we would produce a config that won't load in earlier libraries, right? Validate is not called before a serialize.
Although, looking at the ColorSpace loader, maybe it only logs a warning on an unrecognized key. So perhaps we have an option?
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.
We're calling the checkVersionConsistency() when saving too. It's in the Config::serialize() function.
|
|
||
| # Test setting None (should convert to empty string) | ||
| self.colorspace.setICCProfileName(None) | ||
| self.assertEqual(self.colorspace.getICCProfileName(), '') |
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.
The value should be initialized to something other than an empty string to be a valid test.
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.
good catch.
include/OpenColorIO/OpenColorIO.h
Outdated
| * | ||
| * The interop ID is a standardized identifier for commonly used color spaces. | ||
| * These IDs are defined by the Academy Software Foundation's ColorInterop project | ||
| * to standardize color space naming across the industry. |
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.
Suggest:
The interop ID is a standardized identifier to uniquely identify commonly used color spaces. These IDs are defined by the Academy Software Foundation's Color Interop Forum project. If you create your own ID, you must prefix it with unique characters that will ensure it won't conflict with future Color Interop Forum IDs.
tests/cpu/ColorSpace_tests.cpp
Outdated
| OCIO_CHECK_NO_THROW(cs->setInteropID(nullptr)); | ||
| OCIO_CHECK_EQUAL(std::string(cs->getInteropID()), ""); | ||
|
|
||
| // Test copy constructor preserves ICC profile name |
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.
Update comment.
And minor, but these comments should all end in a period.
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 like the Cursor is also having difficulty sticking to this unusual comment syntax guideline even though the rest of the code has periods in the comments. :)
tests/cpu/ColorSpace_tests.cpp
Outdated
| OCIO_CHECK_EQUAL(cfgString, os.str()); | ||
| } | ||
|
|
||
| // Test that the interop_id can't be used in v2.0 config |
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.
Is this significantly different than the check below (2.0 vs. 2.4 is probably not worth a separate test)?
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.
Tests here are using the v2 yaml "Start" snippet above to create from a stream (de-serialization)
Tests below using v2.4 are exercising the other, serialization direction.
| aliases = cs.getAliases() | ||
| self.assertEqual(len(aliases), 2) | ||
| self.assertEqual(aliases[0], 'alias1') | ||
| self.assertEqual(aliases[1], 'alias2') |
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.
Not sure why this is deleted. Restoring.
Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
…her branch. Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
I was unable to build this locally so modified the CI workflow to upload the docs folder as an artifact in a separate branch. Even that was not readily consumable, I had to manually pick the differences and the remove the duplicate PyOpenColorIO in the entity names (i.e. PyOpenColorIO.PyOpenColorIO.ColorSpace) Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
doug-walker
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.
LGTM
Uh oh!
There was an error while loading. Please reload this page.