UYVY backend
All checks were successful
CI / React UI Build (push) Successful in 11s
CI / Native Windows Build And Tests (push) Successful in 2m22s
CI / Windows Release Package (push) Has been skipped

This commit is contained in:
Aiden
2026-05-30 19:16:16 +10:00
parent d0b1f63524
commit f0f8b080ca
30 changed files with 733 additions and 239 deletions

View File

@@ -117,6 +117,11 @@ bool OutputSupportsFormat(IDeckLinkOutput* output, BMDDisplayMode displayMode, B
&supported);
return result == S_OK && supported != FALSE;
}
bool RenderReadbackSupportsOutputFormat(VideoIOPixelFormat pixelFormat)
{
return pixelFormat == VideoIOPixelFormat::Bgra8 || pixelFormat == VideoIOPixelFormat::Uyvy8;
}
}
DeckLinkSession::~DeckLinkSession()
@@ -254,7 +259,7 @@ bool DeckLinkSession::DiscoverDevicesAndModes(const VideoFormatSelection& videoM
return true;
}
bool DeckLinkSession::SelectPreferredFormats(const VideoFormatSelection& videoModes, bool outputAlphaRequired, std::string& error)
bool DeckLinkSession::SelectPreferredFormats(const VideoFormatSelection& videoModes, VideoIOPixelFormat systemFramePixelFormat, bool outputAlphaRequired, std::string& error)
{
if (!output)
{
@@ -271,18 +276,30 @@ bool DeckLinkSession::SelectPreferredFormats(const VideoFormatSelection& videoMo
}
mState.inputPixelFormat = VideoIOPixelFormat::Uyvy8;
if (!RenderReadbackSupportsOutputFormat(systemFramePixelFormat))
{
error = "DeckLink output requested " + std::string(VideoIOPixelFormatName(systemFramePixelFormat)) +
", but render readback currently supports only BGRA8 and UYVY8 system frames.";
return false;
}
if (outputAlphaRequired && systemFramePixelFormat != VideoIOPixelFormat::Bgra8)
{
error = "DeckLink alpha output requires BGRA8 system frames until a YUVA render packer exists.";
return false;
}
const bool outputTenBitSupported = OutputSupportsFormat(output, outputDisplayMode, bmdFormat10BitYUV);
const bool outputTenBitYuvaSupported = OutputSupportsFormat(output, outputDisplayMode, bmdFormat10BitYUVA);
mState.outputPixelFormat = outputAlphaRequired
? (outputTenBitYuvaSupported ? VideoIOPixelFormat::Yuva10 : VideoIOPixelFormat::Bgra8)
: (outputTenBitSupported ? VideoIOPixelFormat::V210 : VideoIOPixelFormat::Bgra8);
if (outputAlphaRequired && outputTenBitYuvaSupported)
mState.formatStatusMessage += "External keying requires alpha; using 10-bit YUVA output. ";
else if (outputAlphaRequired)
mState.formatStatusMessage += "External keying requires alpha, but DeckLink output does not report 10-bit YUVA support for the configured mode; using 8-bit BGRA output. ";
else if (!outputTenBitSupported)
mState.formatStatusMessage += "DeckLink output does not report 10-bit YUV support for the configured mode; using 8-bit BGRA output. ";
const BMDPixelFormat requestedOutputPixelFormat = DeckLinkPixelFormatForVideoIO(systemFramePixelFormat);
if (!OutputSupportsFormat(output, outputDisplayMode, requestedOutputPixelFormat))
{
error = "DeckLink output does not report support for " +
std::string(VideoIOPixelFormatName(systemFramePixelFormat)) +
" in the configured display mode.";
return false;
}
mState.outputPixelFormat = systemFramePixelFormat;
if (outputAlphaRequired)
mState.formatStatusMessage += "External keying requires alpha; using BGRA8 system frames. ";
int deckLinkOutputRowBytes = 0;
if (output->RowBytesForPixelFormat(DeckLinkPixelFormatForVideoIO(mState.outputPixelFormat), mState.outputFrameSize.width, &deckLinkOutputRowBytes) != S_OK)
@@ -291,9 +308,12 @@ bool DeckLinkSession::SelectPreferredFormats(const VideoFormatSelection& videoMo
return false;
}
mState.outputFrameRowBytes = static_cast<unsigned>(deckLinkOutputRowBytes);
mState.outputPackTextureWidth = OutputIsTenBit()
? PackedTextureWidthFromRowBytes(mState.outputFrameRowBytes)
: mState.outputFrameSize.width;
if (OutputIsTenBit())
mState.outputPackTextureWidth = PackedTextureWidthFromRowBytes(mState.outputFrameRowBytes);
else if (mState.outputPixelFormat == VideoIOPixelFormat::Uyvy8)
mState.outputPackTextureWidth = mState.outputFrameSize.width / 2u;
else
mState.outputPackTextureWidth = mState.outputFrameSize.width;
if (InputIsTenBit())
{