Skip to content

rust: Port the deinterlace draw plan in obs-source-deinterlace.c to obs-source #2130

Closed

Description

@rdoupe

Unit

Port the deinterlace draw decisions in libobs/obs-source-deinterlace.c.h to rust/obs-source, as a new module deinterlace_draw next to deinterlace_pacing. These decisions move:

  • get_effect: the mode-to-effect table. Rust returns an index; C keeps obs_load_effect and the effect slots.
  • deinterlace_linear_required.
  • In deinterlace_render:
    • the early return;
    • linear_srgb;
    • the technique and multiplier for each pair of source and current colour spaces;
    • the frame2 compare.
  • In obs_source_set_deinterlace_mode: the transition, which is one of same, enable, disable or switch. Since libobs: Disable an out-of-range deinterlace mode instead of drawing nothing #2120, a mode outside the enum is treated as disable.

These stay in C:

  • every gs_* call, kept in its order;
  • obs_load_effect, convert_video_space and obs_get_video_sdr_white_level(). C passes their results in.
  • enable_deinterlacing, disable_deinterlacing and obs_enter_graphics.

Plan (one PR, separate commits)

  1. A behaviour-neutral move into libobs/obs-source-deinterlace-draw.c.h, as hidden functions.
  2. Characterization in test_deinterlace_draw_plan_steps. It covers:
    • every mode, plus -1 and 99, for the effect index and the linear rule;
    • the 4 × 4 space pairs, at SDR white levels of 80, 300 and 0;
    • frame2 at the threshold - 1, at the threshold, at + 1, and at the u64 wrap;
    • every mode change.
  3. RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-source-deinterlace-draw group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C. It is exhaustive over modes (including i32 values outside the enum), space pairs and flags, and adds a proptest over full-range u64 times and f32 white levels taken as bit patterns. Also a deliberate-break check and port_comparison numbers.

These real-libobs tests must stay green on every lane: test_deinterlace_2x_field_order, test_deinterlace_pacing_steps, test_deinterlace_mode_load and test_media_restart_first_frame.

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