Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] minor refactor of DXVAHD #23101

Merged
merged 1 commit into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,10 @@ DXGI_COLOR_SPACE_TYPE CProcessorHD::GetDXGIColorSpaceSource(const DXGIColorSpace
}

DXGI_COLOR_SPACE_TYPE CProcessorHD::GetDXGIColorSpaceTarget(const DXGIColorSpaceArgs& csArgs,
bool supportHDR)
bool supportHDR,
bool limitedRange) const
{
DXGI_COLOR_SPACE_TYPE color;

color = DX::Windowing()->UseLimitedColor() ? DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709
DXGI_COLOR_SPACE_TYPE color = limitedRange ? DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709
: DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;

if (!DX::Windowing()->IsHDROutput())
Expand All @@ -533,13 +532,13 @@ DXGI_COLOR_SPACE_TYPE CProcessorHD::GetDXGIColorSpaceTarget(const DXGIColorSpace
{
if (supportHDR)
{
color = DX::Windowing()->UseLimitedColor() ? DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020
: DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020;
color = limitedRange ? DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020
: DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020;
}
else
{
color = DX::Windowing()->UseLimitedColor() ? DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020
: DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020;
color = limitedRange ? DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020
: DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020;
}
}

Expand Down Expand Up @@ -723,9 +722,9 @@ bool CProcessorHD::Render(CRect src, CRect dst, ID3D11Resource* target, CRenderB

ProcColorSpaces CProcessorHD::CalculateDXGIColorSpaces(const DXGIColorSpaceArgs& csArgs) const
{
bool supportHDR = DX::Windowing()->IsHDROutput() &&
(m_bSupportHDR10Limited || !DX::Windowing()->UseLimitedColor());
const bool limited = DX::Windowing()->UseLimitedColor();
const bool supportHDR = DX::Windowing()->IsHDROutput() && (m_bSupportHDR10Limited || !limited);

return ProcColorSpaces{GetDXGIColorSpaceSource(csArgs, supportHDR, m_bSupportHLG),
GetDXGIColorSpaceTarget(csArgs, supportHDR)};
GetDXGIColorSpaceTarget(csArgs, supportHDR, limited)};
}
12 changes: 6 additions & 6 deletions xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ class CProcessorHD : public ID3DResource
UnInit();
}

static DXGI_COLOR_SPACE_TYPE GetDXGIColorSpaceSource(const DXGIColorSpaceArgs& csArgs,
bool supportHDR,
bool supportHLG);
static DXGI_COLOR_SPACE_TYPE GetDXGIColorSpaceTarget(const DXGIColorSpaceArgs& csArgs,
bool supportHDR);

protected:
bool ReInit();
bool InitProcessor();
Expand All @@ -129,6 +123,12 @@ class CProcessorHD : public ID3DResource
* \return the input and output color spaces
*/
ProcColorSpaces CalculateDXGIColorSpaces(const DXGIColorSpaceArgs& csArgs) const;
static DXGI_COLOR_SPACE_TYPE GetDXGIColorSpaceSource(const DXGIColorSpaceArgs& csArgs,
bool supportHDR,
bool supportHLG);
DXGI_COLOR_SPACE_TYPE GetDXGIColorSpaceTarget(const DXGIColorSpaceArgs& csArgs,
Copy link
Contributor

Choose a reason for hiding this comment

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

not static anymore? I think it's good it doesn't rely on class members.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed static as seems a bit confusing due calls others methods inside. In the other hand GetDXGIColorSpaceSource is self contained as not calls others methods. But actually the two methods could be static or not.

bool supportHDR,
bool limitedRange) const;

CCriticalSection m_section;

Expand Down