Skip to content

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

Closed

Description

@rdoupe

Unit

Port the source draw decisions in libobs/obs-source.c.h to rust/obs-source, as a new module draw_plan. It reuses the draw technique enum from the deinterlace draw port (#2153). These decisions move:

  • rotate_async_video: the translate for 90, 180 and 270 degrees. Since libobs: Keep an async rotation in 0-359 #2136 the rotation is always in 0-359.
  • obs_source_render_async_video: for each pair of colour spaces, the technique, the multiplier, linear_srgb and the non-linear alpha choice.
  • source_render: for each pair of colour spaces, the conversion technique and multiplier, and whether to render through color_space_texrender.

These stay in C: every gs_* call, convert_video_space, obs_get_video_sdr_white_level() (C passes in the value), gs_get_format_from_space and the texrenders.

Plan (one PR, separate commits)

  1. A behaviour-neutral move into libobs/obs-source-draw-plan.c.h, as hidden functions.
  2. Characterization in test_source_draw_plan_steps. It covers:
    • every source/current space pair, with SDR white levels of 80, 300 and 0;
    • linear sRGB on and off, and linear alpha on and off;
    • rotations 0, 90, 180 and 270, plus a non-multiple of 90, with non-square sizes.
  3. RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-source-draw-plan group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C: exhaustive over spaces and flags, plus a proptest over f32 white levels as bit patterns and full-range sizes. Also a deliberate-break check and port_comparison numbers.

These real-libobs tests must stay green on every lane:

  • test_async_rotation_normalize
  • test_filter_color_space
  • test_source_color_space_steps
  • the HDR and SDR source render tests
  • the deinterlace draw tests

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