libobs: Add UYVA pixel format support #12125
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request is heavily based on this one which was recently closed due to inactivity: #10345
For readability reasons I'm going to be copying all of its information into this one, too.
This change adds the YUVA pixel format, which is a 4:2:2:4 semi-planar with packed YUV data in one place and a second plane with only alpha data as documented here: docs.ndi.video/docs/sdk/frame-types
Note that best I can tell, NDI is the only software that uses this pixel format, and other software may use YUVA to refer to a different format. I am open to suggestions of alternative names for this format in OBS.
Motivation and Context
NDI uses an unusual format for pixel data with transparency, and obs-ndi was silently ignoring the alpha plane of that format leading to these bug reports :DistroAV/DistroAV#937 and DistroAV/DistroAV#983
The motivation and context for making a new PR is due to the inactivity on the previous one as well as missing formatting, rebasing and compilation issues.
Additionally, this PR also includes a small oversight in the pixel shader (
format_conversion.effect
) as well as bringing UYVA support into a 2 more places (OBSBasic.cpp
andvideo-fourcc.c
)How Has This Been Tested?
The original PR has been tested on Windows and macOS using one OBS instance sending a source with transparency over NDI (which already worked correctly) and another instance receiving (along with a small patch to obs-ndi to use the new format which I will submit as a PR on that side after this has been merged)
This PR has been tested only on Windows but with the same approach (small patch to DistroAV, formerly known as obs-ndi)
Types of changes
Checklist: