[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / DXVAHD.h
blob943a64a0eb0a18e2acb756627f6c25b4bbdaddb0
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "DVDCodecs/Video/DVDVideoCodecFFmpeg.h"
12 #include "DVDCodecs/Video/DXVA.h"
13 #include "VideoRenderers/HwDecRender/DXVAEnumeratorHD.h"
14 #include "VideoRenderers/Windows/RendererBase.h"
15 #include "guilib/D3DResource.h"
16 #include "utils/Geometry.h"
18 #include <mutex>
20 #include <wrl/client.h>
22 class CRenderBuffer;
24 namespace DXVA {
26 using namespace Microsoft::WRL;
28 struct ProcColorSpaces;
30 class CProcessorHD : public ID3DResource
32 public:
33 explicit CProcessorHD();
34 ~CProcessorHD();
36 void UnInit();
37 bool Open(const VideoPicture& picture, std::shared_ptr<DXVA::CEnumeratorHD> enumerator);
38 void Close();
39 bool Render(CRect src, CRect dst, ID3D11Resource* target, CRenderBuffer **views, DWORD flags, UINT frameIdx, UINT rotation, float contrast, float brightness);
40 uint8_t PastRefs() const { return std::min(m_procCaps.m_rateCaps.PastFrames, 4u); }
42 /*!
43 * \brief Configure the processor for the provided conversion.
44 * \param conversion the conversion
45 * \return success status, true = success, false = error
47 bool SetConversion(const ProcessorConversion& conversion);
49 // ID3DResource overrides
50 void OnCreateDevice() override {}
51 void OnDestroyDevice(bool) override
53 std::unique_lock<CCriticalSection> lock(m_section);
54 UnInit();
57 static bool IsSuperResolutionSuitable(const VideoPicture& picture);
58 void TryEnableVideoSuperResolution();
59 bool IsVideoSuperResolutionEnabled() const { return m_superResolutionEnabled; }
60 bool Supports(ERENDERFEATURE feature) const;
62 protected:
63 bool ReInit();
64 bool InitProcessor();
65 bool CheckFormats() const;
66 bool OpenProcessor();
67 void ApplyFilter(D3D11_VIDEO_PROCESSOR_FILTER filter, int value, int min, int max, int def) const;
68 ComPtr<ID3D11VideoProcessorInputView> GetInputView(CRenderBuffer* view) const;
69 /*!
70 * \brief Apply new video settings if there was a change. Returns true if a parameter changed, false otherwise.
72 bool CheckVideoParameters(const CRect& src,
73 const CRect& dst,
74 const UINT& rotation,
75 const float& contrast,
76 const float& brightness,
77 const CRenderBuffer& rb);
79 void EnableIntelVideoSuperResolution();
80 void EnableNvidiaRTXVideoSuperResolution();
82 CCriticalSection m_section;
84 ComPtr<ID3D11VideoDevice> m_pVideoDevice;
85 ComPtr<ID3D11VideoContext> m_pVideoContext;
86 ComPtr<ID3D11VideoProcessor> m_pVideoProcessor;
87 std::shared_ptr<CEnumeratorHD> m_enumerator;
89 AVColorPrimaries m_color_primaries{AVCOL_PRI_UNSPECIFIED};
90 AVColorTransferCharacteristic m_color_transfer{AVCOL_TRC_UNSPECIFIED};
91 ProcessorCapabilities m_procCaps;
93 bool m_superResolutionEnabled{false};
94 ProcessorConversion m_conversion;
95 bool m_isValidConversion{false};
97 /*!
98 * \brief true when at least one frame has been processed successfully since init
100 bool m_configured{false};
102 // Members to compare the current frame with the previous frame
103 UINT m_lastInputFrameOrField{0};
104 UINT m_lastOutputIndex{0};
105 CRect m_lastSrc{};
106 CRect m_lastDst{};
107 UINT m_lastRotation{0};
108 float m_lastContrast{.0f};
109 float m_lastBrightness{.0f};
110 ProcessorConversion m_lastConversion{};
111 AVColorSpace m_lastColorSpace{AVCOL_SPC_UNSPECIFIED};
112 bool m_lastFullRange{false};