| 2243 | } |
| 2244 | |
| 2245 | HRESULT CDX9VideoProcessor::UpdateConvertColorShader() |
| 2246 | { |
| 2247 | m_pPSConvertColor.Release(); |
| 2248 | m_pPSConvertColorDeint.Release(); |
| 2249 | HRESULT hr = S_OK; |
| 2250 | |
| 2251 | if (m_TexSrcVideo.pTexture) { |
| 2252 | int convertType = m_bConvertToSdr ? SHADER_CONVERT_TO_SDR : SHADER_CONVERT_NONE; |
| 2253 | |
| 2254 | MediaSideDataDOVIMetadata* pDOVIMetadata = m_Dovi.bValid ? &m_Dovi.msd : nullptr; |
| 2255 | |
| 2256 | ID3DBlob* pShaderCode = nullptr; |
| 2257 | hr = GetShaderConvertColor(false, |
| 2258 | m_srcWidth, |
| 2259 | m_TexSrcVideo.Width, m_TexSrcVideo.Height, |
| 2260 | m_srcRect, m_srcParams, m_srcExFmt, pDOVIMetadata, |
| 2261 | m_iChromaScaling, convertType, false, |
| 2262 | &pShaderCode); |
| 2263 | if (S_OK == hr) { |
| 2264 | hr = m_pD3DDevEx->CreatePixelShader((const DWORD*)pShaderCode->GetBufferPointer(), &m_pPSConvertColor); |
| 2265 | pShaderCode->Release(); |
| 2266 | } |
| 2267 | |
| 2268 | if (m_bInterlaced && m_srcParams.Subsampling == 420 && m_srcParams.pDX9Planes) { |
| 2269 | hr = GetShaderConvertColor(false, |
| 2270 | m_srcWidth, |
| 2271 | m_TexSrcVideo.Width, m_TexSrcVideo.Height, |
| 2272 | m_srcRect, m_srcParams, m_srcExFmt, pDOVIMetadata, |
| 2273 | m_iChromaScaling, convertType, true, |
| 2274 | &pShaderCode); |
| 2275 | if (S_OK == hr) { |
| 2276 | hr = m_pD3DDevEx->CreatePixelShader((const DWORD*)pShaderCode->GetBufferPointer(), &m_pPSConvertColorDeint); |
| 2277 | pShaderCode->Release(); |
| 2278 | } |
| 2279 | } |
| 2280 | |
| 2281 | const float dx = 1.0f / m_TexSrcVideo.Width; |
| 2282 | const float dy = 1.0f / m_TexSrcVideo.Height; |
| 2283 | float sx = 0.0f; |
| 2284 | float sy = 0.0f; |
| 2285 | |
| 2286 | if (m_srcParams.cformat != CF_YUY2 && m_srcParams.cformat != CF_UYVY && m_iChromaScaling == CHROMA_Bilinear) { |
| 2287 | if (m_srcParams.Subsampling == 420) { |
| 2288 | switch (m_srcExFmt.VideoChromaSubsampling) { |
| 2289 | case DXVA2_VideoChromaSubsampling_Cosited: |
| 2290 | sx = 0.5f * dx; |
| 2291 | sy = 0.5f * dy; |
| 2292 | break; |
| 2293 | case DXVA2_VideoChromaSubsampling_MPEG1: |
| 2294 | //nothing; |
| 2295 | break; |
| 2296 | case DXVA2_VideoChromaSubsampling_MPEG2: |
| 2297 | default: |
| 2298 | sx = 0.5f * dx; |
| 2299 | } |
| 2300 | } |
| 2301 | else if (m_srcParams.Subsampling == 422) { |
| 2302 | sx = 0.5f * dx; |
nothing calls this directly
no test coverage detected