OpenFX (OFX) Documentation

repository·main·Indexed 19 days ago

https://github.com/academysoftwarefoundation/openfx

OpenFX (OFX) is an industry-standard software interface that enables video effects plug-ins to work across various host applications, such as compositors and editors. This documentation covers the OFX core interface, the C++ property system including host-extensible properties, API reference manuals, and guides for building libraries and plugins using Conan and CMake.

Tokens
82.7K
Snippets
129
Records
304
Agent score
68%

What's inside OpenFX

  1. Overview of OFX Image Effect API examples

    main

    The examples in this directory demonstrate specific features of the OFX Image Effect API. They are intended as functional demonstrations of API capabilities rather than high-quality image processing or programming implementations.

    Note: The examples are written in C++ and were originally developed for IRIX 6.5. While they should compile on other operating systems, the provided Makefiles may be platform-specific.

  2. Navigate the OpenFX documentation

    main

    The OpenFX documentation is divided into three primary sections to help you integrate with the OpenFX standard:

    • Programming Guide: Use this to get started with creating a new plug-in or a host application.
    • Reference Guide: Provides the full technical reference for the OpenFX protocol and its design.
    • Release Notes: Contains documentation regarding changes in recent OpenFX releases.

    You can also access the documentation online at https://docs.openeffects.org.

  3. OpenFX V1.4 New Features and Suites

    main

    OpenFX version 1.4 introduces several new capabilities for plugin developers and host implementations:

    • Dialog Suite: The OfxDialogSuiteV1 allows plugins to request that the host display a modal dialog.
    • Progress Suite Updates: OfxProgressSuiteV2 is available, providing an internationalizable version of the progress reporting mechanism.
    • Draft Render Quality: Support for draft render quality via the kOfxImageEffectPropRenderQualityDraft property.
    • Native Origin: The kOfxImageEffectHostPropNativeOrigin property allows hosts to communicate the native origin of the image.
    • CPU Rendering Improvements: The half-float format tag is now available for CPU rendering, extending support beyond just OpenGL.
    • Clarified Semantics: The specification clarifies that OpenGL processing and tiled rendering can be enabled or disabled within Instance Changed events. It also clarifies the semantics for dialogs and the progress suite.
  4. Understand the OFX architecture and use cases

    main

    OFX is a generic C-based plug-in architecture designed for visual effects and image processing. It provides a consistent API that allows plug-ins to work across diverse host applications, including:

    • Compositing hosts
    • Rotoscopers
    • Encoding applications
    • Colour grading hosts
    • Editing hosts

    The API is feature-rich and designed to be flexible; not every host is required to implement every aspect of the API. Hosts are encouraged to extend the standard by providing proprietary suites, actions, properties, and settings to better fit their specific application workflows.

  5. Overview of OpenFX suites

    main
    OpenFX provides functionality through a collection of 'suites'. A suite is a group of related functions (an interface) that a Host provides to a Plug-in. Instead of a single monolithic API, OpenFX uses these specialized suites to allow Plug-ins to access specific capabilities like image processing, memory management, threading, or timeline interaction. To use a specific capability, a Plug-in must request the corresponding suite from the Host during its initialization.
  6. Communicate via Properties

    main

    Plugins and hosts communicate using a property mechanism. A property is a named object within a property set (similar to a dictionary). You access these using the property suite defined in ofxProperty.h.

    Fundamental Types:

    • int
    • double
    • char * (strings)
    • void *

    Multidimensional Properties: Properties can be multidimensional (e.g., a 2D integer for pen position). You can access individual elements via an index or set all values at once using functions like OfxPropertySuiteV1::propSetIntN.

    Important Memory Note: When fetching a string property, the returned pointer is only guaranteed to be valid until the next call to an OFX suite function or until the current action ends. If you need to use the string outside this scope, you must copy it.

    OfxPropertySetHandle effectProps;
    gImageEffectSuite->getPropertySet(effect, &effectProps);
    
    // Setting a string property using kOfxPropLabel
    gPropertySuite->propSetString(effectProps, kOfxPropLabel, 0, "OFX Basics Example");
  7. How the Host-Extensible Property System works

    main

    The OpenFX C++ property system allows hosts to define custom properties that plugins can access with full type safety without modifying the OpenFX core.

    This is achieved through Argument-Dependent Lookup (ADL) and C++17 auto template parameters. The PropertyAccessor uses a template parameter id to accept any enum type. When a plugin calls props.get<myhost::PropId::SomeProp>(), the compiler uses ADL to find the prop_traits_helper function defined in the host's specific namespace (myhost), which provides the necessary type metadata for that property.

    This mechanism ensures:

    • Zero coupling: The OpenFX core remains independent of host-specific logic.
    • Type safety: Plugins get compile-time type checking for host-specific properties.
    • Optionality: Plugins can gracefully handle cases where they are running in a host that does not support the custom properties.
  8. Mandated pseudo-parameters in Retimer and Transition contexts

    main

    In certain OFX contexts, the host application communicates state to the plug-in using specific 'pseudo-parameters'. These are not intended to be exposed on the plug-in's user interface (UI) for manual user adjustment; instead, the host manages them implicitly or via its own UI (like a timeline or a curve).

    Transition Context

    Requires a double parameter named Transition. The host uses this to indicate the progress of a transition between two clips. The host calculates this value based on the current frame's position relative to the transition duration.

    Retimer Context

    Requires a double parameter named SourceTime. The host uses this to communicate the mapping of the current frame to the source media time. The host may derive this value from a timeline stretch or a 'speed' parameter.

    // Conceptual logic for how a host might calculate the Transition parameter:
    Transition = (currentFrame - startOfTransition) / lengthOfTransition;
  9. Handle frame-varying and continuously sampled effects

    main

    Plugins can signal to the host how they generate images over time using two specific properties during the kOfxImageEffectActionGetClipPreferences action:

    Frame Varying Effects

    Use kOfxImageEffectFrameVarying to indicate if an effect produces different images even when parameters and inputs are static (e.g., a random noise generator).

    • Set to 1: The effect must be rendered at every frame. The host cannot cache a single frame for all time.
    • Set to 0 (Default): If inputs and parameters don't change, the host can render one frame and reuse it.

    Continuously Sampled Effects

    Use kOfxImageClipPropContinuousSamples to indicate if an effect can generate images at non-frame-time boundaries (sub-frame rendering).

    • Set to true: The plugin supports sampling at arbitrary times (e.g., a fractal cloud generator with a speed parameter).
    • Default: false.
    • Note: All retimer effects are implicitly continuously sampled.
  10. How the OFX documentation architecture works

    main

    The OFX documentation system is a multi-stage pipeline that combines C++ header parsing with prose documentation:

    1. Doxygen: Extracts API documentation from C/C++ header comments in the include directory.
    2. Breathe: A Sphinx extension that acts as a bridge, allowing Sphinx to consume Doxygen's XML output.
    3. Sphinx: The core engine that processes ReStructured Text (.rst) files and the Breathe-provided Doxygen data to generate the final HTML.
    4. Python Scripts:
      • scripts/gen-props.py: Generates C++ metadata headers from inline YAML.
      • scripts/gen-props-doc.py: Generates RST reference pages from inline metadata.

    Documentation Structure:

    • Reference manual: API docs generated from Doxygen comments.
    • Guide: Tutorial content and examples written in RST.
    • Release notes: Version-specific information.
  11. Handle OFX status codes

    main
    Most functions in OFX host suites and all actions within an OFX plug-in return a 32-bit integer status code to indicate the success or failure of an operation. These codes are defined as the OfxStatus type in ofxCore.h. Developers should check these return values to ensure operations like parameter setting, image processing, or resource allocation have completed successfully.