11 #include "cores/IPlayer.h" 12 #include "cores/VideoPlayer/VideoRenderers/VideoShaders/ConversionMatrix.h" 13 #include "guilib/D3DResource.h" 14 #include "utils/Geometry.h" 19 #include <DirectXMath.h> 20 #include <wrl/client.h> 23 #include <libavutil/pixfmt.h> 24 #include <libavutil/mastering_display_metadata.h> 36 virtual bool CreateVertexBuffer(
unsigned int vertCount,
unsigned int vertSize);
37 virtual bool LockVertexBuffer(
void **data);
38 virtual bool UnlockVertexBuffer();
39 virtual bool LoadEffect(
const std::string& filename, DefinesMap* defines);
40 virtual bool Execute(
const std::vector<CD3DTexture*>& targets,
unsigned int vertexIndexStep);
41 virtual void SetStepParams(
unsigned stepIndex) { }
42 virtual bool CreateInputLayout(D3D11_INPUT_ELEMENT_DESC *layout,
unsigned numElements);
52 unsigned int m_vbsize = 0;
53 unsigned int m_vertsize = 0;
54 Microsoft::WRL::ComPtr<ID3D11InputLayout> m_inputLayout =
nullptr;
63 void ApplyEffectParameters(
CD3DEffect &effect,
unsigned sourceWidth,
unsigned sourceHeight);
64 void GetDefines(DefinesMap &map)
const;
65 bool Create(
bool useLUT,
69 ETONEMAPMETHOD toneMethod,
72 ,
CD3DTexture& target,
unsigned range = 0,
float contrast = 0.5f,
float brightness = 0.5f);
74 ,
CD3DTexture& target,
unsigned range = 0,
float contrast = 0.5f,
float brightness = 0.5f);
75 void SetLUT(
int lutSize, ID3D11ShaderResourceView *pLUTView);
76 void SetDisplayMetadata(
bool hasDisplayMetadata, AVMasteringDisplayMetadata displayMetadata,
77 bool hasLightMetadata, AVContentLightMetadata lightMetadata);
78 void SetToneMapParam(ETONEMAPMETHOD method,
float param);
79 std::string GetDebugInfo();
81 static bool CreateLUTView(
int lutSize, uint16_t* lutData,
bool isRGB, ID3D11ShaderResourceView** ppLUTView);
90 bool HasLUT()
const {
return m_lutSize && m_pLUTView; }
91 void PrepareParameters(
unsigned sourceWidth,
unsigned sourceHeight,
CRect sourceRect,
const CPoint points[4]);
92 void SetShaderParameters(
CD3DTexture &sourceTexture,
unsigned range,
float contrast,
float brightness);
93 void CreateDitherView();
95 bool m_useLut =
false;
96 bool m_useDithering =
false;
97 bool m_toneMapping =
false;
98 bool m_useHLGtoPQ =
false;
100 bool m_hasDisplayMetadata =
false;
101 bool m_hasLightMetadata =
false;
102 unsigned m_sourceWidth = 0;
103 unsigned m_sourceHeight = 0;
105 int m_ditherDepth = 0;
106 ETONEMAPMETHOD m_toneMappingMethod = VS_TONEMAPMETHOD_OFF;
107 float m_toneMappingParam = 1.0f;
108 float m_toneMappingDebug = .0f;
110 CRect m_sourceRect = {};
111 CPoint m_destPoints[4] = {};
112 Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_pDitherView =
nullptr;
113 Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_pLUTView =
nullptr;
115 AVMasteringDisplayMetadata m_displayMetadata = {};
116 AVContentLightMetadata m_lightMetadata = {};
125 bool Create(AVPixelFormat
fmt,
126 AVColorPrimaries dstPrimaries,
127 AVColorPrimaries srcPrimaries,
128 const std::shared_ptr<COutputShader>& pOutShader =
nullptr);
130 void SetParams(
float contrast,
float black,
bool limited);
131 void SetColParams(AVColorSpace colSpace,
int bits,
bool limited,
int texBits);
144 unsigned int m_sourceWidth = 0;
145 unsigned int m_sourceHeight = 0;
146 CRect m_sourceRect = {};
148 AVPixelFormat m_format = AV_PIX_FMT_NONE;
149 std::array<float, 2> m_texSteps = {};
150 std::shared_ptr<COutputShader> m_pOutShader =
nullptr;
152 bool m_colorConversion{
false};
159 virtual bool Create(ESCALINGMETHOD method,
const std::shared_ptr<COutputShader>& pOutShader =
nullptr) = 0;
161 CRect sourceRect,
CRect destRect,
bool useLimitRange) = 0;
170 virtual bool ChooseKernelD3DFormat();
171 virtual bool CreateHQKernel(ESCALINGMETHOD method);
172 virtual void SetShaderParameters(
CD3DTexture &sourceTexture,
float* texSteps,
int texStepsCount,
bool useLimitRange) = 0;
174 bool m_floattex =
false;
176 DXGI_FORMAT m_KernelFormat = DXGI_FORMAT_UNKNOWN;
178 std::shared_ptr<COutputShader> m_pOutShader =
nullptr;
186 bool Create(ESCALINGMETHOD method,
const std::shared_ptr<COutputShader>& pOutputShader =
nullptr)
override;
188 CRect sourceRect,
CRect destRect,
bool useLimitRange)
override;
191 void PrepareParameters(
unsigned int sourceWidth,
unsigned int sourceHeight,
193 void SetShaderParameters(
CD3DTexture &sourceTexture,
float* texSteps,
194 int texStepsCount,
bool useLimitRange)
override;
197 unsigned int m_sourceWidth = 0;
198 unsigned int m_sourceHeight = 0;
199 CRect m_sourceRect = {};
200 CRect m_destRect = {};
209 bool Create(ESCALINGMETHOD method,
const std::shared_ptr<COutputShader>& pOutputShader =
nullptr)
override;
211 CRect sourceRect,
CRect destRect,
bool useLimitRange)
override;
214 bool ChooseIntermediateD3DFormat();
215 bool CreateIntermediateRenderTarget(
unsigned int width,
unsigned int height);
216 bool ClearIntermediateRenderTarget();
217 void PrepareParameters(
unsigned int sourceWidth,
unsigned int sourceHeight,
218 unsigned int destWidth,
unsigned int destHeight,
220 void SetShaderParameters(
CD3DTexture &sourceTexture,
float* texSteps,
221 int texStepsCount,
bool useLimitRange)
override;
222 void SetStepParams(
unsigned iPass)
override;
226 DXGI_FORMAT m_IntermediateFormat = DXGI_FORMAT_UNKNOWN;
227 unsigned int m_sourceWidth = 0;
228 unsigned int m_sourceHeight = 0;
229 unsigned int m_destWidth = 0;
230 unsigned int m_destHeight = 0;
231 CRect m_sourceRect = {};
232 CRect m_destRect = {};
238 virtual bool Create();
Definition: D3DResource.h:92
Definition: WinVideoFilter.h:181
Definition: WinVideoFilter.h:119
Definition: RendererBase.h:57
Definition: D3DResource.h:176
Definition: WinVideoFilter.h:235
Helper class used for YUV to RGB conversions.
Definition: ConversionMatrix.h:144
Definition: WinVideoFilter.h:30
Definition: WinVideoFilter.h:155
Definition: WinVideoFilter.h:163
Definition: WinVideoFilter.h:57
Definition: D3DResource.h:217
Definition: WinVideoFilter.h:203