Skip to content

decklink: Output BGRA only when supported #10392

Draft
DDRBoxman wants to merge 1 commit intoobsproject:masterfrom
DDRBoxman:decklink_pixelformat
Draft

decklink: Output BGRA only when supported #10392
DDRBoxman wants to merge 1 commit intoobsproject:masterfrom
DDRBoxman:decklink_pixelformat

Conversation

@DDRBoxman
Copy link
Member

@DDRBoxman DDRBoxman commented Mar 16, 2024

Description

Currently if you select a mode that doesn't support RGBA on Decklink output the image is corrupted.

Fixes #10380

Motivation and Context

#10380

How Has This Been Tested?

Sent video to the Ultra Studio 4k mini with multiple video modes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@DDRBoxman DDRBoxman force-pushed the decklink_pixelformat branch from 7e329d2 to cd0ea9c Compare March 16, 2024 23:33
@WizardCM WizardCM added the Bug Fix Non-breaking change which fixes an issue label Mar 16, 2024
Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message nits:

  • doesnt -> doesn't

If this fixes #10380, use "Fixes #10380" in the PR description to automatically link them.

@DDRBoxman DDRBoxman force-pushed the decklink_pixelformat branch from cd0ea9c to 1ee36ad Compare March 17, 2024 16:09
@DDRBoxman DDRBoxman changed the title decklink: Use the YUV pixel format if the device doesnt support keying decklink: Use the YUV pixel format if the device doesn't support keying Mar 17, 2024
@DDRBoxman DDRBoxman force-pushed the decklink_pixelformat branch 4 times, most recently from dbbdfa1 to 5a2e609 Compare March 17, 2024 17:06
@DDRBoxman DDRBoxman requested a review from RytoEX March 17, 2024 17:16
@RytoEX RytoEX added this to the OBS Studio (Next Version) milestone Mar 17, 2024
@RytoEX RytoEX self-assigned this Mar 17, 2024
@DDRBoxman DDRBoxman force-pushed the decklink_pixelformat branch from 5a2e609 to 43d9742 Compare March 17, 2024 18:00
@DDRBoxman DDRBoxman requested a review from RytoEX March 17, 2024 18:00
@DDRBoxman DDRBoxman force-pushed the decklink_pixelformat branch 2 times, most recently from 7f04e11 to 4164313 Compare March 17, 2024 21:03
@DDRBoxman DDRBoxman changed the title decklink: Use the YUV pixel format if the device doesn't support keying decklink: Use the YUV pixel format if the device doesn't support RBGA for the video mode Mar 21, 2024
@DDRBoxman DDRBoxman force-pushed the decklink_pixelformat branch 2 times, most recently from 4c6a2f4 to 927204e Compare March 21, 2024 17:54
@RytoEX RytoEX requested a review from jpark37 March 23, 2024 23:04
Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the commit message so that the subject is not wrapped on GitHub (70 characters or less, I think).

If you need to elaborate, use the commit message body.

Copy link
Collaborator

@Lain-B Lain-B left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional to always lock out BGRA/RGBA if it's not HDR? Or am I misunderstanding the PR?

@DDRBoxman DDRBoxman force-pushed the decklink_pixelformat branch from 927204e to 17e0db8 Compare March 24, 2024 03:28
@DDRBoxman DDRBoxman changed the title decklink: Use the YUV pixel format if the device doesn't support RBGA for the video mode decklink: Only output BGRA when supported Mar 24, 2024
@DDRBoxman DDRBoxman force-pushed the decklink_pixelformat branch from 17e0db8 to 3372f6b Compare March 24, 2024 03:29
@DDRBoxman
Copy link
Member Author

I tweaked the logic in decklink-output.cpp to actually match correctly on HDR and keyer. It worked on my device since it supports both but this should fix compatibility on more devices.

@DDRBoxman DDRBoxman requested review from Lain-B and RytoEX March 24, 2024 03:31
@norihiro
Copy link
Contributor

The commit message has a too long description in a line, 107 characters, limit 72.

Not all devices support the BGRA pixel format in all video modes. Make sure we fallback to YUV when needed.

Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@norihiro is right. Wrap the commit message body at 72 characters.
Also, nits:

  • fallback -> fall back
  • Only output BGRA when supported -> Output BGRA only when supported

On "fallback", the former is a noun. The latter is a verb.

If nits are addressed and @Lain-B or @jpark37 are happy with the PR itself, this should be good afterward.

@DDRBoxman DDRBoxman force-pushed the decklink_pixelformat branch from 3372f6b to e502eb9 Compare March 27, 2024 22:12
@DDRBoxman DDRBoxman requested a review from RytoEX March 27, 2024 22:13
Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still nit on commit message subject to place verb first:

  • Only output BGRA when supported -> Output BGRA only when supported

decklink: Output BGRA only when supported

Not all devices support the BGRA pixel format in all video modes.
Make sure we fall back to YUV when needed.
@DDRBoxman DDRBoxman force-pushed the decklink_pixelformat branch from e502eb9 to ebd5aa9 Compare March 28, 2024 00:18
@DDRBoxman DDRBoxman requested a review from RytoEX March 28, 2024 00:18
Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits fixed. Will await other reviews.

@DDRBoxman DDRBoxman changed the title decklink: Only output BGRA when supported decklink: Output BGRA only when supported Mar 28, 2024

struct video_scale_info to = {};
to.format = VIDEO_FORMAT_BGRA;
to.format = (modeSupportsBGRA || supportsHDR)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed that this code is "if supports BGR or HDR, use BGRA" -- wouldn't this just be "if supports BGR, use BGR"?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible I'm misunderstanding this expression though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that probably makes more sense, I think I got confused since HDR was setup for bgra

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm HDR is using bmdFormat10BitRGBXLE on the device. We should also probably check if that is supported for the current format too. And then figure out like YUV HDR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably set this back to always RGB and then do conversions on the GPU here for when we need YUV

gs_effect_t *const effect = obs_get_base_effect(OBS_EFFECT_DEFAULT);

@RytoEX RytoEX marked this pull request as draft April 5, 2024 00:28
@RytoEX
Copy link
Member

RytoEX commented Apr 5, 2024

Setting back to draft per off-thread conversation that the open review thread requires writing new shaders to resolve.

@RytoEX
Copy link
Member

RytoEX commented Jan 16, 2025

Setting back to draft per off-thread conversation that the open review thread requires writing new shaders to resolve.

I presume this is still the case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Fix Non-breaking change which fixes an issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updates to the Decklink Plugin do not properly support all resolutions

6 participants