Skip to content

rust: Port the async video GPU conversion plan in obs-source.c to obs-source #2062

Closed

Description

@rdoupe

Unit

Port the async video GPU conversion plan in libobs/obs-source.c.h to rust/obs-source, as a new module conversion_plan.

What moves:

  • get_convert_type;
  • the twenty set_*_sizes, and the planning part of init_gpu_conversion: per-plane widths, heights and texture formats, and the channel count;
  • select_conversion_technique and need_linear_output.

What stays C: set_async_texture_size (the change check, the texture objects, the graphics context), upload_raw_frame, update_async_texrender and the shader parameters. convert_video_format also stays as an inline for its other callers.

Shape: one hidden entry point takes the frame's format, range, trc and size and returns a plan struct. The plan holds the convert type, channel count, widths, heights, formats, technique and linear flag. C copies it into the source as the setters do now. The technique crosses as an index into a static C-string table, with no allocation.

Plan (one PR, separate commits)

  1. Behaviour-neutral move into libobs/obs-source-conversion-plan.c.h. After the move, init_gpu_conversion only fills the plan and copies it to the source.
  2. Characterization test_async_conversion_plan, which pins the whole table. It covers every video_format plus two values outside the enum, × full_range, × every trc plus one outside. Sizes are 0, 1, 2, 3, odd, 1920 × 1080 and near UINT32_MAX. The near-UINT32_MAX cases are pinned as characterized, not endorsed.
  3. RED, then GREEN: the safe Rust core plus shims in a libobs.ported-source-conversion-plan group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C: exhaustive over format × range × trc, plus a proptest over full u32 sizes, with the technique compared as a string. Also a deliberate-break check and port_comparison numbers.

These real-libobs tests must stay green on every lane: test_media_restart_first_frame, test_deinterlace_2x_field_order, and the PipeWire camera NV12 test.

Activity

  1. rdoupe commented on Oct 24, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2062.

  2. added
    claimed
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions