Skip to content

Support (half) float only OpenFX plugins#1218

Open
ddennedy wants to merge 7 commits intomasterfrom
openfx-float
Open

Support (half) float only OpenFX plugins#1218
ddennedy wants to merge 7 commits intomasterfrom
openfx-float

Conversation

@ddennedy
Copy link
Copy Markdown
Member

@ddennedy ddennedy commented Apr 5, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for OpenFX plugins that only accept half-float or float pixel depths by extending depth negotiation and introducing rgba64↔(half/float) conversion utilities in the OpenFX module.

Changes:

  • Extend supported OpenFX pixel depths to include half and float, and advertise these in host properties.
  • Add conversion helpers between MLT rgba64 and OFX half/float buffers (optionally OpenMP-parallelized).
  • Update the OpenFX filter render path to negotiate depth and perform half/float conversions around the plugin render call.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 11 comments.

File Description
src/modules/openfx/mlt_openfx.h Extends depth mask and API surface for clip depth overrides and new conversion helpers.
src/modules/openfx/mlt_openfx.c Implements half/float conversion utilities and wires new depth strings into host/clip metadata.
src/modules/openfx/filter_openfx.c Updates format/depth negotiation and adds half/float render-buffer conversion around OFX Render.
src/modules/openfx/CMakeLists.txt Adds optional OpenMP detection/linking for faster conversions.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/modules/openfx/mlt_openfx.c:1721

  • Same issue as the source clip: when ofx_depth is non-NULL, depth_byte_size is hard-coded as if the clip is RGBA and prop_component remains RGBA, ignoring format == mlt_image_rgb. This makes kOfxImagePropRowBytes/kOfxImageEffectPropComponents potentially inconsistent with the actual frame layout.

Suggestion: always set component/channels from format first, then compute row-bytes from channels × bytes-per-component derived from depth_format (byte/short/half/float).

    int depth_byte_size = 4;
    const char *depth_format = kOfxBitDepthByte;
    const char *prop_component = kOfxImageComponentRGBA;
    if (ofx_depth) {
        depth_format = ofx_depth;
        if (!strcmp(ofx_depth, kOfxBitDepthFloat))
            depth_byte_size = 16;
        else if (!strcmp(ofx_depth, kOfxBitDepthShort) || !strcmp(ofx_depth, kOfxBitDepthHalf))
            depth_byte_size = 8;
        else
            depth_byte_size = 4;
    } else if (format == mlt_image_rgba64) {
        depth_byte_size = 8;
        depth_format = kOfxBitDepthShort;
    } else if (format == mlt_image_rgb) {
        depth_byte_size = 3;
        prop_component = kOfxImageComponentRGB;
    }

Comment on lines +81 to +84
} else if (strcmp(type, "integer") == 0 || strcmp(type, "string") == 0
|| strcmp(type, "boolean") == 0) {
int value = mlt_properties_anim_get_int(properties, param_name, position, length);
mltofx_param_set_value(image_effect_params, param_name, mltofx_prop_int, value);
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update_plugin_params() treats type == "string" the same as integer/boolean: it reads an int (mlt_properties_anim_get_int) and calls mltofx_param_set_value(..., mltofx_prop_int, value). But mltofx_fetch_params() also maps real OFX kOfxParamTypeString params to type="string", and paramGetValueImpl() supports kOfxParamTypeString by reading MltOfxParamValue as a string. As a result, string parameters can never be set (and choice vs string cannot be distinguished).

Consider distinguishing choice vs real string (e.g., presence of a values property indicates choice), and for real strings read the string value from properties and call mltofx_param_set_value(..., mltofx_prop_string, ...). You’ll also need to extend paramSetValueImpl() in mlt_openfx.c to handle kOfxParamTypeString/kOfxParamTypeStrChoice by storing the string into MltOfxParamValue.

Suggested change
} else if (strcmp(type, "integer") == 0 || strcmp(type, "string") == 0
|| strcmp(type, "boolean") == 0) {
int value = mlt_properties_anim_get_int(properties, param_name, position, length);
mltofx_param_set_value(image_effect_params, param_name, mltofx_prop_int, value);
} else if (strcmp(type, "integer") == 0 || strcmp(type, "boolean") == 0) {
int value = mlt_properties_anim_get_int(properties, param_name, position, length);
mltofx_param_set_value(image_effect_params, param_name, mltofx_prop_int, value);
} else if (strcmp(type, "string") == 0) {
char *values = mlt_properties_get(param, "values");
if (values) {
int value = mlt_properties_anim_get_int(properties, param_name, position, length);
mltofx_param_set_value(image_effect_params, param_name, mltofx_prop_int, value);
} else {
char *value = mlt_properties_get(properties, param_name);
mltofx_param_set_value(image_effect_params,
param_name,
mltofx_prop_string,
value ? value : "");
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants