Skip to content

Windows: full-range imported video is drawn as limited range, clipping shadows and highlights #1531

Open

Description

@EtienneLescot

On Windows, the decoders ignore the colour range of imported footage. A full-range (AVCOL_RANGE_JPEG) video tagged with a plain yuv* pixel format is drawn as limited range, so its shadows and highlights clip in both preview and export.

Where

  • crates/compositor/src/cpu_frames_windows.rs, ensure_sws: sws_getContext gets only the pixel format, never the frame's color_range, so swscale treats yuv420p / yuv420p10le as limited and copies full-range values as they are. Only the yuvj* formats are converted.
  • crates/compositor/src/shaders.hlsl, yuv709_limited: the NV12 shader always reads limited range.
  • The D3D11VA path passes the decoder's NV12 surface to the same shader, so full-range 8-bit H.264 is affected too.

Already true on main for AV1 and VP9 on CpuFrames, for every H.264 stream when the GPU backend is Cpu, and for full-range 8-bit H.264 on D3D11VA. OpenScreen's own recordings are tagged limited range (#923), so only imported files are concerned.

Possible fix: pass the frame's range to swscale (sws_setColorspaceDetails with srcRange from frame->color_range, dstRange limited), and normalise the hardware path the same way or pass the range to the shader.

Found during the review of #1530 (#1530 (comment)).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions