Skip to content

rust: Port the output frame copy plan and scale effect in obs-video.c to obs-core #2118

Closed

Description

@rdoupe

Unit

Port the output frame copy plan and the scale effect choice in libobs/obs-video.c.h to rust/obs-core, as a new module video_copy_plan. It sits next to video_plan (#1714), which sizes the conversion textures this code copies from. These decisions move:

  • set_gpu_converted_plane and set_gpu_converted_data: per format, each plane's row bytes, rows, and source and destination strides, plus the packed NV12/P010 case where the UV plane follows plane 0 in the same buffer;
  • copy_rgbx_frame: one copy when the line sizes match, otherwise rows of width * 4;
  • get_scale_effect_internal, resolution_close and get_scale_effect: the low-resolution rule, the scale type table, the "close enough" rule (within 16 px), and the fallback when an effect failed to load;
  • can_reuse_mix_texture: the per-mix match. C keeps the walk.

These stay in C: every memcpy, the frame lock and unlock, the effect pointers (Rust returns an enum that C maps), and the mix list and its lock.

Plan (one PR, separate commits)

  1. A behaviour-neutral move into libobs/obs-video-copy-plan.c.h, as hidden functions. set_gpu_converted_data becomes "get the plan, run the copies".
  2. Characterization: test_video_copy_plan_steps. It covers:
    • every video_format, plus values outside the enum;
    • equal and unequal line sizes, and a zero second line size for NV12 and P010;
    • widths of 0, 1, odd, and near the wrap;
    • the scale effect for each type, low-res or not, close or not, and each effect missing;
    • resolution_close at ±15, ±16 and ±17.
  3. RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-video-copy-plan group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C: exhaustive over format × line-size equality, a proptest over full-range sizes and line sizes, and the effect enum over all inputs. Run the step test under ASan. Also a deliberate-break check and port_comparison numbers.

These real-libobs tests must stay green on every lane: test_video_output_formats, test_scaled_mix_alpha, test_encoding_lag_rescale and test_video_output_plan.

Activity

  1. rdoupe commented on Oct 24, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2118.

  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