Reference an OCIO Import or Export Transform using a single string syntax
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- cpp
- 领域
- api, computer-graphics
调研方向
首先审阅 Config API 提案,以及 issue 中提到的现有 ColorSpaceTransform、DisplayViewTransform、FileTransform、NamedTransform、Processor 和 Context 概念。在实现之前,通过讨论明确支持的语法、方向处理、上下文变量、序列化规则和错误行为;完成标准是确定 API 和语法规范,而不是基于这个草案编写 patch。
由索引模型根据 Issue 内容生成。
描述
Problem Statement
There are three primary means for applications to use OCIO to transform colors to or from a working color space: ColorSpaceTransform, DIsplayViewTransform, and FileTransform.
Sometimes it's convenient to be able to specify the arguments for doing that as a single string. Many applications do this already to support the ColorSpaceTransfom case. That string is simple, it's just the color space of the incoming media.
In fact some applications or frameworks are setup so that they would like to always have just a single string to hold this information (particularly applications that were designed in the OCIO v1 era). This came up recently during the OpenTimelineIO color management discussions. It would be nice to have a single string that could be associated with a piece of media that would describe to OCIO how to convert it to a working color space.
In the case of OTIO, the use-case was primarily around converting into a working space on import. But there are other use-cases where this would be helpful to convert from a working space on export. It would be helpful if the syntax could support both directions. Though typically, it will be clear from the context which direction is involved, so it might not need to be explicitly stated.
One complication for such a syntax is that OCIO is very flexible in terms of how it allows color spaces to be named. The only characters that are disallowed are the ones used to define context variables. What characters should be used to break the string into tokens? Another complication are context variables themselves, should the syntax allow specifying an arbitrary set of string/value context variable pairs?
It might be nice if the syntax was essentially invisible for the simple cases. In other words, if it is just a color space name, then that's the complete string "<colorSpaceName>". Similarly, the DisplayViewTransform arguments could be "<view> (<display>)", which is already a common way of combining the display and view into a single string. And as long as the FileTranform has an extension, the LUT file name could typically be disambiguated from the other cases without any additional syntax.
Of course, while that is nice and simple, there are potential ways it could fail. For example, a color space could use parentheses so that it looks like a "view (display)" combination. It is unlikely that both of those possibilities would exist in a single config, however, there is probably a need for a more verbose but flexible syntax that could be used in cases where the intent might not be clear, even within the context of a given config. And it might be helpful to allow specifying other information.
Proposal
Here is a proposal for a single-string syntax that applications could use to with OCIO to import to a working color space or export from a working color space. There is a both a "simple syntax" and a "flexible syntax".
Simple Syntax
ColorSpaceTransform: This is simply the color space name.
DisplayViewTransform: This uses parentheses to separate the tokens "<view> (<display>)".
FileTransform: The string is simply the name of the LUT file. If a relative path is provided, the config search_path could be used, along with whatever other information the application might have, to resolve the path.
Flexible Syntax
ColorSpaceTransform: "ociocolorspace: <colorSpaceName>"
DisplayViewTranform: "ociodisplayview: <viewName> {<displayName>}"
FileTransform: "ociofile: <filePath>"
NamedTransform: "ocionamedtransform: <transformName>"
In the DisplayView case, if either the display or view name use the "{" or "}" characters, they would need to be escaped with a backslash.
Any of these could then be followed with context variable tokens as follows: "| <cvName1>=<cvValue1> | <cvName2>=<cvValue2> |"
For the FileTransform case, additional parameters such as CCCId, CDLStyle, and Interpolation could be specified similarly to context variables. For example: "| Interpolation=tetrahedral |".
The working color space for the transform may be added similarly: "| workingSpace=<colorSpaceName> |". This would be helpful to invalidate the string if the working space later has changed.
The inverse direction would be added as: "| direction=inverse |". Note that this could be relevant for DisplayViewTransform as well as obviously FileTransform and NamedTransform.
The parser will strip extra white space such as spaces and newlines, if that is helpful to keep the flexible syntax human readable.
API
We would add a function to the API as a method of the Config class that would accept a working color space name, a direction (forward/inverse), and the string (either simple or flexible syntax) and return an OCIO Processor object of the necessary type. It would throw if the string could not be interpreted. (If we don't want to support context variables, it could return a Transform object rather than a Processor, which would be more useful in some cases.)
We would add the inverse function that would take an enum to choose between Simple or Flexible syntax, a ColorSpaceTransform, DisplayViewTransform, or FileTransform, working color space, and a Context object (which could be null) and return the string. If Simple syntax is requested but not supported, it would throw. We would add a similar function that takes a NamedTransform (since it is not a Transform).
Limitations & Assumptions
One assumption is that a config file would need to be provided along with the string, it's not intended to be meaningful on its own (except in the case of a FileTransform).
Another assumption is that the direction (to or from working space) will be clear from the context.
Another assumption is that when this string is generated, the desired working space that the transform converts to (or from) is known. Furthermore, if the working space is later changed, any existing strings would potentially be invalidated. Certainly that would be true for FileTransform, but it could be true in other cases too, for example, if the the image state of the working space changes from scene-referred to display-referred, or vice versa.
Conclusion
That's a rough strawman to start the conversation. Let's start the discussion around what functionality is desired first, before getting into details of the syntax, which I'm sure could be improved later.
For reference, here is a related request in the ColorInterop issues.
- 主要语言
- C++
- 星标
- 2.1k
- 派生
- 502
- 平均合并
- 6 天 3 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AcademySoftwareFoundation/OpenColorIO 的其他 Issue
-
Inconsistent run-time library usage for locale handling breaks GPU code generation on some systems.未关闭
难度 2/5 1-3 小时 新手友好度 86/100
AcademySoftwareFoundation/OpenColorIO#2351 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
AcademySoftwareFoundation/OpenColorIO#2340 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
AcademySoftwareFoundation/OpenColorIO#2329 ·
维护者通常 1 天内回复
-
Build failure on GCC/MinGW (MXE): std::ifstream constructor mismatch with Platform::filenameToUTF()未关闭
难度 2/5 1-3 小时 新手友好度 78/100
AcademySoftwareFoundation/OpenColorIO#2283 ·
维护者通常 1 天内回复
-
Documentation
难度 1/5 1 小时以内 新手友好度 72/100
AcademySoftwareFoundation/OpenColorIO#2280 · 1 条评论 ·
维护者通常 1 天内回复
查看 AcademySoftwareFoundation/OpenColorIO 的全部 Issue
相似的 Issue
-
category:port-update
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
(S1 - Need confirmation)
难度 2/5 1-3 小时 新手友好度 65/100
CleverRaven/Cataclysm-DDA#89194 ·
维护者通常 1 天内回复
-
reproduced
难度 1/5 1 小时以内 新手友好度 67/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
moonshine-ai/moonshine#231 ·