MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / CDX9VideoProcessor

Method CDX9VideoProcessor

Source/DX9VideoProcessor.cpp:269–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267// CDX9VideoProcessor
268
269CDX9VideoProcessor::CDX9VideoProcessor(CMpcVideoRenderer* pFilter, const Settings_t& config, HRESULT& hr)
270 : CVideoProcessor(pFilter)
271{
272 m_bShowStats = config.bShowStats;
273 m_iResizeStats = config.iResizeStats;
274 m_iTexFormat = config.iTexFormat;
275 m_VPFormats = config.VPFmts;
276 m_iVPDeinterlacing = config.iVPDeinterlacing;
277 m_bDeintDouble = config.bDeintDouble;
278 m_bVPScaling = config.bVPScaling;
279 m_iChromaScaling = config.iChromaScaling;
280 m_iUpscaling = config.iUpscaling;
281 m_iDownscaling = config.iDownscaling;
282 m_bInterpolateAt50pct = config.bInterpolateAt50pct;
283 m_bUseDither = config.bUseDither;
284 m_bDeintBlend = config.bDeintBlend;
285 m_iSwapEffect = config.iSwapEffect;
286 m_bVBlankBeforePresent = config.bVBlankBeforePresent;
287 m_bAdjustPresentTime = config.bAdjustPresentTime;
288 m_bHdrPreferDoVi = config.bHdrPreferDoVi;
289 m_bHdrPassthrough = false;
290 m_iHdrToggleDisplay = HDRTD_Disabled;
291 m_bConvertToSdr = config.bConvertToSdr;
292 m_iSDRDisplayNits = config.iSDRDisplayNits;
293
294 m_nCurrentAdapter = D3DADAPTER_DEFAULT;
295
296 hr = Direct3DCreate9Ex(D3D_SDK_VERSION, &m_pD3DEx);
297 if (!m_pD3DEx || FAILED(hr)) {
298 DLog(L"CDX9VideoProcessor::CDX9VideoProcessor() : failed to call Direct3DCreate9Ex()");
299 hr = E_FAIL;
300 return;
301 }
302
303 hr = DXVA2CreateDirect3DDeviceManager9(&m_nResetTocken, &m_pD3DDeviceManager);
304 if (!m_pD3DDeviceManager || FAILED(hr)) {
305 DLog(L"CDX9VideoProcessor::CDX9VideoProcessor() : failed to call DXVA2CreateDirect3DDeviceManager9()");
306 hr = E_FAIL;
307 m_pD3DEx.Release();
308 return;
309 }
310
311 // set default ProcAmp ranges and values
312 SetDefaultDXVA2ProcAmpRanges(m_DXVA2ProcAmpRanges);
313 SetDefaultDXVA2ProcAmpValues(m_DXVA2ProcAmpValues);
314
315 pOrigSystemParametersInfoA = nullptr;
316 pOrigSetWindowLongA = nullptr;
317 pOrigSetWindowPos = nullptr;
318 pOrigShowWindow = nullptr;
319
320 m_evInit.Reset();
321 m_evResize.Reset();
322 m_evQuit.Reset();
323 m_evThreadFinishJob.Reset();
324
325 m_deviceThread = std::thread([this] { DeviceThreadFunc(); });
326}

Callers

nothing calls this directly

Calls 5

DLogFunction · 0.85
ReleaseMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected