Skip to content

Commit

Permalink
Merge pull request #23101 from thexai/dxvahd-refactor
Browse files Browse the repository at this point in the history
[Windows] minor refactor of DXVAHD
  • Loading branch information
thexai committed Apr 5, 2023
2 parents 6539599 + 8b04ee7 commit 1c215ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
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,
bool supportHDR,
bool limitedRange) const;

CCriticalSection m_section;

Expand Down

0 comments on commit 1c215ce

Please sign in to comment.