| 811 | } |
| 812 | |
| 813 | void CDX11VideoProcessor::SetShaderConvertColorParams() |
| 814 | { |
| 815 | mp_cmat cmatrix; |
| 816 | |
| 817 | if (m_Dovi.bValid) { |
| 818 | const float brightness = DXVA2FixedToFloat(m_DXVA2ProcAmpValues.Brightness) / 255; |
| 819 | const float contrast = DXVA2FixedToFloat(m_DXVA2ProcAmpValues.Contrast); |
| 820 | |
| 821 | for (int i = 0; i < 3; i++) { |
| 822 | cmatrix.m[i][0] = (float)m_Dovi.msd.ColorMetadata.ycc_to_rgb_matrix[i * 3 + 0] * contrast; |
| 823 | cmatrix.m[i][1] = (float)m_Dovi.msd.ColorMetadata.ycc_to_rgb_matrix[i * 3 + 1] * contrast; |
| 824 | cmatrix.m[i][2] = (float)m_Dovi.msd.ColorMetadata.ycc_to_rgb_matrix[i * 3 + 2] * contrast; |
| 825 | } |
| 826 | |
| 827 | for (int i = 0; i < 3; i++) { |
| 828 | cmatrix.c[i] = brightness; |
| 829 | for (int j = 0; j < 3; j++) { |
| 830 | cmatrix.c[i] -= cmatrix.m[i][j] * m_Dovi.msd.ColorMetadata.ycc_to_rgb_offset[j]; |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | m_PSConvColorData.bEnable = true; |
| 835 | } |
| 836 | else { |
| 837 | mp_csp_params csp_params; |
| 838 | set_colorspace(m_srcExFmt, csp_params.color); |
| 839 | csp_params.brightness = DXVA2FixedToFloat(m_DXVA2ProcAmpValues.Brightness) / 255; |
| 840 | csp_params.contrast = DXVA2FixedToFloat(m_DXVA2ProcAmpValues.Contrast); |
| 841 | csp_params.hue = DXVA2FixedToFloat(m_DXVA2ProcAmpValues.Hue) / 180 * acos(-1); |
| 842 | csp_params.saturation = DXVA2FixedToFloat(m_DXVA2ProcAmpValues.Saturation); |
| 843 | csp_params.gray = m_srcParams.CSType == CS_GRAY; |
| 844 | |
| 845 | csp_params.input_bits = csp_params.texture_bits = m_srcParams.CDepth; |
| 846 | |
| 847 | mp_get_csp_matrix(&csp_params, &cmatrix); |
| 848 | |
| 849 | m_PSConvColorData.bEnable = |
| 850 | m_srcParams.CSType == CS_YUV || |
| 851 | m_srcParams.cformat == CF_GBRP8 || m_srcParams.cformat == CF_GBRP10 || m_srcParams.cformat == CF_GBRP16 || |
| 852 | csp_params.gray || |
| 853 | fabs(csp_params.brightness) > 1e-4f || fabs(csp_params.contrast - 1.0f) > 1e-4f; |
| 854 | } |
| 855 | |
| 856 | PS_COLOR_TRANSFORM cbuffer = { |
| 857 | {cmatrix.m[0][0], cmatrix.m[0][1], cmatrix.m[0][2], 0}, |
| 858 | {cmatrix.m[1][0], cmatrix.m[1][1], cmatrix.m[1][2], 0}, |
| 859 | {cmatrix.m[2][0], cmatrix.m[2][1], cmatrix.m[2][2], 0}, |
| 860 | {cmatrix.c[0], cmatrix.c[1], cmatrix.c[2], 0}, |
| 861 | }; |
| 862 | |
| 863 | if (m_srcParams.cformat == CF_GBRP8 || m_srcParams.cformat == CF_GBRP10 || m_srcParams.cformat == CF_GBRP16) { |
| 864 | std::swap(cbuffer.cm_r.x, cbuffer.cm_r.y); std::swap(cbuffer.cm_r.y, cbuffer.cm_r.z); |
| 865 | std::swap(cbuffer.cm_g.x, cbuffer.cm_g.y); std::swap(cbuffer.cm_g.y, cbuffer.cm_g.z); |
| 866 | std::swap(cbuffer.cm_b.x, cbuffer.cm_b.y); std::swap(cbuffer.cm_b.y, cbuffer.cm_b.z); |
| 867 | } |
| 868 | else if (m_srcParams.CSType == CS_GRAY) { |
| 869 | cbuffer.cm_g.x = cbuffer.cm_g.y; |
| 870 | cbuffer.cm_g.y = 0; |
nothing calls this directly
no test coverage detected