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

Misc fixes to colourspace extension #171

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Documentation/sources/Reference/ofxPropertiesReference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ Properties Reference

.. doxygendefine:: kOfxImageEffectPropColourManagementAvailableConfigs

.. doxygendefine:: kOfxImageEffectPropColourManagementBasic
.. doxygendefine:: kOfxImageEffectColourManagementBasic

.. doxygendefine:: kOfxImageEffectPropColourManagementConfig
.. doxygendefine:: kOfxImageEffectColourManagementConfig

.. doxygendefine:: kOfxImageEffectPropColourManagementCore
.. doxygendefine:: kOfxImageEffectColourManagementCore

.. doxygendefine:: kOfxImageEffectPropColourManagementFull
.. doxygendefine:: kOfxImageEffectColourManagementFull

.. doxygendefine:: kOfxImageEffectPropColourManagementNone
.. doxygendefine:: kOfxImageEffectColourManagementNone

.. doxygendefine:: kOfxImageEffectPropColourManagementOCIO
.. doxygendefine:: kOfxImageEffectColourManagementOCIO

.. doxygendefine:: kOfxImageEffectPropColourManagementStyle

Expand Down
2 changes: 1 addition & 1 deletion Examples/ColourSpace/colourspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ getOutputColourspace( OfxImageEffectHandle effect, OfxPropertySetHandle /*inAr

OfxStatus status = kOfxStatReplyDefault;

if (gHostColourManagementStyle != kOfxImageEffectPropColourManagementNone) {
if (gHostColourManagementStyle != kOfxImageEffectColourManagementNone) {

// We could check kOfxImageClipPropPreferredColourspaces from inArgs here

Expand Down
20 changes: 19 additions & 1 deletion include/ofx-native-v1.5_aces-v1.3_ocio-v2.3.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
extern "C" {
#endif

/** @file ofx-native-v1.5_aces-v1.3_ocio-v2.3.h
/** @file ofxColourspaceList.h
Contains the list of supported colourspaces.
This file was auto-generated by scripts/genColour from ofx-native-v1.5_aces-v1.3_ocio-v2.3.
*/
Expand Down Expand Up @@ -770,46 +770,64 @@ Any scene-referred colourspace with a log transfer function.
Guaranteed to be ACES2065-1.
*/
#define kOfxColourspaceRoleAcesInterchange "aces_interchange"
#define kOfxColourspaceRoleAcesInterchangeIsBasic false
#define kOfxColourspaceRoleAcesInterchangeIsCore true

/** @brief cie_xyz_d65_interchange
CIE XYZ colorimetry with the neutral axis at D65.
*/
#define kOfxColourspaceRoleCieXyzD65Interchange "cie_xyz_d65_interchange"
#define kOfxColourspaceRoleCieXyzD65InterchangeIsBasic false
#define kOfxColourspaceRoleCieXyzD65InterchangeIsCore true

/** @brief color_picking
The colourspace to use for colour pickers, typically a display colourspace.
*/
#define kOfxColourspaceRoleColorPicking "color_picking"
#define kOfxColourspaceRoleColorPickingIsBasic false
#define kOfxColourspaceRoleColorPickingIsCore true

/** @brief color_timing
A colourspace suitable for colour grading, typically a log colourspace.
*/
#define kOfxColourspaceRoleColorTiming "color_timing"
#define kOfxColourspaceRoleColorTimingIsBasic false
#define kOfxColourspaceRoleColorTimingIsCore true

/** @brief compositing_log
Any scene-referred colourspace with a log transfer function.
*/
#define kOfxColourspaceRoleCompositingLog "compositing_log"
#define kOfxColourspaceRoleCompositingLogIsBasic false
#define kOfxColourspaceRoleCompositingLogIsCore true

/** @brief data
Image values should not be treated as colour, e.g. motion vectors or masks. Mapped to the raw colourspace.
*/
#define kOfxColourspaceRoleData "data"
#define kOfxColourspaceRoleDataIsBasic false
#define kOfxColourspaceRoleDataIsCore true

/** @brief matte_paint
A colourspace suitable for matte painting.
*/
#define kOfxColourspaceRoleMattePaint "matte_paint"
#define kOfxColourspaceRoleMattePaintIsBasic false
#define kOfxColourspaceRoleMattePaintIsCore true

/** @brief scene_linear
Any scene-referred linear colourspace.
*/
#define kOfxColourspaceRoleSceneLinear "scene_linear"
#define kOfxColourspaceRoleSceneLinearIsBasic false
#define kOfxColourspaceRoleSceneLinearIsCore true

/** @brief texture_paint
A colourspace suitable for texture painting, typically sRGB.
*/
#define kOfxColourspaceRoleTexturePaint "texture_paint"
#define kOfxColourspaceRoleTexturePaintIsBasic false
#define kOfxColourspaceRoleTexturePaintIsCore true

#ifdef __cplusplus
}
Expand Down
33 changes: 21 additions & 12 deletions include/ofxColour.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ Hosts should set this property to the colourspace of the input clip. Typically
it will be set to the working colourspace of the host but could be any valid
colourspace.

Plug-ins may set this property on an output clip. Plug-ins which output motion
vectors or similar images which should not be colour managed should use
kOfxColourspaceRaw,

Both host and plug-in should use the value of
kOfxImageClipPropPreferredColourspace where reasonable.

Expand All @@ -131,11 +127,11 @@ be reported in this property. If an OCIO host has added the basic colourspaces
to its config as roles or aliases, they would be permitted here.

Cross-referencing between clips is possible by setting this property to
"OfxColourspace_<clip>". For example a plug-in may set this property on its
output clip to "OfxColourspace_Source", telling the host that the colourspace
of the output matches the "Source" input clip. In the basic style, plug-ins
are recommended to use cross-referencing for their output clip unless
kOfxColourspaceRaw is required.
"OfxColourspace_<clip>". For example a plug-in may set this property during
kOfxImageEffectActionGetOutputColourspace to "OfxColourspace_Source", telling
he host that the colourspace of the output matches the "Source" input clip.
In the basic style, plug-ins are recommended to use cross-referencing for
their output clip unless kOfxColourspaceRaw is required.

If a clip sets OfxImageClipPropIsMask or it only supports
OfxImageComponentAlpha, colour management is disabled and this property
Expand Down Expand Up @@ -246,17 +242,30 @@ If not defined, the default rules for choosing a view will be followed.

This action allows a host to ask an effect, given a list of preferred
colourspaces, what colourspace will be used for its output clip. This should
be called after first gathering the plug-ins preferred input colourspaces
be called after first gathering the plug-in's preferred input colourspaces
via OfxImageEffectActionGetClipPreferences.

Cross-references to input clip colourspaces are permitted, for example in a
filter context, the host might request "OfxColourspace_Source".

If a host wants to rely on the output clip colourspace, it must call this
action whenever the effect instance is changed. Do not assume that the output
colourspace will be the same across all instances of an effect, or even for
the lifetime of an effect instance, because a plug-in may change its output
colourspace based on a user changing a parameter. Assume that the plug-in will
check kOfxImageClipPropColourspace on its input clips during this action in
order to decide the output clip colourspace, so the action must be called
again if the host changes any of the other colour properties.

On a successful return from this action, the host must set
kOfxImageClipPropColourspace on the instance's output clip to the value
from outArgs.

@param handle handle to the instance, cast to an \ref OfxImageEffectHandle
@param inArgs has the property
@param inArgs a property set containing the property
- \ref kOfxImageClipPropPreferredColourspaces the host's list of preferred colourspaces

@param outArgs has the property
@param outArgs a property set containing the property
- \ref kOfxImageClipPropColourspace the colourspace selected by the plug-in,
which may be a cross-reference to an input clip.

Expand Down
8 changes: 6 additions & 2 deletions scripts/genColour
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Extract information from an OCIO config to C header.
# Example invocation:
# OCIO=include/ofx-native-v1.5_aces-v1.3_ocio-v2.3.ocio scripts/genColour > include/ofxColourspaceList.h
# OCIO=include/ofx-native-v1.5_aces-v1.3_ocio-v2.3.ocio scripts/genColour > include/ofx-native-v1.5_aces-v1.3_ocio-v2.3.h

import sys
import PyOpenColorIO as OCIO
Expand Down Expand Up @@ -98,8 +98,12 @@ def print_basic_colourspace(role):

def print_role(role):
role_name = role[0]
role_prefix = f'Role{camel_name(role_name)}'
print(f'\n/** @brief {role_name}\n{role_docs[role_name]}\n*/')
print(f'{define_base}Role{camel_name(role_name)} "{role_name}"')
print(f'{define_base}{role_prefix} "{role_name}"')
# non-basic roles are included in the core style
print_bool_property(role_prefix, 'Basic', False)
print_bool_property(role_prefix, 'Core', True)

def print_string_property(name, propname, value):
print(f'{define_base}{camel_name(name)}{propname} "{value}"')
Expand Down
Loading